Merge branch '2.1' of github.com:cakephp/cakephp into 2.1

This commit is contained in:
Ceeram 2012-03-03 23:55:20 +01:00
commit 169c99cedf
23 changed files with 103 additions and 99 deletions

View file

@ -477,5 +477,6 @@ class Cache {
} }
return array(); return array();
} }
} }

View file

@ -53,7 +53,8 @@ abstract class CacheEngine {
* Permanently remove all expired and deleted data * Permanently remove all expired and deleted data
* @return void * @return void
*/ */
public function gc() { } public function gc() {
}
/** /**
* Write value for a key into cache * Write value for a key into cache
@ -129,4 +130,5 @@ abstract class CacheEngine {
$key = Inflector::underscore(str_replace(array(DS, '/', '.'), '_', strval($key))); $key = Inflector::underscore(str_replace(array(DS, '/', '.'), '_', strval($key)));
return $key; return $key;
} }
} }

View file

@ -322,4 +322,5 @@ class FileEngine extends CacheEngine {
} }
return true; return true;
} }
} }

View file

@ -234,4 +234,5 @@ class MemcacheEngine extends CacheEngine {
} }
return true; return true;
} }
} }

View file

@ -173,4 +173,5 @@ class XcacheEngine extends CacheEngine {
} }
} }
} }
} }

View file

@ -19,6 +19,7 @@
* @package Cake.Core * @package Cake.Core
*/ */
interface ConfigReaderInterface { interface ConfigReaderInterface {
/** /**
* Read method is used for reading configuration information from sources. * Read method is used for reading configuration information from sources.
* These sources can either be static resources like files, or dynamic ones like * These sources can either be static resources like files, or dynamic ones like
@ -28,4 +29,5 @@ interface ConfigReaderInterface {
* @return array An array of data to merge into the runtime configuration * @return array An array of data to merge into the runtime configuration
*/ */
public function read($key); public function read($key);
} }

View file

@ -134,4 +134,5 @@ class IniReader implements ConfigReaderInterface {
} }
return $values; return $values;
} }
} }

View file

