mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Replacing self with static due to PHP5.3+. Following #7040.
This commit is contained in:
parent
27e40f084d
commit
52e79987a2
53 changed files with 998 additions and 998 deletions
|
@ -125,33 +125,33 @@ class Cache {
|
|||
}
|
||||
|
||||
$current = array();
|
||||
if (isset(self::$_config[$name])) {
|
||||
$current = self::$_config[$name];
|
||||
if (isset(static::$_config[$name])) {
|
||||
$current = static::$_config[$name];
|
||||
}
|
||||
|
||||
if (!empty($settings)) {
|
||||
self::$_config[$name] = $settings + $current;
|
||||
static::$_config[$name] = $settings + $current;
|
||||
}
|
||||
|
||||
if (empty(self::$_config[$name]['engine'])) {
|
||||
if (empty(static::$_config[$name]['engine'])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!empty(self::$_config[$name]['groups'])) {
|
||||
foreach (self::$_config[$name]['groups'] as $group) {
|
||||
self::$_groups[$group][] = $name;
|
||||
sort(self::$_groups[$group]);
|
||||
self::$_groups[$group] = array_unique(self::$_groups[$group]);
|
||||
if (!empty(static::$_config[$name]['groups'])) {
|
||||
foreach (static::$_config[$name]['groups'] as $group) {
|
||||
static::$_groups[$group][] = $name;
|
||||
sort(static::$_groups[$group]);
|
||||
static::$_groups[$group] = array_unique(static::$_groups[$group]);
|
||||
}
|
||||
}
|
||||
|
||||
$engine = self::$_config[$name]['engine'];
|
||||
$engine = static::$_config[$name]['engine'];
|
||||
|
||||
if (!isset(self::$_engines[$name])) {
|
||||
self::_buildEngine($name);
|
||||
$settings = self::$_config[$name] = self::settings($name);
|
||||
} elseif ($settings = self::set(self::$_config[$name], null, $name)) {
|
||||
self::$_config[$name] = $settings;
|
||||
if (!isset(static::$_engines[$name])) {
|
||||
static::_buildEngine($name);
|
||||
$settings = static::$_config[$name] = static::settings($name);
|
||||
} elseif ($settings = static::set(static::$_config[$name], null, $name)) {
|
||||
static::$_config[$name] = $settings;
|
||||
}
|
||||
return compact('engine', 'settings');
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ class Cache {
|
|||
* @throws CacheException
|
||||
*/
|
||||
protected static function _buildEngine($name) {
|
||||
$config = self::$_config[$name];
|
||||
$config = static::$_config[$name];
|
||||
|
||||
list($plugin, $class) = pluginSplit($config['engine'], true);
|
||||
$cacheClass = $class . 'Engine';
|
||||
|
@ -176,8 +176,8 @@ class Cache {
|
|||
if (!is_subclass_of($cacheClass, 'CacheEngine')) {
|
||||
throw new CacheException(__d('cake_dev', 'Cache engines must use %s as a base class.', 'CacheEngine'));
|
||||
}
|
||||
self::$_engines[$name] = new $cacheClass();
|
||||
if (!self::$_engines[$name]->init($config)) {
|
||||
static::$_engines[$name] = new $cacheClass();
|
||||
if (!static::$_engines[$name]->init($config)) {
|
||||
$msg = __d(
|
||||
'cake_dev',
|
||||
'Cache engine "%s" is not properly configured. Ensure required extensions are installed, and credentials/permissions are correct',
|
||||
|
@ -185,8 +185,8 @@ class Cache {
|
|||
);
|
||||
throw new CacheException($msg);
|
||||
}
|
||||
if (self::$_engines[$name]->settings['probability'] && time() % self::$_engines[$name]->settings['probability'] === 0) {
|
||||
self::$_engines[$name]->gc();
|
||||
if (static::$_engines[$name]->settings['probability'] && time() % static::$_engines[$name]->settings['probability'] === 0) {
|
||||
static::$_engines[$name]->gc();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -197,7 +197,7 @@ class Cache {
|
|||
* @return array Array of configured Cache config names.
|
||||
*/
|
||||
public static function configured() {
|
||||
return array_keys(self::$_config);
|
||||
return array_keys(static::$_config);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -209,10 +209,10 @@ class Cache {
|
|||
* @return bool success of the removal, returns false when the config does not exist.
|
||||
*/
|
||||
public static function drop($name) {
|
||||
if (!isset(self::$_config[$name])) {
|
||||
if (!isset(static::$_config[$name])) {
|
||||
return false;
|
||||
}
|
||||
unset(self::$_config[$name], self::$_engines[$name]);
|
||||
unset(static::$_config[$name], static::$_engines[$name]);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -243,29 +243,29 @@ class Cache {
|
|||
if (is_array($settings) && $value !== null) {
|
||||
$config = $value;
|
||||
}
|
||||
if (!isset(self::$_config[$config]) || !isset(self::$_engines[$config])) {
|
||||
if (!isset(static::$_config[$config]) || !isset(static::$_engines[$config])) {
|
||||
return false;
|
||||
}
|
||||
if (!empty($settings)) {
|
||||
self::$_reset = true;
|
||||
static::$_reset = true;
|
||||
}
|
||||
|
||||
if (self::$_reset === true) {
|
||||
if (static::$_reset === true) {
|
||||
if (empty($settings)) {
|
||||
self::$_reset = false;
|
||||
$settings = self::$_config[$config];
|
||||
static::$_reset = false;
|
||||
$settings = static::$_config[$config];
|
||||
} else {
|
||||
if (is_string($settings) && $value !== null) {
|
||||
$settings = array($settings => $value);
|
||||
}
|
||||
$settings += self::$_config[$config];
|
||||
$settings += static::$_config[$config];
|
||||
if (isset($settings['duration']) && !is_numeric($settings['duration'])) {
|
||||
$settings['duration'] = strtotime($settings['duration']) - time();
|
||||
}
|
||||
}
|
||||
self::$_engines[$config]->settings = $settings;
|
||||
static::$_engines[$config]->settings = $settings;
|
||||
}
|
||||
return self::settings($config);
|
||||
return static::settings($config);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -278,7 +278,7 @@ class Cache {
|
|||
* @return void
|
||||
*/
|
||||
public static function gc($config = 'default', $expires = null) {
|
||||
self::$_engines[$config]->gc($expires);
|
||||
static::$_engines[$config]->gc($expires);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -300,29 +300,29 @@ class Cache {
|
|||
* @return bool True if the data was successfully cached, false on failure
|
||||
*/
|
||||
public static function write($key, $value, $config = 'default') {
|
||||
$settings = self::settings($config);
|
||||
$settings = static::settings($config);
|
||||
|
||||
if (empty($settings)) {
|
||||
return false;
|
||||
}
|
||||
if (!self::isInitialized($config)) {
|
||||
if (!static::isInitialized($config)) {
|
||||
return false;
|
||||
}
|
||||
$key = self::$_engines[$config]->key($key);
|
||||
$key = static::$_engines[$config]->key($key);
|
||||
|
||||
if (!$key || is_resource($value)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$success = self::$_engines[$config]->write($settings['prefix'] . $key, $value, $settings['duration']);
|
||||
self::set(null, $config);
|
||||
$success = static::$_engines[$config]->write($settings['prefix'] . $key, $value, $settings['duration']);
|
||||
static::set(null, $config);
|
||||
if ($success === false && $value !== '') {
|
||||
trigger_error(
|
||||
__d('cake_dev',
|
||||
"%s cache was unable to write '%s' to %s cache",
|
||||
$config,
|
||||
$key,
|
||||
self::$_engines[$config]->settings['engine']
|
||||
static::$_engines[$config]->settings['engine']
|
||||
),
|
||||
E_USER_WARNING
|
||||
);
|
||||
|
@ -348,19 +348,19 @@ class Cache {
|
|||
* @return mixed The cached data, or false if the data doesn't exist, has expired, or if there was an error fetching it
|
||||
*/
|
||||
public static function read($key, $config = 'default') {
|
||||
$settings = self::settings($config);
|
||||
$settings = static::settings($config);
|
||||
|
||||
if (empty($settings)) {
|
||||
return false;
|
||||
}
|
||||
if (!self::isInitialized($config)) {
|
||||
if (!static::isInitialized($config)) {
|
||||
return false;
|
||||
}
|
||||
$key = self::$_engines[$config]->key($key);
|
||||
$key = static::$_engines[$config]->key($key);
|
||||
if (!$key) {
|
||||
return false;
|
||||
}
|
||||
return self::$_engines[$config]->read($settings['prefix'] . $key);
|
||||
return static::$_engines[$config]->read($settings['prefix'] . $key);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -373,21 +373,21 @@ class Cache {
|
|||
* or if there was an error fetching it.
|
||||
*/
|
||||
public static function increment($key, $offset = 1, $config = 'default') {
|
||||
$settings = self::settings($config);
|
||||
$settings = static::settings($config);
|
||||
|
||||
if (empty($settings)) {
|
||||
return false;
|
||||
}
|
||||
if (!self::isInitialized($config)) {
|
||||
if (!static::isInitialized($config)) {
|
||||
return false;
|
||||
}
|
||||
$key = self::$_engines[$config]->key($key);
|
||||
$key = static::$_engines[$config]->key($key);
|
||||
|
||||
if (!$key || !is_int($offset) || $offset < 0) {
|
||||
return false;
|
||||
}
|
||||
$success = self::$_engines[$config]->increment($settings['prefix'] . $key, $offset);
|
||||
self::set(null, $config);
|
||||
$success = static::$_engines[$config]->increment($settings['prefix'] . $key, $offset);
|
||||
static::set(null, $config);
|
||||
return $success;
|
||||
}
|
||||
|
||||
|
@ -401,21 +401,21 @@ class Cache {
|
|||
* or if there was an error fetching it
|
||||
*/
|
||||
public static function decrement($key, $offset = 1, $config = 'default') {
|
||||
$settings = self::settings($config);
|
||||
$settings = static::settings($config);
|
||||
|
||||
if (empty($settings)) {
|
||||
return false;
|
||||
}
|
||||
if (!self::isInitialized($config)) {
|
||||
if (!static::isInitialized($config)) {
|
||||
return false;
|
||||
}
|
||||
$key = self::$_engines[$config]->key($key);
|
||||
$key = static::$_engines[$config]->key($key);
|
||||
|
||||
if (!$key || !is_int($offset) || $offset < 0) {
|
||||
return false;
|
||||
}
|
||||
$success = self::$_engines[$config]->decrement($settings['prefix'] . $key, $offset);
|
||||
self::set(null, $config);
|
||||
$success = static::$_engines[$config]->decrement($settings['prefix'] . $key, $offset);
|
||||
static::set(null, $config);
|
||||
return $success;
|
||||
}
|
||||
|
||||
|
@ -437,21 +437,21 @@ class Cache {
|
|||
* @return bool True if the value was successfully deleted, false if it didn't exist or couldn't be removed
|
||||
*/
|
||||
public static function delete($key, $config = 'default') {
|
||||
$settings = self::settings($config);
|
||||
$settings = static::settings($config);
|
||||
|
||||
if (empty($settings)) {
|
||||
return false;
|
||||
}
|
||||
if (!self::isInitialized($config)) {
|
||||
if (!static::isInitialized($config)) {
|
||||
return false;
|
||||
}
|
||||
$key = self::$_engines[$config]->key($key);
|
||||
$key = static::$_engines[$config]->key($key);
|
||||
if (!$key) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$success = self::$_engines[$config]->delete($settings['prefix'] . $key);
|
||||
self::set(null, $config);
|
||||
$success = static::$_engines[$config]->delete($settings['prefix'] . $key);
|
||||
static::set(null, $config);
|
||||
return $success;
|
||||
}
|
||||
|
||||
|
@ -463,11 +463,11 @@ class Cache {
|
|||
* @return bool True if the cache was successfully cleared, false otherwise
|
||||
*/
|
||||
public static function clear($check = false, $config = 'default') {
|
||||
if (!self::isInitialized($config)) {
|
||||
if (!static::isInitialized($config)) {
|
||||
return false;
|
||||
}
|
||||
$success = self::$_engines[$config]->clear($check);
|
||||
self::set(null, $config);
|
||||
$success = static::$_engines[$config]->clear($check);
|
||||
static::set(null, $config);
|
||||
return $success;
|
||||
}
|
||||
|
||||
|
@ -479,11 +479,11 @@ class Cache {
|
|||
* @return bool True if the cache group was successfully cleared, false otherwise
|
||||
*/
|
||||
public static function clearGroup($group, $config = 'default') {
|
||||
if (!self::isInitialized($config)) {
|
||||
if (!static::isInitialized($config)) {
|
||||
return false;
|
||||
}
|
||||
$success = self::$_engines[$config]->clearGroup($group);
|
||||
self::set(null, $config);
|
||||
$success = static::$_engines[$config]->clearGroup($group);
|
||||
static::set(null, $config);
|
||||
return $success;
|
||||
}
|
||||
|
||||
|
@ -497,7 +497,7 @@ class Cache {
|
|||
if (Configure::read('Cache.disable')) {
|
||||
return false;
|
||||
}
|
||||
return isset(self::$_engines[$config]);
|
||||
return isset(static::$_engines[$config]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -508,8 +508,8 @@ class Cache {
|
|||
* @see Cache::config()
|
||||
*/
|
||||
public static function settings($name = 'default') {
|
||||
if (!empty(self::$_engines[$name])) {
|
||||
return self::$_engines[$name]->settings();
|
||||
if (!empty(static::$_engines[$name])) {
|
||||
return static::$_engines[$name]->settings();
|
||||
}
|
||||
return array();
|
||||
}
|
||||
|
@ -535,10 +535,10 @@ class Cache {
|
|||
*/
|
||||
public static function groupConfigs($group = null) {
|
||||
if ($group === null) {
|
||||
return self::$_groups;
|
||||
return static::$_groups;
|
||||
}
|
||||
if (isset(self::$_groups[$group])) {
|
||||
return array($group => self::$_groups[$group]);
|
||||
if (isset(static::$_groups[$group])) {
|
||||
return array($group => static::$_groups[$group]);
|
||||
}
|
||||
throw new CacheException(__d('cake_dev', 'Invalid cache group %s', $group));
|
||||
}
|
||||
|
@ -569,12 +569,12 @@ class Cache {
|
|||
* @return mixed The results of the callable or unserialized results.
|
||||
*/
|
||||
public static function remember($key, $callable, $config = 'default') {
|
||||
$existing = self::read($key, $config);
|
||||
$existing = static::read($key, $config);
|
||||
if ($existing !== false) {
|
||||
return $existing;
|
||||
}
|
||||
$results = call_user_func($callable);
|
||||
self::write($key, $results, $config);
|
||||
static::write($key, $results, $config);
|
||||
return $results;
|
||||
}
|
||||
|
||||
|
|
|
@ -65,8 +65,8 @@ class ServerShell extends AppShell {
|
|||
* @return void
|
||||
*/
|
||||
public function initialize() {
|
||||
$this->_host = self::DEFAULT_HOST;
|
||||
$this->_port = self::DEFAULT_PORT;
|
||||
$this->_host = static::DEFAULT_HOST;
|
||||
$this->_port = static::DEFAULT_PORT;
|
||||
$this->_documentRoot = WWW_ROOT;
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,7 @@ class ServerShell extends AppShell {
|
|||
escapeshellarg($this->_documentRoot . '/index.php')
|
||||
);
|
||||
|
||||
$port = ($this->_port == self::DEFAULT_PORT) ? '' : ':' . $this->_port;
|
||||
$port = ($this->_port == static::DEFAULT_PORT) ? '' : ':' . $this->_port;
|
||||
$this->out(__d('cake_console', 'built-in server is running in http://%s%s/', $this->_host, $port));
|
||||
system($command);
|
||||
}
|
||||
|
|
|
@ -40,10 +40,10 @@ class ConsoleErrorHandler {
|
|||
* @return ConsoleOutput
|
||||
*/
|
||||
public static function getStderr() {
|
||||
if (empty(self::$stderr)) {
|
||||
self::$stderr = new ConsoleOutput('php://stderr');
|
||||
if (empty(static::$stderr)) {
|
||||
static::$stderr = new ConsoleOutput('php://stderr');
|
||||
}
|
||||
return self::$stderr;
|
||||
return static::$stderr;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -53,7 +53,7 @@ class ConsoleErrorHandler {
|
|||
* @return void
|
||||
*/
|
||||
public function handleException(Exception $exception) {
|
||||
$stderr = self::getStderr();
|
||||
$stderr = static::getStderr();
|
||||
$stderr->write(__d('cake_console', "<error>Error:</error> %s\n%s",
|
||||
$exception->getMessage(),
|
||||
$exception->getTraceAsString()
|
||||
|
@ -78,7 +78,7 @@ class ConsoleErrorHandler {
|
|||
if (error_reporting() === 0) {
|
||||
return;
|
||||
}
|
||||
$stderr = self::getStderr();
|
||||
$stderr = static::getStderr();
|
||||
list($name, $log) = ErrorHandler::mapErrorCode($code);
|
||||
$message = __d('cake_console', '%s in [%s, line %s]', $description, $file, $line);
|
||||
$stderr->write(__d('cake_console', "<error>%s Error:</error> %s\n", $name, $message));
|
||||
|
|
|
@ -165,7 +165,7 @@ class ConsoleOutput {
|
|||
$stream === 'php://output' ||
|
||||
(function_exists('posix_isatty') && !posix_isatty($this->_output))
|
||||
) {
|
||||
$this->_outputAs = self::PLAIN;
|
||||
$this->_outputAs = static::PLAIN;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -179,9 +179,9 @@ class ConsoleOutput {
|
|||
*/
|
||||
public function write($message, $newlines = 1) {
|
||||
if (is_array($message)) {
|
||||
$message = implode(self::LF, $message);
|
||||
$message = implode(static::LF, $message);
|
||||
}
|
||||
return $this->_write($this->styleText($message . str_repeat(self::LF, $newlines)));
|
||||
return $this->_write($this->styleText($message . str_repeat(static::LF, $newlines)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -191,11 +191,11 @@ class ConsoleOutput {
|
|||
* @return string String with color codes added.
|
||||
*/
|
||||
public function styleText($text) {
|
||||
if ($this->_outputAs == self::RAW) {
|
||||
if ($this->_outputAs == static::RAW) {
|
||||
return $text;
|
||||
}
|
||||
if ($this->_outputAs == self::PLAIN) {
|
||||
$tags = implode('|', array_keys(self::$_styles));
|
||||
if ($this->_outputAs == static::PLAIN) {
|
||||
$tags = implode('|', array_keys(static::$_styles));
|
||||
return preg_replace('#</?(?:' . $tags . ')>#', '', $text);
|
||||
}
|
||||
return preg_replace_callback(
|
||||
|
@ -216,16 +216,16 @@ class ConsoleOutput {
|
|||
}
|
||||
|
||||
$styleInfo = array();
|
||||
if (!empty($style['text']) && isset(self::$_foregroundColors[$style['text']])) {
|
||||
$styleInfo[] = self::$_foregroundColors[$style['text']];
|
||||
if (!empty($style['text']) && isset(static::$_foregroundColors[$style['text']])) {
|
||||
$styleInfo[] = static::$_foregroundColors[$style['text']];
|
||||
}
|
||||
if (!empty($style['background']) && isset(self::$_backgroundColors[$style['background']])) {
|
||||
$styleInfo[] = self::$_backgroundColors[$style['background']];
|
||||
if (!empty($style['background']) && isset(static::$_backgroundColors[$style['background']])) {
|
||||
$styleInfo[] = static::$_backgroundColors[$style['background']];
|
||||
}
|
||||
unset($style['text'], $style['background']);
|
||||
foreach ($style as $option => $value) {
|
||||
if ($value) {
|
||||
$styleInfo[] = self::$_options[$option];
|
||||
$styleInfo[] = static::$_options[$option];
|
||||
}
|
||||
}
|
||||
return "\033[" . implode($styleInfo, ';') . 'm' . $matches['text'] . "\033[0m";
|
||||
|
@ -268,16 +268,16 @@ class ConsoleOutput {
|
|||
*/
|
||||
public function styles($style = null, $definition = null) {
|
||||
if ($style === null && $definition === null) {
|
||||
return self::$_styles;
|
||||
return static::$_styles;
|
||||
}
|
||||
if (is_string($style) && $definition === null) {
|
||||
return isset(self::$_styles[$style]) ? self::$_styles[$style] : null;
|
||||
return isset(static::$_styles[$style]) ? static::$_styles[$style] : null;
|
||||
}
|
||||
if ($definition === false) {
|
||||
unset(self::$_styles[$style]);
|
||||
unset(static::$_styles[$style]);
|
||||
return true;
|
||||
}
|
||||
self::$_styles[$style] = $definition;
|
||||
static::$_styles[$style] = $definition;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ class PhpAcl extends Object implements AclInterface {
|
|||
*/
|
||||
public function __construct() {
|
||||
$this->options = array(
|
||||
'policy' => self::DENY,
|
||||
'policy' => static::DENY,
|
||||
'config' => APP . 'Config' . DS . 'acl.php',
|
||||
);
|
||||
}
|
||||
|
@ -252,7 +252,7 @@ class PhpAco {
|
|||
}
|
||||
|
||||
foreach ($root as $node => $elements) {
|
||||
$pattern = '/^' . str_replace(array_keys(self::$modifiers), array_values(self::$modifiers), $node) . '$/';
|
||||
$pattern = '/^' . str_replace(array_keys(static::$modifiers), array_values(static::$modifiers), $node) . '$/';
|
||||
|
||||
if ($node == $aco[$level] || preg_match($pattern, $aco[$level])) {
|
||||
// merge allow/denies with $path of current level
|
||||
|
@ -494,7 +494,7 @@ class PhpAro {
|
|||
return $this->aliases[$mapped];
|
||||
}
|
||||
}
|
||||
return self::DEFAULT_ROLE;
|
||||
return static::DEFAULT_ROLE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -610,7 +610,7 @@ class AuthComponent extends Component {
|
|||
}
|
||||
if ($user) {
|
||||
$this->Session->renew();
|
||||
$this->Session->write(self::$sessionKey, $user);
|
||||
$this->Session->write(static::$sessionKey, $user);
|
||||
$event = new CakeEvent('Auth.afterIdentify', $this, array('user' => $user));
|
||||
$this->_Collection->getController()->getEventManager()->dispatch($event);
|
||||
}
|
||||
|
@ -639,7 +639,7 @@ class AuthComponent extends Component {
|
|||
foreach ($this->_authenticateObjects as $auth) {
|
||||
$auth->logout($user);
|
||||
}
|
||||
$this->Session->delete(self::$sessionKey);
|
||||
$this->Session->delete(static::$sessionKey);
|
||||
$this->Session->delete('Auth.redirect');
|
||||
$this->Session->renew();
|
||||
return Router::normalize($this->logoutRedirect);
|
||||
|
@ -657,10 +657,10 @@ class AuthComponent extends Component {
|
|||
* @link http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#accessing-the-logged-in-user
|
||||
*/
|
||||
public static function user($key = null) {
|
||||
if (!empty(self::$_user)) {
|
||||
$user = self::$_user;
|
||||
} elseif (self::$sessionKey && CakeSession::check(self::$sessionKey)) {
|
||||
$user = CakeSession::read(self::$sessionKey);
|
||||
if (!empty(static::$_user)) {
|
||||
$user = static::$_user;
|
||||
} elseif (static::$sessionKey && CakeSession::check(static::$sessionKey)) {
|
||||
$user = CakeSession::read(static::$sessionKey);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
@ -689,7 +689,7 @@ class AuthComponent extends Component {
|
|||
foreach ($this->_authenticateObjects as $auth) {
|
||||
$result = $auth->getUser($this->request);
|
||||
if (!empty($result) && is_array($result)) {
|
||||
self::$_user = $result;
|
||||
static::$_user = $result;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -218,14 +218,14 @@ class App {
|
|||
* @link http://book.cakephp.org/2.0/en/core-utility-libraries/app.html#App::path
|
||||
*/
|
||||
public static function path($type, $plugin = null) {
|
||||
if (!empty(self::$legacy[$type])) {
|
||||
$type = self::$legacy[$type];
|
||||
if (!empty(static::$legacy[$type])) {
|
||||
$type = static::$legacy[$type];
|
||||
}
|
||||
|
||||
if (!empty($plugin)) {
|
||||
$path = array();
|
||||
$pluginPath = CakePlugin::path($plugin);
|
||||
$packageFormat = self::_packageFormat();
|
||||
$packageFormat = static::_packageFormat();
|
||||
if (!empty($packageFormat[$type])) {
|
||||
foreach ($packageFormat[$type] as $f) {
|
||||
$path[] = sprintf($f, $pluginPath);
|
||||
|
@ -234,10 +234,10 @@ class App {
|
|||
return $path;
|
||||
}
|
||||
|
||||
if (!isset(self::$_packages[$type])) {
|
||||
if (!isset(static::$_packages[$type])) {
|
||||
return array();
|
||||
}
|
||||
return self::$_packages[$type];
|
||||
return static::$_packages[$type];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -249,7 +249,7 @@ class App {
|
|||
* @link http://book.cakephp.org/2.0/en/core-utility-libraries/app.html#App::paths
|
||||
*/
|
||||
public static function paths() {
|
||||
return self::$_packages;
|
||||
return static::$_packages;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -279,8 +279,8 @@ class App {
|
|||
//Provides Backwards compatibility for old-style package names
|
||||
$legacyPaths = array();
|
||||
foreach ($paths as $type => $path) {
|
||||
if (!empty(self::$legacy[$type])) {
|
||||
$type = self::$legacy[$type];
|
||||
if (!empty(static::$legacy[$type])) {
|
||||
$type = static::$legacy[$type];
|
||||
}
|
||||
$legacyPaths[$type] = $path;
|
||||
}
|
||||
|
@ -288,17 +288,17 @@ class App {
|
|||
|
||||
if ($mode === App::RESET) {
|
||||
foreach ($paths as $type => $new) {
|
||||
self::$_packages[$type] = (array)$new;
|
||||
self::objects($type, null, false);
|
||||
static::$_packages[$type] = (array)$new;
|
||||
static::objects($type, null, false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (empty($paths)) {
|
||||
self::$_packageFormat = null;
|
||||
static::$_packageFormat = null;
|
||||
}
|
||||
|
||||
$packageFormat = self::_packageFormat();
|
||||
$packageFormat = static::_packageFormat();
|
||||
|
||||
if ($mode === App::REGISTER) {
|
||||
foreach ($paths as $package => $formats) {
|
||||
|
@ -309,7 +309,7 @@ class App {
|
|||
$packageFormat[$package] = array_values(array_unique($formats));
|
||||
}
|
||||
}
|
||||
self::$_packageFormat = $packageFormat;
|
||||
static::$_packageFormat = $packageFormat;
|
||||
}
|
||||
|
||||
$defaults = array();
|
||||
|
@ -320,7 +320,7 @@ class App {
|
|||
}
|
||||
|
||||
if (empty($paths)) {
|
||||
self::$_packages = $defaults;
|
||||
static::$_packages = $defaults;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -329,8 +329,8 @@ class App {
|
|||
}
|
||||
|
||||
foreach ($defaults as $type => $default) {
|
||||
if (!empty(self::$_packages[$type])) {
|
||||
$path = self::$_packages[$type];
|
||||
if (!empty(static::$_packages[$type])) {
|
||||
$path = static::$_packages[$type];
|
||||
} else {
|
||||
$path = $default;
|
||||
}
|
||||
|
@ -347,7 +347,7 @@ class App {
|
|||
$path = array_values(array_unique($path));
|
||||
}
|
||||
|
||||
self::$_packages[$type] = $path;
|
||||
static::$_packages[$type] = $path;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -380,12 +380,12 @@ class App {
|
|||
*/
|
||||
public static function themePath($theme) {
|
||||
$themeDir = 'Themed' . DS . Inflector::camelize($theme);
|
||||
foreach (self::$_packages['View'] as $path) {
|
||||
foreach (static::$_packages['View'] as $path) {
|
||||
if (is_dir($path . $themeDir)) {
|
||||
return $path . $themeDir . DS;
|
||||
}
|
||||
}
|
||||
return self::$_packages['View'][0] . $themeDir . DS;
|
||||
return static::$_packages['View'][0] . $themeDir . DS;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -427,8 +427,8 @@ class App {
|
|||
* @link http://book.cakephp.org/2.0/en/core-utility-libraries/app.html#App::objects
|
||||
*/
|
||||
public static function objects($type, $path = null, $cache = true) {
|
||||
if (empty(self::$_objects) && $cache === true) {
|
||||
self::$_objects = (array)Cache::read('object_map', '_cake_core_');
|
||||
if (empty(static::$_objects) && $cache === true) {
|
||||
static::$_objects = (array)Cache::read('object_map', '_cake_core_');
|
||||
}
|
||||
|
||||
$extension = '/\.php$/';
|
||||
|
@ -446,8 +446,8 @@ class App {
|
|||
|
||||
list($plugin, $type) = pluginSplit($type);
|
||||
|
||||
if (isset(self::$legacy[$type . 's'])) {
|
||||
$type = self::$legacy[$type . 's'];
|
||||
if (isset(static::$legacy[$type . 's'])) {
|
||||
$type = static::$legacy[$type . 's'];
|
||||
}
|
||||
|
||||
if ($type === 'file' && !$path) {
|
||||
|
@ -459,11 +459,11 @@ class App {
|
|||
|
||||
$cacheLocation = empty($plugin) ? 'app' : $plugin;
|
||||
|
||||
if ($cache !== true || !isset(self::$_objects[$cacheLocation][$name])) {
|
||||
if ($cache !== true || !isset(static::$_objects[$cacheLocation][$name])) {
|
||||
$objects = array();
|
||||
|
||||
if (empty($path)) {
|
||||
$path = self::path($type, $plugin);
|
||||
$path = static::path($type, $plugin);
|
||||
}
|
||||
|
||||
foreach ((array)$path as $dir) {
|
||||
|
@ -494,13 +494,13 @@ class App {
|
|||
return $objects;
|
||||
}
|
||||
|
||||
self::$_objects[$cacheLocation][$name] = $objects;
|
||||
static::$_objects[$cacheLocation][$name] = $objects;
|
||||
if ($cache) {
|
||||
self::$_objectCacheChange = true;
|
||||
static::$_objectCacheChange = true;
|
||||
}
|
||||
}
|
||||
|
||||
return self::$_objects[$cacheLocation][$name];
|
||||
return static::$_objects[$cacheLocation][$name];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -519,7 +519,7 @@ class App {
|
|||
* @link http://book.cakephp.org/2.0/en/core-utility-libraries/app.html#App::uses
|
||||
*/
|
||||
public static function uses($className, $location) {
|
||||
self::$_classMap[$className] = $location;
|
||||
static::$_classMap[$className] = $location;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -532,24 +532,24 @@ class App {
|
|||
* @return bool
|
||||
*/
|
||||
public static function load($className) {
|
||||
if (!isset(self::$_classMap[$className])) {
|
||||
if (!isset(static::$_classMap[$className])) {
|
||||
return false;
|
||||
}
|
||||
if (strpos($className, '..') !== false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$parts = explode('.', self::$_classMap[$className], 2);
|
||||
$parts = explode('.', static::$_classMap[$className], 2);
|
||||
list($plugin, $package) = count($parts) > 1 ? $parts : array(null, current($parts));
|
||||
|
||||
$file = self::_mapped($className, $plugin);
|
||||
$file = static::_mapped($className, $plugin);
|
||||
if ($file) {
|
||||
return include $file;
|
||||
}
|
||||
$paths = self::path($package, $plugin);
|
||||
$paths = static::path($package, $plugin);
|
||||
|
||||
if (empty($plugin)) {
|
||||
$appLibs = empty(self::$_packages['Lib']) ? APPLIBS : current(self::$_packages['Lib']);
|
||||
$appLibs = empty(static::$_packages['Lib']) ? APPLIBS : current(static::$_packages['Lib']);
|
||||
$paths[] = $appLibs . $package . DS;
|
||||
$paths[] = APP . $package . DS;
|
||||
$paths[] = CAKE . $package . DS;
|
||||
|
@ -563,7 +563,7 @@ class App {
|
|||
foreach ($paths as $path) {
|
||||
$file = $path . $normalizedClassName . '.php';
|
||||
if (file_exists($file)) {
|
||||
self::_map($file, $className, $plugin);
|
||||
static::_map($file, $className, $plugin);
|
||||
return include $file;
|
||||
}
|
||||
}
|
||||
|
@ -579,8 +579,8 @@ class App {
|
|||
* @link http://book.cakephp.org/2.0/en/core-utility-libraries/app.html#App::location
|
||||
*/
|
||||
public static function location($className) {
|
||||
if (!empty(self::$_classMap[$className])) {
|
||||
return self::$_classMap[$className];
|
||||
if (!empty(static::$_classMap[$className])) {
|
||||
return static::$_classMap[$className];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -629,8 +629,8 @@ class App {
|
|||
|
||||
$originalType = strtolower($type);
|
||||
$specialPackage = in_array($originalType, array('file', 'vendor'));
|
||||
if (!$specialPackage && isset(self::$legacy[$originalType . 's'])) {
|
||||
$type = self::$legacy[$originalType . 's'];
|
||||
if (!$specialPackage && isset(static::$legacy[$originalType . 's'])) {
|
||||
$type = static::$legacy[$originalType . 's'];
|
||||
}
|
||||
list($plugin, $name) = pluginSplit($name);
|
||||
if (!empty($plugin)) {
|
||||
|
@ -640,15 +640,15 @@ class App {
|
|||
}
|
||||
|
||||
if (!$specialPackage) {
|
||||
return self::_loadClass($name, $plugin, $type, $originalType, $parent);
|
||||
return static::_loadClass($name, $plugin, $type, $originalType, $parent);
|
||||
}
|
||||
|
||||
if ($originalType === 'file' && !empty($file)) {
|
||||
return self::_loadFile($name, $plugin, $search, $file, $return);
|
||||
return static::_loadFile($name, $plugin, $search, $file, $return);
|
||||
}
|
||||
|
||||
if ($originalType === 'vendor') {
|
||||
return self::_loadVendor($name, $plugin, $file, $ext);
|
||||
return static::_loadVendor($name, $plugin, $file, $ext);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -668,12 +668,12 @@ class App {
|
|||
protected static function _loadClass($name, $plugin, $type, $originalType, $parent) {
|
||||
if ($type === 'Console/Command' && $name === 'Shell') {
|
||||
$type = 'Console';
|
||||
} elseif (isset(self::$types[$originalType]['suffix'])) {
|
||||
$suffix = self::$types[$originalType]['suffix'];
|
||||
} elseif (isset(static::$types[$originalType]['suffix'])) {
|
||||
$suffix = static::$types[$originalType]['suffix'];
|
||||
$name .= ($suffix === $name) ? '' : $suffix;
|
||||
}
|
||||
if ($parent && isset(self::$types[$originalType]['extends'])) {
|
||||
$extends = self::$types[$originalType]['extends'];
|
||||
if ($parent && isset(static::$types[$originalType]['extends'])) {
|
||||
$extends = static::$types[$originalType]['extends'];
|
||||
$extendType = $type;
|
||||
if (strpos($extends, '/') !== false) {
|
||||
$parts = explode('/', $extends);
|
||||
|
@ -704,7 +704,7 @@ class App {
|
|||
* @return mixed if $return contents of the file after php parses it, boolean indicating success otherwise
|
||||
*/
|
||||
protected static function _loadFile($name, $plugin, $search, $file, $return) {
|
||||
$mapped = self::_mapped($name, $plugin);
|
||||
$mapped = static::_mapped($name, $plugin);
|
||||
if ($mapped) {
|
||||
$file = $mapped;
|
||||
} elseif (!empty($search)) {
|
||||
|
@ -721,7 +721,7 @@ class App {
|
|||
}
|
||||
}
|
||||
if (!empty($file) && file_exists($file)) {
|
||||
self::_map($file, $name, $plugin);
|
||||
static::_map($file, $name, $plugin);
|
||||
$returnValue = include $file;
|
||||
if ($return) {
|
||||
return $returnValue;
|
||||
|
@ -741,7 +741,7 @@ class App {
|
|||
* @return bool true if the file was loaded successfully, false otherwise
|
||||
*/
|
||||
protected static function _loadVendor($name, $plugin, $file, $ext) {
|
||||
if ($mapped = self::_mapped($name, $plugin)) {
|
||||
if ($mapped = static::_mapped($name, $plugin)) {
|
||||
return (bool)include_once $mapped;
|
||||
}
|
||||
$fileTries = array();
|
||||
|
@ -759,7 +759,7 @@ class App {
|
|||
foreach ($fileTries as $file) {
|
||||
foreach ($paths as $path) {
|
||||
if (file_exists($path . $file)) {
|
||||
self::_map($path . $file, $name, $plugin);
|
||||
static::_map($path . $file, $name, $plugin);
|
||||
return (bool)include $path . $file;
|
||||
}
|
||||
}
|
||||
|
@ -773,7 +773,7 @@ class App {
|
|||
* @return void
|
||||
*/
|
||||
public static function init() {
|
||||
self::$_map += (array)Cache::read('file_map', '_cake_core_');
|
||||
static::$_map += (array)Cache::read('file_map', '_cake_core_');
|
||||
register_shutdown_function(array('App', 'shutdown'));
|
||||
}
|
||||
|
||||
|
@ -790,14 +790,14 @@ class App {
|
|||
if ($plugin) {
|
||||
$key = 'plugin.' . $name;
|
||||
}
|
||||
if ($plugin && empty(self::$_map[$name])) {
|
||||
self::$_map[$key] = $file;
|
||||
if ($plugin && empty(static::$_map[$name])) {
|
||||
static::$_map[$key] = $file;
|
||||
}
|
||||
if (!$plugin && empty(self::$_map['plugin.' . $name])) {
|
||||
self::$_map[$key] = $file;
|
||||
if (!$plugin && empty(static::$_map['plugin.' . $name])) {
|
||||
static::$_map[$key] = $file;
|
||||
}
|
||||
if (!self::$bootstrapping) {
|
||||
self::$_cacheChange = true;
|
||||
if (!static::$bootstrapping) {
|
||||
static::$_cacheChange = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -813,7 +813,7 @@ class App {
|
|||
if ($plugin) {
|
||||
$key = 'plugin.' . $name;
|
||||
}
|
||||
return isset(self::$_map[$key]) ? self::$_map[$key] : false;
|
||||
return isset(static::$_map[$key]) ? static::$_map[$key] : false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -822,8 +822,8 @@ class App {
|
|||
* @return array templates for each customizable package path
|
||||
*/
|
||||
protected static function _packageFormat() {
|
||||
if (empty(self::$_packageFormat)) {
|
||||
self::$_packageFormat = array(
|
||||
if (empty(static::$_packageFormat)) {
|
||||
static::$_packageFormat = array(
|
||||
'Model' => array(
|
||||
'%s' . 'Model' . DS
|
||||
),
|
||||
|
@ -885,7 +885,7 @@ class App {
|
|||
);
|
||||
}
|
||||
|
||||
return self::$_packageFormat;
|
||||
return static::$_packageFormat;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -897,13 +897,13 @@ class App {
|
|||
* @return void
|
||||
*/
|
||||
public static function shutdown() {
|
||||
if (self::$_cacheChange) {
|
||||
Cache::write('file_map', array_filter(self::$_map), '_cake_core_');
|
||||
if (static::$_cacheChange) {
|
||||
Cache::write('file_map', array_filter(static::$_map), '_cake_core_');
|
||||
}
|
||||
if (self::$_objectCacheChange) {
|
||||
Cache::write('object_map', self::$_objects, '_cake_core_');
|
||||
if (static::$_objectCacheChange) {
|
||||
Cache::write('object_map', static::$_objects, '_cake_core_');
|
||||
}
|
||||
self::_checkFatalError();
|
||||
static::_checkFatalError();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -91,7 +91,7 @@ class CakePlugin {
|
|||
if (is_array($plugin)) {
|
||||
foreach ($plugin as $name => $conf) {
|
||||
list($name, $conf) = (is_numeric($name)) ? array($conf, $config) : array($name, $conf);
|
||||
self::load($name, $conf);
|
||||
static::load($name, $conf);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -99,26 +99,26 @@ class CakePlugin {
|
|||
if (empty($config['path'])) {
|
||||
foreach (App::path('plugins') as $path) {
|
||||
if (is_dir($path . $plugin)) {
|
||||
self::$_plugins[$plugin] = $config + array('path' => $path . $plugin . DS);
|
||||
static::$_plugins[$plugin] = $config + array('path' => $path . $plugin . DS);
|
||||
break;
|
||||
}
|
||||
|
||||
//Backwards compatibility to make easier to migrate to 2.0
|
||||
$underscored = Inflector::underscore($plugin);
|
||||
if (is_dir($path . $underscored)) {
|
||||
self::$_plugins[$plugin] = $config + array('path' => $path . $underscored . DS);
|
||||
static::$_plugins[$plugin] = $config + array('path' => $path . $underscored . DS);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
self::$_plugins[$plugin] = $config;
|
||||
static::$_plugins[$plugin] = $config;
|
||||
}
|
||||
|
||||
if (empty(self::$_plugins[$plugin]['path'])) {
|
||||
if (empty(static::$_plugins[$plugin]['path'])) {
|
||||
throw new MissingPluginException(array('plugin' => $plugin));
|
||||
}
|
||||
if (!empty(self::$_plugins[$plugin]['bootstrap'])) {
|
||||
self::bootstrap($plugin);
|
||||
if (!empty(static::$_plugins[$plugin]['bootstrap'])) {
|
||||
static::bootstrap($plugin);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -160,7 +160,7 @@ class CakePlugin {
|
|||
if (isset($options[0])) {
|
||||
$opts += $options[0];
|
||||
}
|
||||
self::load($p, $opts);
|
||||
static::load($p, $opts);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -172,10 +172,10 @@ class CakePlugin {
|
|||
* @throws MissingPluginException if the folder for plugin was not found or plugin has not been loaded
|
||||
*/
|
||||
public static function path($plugin) {
|
||||
if (empty(self::$_plugins[$plugin])) {
|
||||
if (empty(static::$_plugins[$plugin])) {
|
||||
throw new MissingPluginException(array('plugin' => $plugin));
|
||||
}
|
||||
return self::$_plugins[$plugin]['path'];
|
||||
return static::$_plugins[$plugin]['path'];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -186,7 +186,7 @@ class CakePlugin {
|
|||
* @see CakePlugin::load() for examples of bootstrap configuration
|
||||
*/
|
||||
public static function bootstrap($plugin) {
|
||||
$config = self::$_plugins[$plugin];
|
||||
$config = static::$_plugins[$plugin];
|
||||
if ($config['bootstrap'] === false) {
|
||||
return false;
|
||||
}
|
||||
|
@ -194,9 +194,9 @@ class CakePlugin {
|
|||
return call_user_func_array($config['bootstrap'], array($plugin, $config));
|
||||
}
|
||||
|
||||
$path = self::path($plugin);
|
||||
$path = static::path($plugin);
|
||||
if ($config['bootstrap'] === true) {
|
||||
return self::_includeFile(
|
||||
return static::_includeFile(
|
||||
$path . 'Config' . DS . 'bootstrap.php',
|
||||
$config['ignoreMissing']
|
||||
);
|
||||
|
@ -204,7 +204,7 @@ class CakePlugin {
|
|||
|
||||
$bootstrap = (array)$config['bootstrap'];
|
||||
foreach ($bootstrap as $file) {
|
||||
self::_includeFile(
|
||||
static::_includeFile(
|
||||
$path . 'Config' . DS . $file . '.php',
|
||||
$config['ignoreMissing']
|
||||
);
|
||||
|
@ -222,17 +222,17 @@ class CakePlugin {
|
|||
*/
|
||||
public static function routes($plugin = null) {
|
||||
if ($plugin === null) {
|
||||
foreach (self::loaded() as $p) {
|
||||
self::routes($p);
|
||||
foreach (static::loaded() as $p) {
|
||||
static::routes($p);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
$config = self::$_plugins[$plugin];
|
||||
$config = static::$_plugins[$plugin];
|
||||
if ($config['routes'] === false) {
|
||||
return false;
|
||||
}
|
||||
return (bool)self::_includeFile(
|
||||
self::path($plugin) . 'Config' . DS . 'routes.php',
|
||||
return (bool)static::_includeFile(
|
||||
static::path($plugin) . 'Config' . DS . 'routes.php',
|
||||
$config['ignoreMissing']
|
||||
);
|
||||
}
|
||||
|
@ -247,9 +247,9 @@ class CakePlugin {
|
|||
*/
|
||||
public static function loaded($plugin = null) {
|
||||
if ($plugin) {
|
||||
return isset(self::$_plugins[$plugin]);
|
||||
return isset(static::$_plugins[$plugin]);
|
||||
}
|
||||
$return = array_keys(self::$_plugins);
|
||||
$return = array_keys(static::$_plugins);
|
||||
sort($return);
|
||||
return $return;
|
||||
}
|
||||
|
@ -262,9 +262,9 @@ class CakePlugin {
|
|||
*/
|
||||
public static function unload($plugin = null) {
|
||||
if ($plugin === null) {
|
||||
self::$_plugins = array();
|
||||
static::$_plugins = array();
|
||||
} else {
|
||||
unset(self::$_plugins[$plugin]);
|
||||
unset(static::$_plugins[$plugin]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ class Configure {
|
|||
*/
|
||||
public static function bootstrap($boot = true) {
|
||||
if ($boot) {
|
||||
self::_appDefaults();
|
||||
static::_appDefaults();
|
||||
|
||||
if (!include APP . 'Config' . DS . 'core.php') {
|
||||
trigger_error(__d('cake_dev',
|
||||
|
@ -87,7 +87,7 @@ class Configure {
|
|||
'handler' => 'ErrorHandler::handleError',
|
||||
'level' => E_ALL & ~E_DEPRECATED,
|
||||
);
|
||||
self::_setErrorHandlers($error, $exception);
|
||||
static::_setErrorHandlers($error, $exception);
|
||||
|
||||
if (!include APP . 'Config' . DS . 'bootstrap.php') {
|
||||
trigger_error(__d('cake_dev',
|
||||
|
@ -98,13 +98,13 @@ class Configure {
|
|||
}
|
||||
restore_error_handler();
|
||||
|
||||
self::_setErrorHandlers(
|
||||
self::$_values['Error'],
|
||||
self::$_values['Exception']
|
||||
static::_setErrorHandlers(
|
||||
static::$_values['Error'],
|
||||
static::$_values['Exception']
|
||||
);
|
||||
|
||||
// Preload Debugger + CakeText in case of E_STRICT errors when loading files.
|
||||
if (self::$_values['debug'] > 0) {
|
||||
if (static::$_values['debug'] > 0) {
|
||||
class_exists('Debugger');
|
||||
class_exists('CakeText');
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ class Configure {
|
|||
* @return void
|
||||
*/
|
||||
protected static function _appDefaults() {
|
||||
self::write('App', (array)self::read('App') + array(
|
||||
static::write('App', (array)static::read('App') + array(
|
||||
'base' => false,
|
||||
'baseUrl' => false,
|
||||
'dir' => APP_DIR,
|
||||
|
@ -156,11 +156,11 @@ class Configure {
|
|||
}
|
||||
|
||||
foreach ($config as $name => $value) {
|
||||
self::$_values = Hash::insert(self::$_values, $name, $value);
|
||||
static::$_values = Hash::insert(static::$_values, $name, $value);
|
||||
}
|
||||
|
||||
if (isset($config['debug']) && function_exists('ini_set')) {
|
||||
if (self::$_values['debug']) {
|
||||
if (static::$_values['debug']) {
|
||||
ini_set('display_errors', 1);
|
||||
} else {
|
||||
ini_set('display_errors', 0);
|
||||
|
@ -185,9 +185,9 @@ class Configure {
|
|||
*/
|
||||
public static function read($var = null) {
|
||||
if ($var === null) {
|
||||
return self::$_values;
|
||||
return static::$_values;
|
||||
}
|
||||
return Hash::get(self::$_values, $var);
|
||||
return Hash::get(static::$_values, $var);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -201,16 +201,16 @@ class Configure {
|
|||
*/
|
||||
public static function consume($var) {
|
||||
$simple = strpos($var, '.') === false;
|
||||
if ($simple && !isset(self::$_values[$var])) {
|
||||
if ($simple && !isset(static::$_values[$var])) {
|
||||
return null;
|
||||
}
|
||||
if ($simple) {
|
||||
$value = self::$_values[$var];
|
||||
unset(self::$_values[$var]);
|
||||
$value = static::$_values[$var];
|
||||
unset(static::$_values[$var]);
|
||||
return $value;
|
||||
}
|
||||
$value = Hash::get(self::$_values, $var);
|
||||
self::$_values = Hash::remove(self::$_values, $var);
|
||||
$value = Hash::get(static::$_values, $var);
|
||||
static::$_values = Hash::remove(static::$_values, $var);
|
||||
return $value;
|
||||
}
|
||||
|
||||
|
@ -224,7 +224,7 @@ class Configure {
|
|||
if (empty($var)) {
|
||||
return false;
|
||||
}
|
||||
return Hash::get(self::$_values, $var) !== null;
|
||||
return Hash::get(static::$_values, $var) !== null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -241,7 +241,7 @@ class Configure {
|
|||
* @link http://book.cakephp.org/2.0/en/development/configuration.html#Configure::delete
|
||||
*/
|
||||
public static function delete($var) {
|
||||
self::$_values = Hash::remove(self::$_values, $var);
|
||||
static::$_values = Hash::remove(static::$_values, $var);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -259,7 +259,7 @@ class Configure {
|
|||
* @return void
|
||||
*/
|
||||
public static function config($name, ConfigReaderInterface $reader) {
|
||||
self::$_readers[$name] = $reader;
|
||||
static::$_readers[$name] = $reader;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -270,9 +270,9 @@ class Configure {
|
|||
*/
|
||||
public static function configured($name = null) {
|
||||
if ($name) {
|
||||
return isset(self::$_readers[$name]);
|
||||
return isset(static::$_readers[$name]);
|
||||
}
|
||||
return array_keys(self::$_readers);
|
||||
return array_keys(static::$_readers);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -283,10 +283,10 @@ class Configure {
|
|||
* @return bool Success
|
||||
*/
|
||||
public static function drop($name) {
|
||||
if (!isset(self::$_readers[$name])) {
|
||||
if (!isset(static::$_readers[$name])) {
|
||||
return false;
|
||||
}
|
||||
unset(self::$_readers[$name]);
|
||||
unset(static::$_readers[$name]);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -316,7 +316,7 @@ class Configure {
|
|||
* @link http://book.cakephp.org/2.0/en/development/configuration.html#Configure::load
|
||||
*/
|
||||
public static function load($key, $config = 'default', $merge = true) {
|
||||
$reader = self::_getReader($config);
|
||||
$reader = static::_getReader($config);
|
||||
if (!$reader) {
|
||||
return false;
|
||||
}
|
||||
|
@ -325,13 +325,13 @@ class Configure {
|
|||
if ($merge) {
|
||||
$keys = array_keys($values);
|
||||
foreach ($keys as $key) {
|
||||
if (($c = self::read($key)) && is_array($values[$key]) && is_array($c)) {
|
||||
if (($c = static::read($key)) && is_array($values[$key]) && is_array($c)) {
|
||||
$values[$key] = Hash::merge($c, $values[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return self::write($values);
|
||||
return static::write($values);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -360,14 +360,14 @@ class Configure {
|
|||
* @throws ConfigureException if the adapter does not implement a `dump` method.
|
||||
*/
|
||||
public static function dump($key, $config = 'default', $keys = array()) {
|
||||
$reader = self::_getReader($config);
|
||||
$reader = static::_getReader($config);
|
||||
if (!$reader) {
|
||||
throw new ConfigureException(__d('cake_dev', 'There is no "%s" adapter.', $config));
|
||||
}
|
||||
if (!method_exists($reader, 'dump')) {
|
||||
throw new ConfigureException(__d('cake_dev', 'The "%s" adapter, does not have a %s method.', $config, 'dump()'));
|
||||
}
|
||||
$values = self::$_values;
|
||||
$values = static::$_values;
|
||||
if (!empty($keys) && is_array($keys)) {
|
||||
$values = array_intersect_key($values, array_flip($keys));
|
||||
}
|
||||
|
@ -382,14 +382,14 @@ class Configure {
|
|||
* @return mixed Reader instance or false
|
||||
*/
|
||||
protected static function _getReader($config) {
|
||||
if (!isset(self::$_readers[$config])) {
|
||||
if (!isset(static::$_readers[$config])) {
|
||||
if ($config !== 'default') {
|
||||
return false;
|
||||
}
|
||||
App::uses('PhpReader', 'Configure');
|
||||
self::config($config, new PhpReader());
|
||||
static::config($config, new PhpReader());
|
||||
}
|
||||
return self::$_readers[$config];
|
||||
return static::$_readers[$config];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -400,11 +400,11 @@ class Configure {
|
|||
* @return string Current version of CakePHP
|
||||
*/
|
||||
public static function version() {
|
||||
if (!isset(self::$_values['Cake']['version'])) {
|
||||
if (!isset(static::$_values['Cake']['version'])) {
|
||||
require CAKE . 'Config' . DS . 'config.php';
|
||||
self::write($config);
|
||||
static::write($config);
|
||||
}
|
||||
return self::$_values['Cake']['version'];
|
||||
return static::$_values['Cake']['version'];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -419,7 +419,7 @@ class Configure {
|
|||
*/
|
||||
public static function store($name, $cacheConfig = 'default', $data = null) {
|
||||
if ($data === null) {
|
||||
$data = self::$_values;
|
||||
$data = static::$_values;
|
||||
}
|
||||
return Cache::write($name, $data, $cacheConfig);
|
||||
}
|
||||
|
@ -435,7 +435,7 @@ class Configure {
|
|||
public static function restore($name, $cacheConfig = 'default') {
|
||||
$values = Cache::read($name, $cacheConfig);
|
||||
if ($values) {
|
||||
return self::write($values);
|
||||
return static::write($values);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -446,7 +446,7 @@ class Configure {
|
|||
* @return bool Success.
|
||||
*/
|
||||
public static function clear() {
|
||||
self::$_values = array();
|
||||
static::$_values = array();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ class ErrorHandler {
|
|||
*/
|
||||
public static function handleException(Exception $exception) {
|
||||
$config = Configure::read('Exception');
|
||||
self::_log($exception, $config);
|
||||
static::_log($exception, $config);
|
||||
|
||||
$renderer = isset($config['renderer']) ? $config['renderer'] : 'ExceptionRenderer';
|
||||
if ($renderer !== 'ExceptionRenderer') {
|
||||
|
@ -134,7 +134,7 @@ class ErrorHandler {
|
|||
$e->getTraceAsString()
|
||||
);
|
||||
|
||||
self::$_bailExceptionRendering = true;
|
||||
static::$_bailExceptionRendering = true;
|
||||
trigger_error($message, E_USER_ERROR);
|
||||
}
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ class ErrorHandler {
|
|||
}
|
||||
}
|
||||
}
|
||||
return CakeLog::write(LOG_ERR, self::_getMessage($exception));
|
||||
return CakeLog::write(LOG_ERR, static::_getMessage($exception));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -208,9 +208,9 @@ class ErrorHandler {
|
|||
return false;
|
||||
}
|
||||
$errorConfig = Configure::read('Error');
|
||||
list($error, $log) = self::mapErrorCode($code);
|
||||
list($error, $log) = static::mapErrorCode($code);
|
||||
if ($log === LOG_ERR) {
|
||||
return self::handleFatalError($code, $description, $file, $line);
|
||||
return static::handleFatalError($code, $description, $file, $line);
|
||||
}
|
||||
|
||||
$debug = Configure::read('debug');
|
||||
|
@ -266,8 +266,8 @@ class ErrorHandler {
|
|||
$exception = new InternalErrorException();
|
||||
}
|
||||
|
||||
if (self::$_bailExceptionRendering) {
|
||||
self::$_bailExceptionRendering = false;
|
||||
if (static::$_bailExceptionRendering) {
|
||||
static::$_bailExceptionRendering = false;
|
||||
throw $exception;
|
||||
}
|
||||
|
||||
|
|
|
@ -67,14 +67,14 @@ class CakeEventManager {
|
|||
*/
|
||||
public static function instance($manager = null) {
|
||||
if ($manager instanceof CakeEventManager) {
|
||||
self::$_generalManager = $manager;
|
||||
static::$_generalManager = $manager;
|
||||
}
|
||||
if (empty(self::$_generalManager)) {
|
||||
self::$_generalManager = new CakeEventManager();
|
||||
if (empty(static::$_generalManager)) {
|
||||
static::$_generalManager = new CakeEventManager();
|
||||
}
|
||||
|
||||
self::$_generalManager->_isGlobal = true;
|
||||
return self::$_generalManager;
|
||||
static::$_generalManager->_isGlobal = true;
|
||||
return static::$_generalManager;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -105,7 +105,7 @@ class CakeEventManager {
|
|||
$this->_attachSubscriber($callable);
|
||||
return;
|
||||
}
|
||||
$options = $options + array('priority' => self::$defaultPriority, 'passParams' => false);
|
||||
$options = $options + array('priority' => static::$defaultPriority, 'passParams' => false);
|
||||
$this->_listeners[$eventKey][$options['priority']][] = array(
|
||||
'callable' => $callable,
|
||||
'passParams' => $options['passParams'],
|
||||
|
@ -265,7 +265,7 @@ class CakeEventManager {
|
|||
$localListeners = $this->prioritisedListeners($eventKey);
|
||||
$localListeners = empty($localListeners) ? array() : $localListeners;
|
||||
}
|
||||
$globalListeners = self::instance()->prioritisedListeners($eventKey);
|
||||
$globalListeners = static::instance()->prioritisedListeners($eventKey);
|
||||
$globalListeners = empty($globalListeners) ? array() : $globalListeners;
|
||||
|
||||
$priorities = array_merge(array_keys($globalListeners), array_keys($localListeners));
|
||||
|
|
|
@ -223,7 +223,7 @@ class I18n {
|
|||
}
|
||||
|
||||
if ($domain === null) {
|
||||
$domain = self::$defaultDomain;
|
||||
$domain = static::$defaultDomain;
|
||||
}
|
||||
if ($domain === '') {
|
||||
throw new CakeException(__d('cake_dev', 'You cannot use "" as a domain.'));
|
||||
|
@ -399,7 +399,7 @@ class I18n {
|
|||
foreach ($this->l10n->languagePath as $lang) {
|
||||
$localeDef = $directory . $lang . DS . $this->category;
|
||||
if (is_file($localeDef)) {
|
||||
$definitions = self::loadLocaleDefinition($localeDef);
|
||||
$definitions = static::loadLocaleDefinition($localeDef);
|
||||
if ($definitions !== false) {
|
||||
$this->_domains[$domain][$this->_lang][$this->category] = $definitions;
|
||||
$this->_noLocale = false;
|
||||
|
@ -412,10 +412,10 @@ class I18n {
|
|||
$translations = false;
|
||||
|
||||
if (is_file($app . '.mo')) {
|
||||
$translations = self::loadMo($app . '.mo');
|
||||
$translations = static::loadMo($app . '.mo');
|
||||
}
|
||||
if ($translations === false && is_file($app . '.po')) {
|
||||
$translations = self::loadPo($app . '.po');
|
||||
$translations = static::loadPo($app . '.po');
|
||||
}
|
||||
|
||||
if ($translations !== false) {
|
||||
|
@ -430,10 +430,10 @@ class I18n {
|
|||
$translations = false;
|
||||
|
||||
if (is_file($file . '.mo')) {
|
||||
$translations = self::loadMo($file . '.mo');
|
||||
$translations = static::loadMo($file . '.mo');
|
||||
}
|
||||
if ($translations === false && is_file($file . '.po')) {
|
||||
$translations = self::loadPo($file . '.po');
|
||||
$translations = static::loadPo($file . '.po');
|
||||
}
|
||||
|
||||
if ($translations !== false) {
|
||||
|
|
|
@ -550,7 +550,7 @@ class Multibyte {
|
|||
$matched = true;
|
||||
} else {
|
||||
$matched = false;
|
||||
$keys = self::_find($char, 'upper');
|
||||
$keys = static::_find($char, 'upper');
|
||||
|
||||
if (!empty($keys)) {
|
||||
foreach ($keys as $key => $value) {
|
||||
|
@ -596,7 +596,7 @@ class Multibyte {
|
|||
|
||||
} else {
|
||||
$matched = false;
|
||||
$keys = self::_find($char);
|
||||
$keys = static::_find($char);
|
||||
$keyCount = count($keys);
|
||||
|
||||
if (!empty($keys)) {
|
||||
|
@ -815,7 +815,7 @@ class Multibyte {
|
|||
} else {
|
||||
$return = false;
|
||||
}
|
||||
self::$_codeRange[$decimal] = $return;
|
||||
static::$_codeRange[$decimal] = $return;
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
@ -828,8 +828,8 @@ class Multibyte {
|
|||
*/
|
||||
protected static function _find($char, $type = 'lower') {
|
||||
$found = array();
|
||||
if (!isset(self::$_codeRange[$char])) {
|
||||
$range = self::_codepoint($char);
|
||||
if (!isset(static::$_codeRange[$char])) {
|
||||
$range = static::_codepoint($char);
|
||||
if ($range === false) {
|
||||
return array();
|
||||
}
|
||||
|
@ -838,21 +838,21 @@ class Multibyte {
|
|||
Configure::config('_cake_core_', new PhpReader(CAKE . 'Config' . DS));
|
||||
}
|
||||
Configure::load('unicode' . DS . 'casefolding' . DS . $range, '_cake_core_');
|
||||
self::$_caseFold[$range] = Configure::read($range);
|
||||
static::$_caseFold[$range] = Configure::read($range);
|
||||
Configure::delete($range);
|
||||
}
|
||||
|
||||
if (!self::$_codeRange[$char]) {
|
||||
if (!static::$_codeRange[$char]) {
|
||||
return array();
|
||||
}
|
||||
self::$_table = self::$_codeRange[$char];
|
||||
$count = count(self::$_caseFold[self::$_table]);
|
||||
static::$_table = static::$_codeRange[$char];
|
||||
$count = count(static::$_caseFold[static::$_table]);
|
||||
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
if ($type === 'lower' && self::$_caseFold[self::$_table][$i][$type][0] === $char) {
|
||||
$found[] = self::$_caseFold[self::$_table][$i];
|
||||
} elseif ($type === 'upper' && self::$_caseFold[self::$_table][$i][$type] === $char) {
|
||||
$found[] = self::$_caseFold[self::$_table][$i];
|
||||
if ($type === 'lower' && static::$_caseFold[static::$_table][$i][$type][0] === $char) {
|
||||
$found[] = static::$_caseFold[static::$_table][$i];
|
||||
} elseif ($type === 'upper' && static::$_caseFold[static::$_table][$i][$type] === $char) {
|
||||
$found[] = static::$_caseFold[static::$_table][$i];
|
||||
}
|
||||
}
|
||||
return $found;
|
||||
|
|
|
@ -118,8 +118,8 @@ class CakeLog {
|
|||
* @return void
|
||||
*/
|
||||
protected static function _init() {
|
||||
self::$_levels = self::defaultLevels();
|
||||
self::$_Collection = new LogEngineCollection();
|
||||
static::$_levels = static::defaultLevels();
|
||||
static::$_Collection = new LogEngineCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -193,10 +193,10 @@ class CakeLog {
|
|||
if (empty($config['engine'])) {
|
||||
throw new CakeLogException(__d('cake_dev', 'Missing logger class name'));
|
||||
}
|
||||
if (empty(self::$_Collection)) {
|
||||
self::_init();
|
||||
if (empty(static::$_Collection)) {
|
||||
static::_init();
|
||||
}
|
||||
self::$_Collection->load($key, $config);
|
||||
static::$_Collection->load($key, $config);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -206,10 +206,10 @@ class CakeLog {
|
|||
* @return array Array of configured log streams.
|
||||
*/
|
||||
public static function configured() {
|
||||
if (empty(self::$_Collection)) {
|
||||
self::_init();
|
||||
if (empty(static::$_Collection)) {
|
||||
static::_init();
|
||||
}
|
||||
return self::$_Collection->loaded();
|
||||
return static::$_Collection->loaded();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -259,20 +259,20 @@ class CakeLog {
|
|||
* @return array Active log levels
|
||||
*/
|
||||
public static function levels($levels = array(), $append = true) {
|
||||
if (empty(self::$_Collection)) {
|
||||
self::_init();
|
||||
if (empty(static::$_Collection)) {
|
||||
static::_init();
|
||||
}
|
||||
if (empty($levels)) {
|
||||
return self::$_levels;
|
||||
return static::$_levels;
|
||||
}
|
||||
$levels = array_values($levels);
|
||||
if ($append) {
|
||||
self::$_levels = array_merge(self::$_levels, $levels);
|
||||
static::$_levels = array_merge(static::$_levels, $levels);
|
||||
} else {
|
||||
self::$_levels = $levels;
|
||||
static::$_levels = $levels;
|
||||
}
|
||||
self::$_levelMap = array_flip(self::$_levels);
|
||||
return self::$_levels;
|
||||
static::$_levelMap = array_flip(static::$_levels);
|
||||
return static::$_levels;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -281,9 +281,9 @@ class CakeLog {
|
|||
* @return array Default log levels
|
||||
*/
|
||||
public static function defaultLevels() {
|
||||
self::$_levelMap = self::$_defaultLevels;
|
||||
self::$_levels = array_flip(self::$_levelMap);
|
||||
return self::$_levels;
|
||||
static::$_levelMap = static::$_defaultLevels;
|
||||
static::$_levels = array_flip(static::$_levelMap);
|
||||
return static::$_levels;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -294,10 +294,10 @@ class CakeLog {
|
|||
* @return void
|
||||
*/
|
||||
public static function drop($streamName) {
|
||||
if (empty(self::$_Collection)) {
|
||||
self::_init();
|
||||
if (empty(static::$_Collection)) {
|
||||
static::_init();
|
||||
}
|
||||
self::$_Collection->unload($streamName);
|
||||
static::$_Collection->unload($streamName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -308,13 +308,13 @@ class CakeLog {
|
|||
* @throws CakeLogException
|
||||
*/
|
||||
public static function enabled($streamName) {
|
||||
if (empty(self::$_Collection)) {
|
||||
self::_init();
|
||||
if (empty(static::$_Collection)) {
|
||||
static::_init();
|
||||
}
|
||||
if (!isset(self::$_Collection->{$streamName})) {
|
||||
if (!isset(static::$_Collection->{$streamName})) {
|
||||
throw new CakeLogException(__d('cake_dev', 'Stream %s not found', $streamName));
|
||||
}
|
||||
return self::$_Collection->enabled($streamName);
|
||||
return static::$_Collection->enabled($streamName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -326,13 +326,13 @@ class CakeLog {
|
|||
* @throws CakeLogException
|
||||
*/
|
||||
public static function enable($streamName) {
|
||||
if (empty(self::$_Collection)) {
|
||||
self::_init();
|
||||
if (empty(static::$_Collection)) {
|
||||
static::_init();
|
||||
}
|
||||
if (!isset(self::$_Collection->{$streamName})) {
|
||||
if (!isset(static::$_Collection->{$streamName})) {
|
||||
throw new CakeLogException(__d('cake_dev', 'Stream %s not found', $streamName));
|
||||
}
|
||||
self::$_Collection->enable($streamName);
|
||||
static::$_Collection->enable($streamName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -345,13 +345,13 @@ class CakeLog {
|
|||
* @throws CakeLogException
|
||||
*/
|
||||
public static function disable($streamName) {
|
||||
if (empty(self::$_Collection)) {
|
||||
self::_init();
|
||||
if (empty(static::$_Collection)) {
|
||||
static::_init();
|
||||
}
|
||||
if (!isset(self::$_Collection->{$streamName})) {
|
||||
if (!isset(static::$_Collection->{$streamName})) {
|
||||
throw new CakeLogException(__d('cake_dev', 'Stream %s not found', $streamName));
|
||||
}
|
||||
self::$_Collection->disable($streamName);
|
||||
static::$_Collection->disable($streamName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -362,11 +362,11 @@ class CakeLog {
|
|||
* @see BaseLog
|
||||
*/
|
||||
public static function stream($streamName) {
|
||||
if (empty(self::$_Collection)) {
|
||||
self::_init();
|
||||
if (empty(static::$_Collection)) {
|
||||
static::_init();
|
||||
}
|
||||
if (!empty(self::$_Collection->{$streamName})) {
|
||||
return self::$_Collection->{$streamName};
|
||||
if (!empty(static::$_Collection->{$streamName})) {
|
||||
return static::$_Collection->{$streamName};
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -403,19 +403,19 @@ class CakeLog {
|
|||
* @link http://book.cakephp.org/2.0/en/core-libraries/logging.html#writing-to-logs
|
||||
*/
|
||||
public static function write($type, $message, $scope = array()) {
|
||||
if (empty(self::$_Collection)) {
|
||||
self::_init();
|
||||
if (empty(static::$_Collection)) {
|
||||
static::_init();
|
||||
}
|
||||
|
||||
if (is_int($type) && isset(self::$_levels[$type])) {
|
||||
$type = self::$_levels[$type];
|
||||
if (is_int($type) && isset(static::$_levels[$type])) {
|
||||
$type = static::$_levels[$type];
|
||||
}
|
||||
if (is_string($type) && empty($scope) && !in_array($type, self::$_levels)) {
|
||||
if (is_string($type) && empty($scope) && !in_array($type, static::$_levels)) {
|
||||
$scope = $type;
|
||||
}
|
||||
$logged = false;
|
||||
foreach (self::$_Collection->enabled() as $streamName) {
|
||||
$logger = self::$_Collection->{$streamName};
|
||||
foreach (static::$_Collection->enabled() as $streamName) {
|
||||
$logger = static::$_Collection->{$streamName};
|
||||
$types = $scopes = $config = array();
|
||||
if (method_exists($logger, 'config')) {
|
||||
$config = $logger->config();
|
||||
|
@ -455,7 +455,7 @@ class CakeLog {
|
|||
* @return bool Success
|
||||
*/
|
||||
public static function emergency($message, $scope = array()) {
|
||||
return self::write(self::$_levelMap['emergency'], $message, $scope);
|
||||
return static::write(static::$_levelMap['emergency'], $message, $scope);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -467,7 +467,7 @@ class CakeLog {
|
|||
* @return bool Success
|
||||
*/
|
||||
public static function alert($message, $scope = array()) {
|
||||
return self::write(self::$_levelMap['alert'], $message, $scope);
|
||||
return static::write(static::$_levelMap['alert'], $message, $scope);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -479,7 +479,7 @@ class CakeLog {
|
|||
* @return bool Success
|
||||
*/
|
||||
public static function critical($message, $scope = array()) {
|
||||
return self::write(self::$_levelMap['critical'], $message, $scope);
|
||||
return static::write(static::$_levelMap['critical'], $message, $scope);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -491,7 +491,7 @@ class CakeLog {
|
|||
* @return bool Success
|
||||
*/
|
||||
public static function error($message, $scope = array()) {
|
||||
return self::write(self::$_levelMap['error'], $message, $scope);
|
||||
return static::write(static::$_levelMap['error'], $message, $scope);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -503,7 +503,7 @@ class CakeLog {
|
|||
* @return bool Success
|
||||
*/
|
||||
public static function warning($message, $scope = array()) {
|
||||
return self::write(self::$_levelMap['warning'], $message, $scope);
|
||||
return static::write(static::$_levelMap['warning'], $message, $scope);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -515,7 +515,7 @@ class CakeLog {
|
|||
* @return bool Success
|
||||
*/
|
||||
public static function notice($message, $scope = array()) {
|
||||
return self::write(self::$_levelMap['notice'], $message, $scope);
|
||||
return static::write(static::$_levelMap['notice'], $message, $scope);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -527,7 +527,7 @@ class CakeLog {
|
|||
* @return bool Success
|
||||
*/
|
||||
public static function debug($message, $scope = array()) {
|
||||
return self::write(self::$_levelMap['debug'], $message, $scope);
|
||||
return static::write(static::$_levelMap['debug'], $message, $scope);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -539,7 +539,7 @@ class CakeLog {
|
|||
* @return bool Success
|
||||
*/
|
||||
public static function info($message, $scope = array()) {
|
||||
return self::write(self::$_levelMap['info'], $message, $scope);
|
||||
return static::write(static::$_levelMap['info'], $message, $scope);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -66,9 +66,9 @@ class ConnectionManager {
|
|||
protected static function _init() {
|
||||
include_once APP . 'Config' . DS . 'database.php';
|
||||
if (class_exists('DATABASE_CONFIG')) {
|
||||
self::$config = new DATABASE_CONFIG();
|
||||
static::$config = new DATABASE_CONFIG();
|
||||
}
|
||||
self::$_init = true;
|
||||
static::$_init = true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -79,20 +79,20 @@ class ConnectionManager {
|
|||
* @throws MissingDatasourceException
|
||||
*/
|
||||
public static function getDataSource($name) {
|
||||
if (empty(self::$_init)) {
|
||||
self::_init();
|
||||
if (empty(static::$_init)) {
|
||||
static::_init();
|
||||
}
|
||||
|
||||
if (!empty(self::$_dataSources[$name])) {
|
||||
return self::$_dataSources[$name];
|
||||
if (!empty(static::$_dataSources[$name])) {
|
||||
return static::$_dataSources[$name];
|
||||
}
|
||||
|
||||
if (empty(self::$_connectionsEnum[$name])) {
|
||||
self::_getConnectionObject($name);
|
||||
if (empty(static::$_connectionsEnum[$name])) {
|
||||
static::_getConnectionObject($name);
|
||||
}
|
||||
|
||||
self::loadDataSource($name);
|
||||
$conn = self::$_connectionsEnum[$name];
|
||||
static::loadDataSource($name);
|
||||
$conn = static::$_connectionsEnum[$name];
|
||||
$class = $conn['classname'];
|
||||
|
||||
if (strpos(App::location($class), 'Datasource') === false) {
|
||||
|
@ -102,10 +102,10 @@ class ConnectionManager {
|
|||
'message' => 'Datasource is not found in Model/Datasource package.'
|
||||
));
|
||||
}
|
||||
self::$_dataSources[$name] = new $class(self::$config->{$name});
|
||||
self::$_dataSources[$name]->configKeyName = $name;
|
||||
static::$_dataSources[$name] = new $class(static::$config->{$name});
|
||||
static::$_dataSources[$name]->configKeyName = $name;
|
||||
|
||||
return self::$_dataSources[$name];
|
||||
return static::$_dataSources[$name];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -116,10 +116,10 @@ class ConnectionManager {
|
|||
* @return array List of available connections
|
||||
*/
|
||||
public static function sourceList() {
|
||||
if (empty(self::$_init)) {
|
||||
self::_init();
|
||||
if (empty(static::$_init)) {
|
||||
static::_init();
|
||||
}
|
||||
return array_keys(self::$_dataSources);
|
||||
return array_keys(static::$_dataSources);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -130,10 +130,10 @@ class ConnectionManager {
|
|||
* in the ConnectionManager.
|
||||
*/
|
||||
public static function getSourceName($source) {
|
||||
if (empty(self::$_init)) {
|
||||
self::_init();
|
||||
if (empty(static::$_init)) {
|
||||
static::_init();
|
||||
}
|
||||
foreach (self::$_dataSources as $name => $ds) {
|
||||
foreach (static::$_dataSources as $name => $ds) {
|
||||
if ($ds === $source) {
|
||||
return $name;
|
||||
}
|
||||
|
@ -151,14 +151,14 @@ class ConnectionManager {
|
|||
* @throws MissingDatasourceException
|
||||
*/
|
||||
public static function loadDataSource($connName) {
|
||||
if (empty(self::$_init)) {
|
||||
self::_init();
|
||||
if (empty(static::$_init)) {
|
||||
static::_init();
|
||||
}
|
||||
|
||||
if (is_array($connName)) {
|
||||
$conn = $connName;
|
||||
} else {
|
||||
$conn = self::$_connectionsEnum[$connName];
|
||||
$conn = static::$_connectionsEnum[$connName];
|
||||
}
|
||||
|
||||
if (class_exists($conn['classname'], false)) {
|
||||
|
@ -190,10 +190,10 @@ class ConnectionManager {
|
|||
* (as defined in Connections), and the value is an array with keys 'filename' and 'classname'.
|
||||
*/
|
||||
public static function enumConnectionObjects() {
|
||||
if (empty(self::$_init)) {
|
||||
self::_init();
|
||||
if (empty(static::$_init)) {
|
||||
static::_init();
|
||||
}
|
||||
return (array)self::$config;
|
||||
return (array)static::$config;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -204,16 +204,16 @@ class ConnectionManager {
|
|||
* @return DataSource|null A reference to the DataSource object, or null if creation failed
|
||||
*/
|
||||
public static function create($name = '', $config = array()) {
|
||||
if (empty(self::$_init)) {
|
||||
self::_init();
|
||||
if (empty(static::$_init)) {
|
||||
static::_init();
|
||||
}
|
||||
|
||||
if (empty($name) || empty($config) || array_key_exists($name, self::$_connectionsEnum)) {
|
||||
if (empty($name) || empty($config) || array_key_exists($name, static::$_connectionsEnum)) {
|
||||
return null;
|
||||
}
|
||||
self::$config->{$name} = $config;
|
||||
self::$_connectionsEnum[$name] = self::_connectionData($config);
|
||||
$return = self::getDataSource($name);
|
||||
static::$config->{$name} = $config;
|
||||
static::$_connectionsEnum[$name] = static::_connectionData($config);
|
||||
$return = static::getDataSource($name);
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
@ -224,14 +224,14 @@ class ConnectionManager {
|
|||
* @return bool success if connection was removed, false if it does not exist
|
||||
*/
|
||||
public static function drop($name) {
|
||||
if (empty(self::$_init)) {
|
||||
self::_init();
|
||||
if (empty(static::$_init)) {
|
||||
static::_init();
|
||||
}
|
||||
|
||||
if (!isset(self::$config->{$name})) {
|
||||
if (!isset(static::$config->{$name})) {
|
||||
return false;
|
||||
}
|
||||
unset(self::$_connectionsEnum[$name], self::$_dataSources[$name], self::$config->{$name});
|
||||
unset(static::$_connectionsEnum[$name], static::$_dataSources[$name], static::$config->{$name});
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -243,8 +243,8 @@ class ConnectionManager {
|
|||
* @throws MissingDatasourceConfigException
|
||||
*/
|
||||
protected static function _getConnectionObject($name) {
|
||||
if (!empty(self::$config->{$name})) {
|
||||
self::$_connectionsEnum[$name] = self::_connectionData(self::$config->{$name});
|
||||
if (!empty(static::$config->{$name})) {
|
||||
static::$_connectionsEnum[$name] = static::_connectionData(static::$config->{$name});
|
||||
} else {
|
||||
throw new MissingDatasourceConfigException(array('config' => $name));
|
||||
}
|
||||
|
|
|
@ -141,20 +141,20 @@ class CakeSession {
|
|||
* @return void
|
||||
*/
|
||||
public static function init($base = null) {
|
||||
self::$time = time();
|
||||
static::$time = time();
|
||||
|
||||
if (env('HTTP_USER_AGENT')) {
|
||||
self::$_userAgent = md5(env('HTTP_USER_AGENT') . Configure::read('Security.salt'));
|
||||
static::$_userAgent = md5(env('HTTP_USER_AGENT') . Configure::read('Security.salt'));
|
||||
}
|
||||
|
||||
self::_setPath($base);
|
||||
self::_setHost(env('HTTP_HOST'));
|
||||
static::_setPath($base);
|
||||
static::_setHost(env('HTTP_HOST'));
|
||||
|
||||
if (!self::$_initialized) {
|
||||
if (!static::$_initialized) {
|
||||
register_shutdown_function('session_write_close');
|
||||
}
|
||||
|
||||
self::$_initialized = true;
|
||||
static::$_initialized = true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -165,7 +165,7 @@ class CakeSession {
|
|||
*/
|
||||
protected static function _setPath($base = null) {
|
||||
if (empty($base)) {
|
||||
self::$path = '/';
|
||||
static::$path = '/';
|
||||
return;
|
||||
}
|
||||
if (strpos($base, 'index.php') !== false) {
|
||||
|
@ -174,7 +174,7 @@ class CakeSession {
|
|||
if (strpos($base, '?') !== false) {
|
||||
$base = str_replace('?', '', $base);
|
||||
}
|
||||
self::$path = $base;
|
||||
static::$path = $base;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -184,9 +184,9 @@ class CakeSession {
|
|||
* @return void
|
||||
*/
|
||||
protected static function _setHost($host) {
|
||||
self::$host = $host;
|
||||
if (strpos(self::$host, ':') !== false) {
|
||||
self::$host = substr(self::$host, 0, strpos(self::$host, ':'));
|
||||
static::$host = $host;
|
||||
if (strpos(static::$host, ':') !== false) {
|
||||
static::$host = substr(static::$host, 0, strpos(static::$host, ':'));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -196,20 +196,20 @@ class CakeSession {
|
|||
* @return bool True if session was started
|
||||
*/
|
||||
public static function start() {
|
||||
if (self::started()) {
|
||||
if (static::started()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$id = self::id();
|
||||
self::_startSession();
|
||||
$id = static::id();
|
||||
static::_startSession();
|
||||
|
||||
if (!$id && self::started()) {
|
||||
self::_checkValid();
|
||||
if (!$id && static::started()) {
|
||||
static::_checkValid();
|
||||
}
|
||||
|
||||
self::$error = false;
|
||||
self::$valid = true;
|
||||
return self::started();
|
||||
static::$error = false;
|
||||
static::$valid = true;
|
||||
return static::started();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -228,7 +228,7 @@ class CakeSession {
|
|||
* @return bool True if variable is there
|
||||
*/
|
||||
public static function check($name) {
|
||||
if (empty($name) || !self::_hasSession() || !self::start()) {
|
||||
if (empty($name) || !static::_hasSession() || !static::start()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -251,13 +251,13 @@ class CakeSession {
|
|||
*/
|
||||
public static function id($id = null) {
|
||||
if ($id) {
|
||||
self::$id = $id;
|
||||
session_id(self::$id);
|
||||
static::$id = $id;
|
||||
session_id(static::$id);
|
||||
}
|
||||
if (self::started()) {
|
||||
if (static::started()) {
|
||||
return session_id();
|
||||
}
|
||||
return self::$id;
|
||||
return static::$id;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -267,9 +267,9 @@ class CakeSession {
|
|||
* @return bool Success
|
||||
*/
|
||||
public static function delete($name) {
|
||||
if (self::check($name)) {
|
||||
self::_overwrite($_SESSION, Hash::remove($_SESSION, $name));
|
||||
return !self::check($name);
|
||||
if (static::check($name)) {
|
||||
static::_overwrite($_SESSION, Hash::remove($_SESSION, $name));
|
||||
return !static::check($name);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -301,10 +301,10 @@ class CakeSession {
|
|||
* @return string Error as string
|
||||
*/
|
||||
protected static function _error($errorNumber) {
|
||||
if (!is_array(self::$error) || !array_key_exists($errorNumber, self::$error)) {
|
||||
if (!is_array(static::$error) || !array_key_exists($errorNumber, static::$error)) {
|
||||
return false;
|
||||
}
|
||||
return self::$error[$errorNumber];
|
||||
return static::$error[$errorNumber];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -313,8 +313,8 @@ class CakeSession {
|
|||
* @return mixed Error description as a string, or false.
|
||||
*/
|
||||
public static function error() {
|
||||
if (self::$lastError) {
|
||||
return self::_error(self::$lastError);
|
||||
if (static::$lastError) {
|
||||
return static::_error(static::$lastError);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -325,32 +325,32 @@ class CakeSession {
|
|||
* @return bool Success
|
||||
*/
|
||||
public static function valid() {
|
||||
if (self::start() && self::read('Config')) {
|
||||
if (self::_validAgentAndTime() && self::$error === false) {
|
||||
self::$valid = true;
|
||||
if (static::start() && static::read('Config')) {
|
||||
if (static::_validAgentAndTime() && static::$error === false) {
|
||||
static::$valid = true;
|
||||
} else {
|
||||
self::$valid = false;
|
||||
self::_setError(1, 'Session Highjacking Attempted !!!');
|
||||
static::$valid = false;
|
||||
static::_setError(1, 'Session Highjacking Attempted !!!');
|
||||
}
|
||||
}
|
||||
return self::$valid;
|
||||
return static::$valid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that the user agent is valid and that the session hasn't 'timed out'.
|
||||
* Since timeouts are implemented in CakeSession it checks the current self::$time
|
||||
* Since timeouts are implemented in CakeSession it checks the current static::$time
|
||||
* against the time the session is set to expire. The User agent is only checked
|
||||
* if Session.checkAgent == true.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected static function _validAgentAndTime() {
|
||||
$config = self::read('Config');
|
||||
$config = static::read('Config');
|
||||
$validAgent = (
|
||||
Configure::read('Session.checkAgent') === false ||
|
||||
isset($config['userAgent']) && self::$_userAgent === $config['userAgent']
|
||||
isset($config['userAgent']) && static::$_userAgent === $config['userAgent']
|
||||
);
|
||||
return ($validAgent && self::$time <= $config['time']);
|
||||
return ($validAgent && static::$time <= $config['time']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -361,12 +361,12 @@ class CakeSession {
|
|||
*/
|
||||
public static function userAgent($userAgent = null) {
|
||||
if ($userAgent) {
|
||||
self::$_userAgent = $userAgent;
|
||||
static::$_userAgent = $userAgent;
|
||||
}
|
||||
if (empty(self::$_userAgent)) {
|
||||
CakeSession::init(self::$path);
|
||||
if (empty(static::$_userAgent)) {
|
||||
CakeSession::init(static::$path);
|
||||
}
|
||||
return self::$_userAgent;
|
||||
return static::$_userAgent;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -380,11 +380,11 @@ class CakeSession {
|
|||
if (empty($name) && $name !== null) {
|
||||
return null;
|
||||
}
|
||||
if (!self::_hasSession() || !self::start()) {
|
||||
if (!static::_hasSession() || !static::start()) {
|
||||
return null;
|
||||
}
|
||||
if ($name === null) {
|
||||
return self::_returnSessionVars();
|
||||
return static::_returnSessionVars();
|
||||
}
|
||||
$result = Hash::get($_SESSION, $name);
|
||||
|
||||
|
@ -403,7 +403,7 @@ class CakeSession {
|
|||
if (!empty($_SESSION)) {
|
||||
return $_SESSION;
|
||||
}
|
||||
self::_setError(2, 'No Session vars set');
|
||||
static::_setError(2, 'No Session vars set');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -415,7 +415,7 @@ class CakeSession {
|
|||
* @return bool True if the write was successful, false if the write failed
|
||||
*/
|
||||
public static function write($name, $value = null) {
|
||||
if (empty($name) || !self::start()) {
|
||||
if (empty($name) || !static::start()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -424,7 +424,7 @@ class CakeSession {
|
|||
$write = array($name => $value);
|
||||
}
|
||||
foreach ($write as $key => $val) {
|
||||
self::_overwrite($_SESSION, Hash::insert($_SESSION, $key, $val));
|
||||
static::_overwrite($_SESSION, Hash::insert($_SESSION, $key, $val));
|
||||
if (Hash::get($_SESSION, $key) !== $val) {
|
||||
return false;
|
||||
}
|
||||
|
@ -443,9 +443,9 @@ class CakeSession {
|
|||
if (empty($name)) {
|
||||
return null;
|
||||
}
|
||||
$value = self::read($name);
|
||||
$value = static::read($name);
|
||||
if ($value !== null) {
|
||||
self::_overwrite($_SESSION, Hash::remove($_SESSION, $name));
|
||||
static::_overwrite($_SESSION, Hash::remove($_SESSION, $name));
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
@ -456,17 +456,17 @@ class CakeSession {
|
|||
* @return void
|
||||
*/
|
||||
public static function destroy() {
|
||||
if (!self::started()) {
|
||||
self::_startSession();
|
||||
if (!static::started()) {
|
||||
static::_startSession();
|
||||
}
|
||||
|
||||
if (self::started()) {
|
||||
if (static::started()) {
|
||||
session_destroy();
|
||||
}
|
||||
|
||||
$_SESSION = null;
|
||||
self::$id = null;
|
||||
self::$_cookieName = null;
|
||||
static::$id = null;
|
||||
static::$_cookieName = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -484,8 +484,8 @@ class CakeSession {
|
|||
}
|
||||
|
||||
$_SESSION = null;
|
||||
self::$id = null;
|
||||
self::renew();
|
||||
static::$id = null;
|
||||
static::renew();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -500,7 +500,7 @@ class CakeSession {
|
|||
$sessionConfig = Configure::read('Session');
|
||||
|
||||
if (isset($sessionConfig['defaults'])) {
|
||||
$defaults = self::_defaultConfig($sessionConfig['defaults']);
|
||||
$defaults = static::_defaultConfig($sessionConfig['defaults']);
|
||||
if ($defaults) {
|
||||
$sessionConfig = Hash::merge($defaults, $sessionConfig);
|
||||
}
|
||||
|
@ -518,7 +518,7 @@ class CakeSession {
|
|||
if (!isset($sessionConfig['ini']['session.name'])) {
|
||||
$sessionConfig['ini']['session.name'] = $sessionConfig['cookie'];
|
||||
}
|
||||
self::$_cookieName = $sessionConfig['ini']['session.name'];
|
||||
static::$_cookieName = $sessionConfig['ini']['session.name'];
|
||||
|
||||
if (!empty($sessionConfig['handler'])) {
|
||||
$sessionConfig['ini']['session.save_handler'] = 'user';
|
||||
|
@ -548,7 +548,7 @@ class CakeSession {
|
|||
call_user_func_array('session_set_save_handler', $sessionConfig['handler']);
|
||||
}
|
||||
if (!empty($sessionConfig['handler']['engine'])) {
|
||||
$handler = self::_getHandler($sessionConfig['handler']['engine']);
|
||||
$handler = static::_getHandler($sessionConfig['handler']['engine']);
|
||||
session_set_save_handler(
|
||||
array($handler, 'open'),
|
||||
array($handler, 'close'),
|
||||
|
@ -559,7 +559,7 @@ class CakeSession {
|
|||
);
|
||||
}
|
||||
Configure::write('Session', $sessionConfig);
|
||||
self::$sessionTime = self::$time + ($sessionConfig['timeout'] * 60);
|
||||
static::$sessionTime = static::$time + ($sessionConfig['timeout'] * 60);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -568,14 +568,14 @@ class CakeSession {
|
|||
* @return string
|
||||
*/
|
||||
protected static function _cookieName() {
|
||||
if (self::$_cookieName !== null) {
|
||||
return self::$_cookieName;
|
||||
if (static::$_cookieName !== null) {
|
||||
return static::$_cookieName;
|
||||
}
|
||||
|
||||
self::init();
|
||||
self::_configureSession();
|
||||
static::init();
|
||||
static::_configureSession();
|
||||
|
||||
return self::$_cookieName = session_name();
|
||||
return static::$_cookieName = session_name();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -584,7 +584,7 @@ class CakeSession {
|
|||
* @return bool
|
||||
*/
|
||||
protected static function _hasSession() {
|
||||
return self::started() || isset($_COOKIE[self::_cookieName()]);
|
||||
return static::started() || isset($_COOKIE[static::_cookieName()]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -620,7 +620,7 @@ class CakeSession {
|
|||
'timeout' => 240,
|
||||
'ini' => array(
|
||||
'session.use_trans_sid' => 0,
|
||||
'session.cookie_path' => self::$path
|
||||
'session.cookie_path' => static::$path
|
||||
)
|
||||
),
|
||||
'cake' => array(
|
||||
|
@ -631,7 +631,7 @@ class CakeSession {
|
|||
'url_rewriter.tags' => '',
|
||||
'session.serialize_handler' => 'php',
|
||||
'session.use_cookies' => 1,
|
||||
'session.cookie_path' => self::$path,
|
||||
'session.cookie_path' => static::$path,
|
||||
'session.save_path' => TMP . 'sessions',
|
||||
'session.save_handler' => 'files'
|
||||
)
|
||||
|
@ -643,7 +643,7 @@ class CakeSession {
|
|||
'session.use_trans_sid' => 0,
|
||||
'url_rewriter.tags' => '',
|
||||
'session.use_cookies' => 1,
|
||||
'session.cookie_path' => self::$path,
|
||||
'session.cookie_path' => static::$path,
|
||||
'session.save_handler' => 'user',
|
||||
),
|
||||
'handler' => array(
|
||||
|
@ -658,7 +658,7 @@ class CakeSession {
|
|||
'session.use_trans_sid' => 0,
|
||||
'url_rewriter.tags' => '',
|
||||
'session.use_cookies' => 1,
|
||||
'session.cookie_path' => self::$path,
|
||||
'session.cookie_path' => static::$path,
|
||||
'session.save_handler' => 'user',
|
||||
'session.serialize_handler' => 'php',
|
||||
),
|
||||
|
@ -680,9 +680,9 @@ class CakeSession {
|
|||
* @return bool Success
|
||||
*/
|
||||
protected static function _startSession() {
|
||||
self::init();
|
||||
static::init();
|
||||
session_write_close();
|
||||
self::_configureSession();
|
||||
static::_configureSession();
|
||||
|
||||
if (headers_sent()) {
|
||||
if (empty($_SESSION)) {
|
||||
|
@ -702,31 +702,31 @@ class CakeSession {
|
|||
* @return void
|
||||
*/
|
||||
protected static function _checkValid() {
|
||||
$config = self::read('Config');
|
||||
$config = static::read('Config');
|
||||
if ($config) {
|
||||
$sessionConfig = Configure::read('Session');
|
||||
|
||||
if (self::valid()) {
|
||||
self::write('Config.time', self::$sessionTime);
|
||||
if (static::valid()) {
|
||||
static::write('Config.time', static::$sessionTime);
|
||||
if (isset($sessionConfig['autoRegenerate']) && $sessionConfig['autoRegenerate'] === true) {
|
||||
$check = $config['countdown'];
|
||||
$check -= 1;
|
||||
self::write('Config.countdown', $check);
|
||||
static::write('Config.countdown', $check);
|
||||
|
||||
if ($check < 1) {
|
||||
self::renew();
|
||||
self::write('Config.countdown', self::$requestCountdown);
|
||||
static::renew();
|
||||
static::write('Config.countdown', static::$requestCountdown);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$_SESSION = array();
|
||||
self::destroy();
|
||||
self::_setError(1, 'Session Highjacking Attempted !!!');
|
||||
self::_startSession();
|
||||
self::_writeConfig();
|
||||
static::destroy();
|
||||
static::_setError(1, 'Session Highjacking Attempted !!!');
|
||||
static::_startSession();
|
||||
static::_writeConfig();
|
||||
}
|
||||
} else {
|
||||
self::_writeConfig();
|
||||
static::_writeConfig();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -736,9 +736,9 @@ class CakeSession {
|
|||
* @return void
|
||||
*/
|
||||
protected static function _writeConfig() {
|
||||
self::write('Config.userAgent', self::$_userAgent);
|
||||
self::write('Config.time', self::$sessionTime);
|
||||
self::write('Config.countdown', self::$requestCountdown);
|
||||
static::write('Config.userAgent', static::$_userAgent);
|
||||
static::write('Config.time', static::$sessionTime);
|
||||
static::write('Config.countdown', static::$requestCountdown);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -751,7 +751,7 @@ class CakeSession {
|
|||
return;
|
||||
}
|
||||
if (isset($_COOKIE[session_name()])) {
|
||||
setcookie(Configure::read('Session.cookie'), '', time() - 42000, self::$path);
|
||||
setcookie(Configure::read('Session.cookie'), '', time() - 42000, static::$path);
|
||||
}
|
||||
session_regenerate_id(true);
|
||||
}
|
||||
|
@ -764,11 +764,11 @@ class CakeSession {
|
|||
* @return void
|
||||
*/
|
||||
protected static function _setError($errorNumber, $errorMessage) {
|
||||
if (self::$error === false) {
|
||||
self::$error = array();
|
||||
if (static::$error === false) {
|
||||
static::$error = array();
|
||||
}
|
||||
self::$error[$errorNumber] = $errorMessage;
|
||||
self::$lastError = $errorNumber;
|
||||
static::$error[$errorNumber] = $errorMessage;
|
||||
static::$lastError = $errorNumber;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -544,7 +544,7 @@ class Sqlserver extends DboSource {
|
|||
$page = (int)($limitOffset[1] / $limitOffset[2]);
|
||||
$offset = (int)($limitOffset[2] * $page);
|
||||
|
||||
$rowCounter = self::ROW_COUNTER;
|
||||
$rowCounter = static::ROW_COUNTER;
|
||||
$sql = "SELECT {$limit} * FROM (
|
||||
SELECT {$fields}, ROW_NUMBER() OVER ({$order}) AS {$rowCounter}
|
||||
FROM {$table} {$alias} {$joins} {$conditions} {$group}
|
||||
|
@ -634,7 +634,7 @@ class Sqlserver extends DboSource {
|
|||
$resultRow = array();
|
||||
foreach ($this->map as $col => $meta) {
|
||||
list($table, $column, $type) = $meta;
|
||||
if ($table === 0 && $column === self::ROW_COUNTER) {
|
||||
if ($table === 0 && $column === static::ROW_COUNTER) {
|
||||
continue;
|
||||
}
|
||||
$resultRow[$table][$column] = $row[$col];
|
||||
|
|
|
@ -759,7 +759,7 @@ class DboSource extends DataSource {
|
|||
*/
|
||||
public function flushMethodCache() {
|
||||
$this->_methodCacheChange = true;
|
||||
self::$methodCache = array();
|
||||
static::$methodCache = array();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -778,14 +778,14 @@ class DboSource extends DataSource {
|
|||
if ($this->cacheMethods === false) {
|
||||
return $value;
|
||||
}
|
||||
if (!$this->_methodCacheChange && empty(self::$methodCache)) {
|
||||
self::$methodCache = (array)Cache::read('method_cache', '_cake_core_');
|
||||
if (!$this->_methodCacheChange && empty(static::$methodCache)) {
|
||||
static::$methodCache = (array)Cache::read('method_cache', '_cake_core_');
|
||||
}
|
||||
if ($value === null) {
|
||||
return (isset(self::$methodCache[$method][$key])) ? self::$methodCache[$method][$key] : null;
|
||||
return (isset(static::$methodCache[$method][$key])) ? static::$methodCache[$method][$key] : null;
|
||||
}
|
||||
$this->_methodCacheChange = true;
|
||||
return self::$methodCache[$method][$key] = $value;
|
||||
return static::$methodCache[$method][$key] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3571,7 +3571,7 @@ class DboSource extends DataSource {
|
|||
*/
|
||||
public function __destruct() {
|
||||
if ($this->_methodCacheChange) {
|
||||
Cache::write('method_cache', self::$methodCache, '_cake_core_');
|
||||
Cache::write('method_cache', static::$methodCache, '_cake_core_');
|
||||
}
|
||||
parent::__destruct();
|
||||
}
|
||||
|
|
|
@ -853,7 +853,7 @@ class CakeRequest implements ArrayAccess {
|
|||
* @return mixed If a $language is provided, a boolean. Otherwise the array of accepted languages.
|
||||
*/
|
||||
public static function acceptLanguage($language = null) {
|
||||
$raw = self::_parseAcceptWithQualifier(self::header('Accept-Language'));
|
||||
$raw = static::_parseAcceptWithQualifier(static::header('Accept-Language'));
|
||||
$accept = array();
|
||||
foreach ($raw as $languages) {
|
||||
foreach ($languages as &$lang) {
|
||||
|
|
|
@ -781,7 +781,7 @@ class CakeEmail {
|
|||
|
||||
$headers += $this->_headers;
|
||||
if (!isset($headers['X-Mailer'])) {
|
||||
$headers['X-Mailer'] = self::EMAIL_CLIENT;
|
||||
$headers['X-Mailer'] = static::EMAIL_CLIENT;
|
||||
}
|
||||
if (!isset($headers['Date'])) {
|
||||
$headers['Date'] = date(DATE_RFC2822);
|
||||
|
@ -1113,9 +1113,9 @@ class CakeEmail {
|
|||
*/
|
||||
public function message($type = null) {
|
||||
switch ($type) {
|
||||
case self::MESSAGE_HTML:
|
||||
case static::MESSAGE_HTML:
|
||||
return $this->_htmlMessage;
|
||||
case self::MESSAGE_TEXT:
|
||||
case static::MESSAGE_TEXT:
|
||||
return $this->_textMessage;
|
||||
}
|
||||
return $this->_message;
|
||||
|
@ -1315,7 +1315,7 @@ class CakeEmail {
|
|||
$this->headerCharset = null;
|
||||
$this->_attachments = array();
|
||||
$this->_config = array();
|
||||
$this->_emailPattern = self::EMAIL_PATTERN;
|
||||
$this->_emailPattern = static::EMAIL_PATTERN;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ class BasicAuthentication {
|
|||
*/
|
||||
public static function authentication(HttpSocket $http, &$authInfo) {
|
||||
if (isset($authInfo['user'], $authInfo['pass'])) {
|
||||
$http->request['header']['Authorization'] = self::_generateHeader($authInfo['user'], $authInfo['pass']);
|
||||
$http->request['header']['Authorization'] = static::_generateHeader($authInfo['user'], $authInfo['pass']);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ class BasicAuthentication {
|
|||
*/
|
||||
public static function proxyAuthentication(HttpSocket $http, &$proxyInfo) {
|
||||
if (isset($proxyInfo['user'], $proxyInfo['pass'])) {
|
||||
$http->request['header']['Proxy-Authorization'] = self::_generateHeader($proxyInfo['user'], $proxyInfo['pass']);
|
||||
$http->request['header']['Proxy-Authorization'] = static::_generateHeader($proxyInfo['user'], $proxyInfo['pass']);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,10 +33,10 @@ class DigestAuthentication {
|
|||
*/
|
||||
public static function authentication(HttpSocket $http, &$authInfo) {
|
||||
if (isset($authInfo['user'], $authInfo['pass'])) {
|
||||
if (!isset($authInfo['realm']) && !self::_getServerInformation($http, $authInfo)) {
|
||||
if (!isset($authInfo['realm']) && !static::_getServerInformation($http, $authInfo)) {
|
||||
return;
|
||||
}
|
||||
$http->request['header']['Authorization'] = self::_generateHeader($http, $authInfo);
|
||||
$http->request['header']['Authorization'] = static::_generateHeader($http, $authInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -213,10 +213,10 @@ class Router {
|
|||
*/
|
||||
public static function defaultRouteClass($routeClass = null) {
|
||||
if ($routeClass === null) {
|
||||
return self::$_routeClass;
|
||||
return static::$_routeClass;
|
||||
}
|
||||
|
||||
self::$_routeClass = self::_validateRouteClass($routeClass);
|
||||
static::$_routeClass = static::_validateRouteClass($routeClass);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -243,7 +243,7 @@ class Router {
|
|||
protected static function _setPrefixes() {
|
||||
$routing = Configure::read('Routing');
|
||||
if (!empty($routing['prefixes'])) {
|
||||
self::$_prefixes = array_merge(self::$_prefixes, (array)$routing['prefixes']);
|
||||
static::$_prefixes = array_merge(static::$_prefixes, (array)$routing['prefixes']);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -254,7 +254,7 @@ class Router {
|
|||
* @see Router::$_namedExpressions
|
||||
*/
|
||||
public static function getNamedExpressions() {
|
||||
return self::$_namedExpressions;
|
||||
return static::$_namedExpressions;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -266,9 +266,9 @@ class Router {
|
|||
*/
|
||||
public static function resourceMap($resourceMap = null) {
|
||||
if ($resourceMap === null) {
|
||||
return self::$_resourceMap;
|
||||
return static::$_resourceMap;
|
||||
}
|
||||
self::$_resourceMap = $resourceMap;
|
||||
static::$_resourceMap = $resourceMap;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -342,9 +342,9 @@ class Router {
|
|||
* @throws RouterException
|
||||
*/
|
||||
public static function connect($route, $defaults = array(), $options = array()) {
|
||||
self::$initialized = true;
|
||||
static::$initialized = true;
|
||||
|
||||
foreach (self::$_prefixes as $prefix) {
|
||||
foreach (static::$_prefixes as $prefix) {
|
||||
if (isset($defaults[$prefix])) {
|
||||
if ($defaults[$prefix]) {
|
||||
$defaults['prefix'] = $prefix;
|
||||
|
@ -354,28 +354,28 @@ class Router {
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (isset($defaults['prefix']) && !in_array($defaults['prefix'], self::$_prefixes)) {
|
||||
self::$_prefixes[] = $defaults['prefix'];
|
||||
if (isset($defaults['prefix']) && !in_array($defaults['prefix'], static::$_prefixes)) {
|
||||
static::$_prefixes[] = $defaults['prefix'];
|
||||
}
|
||||
$defaults += array('plugin' => null);
|
||||
if (empty($options['action'])) {
|
||||
$defaults += array('action' => 'index');
|
||||
}
|
||||
$routeClass = self::$_routeClass;
|
||||
$routeClass = static::$_routeClass;
|
||||
if (isset($options['routeClass'])) {
|
||||
if (strpos($options['routeClass'], '.') === false) {
|
||||
$routeClass = $options['routeClass'];
|
||||
} else {
|
||||
list(, $routeClass) = pluginSplit($options['routeClass'], true);
|
||||
}
|
||||
$routeClass = self::_validateRouteClass($routeClass);
|
||||
$routeClass = static::_validateRouteClass($routeClass);
|
||||
unset($options['routeClass']);
|
||||
}
|
||||
if ($routeClass === 'RedirectRoute' && isset($defaults['redirect'])) {
|
||||
$defaults = $defaults['redirect'];
|
||||
}
|
||||
self::$routes[] = new $routeClass($route, $defaults, $options);
|
||||
return self::$routes;
|
||||
static::$routes[] = new $routeClass($route, $defaults, $options);
|
||||
return static::$routes;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -416,7 +416,7 @@ class Router {
|
|||
if (is_string($url)) {
|
||||
$url = array('redirect' => $url);
|
||||
}
|
||||
return self::connect($route, $url, $options);
|
||||
return static::connect($route, $url, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -473,7 +473,7 @@ class Router {
|
|||
*/
|
||||
public static function connectNamed($named, $options = array()) {
|
||||
if (isset($options['separator'])) {
|
||||
self::$_namedConfig['separator'] = $options['separator'];
|
||||
static::$_namedConfig['separator'] = $options['separator'];
|
||||
unset($options['separator']);
|
||||
}
|
||||
|
||||
|
@ -484,23 +484,23 @@ class Router {
|
|||
$options += array('default' => false, 'reset' => false, 'greedy' => true);
|
||||
}
|
||||
|
||||
if ($options['reset'] || self::$_namedConfig['rules'] === false) {
|
||||
self::$_namedConfig['rules'] = array();
|
||||
if ($options['reset'] || static::$_namedConfig['rules'] === false) {
|
||||
static::$_namedConfig['rules'] = array();
|
||||
}
|
||||
|
||||
if ($options['default']) {
|
||||
$named = array_merge($named, self::$_namedConfig['default']);
|
||||
$named = array_merge($named, static::$_namedConfig['default']);
|
||||
}
|
||||
|
||||
foreach ($named as $key => $val) {
|
||||
if (is_numeric($key)) {
|
||||
self::$_namedConfig['rules'][$val] = true;
|
||||
static::$_namedConfig['rules'][$val] = true;
|
||||
} else {
|
||||
self::$_namedConfig['rules'][$key] = $val;
|
||||
static::$_namedConfig['rules'][$key] = $val;
|
||||
}
|
||||
}
|
||||
self::$_namedConfig['greedyNamed'] = $options['greedy'];
|
||||
return self::$_namedConfig;
|
||||
static::$_namedConfig['greedyNamed'] = $options['greedy'];
|
||||
return static::$_namedConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -510,7 +510,7 @@ class Router {
|
|||
* @see Router::$_namedConfig
|
||||
*/
|
||||
public static function namedConfig() {
|
||||
return self::$_namedConfig;
|
||||
return static::$_namedConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -533,7 +533,7 @@ class Router {
|
|||
$options += array(
|
||||
'connectOptions' => array(),
|
||||
'prefix' => '/',
|
||||
'id' => self::ID . '|' . self::UUID
|
||||
'id' => static::ID . '|' . static::UUID
|
||||
);
|
||||
|
||||
$prefix = $options['prefix'];
|
||||
|
@ -554,7 +554,7 @@ class Router {
|
|||
$prefix = '/' . $plugin . '/';
|
||||
}
|
||||
|
||||
foreach (self::$_resourceMap as $params) {
|
||||
foreach (static::$_resourceMap as $params) {
|
||||
$url = $prefix . $urlName . (($params['id']) ? '/:id' : '');
|
||||
|
||||
Router::connect($url,
|
||||
|
@ -570,9 +570,9 @@ class Router {
|
|||
)
|
||||
);
|
||||
}
|
||||
self::$_resourceMapped[] = $urlName;
|
||||
static::$_resourceMapped[] = $urlName;
|
||||
}
|
||||
return self::$_resourceMapped;
|
||||
return static::$_resourceMapped;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -581,7 +581,7 @@ class Router {
|
|||
* @return array A list of prefixes used in connected routes
|
||||
*/
|
||||
public static function prefixes() {
|
||||
return self::$_prefixes;
|
||||
return static::$_prefixes;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -591,8 +591,8 @@ class Router {
|
|||
* @return array Parsed elements from URL
|
||||
*/
|
||||
public static function parse($url) {
|
||||
if (!self::$initialized) {
|
||||
self::_loadRoutes();
|
||||
if (!static::$initialized) {
|
||||
static::_loadRoutes();
|
||||
}
|
||||
|
||||
$ext = null;
|
||||
|
@ -606,11 +606,11 @@ class Router {
|
|||
parse_str($queryParameters, $queryParameters);
|
||||
}
|
||||
|
||||
extract(self::_parseExtension($url));
|
||||
extract(static::_parseExtension($url));
|
||||
|
||||
foreach (self::$routes as $route) {
|
||||
foreach (static::$routes as $route) {
|
||||
if (($r = $route->parse($url)) !== false) {
|
||||
self::$_currentRoute[] = $route;
|
||||
static::$_currentRoute[] = $route;
|
||||
$out = $r;
|
||||
break;
|
||||
}
|
||||
|
@ -638,14 +638,14 @@ class Router {
|
|||
protected static function _parseExtension($url) {
|
||||
$ext = null;
|
||||
|
||||
if (self::$_parseExtensions) {
|
||||
if (static::$_parseExtensions) {
|
||||
if (preg_match('/\.[0-9a-zA-Z]*$/', $url, $match) === 1) {
|
||||
$match = substr($match[0], 1);
|
||||
if (empty(self::$_validExtensions)) {
|
||||
if (empty(static::$_validExtensions)) {
|
||||
$url = substr($url, 0, strpos($url, '.' . $match));
|
||||
$ext = $match;
|
||||
} else {
|
||||
foreach (self::$_validExtensions as $name) {
|
||||
foreach (static::$_validExtensions as $name) {
|
||||
if (strcasecmp($name, $match) === 0) {
|
||||
$url = substr($url, 0, strpos($url, '.' . $name));
|
||||
$ext = $match;
|
||||
|
@ -674,13 +674,13 @@ class Router {
|
|||
*/
|
||||
public static function setRequestInfo($request) {
|
||||
if ($request instanceof CakeRequest) {
|
||||
self::$_requests[] = $request;
|
||||
static::$_requests[] = $request;
|
||||
} else {
|
||||
$requestObj = new CakeRequest();
|
||||
$request += array(array(), array());
|
||||
$request[0] += array('controller' => false, 'action' => false, 'plugin' => null);
|
||||
$requestObj->addParams($request[0])->addPaths($request[1]);
|
||||
self::$_requests[] = $requestObj;
|
||||
static::$_requests[] = $requestObj;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -692,7 +692,7 @@ class Router {
|
|||
* @see Object::requestAction()
|
||||
*/
|
||||
public static function popRequest() {
|
||||
return array_pop(self::$_requests);
|
||||
return array_pop(static::$_requests);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -703,10 +703,10 @@ class Router {
|
|||
*/
|
||||
public static function getRequest($current = false) {
|
||||
if ($current) {
|
||||
$i = count(self::$_requests) - 1;
|
||||
return isset(self::$_requests[$i]) ? self::$_requests[$i] : null;
|
||||
$i = count(static::$_requests) - 1;
|
||||
return isset(static::$_requests[$i]) ? static::$_requests[$i] : null;
|
||||
}
|
||||
return isset(self::$_requests[0]) ? self::$_requests[0] : null;
|
||||
return isset(static::$_requests[0]) ? static::$_requests[0] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -716,11 +716,11 @@ class Router {
|
|||
* @return array Parameter information
|
||||
*/
|
||||
public static function getParams($current = false) {
|
||||
if ($current && self::$_requests) {
|
||||
return self::$_requests[count(self::$_requests) - 1]->params;
|
||||
if ($current && static::$_requests) {
|
||||
return static::$_requests[count(static::$_requests) - 1]->params;
|
||||
}
|
||||
if (isset(self::$_requests[0])) {
|
||||
return self::$_requests[0]->params;
|
||||
if (isset(static::$_requests[0])) {
|
||||
return static::$_requests[0]->params;
|
||||
}
|
||||
return array();
|
||||
}
|
||||
|
@ -748,12 +748,12 @@ class Router {
|
|||
*/
|
||||
public static function getPaths($current = false) {
|
||||
if ($current) {
|
||||
return self::$_requests[count(self::$_requests) - 1];
|
||||
return static::$_requests[count(static::$_requests) - 1];
|
||||
}
|
||||
if (!isset(self::$_requests[0])) {
|
||||
if (!isset(static::$_requests[0])) {
|
||||
return array('base' => null);
|
||||
}
|
||||
return array('base' => self::$_requests[0]->base);
|
||||
return array('base' => static::$_requests[0]->base);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -763,17 +763,17 @@ class Router {
|
|||
* @return void
|
||||
*/
|
||||
public static function reload() {
|
||||
if (empty(self::$_initialState)) {
|
||||
self::$_initialState = get_class_vars('Router');
|
||||
self::_setPrefixes();
|
||||
if (empty(static::$_initialState)) {
|
||||
static::$_initialState = get_class_vars('Router');
|
||||
static::_setPrefixes();
|
||||
return;
|
||||
}
|
||||
foreach (self::$_initialState as $key => $val) {
|
||||
foreach (static::$_initialState as $key => $val) {
|
||||
if ($key !== '_initialState') {
|
||||
self::${$key} = $val;
|
||||
static::${$key} = $val;
|
||||
}
|
||||
}
|
||||
self::_setPrefixes();
|
||||
static::_setPrefixes();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -785,14 +785,14 @@ class Router {
|
|||
*/
|
||||
public static function promote($which = null) {
|
||||
if ($which === null) {
|
||||
$which = count(self::$routes) - 1;
|
||||
$which = count(static::$routes) - 1;
|
||||
}
|
||||
if (!isset(self::$routes[$which])) {
|
||||
if (!isset(static::$routes[$which])) {
|
||||
return false;
|
||||
}
|
||||
$route =& self::$routes[$which];
|
||||
unset(self::$routes[$which]);
|
||||
array_unshift(self::$routes, $route);
|
||||
$route =& static::$routes[$which];
|
||||
unset(static::$routes[$which]);
|
||||
array_unshift(static::$routes, $route);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -826,8 +826,8 @@ class Router {
|
|||
* @return string Full translated URL with base path.
|
||||
*/
|
||||
public static function url($url = null, $full = false) {
|
||||
if (!self::$initialized) {
|
||||
self::_loadRoutes();
|
||||
if (!static::$initialized) {
|
||||
static::_loadRoutes();
|
||||
}
|
||||
|
||||
$params = array('plugin' => null, 'controller' => null, 'action' => 'index');
|
||||
|
@ -839,8 +839,8 @@ class Router {
|
|||
}
|
||||
|
||||
$path = array('base' => null);
|
||||
if (!empty(self::$_requests)) {
|
||||
$request = self::$_requests[count(self::$_requests) - 1];
|
||||
if (!empty(static::$_requests)) {
|
||||
$request = static::$_requests[count(static::$_requests) - 1];
|
||||
$params = $request->params;
|
||||
$path = array('base' => $request->base, 'here' => $request->here);
|
||||
}
|
||||
|
@ -854,7 +854,7 @@ class Router {
|
|||
if (empty($url)) {
|
||||
$output = isset($path['here']) ? $path['here'] : '/';
|
||||
if ($full) {
|
||||
$output = self::fullBaseUrl() . $output;
|
||||
$output = static::fullBaseUrl() . $output;
|
||||
}
|
||||
return $output;
|
||||
} elseif (is_array($url)) {
|
||||
|
@ -886,8 +886,8 @@ class Router {
|
|||
}
|
||||
}
|
||||
|
||||
$prefixExists = (array_intersect_key($url, array_flip(self::$_prefixes)));
|
||||
foreach (self::$_prefixes as $prefix) {
|
||||
$prefixExists = (array_intersect_key($url, array_flip(static::$_prefixes)));
|
||||
foreach (static::$_prefixes as $prefix) {
|
||||
if (!empty($params[$prefix]) && !$prefixExists) {
|
||||
$url[$prefix] = true;
|
||||
} elseif (isset($url[$prefix]) && !$url[$prefix]) {
|
||||
|
@ -902,7 +902,7 @@ class Router {
|
|||
|
||||
$match = false;
|
||||
|
||||
foreach (self::$routes as $route) {
|
||||
foreach (static::$routes as $route) {
|
||||
$originalUrl = $url;
|
||||
|
||||
$url = $route->persistParams($url, $params);
|
||||
|
@ -914,7 +914,7 @@ class Router {
|
|||
$url = $originalUrl;
|
||||
}
|
||||
if ($match === false) {
|
||||
$output = self::_handleNoRoute($url);
|
||||
$output = static::_handleNoRoute($url);
|
||||
}
|
||||
} else {
|
||||
if (preg_match('/^([a-z][a-z0-9.+\-]+:|:?\/\/|[#?])/i', $url)) {
|
||||
|
@ -923,7 +923,7 @@ class Router {
|
|||
if (substr($url, 0, 1) === '/') {
|
||||
$output = substr($url, 1);
|
||||
} else {
|
||||
foreach (self::$_prefixes as $prefix) {
|
||||
foreach (static::$_prefixes as $prefix) {
|
||||
if (isset($params[$prefix])) {
|
||||
$output .= $prefix . '/';
|
||||
break;
|
||||
|
@ -940,13 +940,13 @@ class Router {
|
|||
$output = str_replace('//', '/', $base . '/' . $output);
|
||||
|
||||
if ($full) {
|
||||
$output = self::fullBaseUrl() . $output;
|
||||
$output = static::fullBaseUrl() . $output;
|
||||
}
|
||||
if (!empty($extension)) {
|
||||
$output = rtrim($output, '/');
|
||||
}
|
||||
}
|
||||
return $output . $extension . self::queryString($q, array(), $escape) . $frag;
|
||||
return $output . $extension . static::queryString($q, array(), $escape) . $frag;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -966,13 +966,13 @@ class Router {
|
|||
*/
|
||||
public static function fullBaseUrl($base = null) {
|
||||
if ($base !== null) {
|
||||
self::$_fullBaseUrl = $base;
|
||||
static::$_fullBaseUrl = $base;
|
||||
Configure::write('App.fullBaseUrl', $base);
|
||||
}
|
||||
if (empty(self::$_fullBaseUrl)) {
|
||||
self::$_fullBaseUrl = Configure::read('App.fullBaseUrl');
|
||||
if (empty(static::$_fullBaseUrl)) {
|
||||
static::$_fullBaseUrl = Configure::read('App.fullBaseUrl');
|
||||
}
|
||||
return self::$_fullBaseUrl;
|
||||
return static::$_fullBaseUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -987,7 +987,7 @@ class Router {
|
|||
$named = $args = array();
|
||||
$skip = array_merge(
|
||||
array('bare', 'action', 'controller', 'plugin', 'prefix'),
|
||||
self::$_prefixes
|
||||
static::$_prefixes
|
||||
);
|
||||
|
||||
$keys = array_values(array_diff(array_keys($url), $skip));
|
||||
|
@ -1002,7 +1002,7 @@ class Router {
|
|||
}
|
||||
|
||||
list($args, $named) = array(Hash::filter($args), Hash::filter($named));
|
||||
foreach (self::$_prefixes as $prefix) {
|
||||
foreach (static::$_prefixes as $prefix) {
|
||||
$prefixed = $prefix . '_';
|
||||
if (!empty($url[$prefix]) && strpos($url['action'], $prefixed) === 0) {
|
||||
$url['action'] = substr($url['action'], strlen($prefixed) * -1);
|
||||
|
@ -1020,7 +1020,7 @@ class Router {
|
|||
array_unshift($urlOut, $url['plugin']);
|
||||
}
|
||||
|
||||
foreach (self::$_prefixes as $prefix) {
|
||||
foreach (static::$_prefixes as $prefix) {
|
||||
if (isset($url[$prefix])) {
|
||||
array_unshift($urlOut, $prefix);
|
||||
break;
|
||||
|
@ -1037,10 +1037,10 @@ class Router {
|
|||
if (is_array($value)) {
|
||||
$flattend = Hash::flatten($value, '%5D%5B');
|
||||
foreach ($flattend as $namedKey => $namedValue) {
|
||||
$output .= '/' . $name . "%5B{$namedKey}%5D" . self::$_namedConfig['separator'] . rawurlencode($namedValue);
|
||||
$output .= '/' . $name . "%5B{$namedKey}%5D" . static::$_namedConfig['separator'] . rawurlencode($namedValue);
|
||||
}
|
||||
} else {
|
||||
$output .= '/' . $name . self::$_namedConfig['separator'] . rawurlencode($value);
|
||||
$output .= '/' . $name . static::$_namedConfig['separator'] . rawurlencode($value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1163,7 +1163,7 @@ class Router {
|
|||
* @return CakeRoute Matching route object.
|
||||
*/
|
||||
public static function requestRoute() {
|
||||
return self::$_currentRoute[0];
|
||||
return static::$_currentRoute[0];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1172,8 +1172,8 @@ class Router {
|
|||
* @return CakeRoute Matching route object.
|
||||
*/
|
||||
public static function currentRoute() {
|
||||
$count = count(self::$_currentRoute) - 1;
|
||||
return ($count >= 0) ? self::$_currentRoute[$count] : false;
|
||||
$count = count(static::$_currentRoute) - 1;
|
||||
return ($count >= 0) ? static::$_currentRoute[$count] : false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1215,9 +1215,9 @@ class Router {
|
|||
* @see RequestHandler::startup()
|
||||
*/
|
||||
public static function parseExtensions() {
|
||||
self::$_parseExtensions = true;
|
||||
static::$_parseExtensions = true;
|
||||
if (func_num_args() > 0) {
|
||||
self::setExtensions(func_get_args(), false);
|
||||
static::setExtensions(func_get_args(), false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1230,11 +1230,11 @@ class Router {
|
|||
* @return array Array of extensions Router is configured to parse.
|
||||
*/
|
||||
public static function extensions() {
|
||||
if (!self::$initialized) {
|
||||
self::_loadRoutes();
|
||||
if (!static::$initialized) {
|
||||
static::_loadRoutes();
|
||||
}
|
||||
|
||||
return self::$_validExtensions;
|
||||
return static::$_validExtensions;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1248,12 +1248,12 @@ class Router {
|
|||
*/
|
||||
public static function setExtensions($extensions, $merge = true) {
|
||||
if (!is_array($extensions)) {
|
||||
return self::$_validExtensions;
|
||||
return static::$_validExtensions;
|
||||
}
|
||||
if (!$merge) {
|
||||
return self::$_validExtensions = $extensions;
|
||||
return static::$_validExtensions = $extensions;
|
||||
}
|
||||
return self::$_validExtensions = array_merge(self::$_validExtensions, $extensions);
|
||||
return static::$_validExtensions = array_merge(static::$_validExtensions, $extensions);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1262,7 +1262,7 @@ class Router {
|
|||
* @return void
|
||||
*/
|
||||
protected static function _loadRoutes() {
|
||||
self::$initialized = true;
|
||||
static::$initialized = true;
|
||||
include APP . 'Config' . DS . 'routes.php';
|
||||
}
|
||||
|
||||
|
|
|
@ -200,7 +200,7 @@ class BlowfishAuthenticateTest extends CakeTestCase {
|
|||
'username' => 'gwoo',
|
||||
'created' => '2007-03-17 01:16:23'
|
||||
);
|
||||
$this->assertEquals(self::date(), $result['updated']);
|
||||
$this->assertEquals(static::date(), $result['updated']);
|
||||
unset($result['updated']);
|
||||
$this->assertEquals($expected, $result);
|
||||
CakePlugin::unload();
|
||||
|
|
|
@ -288,7 +288,7 @@ class FormAuthenticateTest extends CakeTestCase {
|
|||
'username' => 'gwoo',
|
||||
'created' => '2007-03-17 01:16:23'
|
||||
);
|
||||
$this->assertEquals(self::date(), $result['updated']);
|
||||
$this->assertEquals(static::date(), $result['updated']);
|
||||
unset($result['updated']);
|
||||
$this->assertEquals($expected, $result);
|
||||
CakePlugin::unload();
|
||||
|
|
|
@ -125,7 +125,7 @@ class TestAuthComponent extends AuthComponent {
|
|||
}
|
||||
|
||||
public static function clearUser() {
|
||||
self::$_user = array();
|
||||
static::$_user = array();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ class DebugCompTransport extends AbstractTransport {
|
|||
$last .= sprintf("%s\n\n%s", 'Message:', $message);
|
||||
$last .= '</pre>';
|
||||
|
||||
self::$lastEmail = $last;
|
||||
static::$lastEmail = $last;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ class EmailComponentTest extends CakeTestCase {
|
|||
$this->Controller->Components->init($this->Controller);
|
||||
$this->Controller->EmailTest->initialize($this->Controller, array());
|
||||
|
||||
self::$sentDate = date(DATE_RFC2822);
|
||||
static::$sentDate = date(DATE_RFC2822);
|
||||
|
||||
App::build(array(
|
||||
'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS)
|
||||
|
@ -170,7 +170,7 @@ class EmailComponentTest extends CakeTestCase {
|
|||
$this->Controller->EmailTest->delivery = 'DebugComp';
|
||||
$this->Controller->EmailTest->messageId = false;
|
||||
|
||||
$date = self::$sentDate;
|
||||
$date = static::$sentDate;
|
||||
$message = <<<MSGBLOC
|
||||
<pre>To: postmaster@example.com
|
||||
From: noreply@example.com
|
||||
|
@ -217,7 +217,7 @@ MSGBLOC;
|
|||
$this->Controller->EmailTest->delivery = 'DebugComp';
|
||||
$this->Controller->EmailTest->messageId = false;
|
||||
|
||||
$date = self::$sentDate;
|
||||
$date = static::$sentDate;
|
||||
$header = <<<HEADBLOC
|
||||
To: postmaster@example.com
|
||||
From: noreply@example.com
|
||||
|
@ -363,7 +363,7 @@ HTMLBLOC;
|
|||
$this->assertRegExp('/From: noreply@example.com\n/', $result);
|
||||
$this->assertRegExp('/Cc: cc@example.com\n/', $result);
|
||||
$this->assertRegExp('/Bcc: bcc@example.com\n/', $result);
|
||||
$this->assertRegExp('/Date: ' . preg_quote(self::$sentDate) . '\n/', $result);
|
||||
$this->assertRegExp('/Date: ' . preg_quote(static::$sentDate) . '\n/', $result);
|
||||
$this->assertRegExp('/X-Mailer: CakePHP Email Component\n/', $result);
|
||||
$this->assertRegExp('/Content-Type: text\/plain; charset=UTF-8\n/', $result);
|
||||
$this->assertRegExp('/Content-Transfer-Encoding: 8bitMessage:\n/', $result);
|
||||
|
@ -392,7 +392,7 @@ HTMLBLOC;
|
|||
$this->assertRegExp('/Subject: Cake Debug Test\n/', $result);
|
||||
$this->assertRegExp('/Reply-To: noreply@example.com\n/', $result);
|
||||
$this->assertRegExp('/From: noreply@example.com\n/', $result);
|
||||
$this->assertRegExp('/Date: ' . preg_quote(self::$sentDate) . '\n/', $result);
|
||||
$this->assertRegExp('/Date: ' . preg_quote(static::$sentDate) . '\n/', $result);
|
||||
$this->assertRegExp('/X-Mailer: CakePHP Email Component\n/', $result);
|
||||
$this->assertRegExp('/Content-Type: text\/plain; charset=UTF-8\n/', $result);
|
||||
$this->assertRegExp('/Content-Transfer-Encoding: 8bitMessage:\n/', $result);
|
||||
|
@ -563,7 +563,7 @@ HTMLBLOC;
|
|||
$this->Controller->EmailTest->to = 'postmaster@example.com';
|
||||
$this->Controller->EmailTest->from = 'noreply@example.com';
|
||||
$this->Controller->EmailTest->subject = 'Cake Debug Test';
|
||||
$this->Controller->EmailTest->date = self::$sentDate = 'Today!';
|
||||
$this->Controller->EmailTest->date = static::$sentDate = 'Today!';
|
||||
$this->Controller->EmailTest->template = null;
|
||||
$this->Controller->EmailTest->delivery = 'DebugComp';
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ class SessionComponentTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public static function setupBeforeClass() {
|
||||
self::$_sessionBackup = Configure::read('Session');
|
||||
static::$_sessionBackup = Configure::read('Session');
|
||||
Configure::write('Session', array(
|
||||
'defaults' => 'php',
|
||||
'timeout' => 100,
|
||||
|
@ -105,7 +105,7 @@ class SessionComponentTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public static function teardownAfterClass() {
|
||||
Configure::write('Session', self::$_sessionBackup);
|
||||
Configure::write('Session', static::$_sessionBackup);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -35,7 +35,7 @@ class TestConsoleLog extends ConsoleLog {
|
|||
class TestCakeLog extends CakeLog {
|
||||
|
||||
public static function replace($key, &$engine) {
|
||||
self::$_Collection->{$key} = $engine;
|
||||
static::$_Collection->{$key} = $engine;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -28,11 +28,11 @@ App::uses('CacheSession', 'Model/Datasource/Session');
|
|||
class TestCakeSession extends CakeSession {
|
||||
|
||||
public static function setUserAgent($value) {
|
||||
self::$_userAgent = $value;
|
||||
static::$_userAgent = $value;
|
||||
}
|
||||
|
||||
public static function setHost($host) {
|
||||
self::_setHost($host);
|
||||
static::_setHost($host);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ class CakeSessionTest extends CakeTestCase {
|
|||
*/
|
||||
public static function setupBeforeClass() {
|
||||
// Make sure garbage colector will be called
|
||||
self::$_gcDivisor = ini_get('session.gc_divisor');
|
||||
static::$_gcDivisor = ini_get('session.gc_divisor');
|
||||
ini_set('session.gc_divisor', '1');
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ class CakeSessionTest extends CakeTestCase {
|
|||
*/
|
||||
public static function teardownAfterClass() {
|
||||
// Revert to the default setting
|
||||
ini_set('session.gc_divisor', self::$_gcDivisor);
|
||||
ini_set('session.gc_divisor', static::$_gcDivisor);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -39,7 +39,7 @@ class CacheSessionTest extends CakeTestCase {
|
|||
'engine' => 'File',
|
||||
'prefix' => 'session_test_'
|
||||
));
|
||||
self::$_sessionBackup = Configure::read('Session');
|
||||
static::$_sessionBackup = Configure::read('Session');
|
||||
|
||||
Configure::write('Session.handler.config', 'session_test');
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ class CacheSessionTest extends CakeTestCase {
|
|||
Cache::clear(false, 'session_test');
|
||||
Cache::drop('session_test');
|
||||
|
||||
Configure::write('Session', self::$_sessionBackup);
|
||||
Configure::write('Session', static::$_sessionBackup);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -54,7 +54,7 @@ class DatabaseSessionTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public static function setupBeforeClass() {
|
||||
self::$_sessionBackup = Configure::read('Session');
|
||||
static::$_sessionBackup = Configure::read('Session');
|
||||
Configure::write('Session.handler', array(
|
||||
'model' => 'SessionTestModel',
|
||||
));
|
||||
|
@ -67,7 +67,7 @@ class DatabaseSessionTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public static function teardownAfterClass() {
|
||||
Configure::write('Session', self::$_sessionBackup);
|
||||
Configure::write('Session', static::$_sessionBackup);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1994,7 +1994,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
'afterFind' => 'Successfully added by AfterFind'
|
||||
)
|
||||
));
|
||||
$this->assertEquals(self::date(), $result['Something']['updated']);
|
||||
$this->assertEquals(static::date(), $result['Something']['updated']);
|
||||
unset($result['Something']['updated']);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
|
|
@ -2102,7 +2102,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'body' => 'Second Article Body',
|
||||
'published' => 'Y',
|
||||
'created' => '2007-03-18 10:41:23',
|
||||
'updated' => self::date()
|
||||
'updated' => static::date()
|
||||
),
|
||||
'Tag' => array(
|
||||
array(
|
||||
|
@ -3042,23 +3042,23 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'JoinA' => array(
|
||||
'id' => '1',
|
||||
'name' => 'New name for Join A 1',
|
||||
'updated' => self::date()
|
||||
'updated' => static::date()
|
||||
),
|
||||
'JoinB' => array(
|
||||
array(
|
||||
'id' => 1,
|
||||
'join_b_id' => 2,
|
||||
'other' => 'New data for Join A 1 Join B 2',
|
||||
'created' => self::date(),
|
||||
'updated' => self::date()
|
||||
'created' => static::date(),
|
||||
'updated' => static::date()
|
||||
)),
|
||||
'JoinC' => array(
|
||||
array(
|
||||
'id' => 1,
|
||||
'join_c_id' => 2,
|
||||
'other' => 'New data for Join A 1 Join C 2',
|
||||
'created' => self::date(),
|
||||
'updated' => self::date()
|
||||
'created' => static::date(),
|
||||
'updated' => static::date()
|
||||
)));
|
||||
|
||||
$TestModel->set($data);
|
||||
|
@ -3071,7 +3071,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'name' => 'New name for Join A 1',
|
||||
'body' => 'Join A 1 Body',
|
||||
'created' => '2008-01-03 10:54:23',
|
||||
'updated' => self::date()
|
||||
'updated' => static::date()
|
||||
),
|
||||
'JoinB' => array(
|
||||
0 => array(
|
||||
|
@ -3084,8 +3084,8 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'join_a_id' => 1,
|
||||
'join_b_id' => 2,
|
||||
'other' => 'New data for Join A 1 Join B 2',
|
||||
'created' => self::date(),
|
||||
'updated' => self::date()
|
||||
'created' => static::date(),
|
||||
'updated' => static::date()
|
||||
))),
|
||||
'JoinC' => array(
|
||||
0 => array(
|
||||
|
@ -3098,8 +3098,8 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'join_a_id' => 1,
|
||||
'join_c_id' => 2,
|
||||
'other' => 'New data for Join A 1 Join C 2',
|
||||
'created' => self::date(),
|
||||
'updated' => self::date()
|
||||
'created' => static::date(),
|
||||
'updated' => static::date()
|
||||
))));
|
||||
|
||||
$this->assertEquals($expected, $result);
|
||||
|
@ -3143,10 +3143,10 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'password' => '5f4dcc3b5aa765d61d8327deb882cf90',
|
||||
'test' => 'working'
|
||||
));
|
||||
$this->assertEquals(self::date(), $result[3]['Post']['created']);
|
||||
$this->assertEquals(self::date(), $result[3]['Post']['updated']);
|
||||
$this->assertEquals(self::date(), $result[3]['Author']['created']);
|
||||
$this->assertEquals(self::date(), $result[3]['Author']['updated']);
|
||||
$this->assertEquals(static::date(), $result[3]['Post']['created']);
|
||||
$this->assertEquals(static::date(), $result[3]['Post']['updated']);
|
||||
$this->assertEquals(static::date(), $result[3]['Author']['created']);
|
||||
$this->assertEquals(static::date(), $result[3]['Author']['updated']);
|
||||
unset($result[3]['Post']['created'], $result[3]['Post']['updated']);
|
||||
unset($result[3]['Author']['created'], $result[3]['Author']['updated']);
|
||||
$this->assertEquals($expected, $result[3]);
|
||||
|
@ -3191,10 +3191,10 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'body' => 'Second multi-record post',
|
||||
'published' => 'N'
|
||||
)));
|
||||
$this->assertEquals(self::date(), $result[0]['Post']['created']);
|
||||
$this->assertEquals(self::date(), $result[0]['Post']['updated']);
|
||||
$this->assertEquals(self::date(), $result[1]['Post']['created']);
|
||||
$this->assertEquals(self::date(), $result[1]['Post']['updated']);
|
||||
$this->assertEquals(static::date(), $result[0]['Post']['created']);
|
||||
$this->assertEquals(static::date(), $result[0]['Post']['updated']);
|
||||
$this->assertEquals(static::date(), $result[1]['Post']['created']);
|
||||
$this->assertEquals(static::date(), $result[1]['Post']['updated']);
|
||||
unset($result[0]['Post']['created'], $result[0]['Post']['updated']);
|
||||
unset($result[1]['Post']['created'], $result[1]['Post']['updated']);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
@ -3220,8 +3220,8 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'comment' => 'New comment with attachment',
|
||||
'published' => 'Y'
|
||||
);
|
||||
$this->assertEquals(self::date(), $result[6]['Comment']['created']);
|
||||
$this->assertEquals(self::date(), $result[6]['Comment']['updated']);
|
||||
$this->assertEquals(static::date(), $result[6]['Comment']['created']);
|
||||
$this->assertEquals(static::date(), $result[6]['Comment']['updated']);
|
||||
unset($result[6]['Comment']['created'], $result[6]['Comment']['updated']);
|
||||
$this->assertEquals($expected, $result[6]['Comment']);
|
||||
|
||||
|
@ -3230,8 +3230,8 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'comment_id' => '7',
|
||||
'attachment' => 'some_file.tgz'
|
||||
);
|
||||
$this->assertEquals(self::date(), $result[6]['Attachment']['created']);
|
||||
$this->assertEquals(self::date(), $result[6]['Attachment']['updated']);
|
||||
$this->assertEquals(static::date(), $result[6]['Attachment']['created']);
|
||||
$this->assertEquals(static::date(), $result[6]['Attachment']['updated']);
|
||||
unset($result[6]['Attachment']['created'], $result[6]['Attachment']['updated']);
|
||||
$this->assertEquals($expected, $result[6]['Attachment']);
|
||||
}
|
||||
|
@ -4665,8 +4665,8 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'title' => 'New Fourth Post',
|
||||
'body' => null,
|
||||
'published' => 'N',
|
||||
'created' => self::date(),
|
||||
'updated' => self::date()
|
||||
'created' => static::date(),
|
||||
'updated' => static::date()
|
||||
));
|
||||
|
||||
$expected[] = array(
|
||||
|
@ -4676,8 +4676,8 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'title' => 'New Fifth Post',
|
||||
'body' => null,
|
||||
'published' => 'N',
|
||||
'created' => self::date(),
|
||||
'updated' => self::date()
|
||||
'created' => static::date(),
|
||||
'updated' => static::date()
|
||||
));
|
||||
|
||||
$this->assertEquals($expected, $result);
|
||||
|
@ -4733,8 +4733,8 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'title' => 'New Fourth Post',
|
||||
'body' => 'Third Post Body',
|
||||
'published' => 'N',
|
||||
'created' => self::date(),
|
||||
'updated' => self::date()
|
||||
'created' => static::date(),
|
||||
'updated' => static::date()
|
||||
));
|
||||
|
||||
$expected[] = array(
|
||||
|
@ -4744,8 +4744,8 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'title' => 'Third Post',
|
||||
'body' => 'Third Post Body',
|
||||
'published' => 'N',
|
||||
'created' => self::date(),
|
||||
'updated' => self::date()
|
||||
'created' => static::date(),
|
||||
'updated' => static::date()
|
||||
));
|
||||
}
|
||||
$this->assertEquals($expected, $result);
|
||||
|
@ -4870,10 +4870,10 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'body' => 'Fourth post body',
|
||||
'published' => 'N'
|
||||
)));
|
||||
$this->assertEquals(self::date(), $result[0]['Post']['updated']);
|
||||
$this->assertEquals(self::date(), $result[1]['Post']['updated']);
|
||||
$this->assertEquals(self::date(), $result[3]['Post']['created']);
|
||||
$this->assertEquals(self::date(), $result[3]['Post']['updated']);
|
||||
$this->assertEquals(static::date(), $result[0]['Post']['updated']);
|
||||
$this->assertEquals(static::date(), $result[1]['Post']['updated']);
|
||||
$this->assertEquals(static::date(), $result[3]['Post']['created']);
|
||||
$this->assertEquals(static::date(), $result[3]['Post']['updated']);
|
||||
unset($result[0]['Post']['updated'], $result[1]['Post']['updated']);
|
||||
unset($result[3]['Post']['created'], $result[3]['Post']['updated']);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
@ -4964,10 +4964,10 @@ class ModelWriteTest extends BaseModelTest {
|
|||
)
|
||||
);
|
||||
|
||||
$this->assertEquals(self::date(), $result[0]['Post']['updated']);
|
||||
$this->assertEquals(self::date(), $result[1]['Post']['updated']);
|
||||
$this->assertEquals(self::date(), $result[3]['Post']['updated']);
|
||||
$this->assertEquals(self::date(), $result[3]['Post']['created']);
|
||||
$this->assertEquals(static::date(), $result[0]['Post']['updated']);
|
||||
$this->assertEquals(static::date(), $result[1]['Post']['updated']);
|
||||
$this->assertEquals(static::date(), $result[3]['Post']['updated']);
|
||||
$this->assertEquals(static::date(), $result[3]['Post']['created']);
|
||||
unset(
|
||||
$result[0]['Post']['updated'], $result[1]['Post']['updated'],
|
||||
$result[3]['Post']['updated'], $result[3]['Post']['created']
|
||||
|
@ -5348,10 +5348,10 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'password' => '5f4dcc3b5aa765d61d8327deb882cf90',
|
||||
'test' => 'working'
|
||||
));
|
||||
$this->assertEquals(self::date(), $result[3]['Post']['updated']);
|
||||
$this->assertEquals(self::date(), $result[3]['Post']['created']);
|
||||
$this->assertEquals(self::date(), $result[3]['Author']['created']);
|
||||
$this->assertEquals(self::date(), $result[3]['Author']['updated']);
|
||||
$this->assertEquals(static::date(), $result[3]['Post']['updated']);
|
||||
$this->assertEquals(static::date(), $result[3]['Post']['created']);
|
||||
$this->assertEquals(static::date(), $result[3]['Author']['created']);
|
||||
$this->assertEquals(static::date(), $result[3]['Author']['updated']);
|
||||
unset(
|
||||
$result[3]['Post']['updated'], $result[3]['Post']['created'],
|
||||
$result[3]['Author']['updated'], $result[3]['Author']['created']
|
||||
|
@ -5380,8 +5380,8 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'comment' => 'New comment with attachment',
|
||||
'published' => 'Y'
|
||||
);
|
||||
$this->assertEquals(self::date(), $result[6]['Comment']['updated']);
|
||||
$this->assertEquals(self::date(), $result[6]['Comment']['created']);
|
||||
$this->assertEquals(static::date(), $result[6]['Comment']['updated']);
|
||||
$this->assertEquals(static::date(), $result[6]['Comment']['created']);
|
||||
unset($result[6]['Comment']['updated'], $result[6]['Comment']['created']);
|
||||
$this->assertEquals($expected, $result[6]['Comment']);
|
||||
|
||||
|
@ -5390,8 +5390,8 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'comment_id' => '7',
|
||||
'attachment' => 'some_file.tgz'
|
||||
);
|
||||
$this->assertEquals(self::date(), $result[6]['Attachment']['updated']);
|
||||
$this->assertEquals(self::date(), $result[6]['Attachment']['created']);
|
||||
$this->assertEquals(static::date(), $result[6]['Attachment']['updated']);
|
||||
$this->assertEquals(static::date(), $result[6]['Attachment']['created']);
|
||||
unset($result[6]['Attachment']['updated'], $result[6]['Attachment']['created']);
|
||||
$this->assertEquals($expected, $result[6]['Attachment']);
|
||||
}
|
||||
|
@ -5491,10 +5491,10 @@ class ModelWriteTest extends BaseModelTest {
|
|||
)
|
||||
)
|
||||
);
|
||||
$this->assertEquals(self::date(), $result[0]['Post']['updated']);
|
||||
$this->assertEquals(self::date(), $result[0]['Post']['created']);
|
||||
$this->assertEquals(self::date(), $result[1]['Post']['updated']);
|
||||
$this->assertEquals(self::date(), $result[1]['Post']['created']);
|
||||
$this->assertEquals(static::date(), $result[0]['Post']['updated']);
|
||||
$this->assertEquals(static::date(), $result[0]['Post']['created']);
|
||||
$this->assertEquals(static::date(), $result[1]['Post']['updated']);
|
||||
$this->assertEquals(static::date(), $result[1]['Post']['created']);
|
||||
unset($result[0]['Post']['updated'], $result[0]['Post']['created']);
|
||||
unset($result[1]['Post']['updated'], $result[1]['Post']['created']);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
@ -6184,10 +6184,10 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'published' => 'N',
|
||||
));
|
||||
|
||||
$this->assertEquals(self::date(), $result[3]['Post']['created']);
|
||||
$this->assertEquals(self::date(), $result[3]['Post']['updated']);
|
||||
$this->assertEquals(self::date(), $result[4]['Post']['created']);
|
||||
$this->assertEquals(self::date(), $result[4]['Post']['updated']);
|
||||
$this->assertEquals(static::date(), $result[3]['Post']['created']);
|
||||
$this->assertEquals(static::date(), $result[3]['Post']['updated']);
|
||||
$this->assertEquals(static::date(), $result[4]['Post']['created']);
|
||||
$this->assertEquals(static::date(), $result[4]['Post']['updated']);
|
||||
unset($result[3]['Post']['created'], $result[3]['Post']['updated']);
|
||||
unset($result[4]['Post']['created'], $result[4]['Post']['updated']);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
@ -6253,10 +6253,10 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'body' => 'Third Post Body',
|
||||
'published' => 'N'
|
||||
));
|
||||
$this->assertEquals(self::date(), $result[3]['Post']['created']);
|
||||
$this->assertEquals(self::date(), $result[3]['Post']['updated']);
|
||||
$this->assertEquals(self::date(), $result[4]['Post']['created']);
|
||||
$this->assertEquals(self::date(), $result[4]['Post']['updated']);
|
||||
$this->assertEquals(static::date(), $result[3]['Post']['created']);
|
||||
$this->assertEquals(static::date(), $result[3]['Post']['updated']);
|
||||
$this->assertEquals(static::date(), $result[4]['Post']['created']);
|
||||
$this->assertEquals(static::date(), $result[4]['Post']['updated']);
|
||||
unset($result[3]['Post']['created'], $result[3]['Post']['updated']);
|
||||
unset($result[4]['Post']['created'], $result[4]['Post']['updated']);
|
||||
}
|
||||
|
@ -6387,10 +6387,10 @@ class ModelWriteTest extends BaseModelTest {
|
|||
)
|
||||
);
|
||||
|
||||
$this->assertEquals(self::date(), $result[0]['Post']['updated']);
|
||||
$this->assertEquals(self::date(), $result[1]['Post']['updated']);
|
||||
$this->assertEquals(self::date(), $result[3]['Post']['created']);
|
||||
$this->assertEquals(self::date(), $result[3]['Post']['updated']);
|
||||
$this->assertEquals(static::date(), $result[0]['Post']['updated']);
|
||||
$this->assertEquals(static::date(), $result[1]['Post']['updated']);
|
||||
$this->assertEquals(static::date(), $result[3]['Post']['created']);
|
||||
$this->assertEquals(static::date(), $result[3]['Post']['updated']);
|
||||
unset($result[0]['Post']['updated'], $result[1]['Post']['updated']);
|
||||
unset($result[3]['Post']['created'], $result[3]['Post']['updated']);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
@ -7147,15 +7147,15 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'title' => 'Post without body',
|
||||
'body' => null,
|
||||
'published' => 'N',
|
||||
'created' => self::date(),
|
||||
'updated' => self::date(),
|
||||
'created' => static::date(),
|
||||
'updated' => static::date(),
|
||||
),
|
||||
'Author' => array(
|
||||
'id' => '5',
|
||||
'user' => 'bob',
|
||||
'password' => null,
|
||||
'created' => self::date(),
|
||||
'updated' => self::date(),
|
||||
'created' => static::date(),
|
||||
'updated' => static::date(),
|
||||
'test' => 'working',
|
||||
),
|
||||
);
|
||||
|
@ -7210,15 +7210,15 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'title' => 'Post title',
|
||||
'body' => 'Post body',
|
||||
'published' => 'N',
|
||||
'created' => self::date(),
|
||||
'updated' => self::date()
|
||||
'created' => static::date(),
|
||||
'updated' => static::date()
|
||||
),
|
||||
'Author' => array(
|
||||
'id' => '6',
|
||||
'user' => 'jack',
|
||||
'password' => 'foobar',
|
||||
'created' => self::date(),
|
||||
'updated' => self::date(),
|
||||
'created' => static::date(),
|
||||
'updated' => static::date(),
|
||||
'test' => 'working'
|
||||
),
|
||||
);
|
||||
|
@ -7252,8 +7252,8 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'title' => 'Multi-record post 1',
|
||||
'body' => '',
|
||||
'published' => 'N',
|
||||
'created' => self::date(),
|
||||
'updated' => self::date()
|
||||
'created' => static::date(),
|
||||
'updated' => static::date()
|
||||
)
|
||||
),
|
||||
array(
|
||||
|
@ -7263,8 +7263,8 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'title' => 'Multi-record post 2',
|
||||
'body' => '',
|
||||
'published' => 'N',
|
||||
'created' => self::date(),
|
||||
'updated' => self::date()
|
||||
'created' => static::date(),
|
||||
'updated' => static::date()
|
||||
)
|
||||
)
|
||||
);
|
||||
|
|
|
@ -41,7 +41,7 @@ class FolderTest extends CakeTestCase {
|
|||
|
||||
foreach (scandir(TMP) as $file) {
|
||||
if (is_dir(TMP . $file) && !in_array($file, array('.', '..'))) {
|
||||
self::$_tmp[] = $file;
|
||||
static::$_tmp[] = $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ class FolderTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function tearDown() {
|
||||
$exclude = array_merge(self::$_tmp, array('.', '..'));
|
||||
$exclude = array_merge(static::$_tmp, array('.', '..'));
|
||||
foreach (scandir(TMP) as $dir) {
|
||||
if (is_dir(TMP . $dir) && !in_array($dir, $exclude)) {
|
||||
$iterator = new RecursiveDirectoryIterator(TMP . $dir);
|
||||
|
|
|
@ -198,7 +198,7 @@ class HashTest extends CakeTestCase {
|
|||
$result = Hash::get($data, '1');
|
||||
$this->assertEquals('def', $result);
|
||||
|
||||
$data = self::articleData();
|
||||
$data = static::articleData();
|
||||
|
||||
$result = Hash::get(array(), '1.Article.title');
|
||||
$this->assertNull($result);
|
||||
|
@ -708,7 +708,7 @@ class HashTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testExtractBasic() {
|
||||
$data = self::articleData();
|
||||
$data = static::articleData();
|
||||
|
||||
$result = Hash::extract($data, '');
|
||||
$this->assertEquals($data, $result);
|
||||
|
@ -729,7 +729,7 @@ class HashTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testExtractNumericKey() {
|
||||
$data = self::articleData();
|
||||
$data = static::articleData();
|
||||
$result = Hash::extract($data, '{n}.Article.title');
|
||||
$expected = array(
|
||||
'First Article', 'Second Article',
|
||||
|
@ -808,7 +808,7 @@ class HashTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testExtractStringKey() {
|
||||
$data = self::articleData();
|
||||
$data = static::articleData();
|
||||
$result = Hash::extract($data, '{n}.{s}.user');
|
||||
$expected = array(
|
||||
'mariano',
|
||||
|
@ -855,7 +855,7 @@ class HashTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testExtractAttributePresence() {
|
||||
$data = self::articleData();
|
||||
$data = static::articleData();
|
||||
|
||||
$result = Hash::extract($data, '{n}.Article[published]');
|
||||
$expected = array($data[1]['Article']);
|
||||
|
@ -872,7 +872,7 @@ class HashTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testExtractAttributeEquality() {
|
||||
$data = self::articleData();
|
||||
$data = static::articleData();
|
||||
|
||||
$result = Hash::extract($data, '{n}.Article[id=3]');
|
||||
$expected = array($data[2]['Article']);
|
||||
|
@ -957,7 +957,7 @@ class HashTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testExtractAttributeComparison() {
|
||||
$data = self::articleData();
|
||||
$data = static::articleData();
|
||||
|
||||
$result = Hash::extract($data, '{n}.Comment.{n}[user_id > 2]');
|
||||
$expected = array($data[0]['Comment'][1]);
|
||||
|
@ -986,7 +986,7 @@ class HashTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testExtractAttributeMultiple() {
|
||||
$data = self::articleData();
|
||||
$data = static::articleData();
|
||||
|
||||
$result = Hash::extract($data, '{n}.Comment.{n}[user_id > 2][id=1]');
|
||||
$this->assertEmpty($result);
|
||||
|
@ -1003,7 +1003,7 @@ class HashTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testExtractAttributePattern() {
|
||||
$data = self::articleData();
|
||||
$data = static::articleData();
|
||||
|
||||
$result = Hash::extract($data, '{n}.Article[title=/^First/]');
|
||||
$expected = array($data[0]['Article']);
|
||||
|
@ -1426,7 +1426,7 @@ class HashTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testInsertMulti() {
|
||||
$data = self::articleData();
|
||||
$data = static::articleData();
|
||||
|
||||
$result = Hash::insert($data, '{n}.Article.insert', 'value');
|
||||
$this->assertEquals('value', $result[0]['Article']['insert']);
|
||||
|
@ -1552,7 +1552,7 @@ class HashTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testRemoveMulti() {
|
||||
$data = self::articleData();
|
||||
$data = static::articleData();
|
||||
|
||||
$result = Hash::remove($data, '{n}.Article.title');
|
||||
$this->assertFalse(isset($result[0]['Article']['title']));
|
||||
|
@ -1619,7 +1619,7 @@ class HashTest extends CakeTestCase {
|
|||
$result = Hash::combine(array(), '{n}.User.id', '{n}.User.Data');
|
||||
$this->assertTrue(empty($result));
|
||||
|
||||
$a = self::userData();
|
||||
$a = static::userData();
|
||||
|
||||
$result = Hash::combine($a, '{n}.User.id');
|
||||
$expected = array(2 => null, 14 => null, 25 => null);
|
||||
|
@ -1678,7 +1678,7 @@ class HashTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testCombineWithGroupPath() {
|
||||
$a = self::userData();
|
||||
$a = static::userData();
|
||||
|
||||
$result = Hash::combine($a, '{n}.User.id', '{n}.User.Data', '{n}.User.group_id');
|
||||
$expected = array(
|
||||
|
@ -1735,7 +1735,7 @@ class HashTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testCombineWithFormatting() {
|
||||
$a = self::userData();
|
||||
$a = static::userData();
|
||||
|
||||
$result = Hash::combine(
|
||||
$a,
|
||||
|
@ -1801,7 +1801,7 @@ class HashTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testFormat() {
|
||||
$data = self::userData();
|
||||
$data = static::userData();
|
||||
|
||||
$result = Hash::format(
|
||||
$data,
|
||||
|
@ -1861,7 +1861,7 @@ class HashTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testMap() {
|
||||
$data = self::articleData();
|
||||
$data = static::articleData();
|
||||
|
||||
$result = Hash::map($data, '{n}.Article.id', array($this, 'mapCallback'));
|
||||
$expected = array(2, 4, 6, 8, 10);
|
||||
|
@ -1874,7 +1874,7 @@ class HashTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testApply() {
|
||||
$data = self::articleData();
|
||||
$data = static::articleData();
|
||||
|
||||
$result = Hash::apply($data, '{n}.Article.id', 'array_sum');
|
||||
$this->assertEquals(15, $result);
|
||||
|
@ -1886,7 +1886,7 @@ class HashTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testReduce() {
|
||||
$data = self::articleData();
|
||||
$data = static::articleData();
|
||||
|
||||
$result = Hash::reduce($data, '{n}.Article.id', array($this, 'reduceCallback'));
|
||||
$this->assertEquals(15, $result);
|
||||
|
|
|
@ -406,7 +406,7 @@ class InflectorTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testInflectorSlugCharList() {
|
||||
foreach (self::$maps as $language => $list) {
|
||||
foreach (static::$maps as $language => $list) {
|
||||
foreach ($list as $from => $to) {
|
||||
$result = Inflector::slug($from);
|
||||
$this->assertEquals($to, $result, $from . ' (' . $language . ') should be ' . $to . ' - but is ' . $result);
|
||||
|
|
|
@ -548,7 +548,7 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase {
|
|||
* @return void
|
||||
*/
|
||||
protected static function assertEqual($result, $expected, $message = '') {
|
||||
return self::assertEquals($expected, $result, $message);
|
||||
return static::assertEquals($expected, $result, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -561,7 +561,7 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase {
|
|||
* @return void
|
||||
*/
|
||||
protected static function assertNotEqual($result, $expected, $message = '') {
|
||||
return self::assertNotEquals($expected, $result, $message);
|
||||
return static::assertNotEquals($expected, $result, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -574,7 +574,7 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase {
|
|||
* @return void
|
||||
*/
|
||||
protected static function assertPattern($pattern, $string, $message = '') {
|
||||
return self::assertRegExp($pattern, $string, $message);
|
||||
return static::assertRegExp($pattern, $string, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -587,7 +587,7 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase {
|
|||
* @return void
|
||||
*/
|
||||
protected static function assertIdentical($actual, $expected, $message = '') {
|
||||
return self::assertSame($expected, $actual, $message);
|
||||
return static::assertSame($expected, $actual, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -600,7 +600,7 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase {
|
|||
* @return void
|
||||
*/
|
||||
protected static function assertNotIdentical($actual, $expected, $message = '') {
|
||||
return self::assertNotSame($expected, $actual, $message);
|
||||
return static::assertNotSame($expected, $actual, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -613,7 +613,7 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase {
|
|||
* @return void
|
||||
*/
|
||||
protected static function assertNoPattern($pattern, $string, $message = '') {
|
||||
return self::assertNotRegExp($pattern, $string, $message);
|
||||
return static::assertNotRegExp($pattern, $string, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -662,7 +662,7 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase {
|
|||
* @return void
|
||||
*/
|
||||
protected static function assertReference(&$first, &$second, $message = '') {
|
||||
return self::assertSame($first, $second, $message);
|
||||
return static::assertSame($first, $second, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -675,7 +675,7 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase {
|
|||
* @return void
|
||||
*/
|
||||
protected static function assertIsA($object, $type, $message = '') {
|
||||
return self::assertInstanceOf($type, $object, $message);
|
||||
return static::assertInstanceOf($type, $object, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -690,7 +690,7 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase {
|
|||
protected static function assertWithinMargin($result, $expected, $margin, $message = '') {
|
||||
$upper = $result + $margin;
|
||||
$lower = $result - $margin;
|
||||
return self::assertTrue((($expected <= $upper) && ($expected >= $lower)), $message);
|
||||
return static::assertTrue((($expected <= $upper) && ($expected >= $lower)), $message);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -85,8 +85,8 @@ class CakeTestLoader extends PHPUnit_Runner_StandardTestSuiteLoader {
|
|||
* @return array
|
||||
*/
|
||||
public static function generateTestList($params) {
|
||||
$directory = self::_basePath($params);
|
||||
$fileList = self::_getRecursiveFileList($directory);
|
||||
$directory = static::_basePath($params);
|
||||
$fileList = static::_getRecursiveFileList($directory);
|
||||
|
||||
$testCases = array();
|
||||
foreach ($fileList as $testCaseFile) {
|
||||
|
|
|
@ -48,7 +48,7 @@ class CakeTestRunner extends PHPUnit_TextUI_TestRunner {
|
|||
*/
|
||||
public function doRun(PHPUnit_Framework_Test $suite, array $arguments = array()) {
|
||||
if (isset($arguments['printer'])) {
|
||||
self::$versionStringPrinted = true;
|
||||
static::$versionStringPrinted = true;
|
||||
}
|
||||
|
||||
$fixture = $this->_getFixtureManager($arguments);
|
||||
|
|
|
@ -254,7 +254,7 @@ class CakeTestSuiteDispatcher {
|
|||
restore_error_handler();
|
||||
|
||||
try {
|
||||
self::time();
|
||||
static::time();
|
||||
$command = new CakeTestSuiteCommand('CakeTestLoader', $commandArgs);
|
||||
$command->run($options);
|
||||
} catch (MissingConnectionException $exception) {
|
||||
|
@ -287,7 +287,7 @@ class CakeTestSuiteDispatcher {
|
|||
* @return string formatted date
|
||||
*/
|
||||
public static function date($format) {
|
||||
return date($format, self::time());
|
||||
return date($format, static::time());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -116,13 +116,13 @@ class CakeNumber {
|
|||
case $size < 1024:
|
||||
return __dn('cake', '%d Byte', '%d Bytes', $size, $size);
|
||||
case round($size / 1024) < 1024:
|
||||
return __d('cake', '%s KB', self::precision($size / 1024, 0));
|
||||
return __d('cake', '%s KB', static::precision($size / 1024, 0));
|
||||
case round($size / 1024 / 1024, 2) < 1024:
|
||||
return __d('cake', '%s MB', self::precision($size / 1024 / 1024, 2));
|
||||
return __d('cake', '%s MB', static::precision($size / 1024 / 1024, 2));
|
||||
case round($size / 1024 / 1024 / 1024, 2) < 1024:
|
||||
return __d('cake', '%s GB', self::precision($size / 1024 / 1024 / 1024, 2));
|
||||
return __d('cake', '%s GB', static::precision($size / 1024 / 1024 / 1024, 2));
|
||||
default:
|
||||
return __d('cake', '%s TB', self::precision($size / 1024 / 1024 / 1024 / 1024, 2));
|
||||
return __d('cake', '%s TB', static::precision($size / 1024 / 1024 / 1024 / 1024, 2));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -181,7 +181,7 @@ class CakeNumber {
|
|||
if ($options['multiply']) {
|
||||
$value *= 100;
|
||||
}
|
||||
return self::precision($value, $precision) . '%';
|
||||
return static::precision($value, $precision) . '%';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -221,8 +221,8 @@ class CakeNumber {
|
|||
extract($options);
|
||||
}
|
||||
|
||||
$value = self::_numberFormat($value, $places, '.', '');
|
||||
$out = $before . self::_numberFormat($value, $places, $decimals, $thousands) . $after;
|
||||
$value = static::_numberFormat($value, $places, '.', '');
|
||||
$out = $before . static::_numberFormat($value, $places, $decimals, $thousands) . $after;
|
||||
|
||||
if ($escape) {
|
||||
return h($out);
|
||||
|
@ -249,10 +249,10 @@ class CakeNumber {
|
|||
*/
|
||||
public static function formatDelta($value, $options = array()) {
|
||||
$places = isset($options['places']) ? $options['places'] : 0;
|
||||
$value = self::_numberFormat($value, $places, '.', '');
|
||||
$value = static::_numberFormat($value, $places, '.', '');
|
||||
$sign = $value > 0 ? '+' : '';
|
||||
$options['before'] = isset($options['before']) ? $options['before'] . $sign : $sign;
|
||||
return self::format($value, $options);
|
||||
return static::format($value, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -265,10 +265,10 @@ class CakeNumber {
|
|||
* @return string
|
||||
*/
|
||||
protected static function _numberFormat($value, $places = 0, $decimals = '.', $thousands = ',') {
|
||||
if (!isset(self::$_numberFormatSupport)) {
|
||||
self::$_numberFormatSupport = version_compare(PHP_VERSION, '5.4.0', '>=');
|
||||
if (!isset(static::$_numberFormatSupport)) {
|
||||
static::$_numberFormatSupport = version_compare(PHP_VERSION, '5.4.0', '>=');
|
||||
}
|
||||
if (self::$_numberFormatSupport) {
|
||||
if (static::$_numberFormatSupport) {
|
||||
return number_format($value, $places, $decimals, $thousands);
|
||||
}
|
||||
$value = number_format($value, $places, '.', '');
|
||||
|
@ -323,13 +323,13 @@ class CakeNumber {
|
|||
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/number.html#NumberHelper::currency
|
||||
*/
|
||||
public static function currency($value, $currency = null, $options = array()) {
|
||||
$defaults = self::$_currencyDefaults;
|
||||
$defaults = static::$_currencyDefaults;
|
||||
if ($currency === null) {
|
||||
$currency = self::defaultCurrency();
|
||||
$currency = static::defaultCurrency();
|
||||
}
|
||||
|
||||
if (isset(self::$_currencies[$currency])) {
|
||||
$defaults = self::$_currencies[$currency];
|
||||
if (isset(static::$_currencies[$currency])) {
|
||||
$defaults = static::$_currencies[$currency];
|
||||
} elseif (is_string($currency)) {
|
||||
$options['before'] = $currency;
|
||||
}
|
||||
|
@ -364,7 +364,7 @@ class CakeNumber {
|
|||
$options[$position] = $options[$symbolKey . 'Symbol'];
|
||||
|
||||
$abs = abs($value);
|
||||
$result = self::format($abs, $options);
|
||||
$result = static::format($abs, $options);
|
||||
|
||||
if ($value < 0) {
|
||||
if ($options['negative'] === '()') {
|
||||
|
@ -396,7 +396,7 @@ class CakeNumber {
|
|||
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/number.html#NumberHelper::addFormat
|
||||
*/
|
||||
public static function addFormat($formatName, $options) {
|
||||
self::$_currencies[$formatName] = $options + self::$_currencyDefaults;
|
||||
static::$_currencies[$formatName] = $options + static::$_currencyDefaults;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -408,9 +408,9 @@ class CakeNumber {
|
|||
*/
|
||||
public static function defaultCurrency($currency = null) {
|
||||
if ($currency) {
|
||||
self::$_defaultCurrency = $currency;
|
||||
static::$_defaultCurrency = $currency;
|
||||
}
|
||||
return self::$_defaultCurrency;
|
||||
return static::$_defaultCurrency;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -332,7 +332,7 @@ class CakeText {
|
|||
}
|
||||
$options += array('width' => 72, 'wordWrap' => true, 'indent' => null, 'indentAt' => 0);
|
||||
if ($options['wordWrap']) {
|
||||
$wrapped = self::wordWrap($text, $options['width'], "\n");
|
||||
$wrapped = static::wordWrap($text, $options['width'], "\n");
|
||||
} else {
|
||||
$wrapped = trim(chunk_split($text, $options['width'] - 1, "\n"));
|
||||
}
|
||||
|
@ -358,7 +358,7 @@ class CakeText {
|
|||
public static function wordWrap($text, $width = 72, $break = "\n", $cut = false) {
|
||||
$paragraphs = explode($break, $text);
|
||||
foreach ($paragraphs as &$paragraph) {
|
||||
$paragraph = self::_wordWrap($paragraph, $width, $break, $cut);
|
||||
$paragraph = static::_wordWrap($paragraph, $width, $break, $cut);
|
||||
}
|
||||
return implode($break, $paragraphs);
|
||||
}
|
||||
|
@ -657,7 +657,7 @@ class CakeText {
|
|||
*/
|
||||
public static function excerpt($text, $phrase, $radius = 100, $ellipsis = '...') {
|
||||
if (empty($text) || empty($phrase)) {
|
||||
return self::truncate($text, $radius * 2, array('ellipsis' => $ellipsis));
|
||||
return static::truncate($text, $radius * 2, array('ellipsis' => $ellipsis));
|
||||
}
|
||||
|
||||
$append = $prepend = $ellipsis;
|
||||
|
|
|
@ -100,7 +100,7 @@ class CakeTime {
|
|||
public function __set($name, $value) {
|
||||
switch ($name) {
|
||||
case 'niceFormat':
|
||||
self::${$name} = $value;
|
||||
static::${$name} = $value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ class CakeTime {
|
|||
public function __get($name) {
|
||||
switch ($name) {
|
||||
case 'niceFormat':
|
||||
return self::${$name};
|
||||
return static::${$name};
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ class CakeTime {
|
|||
if (!$time) {
|
||||
$time = time();
|
||||
}
|
||||
self::$_time = $time;
|
||||
static::$_time = $time;
|
||||
return preg_replace_callback('/\%(\w+)/', array('CakeTime', '_translateSpecifier'), $format);
|
||||
}
|
||||
|
||||
|
@ -151,47 +151,47 @@ class CakeTime {
|
|||
case 'a':
|
||||
$abday = __dc('cake', 'abday', 5);
|
||||
if (is_array($abday)) {
|
||||
return $abday[date('w', self::$_time)];
|
||||
return $abday[date('w', static::$_time)];
|
||||
}
|
||||
break;
|
||||
case 'A':
|
||||
$day = __dc('cake', 'day', 5);
|
||||
if (is_array($day)) {
|
||||
return $day[date('w', self::$_time)];
|
||||
return $day[date('w', static::$_time)];
|
||||
}
|
||||
break;
|
||||
case 'c':
|
||||
$format = __dc('cake', 'd_t_fmt', 5);
|
||||
if ($format !== 'd_t_fmt') {
|
||||
return self::convertSpecifiers($format, self::$_time);
|
||||
return static::convertSpecifiers($format, static::$_time);
|
||||
}
|
||||
break;
|
||||
case 'C':
|
||||
return sprintf("%02d", date('Y', self::$_time) / 100);
|
||||
return sprintf("%02d", date('Y', static::$_time) / 100);
|
||||
case 'D':
|
||||
return '%m/%d/%y';
|
||||
case 'e':
|
||||
if (DS === '/') {
|
||||
return '%e';
|
||||
}
|
||||
$day = date('j', self::$_time);
|
||||
$day = date('j', static::$_time);
|
||||
if ($day < 10) {
|
||||
$day = ' ' . $day;
|
||||
}
|
||||
return $day;
|
||||
case 'eS' :
|
||||
return date('jS', self::$_time);
|
||||
return date('jS', static::$_time);
|
||||
case 'b':
|
||||
case 'h':
|
||||
$months = __dc('cake', 'abmon', 5);
|
||||
if (is_array($months)) {
|
||||
return $months[date('n', self::$_time) - 1];
|
||||
return $months[date('n', static::$_time) - 1];
|
||||
}
|
||||
return '%b';
|
||||
case 'B':
|
||||
$months = __dc('cake', 'mon', 5);
|
||||
if (is_array($months)) {
|
||||
return $months[date('n', self::$_time) - 1];
|
||||
return $months[date('n', static::$_time) - 1];
|
||||
}
|
||||
break;
|
||||
case 'n':
|
||||
|
@ -199,7 +199,7 @@ class CakeTime {
|
|||
case 'p':
|
||||
case 'P':
|
||||
$default = array('am' => 0, 'pm' => 1);
|
||||
$meridiem = $default[date('a', self::$_time)];
|
||||
$meridiem = $default[date('a', static::$_time)];
|
||||
$format = __dc('cake', 'am_pm', 5);
|
||||
if (is_array($format)) {
|
||||
$meridiem = $format[$meridiem];
|
||||
|
@ -209,27 +209,27 @@ class CakeTime {
|
|||
case 'r':
|
||||
$complete = __dc('cake', 't_fmt_ampm', 5);
|
||||
if ($complete !== 't_fmt_ampm') {
|
||||
return str_replace('%p', self::_translateSpecifier(array('%p', 'p')), $complete);
|
||||
return str_replace('%p', static::_translateSpecifier(array('%p', 'p')), $complete);
|
||||
}
|
||||
break;
|
||||
case 'R':
|
||||
return date('H:i', self::$_time);
|
||||
return date('H:i', static::$_time);
|
||||
case 't':
|
||||
return "\t";
|
||||
case 'T':
|
||||
return '%H:%M:%S';
|
||||
case 'u':
|
||||
return ($weekDay = date('w', self::$_time)) ? $weekDay : 7;
|
||||
return ($weekDay = date('w', static::$_time)) ? $weekDay : 7;
|
||||
case 'x':
|
||||
$format = __dc('cake', 'd_fmt', 5);
|
||||
if ($format !== 'd_fmt') {
|
||||
return self::convertSpecifiers($format, self::$_time);
|
||||
return static::convertSpecifiers($format, static::$_time);
|
||||
}
|
||||
break;
|
||||
case 'X':
|
||||
$format = __dc('cake', 't_fmt', 5);
|
||||
if ($format !== 't_fmt') {
|
||||
return self::convertSpecifiers($format, self::$_time);
|
||||
return static::convertSpecifiers($format, static::$_time);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ class CakeTime {
|
|||
if (is_numeric($timezone)) {
|
||||
$userOffset = $timezone * (60 * 60);
|
||||
} else {
|
||||
$timezone = self::timezone($timezone);
|
||||
$timezone = static::timezone($timezone);
|
||||
$userOffset = $timezone->getOffset(new DateTime('@' . $gmtTime));
|
||||
}
|
||||
$userTime = $gmtTime + $userOffset;
|
||||
|
@ -343,7 +343,7 @@ class CakeTime {
|
|||
}
|
||||
|
||||
if ($timezone !== null) {
|
||||
return self::convert($date, $timezone);
|
||||
return static::convert($date, $timezone);
|
||||
}
|
||||
return $date;
|
||||
}
|
||||
|
@ -364,12 +364,12 @@ class CakeTime {
|
|||
if (!$dateString) {
|
||||
$dateString = time();
|
||||
}
|
||||
$date = self::fromString($dateString, $timezone);
|
||||
$date = static::fromString($dateString, $timezone);
|
||||
|
||||
if (!$format) {
|
||||
$format = self::$niceFormat;
|
||||
$format = static::$niceFormat;
|
||||
}
|
||||
return self::_strftime(self::convertSpecifiers($format, $date), $date);
|
||||
return static::_strftime(static::convertSpecifiers($format, $date), $date);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -391,19 +391,19 @@ class CakeTime {
|
|||
if (!$dateString) {
|
||||
$dateString = time();
|
||||
}
|
||||
$date = self::fromString($dateString, $timezone);
|
||||
$date = static::fromString($dateString, $timezone);
|
||||
|
||||
if (self::isToday($dateString, $timezone)) {
|
||||
return __d('cake', 'Today, %s', self::_strftime("%H:%M", $date));
|
||||
if (static::isToday($dateString, $timezone)) {
|
||||
return __d('cake', 'Today, %s', static::_strftime("%H:%M", $date));
|
||||
}
|
||||
if (self::wasYesterday($dateString, $timezone)) {
|
||||
return __d('cake', 'Yesterday, %s', self::_strftime("%H:%M", $date));
|
||||
if (static::wasYesterday($dateString, $timezone)) {
|
||||
return __d('cake', 'Yesterday, %s', static::_strftime("%H:%M", $date));
|
||||
}
|
||||
if (self::isTomorrow($dateString, $timezone)) {
|
||||
return __d('cake', 'Tomorrow, %s', self::_strftime("%H:%M", $date));
|
||||
if (static::isTomorrow($dateString, $timezone)) {
|
||||
return __d('cake', 'Tomorrow, %s', static::_strftime("%H:%M", $date));
|
||||
}
|
||||
|
||||
$d = self::_strftime("%w", $date);
|
||||
$d = static::_strftime("%w", $date);
|
||||
$day = array(
|
||||
__d('cake', 'Sunday'),
|
||||
__d('cake', 'Monday'),
|
||||
|
@ -413,18 +413,18 @@ class CakeTime {
|
|||
__d('cake', 'Friday'),
|
||||
__d('cake', 'Saturday')
|
||||
);
|
||||
if (self::wasWithinLast('7 days', $dateString, $timezone)) {
|
||||
return sprintf('%s %s', $day[$d], self::_strftime(self::$niceShortFormat, $date));
|
||||
if (static::wasWithinLast('7 days', $dateString, $timezone)) {
|
||||
return sprintf('%s %s', $day[$d], static::_strftime(static::$niceShortFormat, $date));
|
||||
}
|
||||
if (self::isWithinNext('7 days', $dateString, $timezone)) {
|
||||
return __d('cake', 'On %s %s', $day[$d], self::_strftime(self::$niceShortFormat, $date));
|
||||
if (static::isWithinNext('7 days', $dateString, $timezone)) {
|
||||
return __d('cake', 'On %s %s', $day[$d], static::_strftime(static::$niceShortFormat, $date));
|
||||
}
|
||||
|
||||
$y = '';
|
||||
if (!self::isThisYear($date)) {
|
||||
if (!static::isThisYear($date)) {
|
||||
$y = ' %Y';
|
||||
}
|
||||
return self::_strftime(self::convertSpecifiers("%b %eS{$y}, %H:%M", $date), $date);
|
||||
return static::_strftime(static::convertSpecifiers("%b %eS{$y}, %H:%M", $date), $date);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -438,8 +438,8 @@ class CakeTime {
|
|||
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#TimeHelper::daysAsSql
|
||||
*/
|
||||
public static function daysAsSql($begin, $end, $fieldName, $timezone = null) {
|
||||
$begin = self::fromString($begin, $timezone);
|
||||
$end = self::fromString($end, $timezone);
|
||||
$begin = static::fromString($begin, $timezone);
|
||||
$end = static::fromString($end, $timezone);
|
||||
$begin = date('Y-m-d', $begin) . ' 00:00:00';
|
||||
$end = date('Y-m-d', $end) . ' 23:59:59';
|
||||
|
||||
|
@ -457,7 +457,7 @@ class CakeTime {
|
|||
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#TimeHelper::dayAsSql
|
||||
*/
|
||||
public static function dayAsSql($dateString, $fieldName, $timezone = null) {
|
||||
return self::daysAsSql($dateString, $dateString, $fieldName, $timezone);
|
||||
return static::daysAsSql($dateString, $dateString, $fieldName, $timezone);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -469,8 +469,8 @@ class CakeTime {
|
|||
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#TimeHelper::isToday
|
||||
*/
|
||||
public static function isToday($dateString, $timezone = null) {
|
||||
$timestamp = self::fromString($dateString, $timezone);
|
||||
$now = self::fromString('now', $timezone);
|
||||
$timestamp = static::fromString($dateString, $timezone);
|
||||
$now = static::fromString('now', $timezone);
|
||||
return date('Y-m-d', $timestamp) === date('Y-m-d', $now);
|
||||
}
|
||||
|
||||
|
@ -483,7 +483,7 @@ class CakeTime {
|
|||
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#TimeHelper::isFuture
|
||||
*/
|
||||
public static function isFuture($dateString, $timezone = null) {
|
||||
$timestamp = self::fromString($dateString, $timezone);
|
||||
$timestamp = static::fromString($dateString, $timezone);
|
||||
return $timestamp > time();
|
||||
}
|
||||
|
||||
|
@ -496,7 +496,7 @@ class CakeTime {
|
|||
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#TimeHelper::isPast
|
||||
*/
|
||||
public static function isPast($dateString, $timezone = null) {
|
||||
$timestamp = self::fromString($dateString, $timezone);
|
||||
$timestamp = static::fromString($dateString, $timezone);
|
||||
return $timestamp < time();
|
||||
}
|
||||
|
||||
|
@ -509,8 +509,8 @@ class CakeTime {
|
|||
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#TimeHelper::isThisWeek
|
||||
*/
|
||||
public static function isThisWeek($dateString, $timezone = null) {
|
||||
$timestamp = self::fromString($dateString, $timezone);
|
||||
$now = self::fromString('now', $timezone);
|
||||
$timestamp = static::fromString($dateString, $timezone);
|
||||
$now = static::fromString('now', $timezone);
|
||||
return date('W o', $timestamp) === date('W o', $now);
|
||||
}
|
||||
|
||||
|
@ -523,8 +523,8 @@ class CakeTime {
|
|||
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#TimeHelper::isThisMonth
|
||||
*/
|
||||
public static function isThisMonth($dateString, $timezone = null) {
|
||||
$timestamp = self::fromString($dateString, $timezone);
|
||||
$now = self::fromString('now', $timezone);
|
||||
$timestamp = static::fromString($dateString, $timezone);
|
||||
$now = static::fromString('now', $timezone);
|
||||
return date('m Y', $timestamp) === date('m Y', $now);
|
||||
}
|
||||
|
||||
|
@ -537,8 +537,8 @@ class CakeTime {
|
|||
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#TimeHelper::isThisYear
|
||||
*/
|
||||
public static function isThisYear($dateString, $timezone = null) {
|
||||
$timestamp = self::fromString($dateString, $timezone);
|
||||
$now = self::fromString('now', $timezone);
|
||||
$timestamp = static::fromString($dateString, $timezone);
|
||||
$now = static::fromString('now', $timezone);
|
||||
return date('Y', $timestamp) === date('Y', $now);
|
||||
}
|
||||
|
||||
|
@ -551,8 +551,8 @@ class CakeTime {
|
|||
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#TimeHelper::wasYesterday
|
||||
*/
|
||||
public static function wasYesterday($dateString, $timezone = null) {
|
||||
$timestamp = self::fromString($dateString, $timezone);
|
||||
$yesterday = self::fromString('yesterday', $timezone);
|
||||
$timestamp = static::fromString($dateString, $timezone);
|
||||
$yesterday = static::fromString('yesterday', $timezone);
|
||||
return date('Y-m-d', $timestamp) === date('Y-m-d', $yesterday);
|
||||
}
|
||||
|
||||
|
@ -565,8 +565,8 @@ class CakeTime {
|
|||
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#TimeHelper::isTomorrow
|
||||
*/
|
||||
public static function isTomorrow($dateString, $timezone = null) {
|
||||
$timestamp = self::fromString($dateString, $timezone);
|
||||
$tomorrow = self::fromString('tomorrow', $timezone);
|
||||
$timestamp = static::fromString($dateString, $timezone);
|
||||
$tomorrow = static::fromString('tomorrow', $timezone);
|
||||
return date('Y-m-d', $timestamp) === date('Y-m-d', $tomorrow);
|
||||
}
|
||||
|
||||
|
@ -579,7 +579,7 @@ class CakeTime {
|
|||
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#TimeHelper::toQuarter
|
||||
*/
|
||||
public static function toQuarter($dateString, $range = false) {
|
||||
$time = self::fromString($dateString);
|
||||
$time = static::fromString($dateString);
|
||||
$date = (int)ceil(date('m', $time) / 3);
|
||||
if ($range === false) {
|
||||
return $date;
|
||||
|
@ -607,7 +607,7 @@ class CakeTime {
|
|||
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#TimeHelper::toUnix
|
||||
*/
|
||||
public static function toUnix($dateString, $timezone = null) {
|
||||
return self::fromString($dateString, $timezone);
|
||||
return static::fromString($dateString, $timezone);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -658,7 +658,7 @@ class CakeTime {
|
|||
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#TimeHelper::toAtom
|
||||
*/
|
||||
public static function toAtom($dateString, $timezone = null) {
|
||||
return date('Y-m-d\TH:i:s\Z', self::fromString($dateString, $timezone));
|
||||
return date('Y-m-d\TH:i:s\Z', static::fromString($dateString, $timezone));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -670,7 +670,7 @@ class CakeTime {
|
|||
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#TimeHelper::toRSS
|
||||
*/
|
||||
public static function toRSS($dateString, $timezone = null) {
|
||||
$date = self::fromString($dateString, $timezone);
|
||||
$date = static::fromString($dateString, $timezone);
|
||||
|
||||
if ($timezone === null) {
|
||||
return date("r", $date);
|
||||
|
@ -737,9 +737,9 @@ class CakeTime {
|
|||
*/
|
||||
public static function timeAgoInWords($dateTime, $options = array()) {
|
||||
$timezone = null;
|
||||
$accuracies = self::$wordAccuracy;
|
||||
$format = self::$wordFormat;
|
||||
$relativeEnd = self::$wordEnd;
|
||||
$accuracies = static::$wordAccuracy;
|
||||
$format = static::$wordFormat;
|
||||
$relativeEnd = static::$wordEnd;
|
||||
$relativeStringPast = __d('cake', '%s ago');
|
||||
$relativeStringFuture = __d('cake', 'in %s');
|
||||
$absoluteString = __d('cake', 'on %s');
|
||||
|
@ -784,8 +784,8 @@ class CakeTime {
|
|||
unset($options['end'], $options['format']);
|
||||
}
|
||||
|
||||
$now = self::fromString(time(), $timezone);
|
||||
$inSeconds = self::fromString($dateTime, $timezone);
|
||||
$now = static::fromString(time(), $timezone);
|
||||
$inSeconds = static::fromString($dateTime, $timezone);
|
||||
$isFuture = ($inSeconds > $now);
|
||||
|
||||
if ($isFuture) {
|
||||
|
@ -801,12 +801,12 @@ class CakeTime {
|
|||
return __d('cake', 'just now', 'just now');
|
||||
}
|
||||
|
||||
$isAbsoluteDate = $diff > abs($now - self::fromString($relativeEnd));
|
||||
$isAbsoluteDate = $diff > abs($now - static::fromString($relativeEnd));
|
||||
if ($isAbsoluteDate) {
|
||||
if (strpos($format, '%') === false) {
|
||||
$date = date($format, $inSeconds);
|
||||
} else {
|
||||
$date = self::_strftime($format, $inSeconds);
|
||||
$date = static::_strftime($format, $inSeconds);
|
||||
}
|
||||
return sprintf($absoluteString, $date);
|
||||
}
|
||||
|
@ -958,9 +958,9 @@ class CakeTime {
|
|||
$timeInterval = $tmp . ' ' . __d('cake', 'days');
|
||||
}
|
||||
|
||||
$date = self::fromString($dateString, $timezone);
|
||||
$interval = self::fromString('-' . $timeInterval);
|
||||
$now = self::fromString('now', $timezone);
|
||||
$date = static::fromString($dateString, $timezone);
|
||||
$interval = static::fromString('-' . $timeInterval);
|
||||
$now = static::fromString('now', $timezone);
|
||||
|
||||
return $date >= $interval && $date <= $now;
|
||||
}
|
||||
|
@ -980,9 +980,9 @@ class CakeTime {
|
|||
$timeInterval = $tmp . ' ' . __d('cake', 'days');
|
||||
}
|
||||
|
||||
$date = self::fromString($dateString, $timezone);
|
||||
$interval = self::fromString('+' . $timeInterval);
|
||||
$now = self::fromString('now', $timezone);
|
||||
$date = static::fromString($dateString, $timezone);
|
||||
$interval = static::fromString('+' . $timeInterval);
|
||||
$now = static::fromString('now', $timezone);
|
||||
|
||||
return $date <= $interval && $date >= $now;
|
||||
}
|
||||
|
@ -997,7 +997,7 @@ class CakeTime {
|
|||
public static function gmt($dateString = null) {
|
||||
$time = time();
|
||||
if ($dateString) {
|
||||
$time = self::fromString($dateString);
|
||||
$time = static::fromString($dateString);
|
||||
}
|
||||
return gmmktime(
|
||||
(int)date('G', $time),
|
||||
|
@ -1035,10 +1035,10 @@ class CakeTime {
|
|||
*/
|
||||
public static function format($date, $format = null, $default = false, $timezone = null) {
|
||||
//Backwards compatible params re-order test
|
||||
$time = self::fromString($format, $timezone);
|
||||
$time = static::fromString($format, $timezone);
|
||||
|
||||
if ($time === false) {
|
||||
return self::i18nFormat($date, $format, $default, $timezone);
|
||||
return static::i18nFormat($date, $format, $default, $timezone);
|
||||
}
|
||||
return date($date, $time);
|
||||
}
|
||||
|
@ -1055,7 +1055,7 @@ class CakeTime {
|
|||
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#TimeHelper::i18nFormat
|
||||
*/
|
||||
public static function i18nFormat($date, $format = null, $default = false, $timezone = null) {
|
||||
$date = self::fromString($date, $timezone);
|
||||
$date = static::fromString($date, $timezone);
|
||||
if ($date === false && $default !== false) {
|
||||
return $default;
|
||||
}
|
||||
|
@ -1065,7 +1065,7 @@ class CakeTime {
|
|||
if (empty($format)) {
|
||||
$format = '%x';
|
||||
}
|
||||
return self::_strftime(self::convertSpecifiers($format, $date), $date);
|
||||
return static::_strftime(static::convertSpecifiers($format, $date), $date);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -174,7 +174,7 @@ class Debugger {
|
|||
* @link http://book.cakephp.org/2.0/en/development/debugging.html#Debugger::dump
|
||||
*/
|
||||
public static function dump($var, $depth = 3) {
|
||||
pr(self::exportVar($var, $depth));
|
||||
pr(static::exportVar($var, $depth));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -188,8 +188,8 @@ class Debugger {
|
|||
* @link http://book.cakephp.org/2.0/en/development/debugging.html#Debugger::log
|
||||
*/
|
||||
public static function log($var, $level = LOG_DEBUG, $depth = 3) {
|
||||
$source = self::trace(array('start' => 1)) . "\n";
|
||||
CakeLog::write($level, "\n" . $source . self::exportVar($var, $depth));
|
||||
$source = static::trace(array('start' => 1)) . "\n";
|
||||
CakeLog::write($level, "\n" . $source . static::exportVar($var, $depth));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -334,7 +334,7 @@ class Debugger {
|
|||
} else {
|
||||
$tpl = $self->_templates['base']['traceLine'];
|
||||
}
|
||||
$trace['path'] = self::trimPath($trace['file']);
|
||||
$trace['path'] = static::trimPath($trace['file']);
|
||||
$trace['reference'] = $reference;
|
||||
unset($trace['object'], $trace['args']);
|
||||
$back[] = CakeText::insert($tpl, $trace, array('before' => '{:', 'after' => '}'));
|
||||
|
@ -408,7 +408,7 @@ class Debugger {
|
|||
if (!isset($data[$i])) {
|
||||
continue;
|
||||
}
|
||||
$string = str_replace(array("\r\n", "\n"), "", self::_highlight($data[$i]));
|
||||
$string = str_replace(array("\r\n", "\n"), "", static::_highlight($data[$i]));
|
||||
if ($i == $line) {
|
||||
$lines[] = '<span class="code-highlight">' . $string . '</span>';
|
||||
} else {
|
||||
|
@ -468,7 +468,7 @@ class Debugger {
|
|||
* @link http://book.cakephp.org/2.0/en/development/debugging.html#Debugger::exportVar
|
||||
*/
|
||||
public static function exportVar($var, $depth = 3) {
|
||||
return self::_export($var, $depth, 0);
|
||||
return static::_export($var, $depth, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -480,7 +480,7 @@ class Debugger {
|
|||
* @return string The dumped variable.
|
||||
*/
|
||||
protected static function _export($var, $depth, $indent) {
|
||||
switch (self::getType($var)) {
|
||||
switch (static::getType($var)) {
|
||||
case 'boolean':
|
||||
return ($var) ? 'true' : 'false';
|
||||
case 'integer':
|
||||
|
@ -493,7 +493,7 @@ class Debugger {
|
|||
}
|
||||
return "'" . $var . "'";
|
||||
case 'array':
|
||||
return self::_array($var, $depth - 1, $indent + 1);
|
||||
return static::_array($var, $depth - 1, $indent + 1);
|
||||
case 'resource':
|
||||
return strtolower(gettype($var));
|
||||
case 'null':
|
||||
|
@ -501,7 +501,7 @@ class Debugger {
|
|||
case 'unknown':
|
||||
return 'unknown';
|
||||
default:
|
||||
return self::_object($var, $depth - 1, $indent + 1);
|
||||
return static::_object($var, $depth - 1, $indent + 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -550,9 +550,9 @@ class Debugger {
|
|||
if ($key === 'GLOBALS' && is_array($val) && isset($val['GLOBALS'])) {
|
||||
$val = '[recursion]';
|
||||
} elseif ($val !== $var) {
|
||||
$val = self::_export($val, $depth, $indent);
|
||||
$val = static::_export($val, $depth, $indent);
|
||||
}
|
||||
$vars[] = $break . self::exportVar($key) .
|
||||
$vars[] = $break . static::exportVar($key) .
|
||||
' => ' .
|
||||
$val;
|
||||
}
|
||||
|
@ -583,7 +583,7 @@ class Debugger {
|
|||
$break = "\n" . str_repeat("\t", $indent);
|
||||
$objectVars = get_object_vars($var);
|
||||
foreach ($objectVars as $key => $value) {
|
||||
$value = self::_export($value, $depth - 1, $indent);
|
||||
$value = static::_export($value, $depth - 1, $indent);
|
||||
$props[] = "$key => " . $value;
|
||||
}
|
||||
|
||||
|
@ -600,7 +600,7 @@ class Debugger {
|
|||
$reflectionProperty->setAccessible(true);
|
||||
$property = $reflectionProperty->getValue($var);
|
||||
|
||||
$value = self::_export($property, $depth - 1, $indent);
|
||||
$value = static::_export($property, $depth - 1, $indent);
|
||||
$key = $reflectionProperty->name;
|
||||
$props[] = sprintf('[%s] %s => %s', $visibility, $key, $value);
|
||||
}
|
||||
|
|
|
@ -285,7 +285,7 @@ class Folder {
|
|||
return $path[0] === '/' ||
|
||||
preg_match('/^[A-Z]:\\\\/i', $path) ||
|
||||
substr($path, 0, 2) === '\\\\' ||
|
||||
self::isRegisteredStreamWrapper($path);
|
||||
static::isRegisteredStreamWrapper($path);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -525,8 +525,8 @@ class Folder {
|
|||
return true;
|
||||
}
|
||||
|
||||
if (!self::isAbsolute($pathname)) {
|
||||
$pathname = self::addPathElement($this->pwd(), $pathname);
|
||||
if (!static::isAbsolute($pathname)) {
|
||||
$pathname = static::addPathElement($this->pwd(), $pathname);
|
||||
}
|
||||
|
||||
if (!$mode) {
|
||||
|
|
|
@ -106,7 +106,7 @@ class Hash {
|
|||
|
||||
// Simple paths.
|
||||
if (!preg_match('/[{\[]/', $path)) {
|
||||
return (array)self::get($data, $path);
|
||||
return (array)static::get($data, $path);
|
||||
}
|
||||
|
||||
if (strpos($path, '[') === false) {
|
||||
|
@ -122,11 +122,11 @@ class Hash {
|
|||
foreach ($tokens as $token) {
|
||||
$next = array();
|
||||
|
||||
list($token, $conditions) = self::_splitConditions($token);
|
||||
list($token, $conditions) = static::_splitConditions($token);
|
||||
|
||||
foreach ($context[$_key] as $item) {
|
||||
foreach ((array)$item as $k => $v) {
|
||||
if (self::_matchToken($k, $token)) {
|
||||
if (static::_matchToken($k, $token)) {
|
||||
$next[] = $v;
|
||||
}
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ class Hash {
|
|||
if ($conditions) {
|
||||
$filter = array();
|
||||
foreach ($next as $item) {
|
||||
if (is_array($item) && self::_matches($item, $conditions)) {
|
||||
if (is_array($item) && static::_matches($item, $conditions)) {
|
||||
$filter[] = $item;
|
||||
}
|
||||
}
|
||||
|
@ -262,22 +262,22 @@ class Hash {
|
|||
}
|
||||
|
||||
if (strpos($path, '{') === false && strpos($path, '[') === false) {
|
||||
return self::_simpleOp('insert', $data, $tokens, $values);
|
||||
return static::_simpleOp('insert', $data, $tokens, $values);
|
||||
}
|
||||
|
||||
$token = array_shift($tokens);
|
||||
$nextPath = implode('.', $tokens);
|
||||
|
||||
list($token, $conditions) = self::_splitConditions($token);
|
||||
list($token, $conditions) = static::_splitConditions($token);
|
||||
|
||||
foreach ($data as $k => $v) {
|
||||
if (self::_matchToken($k, $token)) {
|
||||
if ($conditions && self::_matches($v, $conditions)) {
|
||||
if (static::_matchToken($k, $token)) {
|
||||
if ($conditions && static::_matches($v, $conditions)) {
|
||||
$data[$k] = array_merge($v, $values);
|
||||
continue;
|
||||
}
|
||||
if (!$conditions) {
|
||||
$data[$k] = self::insert($v, $nextPath, $values);
|
||||
$data[$k] = static::insert($v, $nextPath, $values);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -345,22 +345,22 @@ class Hash {
|
|||
}
|
||||
|
||||
if (strpos($path, '{') === false && strpos($path, '[') === false) {
|
||||
return self::_simpleOp('remove', $data, $tokens);
|
||||
return static::_simpleOp('remove', $data, $tokens);
|
||||
}
|
||||
|
||||
$token = array_shift($tokens);
|
||||
$nextPath = implode('.', $tokens);
|
||||
|
||||
list($token, $conditions) = self::_splitConditions($token);
|
||||
list($token, $conditions) = static::_splitConditions($token);
|
||||
|
||||
foreach ($data as $k => $v) {
|
||||
$match = self::_matchToken($k, $token);
|
||||
$match = static::_matchToken($k, $token);
|
||||
if ($match && is_array($v)) {
|
||||
if ($conditions && self::_matches($v, $conditions)) {
|
||||
if ($conditions && static::_matches($v, $conditions)) {
|
||||
unset($data[$k]);
|
||||
continue;
|
||||
}
|
||||
$data[$k] = self::remove($v, $nextPath);
|
||||
$data[$k] = static::remove($v, $nextPath);
|
||||
if (empty($data[$k])) {
|
||||
unset($data[$k]);
|
||||
}
|
||||
|
@ -392,9 +392,9 @@ class Hash {
|
|||
|
||||
if (is_array($keyPath)) {
|
||||
$format = array_shift($keyPath);
|
||||
$keys = self::format($data, $keyPath, $format);
|
||||
$keys = static::format($data, $keyPath, $format);
|
||||
} else {
|
||||
$keys = self::extract($data, $keyPath);
|
||||
$keys = static::extract($data, $keyPath);
|
||||
}
|
||||
if (empty($keys)) {
|
||||
return array();
|
||||
|
@ -402,9 +402,9 @@ class Hash {
|
|||
|
||||
if (!empty($valuePath) && is_array($valuePath)) {
|
||||
$format = array_shift($valuePath);
|
||||
$vals = self::format($data, $valuePath, $format);
|
||||
$vals = static::format($data, $valuePath, $format);
|
||||
} elseif (!empty($valuePath)) {
|
||||
$vals = self::extract($data, $valuePath);
|
||||
$vals = static::extract($data, $valuePath);
|
||||
}
|
||||
if (empty($vals)) {
|
||||
$vals = array_fill(0, count($keys), null);
|
||||
|
@ -418,7 +418,7 @@ class Hash {
|
|||
}
|
||||
|
||||
if ($groupPath !== null) {
|
||||
$group = self::extract($data, $groupPath);
|
||||
$group = static::extract($data, $groupPath);
|
||||
if (!empty($group)) {
|
||||
$c = count($keys);
|
||||
for ($i = 0; $i < $c; $i++) {
|
||||
|
@ -469,7 +469,7 @@ class Hash {
|
|||
}
|
||||
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
$extracted[] = self::extract($data, $paths[$i]);
|
||||
$extracted[] = static::extract($data, $paths[$i]);
|
||||
}
|
||||
$out = array();
|
||||
$data = $extracted;
|
||||
|
@ -539,7 +539,7 @@ class Hash {
|
|||
* @link http://book.cakephp.org/2.0/en/core-utility-libraries/hash.html#Hash::check
|
||||
*/
|
||||
public static function check(array $data, $path) {
|
||||
$results = self::extract($data, $path);
|
||||
$results = static::extract($data, $path);
|
||||
if (!is_array($results)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -551,14 +551,14 @@ class Hash {
|
|||
*
|
||||
* @param array $data Either an array to filter, or value when in callback
|
||||
* @param callable $callback A function to filter the data with. Defaults to
|
||||
* `self::_filter()` Which strips out all non-zero empty values.
|
||||
* `static::_filter()` Which strips out all non-zero empty values.
|
||||
* @return array Filtered array
|
||||
* @link http://book.cakephp.org/2.0/en/core-utility-libraries/hash.html#Hash::filter
|
||||
*/
|
||||
public static function filter(array $data, $callback = array('self', '_filter')) {
|
||||
foreach ($data as $k => $v) {
|
||||
if (is_array($v)) {
|
||||
$data[$k] = self::filter($v, $callback);
|
||||
$data[$k] = static::filter($v, $callback);
|
||||
}
|
||||
}
|
||||
return array_filter($data, $callback);
|
||||
|
@ -781,7 +781,7 @@ class Hash {
|
|||
* @link http://book.cakephp.org/2.0/en/core-utility-libraries/hash.html#Hash::map
|
||||
*/
|
||||
public static function map(array $data, $path, $function) {
|
||||
$values = (array)self::extract($data, $path);
|
||||
$values = (array)static::extract($data, $path);
|
||||
return array_map($function, $values);
|
||||
}
|
||||
|
||||
|
@ -795,7 +795,7 @@ class Hash {
|
|||
* @link http://book.cakephp.org/2.0/en/core-utility-libraries/hash.html#Hash::reduce
|
||||
*/
|
||||
public static function reduce(array $data, $path, $function) {
|
||||
$values = (array)self::extract($data, $path);
|
||||
$values = (array)static::extract($data, $path);
|
||||
return array_reduce($values, $function);
|
||||
}
|
||||
|
||||
|
@ -820,7 +820,7 @@ class Hash {
|
|||
* @return mixed The results of the applied method.
|
||||
*/
|
||||
public static function apply(array $data, $path, $function) {
|
||||
$values = (array)self::extract($data, $path);
|
||||
$values = (array)static::extract($data, $path);
|
||||
return call_user_func($function, $values);
|
||||
}
|
||||
|
||||
|
@ -856,7 +856,7 @@ class Hash {
|
|||
if ($numeric) {
|
||||
$data = array_values($data);
|
||||
}
|
||||
$sortValues = self::extract($data, $path);
|
||||
$sortValues = static::extract($data, $path);
|
||||
$sortCount = count($sortValues);
|
||||
$dataCount = count($data);
|
||||
|
||||
|
@ -865,9 +865,9 @@ class Hash {
|
|||
if ($sortCount < $dataCount) {
|
||||
$sortValues = array_pad($sortValues, $dataCount, null);
|
||||
}
|
||||
$result = self::_squash($sortValues);
|
||||
$keys = self::extract($result, '{n}.id');
|
||||
$values = self::extract($result, '{n}.value');
|
||||
$result = static::_squash($sortValues);
|
||||
$keys = static::extract($result, '{n}.id');
|
||||
$values = static::extract($result, '{n}.value');
|
||||
|
||||
$dir = strtolower($dir);
|
||||
$type = strtolower($type);
|
||||
|
@ -922,7 +922,7 @@ class Hash {
|
|||
$id = $key;
|
||||
}
|
||||
if (is_array($r) && !empty($r)) {
|
||||
$stack = array_merge($stack, self::_squash($r, $id));
|
||||
$stack = array_merge($stack, static::_squash($r, $id));
|
||||
} else {
|
||||
$stack[] = array('id' => $id, 'value' => $r);
|
||||
}
|
||||
|
@ -978,7 +978,7 @@ class Hash {
|
|||
if (!array_key_exists($key, $data)) {
|
||||
$data[$key] = $value;
|
||||
} elseif (is_array($value)) {
|
||||
$data[$key] = self::mergeDiff($data[$key], $compare[$key]);
|
||||
$data[$key] = static::mergeDiff($data[$key], $compare[$key]);
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
|
@ -1052,7 +1052,7 @@ class Hash {
|
|||
);
|
||||
|
||||
$return = $idMap = array();
|
||||
$ids = self::extract($data, $options['idPath']);
|
||||
$ids = static::extract($data, $options['idPath']);
|
||||
|
||||
$idKeys = explode('.', $options['idPath']);
|
||||
array_shift($idKeys);
|
||||
|
@ -1063,8 +1063,8 @@ class Hash {
|
|||
foreach ($data as $result) {
|
||||
$result[$options['children']] = array();
|
||||
|
||||
$id = self::get($result, $idKeys);
|
||||
$parentId = self::get($result, $parentKeys);
|
||||
$id = static::get($result, $idKeys);
|
||||
$parentId = static::get($result, $parentKeys);
|
||||
|
||||
if (isset($idMap[$id][$options['children']])) {
|
||||
$idMap[$id] = array_merge($result, (array)$idMap[$id]);
|
||||
|
@ -1087,12 +1087,12 @@ class Hash {
|
|||
if ($options['root']) {
|
||||
$root = $options['root'];
|
||||
} else {
|
||||
$root = self::get($return[0], $parentKeys);
|
||||
$root = static::get($return[0], $parentKeys);
|
||||
}
|
||||
|
||||
foreach ($return as $i => $result) {
|
||||
$id = self::get($result, $idKeys);
|
||||
$parentId = self::get($result, $parentKeys);
|
||||
$id = static::get($result, $idKeys);
|
||||
$parentId = static::get($result, $parentKeys);
|
||||
if ($id !== $root && $parentId != $root) {
|
||||
unset($return[$i]);
|
||||
}
|
||||
|
|
|
@ -274,13 +274,13 @@ class Inflector {
|
|||
$key = '_' . $key;
|
||||
$type = '_' . $type;
|
||||
if ($value !== false) {
|
||||
self::$_cache[$type][$key] = $value;
|
||||
static::$_cache[$type][$key] = $value;
|
||||
return $value;
|
||||
}
|
||||
if (!isset(self::$_cache[$type][$key])) {
|
||||
if (!isset(static::$_cache[$type][$key])) {
|
||||
return false;
|
||||
}
|
||||
return self::$_cache[$type][$key];
|
||||
return static::$_cache[$type][$key];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -290,13 +290,13 @@ class Inflector {
|
|||
* @return void
|
||||
*/
|
||||
public static function reset() {
|
||||
if (empty(self::$_initialState)) {
|
||||
self::$_initialState = get_class_vars('Inflector');
|
||||
if (empty(static::$_initialState)) {
|
||||
static::$_initialState = get_class_vars('Inflector');
|
||||
return;
|
||||
}
|
||||
foreach (self::$_initialState as $key => $val) {
|
||||
foreach (static::$_initialState as $key => $val) {
|
||||
if ($key !== '_initialState') {
|
||||
self::${$key} = $val;
|
||||
static::${$key} = $val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -328,9 +328,9 @@ class Inflector {
|
|||
switch ($type) {
|
||||
case 'transliteration':
|
||||
if ($reset) {
|
||||
self::$_transliteration = $rules;
|
||||
static::$_transliteration = $rules;
|
||||
} else {
|
||||
self::$_transliteration = $rules + self::$_transliteration;
|
||||
static::$_transliteration = $rules + static::$_transliteration;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -338,26 +338,26 @@ class Inflector {
|
|||
foreach ($rules as $rule => $pattern) {
|
||||
if (is_array($pattern)) {
|
||||
if ($reset) {
|
||||
self::${$var}[$rule] = $pattern;
|
||||
static::${$var}[$rule] = $pattern;
|
||||
} else {
|
||||
if ($rule === 'uninflected') {
|
||||
self::${$var}[$rule] = array_merge($pattern, self::${$var}[$rule]);
|
||||
static::${$var}[$rule] = array_merge($pattern, static::${$var}[$rule]);
|
||||
} else {
|
||||
self::${$var}[$rule] = $pattern + self::${$var}[$rule];
|
||||
static::${$var}[$rule] = $pattern + static::${$var}[$rule];
|
||||
}
|
||||
}
|
||||
unset($rules[$rule], self::${$var}['cache' . ucfirst($rule)]);
|
||||
if (isset(self::${$var}['merged'][$rule])) {
|
||||
unset(self::${$var}['merged'][$rule]);
|
||||
unset($rules[$rule], static::${$var}['cache' . ucfirst($rule)]);
|
||||
if (isset(static::${$var}['merged'][$rule])) {
|
||||
unset(static::${$var}['merged'][$rule]);
|
||||
}
|
||||
if ($type === 'plural') {
|
||||
self::$_cache['pluralize'] = self::$_cache['tableize'] = array();
|
||||
static::$_cache['pluralize'] = static::$_cache['tableize'] = array();
|
||||
} elseif ($type === 'singular') {
|
||||
self::$_cache['singularize'] = array();
|
||||
static::$_cache['singularize'] = array();
|
||||
}
|
||||
}
|
||||
}
|
||||
self::${$var}['rules'] = $rules + self::${$var}['rules'];
|
||||
static::${$var}['rules'] = $rules + static::${$var}['rules'];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -369,39 +369,39 @@ class Inflector {
|
|||
* @link http://book.cakephp.org/2.0/en/core-utility-libraries/inflector.html#Inflector::pluralize
|
||||
*/
|
||||
public static function pluralize($word) {
|
||||
if (isset(self::$_cache['pluralize'][$word])) {
|
||||
return self::$_cache['pluralize'][$word];
|
||||
if (isset(static::$_cache['pluralize'][$word])) {
|
||||
return static::$_cache['pluralize'][$word];
|
||||
}
|
||||
|
||||
if (!isset(self::$_plural['merged']['irregular'])) {
|
||||
self::$_plural['merged']['irregular'] = self::$_plural['irregular'];
|
||||
if (!isset(static::$_plural['merged']['irregular'])) {
|
||||
static::$_plural['merged']['irregular'] = static::$_plural['irregular'];
|
||||
}
|
||||
|
||||
if (!isset(self::$_plural['merged']['uninflected'])) {
|
||||
self::$_plural['merged']['uninflected'] = array_merge(self::$_plural['uninflected'], self::$_uninflected);
|
||||
if (!isset(static::$_plural['merged']['uninflected'])) {
|
||||
static::$_plural['merged']['uninflected'] = array_merge(static::$_plural['uninflected'], static::$_uninflected);
|
||||
}
|
||||
|
||||
if (!isset(self::$_plural['cacheUninflected']) || !isset(self::$_plural['cacheIrregular'])) {
|
||||
self::$_plural['cacheUninflected'] = '(?:' . implode('|', self::$_plural['merged']['uninflected']) . ')';
|
||||
self::$_plural['cacheIrregular'] = '(?:' . implode('|', array_keys(self::$_plural['merged']['irregular'])) . ')';
|
||||
if (!isset(static::$_plural['cacheUninflected']) || !isset(static::$_plural['cacheIrregular'])) {
|
||||
static::$_plural['cacheUninflected'] = '(?:' . implode('|', static::$_plural['merged']['uninflected']) . ')';
|
||||
static::$_plural['cacheIrregular'] = '(?:' . implode('|', array_keys(static::$_plural['merged']['irregular'])) . ')';
|
||||
}
|
||||
|
||||
if (preg_match('/(.*?(?:\\b|_))(' . self::$_plural['cacheIrregular'] . ')$/i', $word, $regs)) {
|
||||
self::$_cache['pluralize'][$word] = $regs[1] .
|
||||
if (preg_match('/(.*?(?:\\b|_))(' . static::$_plural['cacheIrregular'] . ')$/i', $word, $regs)) {
|
||||
static::$_cache['pluralize'][$word] = $regs[1] .
|
||||
substr($regs[2], 0, 1) .
|
||||
substr(self::$_plural['merged']['irregular'][strtolower($regs[2])], 1);
|
||||
return self::$_cache['pluralize'][$word];
|
||||
substr(static::$_plural['merged']['irregular'][strtolower($regs[2])], 1);
|
||||
return static::$_cache['pluralize'][$word];
|
||||
}
|
||||
|
||||
if (preg_match('/^(' . self::$_plural['cacheUninflected'] . ')$/i', $word, $regs)) {
|
||||
self::$_cache['pluralize'][$word] = $word;
|
||||
if (preg_match('/^(' . static::$_plural['cacheUninflected'] . ')$/i', $word, $regs)) {
|
||||
static::$_cache['pluralize'][$word] = $word;
|
||||
return $word;
|
||||
}
|
||||
|
||||
foreach (self::$_plural['rules'] as $rule => $replacement) {
|
||||
foreach (static::$_plural['rules'] as $rule => $replacement) {
|
||||
if (preg_match($rule, $word)) {
|
||||
self::$_cache['pluralize'][$word] = preg_replace($rule, $replacement, $word);
|
||||
return self::$_cache['pluralize'][$word];
|
||||
static::$_cache['pluralize'][$word] = preg_replace($rule, $replacement, $word);
|
||||
return static::$_cache['pluralize'][$word];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -414,48 +414,48 @@ class Inflector {
|
|||
* @link http://book.cakephp.org/2.0/en/core-utility-libraries/inflector.html#Inflector::singularize
|
||||
*/
|
||||
public static function singularize($word) {
|
||||
if (isset(self::$_cache['singularize'][$word])) {
|
||||
return self::$_cache['singularize'][$word];
|
||||
if (isset(static::$_cache['singularize'][$word])) {
|
||||
return static::$_cache['singularize'][$word];
|
||||
}
|
||||
|
||||
if (!isset(self::$_singular['merged']['uninflected'])) {
|
||||
self::$_singular['merged']['uninflected'] = array_merge(
|
||||
self::$_singular['uninflected'],
|
||||
self::$_uninflected
|
||||
if (!isset(static::$_singular['merged']['uninflected'])) {
|
||||
static::$_singular['merged']['uninflected'] = array_merge(
|
||||
static::$_singular['uninflected'],
|
||||
static::$_uninflected
|
||||
);
|
||||
}
|
||||
|
||||
if (!isset(self::$_singular['merged']['irregular'])) {
|
||||
self::$_singular['merged']['irregular'] = array_merge(
|
||||
self::$_singular['irregular'],
|
||||
array_flip(self::$_plural['irregular'])
|
||||
if (!isset(static::$_singular['merged']['irregular'])) {
|
||||
static::$_singular['merged']['irregular'] = array_merge(
|
||||
static::$_singular['irregular'],
|
||||
array_flip(static::$_plural['irregular'])
|
||||
);
|
||||
}
|
||||
|
||||
if (!isset(self::$_singular['cacheUninflected']) || !isset(self::$_singular['cacheIrregular'])) {
|
||||
self::$_singular['cacheUninflected'] = '(?:' . implode('|', self::$_singular['merged']['uninflected']) . ')';
|
||||
self::$_singular['cacheIrregular'] = '(?:' . implode('|', array_keys(self::$_singular['merged']['irregular'])) . ')';
|
||||
if (!isset(static::$_singular['cacheUninflected']) || !isset(static::$_singular['cacheIrregular'])) {
|
||||
static::$_singular['cacheUninflected'] = '(?:' . implode('|', static::$_singular['merged']['uninflected']) . ')';
|
||||
static::$_singular['cacheIrregular'] = '(?:' . implode('|', array_keys(static::$_singular['merged']['irregular'])) . ')';
|
||||
}
|
||||
|
||||
if (preg_match('/(.*?(?:\\b|_))(' . self::$_singular['cacheIrregular'] . ')$/i', $word, $regs)) {
|
||||
self::$_cache['singularize'][$word] = $regs[1] .
|
||||
if (preg_match('/(.*?(?:\\b|_))(' . static::$_singular['cacheIrregular'] . ')$/i', $word, $regs)) {
|
||||
static::$_cache['singularize'][$word] = $regs[1] .
|
||||
substr($regs[2], 0, 1) .
|
||||
substr(self::$_singular['merged']['irregular'][strtolower($regs[2])], 1);
|
||||
return self::$_cache['singularize'][$word];
|
||||
substr(static::$_singular['merged']['irregular'][strtolower($regs[2])], 1);
|
||||
return static::$_cache['singularize'][$word];
|
||||
}
|
||||
|
||||
if (preg_match('/^(' . self::$_singular['cacheUninflected'] . ')$/i', $word, $regs)) {
|
||||
self::$_cache['singularize'][$word] = $word;
|
||||
if (preg_match('/^(' . static::$_singular['cacheUninflected'] . ')$/i', $word, $regs)) {
|
||||
static::$_cache['singularize'][$word] = $word;
|
||||
return $word;
|
||||
}
|
||||
|
||||
foreach (self::$_singular['rules'] as $rule => $replacement) {
|
||||
foreach (static::$_singular['rules'] as $rule => $replacement) {
|
||||
if (preg_match($rule, $word)) {
|
||||
self::$_cache['singularize'][$word] = preg_replace($rule, $replacement, $word);
|
||||
return self::$_cache['singularize'][$word];
|
||||
static::$_cache['singularize'][$word] = preg_replace($rule, $replacement, $word);
|
||||
return static::$_cache['singularize'][$word];
|
||||
}
|
||||
}
|
||||
self::$_cache['singularize'][$word] = $word;
|
||||
static::$_cache['singularize'][$word] = $word;
|
||||
return $word;
|
||||
}
|
||||
|
||||
|
@ -467,9 +467,9 @@ class Inflector {
|
|||
* @link http://book.cakephp.org/2.0/en/core-utility-libraries/inflector.html#Inflector::camelize
|
||||
*/
|
||||
public static function camelize($lowerCaseAndUnderscoredWord) {
|
||||
if (!($result = self::_cache(__FUNCTION__, $lowerCaseAndUnderscoredWord))) {
|
||||
if (!($result = static::_cache(__FUNCTION__, $lowerCaseAndUnderscoredWord))) {
|
||||
$result = str_replace(' ', '', Inflector::humanize($lowerCaseAndUnderscoredWord));
|
||||
self::_cache(__FUNCTION__, $lowerCaseAndUnderscoredWord, $result);
|
||||
static::_cache(__FUNCTION__, $lowerCaseAndUnderscoredWord, $result);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
@ -482,10 +482,10 @@ class Inflector {
|
|||
* @link http://book.cakephp.org/2.0/en/core-utility-libraries/inflector.html#Inflector::underscore
|
||||
*/
|
||||
public static function underscore($camelCasedWord) {
|
||||
if (!($result = self::_cache(__FUNCTION__, $camelCasedWord))) {
|
||||
if (!($result = static::_cache(__FUNCTION__, $camelCasedWord))) {
|
||||
$underscoredWord = preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $camelCasedWord);
|
||||
$result = mb_strtolower($underscoredWord);
|
||||
self::_cache(__FUNCTION__, $camelCasedWord, $result);
|
||||
static::_cache(__FUNCTION__, $camelCasedWord, $result);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
@ -499,13 +499,13 @@ class Inflector {
|
|||
* @link http://book.cakephp.org/2.0/en/core-utility-libraries/inflector.html#Inflector::humanize
|
||||
*/
|
||||
public static function humanize($lowerCaseAndUnderscoredWord) {
|
||||
if (!($result = self::_cache(__FUNCTION__, $lowerCaseAndUnderscoredWord))) {
|
||||
if (!($result = static::_cache(__FUNCTION__, $lowerCaseAndUnderscoredWord))) {
|
||||
$result = explode(' ', str_replace('_', ' ', $lowerCaseAndUnderscoredWord));
|
||||
foreach ($result as &$word) {
|
||||
$word = mb_strtoupper(mb_substr($word, 0, 1)) . mb_substr($word, 1);
|
||||
}
|
||||
$result = implode(' ', $result);
|
||||
self::_cache(__FUNCTION__, $lowerCaseAndUnderscoredWord, $result);
|
||||
static::_cache(__FUNCTION__, $lowerCaseAndUnderscoredWord, $result);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
@ -518,9 +518,9 @@ class Inflector {
|
|||
* @link http://book.cakephp.org/2.0/en/core-utility-libraries/inflector.html#Inflector::tableize
|
||||
*/
|
||||
public static function tableize($className) {
|
||||
if (!($result = self::_cache(__FUNCTION__, $className))) {
|
||||
if (!($result = static::_cache(__FUNCTION__, $className))) {
|
||||
$result = Inflector::pluralize(Inflector::underscore($className));
|
||||
self::_cache(__FUNCTION__, $className, $result);
|
||||
static::_cache(__FUNCTION__, $className, $result);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
@ -533,9 +533,9 @@ class Inflector {
|
|||
* @link http://book.cakephp.org/2.0/en/core-utility-libraries/inflector.html#Inflector::classify
|
||||
*/
|
||||
public static function classify($tableName) {
|
||||
if (!($result = self::_cache(__FUNCTION__, $tableName))) {
|
||||
if (!($result = static::_cache(__FUNCTION__, $tableName))) {
|
||||
$result = Inflector::camelize(Inflector::singularize($tableName));
|
||||
self::_cache(__FUNCTION__, $tableName, $result);
|
||||
static::_cache(__FUNCTION__, $tableName, $result);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
@ -548,11 +548,11 @@ class Inflector {
|
|||
* @link http://book.cakephp.org/2.0/en/core-utility-libraries/inflector.html#Inflector::variable
|
||||
*/
|
||||
public static function variable($string) {
|
||||
if (!($result = self::_cache(__FUNCTION__, $string))) {
|
||||
if (!($result = static::_cache(__FUNCTION__, $string))) {
|
||||
$camelized = Inflector::camelize(Inflector::underscore($string));
|
||||
$replace = strtolower(substr($camelized, 0, 1));
|
||||
$result = preg_replace('/\\w/', $replace, $camelized, 1);
|
||||
self::_cache(__FUNCTION__, $string, $result);
|
||||
static::_cache(__FUNCTION__, $string, $result);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
@ -575,7 +575,7 @@ class Inflector {
|
|||
sprintf('/^[%s]+|[%s]+$/', $quotedReplacement, $quotedReplacement) => '',
|
||||
);
|
||||
|
||||
$map = self::$_transliteration + $merge;
|
||||
$map = static::$_transliteration + $merge;
|
||||
return preg_replace(array_keys($map), array_values($map), $string);
|
||||
}
|
||||
|
||||
|
|
|
@ -105,12 +105,12 @@ class Security {
|
|||
*/
|
||||
public static function hash($string, $type = null, $salt = false) {
|
||||
if (empty($type)) {
|
||||
$type = self::$hashType;
|
||||
$type = static::$hashType;
|
||||
}
|
||||
$type = strtolower($type);
|
||||
|
||||
if ($type === 'blowfish') {
|
||||
return self::_crypt($string, $salt);
|
||||
return static::_crypt($string, $salt);
|
||||
}
|
||||
if ($salt) {
|
||||
if (!is_string($salt)) {
|
||||
|
@ -145,7 +145,7 @@ class Security {
|
|||
* @see Security::hash()
|
||||
*/
|
||||
public static function setHash($hash) {
|
||||
self::$hashType = $hash;
|
||||
static::$hashType = $hash;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -163,7 +163,7 @@ class Security {
|
|||
), E_USER_WARNING);
|
||||
return null;
|
||||
}
|
||||
self::$hashCost = $cost;
|
||||
static::$hashCost = $cost;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -273,8 +273,8 @@ class Security {
|
|||
*/
|
||||
protected static function _crypt($password, $salt = false) {
|
||||
if ($salt === false) {
|
||||
$salt = self::_salt(22);
|
||||
$salt = vsprintf('$2a$%02d$%s', array(self::$hashCost, $salt));
|
||||
$salt = static::_salt(22);
|
||||
$salt = vsprintf('$2a$%02d$%s', array(static::$hashCost, $salt));
|
||||
}
|
||||
|
||||
$invalidCipher = (
|
||||
|
@ -307,7 +307,7 @@ class Security {
|
|||
* @throws CakeException On invalid data or key.
|
||||
*/
|
||||
public static function encrypt($plain, $key, $hmacSalt = null) {
|
||||
self::_checkKey($key, 'encrypt()');
|
||||
static::_checkKey($key, 'encrypt()');
|
||||
|
||||
if ($hmacSalt === null) {
|
||||
$hmacSalt = Configure::read('Security.salt');
|
||||
|
@ -350,7 +350,7 @@ class Security {
|
|||
* @throws CakeException On invalid data or key.
|
||||
*/
|
||||
public static function decrypt($cipher, $key, $hmacSalt = null) {
|
||||
self::_checkKey($key, 'decrypt()');
|
||||
static::_checkKey($key, 'decrypt()');
|
||||
if (empty($cipher)) {
|
||||
throw new CakeException(__d('cake_dev', 'The data to decrypt cannot be empty.'));
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ class Validation {
|
|||
*/
|
||||
public static function notEmpty($check) {
|
||||
trigger_error('Validation::notEmpty() is deprecated. Use Validation::notBlank() instead.', E_USER_DEPRECATED);
|
||||
return self::notBlank($check);
|
||||
return static::notBlank($check);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -74,13 +74,13 @@ class Validation {
|
|||
*/
|
||||
public static function notBlank($check) {
|
||||
if (is_array($check)) {
|
||||
extract(self::_defaults($check));
|
||||
extract(static::_defaults($check));
|
||||
}
|
||||
|
||||
if (empty($check) && (string)$check !== '0') {
|
||||
return false;
|
||||
}
|
||||
return self::_check($check, '/[^\s]+/m');
|
||||
return static::_check($check, '/[^\s]+/m');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -96,13 +96,13 @@ class Validation {
|
|||
*/
|
||||
public static function alphaNumeric($check) {
|
||||
if (is_array($check)) {
|
||||
extract(self::_defaults($check));
|
||||
extract(static::_defaults($check));
|
||||
}
|
||||
|
||||
if (empty($check) && $check != '0') {
|
||||
return false;
|
||||
}
|
||||
return self::_check($check, '/^[\p{Ll}\p{Lm}\p{Lo}\p{Lt}\p{Lu}\p{Nd}]+$/Du');
|
||||
return static::_check($check, '/^[\p{Ll}\p{Lm}\p{Lo}\p{Lt}\p{Lu}\p{Nd}]+$/Du');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -131,7 +131,7 @@ class Validation {
|
|||
* @deprecated Deprecated 2.6. Use Validator::lengthBetween() instead.
|
||||
*/
|
||||
public static function between($check, $min, $max) {
|
||||
return self::lengthBetween($check, $min, $max);
|
||||
return static::lengthBetween($check, $min, $max);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -146,9 +146,9 @@ class Validation {
|
|||
*/
|
||||
public static function blank($check) {
|
||||
if (is_array($check)) {
|
||||
extract(self::_defaults($check));
|
||||
extract(static::_defaults($check));
|
||||
}
|
||||
return !self::_check($check, '/[^\\s]/');
|
||||
return !static::_check($check, '/[^\\s]/');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -167,7 +167,7 @@ class Validation {
|
|||
*/
|
||||
public static function cc($check, $type = 'fast', $deep = false, $regex = null) {
|
||||
if (is_array($check)) {
|
||||
extract(self::_defaults($check));
|
||||
extract(static::_defaults($check));
|
||||
}
|
||||
|
||||
$check = str_replace(array('-', ' '), '', $check);
|
||||
|
@ -176,8 +176,8 @@ class Validation {
|
|||
}
|
||||
|
||||
if ($regex !== null) {
|
||||
if (self::_check($check, $regex)) {
|
||||
return self::luhn($check, $deep);
|
||||
if (static::_check($check, $regex)) {
|
||||
return static::luhn($check, $deep);
|
||||
}
|
||||
}
|
||||
$cards = array(
|
||||
|
@ -205,23 +205,23 @@ class Validation {
|
|||
foreach ($type as $value) {
|
||||
$regex = $cards['all'][strtolower($value)];
|
||||
|
||||
if (self::_check($check, $regex)) {
|
||||
return self::luhn($check, $deep);
|
||||
if (static::_check($check, $regex)) {
|
||||
return static::luhn($check, $deep);
|
||||
}
|
||||
}
|
||||
} elseif ($type === 'all') {
|
||||
foreach ($cards['all'] as $value) {
|
||||
$regex = $value;
|
||||
|
||||
if (self::_check($check, $regex)) {
|
||||
return self::luhn($check, $deep);
|
||||
if (static::_check($check, $regex)) {
|
||||
return static::luhn($check, $deep);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$regex = $cards['fast'];
|
||||
|
||||
if (self::_check($check, $regex)) {
|
||||
return self::luhn($check, $deep);
|
||||
if (static::_check($check, $regex)) {
|
||||
return static::luhn($check, $deep);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
@ -282,7 +282,7 @@ class Validation {
|
|||
}
|
||||
break;
|
||||
default:
|
||||
self::$errors[] = __d('cake_dev', 'You must define the $operator parameter for %s', 'Validation::comparison()');
|
||||
static::$errors[] = __d('cake_dev', 'You must define the $operator parameter for %s', 'Validation::comparison()');
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -297,13 +297,13 @@ class Validation {
|
|||
*/
|
||||
public static function custom($check, $regex = null) {
|
||||
if (is_array($check)) {
|
||||
extract(self::_defaults($check));
|
||||
extract(static::_defaults($check));
|
||||
}
|
||||
if ($regex === null) {
|
||||
self::$errors[] = __d('cake_dev', 'You must define a regular expression for %s', 'Validation::custom()');
|
||||
static::$errors[] = __d('cake_dev', 'You must define a regular expression for %s', 'Validation::custom()');
|
||||
return false;
|
||||
}
|
||||
return self::_check($check, $regex);
|
||||
return static::_check($check, $regex);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -332,7 +332,7 @@ class Validation {
|
|||
*/
|
||||
public static function date($check, $format = 'ymd', $regex = null) {
|
||||
if ($regex !== null) {
|
||||
return self::_check($check, $regex);
|
||||
return static::_check($check, $regex);
|
||||
}
|
||||
$month = '(0[123456789]|10|11|12)';
|
||||
$separator = '([- /.])';
|
||||
|
@ -366,7 +366,7 @@ class Validation {
|
|||
|
||||
$format = (is_array($format)) ? array_values($format) : array($format);
|
||||
foreach ($format as $key) {
|
||||
if (self::_check($check, $regex[$key]) === true) {
|
||||
if (static::_check($check, $regex[$key]) === true) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -391,7 +391,7 @@ class Validation {
|
|||
if (!empty($parts) && count($parts) > 1) {
|
||||
$time = array_pop($parts);
|
||||
$date = implode(' ', $parts);
|
||||
$valid = self::date($date, $dateFormat, $regex) && self::time($time);
|
||||
$valid = static::date($date, $dateFormat, $regex) && static::time($time);
|
||||
}
|
||||
return $valid;
|
||||
}
|
||||
|
@ -405,7 +405,7 @@ class Validation {
|
|||
* @return bool Success
|
||||
*/
|
||||
public static function time($check) {
|
||||
return self::_check($check, '%^((0?[1-9]|1[012])(:[0-5]\d){0,2} ?([AP]M|[ap]m))$|^([01]\d|2[0-3])(:[0-5]\d){0,2}$%');
|
||||
return static::_check($check, '%^((0?[1-9]|1[012])(:[0-5]\d){0,2} ?([AP]M|[ap]m))$|^([01]\d|2[0-3])(:[0-5]\d){0,2}$%');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -461,7 +461,7 @@ class Validation {
|
|||
$check = str_replace($data['thousands_sep'], '', $check);
|
||||
$check = str_replace($data['decimal_point'], '.', $check);
|
||||
|
||||
return self::_check($check, $regex);
|
||||
return static::_check($check, $regex);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -477,18 +477,18 @@ class Validation {
|
|||
*/
|
||||
public static function email($check, $deep = false, $regex = null) {
|
||||
if (is_array($check)) {
|
||||
extract(self::_defaults($check));
|
||||
extract(static::_defaults($check));
|
||||
}
|
||||
|
||||
if ($regex === null) {
|
||||
$regex = '/^[\p{L}0-9!#$%&\'*+\/=?^_`{|}~-]+(?:\.[\p{L}0-9!#$%&\'*+\/=?^_`{|}~-]+)*@' . self::$_pattern['hostname'] . '$/ui';
|
||||
$regex = '/^[\p{L}0-9!#$%&\'*+\/=?^_`{|}~-]+(?:\.[\p{L}0-9!#$%&\'*+\/=?^_`{|}~-]+)*@' . static::$_pattern['hostname'] . '$/ui';
|
||||
}
|
||||
$return = self::_check($check, $regex);
|
||||
$return = static::_check($check, $regex);
|
||||
if ($deep === false || $deep === null) {
|
||||
return $return;
|
||||
}
|
||||
|
||||
if ($return === true && preg_match('/@(' . self::$_pattern['hostname'] . ')$/i', $check, $regs)) {
|
||||
if ($return === true && preg_match('/@(' . static::$_pattern['hostname'] . ')$/i', $check, $regs)) {
|
||||
if (function_exists('getmxrr') && getmxrr($regs[1], $mxhosts)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -520,7 +520,7 @@ class Validation {
|
|||
*/
|
||||
public static function extension($check, $extensions = array('gif', 'jpeg', 'png', 'jpg')) {
|
||||
if (is_array($check)) {
|
||||
return self::extension(array_shift($check), $extensions);
|
||||
return static::extension(array_shift($check), $extensions);
|
||||
}
|
||||
$extension = strtolower(pathinfo($check, PATHINFO_EXTENSION));
|
||||
foreach ($extensions as $value) {
|
||||
|
@ -586,7 +586,7 @@ class Validation {
|
|||
} else {
|
||||
$regex = '/^(?!\x{00a2})\p{Sc}?' . $money . '$/u';
|
||||
}
|
||||
return self::_check($check, $regex);
|
||||
return static::_check($check, $regex);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -654,7 +654,7 @@ class Validation {
|
|||
*/
|
||||
public static function naturalNumber($check, $allowZero = false) {
|
||||
$regex = $allowZero ? '/^(?:0|[1-9][0-9]*)$/' : '/^[1-9][0-9]*$/';
|
||||
return self::_check($check, $regex);
|
||||
return static::_check($check, $regex);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -667,7 +667,7 @@ class Validation {
|
|||
*/
|
||||
public static function phone($check, $regex = null, $country = 'all') {
|
||||
if (is_array($check)) {
|
||||
extract(self::_defaults($check));
|
||||
extract(static::_defaults($check));
|
||||
}
|
||||
|
||||
if ($regex === null) {
|
||||
|
@ -697,9 +697,9 @@ class Validation {
|
|||
}
|
||||
}
|
||||
if (empty($regex)) {
|
||||
return self::_pass('phone', $check, $country);
|
||||
return static::_pass('phone', $check, $country);
|
||||
}
|
||||
return self::_check($check, $regex);
|
||||
return static::_check($check, $regex);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -712,7 +712,7 @@ class Validation {
|
|||
*/
|
||||
public static function postal($check, $regex = null, $country = 'us') {
|
||||
if (is_array($check)) {
|
||||
extract(self::_defaults($check));
|
||||
extract(static::_defaults($check));
|
||||
}
|
||||
|
||||
if ($regex === null) {
|
||||
|
@ -738,9 +738,9 @@ class Validation {
|
|||
}
|
||||
}
|
||||
if (empty($regex)) {
|
||||
return self::_pass('postal', $check, $country);
|
||||
return static::_pass('postal', $check, $country);
|
||||
}
|
||||
return self::_check($check, $regex);
|
||||
return static::_check($check, $regex);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -774,7 +774,7 @@ class Validation {
|
|||
*/
|
||||
public static function ssn($check, $regex = null, $country = null) {
|
||||
if (is_array($check)) {
|
||||
extract(self::_defaults($check));
|
||||
extract(static::_defaults($check));
|
||||
}
|
||||
|
||||
if ($regex === null) {
|
||||
|
@ -791,9 +791,9 @@ class Validation {
|
|||
}
|
||||
}
|
||||
if (empty($regex)) {
|
||||
return self::_pass('ssn', $check, $country);
|
||||
return static::_pass('ssn', $check, $country);
|
||||
}
|
||||
return self::_check($check, $regex);
|
||||
return static::_check($check, $regex);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -814,14 +814,14 @@ class Validation {
|
|||
* @return bool Success
|
||||
*/
|
||||
public static function url($check, $strict = false) {
|
||||
self::_populateIp();
|
||||
static::_populateIp();
|
||||
$validChars = '([' . preg_quote('!"$&\'()*+,-.@_:;=~[]') . '\/0-9\p{L}\p{N}]|(%[0-9a-f]{2}))';
|
||||
$regex = '/^(?:(?:https?|ftps?|sftp|file|news|gopher):\/\/)' . (!empty($strict) ? '' : '?') .
|
||||
'(?:' . self::$_pattern['IPv4'] . '|\[' . self::$_pattern['IPv6'] . '\]|' . self::$_pattern['hostname'] . ')(?::[1-9][0-9]{0,4})?' .
|
||||
'(?:' . static::$_pattern['IPv4'] . '|\[' . static::$_pattern['IPv6'] . '\]|' . static::$_pattern['hostname'] . ')(?::[1-9][0-9]{0,4})?' .
|
||||
'(?:\/?|\/' . $validChars . '*)?' .
|
||||
'(?:\?' . $validChars . '*)?' .
|
||||
'(?:#' . $validChars . '*)?$/iu';
|
||||
return self::_check($check, $regex);
|
||||
return static::_check($check, $regex);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -863,7 +863,7 @@ class Validation {
|
|||
*/
|
||||
public static function uuid($check) {
|
||||
$regex = '/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[0-5][a-fA-F0-9]{3}-[089aAbB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$/';
|
||||
return self::_check($check, $regex);
|
||||
return static::_check($check, $regex);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -912,7 +912,7 @@ class Validation {
|
|||
* @return void
|
||||
*/
|
||||
protected static function _defaults($params) {
|
||||
self::_reset();
|
||||
static::_reset();
|
||||
$defaults = array(
|
||||
'check' => null,
|
||||
'regex' => null,
|
||||
|
@ -937,7 +937,7 @@ class Validation {
|
|||
*/
|
||||
public static function luhn($check, $deep = false) {
|
||||
if (is_array($check)) {
|
||||
extract(self::_defaults($check));
|
||||
extract(static::_defaults($check));
|
||||
}
|
||||
if ($deep !== true) {
|
||||
return true;
|
||||
|
@ -981,7 +981,7 @@ class Validation {
|
|||
}
|
||||
|
||||
if (is_string($mimeTypes)) {
|
||||
return self::_check($mime, $mimeTypes);
|
||||
return static::_check($mime, $mimeTypes);
|
||||
}
|
||||
|
||||
foreach ($mimeTypes as $key => $val) {
|
||||
|
@ -1008,7 +1008,7 @@ class Validation {
|
|||
}
|
||||
$filesize = filesize($check);
|
||||
|
||||
return self::comparison($filesize, $operator, $size);
|
||||
return static::comparison($filesize, $operator, $size);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1032,7 +1032,7 @@ class Validation {
|
|||
* @return void
|
||||
*/
|
||||
protected static function _populateIp() {
|
||||
if (!isset(self::$_pattern['IPv6'])) {
|
||||
if (!isset(static::$_pattern['IPv6'])) {
|
||||
$pattern = '((([0-9A-Fa-f]{1,4}:){7}(([0-9A-Fa-f]{1,4})|:))|(([0-9A-Fa-f]{1,4}:){6}';
|
||||
$pattern .= '(:|((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})';
|
||||
$pattern .= '|(:[0-9A-Fa-f]{1,4})))|(([0-9A-Fa-f]{1,4}:){5}((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})';
|
||||
|
@ -1048,11 +1048,11 @@ class Validation {
|
|||
$pattern .= '\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4})';
|
||||
$pattern .= '{1,2})))|(((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})))(%.+)?';
|
||||
|
||||
self::$_pattern['IPv6'] = $pattern;
|
||||
static::$_pattern['IPv6'] = $pattern;
|
||||
}
|
||||
if (!isset(self::$_pattern['IPv4'])) {
|
||||
if (!isset(static::$_pattern['IPv4'])) {
|
||||
$pattern = '(?:(?:25[0-5]|2[0-4][0-9]|(?:(?:1[0-9])?|[1-9]?)[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|(?:(?:1[0-9])?|[1-9]?)[0-9])';
|
||||
self::$_pattern['IPv4'] = $pattern;
|
||||
static::$_pattern['IPv4'] = $pattern;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1062,7 +1062,7 @@ class Validation {
|
|||
* @return void
|
||||
*/
|
||||
protected static function _reset() {
|
||||
self::$errors = array();
|
||||
static::$errors = array();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -99,11 +99,11 @@ class Xml {
|
|||
$options += $defaults;
|
||||
|
||||
if (is_array($input) || is_object($input)) {
|
||||
return self::fromArray((array)$input, $options);
|
||||
return static::fromArray((array)$input, $options);
|
||||
} elseif (strpos($input, '<') !== false) {
|
||||
return self::_loadXml($input, $options);
|
||||
return static::_loadXml($input, $options);
|
||||
} elseif ($options['readFile'] && file_exists($input)) {
|
||||
return self::_loadXml(file_get_contents($input), $options);
|
||||
return static::_loadXml(file_get_contents($input), $options);
|
||||
} elseif ($options['readFile'] && strpos($input, 'http://') === 0 || strpos($input, 'https://') === 0) {
|
||||
try {
|
||||
$socket = new HttpSocket(array('request' => array('redirect' => 10)));
|
||||
|
@ -111,7 +111,7 @@ class Xml {
|
|||
if (!$response->isOk()) {
|
||||
throw new XmlException(__d('cake_dev', 'XML cannot be read.'));
|
||||
}
|
||||
return self::_loadXml($response->body, $options);
|
||||
return static::_loadXml($response->body, $options);
|
||||
} catch (SocketException $e) {
|
||||
throw new XmlException(__d('cake_dev', 'XML cannot be read.'));
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ class Xml {
|
|||
if ($options['pretty']) {
|
||||
$dom->formatOutput = true;
|
||||
}
|
||||
self::_fromArray($dom, $dom, $input, $options['format']);
|
||||
static::_fromArray($dom, $dom, $input, $options['format']);
|
||||
|
||||
$options['return'] = strtolower($options['return']);
|
||||
if ($options['return'] === 'simplexml' || $options['return'] === 'simplexmlelement') {
|
||||
|
@ -282,10 +282,10 @@ class Xml {
|
|||
foreach ($value as $item) {
|
||||
$itemData = compact('dom', 'node', 'key', 'format');
|
||||
$itemData['value'] = $item;
|
||||
self::_createChild($itemData);
|
||||
static::_createChild($itemData);
|
||||
}
|
||||
} else { // Struct
|
||||
self::_createChild(compact('dom', 'node', 'key', 'value', 'format'));
|
||||
static::_createChild(compact('dom', 'node', 'key', 'value', 'format'));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -324,7 +324,7 @@ class Xml {
|
|||
$child->setAttribute('xmlns', $childNS);
|
||||
}
|
||||
|
||||
self::_fromArray($dom, $child, $value, $format);
|
||||
static::_fromArray($dom, $child, $value, $format);
|
||||
$node->appendChild($child);
|
||||
}
|
||||
|
||||
|
@ -344,7 +344,7 @@ class Xml {
|
|||
}
|
||||
$result = array();
|
||||
$namespaces = array_merge(array('' => ''), $obj->getNamespaces(true));
|
||||
self::_toArray($obj, $result, '', array_keys($namespaces));
|
||||
static::_toArray($obj, $result, '', array_keys($namespaces));
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
@ -369,7 +369,7 @@ class Xml {
|
|||
}
|
||||
|
||||
foreach ($xml->children($namespace, true) as $child) {
|
||||
self::_toArray($child, $data, $namespace, $namespaces);
|
||||
static::_toArray($child, $data, $namespace, $namespaces);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -428,7 +428,7 @@ class FormHelper extends AppHelper {
|
|||
case 'delete':
|
||||
$append .= $this->hidden('_method', array(
|
||||
'name' => '_method', 'value' => strtoupper($options['type']), 'id' => null,
|
||||
'secure' => self::SECURE_SKIP
|
||||
'secure' => static::SECURE_SKIP
|
||||
));
|
||||
default:
|
||||
$htmlAttributes['method'] = 'post';
|
||||
|
@ -488,7 +488,7 @@ class FormHelper extends AppHelper {
|
|||
}
|
||||
return $this->hidden('_Token.key', array(
|
||||
'value' => $this->request->params['_Token']['key'], 'id' => 'Token' . mt_rand(),
|
||||
'secure' => self::SECURE_SKIP
|
||||
'secure' => static::SECURE_SKIP
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -1696,7 +1696,7 @@ class FormHelper extends AppHelper {
|
|||
unset($options['secure']);
|
||||
|
||||
$options = $this->_initInputField($fieldName, array_merge(
|
||||
$options, array('secure' => self::SECURE_SKIP)
|
||||
$options, array('secure' => static::SECURE_SKIP)
|
||||
));
|
||||
|
||||
if ($secure === true) {
|
||||
|
@ -1717,7 +1717,7 @@ class FormHelper extends AppHelper {
|
|||
public function file($fieldName, $options = array()) {
|
||||
$options += array('secure' => true);
|
||||
$secure = $options['secure'];
|
||||
$options['secure'] = self::SECURE_SKIP;
|
||||
$options['secure'] = static::SECURE_SKIP;
|
||||
|
||||
$options = $this->_initInputField($fieldName, $options);
|
||||
$field = $this->entity();
|
||||
|
@ -2067,7 +2067,7 @@ class FormHelper extends AppHelper {
|
|||
$id = $this->_extractOption('id', $attributes);
|
||||
|
||||
$attributes = $this->_initInputField($fieldName, array_merge(
|
||||
(array)$attributes, array('secure' => self::SECURE_SKIP)
|
||||
(array)$attributes, array('secure' => static::SECURE_SKIP)
|
||||
));
|
||||
|
||||
if (is_string($options) && isset($this->_options[$options])) {
|
||||
|
@ -3007,7 +3007,7 @@ class FormHelper extends AppHelper {
|
|||
$result['required'] = true;
|
||||
}
|
||||
|
||||
if ($secure === self::SECURE_SKIP) {
|
||||
if ($secure === static::SECURE_SKIP) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
|
|
@ -468,7 +468,7 @@ class View extends Object {
|
|||
}
|
||||
|
||||
if ($view !== false && $viewFileName = $this->_getViewFileName($view)) {
|
||||
$this->_currentType = self::TYPE_VIEW;
|
||||
$this->_currentType = static::TYPE_VIEW;
|
||||
$this->getEventManager()->dispatch(new CakeEvent('View.beforeRender', $this, array($viewFileName)));
|
||||
$this->Blocks->set('content', $this->_render($viewFileName));
|
||||
$this->getEventManager()->dispatch(new CakeEvent('View.afterRender', $this, array($viewFileName)));
|
||||
|
@ -542,7 +542,7 @@ class View extends Object {
|
|||
$this->viewVars['title_for_layout'] = $title;
|
||||
$this->Blocks->set('title', $title);
|
||||
|
||||
$this->_currentType = self::TYPE_LAYOUT;
|
||||
$this->_currentType = static::TYPE_LAYOUT;
|
||||
$this->Blocks->set('content', $this->_render($layoutFileName));
|
||||
|
||||
$this->getEventManager()->dispatch(new CakeEvent('View.afterLayout', $this, array($layoutFileName)));
|
||||
|
@ -728,11 +728,11 @@ class View extends Object {
|
|||
* @throws LogicException when you extend an element which doesn't exist
|
||||
*/
|
||||
public function extend($name) {
|
||||
if ($name[0] === '/' || $this->_currentType === self::TYPE_VIEW) {
|
||||
if ($name[0] === '/' || $this->_currentType === static::TYPE_VIEW) {
|
||||
$parent = $this->_getViewFileName($name);
|
||||
} else {
|
||||
switch ($this->_currentType) {
|
||||
case self::TYPE_ELEMENT:
|
||||
case static::TYPE_ELEMENT:
|
||||
$parent = $this->_getElementFileName($name);
|
||||
if (!$parent) {
|
||||
list($plugin, $name) = $this->pluginSplit($name);
|
||||
|
@ -745,7 +745,7 @@ class View extends Object {
|
|||
));
|
||||
}
|
||||
break;
|
||||
case self::TYPE_LAYOUT:
|
||||
case static::TYPE_LAYOUT:
|
||||
$parent = $this->_getLayoutFileName($name);
|
||||
break;
|
||||
default:
|
||||
|
@ -1218,7 +1218,7 @@ class View extends Object {
|
|||
protected function _renderElement($file, $data, $options) {
|
||||
$current = $this->_current;
|
||||
$restore = $this->_currentType;
|
||||
$this->_currentType = self::TYPE_ELEMENT;
|
||||
$this->_currentType = static::TYPE_ELEMENT;
|
||||
|
||||
if ($options['callbacks']) {
|
||||
$this->getEventManager()->dispatch(new CakeEvent('View.beforeRender', $this, array($file)));
|
||||
|
|
Loading…
Reference in a new issue