code
stringlengths
31
1.39M
docstring
stringlengths
23
16.8k
func_name
stringlengths
1
126
language
stringclasses
1 value
repo
stringlengths
7
63
path
stringlengths
7
166
url
stringlengths
50
220
license
stringclasses
7 values
function &parent() { $return = null; return $return; }
Get parent element. NOT implemented. @return object @access public
parent
php
Datawalke/Coordino
cake/libs/xml.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/xml.php
MIT
function addNamespace($prefix, $url) { if ($count = count($this->children)) { for ($i = 0; $i < $count; $i++) { $this->children[$i]->addNamespace($prefix, $url); } return true; } return parent::addNamespace($prefix, $url); }
Adds a namespace to the current document @param string $prefix The namespace prefix @param string $url The namespace DTD URL @return void
addNamespace
php
Datawalke/Coordino
cake/libs/xml.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/xml.php
MIT
function removeNamespace($prefix) { if ($count = count($this->children)) { for ($i = 0; $i < $count; $i++) { $this->children[$i]->removeNamespace($prefix); } return true; } return parent::removeNamespace($prefix); }
Removes a namespace to the current document @param string $prefix The namespace prefix @return void
removeNamespace
php
Datawalke/Coordino
cake/libs/xml.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/xml.php
MIT
function toString($options = array()) { if (is_bool($options)) { $options = array('header' => $options); } $defaults = array('header' => false, 'encoding' => $this->encoding); $options = array_merge($defaults, Xml::options(), $options); $data = parent::toString($options, 0); if ($options['header']) { if (!empty($this->__header)) { return $this->header($this->__header) . "\n" . $data; } return $this->header() . "\n" . $data; } return $data; }
Return string representation of current object. @return string String representation @access public
toString
php
Datawalke/Coordino
cake/libs/xml.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/xml.php
MIT
function header($attrib = array()) { $header = 'xml'; if (is_string($attrib)) { $header = $attrib; } else { $attrib = array_merge(array('version' => $this->version, 'encoding' => $this->encoding), $attrib); foreach ($attrib as $key=>$val) { $header .= ' ' . $key . '="' . $val . '"'; } } return '<' . '?' . $header . ' ?' . '>'; }
Return a header used on the first line of the xml file @param mixed $attrib attributes of the header element @return string formated header
header
php
Datawalke/Coordino
cake/libs/xml.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/xml.php
MIT
function addGlobalNs($name, $url = null) { $_this =& XmlManager::getInstance(); if ($ns = Xml::resolveNamespace($name, $url)) { $_this->namespaces = array_merge($_this->namespaces, $ns); return $ns; } return false; }
Adds a namespace to any XML documents generated or parsed @param string $name The namespace name @param string $url The namespace URI; can be empty if in the default namespace map @return boolean False if no URL is specified, and the namespace does not exist default namespace map, otherwise true @access public @static
addGlobalNs
php
Datawalke/Coordino
cake/libs/xml.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/xml.php
MIT
function resolveNamespace($name, $url) { $_this =& XmlManager::getInstance(); if ($url == null && isset($_this->defaultNamespaceMap[$name])) { $url = $_this->defaultNamespaceMap[$name]; } elseif ($url == null) { return false; } if (!strpos($url, '://') && isset($_this->defaultNamespaceMap[$name])) { $_url = $_this->defaultNamespaceMap[$name]; $name = $url; $url = $_url; } return array($name => $url); }
Resolves current namespace @param string $name @param string $url @return array
resolveNamespace
php
Datawalke/Coordino
cake/libs/xml.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/xml.php
MIT
function addGlobalNamespace($name, $url = null) { return Xml::addGlobalNs($name, $url); }
Alias to Xml::addNs @access public @static
addGlobalNamespace
php
Datawalke/Coordino
cake/libs/xml.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/xml.php
MIT
function removeGlobalNs($name) { $_this =& XmlManager::getInstance(); if (isset($_this->namespaces[$name])) { unset($_this->namespaces[$name]); unset($this->namespaces[$name]); return true; } elseif (in_array($name, $_this->namespaces)) { $keys = array_keys($_this->namespaces); $count = count($keys); for ($i = 0; $i < $count; $i++) { if ($_this->namespaces[$keys[$i]] == $name) { unset($_this->namespaces[$keys[$i]]); unset($this->namespaces[$keys[$i]]); return true; } } } return false; }
Removes a namespace added in addNs() @param string $name The namespace name or URI @access public @static
removeGlobalNs
php
Datawalke/Coordino
cake/libs/xml.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/xml.php
MIT
function removeGlobalNamespace($name) { return Xml::removeGlobalNs($name); }
Alias to Xml::removeNs @access public @static
removeGlobalNamespace
php
Datawalke/Coordino
cake/libs/xml.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/xml.php
MIT
function options($options = array()) { $_this =& XmlManager::getInstance(); $_this->options = array_merge($_this->options, $options); return $_this->options; }
Sets/gets global XML options @param array $options @return array @access public @static
options
php
Datawalke/Coordino
cake/libs/xml.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/xml.php
MIT
function __construct($name = null, $value = null, $attributes = array(), $namespace = false) { parent::__construct($name, $value, $namespace); $this->addAttribute($attributes); }
Construct an Xml element @param string $name name of the node @param string $value value of the node @param array $attributes @param string $namespace @return string A copy of $data in XML format
__construct
php
Datawalke/Coordino
cake/libs/xml.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/xml.php
MIT
function attributes() { return $this->attributes; }
Get all the attributes for this element @return array
attributes
php
Datawalke/Coordino
cake/libs/xml.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/xml.php
MIT
function addAttribute($name, $val = null) { if (is_object($name)) { $name = get_object_vars($name); } if (is_array($name)) { foreach ($name as $key => $val) { $this->addAttribute($key, $val); } return true; } if (is_numeric($name)) { $name = $val; $val = null; } if (!empty($name)) { if (strpos($name, 'xmlns') === 0) { if ($name == 'xmlns') { $this->namespace = $val; } else { list($pre, $prefix) = explode(':', $name); $this->addNamespace($prefix, $val); return true; } } $this->attributes[$name] = $val; return true; } return false; }
Add attributes to this element @param string $name name of the node @param string $value value of the node @return boolean
addAttribute
php
Datawalke/Coordino
cake/libs/xml.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/xml.php
MIT
function removeAttribute($attr) { if (array_key_exists($attr, $this->attributes)) { unset($this->attributes[$attr]); return true; } return false; }
Remove attributes to this element @param string $name name of the node @return boolean
removeAttribute
php
Datawalke/Coordino
cake/libs/xml.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/xml.php
MIT
function __construct($value = null) { $this->value = $value; }
Construct text node with the given parent object and data @param object $parent Parent XmlNode/XmlElement object @param mixed $value Node value
__construct
php
Datawalke/Coordino
cake/libs/xml.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/xml.php
MIT
function hasChildren() { return false; }
Looks for child nodes in this element @return boolean False - not supported
hasChildren
php
Datawalke/Coordino
cake/libs/xml.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/xml.php
MIT
function append() { return false; }
Append an XML node: XmlTextNode does not support this operation @return boolean False - not supported @todo make convertEntities work without mb support, convert entities to number entities
append
php
Datawalke/Coordino
cake/libs/xml.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/xml.php
MIT
function toString($options = array(), $depth = 0) { if (is_int($options)) { $depth = $options; $options = array(); } $defaults = array('cdata' => true, 'whitespace' => false, 'convertEntities' => false); $options = array_merge($defaults, Xml::options(), $options); $val = $this->value; if ($options['convertEntities'] && function_exists('mb_convert_encoding')) { $val = mb_convert_encoding($val,'UTF-8', 'HTML-ENTITIES'); } if ($options['cdata'] === true && !is_numeric($val)) { $val = '<![CDATA[' . $val . ']]>'; } if ($options['whitespace']) { return str_repeat("\t", $depth) . $val . "\n"; } return $val; }
Return string representation of current text node object. @return string String representation @access public
toString
php
Datawalke/Coordino
cake/libs/xml.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/xml.php
MIT
function &getInstance() { static $instance = array(); if (!$instance) { $instance[0] =& new XmlManager(); } return $instance[0]; }
Returns a reference to the global XML object that manages app-wide XML settings @return object @access public
getInstance
php
Datawalke/Coordino
cake/libs/xml.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/xml.php
MIT
function init($settings = array()) { parent::init(array_merge(array('engine' => 'Apc', 'prefix' => Inflector::slug(APP_DIR) . '_'), $settings)); return function_exists('apc_cache_info'); }
Initialize the Cache Engine Called automatically by the cache frontend To reinitialize the settings call Cache::engine('EngineName', [optional] settings = array()); @param array $setting array of setting for the engine @return boolean True if the engine has been successfully initialized, false if not @see CacheEngine::__defaults @access public
init
php
Datawalke/Coordino
cake/libs/cache/apc.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/cache/apc.php
MIT
function write($key, &$value, $duration) { if ($duration == 0) { $expires = 0; } else { $expires = time() + $duration; } apc_store($key.'_expires', $expires, $duration); return apc_store($key, $value, $duration); }
Write data for key into cache @param string $key Identifier for the data @param mixed $value Data to be cached @param integer $duration How long to cache the data, in seconds @return boolean True if the data was succesfully cached, false on failure @access public
write
php
Datawalke/Coordino
cake/libs/cache/apc.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/cache/apc.php
MIT
function read($key) { $time = time(); $cachetime = intval(apc_fetch($key.'_expires')); if ($cachetime !== 0 && ($cachetime < $time || ($time + $this->settings['duration']) < $cachetime)) { return false; } return apc_fetch($key); }
Read a key from the cache @param string $key Identifier for the data @return mixed The cached data, or false if the data doesn't exist, has expired, or if there was an error fetching it @access public
read
php
Datawalke/Coordino
cake/libs/cache/apc.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/cache/apc.php
MIT
function increment($key, $offset = 1) { return apc_inc($key, $offset); }
Increments the value of an integer cached key @param string $key Identifier for the data @param integer $offset How much to increment @param integer $duration How long to cache the data, in seconds @return New incremented value, false otherwise @access public
increment
php
Datawalke/Coordino
cake/libs/cache/apc.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/cache/apc.php
MIT
function decrement($key, $offset = 1) { return apc_dec($key, $offset); }
Decrements the value of an integer cached key @param string $key Identifier for the data @param integer $offset How much to substract @param integer $duration How long to cache the data, in seconds @return New decremented value, false otherwise @access public
decrement
php
Datawalke/Coordino
cake/libs/cache/apc.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/cache/apc.php
MIT
function delete($key) { return apc_delete($key); }
Delete a key from the cache @param string $key Identifier for the data @return boolean True if the value was succesfully deleted, false if it didn't exist or couldn't be removed @access public
delete
php
Datawalke/Coordino
cake/libs/cache/apc.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/cache/apc.php
MIT
function clear() { return apc_clear_cache('user'); }
Delete all keys from the cache @return boolean True if the cache was succesfully cleared, false otherwise @access public
clear
php
Datawalke/Coordino
cake/libs/cache/apc.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/cache/apc.php
MIT
function init($settings = array()) { parent::init(array_merge( array( 'engine' => 'File', 'path' => CACHE, 'prefix'=> 'cake_', 'lock'=> false, 'serialize'=> true, 'isWindows' => false ), $settings )); if (!isset($this->_File)) { $this->_File =& new File($this->settings['path'] . DS . 'cake'); } if (DIRECTORY_SEPARATOR === '\\') { $this->settings['isWindows'] = true; } $path = $this->_File->Folder->cd($this->settings['path']); if ($path) { $this->settings['path'] = $path; } return $this->__active(); }
Initialize the Cache Engine Called automatically by the cache frontend To reinitialize the settings call Cache::engine('EngineName', [optional] settings = array()); @param array $setting array of setting for the engine @return boolean True if the engine has been successfully initialized, false if not @access public
init
php
Datawalke/Coordino
cake/libs/cache/file.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/cache/file.php
MIT
function gc() { return $this->clear(true); }
Garbage collection. Permanently remove all expired and deleted data @return boolean True if garbage collection was succesful, false on failure @access public
gc
php
Datawalke/Coordino
cake/libs/cache/file.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/cache/file.php
MIT
function write($key, &$data, $duration) { if ($data === '' || !$this->_init) { return false; } if ($this->_setKey($key) === false) { return false; } $lineBreak = "\n"; if ($this->settings['isWindows']) { $lineBreak = "\r\n"; } if (!empty($this->settings['serialize'])) { if ($this->settings['isWindows']) { $data = str_replace('\\', '\\\\\\\\', serialize($data)); } else { $data = serialize($data); } } $expires = time() + $duration; $contents = $expires . $lineBreak . $data . $lineBreak; $old = umask(0); $handle = fopen($this->_File->path, 'a'); umask($old); if (!$handle) { return false; } if ($this->settings['lock']) { flock($handle, LOCK_EX); } $success = ftruncate($handle, 0) && fwrite($handle, $contents) && fflush($handle); if ($this->settings['lock']) { flock($handle, LOCK_UN); } fclose($handle); return $success; }
Write data for key into cache @param string $key Identifier for the data @param mixed $data Data to be cached @param mixed $duration How long to cache the data, in seconds @return boolean True if the data was succesfully cached, false on failure @access public
write
php
Datawalke/Coordino
cake/libs/cache/file.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/cache/file.php
MIT
function read($key) { if ($this->_setKey($key) === false || !$this->_init || !$this->_File->exists()) { return false; } if ($this->settings['lock']) { $this->_File->lock = true; } $time = time(); $cachetime = intval($this->_File->read(11)); if ($cachetime !== false && ($cachetime < $time || ($time + $this->settings['duration']) < $cachetime)) { $this->_File->close(); return false; } $data = $this->_File->read(true); if ($data !== '' && !empty($this->settings['serialize'])) { if ($this->settings['isWindows']) { $data = str_replace('\\\\\\\\', '\\', $data); } $data = unserialize((string)$data); } $this->_File->close(); return $data; }
Read a key from the cache @param string $key Identifier for the data @return mixed The cached data, or false if the data doesn't exist, has expired, or if there was an error fetching it @access public
read
php
Datawalke/Coordino
cake/libs/cache/file.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/cache/file.php
MIT
function delete($key) { if ($this->_setKey($key) === false || !$this->_init) { return false; } return $this->_File->delete(); }
Delete a key from the cache @param string $key Identifier for the data @return boolean True if the value was successfully deleted, false if it didn't exist or couldn't be removed @access public
delete
php
Datawalke/Coordino
cake/libs/cache/file.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/cache/file.php
MIT
function clear($check) { if (!$this->_init) { return false; } $dir = dir($this->settings['path']); if ($check) { $now = time(); $threshold = $now - $this->settings['duration']; } $prefixLength = strlen($this->settings['prefix']); while (($entry = $dir->read()) !== false) { if (substr($entry, 0, $prefixLength) !== $this->settings['prefix']) { continue; } if ($this->_setKey($entry) === false) { continue; } if ($check) { $mtime = $this->_File->lastChange(); if ($mtime === false || $mtime > $threshold) { continue; } $expires = $this->_File->read(11); $this->_File->close(); if ($expires > $now) { continue; } } $this->_File->delete(); } $dir->close(); return true; }
Delete all values from the cache @param boolean $check Optional - only delete expired cache items @return boolean True if the cache was succesfully cleared, false otherwise @access public
clear
php
Datawalke/Coordino
cake/libs/cache/file.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/cache/file.php
MIT
function _setKey($key) { $this->_File->Folder->cd($this->settings['path']); if ($key !== $this->_File->name) { $this->_File->name = $key; $this->_File->path = null; } if (!$this->_File->Folder->inPath($this->_File->pwd(), true)) { return false; } }
Get absolute file for a given key @param string $key The key @return mixed Absolute cache file for the given key or false if erroneous @access private
_setKey
php
Datawalke/Coordino
cake/libs/cache/file.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/cache/file.php
MIT
function __active() { if ($this->_init && !is_writable($this->settings['path'])) { $this->_init = false; trigger_error(sprintf(__('%s is not writable', true), $this->settings['path']), E_USER_WARNING); return false; } return true; }
Determine is cache directory is writable @return boolean @access private
__active
php
Datawalke/Coordino
cake/libs/cache/file.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/cache/file.php
MIT
function init($settings = array()) { if (!class_exists('Memcache')) { return false; } parent::init(array_merge(array( 'engine'=> 'Memcache', 'prefix' => Inflector::slug(APP_DIR) . '_', 'servers' => array('127.0.0.1'), 'compress'=> false, 'persistent' => true ), $settings) ); if ($this->settings['compress']) { $this->settings['compress'] = MEMCACHE_COMPRESSED; } if (!is_array($this->settings['servers'])) { $this->settings['servers'] = array($this->settings['servers']); } if (!isset($this->__Memcache)) { $return = false; $this->__Memcache =& new Memcache(); foreach ($this->settings['servers'] as $server) { list($host, $port) = $this->_parseServerString($server); if ($this->__Memcache->addServer($host, $port, $this->settings['persistent'])) { $return = true; } } return $return; } return true; }
Initialize the Cache Engine Called automatically by the cache frontend To reinitialize the settings call Cache::engine('EngineName', [optional] settings = array()); @param array $setting array of setting for the engine @return boolean True if the engine has been successfully initialized, false if not @access public
init
php
Datawalke/Coordino
cake/libs/cache/memcache.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/cache/memcache.php
MIT
function _parseServerString($server) { if ($server[0] == 'u') { return array($server, 0); } if (substr($server, 0, 1) == '[') { $position = strpos($server, ']:'); if ($position !== false) { $position++; } } else { $position = strpos($server, ':'); } $port = 11211; $host = $server; if ($position !== false) { $host = substr($server, 0, $position); $port = substr($server, $position + 1); } return array($host, $port); }
Parses the server address into the host/port. Handles both IPv6 and IPv4 addresses and Unix sockets @param string $server The server address string. @return array Array containing host, port
_parseServerString
php
Datawalke/Coordino
cake/libs/cache/memcache.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/cache/memcache.php
MIT
function write($key, &$value, $duration) { if ($duration > 30 * DAY) { $duration = 0; } return $this->__Memcache->set($key, $value, $this->settings['compress'], $duration); }
Write data for key into cache. When using memcache as your cache engine remember that the Memcache pecl extension does not support cache expiry times greater than 30 days in the future. Any duration greater than 30 days will be treated as never expiring. @param string $key Identifier for the data @param mixed $value Data to be cached @param integer $duration How long to cache the data, in seconds @return boolean True if the data was succesfully cached, false on failure @see http://php.net/manual/en/memcache.set.php @access public
write
php
Datawalke/Coordino
cake/libs/cache/memcache.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/cache/memcache.php
MIT
function read($key) { return $this->__Memcache->get($key); }
Read a key from the cache @param string $key Identifier for the data @return mixed The cached data, or false if the data doesn't exist, has expired, or if there was an error fetching it @access public
read
php
Datawalke/Coordino
cake/libs/cache/memcache.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/cache/memcache.php
MIT
function increment($key, $offset = 1) { if ($this->settings['compress']) { trigger_error(sprintf(__('Method increment() not implemented for compressed cache in %s', true), get_class($this)), E_USER_ERROR); } return $this->__Memcache->increment($key, $offset); }
Increments the value of an integer cached key @param string $key Identifier for the data @param integer $offset How much to increment @param integer $duration How long to cache the data, in seconds @return New incremented value, false otherwise @access public
increment
php
Datawalke/Coordino
cake/libs/cache/memcache.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/cache/memcache.php
MIT
function decrement($key, $offset = 1) { if ($this->settings['compress']) { trigger_error(sprintf(__('Method decrement() not implemented for compressed cache in %s', true), get_class($this)), E_USER_ERROR); } return $this->__Memcache->decrement($key, $offset); }
Decrements the value of an integer cached key @param string $key Identifier for the data @param integer $offset How much to substract @param integer $duration How long to cache the data, in seconds @return New decremented value, false otherwise @access public
decrement
php
Datawalke/Coordino
cake/libs/cache/memcache.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/cache/memcache.php
MIT
function delete($key) { return $this->__Memcache->delete($key); }
Delete a key from the cache @param string $key Identifier for the data @return boolean True if the value was succesfully deleted, false if it didn't exist or couldn't be removed @access public
delete
php
Datawalke/Coordino
cake/libs/cache/memcache.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/cache/memcache.php
MIT
function clear() { return $this->__Memcache->flush(); }
Delete all keys from the cache @return boolean True if the cache was succesfully cleared, false otherwise @access public
clear
php
Datawalke/Coordino
cake/libs/cache/memcache.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/cache/memcache.php
MIT
function connect($host, $port = 11211) { if ($this->__Memcache->getServerStatus($host, $port) === 0) { if ($this->__Memcache->connect($host, $port)) { return true; } return false; } return true; }
Connects to a server in connection pool @param string $host host ip address or name @param integer $port Server port @return boolean True if memcache server was connected @access public
connect
php
Datawalke/Coordino
cake/libs/cache/memcache.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/cache/memcache.php
MIT
function init($settings) { parent::init(array_merge(array( 'engine' => 'Xcache', 'prefix' => Inflector::slug(APP_DIR) . '_', 'PHP_AUTH_USER' => 'user', 'PHP_AUTH_PW' => 'password' ), $settings) ); return function_exists('xcache_info'); }
Initialize the Cache Engine Called automatically by the cache frontend To reinitialize the settings call Cache::engine('EngineName', [optional] settings = array()); @param array $setting array of setting for the engine @return boolean True if the engine has been successfully initialized, false if not @access public
init
php
Datawalke/Coordino
cake/libs/cache/xcache.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/cache/xcache.php
MIT
function write($key, &$value, $duration) { $expires = time() + $duration; xcache_set($key . '_expires', $expires, $duration); return xcache_set($key, $value, $duration); }
Write data for key into cache @param string $key Identifier for the data @param mixed $value Data to be cached @param integer $duration How long to cache the data, in seconds @return boolean True if the data was succesfully cached, false on failure @access public
write
php
Datawalke/Coordino
cake/libs/cache/xcache.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/cache/xcache.php
MIT
function read($key) { if (xcache_isset($key)) { $time = time(); $cachetime = intval(xcache_get($key . '_expires')); if ($cachetime < $time || ($time + $this->settings['duration']) < $cachetime) { return false; } return xcache_get($key); } return false; }
Read a key from the cache @param string $key Identifier for the data @return mixed The cached data, or false if the data doesn't exist, has expired, or if there was an error fetching it @access public
read
php
Datawalke/Coordino
cake/libs/cache/xcache.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/cache/xcache.php
MIT
function increment($key, $offset = 1) { return xcache_inc($key, $offset); }
Increments the value of an integer cached key If the cache key is not an integer it will be treated as 0 @param string $key Identifier for the data @param integer $offset How much to increment @param integer $duration How long to cache the data, in seconds @return New incremented value, false otherwise @access public
increment
php
Datawalke/Coordino
cake/libs/cache/xcache.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/cache/xcache.php
MIT
function decrement($key, $offset = 1) { return xcache_dec($key, $offset); }
Decrements the value of an integer cached key. If the cache key is not an integer it will be treated as 0 @param string $key Identifier for the data @param integer $offset How much to substract @param integer $duration How long to cache the data, in seconds @return New decremented value, false otherwise @access public
decrement
php
Datawalke/Coordino
cake/libs/cache/xcache.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/cache/xcache.php
MIT
function delete($key) { return xcache_unset($key); }
Delete a key from the cache @param string $key Identifier for the data @return boolean True if the value was succesfully deleted, false if it didn't exist or couldn't be removed @access public
delete
php
Datawalke/Coordino
cake/libs/cache/xcache.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/cache/xcache.php
MIT
function clear() { $this->__auth(); $max = xcache_count(XC_TYPE_VAR); for ($i = 0; $i < $max; $i++) { xcache_clear_cache(XC_TYPE_VAR, $i); } $this->__auth(true); return true; }
Delete all keys from the cache @return boolean True if the cache was succesfully cleared, false otherwise @access public
clear
php
Datawalke/Coordino
cake/libs/cache/xcache.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/cache/xcache.php
MIT
function __auth($reverse = false) { static $backup = array(); $keys = array('PHP_AUTH_USER' => 'user', 'PHP_AUTH_PW' => 'password'); foreach ($keys as $key => $setting) { if ($reverse) { if (isset($backup[$key])) { $_SERVER[$key] = $backup[$key]; unset($backup[$key]); } else { unset($_SERVER[$key]); } } else { $value = env($key); if (!empty($value)) { $backup[$key] = $value; } if (!empty($this->settings[$setting])) { $_SERVER[$key] = $this->settings[$setting]; } else if (!empty($this->settings[$key])) { $_SERVER[$key] = $this->settings[$key]; } else { $_SERVER[$key] = $value; } } } }
Populates and reverses $_SERVER authentication values Makes necessary changes (and reverting them back) in $_SERVER This has to be done because xcache_clear_cache() needs to pass Basic Http Auth (see xcache.admin configuration settings) @param boolean Revert changes @access private
__auth
php
Datawalke/Coordino
cake/libs/cache/xcache.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/cache/xcache.php
MIT
function init(&$controller) { if (!is_array($controller->components)) { return; } $this->__controllerVars = array( 'plugin' => $controller->plugin, 'name' => $controller->name, 'base' => $controller->base ); $this->_loadComponents($controller); }
Used to initialize the components for current controller. @param object $controller Controller with components to load @return void @access public
init
php
Datawalke/Coordino
cake/libs/controller/component.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/component.php
MIT
function initialize(&$controller) { foreach (array_keys($this->_loaded) as $name) { $component =& $this->_loaded[$name]; if (method_exists($component,'initialize') && $component->enabled === true) { $settings = array(); if (isset($this->__settings[$name])) { $settings = $this->__settings[$name]; } $component->initialize($controller, $settings); } } }
Called before the Controller::beforeFilter(). @param object $controller Controller with components to initialize @return void @access public @link http://book.cakephp.org/view/998/MVC-Class-Access-Within-Components
initialize
php
Datawalke/Coordino
cake/libs/controller/component.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/component.php
MIT
function startup(&$controller) { $this->triggerCallback('startup', $controller); }
Called after the Controller::beforeFilter() and before the controller action @param object $controller Controller with components to startup @return void @access public @link http://book.cakephp.org/view/998/MVC-Class-Access-Within-Components @deprecated See Component::triggerCallback()
startup
php
Datawalke/Coordino
cake/libs/controller/component.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/component.php
MIT
function beforeRender(&$controller) { $this->triggerCallback('beforeRender', $controller); }
Called after the Controller::beforeRender(), after the view class is loaded, and before the Controller::render() @param object $controller Controller with components to beforeRender @return void @access public @deprecated See Component::triggerCallback()
beforeRender
php
Datawalke/Coordino
cake/libs/controller/component.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/component.php
MIT
function beforeRedirect(&$controller, $url, $status = null, $exit = true) { $response = array(); foreach ($this->_primary as $name) { $component =& $this->_loaded[$name]; if ($component->enabled === true && method_exists($component, 'beforeRedirect')) { $resp = $component->beforeRedirect($controller, $url, $status, $exit); if ($resp === false) { return false; } $response[] = $resp; } } return $response; }
Called before Controller::redirect(). @param object $controller Controller with components to beforeRedirect @return void @access public
beforeRedirect
php
Datawalke/Coordino
cake/libs/controller/component.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/component.php
MIT
function shutdown(&$controller) { $this->triggerCallback('shutdown', $controller); }
Called after Controller::render() and before the output is printed to the browser. @param object $controller Controller with components to shutdown @return void @access public @deprecated See Component::triggerCallback()
shutdown
php
Datawalke/Coordino
cake/libs/controller/component.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/component.php
MIT
function triggerCallback($callback, &$controller) { foreach ($this->_primary as $name) { $component =& $this->_loaded[$name]; if (method_exists($component, $callback) && $component->enabled === true) { $component->{$callback}($controller); } } }
Trigger a callback on all primary components. Will fire $callback on all components that have such a method. You can implement and fire custom callbacks in addition to the standard ones. example use, from inside a controller: `$this->Component->triggerCallback('beforeFilter', $this);` will trigger the beforeFilter callback on all components that have implemented one. You can trigger any method in this fashion. @param Controller $controller Controller instance @param string $callback Callback to trigger. @return void @access public
triggerCallback
php
Datawalke/Coordino
cake/libs/controller/component.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/component.php
MIT
function _loadComponents(&$object, $parent = null) { $base = $this->__controllerVars['base']; $normal = Set::normalize($object->components); foreach ((array)$normal as $component => $config) { $plugin = isset($this->__controllerVars['plugin']) ? $this->__controllerVars['plugin'] . '.' : null; list($plugin, $component) = pluginSplit($component, true, $plugin); $componentCn = $component . 'Component'; if (!class_exists($componentCn)) { if (is_null($plugin) || !App::import('Component', $plugin . $component)) { if (!App::import('Component', $component)) { $this->cakeError('missingComponentFile', array(array( 'className' => $this->__controllerVars['name'], 'component' => $component, 'file' => Inflector::underscore($component) . '.php', 'base' => $base, 'code' => 500 ))); return false; } } if (!class_exists($componentCn)) { $this->cakeError('missingComponentClass', array(array( 'className' => $this->__controllerVars['name'], 'component' => $component, 'file' => Inflector::underscore($component) . '.php', 'base' => $base, 'code' => 500 ))); return false; } } if ($parent === null) { $this->_primary[] = $component; } if (isset($this->_loaded[$component])) { $object->{$component} =& $this->_loaded[$component]; if (!empty($config) && isset($this->__settings[$component])) { $this->__settings[$component] = array_merge($this->__settings[$component], $config); } elseif (!empty($config)) { $this->__settings[$component] = $config; } } else { if ($componentCn === 'SessionComponent') { $object->{$component} =& new $componentCn($base); } else { if (PHP5) { $object->{$component} = new $componentCn(); } else { $object->{$component} =& new $componentCn(); } } $object->{$component}->enabled = true; $this->_loaded[$component] =& $object->{$component}; if (!empty($config)) { $this->__settings[$component] = $config; } if (isset($object->{$component}->components) && is_array($object->{$component}->components) && (!isset($object->{$component}->{$parent}))) { $this->_loadComponents($object->{$component}, $component); } } } }
Loads components used by this component. @param object $object Object with a Components array @param object $parent the parent of the current object @return void @access protected
_loadComponents
php
Datawalke/Coordino
cake/libs/controller/component.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/component.php
MIT
function __mergeVars() { $pluginName = Inflector::camelize($this->plugin); $pluginController = $pluginName . 'AppController'; if (is_subclass_of($this, 'AppController') || is_subclass_of($this, $pluginController)) { $appVars = get_class_vars('AppController'); $uses = $appVars['uses']; $merge = array('components', 'helpers'); $plugin = null; if (!empty($this->plugin)) { $plugin = $pluginName . '.'; if (!is_subclass_of($this, $pluginController)) { $pluginController = null; } } else { $pluginController = null; } if ($uses == $this->uses && !empty($this->uses)) { if (!in_array($plugin . $this->modelClass, $this->uses)) { array_unshift($this->uses, $plugin . $this->modelClass); } elseif ($this->uses[0] !== $plugin . $this->modelClass) { $this->uses = array_flip($this->uses); unset($this->uses[$plugin . $this->modelClass]); $this->uses = array_flip($this->uses); array_unshift($this->uses, $plugin . $this->modelClass); } } else { $merge[] = 'uses'; } foreach ($merge as $var) { if (!empty($appVars[$var]) && is_array($this->{$var})) { if ($var !== 'uses') { $normal = Set::normalize($this->{$var}); $app = Set::normalize($appVars[$var]); if ($app !== $normal) { $this->{$var} = Set::merge($app, $normal); } } else { $this->{$var} = array_merge($this->{$var}, array_diff($appVars[$var], $this->{$var})); } } } } if ($pluginController && $pluginName != null) { $appVars = get_class_vars($pluginController); $uses = $appVars['uses']; $merge = array('components', 'helpers'); if ($this->uses !== null && $this->uses !== false) { $merge[] = 'uses'; } foreach ($merge as $var) { if (isset($appVars[$var]) && !empty($appVars[$var]) && is_array($this->{$var})) { if ($var !== 'uses') { $normal = Set::normalize($this->{$var}); $app = Set::normalize($appVars[$var]); if ($app !== $normal) { $this->{$var} = Set::merge($app, $normal); } } else { $this->{$var} = array_merge($this->{$var}, array_diff($appVars[$var], $this->{$var})); } } } } }
Merge components, helpers, and uses vars from AppController and PluginAppController. @return void @access protected
__mergeVars
php
Datawalke/Coordino
cake/libs/controller/controller.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/controller.php
MIT
function constructClasses() { $this->__mergeVars(); $this->Component->init($this); if ($this->uses !== null || ($this->uses !== array())) { if (empty($this->passedArgs) || !isset($this->passedArgs['0'])) { $id = false; } else { $id = $this->passedArgs['0']; } if ($this->uses === false) { $this->loadModel($this->modelClass, $id); } elseif ($this->uses) { $uses = is_array($this->uses) ? $this->uses : array($this->uses); $modelClassName = $uses[0]; if (strpos($uses[0], '.') !== false) { list($plugin, $modelClassName) = explode('.', $uses[0]); } $this->modelClass = $modelClassName; foreach ($uses as $modelClass) { $this->loadModel($modelClass); } } } return true; }
Loads Model classes based on the uses property see Controller::loadModel(); for more info. Loads Components and prepares them for initialization. @return mixed true if models found and instance created, or cakeError if models not found. @access public @see Controller::loadModel() @link http://book.cakephp.org/view/977/Controller-Methods#constructClasses-986
constructClasses
php
Datawalke/Coordino
cake/libs/controller/controller.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/controller.php
MIT
function startupProcess() { $this->Component->initialize($this); $this->beforeFilter(); $this->Component->triggerCallback('startup', $this); }
Perform the startup process for this controller. Fire the Component and Controller callbacks in the correct order. - Initializes components, which fires their `initialize` callback - Calls the controller `beforeFilter`. - triggers Component `startup` methods. @return void @access public
startupProcess
php
Datawalke/Coordino
cake/libs/controller/controller.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/controller.php
MIT
function shutdownProcess() { $this->Component->triggerCallback('shutdown', $this); $this->afterFilter(); }
Perform the various shutdown processes for this controller. Fire the Component and Controller callbacks in the correct order. - triggers the component `shutdown` callback. - calls the Controller's `afterFilter` method. @return void @access public
shutdownProcess
php
Datawalke/Coordino
cake/libs/controller/controller.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/controller.php
MIT
function httpCodes($code = null) { if (empty($this->__httpCodes)) { $this->__httpCodes = array( 100 => 'Continue', 101 => 'Switching Protocols', 200 => 'OK', 201 => 'Created', 202 => 'Accepted', 203 => 'Non-Authoritative Information', 204 => 'No Content', 205 => 'Reset Content', 206 => 'Partial Content', 300 => 'Multiple Choices', 301 => 'Moved Permanently', 302 => 'Found', 303 => 'See Other', 304 => 'Not Modified', 305 => 'Use Proxy', 307 => 'Temporary Redirect', 400 => 'Bad Request', 401 => 'Unauthorized', 402 => 'Payment Required', 403 => 'Forbidden', 404 => 'Not Found', 405 => 'Method Not Allowed', 406 => 'Not Acceptable', 407 => 'Proxy Authentication Required', 408 => 'Request Time-out', 409 => 'Conflict', 410 => 'Gone', 411 => 'Length Required', 412 => 'Precondition Failed', 413 => 'Request Entity Too Large', 414 => 'Request-URI Too Large', 415 => 'Unsupported Media Type', 416 => 'Requested range not satisfiable', 417 => 'Expectation Failed', 500 => 'Internal Server Error', 501 => 'Not Implemented', 502 => 'Bad Gateway', 503 => 'Service Unavailable', 504 => 'Gateway Time-out' ); } if (empty($code)) { return $this->__httpCodes; } if (is_array($code)) { $this->__httpCodes = $code + $this->__httpCodes; return true; } if (!isset($this->__httpCodes[$code])) { return null; } return array($code => $this->__httpCodes[$code]); }
Queries & sets valid HTTP response codes & messages. @param mixed $code If $code is an integer, then the corresponding code/message is returned if it exists, null if it does not exist. If $code is an array, then the 'code' and 'message' keys of each nested array are added to the default HTTP codes. Example: httpCodes(404); // returns array(404 => 'Not Found') httpCodes(array( 701 => 'Unicorn Moved', 800 => 'Unexpected Minotaur' )); // sets these new values, and returns true @return mixed Associative array of the HTTP codes as keys, and the message strings as values, or null of the given $code does not exist.
httpCodes
php
Datawalke/Coordino
cake/libs/controller/controller.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/controller.php
MIT
function loadModel($modelClass = null, $id = null) { if ($modelClass === null) { $modelClass = $this->modelClass; } $cached = false; $object = null; $plugin = null; if ($this->uses === false) { if ($this->plugin) { $plugin = $this->plugin . '.'; } } list($plugin, $modelClass) = pluginSplit($modelClass, true, $plugin); if ($this->persistModel === true) { $cached = $this->_persist($modelClass, null, $object); } if (($cached === false)) { $this->modelNames[] = $modelClass; if (!PHP5) { $this->{$modelClass} =& ClassRegistry::init(array( 'class' => $plugin . $modelClass, 'alias' => $modelClass, 'id' => $id )); } else { $this->{$modelClass} = ClassRegistry::init(array( 'class' => $plugin . $modelClass, 'alias' => $modelClass, 'id' => $id )); } if (!$this->{$modelClass}) { return $this->cakeError('missingModel', array(array( 'className' => $modelClass, 'webroot' => '', 'base' => $this->base ))); } if ($this->persistModel === true) { $this->_persist($modelClass, true, $this->{$modelClass}); $registry =& ClassRegistry::getInstance(); $this->_persist($modelClass . 'registry', true, $registry->__objects, 'registry'); } } else { $this->_persist($modelClass . 'registry', true, $object, 'registry'); $this->_persist($modelClass, true, $object); $this->modelNames[] = $modelClass; } return true; }
Loads and instantiates models required by this controller. If Controller::$persistModel; is true, controller will cache model instances on first request, additional request will used cached models. If the model is non existent, it will throw a missing database table error, as Cake generates dynamic models for the time being. @param string $modelClass Name of model class to load @param mixed $id Initial ID the instanced model class should have @return mixed true when single model found and instance created, error returned if model not found. @access public
loadModel
php
Datawalke/Coordino
cake/libs/controller/controller.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/controller.php
MIT
function redirect($url, $status = null, $exit = true) { $this->autoRender = false; if (is_array($status)) { extract($status, EXTR_OVERWRITE); } $response = $this->Component->beforeRedirect($this, $url, $status, $exit); if ($response === false) { return; } if (is_array($response)) { foreach ($response as $resp) { if (is_array($resp) && isset($resp['url'])) { extract($resp, EXTR_OVERWRITE); } elseif ($resp !== null) { $url = $resp; } } } if (function_exists('session_write_close')) { session_write_close(); } if (!empty($status)) { $codes = $this->httpCodes(); if (is_string($status)) { $codes = array_flip($codes); } if (isset($codes[$status])) { $code = $msg = $codes[$status]; if (is_numeric($status)) { $code = $status; } if (is_string($status)) { $msg = $status; } $status = "HTTP/1.1 {$code} {$msg}"; } else { $status = null; } $this->header($status); } if ($url !== null) { $this->header('Location: ' . Router::url($url, true)); } if (!empty($status) && ($status >= 300 && $status < 400)) { $this->header($status); } if ($exit) { $this->_stop(); } }
Redirects to given $url, after turning off $this->autoRender. Script execution is halted after the redirect. @param mixed $url A string or array-based URL pointing to another location within the app, or an absolute URL @param integer $status Optional HTTP status code (eg: 404) @param boolean $exit If true, exit() will be called after the redirect @return mixed void if $exit = false. Terminates script if $exit = true @access public @link http://book.cakephp.org/view/982/redirect
redirect
php
Datawalke/Coordino
cake/libs/controller/controller.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/controller.php
MIT
function set($one, $two = null) { $data = array(); if (is_array($one)) { if (is_array($two)) { $data = array_combine($one, $two); } else { $data = $one; } } else { $data = array($one => $two); } $this->viewVars = $data + $this->viewVars; }
Saves a variable for use inside a view template. @param mixed $one A string or an array of data. @param mixed $two Value in case $one is a string (which then works as the key). Unused if $one is an associative array, otherwise serves as the values to $one's keys. @return void @access public @link http://book.cakephp.org/view/979/set
set
php
Datawalke/Coordino
cake/libs/controller/controller.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/controller.php
MIT
function setAction($action) { $this->action = $action; $args = func_get_args(); unset($args[0]); return call_user_func_array(array(&$this, $action), $args); }
Internally redirects one action to another. Does not perform another HTTP request unlike Controller::redirect() Examples: {{{ setAction('another_action'); setAction('action_with_parameters', $parameter1); }}} @param string $action The new action to be 'redirected' to @param mixed Any other parameters passed to this method will be passed as parameters to the new action. @return mixed Returns the return value of the called action @access public
setAction
php
Datawalke/Coordino
cake/libs/controller/controller.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/controller.php
MIT
function isAuthorized() { trigger_error(sprintf( __('%sController::isAuthorized() is not defined.', true), $this->name ), E_USER_WARNING); return false; }
Controller callback to tie into Auth component. Only called when AuthComponent::$authorize is set to 'controller'. @return bool true if authorized, false otherwise @access public @link http://book.cakephp.org/view/1275/authorize
isAuthorized
php
Datawalke/Coordino
cake/libs/controller/controller.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/controller.php
MIT
function validateErrors() { $objects = func_get_args(); if (empty($objects)) { return false; } $errors = array(); foreach ($objects as $object) { if (isset($this->{$object->alias})) { $object =& $this->{$object->alias}; } $object->set($object->data); $errors = array_merge($errors, (array)$object->invalidFields()); } return $this->validationErrors = (!empty($errors) ? $errors : false); }
Validates models passed by parameters. Example: `$errors = $this->validateErrors($this->Article, $this->User);` @param mixed A list of models as a variable argument @return array Validation errors, or false if none @access public
validateErrors
php
Datawalke/Coordino
cake/libs/controller/controller.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/controller.php
MIT
function render($action = null, $layout = null, $file = null) { $this->beforeRender(); $this->Component->triggerCallback('beforeRender', $this); $viewClass = $this->view; if ($this->view != 'View') { list($plugin, $viewClass) = pluginSplit($viewClass); $viewClass = $viewClass . 'View'; App::import('View', $this->view); } $this->params['models'] = $this->modelNames; if (Configure::read() > 2) { $this->set('cakeDebug', $this); } $View =& new $viewClass($this); if (!empty($this->modelNames)) { $models = array(); foreach ($this->modelNames as $currentModel) { if (isset($this->$currentModel) && is_a($this->$currentModel, 'Model')) { $models[] = Inflector::underscore($currentModel); } $isValidModel = ( isset($this->$currentModel) && is_a($this->$currentModel, 'Model') && !empty($this->$currentModel->validationErrors) ); if ($isValidModel) { $View->validationErrors[Inflector::camelize($currentModel)] =& $this->$currentModel->validationErrors; } } $models = array_diff(ClassRegistry::keys(), $models); foreach ($models as $currentModel) { if (ClassRegistry::isKeySet($currentModel)) { $currentObject =& ClassRegistry::getObject($currentModel); if (is_a($currentObject, 'Model') && !empty($currentObject->validationErrors)) { $View->validationErrors[Inflector::camelize($currentModel)] =& $currentObject->validationErrors; } } } } $this->autoRender = false; $this->output .= $View->render($action, $layout, $file); return $this->output; }
Instantiates the correct view class, hands it its data, and uses it to render the view output. @param string $action Action name to render @param string $layout Layout to use @param string $file File to use for rendering @return string Full output string of view contents @access public @link http://book.cakephp.org/view/980/render
render
php
Datawalke/Coordino
cake/libs/controller/controller.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/controller.php
MIT
function referer($default = null, $local = false) { $ref = env('HTTP_REFERER'); if (!empty($ref) && defined('FULL_BASE_URL')) { $base = FULL_BASE_URL . $this->webroot; if (strpos($ref, $base) === 0) { $return = substr($ref, strlen($base)); if ($return[0] != '/') { $return = '/'.$return; } return $return; } elseif (!$local) { return $ref; } } if ($default != null) { $url = Router::url($default, true); return $url; } return '/'; }
Returns the referring URL for this request. @param string $default Default URL to use if HTTP_REFERER cannot be read from headers @param boolean $local If true, restrict referring URLs to local server @return string Referring URL @access public @link http://book.cakephp.org/view/987/referer
referer
php
Datawalke/Coordino
cake/libs/controller/controller.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/controller.php
MIT
function disableCache() { header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); }
Forces the user's browser not to cache the results of the current request. @return void @access public @link http://book.cakephp.org/view/988/disableCache
disableCache
php
Datawalke/Coordino
cake/libs/controller/controller.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/controller.php
MIT
function flash($message, $url, $pause = 1, $layout = 'flash') { $this->autoRender = false; $this->set('url', Router::url($url)); $this->set('message', $message); $this->set('pause', $pause); $this->set('page_title', $message); $this->render(false, $layout); }
Shows a message to the user for $pause seconds, then redirects to $url. Uses flash.ctp as the default layout for the message. Does not work if the current debug level is higher than 0. @param string $message Message to display to the user @param mixed $url Relative string or array-based URL to redirect to after the time expires @param integer $pause Time to show the message @param string $layout Layout you want to use, defaults to 'flash' @return void Renders flash layout @access public @link http://book.cakephp.org/view/983/flash
flash
php
Datawalke/Coordino
cake/libs/controller/controller.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/controller.php
MIT
function postConditions($data = array(), $op = null, $bool = 'AND', $exclusive = false) { if (!is_array($data) || empty($data)) { if (!empty($this->data)) { $data = $this->data; } else { return null; } } $cond = array(); if ($op === null) { $op = ''; } $arrayOp = is_array($op); foreach ($data as $model => $fields) { foreach ($fields as $field => $value) { $key = $model.'.'.$field; $fieldOp = $op; if ($arrayOp) { if (array_key_exists($key, $op)) { $fieldOp = $op[$key]; } elseif (array_key_exists($field, $op)) { $fieldOp = $op[$field]; } else { $fieldOp = false; } } if ($exclusive && $fieldOp === false) { continue; } $fieldOp = strtoupper(trim($fieldOp)); if ($fieldOp === 'LIKE') { $key = $key.' LIKE'; $value = '%'.$value.'%'; } elseif ($fieldOp && $fieldOp != '=') { $key = $key.' '.$fieldOp; } $cond[$key] = $value; } } if ($bool != null && strtoupper($bool) != 'AND') { $cond = array($bool => $cond); } return $cond; }
Converts POST'ed form data to a model conditions array, suitable for use in a Model::find() call. @param array $data POST'ed data organized by model and field @param mixed $op A string containing an SQL comparison operator, or an array matching operators to fields @param string $bool SQL boolean operator: AND, OR, XOR, etc. @param boolean $exclusive If true, and $op is an array, fields not included in $op will not be included in the returned conditions @return array An array of model conditions @access public @link http://book.cakephp.org/view/989/postConditions
postConditions
php
Datawalke/Coordino
cake/libs/controller/controller.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/controller.php
MIT
function paginate($object = null, $scope = array(), $whitelist = array()) { if (is_array($object)) { $whitelist = $scope; $scope = $object; $object = null; } $assoc = null; if (is_string($object)) { $assoc = null; if (strpos($object, '.') !== false) { list($object, $assoc) = pluginSplit($object); } if ($assoc && isset($this->{$object}->{$assoc})) { $object =& $this->{$object}->{$assoc}; } elseif ( $assoc && isset($this->{$this->modelClass}) && isset($this->{$this->modelClass}->{$assoc} )) { $object =& $this->{$this->modelClass}->{$assoc}; } elseif (isset($this->{$object})) { $object =& $this->{$object}; } elseif ( isset($this->{$this->modelClass}) && isset($this->{$this->modelClass}->{$object} )) { $object =& $this->{$this->modelClass}->{$object}; } } elseif (empty($object) || $object === null) { if (isset($this->{$this->modelClass})) { $object =& $this->{$this->modelClass}; } else { $className = null; $name = $this->uses[0]; if (strpos($this->uses[0], '.') !== false) { list($name, $className) = explode('.', $this->uses[0]); } if ($className) { $object =& $this->{$className}; } else { $object =& $this->{$name}; } } } if (!is_object($object)) { trigger_error(sprintf( __('Controller::paginate() - can\'t find model %1$s in controller %2$sController', true ), $object, $this->name ), E_USER_WARNING); return array(); } $options = array_merge($this->params, $this->params['url'], $this->passedArgs); if (isset($this->paginate[$object->alias])) { $defaults = $this->paginate[$object->alias]; } else { $defaults = $this->paginate; } if (isset($options['show'])) { $options['limit'] = $options['show']; } if (isset($options['sort'])) { $direction = null; if (isset($options['direction'])) { $direction = strtolower($options['direction']); } if ($direction != 'asc' && $direction != 'desc') { $direction = 'asc'; } $options['order'] = array($options['sort'] => $direction); } if (!empty($options['order']) && is_array($options['order'])) { $alias = $object->alias; $key = $field = key($options['order']); if (strpos($key, '.') !== false) { list($alias, $field) = explode('.', $key); } $value = $options['order'][$key]; unset($options['order'][$key]); if ($object->hasField($field)) { $options['order'][$object->alias . '.' . $field] = $value; } elseif ($object->hasField($key, true)) { $options['order'][$field] = $value; } elseif (isset($object->{$alias}) && $object->{$alias}->hasField($field)) { $options['order'][$alias . '.' . $field] = $value; } } $vars = array('fields', 'order', 'limit', 'page', 'recursive'); $keys = array_keys($options); $count = count($keys); for ($i = 0; $i < $count; $i++) { if (!in_array($keys[$i], $vars, true)) { unset($options[$keys[$i]]); } if (empty($whitelist) && ($keys[$i] === 'fields' || $keys[$i] === 'recursive')) { unset($options[$keys[$i]]); } elseif (!empty($whitelist) && !in_array($keys[$i], $whitelist)) { unset($options[$keys[$i]]); } } $conditions = $fields = $order = $limit = $page = $recursive = null; if (!isset($defaults['conditions'])) { $defaults['conditions'] = array(); } $type = 'all'; if (isset($defaults[0])) { $type = $defaults[0]; unset($defaults[0]); } $options = array_merge(array('page' => 1, 'limit' => 20), $defaults, $options); $options['limit'] = (int) $options['limit']; if (empty($options['limit']) || $options['limit'] < 1) { $options['limit'] = 1; } extract($options); if (is_array($scope) && !empty($scope)) { $conditions = array_merge($conditions, $scope); } elseif (is_string($scope)) { $conditions = array($conditions, $scope); } if ($recursive === null) { $recursive = $object->recursive; } $extra = array_diff_key($defaults, compact( 'conditions', 'fields', 'order', 'limit', 'page', 'recursive' )); if ($type !== 'all') { $extra['type'] = $type; } if (method_exists($object, 'paginateCount')) { $count = $object->paginateCount($conditions, $recursive, $extra); } else { $parameters = compact('conditions'); if ($recursive != $object->recursive) { $parameters['recursive'] = $recursive; } $count = $object->find('count', array_merge($parameters, $extra)); } $pageCount = intval(ceil($count / $limit)); if ($page === 'last' || $page >= $pageCount) { $options['page'] = $page = $pageCount; } elseif (intval($page) < 1) { $options['page'] = $page = 1; } $page = $options['page'] = (integer)$page; if (method_exists($object, 'paginate')) { $results = $object->paginate( $conditions, $fields, $order, $limit, $page, $recursive, $extra ); } else { $parameters = compact('conditions', 'fields', 'order', 'limit', 'page'); if ($recursive != $object->recursive) { $parameters['recursive'] = $recursive; } $results = $object->find($type, array_merge($parameters, $extra)); } $paging = array( 'page' => $page, 'current' => count($results), 'count' => $count, 'prevPage' => ($page > 1), 'nextPage' => ($count > ($page * $limit)), 'pageCount' => $pageCount, 'defaults' => array_merge(array('limit' => 20, 'step' => 1), $defaults), 'options' => $options ); $this->params['paging'][$object->alias] = $paging; if (!in_array('Paginator', $this->helpers) && !array_key_exists('Paginator', $this->helpers)) { $this->helpers[] = 'Paginator'; } return $results; }
Handles automatic pagination of model records. @param mixed $object Model to paginate (e.g: model instance, or 'Model', or 'Model.InnerModel') @param mixed $scope Conditions to use while paginating @param array $whitelist List of allowed options for paging @return array Model query results @access public @link http://book.cakephp.org/view/1232/Controller-Setup
paginate
php
Datawalke/Coordino
cake/libs/controller/controller.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/controller.php
MIT
function _beforeScaffold($method) { return true; }
This method should be overridden in child classes. @param string $method name of method called example index, edit, etc. @return boolean Success @access protected @link http://book.cakephp.org/view/984/Callbacks
_beforeScaffold
php
Datawalke/Coordino
cake/libs/controller/controller.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/controller.php
MIT
function _afterScaffoldSave($method) { return true; }
This method should be overridden in child classes. @param string $method name of method called either edit or update. @return boolean Success @access protected @link http://book.cakephp.org/view/984/Callbacks
_afterScaffoldSave
php
Datawalke/Coordino
cake/libs/controller/controller.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/controller.php
MIT
function _afterScaffoldSaveError($method) { return true; }
This method should be overridden in child classes. @param string $method name of method called either edit or update. @return boolean Success @access protected @link http://book.cakephp.org/view/984/Callbacks
_afterScaffoldSaveError
php
Datawalke/Coordino
cake/libs/controller/controller.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/controller.php
MIT
function _scaffoldError($method) { return false; }
This method should be overridden in child classes. If not it will render a scaffold error. Method MUST return true in child classes @param string $method name of method called example index, edit, etc. @return boolean Success @access protected @link http://book.cakephp.org/view/984/Callbacks
_scaffoldError
php
Datawalke/Coordino
cake/libs/controller/controller.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/controller.php
MIT
function display() { $path = func_get_args(); $count = count($path); if (!$count) { $this->redirect('/'); } $page = $subpage = $title_for_layout = null; if (!empty($path[0])) { $page = $path[0]; } if (!empty($path[1])) { $subpage = $path[1]; } if (!empty($path[$count - 1])) { $title_for_layout = Inflector::humanize($path[$count - 1]); } $this->set(compact('page', 'subpage', 'title_for_layout')); $this->render(implode('/', $path)); }
Displays a view @param mixed What page to display @access public
display
php
Datawalke/Coordino
cake/libs/controller/pages_controller.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/pages_controller.php
MIT
function __construct(&$controller, $params) { $this->controller =& $controller; $count = count($this->__passedVars); for ($j = 0; $j < $count; $j++) { $var = $this->__passedVars[$j]; $this->{$var} = $controller->{$var}; } $this->redirect = array('action' => 'index'); $this->modelClass = $controller->modelClass; $this->modelKey = $controller->modelKey; if (!is_object($this->controller->{$this->modelClass})) { return $this->cakeError('missingModel', array(array( 'className' => $this->modelClass, 'webroot' => '', 'base' => $controller->base ))); } $this->ScaffoldModel =& $this->controller->{$this->modelClass}; $this->scaffoldTitle = Inflector::humanize($this->viewPath); $this->scaffoldActions = $controller->scaffold; $title_for_layout = __('Scaffold :: ', true) . Inflector::humanize($this->action) . ' :: ' . $this->scaffoldTitle; $modelClass = $this->controller->modelClass; $primaryKey = $this->ScaffoldModel->primaryKey; $displayField = $this->ScaffoldModel->displayField; $singularVar = Inflector::variable($modelClass); $pluralVar = Inflector::variable($this->controller->name); $singularHumanName = Inflector::humanize(Inflector::underscore($modelClass)); $pluralHumanName = Inflector::humanize(Inflector::underscore($this->controller->name)); $scaffoldFields = array_keys($this->ScaffoldModel->schema()); $associations = $this->__associations(); $this->controller->set(compact( 'title_for_layout', 'modelClass', 'primaryKey', 'displayField', 'singularVar', 'pluralVar', 'singularHumanName', 'pluralHumanName', 'scaffoldFields', 'associations' )); if ($this->controller->view) { $this->controller->view = 'Scaffold'; } $this->_validSession = ( isset($this->controller->Session) && $this->controller->Session->valid() != false ); $this->__scaffold($params); }
Construct and set up given controller with given parameters. @param string $controller_class Name of controller @param array $params Parameters for scaffolding
__construct
php
Datawalke/Coordino
cake/libs/controller/scaffold.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/scaffold.php
MIT
function _output() { $this->controller->afterFilter(); echo($this->controller->output); }
Outputs the content of a scaffold method passing it through the Controller::afterFilter() @return void @access protected
_output
php
Datawalke/Coordino
cake/libs/controller/scaffold.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/scaffold.php
MIT
function __scaffoldView($params) { if ($this->controller->_beforeScaffold('view')) { $message = sprintf(__("No id set for %s::view()", true), Inflector::humanize($this->modelKey)); if (isset($params['pass'][0])) { $this->ScaffoldModel->id = $params['pass'][0]; } elseif ($this->_validSession) { $this->controller->Session->setFlash($message); $this->controller->redirect($this->redirect); } else { return $this->controller->flash($message, '/' . Inflector::underscore($this->controller->viewPath)); } $this->ScaffoldModel->recursive = 1; $this->controller->data = $this->ScaffoldModel->read(); $this->controller->set( Inflector::variable($this->controller->modelClass), $this->controller->data ); $this->controller->render($this->action, $this->layout); $this->_output(); } elseif ($this->controller->_scaffoldError('view') === false) { return $this->__scaffoldError(); } }
Renders a view action of scaffolded model. @param array $params Parameters for scaffolding @return mixed A rendered view of a row from Models database table @access private
__scaffoldView
php
Datawalke/Coordino
cake/libs/controller/scaffold.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/scaffold.php
MIT
function __scaffoldIndex($params) { if ($this->controller->_beforeScaffold('index')) { $this->ScaffoldModel->recursive = 0; $this->controller->set( Inflector::variable($this->controller->name), $this->controller->paginate() ); $this->controller->render($this->action, $this->layout); $this->_output(); } elseif ($this->controller->_scaffoldError('index') === false) { return $this->__scaffoldError(); } }
Renders index action of scaffolded model. @param array $params Parameters for scaffolding @return mixed A rendered view listing rows from Models database table @access private
__scaffoldIndex
php
Datawalke/Coordino
cake/libs/controller/scaffold.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/scaffold.php
MIT
function __scaffoldForm($action = 'edit') { $this->controller->viewVars['scaffoldFields'] = array_merge( $this->controller->viewVars['scaffoldFields'], array_keys($this->ScaffoldModel->hasAndBelongsToMany) ); $this->controller->render($action, $this->layout); $this->_output(); }
Renders an add or edit action for scaffolded model. @param string $action Action (add or edit) @return mixed A rendered view with a form to edit or add a record in the Models database table @access private
__scaffoldForm
php
Datawalke/Coordino
cake/libs/controller/scaffold.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/scaffold.php
MIT
function __scaffoldSave($params = array(), $action = 'edit') { $formAction = 'edit'; $success = __('updated', true); if ($action === 'add') { $formAction = 'add'; $success = __('saved', true); } if ($this->controller->_beforeScaffold($action)) { if ($action == 'edit') { if (isset($params['pass'][0])) { $this->ScaffoldModel->id = $params['pass'][0]; } if (!$this->ScaffoldModel->exists()) { $message = sprintf(__("Invalid id for %s::edit()", true), Inflector::humanize($this->modelKey)); if ($this->_validSession) { $this->controller->Session->setFlash($message); $this->controller->redirect($this->redirect); } else { $this->controller->flash($message, $this->redirect); $this->_output(); } } } if (!empty($this->controller->data)) { if ($action == 'create') { $this->ScaffoldModel->create(); } if ($this->ScaffoldModel->save($this->controller->data)) { if ($this->controller->_afterScaffoldSave($action)) { $message = sprintf( __('The %1$s has been %2$s', true), Inflector::humanize($this->modelKey), $success ); if ($this->_validSession) { $this->controller->Session->setFlash($message); $this->controller->redirect($this->redirect); } else { $this->controller->flash($message, $this->redirect); return $this->_output(); } } else { return $this->controller->_afterScaffoldSaveError($action); } } else { if ($this->_validSession) { $this->controller->Session->setFlash(__('Please correct errors below.', true)); } } } if (empty($this->controller->data)) { if ($this->ScaffoldModel->id) { $this->controller->data = $this->ScaffoldModel->read(); } else { $this->controller->data = $this->ScaffoldModel->create(); } } foreach ($this->ScaffoldModel->belongsTo as $assocName => $assocData) { $varName = Inflector::variable(Inflector::pluralize( preg_replace('/(?:_id)$/', '', $assocData['foreignKey']) )); $this->controller->set($varName, $this->ScaffoldModel->{$assocName}->find('list')); } foreach ($this->ScaffoldModel->hasAndBelongsToMany as $assocName => $assocData) { $varName = Inflector::variable(Inflector::pluralize($assocName)); $this->controller->set($varName, $this->ScaffoldModel->{$assocName}->find('list')); } return $this->__scaffoldForm($formAction); } elseif ($this->controller->_scaffoldError($action) === false) { return $this->__scaffoldError(); } }
Saves or updates the scaffolded model. @param array $params Parameters for scaffolding @param string $action add or edt @return mixed Success on save/update, add/edit form if data is empty or error if save or update fails @access private
__scaffoldSave
php
Datawalke/Coordino
cake/libs/controller/scaffold.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/scaffold.php
MIT
function __scaffoldDelete($params = array()) { if ($this->controller->_beforeScaffold('delete')) { $message = sprintf( __("No id set for %s::delete()", true), Inflector::humanize($this->modelKey) ); if (isset($params['pass'][0])) { $id = $params['pass'][0]; } elseif ($this->_validSession) { $this->controller->Session->setFlash($message); $this->controller->redirect($this->redirect); } else { $this->controller->flash($message, $this->redirect); return $this->_output(); } if ($this->ScaffoldModel->delete($id)) { $message = sprintf( __('The %1$s with id: %2$d has been deleted.', true), Inflector::humanize($this->modelClass), $id ); if ($this->_validSession) { $this->controller->Session->setFlash($message); $this->controller->redirect($this->redirect); } else { $this->controller->flash($message, $this->redirect); return $this->_output(); } } else { $message = sprintf( __('There was an error deleting the %1$s with id: %2$d', true), Inflector::humanize($this->modelClass), $id ); if ($this->_validSession) { $this->controller->Session->setFlash($message); $this->controller->redirect($this->redirect); } else { $this->controller->flash($message, $this->redirect); return $this->_output(); } } } elseif ($this->controller->_scaffoldError('delete') === false) { return $this->__scaffoldError(); } }
Performs a delete on given scaffolded Model. @param array $params Parameters for scaffolding @return mixed Success on delete, error if delete fails @access private
__scaffoldDelete
php
Datawalke/Coordino
cake/libs/controller/scaffold.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/scaffold.php
MIT
function __scaffoldError() { return $this->controller->render('error', $this->layout); $this->_output(); }
Show a scaffold error @return mixed A rendered view showing the error @access private
__scaffoldError
php
Datawalke/Coordino
cake/libs/controller/scaffold.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/scaffold.php
MIT
function __scaffold($params) { $db = &ConnectionManager::getDataSource($this->ScaffoldModel->useDbConfig); $prefixes = Configure::read('Routing.prefixes'); $scaffoldPrefix = $this->scaffoldActions; if (isset($db)) { if (empty($this->scaffoldActions)) { $this->scaffoldActions = array( 'index', 'list', 'view', 'add', 'create', 'edit', 'update', 'delete' ); } elseif (!empty($prefixes) && in_array($scaffoldPrefix, $prefixes)) { $this->scaffoldActions = array( $scaffoldPrefix . '_index', $scaffoldPrefix . '_list', $scaffoldPrefix . '_view', $scaffoldPrefix . '_add', $scaffoldPrefix . '_create', $scaffoldPrefix . '_edit', $scaffoldPrefix . '_update', $scaffoldPrefix . '_delete' ); } if (in_array($params['action'], $this->scaffoldActions)) { if (!empty($prefixes)) { $params['action'] = str_replace($scaffoldPrefix . '_', '', $params['action']); } switch ($params['action']) { case 'index': case 'list': $this->__scaffoldIndex($params); break; case 'view': $this->__scaffoldView($params); break; case 'add': case 'create': $this->__scaffoldSave($params, 'add'); break; case 'edit': case 'update': $this->__scaffoldSave($params, 'edit'); break; case 'delete': $this->__scaffoldDelete($params); break; } } else { return $this->cakeError('missingAction', array(array( 'className' => $this->controller->name . "Controller", 'base' => $this->controller->base, 'action' => $this->action, 'webroot' => $this->controller->webroot ))); } } else { return $this->cakeError('missingDatabase', array(array( 'webroot' => $this->controller->webroot ))); } }
When methods are now present in a controller scaffoldView is used to call default Scaffold methods if: `var $scaffold;` is placed in the controller's class definition. @param array $params Parameters for scaffolding @return mixed A rendered view of scaffold action, or showing the error @access private
__scaffold
php
Datawalke/Coordino
cake/libs/controller/scaffold.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/scaffold.php
MIT
function __associations() { $keys = array('belongsTo', 'hasOne', 'hasMany', 'hasAndBelongsToMany'); $associations = array(); foreach ($keys as $key => $type) { foreach ($this->ScaffoldModel->{$type} as $assocKey => $assocData) { $associations[$type][$assocKey]['primaryKey'] = $this->ScaffoldModel->{$assocKey}->primaryKey; $associations[$type][$assocKey]['displayField'] = $this->ScaffoldModel->{$assocKey}->displayField; $associations[$type][$assocKey]['foreignKey'] = $assocData['foreignKey']; $associations[$type][$assocKey]['controller'] = Inflector::pluralize(Inflector::underscore($assocData['className'])); if ($type == 'hasAndBelongsToMany') { $associations[$type][$assocKey]['with'] = $assocData['with']; } } } return $associations; }
Returns associations for controllers models. @return array Associations for model @access private
__associations
php
Datawalke/Coordino
cake/libs/controller/scaffold.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/scaffold.php
MIT
function _getViewFileName($name = null) { if ($name === null) { $name = $this->action; } $name = Inflector::underscore($name); $prefixes = Configure::read('Routing.prefixes'); if (!empty($prefixes)) { foreach ($prefixes as $prefix) { if (strpos($name, $prefix . '_') !== false) { $name = substr($name, strlen($prefix) + 1); break; } } } if ($name === 'add') { $name = 'edit'; } $scaffoldAction = 'scaffold.' . $name; if (!is_null($this->subDir)) { $subDir = strtolower($this->subDir) . DS; } else { $subDir = null; } $names[] = $this->viewPath . DS . $subDir . $scaffoldAction; $names[] = 'scaffolds' . DS . $subDir . $name; $paths = $this->_paths($this->plugin); $exts = array($this->ext); if ($this->ext !== '.ctp') { array_push($exts, '.ctp'); } foreach ($exts as $ext) { foreach ($paths as $path) { foreach ($names as $name) { if (file_exists($path . $name . $ext)) { return $path . $name . $ext; } } } } if ($name === 'scaffolds' . DS . $subDir . 'error') { return LIBS . 'view' . DS . 'errors' . DS . 'scaffold_error.ctp'; } return $this->_missingView($paths[0] . $name . $this->ext, 'missingView'); }
Override _getViewFileName Appends special scaffolding views in. @param string $name name of the view file to get. @return string action @access protected
_getViewFileName
php
Datawalke/Coordino
cake/libs/controller/scaffold.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/scaffold.php
MIT
function __construct() { $name = Inflector::camelize(strtolower(Configure::read('Acl.classname'))); if (!class_exists($name)) { if (App::import('Component', $name)) { list($plugin, $name) = pluginSplit($name); $name .= 'Component'; } else { trigger_error(sprintf(__('Could not find %s.', true), $name), E_USER_WARNING); } } $this->_Instance =& new $name(); $this->_Instance->initialize($this); }
Constructor. Will return an instance of the correct ACL class as defined in `Configure::read('Acl.classname')`
__construct
php
Datawalke/Coordino
cake/libs/controller/components/acl.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/components/acl.php
MIT
function startup(&$controller) { return true; }
Startup is not used @param object $controller Controller using this component @return boolean Proceed with component usage (true), or fail (false) @access public
startup
php
Datawalke/Coordino
cake/libs/controller/components/acl.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/components/acl.php
MIT
function check($aro, $aco, $action = "*") { return $this->_Instance->check($aro, $aco, $action); }
Pass-thru function for ACL check instance. Check methods are used to check whether or not an ARO can access an ACO @param string $aro ARO The requesting object identifier. @param string $aco ACO The controlled object identifier. @param string $action Action (defaults to *) @return boolean Success @access public
check
php
Datawalke/Coordino
cake/libs/controller/components/acl.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/components/acl.php
MIT
function allow($aro, $aco, $action = "*") { return $this->_Instance->allow($aro, $aco, $action); }
Pass-thru function for ACL allow instance. Allow methods are used to grant an ARO access to an ACO. @param string $aro ARO The requesting object identifier. @param string $aco ACO The controlled object identifier. @param string $action Action (defaults to *) @return boolean Success @access public
allow
php
Datawalke/Coordino
cake/libs/controller/components/acl.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/components/acl.php
MIT
function deny($aro, $aco, $action = "*") { return $this->_Instance->deny($aro, $aco, $action); }
Pass-thru function for ACL deny instance. Deny methods are used to remove permission from an ARO to access an ACO. @param string $aro ARO The requesting object identifier. @param string $aco ACO The controlled object identifier. @param string $action Action (defaults to *) @return boolean Success @access public
deny
php
Datawalke/Coordino
cake/libs/controller/components/acl.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/components/acl.php
MIT
function inherit($aro, $aco, $action = "*") { return $this->_Instance->inherit($aro, $aco, $action); }
Pass-thru function for ACL inherit instance. Inherit methods modify the permission for an ARO to be that of its parent object. @param string $aro ARO The requesting object identifier. @param string $aco ACO The controlled object identifier. @param string $action Action (defaults to *) @return boolean Success @access public
inherit
php
Datawalke/Coordino
cake/libs/controller/components/acl.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/components/acl.php
MIT
function grant($aro, $aco, $action = "*") { return $this->_Instance->grant($aro, $aco, $action); }
Pass-thru function for ACL grant instance. An alias for AclComponent::allow() @param string $aro ARO The requesting object identifier. @param string $aco ACO The controlled object identifier. @param string $action Action (defaults to *) @return boolean Success @access public
grant
php
Datawalke/Coordino
cake/libs/controller/components/acl.php
https://github.com/Datawalke/Coordino/blob/master/cake/libs/controller/components/acl.php
MIT