@ -27,6 +27,7 @@
* @package Cake.Configure * @package Cake.Configure
*/ */
class PhpReader implements ConfigReaderInterface { class PhpReader implements ConfigReaderInterface {
/** /**
* The path this reader finds files on. * The path this reader finds files on.
* *
@ -86,4 +87,5 @@ class PhpReader implements ConfigReaderInterface {
} }
return $config; return $config;
} }
} }

View file

@ -795,4 +795,5 @@ class CakeTime {
} }
return $format; return $format;
} }
} }

View file

@ -1,11 +1,5 @@
<?php <?php
/** /**
* Class collections.
*
* A repository for class objects, each registered with a key.
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* *
@ -370,4 +364,5 @@ class ClassRegistry {
$_this->_objects = array(); $_this->_objects = array();
$_this->_map = array(); $_this->_map = array();
} }
} }

View file

@ -203,7 +203,7 @@ class Debugger {
* @deprecated This function is superseded by Debugger::outputError() * @deprecated This function is superseded by Debugger::outputError()
*/ */
public static function showError($code, $description, $file = null, $line = null, $context = null) { public static function showError($code, $description, $file = null, $line = null, $context = null) {
$_this = Debugger::getInstance(); $self = Debugger::getInstance();
if (empty($file)) { if (empty($file)) {
$file = '[internal]'; $file = '[internal]';
@ -214,8 +214,8 @@ class Debugger {
$path = self::trimPath($file); $path = self::trimPath($file);
$info = compact('code', 'description', 'file', 'line'); $info = compact('code', 'description', 'file', 'line');
if (!in_array($info, $_this->errors)) { if (!in_array($info, $self->errors)) {
$_this->errors[] = $info; $self->errors[] = $info;
} else { } else {
return; return;
} }
@ -254,7 +254,7 @@ class Debugger {
$data = compact( $data = compact(
'level', 'error', 'code', 'description', 'file', 'path', 'line', 'context' 'level', 'error', 'code', 'description', 'file', 'path', 'line', 'context'
); );
echo $_this->outputError($data); echo $self->outputError($data);
if ($error == 'Fatal Error') { if ($error == 'Fatal Error') {
exit(); exit();
@ -279,10 +279,10 @@ class Debugger {
* @link http://book.cakephp.org/2.0/en/development/debugging.html#Debugger::trace * @link http://book.cakephp.org/2.0/en/development/debugging.html#Debugger::trace
*/ */
public static function trace($options = array()) { public static function trace($options = array()) {
$_this = Debugger::getInstance(); $self = Debugger::getInstance();
$defaults = array( $defaults = array(
'depth' => 999, 'depth' => 999,
'format' => $_this->_outputFormat, 'format' => $self->_outputFormat,
'args' => false, 'args' => false,
'start' => 0, 'start' => 0,
'scope' => null, 'scope' => null,
@ -330,10 +330,10 @@ class Debugger {
} elseif ($options['format'] == 'array') { } elseif ($options['format'] == 'array') {
$back[] = $trace; $back[] = $trace;
} else { } else {
if (isset($_this->_templates[$options['format']]['traceLine'])) { if (isset($self->_templates[$options['format']]['traceLine'])) {
$tpl = $_this->_templates[$options['format']]['traceLine']; $tpl = $self->_templates[$options['format']]['traceLine'];
} else { } else {
$tpl = $_this->_templates['base']['traceLine']; $tpl = $self->_templates['base']['traceLine'];
} }
$trace['path'] = self::trimPath($trace['file']); $trace['path'] = self::trimPath($trace['file']);
$trace['reference'] = $reference; $trace['reference'] = $reference;
@ -665,7 +665,7 @@ class Debugger {
* in 3.0 * in 3.0
*/ */
public function output($format = null, $strings = array()) { public function output($format = null, $strings = array()) {
$_this = Debugger::getInstance(); $self = Debugger::getInstance();
$data = null; $data = null;
if (is_null($format)) { if (is_null($format)) {
@ -676,9 +676,9 @@ class Debugger {
return Debugger::addFormat($format, $strings); return Debugger::addFormat($format, $strings);
} }
if ($format === true && !empty($_this->_data)) { if ($format === true && !empty($self->_data)) {
$data = $_this->_data; $data = $self->_data;
$_this->_data = array(); $self->_data = array();
$format = false; $format = false;
} }
Debugger::outputAs($format); Debugger::outputAs($format);
@ -810,4 +810,5 @@ class Debugger {
trigger_error(__d('cake_dev', 'Please change the value of \'Security.cipherSeed\' in app/Config/core.php to a numeric (digits only) seed value specific to your application'), E_USER_NOTICE); trigger_error(__d('cake_dev', 'Please change the value of \'Security.cipherSeed\' in app/Config/core.php to a numeric (digits only) seed value specific to your application'), E_USER_NOTICE);
} }
} }
} }

View file

@ -528,7 +528,7 @@ class File {
* @return Folder Current folder * @return Folder Current folder
* @link http://book.cakephp.org/2.0/en/core-utility-libraries/file-folder.html#File::Folder * @link http://book.cakephp.org/2.0/en/core-utility-libraries/file-folder.html#File::Folder
*/ */
public function &Folder() { public function &folder() {
return $this->Folder; return $this->Folder;
} }

View file

@ -1,9 +1,5 @@
<?php <?php
/** /**
* Convenience class for handling directories.
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* *
@ -192,7 +188,7 @@ class Folder {
*/ */
public function find($regexpPattern = '.*', $sort = false) { public function find($regexpPattern = '.*', $sort = false) {
list($dirs, $files) = $this->read($sort); list($dirs, $files) = $this->read($sort);
return array_values(preg_grep('/^' . $regexpPattern . '$/i', $files)); ; return array_values(preg_grep('/^' . $regexpPattern . '$/i', $files));
} }
/** /**
@ -750,7 +746,7 @@ class Folder {
$newpath = DS; $newpath = DS;
} }
while (($part = array_shift($parts)) !== NULL) { while (($part = array_shift($parts)) !== null) {
if ($part === '.' || $part === '') { if ($part === '.' || $part === '') {
continue; continue;
} }
@ -780,4 +776,5 @@ class Folder {
$lastChar = $path[strlen($path) - 1]; $lastChar = $path[strlen($path) - 1];
return $lastChar === '/' || $lastChar === '\\'; return $lastChar === '/' || $lastChar === '\\';
} }
} }

View file

@ -1,11 +1,5 @@
<?php <?php
/** /**
* Pluralize and singularize English words.
*
* Used by Cake's naming conventions throughout the framework.
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org) * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* *
@ -350,7 +344,6 @@ class Inflector {
* @link http://book.cakephp.org/2.0/en/core-utility-libraries/inflector.html#Inflector::pluralize * @link http://book.cakephp.org/2.0/en/core-utility-libraries/inflector.html#Inflector::pluralize
*/ */
public static function pluralize($word) { public static function pluralize($word) {
if (isset(self::$_cache['pluralize'][$word])) { if (isset(self::$_cache['pluralize'][$word])) {
return self::$_cache['pluralize'][$word]; return self::$_cache['pluralize'][$word];
} }
@ -394,7 +387,6 @@ class Inflector {
* @link http://book.cakephp.org/2.0/en/core-utility-libraries/inflector.html#Inflector::singularize * @link http://book.cakephp.org/2.0/en/core-utility-libraries/inflector.html#Inflector::singularize
*/ */
public static function singularize($word) { public static function singularize($word) {
if (isset(self::$_cache['singularize'][$word])) { if (isset(self::$_cache['singularize'][$word])) {
return self::$_cache['singularize'][$word]; return self::$_cache['singularize'][$word];
} }
@ -552,6 +544,7 @@ class Inflector {
$map = self::$_transliteration + $merge; $map = self::$_transliteration + $merge;
return preg_replace(array_keys($map), array_values($map), $string); return preg_replace(array_keys($map), array_values($map), $string);
} }
} }
// Store the initial state // Store the initial state

View file

@ -322,4 +322,5 @@ abstract class ObjectCollection {
} }
return $normal; return $normal;
} }
} }

View file

@ -260,4 +260,5 @@ class Sanitize {
return $data; return $data;
} }
} }
} }

View file

@ -154,4 +154,5 @@ class Security {
srand(); srand();
return $out; return $out;
} }
} }

View file

@ -1214,4 +1214,5 @@ class Set {
} }
return $return; return $return;
} }
} }

View file

@ -551,7 +551,7 @@ class String {
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/text.html#TextHelper::excerpt * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/text.html#TextHelper::excerpt
*/ */
public static function excerpt($text, $phrase, $radius = 100, $ending = '...') { public static function excerpt($text, $phrase, $radius = 100, $ending = '...') {
if (empty($text) or empty($phrase)) { if (empty($text) || empty($phrase)) {
return self::truncate($text, $radius * 2, array('ending' => $ending)); return self::truncate($text, $radius * 2, array('ending' => $ending));
} }

View file

@ -580,7 +580,8 @@ class Validation {
case 'us': case 'us':
case 'all': case 'all':
case 'can': case 'can':
// includes all NANPA members. see http://en.wikipedia.org/wiki/North_American_Numbering_Plan#List_of_NANPA_countries_and_territories // includes all NANPA members.
// see http://en.wikipedia.org/wiki/North_American_Numbering_Plan#List_of_NANPA_countries_and_territories
$regex = '/^(?:\+?1)?[-. ]?\\(?[2-9][0-8][0-9]\\)?[-. ]?[2-9][0-9]{2}[-. ]?[0-9]{4}$/'; $regex = '/^(?:\+?1)?[-. ]?\\(?[2-9][0-8][0-9]\\)?[-. ]?[2-9][0-9]{2}[-. ]?[0-9]{4}$/';
break; break;
} }
@ -880,4 +881,5 @@ class Validation {
protected static function _reset() { protected static function _reset() {
self::$errors = array(); self::$errors = array();
} }
} }