mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Changed methods and attributes from private to protected.
This commit is contained in:
parent
40654df5ab
commit
f5a54d00dd
39 changed files with 502 additions and 547 deletions
|
@ -88,7 +88,7 @@ class ApiShell extends Shell {
|
|||
$this->error(__d('cake_console', '%s not found', $class));
|
||||
}
|
||||
|
||||
$parsed = $this->__parseClass($path . $class .'.php', $class);
|
||||
$parsed = $this->_parseClass($path . $class .'.php', $class);
|
||||
|
||||
if (!empty($parsed)) {
|
||||
if (isset($this->params['method'])) {
|
||||
|
@ -194,7 +194,7 @@ class ApiShell extends Shell {
|
|||
* @param string $class Class name
|
||||
* @return array Methods and signatures indexed by method name
|
||||
*/
|
||||
private function __parseClass($path, $class) {
|
||||
protected function _parseClass($path, $class) {
|
||||
$parsed = array();
|
||||
|
||||
if (!class_exists($class)) {
|
||||
|
|
|
@ -30,13 +30,6 @@ App::uses('CakeSchema', 'Model');
|
|||
*/
|
||||
class SchemaShell extends Shell {
|
||||
|
||||
/**
|
||||
* is this a dry run?
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $__dry = null;
|
||||
|
||||
/**
|
||||
* Schema class being used.
|
||||
*
|
||||
|
@ -278,7 +271,7 @@ class SchemaShell extends Shell {
|
|||
}
|
||||
|
||||
if (!empty($this->params['dry'])) {
|
||||
$this->__dry = true;
|
||||
$this->_dry = true;
|
||||
$this->out(__d('cake_console', 'Performing a dry run.'));
|
||||
}
|
||||
|
||||
|
@ -411,7 +404,7 @@ class SchemaShell extends Shell {
|
|||
if (empty($sql)) {
|
||||
$this->out(__d('cake_console', '%s is up to date.', $table));
|
||||
} else {
|
||||
if ($this->__dry === true) {
|
||||
if ($this->_dry === true) {
|
||||
$this->out(__d('cake_console', 'Dry run for %s :', $table));
|
||||
$this->out($sql);
|
||||
} else {
|
||||
|
|
|
@ -115,7 +115,7 @@ class ViewTask extends BakeTask {
|
|||
return $this->bake($action, true);
|
||||
}
|
||||
|
||||
$vars = $this->__loadController();
|
||||
$vars = $this->_loadController();
|
||||
$methods = $this->_methodsToBake();
|
||||
|
||||
foreach ($methods as $method) {
|
||||
|
@ -177,7 +177,7 @@ class ViewTask extends BakeTask {
|
|||
$this->controllerName = $this->_controllerName($model);
|
||||
App::uses($model, 'Model');
|
||||
if (class_exists($model)) {
|
||||
$vars = $this->__loadController();
|
||||
$vars = $this->_loadController();
|
||||
if (!$actions) {
|
||||
$actions = $this->_methodsToBake();
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ class ViewTask extends BakeTask {
|
|||
$wannaDoAdmin = $this->in(__d('cake_console', "Would you like to create the views for admin routing?"), array('y','n'), 'n');
|
||||
|
||||
if (strtolower($wannaDoScaffold) == 'y' || strtolower($wannaDoAdmin) == 'y') {
|
||||
$vars = $this->__loadController();
|
||||
$vars = $this->_loadController();
|
||||
if (strtolower($wannaDoScaffold) == 'y') {
|
||||
$actions = $this->scaffoldActions;
|
||||
$this->bakeActions($actions, $vars);
|
||||
|
@ -250,7 +250,7 @@ class ViewTask extends BakeTask {
|
|||
*
|
||||
* @return array Returns an variables to be made available to a view template
|
||||
*/
|
||||
private function __loadController() {
|
||||
protected function _loadController() {
|
||||
if (!$this->controllerName) {
|
||||
$this->err(__d('cake_console', 'Controller not found'));
|
||||
}
|
||||
|
@ -280,7 +280,7 @@ class ViewTask extends BakeTask {
|
|||
$singularHumanName = $this->_singularHumanName($this->controllerName);
|
||||
$schema = $modelObj->schema(true);
|
||||
$fields = array_keys($schema);
|
||||
$associations = $this->__associations($modelObj);
|
||||
$associations = $this->_associations($modelObj);
|
||||
} else {
|
||||
$primaryKey = $displayField = null;
|
||||
$singularVar = Inflector::variable(Inflector::singularize($this->controllerName));
|
||||
|
@ -367,7 +367,7 @@ class ViewTask extends BakeTask {
|
|||
*/
|
||||
public function getContent($action, $vars = null) {
|
||||
if (!$vars) {
|
||||
$vars = $this->__loadController();
|
||||
$vars = $this->_loadController();
|
||||
}
|
||||
|
||||
$this->Template->set('action', $action);
|
||||
|
@ -443,7 +443,7 @@ class ViewTask extends BakeTask {
|
|||
* @param Model $model
|
||||
* @return array $associations
|
||||
*/
|
||||
private function __associations($model) {
|
||||
protected function _associations($model) {
|
||||
$keys = array('belongsTo', 'hasOne', 'hasMany', 'hasAndBelongsToMany');
|
||||
$associations = array();
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ class ShellDispatcher {
|
|||
* @throws CakeException
|
||||
*/
|
||||
protected function _initEnvironment() {
|
||||
if (!$this->__bootstrap()) {
|
||||
if (!$this->_bootstrap()) {
|
||||
$message = "Unable to load CakePHP core.\nMake sure " . DS . 'lib' . DS . 'Cake exists in ' . CAKE_CORE_INCLUDE_PATH;
|
||||
throw new CakeException($message);
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ class ShellDispatcher {
|
|||
*
|
||||
* @return boolean Success.
|
||||
*/
|
||||
private function __bootstrap() {
|
||||
protected function _bootstrap() {
|
||||
define('ROOT', $this->params['root']);
|
||||
define('APP_DIR', $this->params['app']);
|
||||
define('APP', $this->params['working'] . DS);
|
||||
|
|
|
@ -72,7 +72,7 @@ class RequestHandlerComponent extends Component {
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
private $__renderType = null;
|
||||
protected $_renderType = null;
|
||||
|
||||
/**
|
||||
* A mapping between extensions and deserializers for request bodies of that type.
|
||||
|
@ -80,7 +80,7 @@ class RequestHandlerComponent extends Component {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
private $__inputTypeMap = array(
|
||||
protected $_inputTypeMap = array(
|
||||
'json' => array('json_decode', true)
|
||||
);
|
||||
|
||||
|
@ -160,7 +160,7 @@ class RequestHandlerComponent extends Component {
|
|||
$this->respondAs('html', array('charset' => Configure::read('App.encoding')));
|
||||
}
|
||||
|
||||
foreach ($this->__inputTypeMap as $type => $handler) {
|
||||
foreach ($this->_inputTypeMap as $type => $handler) {
|
||||
if ($this->requestedWith($type)) {
|
||||
$input = call_user_func_array(array($controller->request, 'input'), $handler);
|
||||
$controller->request->data = $input;
|
||||
|
@ -530,13 +530,13 @@ class RequestHandlerComponent extends Component {
|
|||
}
|
||||
$controller->ext = '.ctp';
|
||||
|
||||
if (empty($this->__renderType)) {
|
||||
if (empty($this->_renderType)) {
|
||||
$controller->viewPath .= DS . $type;
|
||||
} else {
|
||||
$remove = preg_replace("/([\/\\\\]{$this->__renderType})$/", DS . $type, $controller->viewPath);
|
||||
$remove = preg_replace("/([\/\\\\]{$this->_renderType})$/", DS . $type, $controller->viewPath);
|
||||
$controller->viewPath = $remove;
|
||||
}
|
||||
$this->__renderType = $type;
|
||||
$this->_renderType = $type;
|
||||
$controller->layoutPath = $type;
|
||||
|
||||
if ($this->response->getMimeType($type)) {
|
||||
|
@ -666,6 +666,6 @@ class RequestHandlerComponent extends Component {
|
|||
if (!is_array($handler) || !isset($handler[0]) || !is_callable($handler[0])) {
|
||||
throw new CakeException(__d('cake_dev', 'You must give a handler callback.'));
|
||||
}
|
||||
$this->__inputTypeMap[$type] = $handler;
|
||||
$this->_inputTypeMap[$type] = $handler;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ class Scaffold {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
private $__passedVars = array(
|
||||
protected $_passedVars = array(
|
||||
'layout', 'name', 'viewPath', 'request'
|
||||
);
|
||||
|
||||
|
@ -107,9 +107,9 @@ class Scaffold {
|
|||
public function __construct(Controller $controller, CakeRequest $request) {
|
||||
$this->controller = $controller;
|
||||
|
||||
$count = count($this->__passedVars);
|
||||
$count = count($this->_passedVars);
|
||||
for ($j = 0; $j < $count; $j++) {
|
||||
$var = $this->__passedVars[$j];
|
||||
$var = $this->_passedVars[$j];
|
||||
$this->{$var} = $controller->{$var};
|
||||
}
|
||||
|
||||
|
|
|
@ -122,49 +122,35 @@ class App {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $__map = array();
|
||||
|
||||
/**
|
||||
* Holds paths for deep searching of files.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $__paths = array();
|
||||
|
||||
/**
|
||||
* Holds loaded files.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $__loaded = array();
|
||||
protected static $_map = array();
|
||||
|
||||
/**
|
||||
* Holds and key => value array of object types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $__objects = array();
|
||||
protected static $_objects = array();
|
||||
|
||||
/**
|
||||
* Holds the location of each class
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $__classMap = array();
|
||||
protected static $_classMap = array();
|
||||
|
||||
/**
|
||||
* Holds the possible paths for each package name
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $__packages = array();
|
||||
protected static $_packages = array();
|
||||
|
||||
/**
|
||||
* Holds the templates for each customizable package path in the application
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $__packageFormat = array();
|
||||
protected static $_packageFormat = array();
|
||||
|
||||
/**
|
||||
* Maps an old style CakePHP class type to the corresponding package
|
||||
|
@ -188,14 +174,14 @@ class App {
|
|||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private static $_cacheChange = false;
|
||||
protected static $_cacheChange = false;
|
||||
|
||||
/**
|
||||
* Indicates whether the object cache should be stored again because of an addition to it
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private static $_objectCacheChange = false;
|
||||
protected static $_objectCacheChange = false;
|
||||
|
||||
/**
|
||||
* Indicates the the Application is in the bootstrapping process. Used to better cache
|
||||
|
@ -226,8 +212,8 @@ class App {
|
|||
if (!empty($plugin)) {
|
||||
$path = array();
|
||||
$pluginPath = self::pluginPath($plugin);
|
||||
if (!empty(self::$__packageFormat[$type])) {
|
||||
foreach (self::$__packageFormat[$type] as $f) {
|
||||
if (!empty(self::$_packageFormat[$type])) {
|
||||
foreach (self::$_packageFormat[$type] as $f) {
|
||||
$path[] = sprintf($f, $pluginPath);
|
||||
}
|
||||
}
|
||||
|
@ -235,10 +221,10 @@ class App {
|
|||
return $path;
|
||||
}
|
||||
|
||||
if (!isset(self::$__packages[$type])) {
|
||||
if (!isset(self::$_packages[$type])) {
|
||||
return array();
|
||||
}
|
||||
return self::$__packages[$type];
|
||||
return self::$_packages[$type];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -261,8 +247,8 @@ class App {
|
|||
* @return void
|
||||
*/
|
||||
public static function build($paths = array(), $mode = App::PREPEND) {
|
||||
if (empty(self::$__packageFormat)) {
|
||||
self::$__packageFormat = array(
|
||||
if (empty(self::$_packageFormat)) {
|
||||
self::$_packageFormat = array(
|
||||
'Model' => array(
|
||||
'%s' . 'Model' . DS,
|
||||
'%s' . 'models' . DS
|
||||
|
@ -337,7 +323,7 @@ class App {
|
|||
if (!empty(self::$legacy[$type])) {
|
||||
$type = self::$legacy[$type];
|
||||
}
|
||||
self::$__packages[$type] = (array)$new;
|
||||
self::$_packages[$type] = (array)$new;
|
||||
self::objects($type, null, false);
|
||||
}
|
||||
return $paths;
|
||||
|
@ -354,28 +340,28 @@ class App {
|
|||
|
||||
$paths = $legacyPaths;
|
||||
$defaults = array();
|
||||
foreach (self::$__packageFormat as $package => $format) {
|
||||
foreach (self::$_packageFormat as $package => $format) {
|
||||
foreach ($format as $f) {
|
||||
$defaults[$package][] = sprintf($f, APP);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($defaults as $type => $default) {
|
||||
if (empty(self::$__packages[$type]) || empty($paths)) {
|
||||
self::$__packages[$type] = $default;
|
||||
if (empty(self::$_packages[$type]) || empty($paths)) {
|
||||
self::$_packages[$type] = $default;
|
||||
}
|
||||
|
||||
if (!empty($paths[$type])) {
|
||||
if ($mode === App::PREPEND) {
|
||||
$path = array_merge((array)$paths[$type], self::$__packages[$type]);
|
||||
$path = array_merge((array)$paths[$type], self::$_packages[$type]);
|
||||
} else {
|
||||
$path = array_merge(self::$__packages[$type], (array)$paths[$type]);
|
||||
$path = array_merge(self::$_packages[$type], (array)$paths[$type]);
|
||||
}
|
||||
} else {
|
||||
$path = self::$__packages[$type];
|
||||
$path = self::$_packages[$type];
|
||||
}
|
||||
|
||||
self::$__packages[$type] = array_values(array_unique($path));
|
||||
self::$_packages[$type] = array_values(array_unique($path));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -405,12 +391,12 @@ class App {
|
|||
*/
|
||||
public static function themePath($theme) {
|
||||
$themeDir = 'Themed' . DS . Inflector::camelize($theme);
|
||||
foreach (self::$__packages['View'] as $path) {
|
||||
foreach (self::$_packages['View'] as $path) {
|
||||
if (is_dir($path . $themeDir)) {
|
||||
return $path . $themeDir . DS ;
|
||||
}
|
||||
}
|
||||
return self::$__packages['View'][0] . $themeDir . DS;
|
||||
return self::$_packages['View'][0] . $themeDir . DS;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -473,13 +459,13 @@ class App {
|
|||
$name = $type . str_replace(DS, '', $path);
|
||||
}
|
||||
|
||||
if (empty(self::$__objects) && $cache === true) {
|
||||
self::$__objects = Cache::read('object_map', '_cake_core_');
|
||||
if (empty(self::$_objects) && $cache === true) {
|
||||
self::$_objects = Cache::read('object_map', '_cake_core_');
|
||||
}
|
||||
|
||||
$cacheLocation = empty($plugin) ? 'app' : $plugin;
|
||||
|
||||
if ($cache !== true || !isset(self::$__objects[$cacheLocation][$name])) {
|
||||
if ($cache !== true || !isset(self::$_objects[$cacheLocation][$name])) {
|
||||
$objects = array();
|
||||
|
||||
if (empty($path)) {
|
||||
|
@ -513,13 +499,13 @@ class App {
|
|||
return $objects;
|
||||
}
|
||||
|
||||
self::$__objects[$cacheLocation][$name] = $objects;
|
||||
self::$_objects[$cacheLocation][$name] = $objects;
|
||||
if ($cache) {
|
||||
self::$_objectCacheChange = true;
|
||||
}
|
||||
}
|
||||
|
||||
return self::$__objects[$cacheLocation][$name];
|
||||
return self::$_objects[$cacheLocation][$name];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -537,7 +523,7 @@ class App {
|
|||
* @return void
|
||||
*/
|
||||
public static function uses($className, $location) {
|
||||
self::$__classMap[$className] = $location;
|
||||
self::$_classMap[$className] = $location;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -550,20 +536,20 @@ class App {
|
|||
* @return boolean
|
||||
*/
|
||||
public static function load($className) {
|
||||
if (!isset(self::$__classMap[$className])) {
|
||||
if (!isset(self::$_classMap[$className])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($file = self::__mapped($className)) {
|
||||
if ($file = self::_mapped($className)) {
|
||||
return include $file;
|
||||
}
|
||||
|
||||
$parts = explode('.', self::$__classMap[$className], 2);
|
||||
$parts = explode('.', self::$_classMap[$className], 2);
|
||||
list($plugin, $package) = count($parts) > 1 ? $parts : array(null, current($parts));
|
||||
$paths = self::path($package, $plugin);
|
||||
|
||||
if (empty($plugin)) {
|
||||
$appLibs = empty(self::$__packages['Lib']) ? APPLIBS : current(self::$__packages['Lib']);
|
||||
$appLibs = empty(self::$_packages['Lib']) ? APPLIBS : current(self::$_packages['Lib']);
|
||||
$paths[] = $appLibs . $package . DS;
|
||||
$paths[] = CAKE . $package . DS;
|
||||
}
|
||||
|
@ -571,7 +557,7 @@ class App {
|
|||
foreach ($paths as $path) {
|
||||
$file = $path . $className . '.php';
|
||||
if (file_exists($file)) {
|
||||
self::__map($file, $className);
|
||||
self::_map($file, $className);
|
||||
return include $file;
|
||||
}
|
||||
}
|
||||
|
@ -587,7 +573,7 @@ class App {
|
|||
}
|
||||
foreach ($tries as $file) {
|
||||
if (file_exists($file)) {
|
||||
self::__map($file, $className);
|
||||
self::_map($file, $className);
|
||||
return include $file;
|
||||
}
|
||||
}
|
||||
|
@ -603,8 +589,8 @@ class App {
|
|||
* @return string package name or null if not declared
|
||||
*/
|
||||
public static function location($className) {
|
||||
if (!empty(self::$__classMap[$className])) {
|
||||
return self::$__classMap[$className];
|
||||
if (!empty(self::$_classMap[$className])) {
|
||||
return self::$_classMap[$className];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -727,8 +713,8 @@ class App {
|
|||
* @param boolean $return whether this function should return the contents of the file after being parsed by php or just a success notice
|
||||
* @return mixed if $return contents of the file after php parses it, boolean indicating success otherwise
|
||||
*/
|
||||
private function _loadFile($name, $plugin, $search, $file, $return) {
|
||||
$mapped = self::__mapped($name, $plugin);
|
||||
protected function _loadFile($name, $plugin, $search, $file, $return) {
|
||||
$mapped = self::_mapped($name, $plugin);
|
||||
if ($mapped) {
|
||||
$file = $mapped;
|
||||
} else if (!empty($search)) {
|
||||
|
@ -745,7 +731,7 @@ class App {
|
|||
}
|
||||
}
|
||||
if (!empty($file) && file_exists($file)) {
|
||||
self::__map($file, $name, $plugin);
|
||||
self::_map($file, $name, $plugin);
|
||||
$returnValue = include $file;
|
||||
if ($return) {
|
||||
return $returnValue;
|
||||
|
@ -764,8 +750,8 @@ class App {
|
|||
* @param string $ext file extension if known
|
||||
* @return boolean true if the file was loaded successfully, false otherwise
|
||||
*/
|
||||
private function _loadVendor($name, $plugin, $file, $ext) {
|
||||
if ($mapped = self::__mapped($name, $plugin)) {
|
||||
protected function _loadVendor($name, $plugin, $file, $ext) {
|
||||
if ($mapped = self::_mapped($name, $plugin)) {
|
||||
return (bool) include_once($mapped);
|
||||
}
|
||||
$fileTries = array();
|
||||
|
@ -783,7 +769,7 @@ class App {
|
|||
foreach ($fileTries as $file) {
|
||||
foreach ($paths as $path) {
|
||||
if (file_exists($path . $file)) {
|
||||
self::__map($path . $file, $name, $plugin);
|
||||
self::_map($path . $file, $name, $plugin);
|
||||
return (bool) include($path . $file);
|
||||
}
|
||||
}
|
||||
|
@ -797,8 +783,8 @@ class App {
|
|||
* @return void
|
||||
*/
|
||||
public static function init() {
|
||||
self::$__map += (array)Cache::read('file_map', '_cake_core_');
|
||||
self::$__objects += (array)Cache::read('object_map', '_cake_core_');
|
||||
self::$_map += (array)Cache::read('file_map', '_cake_core_');
|
||||
self::$_objects += (array)Cache::read('object_map', '_cake_core_');
|
||||
register_shutdown_function(array('App', 'shutdown'));
|
||||
self::uses('CakePlugin', 'Core');
|
||||
}
|
||||
|
@ -811,11 +797,11 @@ class App {
|
|||
* @param string $plugin camelized if object is from a plugin, the name of the plugin
|
||||
* @return void
|
||||
*/
|
||||
private static function __map($file, $name, $plugin = null) {
|
||||
protected static function _map($file, $name, $plugin = null) {
|
||||
if ($plugin) {
|
||||
self::$__map['Plugin'][$plugin][$name] = $file;
|
||||
self::$_map['Plugin'][$plugin][$name] = $file;
|
||||
} else {
|
||||
self::$__map[$name] = $file;
|
||||
self::$_map[$name] = $file;
|
||||
}
|
||||
if (!self::$bootstrapping) {
|
||||
self::$_cacheChange = true;
|
||||
|
@ -829,16 +815,16 @@ class App {
|
|||
* @param string $plugin camelized if object is from a plugin, the name of the plugin
|
||||
* @return mixed file path if found, false otherwise
|
||||
*/
|
||||
private static function __mapped($name, $plugin = null) {
|
||||
protected static function _mapped($name, $plugin = null) {
|
||||
if ($plugin) {
|
||||
if (isset(self::$__map['Plugin'][$plugin][$name])) {
|
||||
return self::$__map['Plugin'][$plugin][$name];
|
||||
if (isset(self::$_map['Plugin'][$plugin][$name])) {
|
||||
return self::$_map['Plugin'][$plugin][$name];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isset(self::$__map[$name])) {
|
||||
return self::$__map[$name];
|
||||
if (isset(self::$_map[$name])) {
|
||||
return self::$_map[$name];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -846,16 +832,16 @@ class App {
|
|||
/**
|
||||
* Object destructor.
|
||||
*
|
||||
* Writes cache file if changes have been made to the $__map or $__paths
|
||||
* Writes cache file if changes have been made to the $_map
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function shutdown() {
|
||||
if (self::$_cacheChange) {
|
||||
Cache::write('file_map', array_filter(self::$__map), '_cake_core_');
|
||||
Cache::write('file_map', array_filter(self::$_map), '_cake_core_');
|
||||
}
|
||||
if (self::$_objectCacheChange) {
|
||||
Cache::write('object_map', self::$__objects, '_cake_core_');
|
||||
Cache::write('object_map', self::$_objects, '_cake_core_');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ class CakePlugin {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $_plugins = array();
|
||||
protected static $_plugins = array();
|
||||
|
||||
/**
|
||||
* Loads a plugin and optionally loads bootstrapping, routing files or loads a initialization function
|
||||
|
|
|
@ -64,31 +64,31 @@ class I18n {
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
private $__lang = null;
|
||||
protected $_lang = null;
|
||||
|
||||
/**
|
||||
* Translation strings for a specific domain read from the .mo or .po files
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $__domains = array();
|
||||
protected $_domains = array();
|
||||
|
||||
/**
|
||||
* Set to true when I18N::__bindTextDomain() is called for the first time.
|
||||
* Set to true when I18N::_bindTextDomain() is called for the first time.
|
||||
* If a translation file is found it is set to false again
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $__noLocale = false;
|
||||
protected $_noLocale = false;
|
||||
|
||||
/**
|
||||
* Set to true when I18N::__bindTextDomain() is called for the first time.
|
||||
* Set to true when I18N::_bindTextDomain() is called for the first time.
|
||||
* If a translation file is found it is set to false again
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $__categories = array(
|
||||
'LC_ALL', 'LC_COLLATE', 'LC_CTYPE', 'LC_MONETARY', 'LC_NUMERIC', 'LC_TIME', 'LC_MESSAGES'
|
||||
protected $_categories = array(
|
||||
'LC_ALL', 'LC_COLLATE', 'LC_CTYPE', 'LC_MONETARY', 'LC_NUMERIC', 'LC_TIME', 'LC_MESSAGES'
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -127,7 +127,7 @@ class I18n {
|
|||
}
|
||||
|
||||
if (is_numeric($category)) {
|
||||
$_this->category = $_this->__categories[$category];
|
||||
$_this->category = $_this->_categories[$category];
|
||||
}
|
||||
$language = Configure::read('Config.language');
|
||||
|
||||
|
@ -135,9 +135,9 @@ class I18n {
|
|||
$language = $_SESSION['Config']['language'];
|
||||
}
|
||||
|
||||
if (($_this->__lang && $_this->__lang !== $language) || !$_this->__lang) {
|
||||
if (($_this->_lang && $_this->_lang !== $language) || !$_this->_lang) {
|
||||
$lang = $_this->l10n->get($language);
|
||||
$_this->__lang = $lang;
|
||||
$_this->_lang = $lang;
|
||||
}
|
||||
|
||||
if (is_null($domain)) {
|
||||
|
@ -146,24 +146,24 @@ class I18n {
|
|||
|
||||
$_this->domain = $domain . '_' . $_this->l10n->lang;
|
||||
|
||||
if (!isset($_this->__domains[$domain][$_this->__lang])) {
|
||||
$_this->__domains[$domain][$_this->__lang] = Cache::read($_this->domain, '_cake_core_');
|
||||
if (!isset($_this->_domains[$domain][$_this->_lang])) {
|
||||
$_this->_domains[$domain][$_this->_lang] = Cache::read($_this->domain, '_cake_core_');
|
||||
}
|
||||
|
||||
if (!isset($_this->__domains[$domain][$_this->__lang][$_this->category])) {
|
||||
$_this->__bindTextDomain($domain);
|
||||
Cache::write($_this->domain, $_this->__domains[$domain][$_this->__lang], '_cake_core_');
|
||||
if (!isset($_this->_domains[$domain][$_this->_lang][$_this->category])) {
|
||||
$_this->_bindTextDomain($domain);
|
||||
Cache::write($_this->domain, $_this->_domains[$domain][$_this->_lang], '_cake_core_');
|
||||
}
|
||||
|
||||
if ($_this->category == 'LC_TIME') {
|
||||
return $_this->__translateTime($singular,$domain);
|
||||
return $_this->_translateTime($singular,$domain);
|
||||
}
|
||||
|
||||
if (!isset($count)) {
|
||||
$plurals = 0;
|
||||
} elseif (!empty($_this->__domains[$domain][$_this->__lang][$_this->category]["%plural-c"]) && $_this->__noLocale === false) {
|
||||
$header = $_this->__domains[$domain][$_this->__lang][$_this->category]["%plural-c"];
|
||||
$plurals = $_this->__pluralGuess($header, $count);
|
||||
} elseif (!empty($_this->_domains[$domain][$_this->_lang][$_this->category]["%plural-c"]) && $_this->_noLocale === false) {
|
||||
$header = $_this->_domains[$domain][$_this->_lang][$_this->category]["%plural-c"];
|
||||
$plurals = $_this->_pluralGuess($header, $count);
|
||||
} else {
|
||||
if ($count != 1) {
|
||||
$plurals = 1;
|
||||
|
@ -172,8 +172,8 @@ class I18n {
|
|||
}
|
||||
}
|
||||
|
||||
if (!empty($_this->__domains[$domain][$_this->__lang][$_this->category][$singular])) {
|
||||
if (($trans = $_this->__domains[$domain][$_this->__lang][$_this->category][$singular]) || ($plurals) && ($trans = $_this->__domains[$domain][$_this->__lang][$_this->category][$plural])) {
|
||||
if (!empty($_this->_domains[$domain][$_this->_lang][$_this->category][$singular])) {
|
||||
if (($trans = $_this->_domains[$domain][$_this->_lang][$_this->category][$singular]) || ($plurals) && ($trans = $_this->_domains[$domain][$_this->_lang][$_this->category][$plural])) {
|
||||
if (is_array($trans)) {
|
||||
if (isset($trans[$plurals])) {
|
||||
$trans = $trans[$plurals];
|
||||
|
@ -198,7 +198,7 @@ class I18n {
|
|||
*/
|
||||
public static function clear() {
|
||||
$self = I18n::getInstance();
|
||||
$self->__domains = array();
|
||||
$self->_domains = array();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -208,7 +208,7 @@ class I18n {
|
|||
*/
|
||||
public static function domains() {
|
||||
$self = I18n::getInstance();
|
||||
return $self->__domains;
|
||||
return $self->_domains;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -218,7 +218,7 @@ class I18n {
|
|||
* @param integer $n Number
|
||||
* @return integer plural match
|
||||
*/
|
||||
private function __pluralGuess($header, $n) {
|
||||
protected function _pluralGuess($header, $n) {
|
||||
if (!is_string($header) || $header === "nplurals=1;plural=0;" || !isset($header[0])) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -266,8 +266,8 @@ class I18n {
|
|||
* @param string $domain Domain to bind
|
||||
* @return string Domain binded
|
||||
*/
|
||||
private function __bindTextDomain($domain) {
|
||||
$this->__noLocale = true;
|
||||
protected function _bindTextDomain($domain) {
|
||||
$this->_noLocale = true;
|
||||
$core = true;
|
||||
$merge = array();
|
||||
$searchPaths = App::path('locales');
|
||||
|
@ -295,70 +295,70 @@ class I18n {
|
|||
$app = $directory . $lang . DS . $this->category . DS . 'core';
|
||||
|
||||
if (file_exists($fn = "$app.mo")) {
|
||||
$this->__loadMo($fn, $domain);
|
||||
$this->__noLocale = false;
|
||||
$merge[$domain][$this->__lang][$this->category] = $this->__domains[$domain][$this->__lang][$this->category];
|
||||
$this->_loadMo($fn, $domain);
|
||||
$this->_noLocale = false;
|
||||
$merge[$domain][$this->_lang][$this->category] = $this->_domains[$domain][$this->_lang][$this->category];
|
||||
$core = null;
|
||||
} elseif (file_exists($fn = "$app.po") && ($f = fopen($fn, "r"))) {
|
||||
$this->__loadPo($f, $domain);
|
||||
$this->__noLocale = false;
|
||||
$merge[$domain][$this->__lang][$this->category] = $this->__domains[$domain][$this->__lang][$this->category];
|
||||
$this->_loadPo($f, $domain);
|
||||
$this->_noLocale = false;
|
||||
$merge[$domain][$this->_lang][$this->category] = $this->_domains[$domain][$this->_lang][$this->category];
|
||||
$core = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (file_exists($fn = "$file.mo")) {
|
||||
$this->__loadMo($fn, $domain);
|
||||
$this->__noLocale = false;
|
||||
$this->_loadMo($fn, $domain);
|
||||
$this->_noLocale = false;
|
||||
break 2;
|
||||
} elseif (file_exists($fn = "$file.po") && ($f = fopen($fn, "r"))) {
|
||||
$this->__loadPo($f, $domain);
|
||||
$this->__noLocale = false;
|
||||
$this->_loadPo($f, $domain);
|
||||
$this->_noLocale = false;
|
||||
break 2;
|
||||
} elseif (is_file($localeDef) && ($f = fopen($localeDef, "r"))) {
|
||||
$this->__loadLocaleDefinition($f, $domain);
|
||||
$this->__noLocale = false;
|
||||
$this->_loadLocaleDefinition($f, $domain);
|
||||
$this->_noLocale = false;
|
||||
return $domain;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($this->__domains[$domain][$this->__lang][$this->category])) {
|
||||
$this->__domains[$domain][$this->__lang][$this->category] = array();
|
||||
if (empty($this->_domains[$domain][$this->_lang][$this->category])) {
|
||||
$this->_domains[$domain][$this->_lang][$this->category] = array();
|
||||
return $domain;
|
||||
}
|
||||
|
||||
if (isset($this->__domains[$domain][$this->__lang][$this->category][""])) {
|
||||
$head = $this->__domains[$domain][$this->__lang][$this->category][""];
|
||||
if (isset($this->_domains[$domain][$this->_lang][$this->category][""])) {
|
||||
$head = $this->_domains[$domain][$this->_lang][$this->category][""];
|
||||
|
||||
foreach (explode("\n", $head) as $line) {
|
||||
$header = strtok($line,":");
|
||||
$line = trim(strtok("\n"));
|
||||
$this->__domains[$domain][$this->__lang][$this->category]["%po-header"][strtolower($header)] = $line;
|
||||
$this->_domains[$domain][$this->_lang][$this->category]["%po-header"][strtolower($header)] = $line;
|
||||
}
|
||||
|
||||
if (isset($this->__domains[$domain][$this->__lang][$this->category]["%po-header"]["plural-forms"])) {
|
||||
$switch = preg_replace("/(?:[() {}\\[\\]^\\s*\\]]+)/", "", $this->__domains[$domain][$this->__lang][$this->category]["%po-header"]["plural-forms"]);
|
||||
$this->__domains[$domain][$this->__lang][$this->category]["%plural-c"] = $switch;
|
||||
unset($this->__domains[$domain][$this->__lang][$this->category]["%po-header"]);
|
||||
if (isset($this->_domains[$domain][$this->_lang][$this->category]["%po-header"]["plural-forms"])) {
|
||||
$switch = preg_replace("/(?:[() {}\\[\\]^\\s*\\]]+)/", "", $this->_domains[$domain][$this->_lang][$this->category]["%po-header"]["plural-forms"]);
|
||||
$this->_domains[$domain][$this->_lang][$this->category]["%plural-c"] = $switch;
|
||||
unset($this->_domains[$domain][$this->_lang][$this->category]["%po-header"]);
|
||||
}
|
||||
$this->__domains = Set::pushDiff($this->__domains, $merge);
|
||||
$this->_domains = Set::pushDiff($this->_domains, $merge);
|
||||
|
||||
if (isset($this->__domains[$domain][$this->__lang][$this->category][null])) {
|
||||
unset($this->__domains[$domain][$this->__lang][$this->category][null]);
|
||||
if (isset($this->_domains[$domain][$this->_lang][$this->category][null])) {
|
||||
unset($this->_domains[$domain][$this->_lang][$this->category][null]);
|
||||
}
|
||||
}
|
||||
return $domain;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the binary .mo file for translation and sets the values for this translation in the var I18n::__domains
|
||||
* Loads the binary .mo file for translation and sets the values for this translation in the var I18n::_domains
|
||||
*
|
||||
* @param resource $file Binary .mo file to load
|
||||
* @param string $domain Domain where to load file in
|
||||
* @return void
|
||||
*/
|
||||
private function __loadMo($file, $domain) {
|
||||
protected function _loadMo($file, $domain) {
|
||||
$data = file_get_contents($file);
|
||||
|
||||
if ($data) {
|
||||
|
@ -381,10 +381,10 @@ class I18n {
|
|||
if (strpos($msgstr, "\000")) {
|
||||
$msgstr = explode("\000", $msgstr);
|
||||
}
|
||||
$this->__domains[$domain][$this->__lang][$this->category][$msgid] = $msgstr;
|
||||
$this->_domains[$domain][$this->_lang][$this->category][$msgid] = $msgstr;
|
||||
|
||||
if (isset($msgid_plural)) {
|
||||
$this->__domains[$domain][$this->__lang][$this->category][$msgid_plural] =& $this->__domains[$domain][$this->__lang][$this->category][$msgid];
|
||||
$this->_domains[$domain][$this->_lang][$this->category][$msgid_plural] =& $this->_domains[$domain][$this->_lang][$this->category][$msgid];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -392,13 +392,13 @@ class I18n {
|
|||
}
|
||||
|
||||
/**
|
||||
* Loads the text .po file for translation and sets the values for this translation in the var I18n::__domains
|
||||
* Loads the text .po file for translation and sets the values for this translation in the var I18n::_domains
|
||||
*
|
||||
* @param resource $file Text .po file to load
|
||||
* @param string $domain Domain to load file in
|
||||
* @return array Binded domain elements
|
||||
*/
|
||||
private function __loadPo($file, $domain) {
|
||||
protected function _loadPo($file, $domain) {
|
||||
$type = 0;
|
||||
$translations = array();
|
||||
$translationKey = "";
|
||||
|
@ -458,7 +458,7 @@ class I18n {
|
|||
} while (!feof($file));
|
||||
fclose($file);
|
||||
$merge[""] = $header;
|
||||
return $this->__domains[$domain][$this->__lang][$this->category] = array_merge($merge ,$translations);
|
||||
return $this->_domains[$domain][$this->_lang][$this->category] = array_merge($merge ,$translations);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -468,7 +468,7 @@ class I18n {
|
|||
* @param string $domain Domain where locale definitions will be stored
|
||||
* @return void
|
||||
*/
|
||||
private function __loadLocaleDefinition($file, $domain = null) {
|
||||
protected function _loadLocaleDefinition($file, $domain = null) {
|
||||
$comment = '#';
|
||||
$escape = '\\';
|
||||
$currentToken = false;
|
||||
|
@ -510,14 +510,14 @@ class I18n {
|
|||
$this->__escape = $escape;
|
||||
foreach ($value as $i => $val) {
|
||||
$val = trim($val, '"');
|
||||
$val = preg_replace_callback('/(?:<)?(.[^>]*)(?:>)?/', array(&$this, '__parseLiteralValue'), $val);
|
||||
$val = preg_replace_callback('/(?:<)?(.[^>]*)(?:>)?/', array(&$this, '_parseLiteralValue'), $val);
|
||||
$val = str_replace($replacements, $mustEscape, $val);
|
||||
$value[$i] = $val;
|
||||
}
|
||||
if (count($value) == 1) {
|
||||
$this->__domains[$domain][$this->__lang][$this->category][$currentToken] = array_pop($value);
|
||||
$this->_domains[$domain][$this->_lang][$this->category][$currentToken] = array_pop($value);
|
||||
} else {
|
||||
$this->__domains[$domain][$this->__lang][$this->category][$currentToken] = $value;
|
||||
$this->_domains[$domain][$this->_lang][$this->category][$currentToken] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -528,7 +528,7 @@ class I18n {
|
|||
* @param string $string Symbol to be parsed
|
||||
* @return string parsed symbol
|
||||
*/
|
||||
private function __parseLiteralValue($string) {
|
||||
protected function _parseLiteralValue($string) {
|
||||
$string = $string[1];
|
||||
if (substr($string, 0, 2) === $this->__escape . 'x') {
|
||||
$delimiter = $this->__escape . 'x';
|
||||
|
@ -559,9 +559,9 @@ class I18n {
|
|||
* @param string $domain Domain where format is stored
|
||||
* @return mixed translated format string if only value or array of translated strings for corresponding format.
|
||||
*/
|
||||
private function __translateTime($format, $domain) {
|
||||
if (!empty($this->__domains[$domain][$this->__lang]['LC_TIME'][$format])) {
|
||||
if (($trans = $this->__domains[$domain][$this->__lang][$this->category][$format])) {
|
||||
protected function _translateTime($format, $domain) {
|
||||
if (!empty($this->_domains[$domain][$this->_lang]['LC_TIME'][$format])) {
|
||||
if (($trans = $this->_domains[$domain][$this->_lang][$this->category][$format])) {
|
||||
return $trans;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,11 +84,11 @@ class L10n {
|
|||
public $found = false;
|
||||
|
||||
/**
|
||||
* Maps ISO 639-3 to I10n::__l10nCatalog
|
||||
* Maps ISO 639-3 to I10n::_l10nCatalog
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $__l10nMap = array(/* Afrikaans */ 'afr' => 'af',
|
||||
protected $_l10nMap = array(/* Afrikaans */ 'afr' => 'af',
|
||||
/* Albanian */ 'alb' => 'sq',
|
||||
/* Arabic */ 'ara' => 'ar',
|
||||
/* Armenian - Armenia */ 'hye' => 'hy',
|
||||
|
@ -174,7 +174,7 @@ class L10n {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
private $__l10nCatalog = array('af' => array('language' => 'Afrikaans', 'locale' => 'afr', 'localeFallback' => 'afr', 'charset' => 'utf-8', 'direction' => 'ltr'),
|
||||
protected $_l10nCatalog = array('af' => array('language' => 'Afrikaans', 'locale' => 'afr', 'localeFallback' => 'afr', 'charset' => 'utf-8', 'direction' => 'ltr'),
|
||||
'ar' => array('language' => 'Arabic', 'locale' => 'ara', 'localeFallback' => 'ara', 'charset' => 'utf-8', 'direction' => 'rtl'),
|
||||
'ar-ae' => array('language' => 'Arabic (U.A.E.)', 'locale' => 'ar_ae', 'localeFallback' => 'ara', 'charset' => 'utf-8', 'direction' => 'rtl'),
|
||||
'ar-bh' => array('language' => 'Arabic (Bahrain)', 'locale' => 'ar_bh', 'localeFallback' => 'ara', 'charset' => 'utf-8', 'direction' => 'rtl'),
|
||||
|
@ -326,17 +326,17 @@ class L10n {
|
|||
|
||||
/**
|
||||
* Gets the settings for $language.
|
||||
* If $language is null it attempt to get settings from L10n::__autoLanguage(); if this fails
|
||||
* the method will get the settings from L10n::__setLanguage();
|
||||
* If $language is null it attempt to get settings from L10n::_autoLanguage(); if this fails
|
||||
* the method will get the settings from L10n::_setLanguage();
|
||||
*
|
||||
* @param string $language Language (if null will use DEFAULT_LANGUAGE if defined)
|
||||
* @return mixed
|
||||
*/
|
||||
public function get($language = null) {
|
||||
if ($language !== null) {
|
||||
return $this->__setLanguage($language);
|
||||
} elseif ($this->__autoLanguage() === false) {
|
||||
return $this->__setLanguage();
|
||||
return $this->_setLanguage($language);
|
||||
} elseif ($this->_autoLanguage() === false) {
|
||||
return $this->_setLanguage();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -347,36 +347,36 @@ class L10n {
|
|||
* @param string $language Language (if null will use DEFAULT_LANGUAGE if defined)
|
||||
* @return mixed
|
||||
*/
|
||||
private function __setLanguage($language = null) {
|
||||
protected function _setLanguage($language = null) {
|
||||
$langKey = null;
|
||||
if ($language !== null && isset($this->__l10nMap[$language]) && isset($this->__l10nCatalog[$this->__l10nMap[$language]])) {
|
||||
$langKey = $this->__l10nMap[$language];
|
||||
} else if ($language !== null && isset($this->__l10nCatalog[$language])) {
|
||||
if ($language !== null && isset($this->_l10nMap[$language]) && isset($this->_l10nCatalog[$this->_l10nMap[$language]])) {
|
||||
$langKey = $this->_l10nMap[$language];
|
||||
} else if ($language !== null && isset($this->_l10nCatalog[$language])) {
|
||||
$langKey = $language;
|
||||
} else if (defined('DEFAULT_LANGUAGE')) {
|
||||
$langKey = $language = DEFAULT_LANGUAGE;
|
||||
}
|
||||
|
||||
if ($langKey !== null && isset($this->__l10nCatalog[$langKey])) {
|
||||
$this->language = $this->__l10nCatalog[$langKey]['language'];
|
||||
if ($langKey !== null && isset($this->_l10nCatalog[$langKey])) {
|
||||
$this->language = $this->_l10nCatalog[$langKey]['language'];
|
||||
$this->languagePath = array(
|
||||
$this->__l10nCatalog[$langKey]['locale'],
|
||||
$this->__l10nCatalog[$langKey]['localeFallback']
|
||||
$this->_l10nCatalog[$langKey]['locale'],
|
||||
$this->_l10nCatalog[$langKey]['localeFallback']
|
||||
);
|
||||
$this->lang = $language;
|
||||
$this->locale = $this->__l10nCatalog[$langKey]['locale'];
|
||||
$this->charset = $this->__l10nCatalog[$langKey]['charset'];
|
||||
$this->direction = $this->__l10nCatalog[$langKey]['direction'];
|
||||
$this->locale = $this->_l10nCatalog[$langKey]['locale'];
|
||||
$this->charset = $this->_l10nCatalog[$langKey]['charset'];
|
||||
$this->direction = $this->_l10nCatalog[$langKey]['direction'];
|
||||
} else {
|
||||
$this->lang = $language;
|
||||
$this->languagePath = array($language);
|
||||
}
|
||||
|
||||
if ($this->default) {
|
||||
if (isset($this->__l10nMap[$this->default]) && isset($this->__l10nCatalog[$this->__l10nMap[$this->default]])) {
|
||||
$this->languagePath[] = $this->__l10nCatalog[$this->__l10nMap[$this->default]]['localeFallback'];
|
||||
} else if (isset($this->__l10nCatalog[$this->default])) {
|
||||
$this->languagePath[] = $this->__l10nCatalog[$this->default]['localeFallback'];
|
||||
if (isset($this->_l10nMap[$this->default]) && isset($this->_l10nCatalog[$this->_l10nMap[$this->default]])) {
|
||||
$this->languagePath[] = $this->_l10nCatalog[$this->_l10nMap[$this->default]]['localeFallback'];
|
||||
} else if (isset($this->_l10nCatalog[$this->default])) {
|
||||
$this->languagePath[] = $this->_l10nCatalog[$this->default]['localeFallback'];
|
||||
}
|
||||
}
|
||||
$this->found = true;
|
||||
|
@ -395,16 +395,16 @@ class L10n {
|
|||
*
|
||||
* @return boolean Success
|
||||
*/
|
||||
private function __autoLanguage() {
|
||||
protected function _autoLanguage() {
|
||||
$_detectableLanguages = CakeRequest::acceptLanguage();
|
||||
foreach ($_detectableLanguages as $key => $langKey) {
|
||||
if (isset($this->__l10nCatalog[$langKey])) {
|
||||
$this->__setLanguage($langKey);
|
||||
if (isset($this->_l10nCatalog[$langKey])) {
|
||||
$this->_setLanguage($langKey);
|
||||
return true;
|
||||
} else if (strpos($langKey, '-') !== false) {
|
||||
$langKey = substr($langKey, 0, 2);
|
||||
if (isset($this->__l10nCatalog[$langKey])) {
|
||||
$this->__setLanguage($langKey);
|
||||
if (isset($this->_l10nCatalog[$langKey])) {
|
||||
$this->_setLanguage($langKey);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -429,14 +429,14 @@ class L10n {
|
|||
}
|
||||
return $result;
|
||||
} else if (is_string($mixed)) {
|
||||
if (strlen($mixed) === 2 && in_array($mixed, $this->__l10nMap)) {
|
||||
return array_search($mixed, $this->__l10nMap);
|
||||
} else if (isset($this->__l10nMap[$mixed])) {
|
||||
return $this->__l10nMap[$mixed];
|
||||
if (strlen($mixed) === 2 && in_array($mixed, $this->_l10nMap)) {
|
||||
return array_search($mixed, $this->_l10nMap);
|
||||
} else if (isset($this->_l10nMap[$mixed])) {
|
||||
return $this->_l10nMap[$mixed];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return $this->__l10nMap;
|
||||
return $this->_l10nMap;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -456,13 +456,13 @@ class L10n {
|
|||
}
|
||||
return $result;
|
||||
} else if (is_string($language)) {
|
||||
if (isset($this->__l10nCatalog[$language])) {
|
||||
return $this->__l10nCatalog[$language];
|
||||
} else if (isset($this->__l10nMap[$language]) && isset($this->__l10nCatalog[$this->__l10nMap[$language]])) {
|
||||
return $this->__l10nCatalog[$this->__l10nMap[$language]];
|
||||
if (isset($this->_l10nCatalog[$language])) {
|
||||
return $this->_l10nCatalog[$language];
|
||||
} else if (isset($this->_l10nMap[$language]) && isset($this->_l10nCatalog[$this->_l10nMap[$language]])) {
|
||||
return $this->_l10nCatalog[$this->_l10nMap[$language]];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return $this->__l10nCatalog;
|
||||
return $this->_l10nCatalog;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -258,21 +258,21 @@ class Multibyte {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $__caseFold = array();
|
||||
protected static $_caseFold = array();
|
||||
|
||||
/**
|
||||
* Holds an array of Unicode code point ranges
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $__codeRange = array();
|
||||
protected static $_codeRange = array();
|
||||
|
||||
/**
|
||||
* Holds the current code point range
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private static $__table = null;
|
||||
protected static $_table = null;
|
||||
|
||||
/**
|
||||
* Converts a multibyte character string
|
||||
|
@ -780,7 +780,7 @@ class Multibyte {
|
|||
$matched = true;
|
||||
} else {
|
||||
$matched = false;
|
||||
$keys = self::__find($char, 'upper');
|
||||
$keys = self::_find($char, 'upper');
|
||||
|
||||
if (!empty($keys)) {
|
||||
foreach ($keys as $key => $value) {
|
||||
|
@ -826,7 +826,7 @@ class Multibyte {
|
|||
|
||||
} else {
|
||||
$matched = false;
|
||||
$keys = self::__find($char);
|
||||
$keys = self::_find($char);
|
||||
$keyCount = count($keys);
|
||||
|
||||
if (!empty($keys)) {
|
||||
|
@ -1006,7 +1006,7 @@ class Multibyte {
|
|||
* @param integer $decimal
|
||||
* @return string
|
||||
*/
|
||||
private static function __codepoint($decimal) {
|
||||
protected static function _codepoint($decimal) {
|
||||
if ($decimal > 128 && $decimal < 256) {
|
||||
$return = '0080_00ff'; // Latin-1 Supplement
|
||||
} elseif ($decimal < 384) {
|
||||
|
@ -1044,7 +1044,7 @@ class Multibyte {
|
|||
} else {
|
||||
$return = false;
|
||||
}
|
||||
self::$__codeRange[$decimal] = $return;
|
||||
self::$_codeRange[$decimal] = $return;
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
@ -1055,10 +1055,10 @@ class Multibyte {
|
|||
* @param string $type
|
||||
* @return array
|
||||
*/
|
||||
private static function __find($char, $type = 'lower') {
|
||||
protected static function _find($char, $type = 'lower') {
|
||||
$found = array();
|
||||
if (!isset(self::$__codeRange[$char])) {
|
||||
$range = self::__codepoint($char);
|
||||
if (!isset(self::$_codeRange[$char])) {
|
||||
$range = self::_codepoint($char);
|
||||
if ($range === false) {
|
||||
return null;
|
||||
}
|
||||
|
@ -1067,21 +1067,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);
|
||||
self::$_caseFold[$range] = Configure::read($range);
|
||||
Configure::delete($range);
|
||||
}
|
||||
|
||||
if (!self::$__codeRange[$char]) {
|
||||
if (!self::$_codeRange[$char]) {
|
||||
return null;
|
||||
}
|
||||
self::$__table = self::$__codeRange[$char];
|
||||
$count = count(self::$__caseFold[self::$__table]);
|
||||
self::$_table = self::$_codeRange[$char];
|
||||
$count = count(self::$_caseFold[self::$_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' && 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];
|
||||
}
|
||||
}
|
||||
return $found;
|
||||
|
|
|
@ -33,7 +33,7 @@ class AclBehavior extends ModelBehavior {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
private $__typeMaps = array('requester' => 'Aro', 'controlled' => 'Aco', 'both' => array('Aro', 'Aco'));
|
||||
protected $_typeMaps = array('requester' => 'Aro', 'controlled' => 'Aco', 'both' => array('Aro', 'Aco'));
|
||||
|
||||
/**
|
||||
* Sets up the configuation for the model, and loads ACL models if they haven't been already
|
||||
|
@ -49,7 +49,7 @@ class AclBehavior extends ModelBehavior {
|
|||
$this->settings[$model->name] = array_merge(array('type' => 'controlled'), (array)$config);
|
||||
$this->settings[$model->name]['type'] = strtolower($this->settings[$model->name]['type']);
|
||||
|
||||
$types = $this->__typeMaps[$this->settings[$model->name]['type']];
|
||||
$types = $this->_typeMaps[$this->settings[$model->name]['type']];
|
||||
|
||||
if (!is_array($types)) {
|
||||
$types = array($types);
|
||||
|
@ -73,7 +73,7 @@ class AclBehavior extends ModelBehavior {
|
|||
*/
|
||||
public function node($model, $ref = null, $type = null) {
|
||||
if (empty($type)) {
|
||||
$type = $this->__typeMaps[$this->settings[$model->name]['type']];
|
||||
$type = $this->_typeMaps[$this->settings[$model->name]['type']];
|
||||
if (is_array($type)) {
|
||||
trigger_error(__d('cake_dev', 'AclBehavior is setup with more then one type, please specify type parameter for node()'), E_USER_WARNING);
|
||||
return null;
|
||||
|
@ -93,7 +93,7 @@ class AclBehavior extends ModelBehavior {
|
|||
* @return void
|
||||
*/
|
||||
public function afterSave($model, $created) {
|
||||
$types = $this->__typeMaps[$this->settings[$model->name]['type']];
|
||||
$types = $this->_typeMaps[$this->settings[$model->name]['type']];
|
||||
if (!is_array($types)) {
|
||||
$types = array($types);
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ class AclBehavior extends ModelBehavior {
|
|||
* @return void
|
||||
*/
|
||||
public function afterDelete($model) {
|
||||
$types = $this->__typeMaps[$this->settings[$model->name]['type']];
|
||||
$types = $this->_typeMaps[$this->settings[$model->name]['type']];
|
||||
if (!is_array($types)) {
|
||||
$types = array($types);
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ class TreeBehavior extends ModelBehavior {
|
|||
$scope[]["{$Model->alias}.{$left} BETWEEN ? AND ?"] = array($data[$left] + 1, $data[$right] - 1);
|
||||
$Model->deleteAll($scope);
|
||||
}
|
||||
$this->__sync($Model, $diff, '-', '> ' . $data[$right]);
|
||||
$this->_sync($Model, $diff, '-', '> ' . $data[$right]);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ class TreeBehavior extends ModelBehavior {
|
|||
$Model->data[$Model->alias][$left] = 0; //$parentNode[$right];
|
||||
$Model->data[$Model->alias][$right] = 0; //$parentNode[$right] + 1;
|
||||
} else {
|
||||
$edge = $this->__getMax($Model, $scope, $right, $recursive);
|
||||
$edge = $this->_getMax($Model, $scope, $right, $recursive);
|
||||
$Model->data[$Model->alias][$left] = $edge + 1;
|
||||
$Model->data[$Model->alias][$right] = $edge + 2;
|
||||
}
|
||||
|
@ -464,10 +464,10 @@ class TreeBehavior extends ModelBehavior {
|
|||
} else {
|
||||
return false;
|
||||
}
|
||||
$edge = $this->__getMax($Model, $scope, $right, $recursive);
|
||||
$this->__sync($Model, $edge - $node[$left] + 1, '+', 'BETWEEN ' . $node[$left] . ' AND ' . $node[$right]);
|
||||
$this->__sync($Model, $nextNode[$left] - $node[$left], '-', 'BETWEEN ' . $nextNode[$left] . ' AND ' . $nextNode[$right]);
|
||||
$this->__sync($Model, $edge - $node[$left] - ($nextNode[$right] - $nextNode[$left]), '-', '> ' . $edge);
|
||||
$edge = $this->_getMax($Model, $scope, $right, $recursive);
|
||||
$this->_sync($Model, $edge - $node[$left] + 1, '+', 'BETWEEN ' . $node[$left] . ' AND ' . $node[$right]);
|
||||
$this->_sync($Model, $nextNode[$left] - $node[$left], '-', 'BETWEEN ' . $nextNode[$left] . ' AND ' . $nextNode[$right]);
|
||||
$this->_sync($Model, $edge - $node[$left] - ($nextNode[$right] - $nextNode[$left]), '-', '> ' . $edge);
|
||||
|
||||
if (is_int($number)) {
|
||||
$number--;
|
||||
|
@ -524,10 +524,10 @@ class TreeBehavior extends ModelBehavior {
|
|||
} else {
|
||||
return false;
|
||||
}
|
||||
$edge = $this->__getMax($Model, $scope, $right, $recursive);
|
||||
$this->__sync($Model, $edge - $previousNode[$left] +1, '+', 'BETWEEN ' . $previousNode[$left] . ' AND ' . $previousNode[$right]);
|
||||
$this->__sync($Model, $node[$left] - $previousNode[$left], '-', 'BETWEEN ' .$node[$left] . ' AND ' . $node[$right]);
|
||||
$this->__sync($Model, $edge - $previousNode[$left] - ($node[$right] - $node[$left]), '-', '> ' . $edge);
|
||||
$edge = $this->_getMax($Model, $scope, $right, $recursive);
|
||||
$this->_sync($Model, $edge - $previousNode[$left] +1, '+', 'BETWEEN ' . $previousNode[$left] . ' AND ' . $previousNode[$right]);
|
||||
$this->_sync($Model, $node[$left] - $previousNode[$left], '-', 'BETWEEN ' .$node[$left] . ' AND ' . $node[$right]);
|
||||
$this->_sync($Model, $edge - $previousNode[$left] - ($node[$right] - $node[$left]), '-', '> ' . $edge);
|
||||
if (is_int($number)) {
|
||||
$number--;
|
||||
}
|
||||
|
@ -706,8 +706,8 @@ class TreeBehavior extends ModelBehavior {
|
|||
array($parent => $db->value($node[$parent], $parent)),
|
||||
array($Model->escapeField($parent) => $node[$Model->primaryKey])
|
||||
);
|
||||
$this->__sync($Model, 1, '-', 'BETWEEN ' . ($node[$left] + 1) . ' AND ' . ($node[$right] - 1));
|
||||
$this->__sync($Model, 2, '-', '> ' . ($node[$right]));
|
||||
$this->_sync($Model, 1, '-', 'BETWEEN ' . ($node[$left] + 1) . ' AND ' . ($node[$right] - 1));
|
||||
$this->_sync($Model, 2, '-', '> ' . ($node[$right]));
|
||||
$Model->id = $id;
|
||||
|
||||
if ($delete) {
|
||||
|
@ -721,7 +721,7 @@ class TreeBehavior extends ModelBehavior {
|
|||
);
|
||||
return $Model->delete($id);
|
||||
} else {
|
||||
$edge = $this->__getMax($Model, $scope, $right, $recursive);
|
||||
$edge = $this->_getMax($Model, $scope, $right, $recursive);
|
||||
if ($node[$right] == $edge) {
|
||||
$edge = $edge - 2;
|
||||
}
|
||||
|
@ -748,8 +748,8 @@ class TreeBehavior extends ModelBehavior {
|
|||
if (!$Model->find('count', array('conditions' => $scope))) {
|
||||
return true;
|
||||
}
|
||||
$min = $this->__getMin($Model, $scope, $left, $recursive);
|
||||
$edge = $this->__getMax($Model, $scope, $right, $recursive);
|
||||
$min = $this->_getMin($Model, $scope, $left, $recursive);
|
||||
$edge = $this->_getMax($Model, $scope, $right, $recursive);
|
||||
$errors = array();
|
||||
|
||||
for ($i = $min; $i <= $edge; $i++) {
|
||||
|
@ -822,11 +822,11 @@ class TreeBehavior extends ModelBehavior {
|
|||
'fields' => array($Model->primaryKey, $parent, $left, $right),
|
||||
'recursive' => $recursive
|
||||
)));
|
||||
$edge = $this->__getMax($Model, $scope, $right, $recursive, $created);
|
||||
$edge = $this->_getMax($Model, $scope, $right, $recursive, $created);
|
||||
|
||||
if (empty ($parentId)) {
|
||||
$this->__sync($Model, $edge - $node[$left] + 1, '+', 'BETWEEN ' . $node[$left] . ' AND ' . $node[$right], $created);
|
||||
$this->__sync($Model, $node[$right] - $node[$left] + 1, '-', '> ' . $node[$left], $created);
|
||||
$this->_sync($Model, $edge - $node[$left] + 1, '+', 'BETWEEN ' . $node[$left] . ' AND ' . $node[$right], $created);
|
||||
$this->_sync($Model, $node[$right] - $node[$left] + 1, '-', '> ' . $node[$left], $created);
|
||||
} else {
|
||||
$values = $Model->find('first', array(
|
||||
'conditions' => array($scope, $Model->escapeField() => $parentId),
|
||||
|
@ -851,27 +851,27 @@ class TreeBehavior extends ModelBehavior {
|
|||
return false;
|
||||
}
|
||||
if (empty ($node[$left]) && empty ($node[$right])) {
|
||||
$this->__sync($Model, 2, '+', '>= ' . $parentNode[$right], $created);
|
||||
$this->_sync($Model, 2, '+', '>= ' . $parentNode[$right], $created);
|
||||
$result = $Model->save(
|
||||
array($left => $parentNode[$right], $right => $parentNode[$right] + 1, $parent => $parentId),
|
||||
array('validate' => false, 'callbacks' => false)
|
||||
);
|
||||
$Model->data = $result;
|
||||
} else {
|
||||
$this->__sync($Model, $edge - $node[$left] +1, '+', 'BETWEEN ' . $node[$left] . ' AND ' . $node[$right], $created);
|
||||
$this->_sync($Model, $edge - $node[$left] +1, '+', 'BETWEEN ' . $node[$left] . ' AND ' . $node[$right], $created);
|
||||
$diff = $node[$right] - $node[$left] + 1;
|
||||
|
||||
if ($node[$left] > $parentNode[$left]) {
|
||||
if ($node[$right] < $parentNode[$right]) {
|
||||
$this->__sync($Model, $diff, '-', 'BETWEEN ' . $node[$right] . ' AND ' . ($parentNode[$right] - 1), $created);
|
||||
$this->__sync($Model, $edge - $parentNode[$right] + $diff + 1, '-', '> ' . $edge, $created);
|
||||
$this->_sync($Model, $diff, '-', 'BETWEEN ' . $node[$right] . ' AND ' . ($parentNode[$right] - 1), $created);
|
||||
$this->_sync($Model, $edge - $parentNode[$right] + $diff + 1, '-', '> ' . $edge, $created);
|
||||
} else {
|
||||
$this->__sync($Model, $diff, '+', 'BETWEEN ' . $parentNode[$right] . ' AND ' . $node[$right], $created);
|
||||
$this->__sync($Model, $edge - $parentNode[$right] + 1, '-', '> ' . $edge, $created);
|
||||
$this->_sync($Model, $diff, '+', 'BETWEEN ' . $parentNode[$right] . ' AND ' . $node[$right], $created);
|
||||
$this->_sync($Model, $edge - $parentNode[$right] + 1, '-', '> ' . $edge, $created);
|
||||
}
|
||||
} else {
|
||||
$this->__sync($Model, $diff, '-', 'BETWEEN ' . $node[$right] . ' AND ' . ($parentNode[$right] - 1), $created);
|
||||
$this->__sync($Model, $edge - $parentNode[$right] + $diff + 1, '-', '> ' . $edge, $created);
|
||||
$this->_sync($Model, $diff, '-', 'BETWEEN ' . $node[$right] . ' AND ' . ($parentNode[$right] - 1), $created);
|
||||
$this->_sync($Model, $edge - $parentNode[$right] + $diff + 1, '-', '> ' . $edge, $created);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -888,7 +888,7 @@ class TreeBehavior extends ModelBehavior {
|
|||
* @param boolean $created
|
||||
* @return integer
|
||||
*/
|
||||
private function __getMax($Model, $scope, $right, $recursive = -1, $created = false) {
|
||||
protected function _getMax($Model, $scope, $right, $recursive = -1, $created = false) {
|
||||
$db = ConnectionManager::getDataSource($Model->useDbConfig);
|
||||
if ($created) {
|
||||
if (is_string($scope)) {
|
||||
|
@ -916,7 +916,7 @@ class TreeBehavior extends ModelBehavior {
|
|||
* @param integer $recursive
|
||||
* @return integer
|
||||
*/
|
||||
private function __getMin($Model, $scope, $left, $recursive = -1) {
|
||||
protected function _getMin($Model, $scope, $left, $recursive = -1) {
|
||||
$db = ConnectionManager::getDataSource($Model->useDbConfig);
|
||||
$name = $Model->alias . '.' . $left;
|
||||
list($edge) = array_values($Model->find('first', array(
|
||||
|
@ -940,13 +940,13 @@ class TreeBehavior extends ModelBehavior {
|
|||
* @param string $field
|
||||
* @return void
|
||||
*/
|
||||
private function __sync($Model, $shift, $dir = '+', $conditions = array(), $created = false, $field = 'both') {
|
||||
protected function _sync($Model, $shift, $dir = '+', $conditions = array(), $created = false, $field = 'both') {
|
||||
$ModelRecursive = $Model->recursive;
|
||||
extract($this->settings[$Model->alias]);
|
||||
$Model->recursive = $recursive;
|
||||
|
||||
if ($field == 'both') {
|
||||
$this->__sync($Model, $shift, $dir, $conditions, $created, $left);
|
||||
$this->_sync($Model, $shift, $dir, $conditions, $created, $left);
|
||||
$field = $right;
|
||||
}
|
||||
if (is_string($conditions)) {
|
||||
|
|
|
@ -54,14 +54,14 @@ class ConnectionManager {
|
|||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private static $_init = false;
|
||||
protected static $_init = false;
|
||||
|
||||
/**
|
||||
* Loads connections configuration.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private static function init() {
|
||||
protected static function _init() {
|
||||
include_once APP . 'Config' . DS . 'database.php';
|
||||
if (class_exists('DATABASE_CONFIG')) {
|
||||
self::$config = new DATABASE_CONFIG();
|
||||
|
@ -80,7 +80,7 @@ class ConnectionManager {
|
|||
*/
|
||||
public static function getDataSource($name) {
|
||||
if (empty(self::$_init)) {
|
||||
self::init();
|
||||
self::_init();
|
||||
}
|
||||
|
||||
if (!empty(self::$_dataSources[$name])) {
|
||||
|
@ -111,7 +111,7 @@ class ConnectionManager {
|
|||
*/
|
||||
public static function sourceList() {
|
||||
if (empty(self::$_init)) {
|
||||
self::init();
|
||||
self::_init();
|
||||
}
|
||||
return array_keys(self::$_dataSources);
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ class ConnectionManager {
|
|||
*/
|
||||
public static function getSourceName($source) {
|
||||
if (empty(self::$_init)) {
|
||||
self::init();
|
||||
self::_init();
|
||||
}
|
||||
foreach (self::$_dataSources as $name => $ds) {
|
||||
if ($ds === $source) {
|
||||
|
@ -146,7 +146,7 @@ class ConnectionManager {
|
|||
*/
|
||||
public static function loadDataSource($connName) {
|
||||
if (empty(self::$_init)) {
|
||||
self::init();
|
||||
self::_init();
|
||||
}
|
||||
|
||||
if (is_array($connName)) {
|
||||
|
@ -182,7 +182,7 @@ class ConnectionManager {
|
|||
*/
|
||||
public static function enumConnectionObjects() {
|
||||
if (empty(self::$_init)) {
|
||||
self::init();
|
||||
self::_init();
|
||||
}
|
||||
return (array) self::$config;
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ class ConnectionManager {
|
|||
*/
|
||||
public static function create($name = '', $config = array()) {
|
||||
if (empty(self::$_init)) {
|
||||
self::init();
|
||||
self::_init();
|
||||
}
|
||||
|
||||
if (empty($name) || empty($config) || array_key_exists($name, self::$_connectionsEnum)) {
|
||||
|
@ -216,7 +216,7 @@ class ConnectionManager {
|
|||
*/
|
||||
public static function drop($name) {
|
||||
if (empty(self::$_init)) {
|
||||
self::init();
|
||||
self::_init();
|
||||
}
|
||||
|
||||
if (!isset(self::$config->{$name})) {
|
||||
|
@ -247,7 +247,7 @@ class ConnectionManager {
|
|||
* @param array $config Array with connection configuration. Key 'datasource' is required
|
||||
* @return array An indexed array with: filename, classname, plugin and parent
|
||||
*/
|
||||
private static function _connectionData($config) {
|
||||
protected static function _connectionData($config) {
|
||||
$package = $classname = $plugin = null;
|
||||
|
||||
list($plugin, $classname) = pluginSplit($config['datasource']);
|
||||
|
|
|
@ -252,10 +252,10 @@ class CakeSession {
|
|||
*/
|
||||
public static function delete($name) {
|
||||
if (self::check($name)) {
|
||||
self::__overwrite($_SESSION, Set::remove($_SESSION, $name));
|
||||
self::_overwrite($_SESSION, Set::remove($_SESSION, $name));
|
||||
return (self::check($name) == false);
|
||||
}
|
||||
self::__setError(2, __d('cake_dev', "%s doesn't exist", $name));
|
||||
self::_setError(2, __d('cake_dev', "%s doesn't exist", $name));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -266,7 +266,7 @@ class CakeSession {
|
|||
* @param array $new New set of variable => value
|
||||
* @return void
|
||||
*/
|
||||
private static function __overwrite(&$old, $new) {
|
||||
protected static function _overwrite(&$old, $new) {
|
||||
if (!empty($old)) {
|
||||
foreach ($old as $key => $var) {
|
||||
if (!isset($new[$key])) {
|
||||
|
@ -285,7 +285,7 @@ class CakeSession {
|
|||
* @param integer $errorNumber Error to set
|
||||
* @return string Error as string
|
||||
*/
|
||||
private static function __error($errorNumber) {
|
||||
protected static function _error($errorNumber) {
|
||||
if (!is_array(self::$error) || !array_key_exists($errorNumber, self::$error)) {
|
||||
return false;
|
||||
} else {
|
||||
|
@ -300,7 +300,7 @@ class CakeSession {
|
|||
*/
|
||||
public static function error() {
|
||||
if (self::$lastError) {
|
||||
return self::__error(self::$lastError);
|
||||
return self::_error(self::$lastError);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -316,7 +316,7 @@ class CakeSession {
|
|||
self::$valid = true;
|
||||
} else {
|
||||
self::$valid = false;
|
||||
self::__setError(1, 'Session Highjacking Attempted !!!');
|
||||
self::_setError(1, 'Session Highjacking Attempted !!!');
|
||||
}
|
||||
}
|
||||
return self::$valid;
|
||||
|
@ -363,7 +363,7 @@ class CakeSession {
|
|||
return false;
|
||||
}
|
||||
if (is_null($name)) {
|
||||
return self::__returnSessionVars();
|
||||
return self::_returnSessionVars();
|
||||
}
|
||||
if (empty($name)) {
|
||||
return false;
|
||||
|
@ -373,7 +373,7 @@ class CakeSession {
|
|||
if (!is_null($result)) {
|
||||
return $result;
|
||||
}
|
||||
self::__setError(2, "$name doesn't exist");
|
||||
self::_setError(2, "$name doesn't exist");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -382,11 +382,11 @@ class CakeSession {
|
|||
*
|
||||
* @return mixed Full $_SESSION array, or false on error.
|
||||
*/
|
||||
private static function __returnSessionVars() {
|
||||
protected static function _returnSessionVars() {
|
||||
if (!empty($_SESSION)) {
|
||||
return $_SESSION;
|
||||
}
|
||||
self::__setError(2, 'No Session vars set');
|
||||
self::_setError(2, 'No Session vars set');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -409,7 +409,7 @@ class CakeSession {
|
|||
$write = array($name => $value);
|
||||
}
|
||||
foreach ($write as $key => $val) {
|
||||
self::__overwrite($_SESSION, Set::insert($_SESSION, $key, $val));
|
||||
self::_overwrite($_SESSION, Set::insert($_SESSION, $key, $val));
|
||||
if (Set::classicExtract($_SESSION, $key) !== $val) {
|
||||
return false;
|
||||
}
|
||||
|
@ -650,7 +650,7 @@ class CakeSession {
|
|||
} else {
|
||||
self::destroy();
|
||||
self::$valid = false;
|
||||
self::__setError(1, 'Session Highjacking Attempted !!!');
|
||||
self::_setError(1, 'Session Highjacking Attempted !!!');
|
||||
}
|
||||
} else {
|
||||
self::write('Config.userAgent', self::$_userAgent);
|
||||
|
@ -681,7 +681,7 @@ class CakeSession {
|
|||
* @param string $errorMessage Description of the error
|
||||
* @return void
|
||||
*/
|
||||
private static function __setError($errorNumber, $errorMessage) {
|
||||
protected static function _setError($errorNumber, $errorMessage) {
|
||||
if (self::$error === false) {
|
||||
self::$error = array();
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ class DataSource extends Object {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
private $__descriptions = array();
|
||||
protected $_descriptions = array();
|
||||
|
||||
/**
|
||||
* Holds a list of sources (tables) contained in the DataSource
|
||||
|
@ -123,13 +123,13 @@ class DataSource extends Object {
|
|||
}
|
||||
$table = $model->tablePrefix . $model->table;
|
||||
|
||||
if (isset($this->__descriptions[$table])) {
|
||||
return $this->__descriptions[$table];
|
||||
if (isset($this->_descriptions[$table])) {
|
||||
return $this->_descriptions[$table];
|
||||
}
|
||||
$cache = $this->__cacheDescription($table);
|
||||
|
||||
if ($cache !== null) {
|
||||
$this->__descriptions[$table] =& $cache;
|
||||
$this->_descriptions[$table] =& $cache;
|
||||
return $cache;
|
||||
}
|
||||
return null;
|
||||
|
@ -293,7 +293,7 @@ class DataSource extends Object {
|
|||
}
|
||||
|
||||
if ($data !== null) {
|
||||
$this->__descriptions[$object] =& $data;
|
||||
$this->_descriptions[$object] =& $data;
|
||||
}
|
||||
|
||||
$key = ConnectionManager::getSourceName($this) . '_' . $object;
|
||||
|
|
|
@ -52,7 +52,7 @@ class DboOracle extends DboSource {
|
|||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $__transactionStarted = false;
|
||||
protected $_transactionStarted = false;
|
||||
|
||||
/**
|
||||
* Column definitions
|
||||
|
@ -334,7 +334,7 @@ class DboOracle extends DboSource {
|
|||
return false;
|
||||
}
|
||||
|
||||
if ($this->__transactionStarted) {
|
||||
if ($this->_transactionStarted) {
|
||||
$mode = OCI_DEFAULT;
|
||||
} else {
|
||||
$mode = OCI_COMMIT_ON_SUCCESS;
|
||||
|
@ -753,7 +753,7 @@ class DboOracle extends DboSource {
|
|||
* (i.e. if the database/model does not support transactions).
|
||||
*/
|
||||
public function begin() {
|
||||
$this->__transactionStarted = true;
|
||||
$this->_transactionStarted = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -776,7 +776,7 @@ class DboOracle extends DboSource {
|
|||
* or a transaction has not started).
|
||||
*/
|
||||
public function commit() {
|
||||
$this->__transactionStarted = false;
|
||||
$this->_transactionStarted = false;
|
||||
return ocicommit($this->connection);
|
||||
}
|
||||
|
||||
|
|
|
@ -382,7 +382,7 @@ class Postgres extends DboSource {
|
|||
$fields[$i] = $prepend . $this->name($build[0]) . '.' . $this->name($build[1]) . ' AS ' . $this->name($build[0] . '__' . $build[1]);
|
||||
}
|
||||
} else {
|
||||
$fields[$i] = preg_replace_callback('/\(([\s\.\w]+)\)/', array(&$this, '__quoteFunctionField'), $fields[$i]);
|
||||
$fields[$i] = preg_replace_callback('/\(([\s\.\w]+)\)/', array(&$this, '_quoteFunctionField'), $fields[$i]);
|
||||
}
|
||||
$result[] = $fields[$i];
|
||||
}
|
||||
|
@ -397,7 +397,7 @@ class Postgres extends DboSource {
|
|||
* @param string $match matched string
|
||||
* @return string quoted strig
|
||||
*/
|
||||
private function __quoteFunctionField($match) {
|
||||
protected function _quoteFunctionField($match) {
|
||||
$prepend = '';
|
||||
if (strpos($match[1], 'DISTINCT') !== false) {
|
||||
$prepend = 'DISTINCT ';
|
||||
|
|
|
@ -108,13 +108,6 @@ class Sqlserver extends DboSource {
|
|||
'rollback' => 'ROLLBACK'
|
||||
);
|
||||
|
||||
/**
|
||||
* Define if the last query had error
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $__lastQueryHadError = false;
|
||||
|
||||
/**
|
||||
* Magic column name used to provide pagination support for SQLServer 2008
|
||||
* which lacks proper limit/offset support.
|
||||
|
|
|
@ -181,7 +181,7 @@ class DboSource extends DataSource {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
private $__sqlOps = array('like', 'ilike', 'or', 'not', 'in', 'between', 'regexp', 'similar to');
|
||||
protected $_sqlOps = array('like', 'ilike', 'or', 'not', 'in', 'between', 'regexp', 'similar to');
|
||||
|
||||
/**
|
||||
* Indicates the level of nested transactions
|
||||
|
@ -1200,7 +1200,7 @@ class DboSource extends DataSource {
|
|||
}
|
||||
}
|
||||
$this->_filterResults($fetch, $model);
|
||||
return $this->__mergeHasMany($resultSet, $fetch, $association, $model, $linkModel);
|
||||
return $this->_mergeHasMany($resultSet, $fetch, $association, $model, $linkModel);
|
||||
} elseif ($type === 'hasAndBelongsToMany') {
|
||||
$ins = $fetch = array();
|
||||
foreach ($resultSet as &$result) {
|
||||
|
@ -1322,7 +1322,7 @@ class DboSource extends DataSource {
|
|||
* @param Model $linkModel Model being merged
|
||||
* @return void
|
||||
*/
|
||||
private function __mergeHasMany(&$resultSet, $merge, $association, $model, $linkModel) {
|
||||
protected function _mergeHasMany(&$resultSet, $merge, $association, $model, $linkModel) {
|
||||
$modelAlias = $model->alias;
|
||||
$modelPK = $model->primaryKey;
|
||||
$modelFK = $model->hasMany[$association]['foreignKey'];
|
||||
|
@ -1501,7 +1501,7 @@ class DboSource extends DataSource {
|
|||
switch ($type) {
|
||||
case 'hasOne':
|
||||
case 'belongsTo':
|
||||
$conditions = $this->__mergeConditions(
|
||||
$conditions = $this->_mergeConditions(
|
||||
$assocData['conditions'],
|
||||
$this->getConstraint($type, $model, $linkModel, $association, array_merge($assocData, compact('external', 'self')))
|
||||
);
|
||||
|
@ -1547,7 +1547,7 @@ class DboSource extends DataSource {
|
|||
$assocData['fields'] = array_merge($assocData['fields'], $this->fields($linkModel, $association, array("{$association}.{$assocData['foreignKey']}")));
|
||||
}
|
||||
$query = array(
|
||||
'conditions' => $this->__mergeConditions($this->getConstraint('hasMany', $model, $linkModel, $association, $assocData), $assocData['conditions']),
|
||||
'conditions' => $this->_mergeConditions($this->getConstraint('hasMany', $model, $linkModel, $association, $assocData), $assocData['conditions']),
|
||||
'fields' => array_unique($assocData['fields']),
|
||||
'table' => $this->fullTableName($linkModel),
|
||||
'alias' => $association,
|
||||
|
@ -1753,7 +1753,7 @@ class DboSource extends DataSource {
|
|||
* @param mixed $assoc
|
||||
* @return array
|
||||
*/
|
||||
private function __mergeConditions($query, $assoc) {
|
||||
protected function _mergeConditions($query, $assoc) {
|
||||
if (empty($assoc)) {
|
||||
return $query;
|
||||
}
|
||||
|
@ -1945,7 +1945,7 @@ class DboSource extends DataSource {
|
|||
'alias' => $assoc,
|
||||
'type' => isset($assocData['type']) ? $assocData['type'] : 'LEFT',
|
||||
'conditions' => trim($this->conditions(
|
||||
$this->__mergeConditions($assocData['conditions'], $this->getConstraint($assocData['association'], $model, $model->{$assoc}, $assoc, $assocData)),
|
||||
$this->_mergeConditions($assocData['conditions'], $this->getConstraint($assocData['association'], $model, $model->{$assoc}, $assoc, $assocData)),
|
||||
true, false, $model
|
||||
))
|
||||
));
|
||||
|
@ -1974,7 +1974,7 @@ class DboSource extends DataSource {
|
|||
$params[1] = 'count';
|
||||
}
|
||||
if (is_object($model) && $model->isVirtualField($params[0])){
|
||||
$arg = $this->__quoteFields($model->getVirtualField($params[0]));
|
||||
$arg = $this->_quoteFields($model->getVirtualField($params[0]));
|
||||
} else {
|
||||
$arg = $this->name($params[0]);
|
||||
}
|
||||
|
@ -1985,7 +1985,7 @@ class DboSource extends DataSource {
|
|||
$params[1] = $params[0];
|
||||
}
|
||||
if (is_object($model) && $model->isVirtualField($params[0])) {
|
||||
$arg = $this->__quoteFields($model->getVirtualField($params[0]));
|
||||
$arg = $this->_quoteFields($model->getVirtualField($params[0]));
|
||||
} else {
|
||||
$arg = $this->name($params[0]);
|
||||
}
|
||||
|
@ -2143,7 +2143,7 @@ class DboSource extends DataSource {
|
|||
$virtual = array();
|
||||
foreach ($fields as $field) {
|
||||
$virtualField = $this->name($alias . $this->virtualFieldSeparator . $field);
|
||||
$expression = $this->__quoteFields($model->getVirtualField($field));
|
||||
$expression = $this->_quoteFields($model->getVirtualField($field));
|
||||
$virtual[] = '(' . $expression . ") {$this->alias} {$virtualField}";
|
||||
}
|
||||
return $virtual;
|
||||
|
@ -2306,7 +2306,7 @@ class DboSource extends DataSource {
|
|||
if (preg_match($clauses, $conditions, $match)) {
|
||||
$clause = '';
|
||||
}
|
||||
$conditions = $this->__quoteFields($conditions);
|
||||
$conditions = $this->_quoteFields($conditions);
|
||||
return $clause . $conditions;
|
||||
}
|
||||
|
||||
|
@ -2337,7 +2337,7 @@ class DboSource extends DataSource {
|
|||
if (is_numeric($key) && empty($value)) {
|
||||
continue;
|
||||
} elseif (is_numeric($key) && is_string($value)) {
|
||||
$out[] = $not . $this->__quoteFields($value);
|
||||
$out[] = $not . $this->_quoteFields($value);
|
||||
} elseif ((is_numeric($key) && is_array($value)) || in_array(strtolower(trim($key)), $bool)) {
|
||||
if (in_array(strtolower(trim($key)), $bool)) {
|
||||
$join = ' ' . strtoupper($key) . ' ';
|
||||
|
@ -2378,9 +2378,9 @@ class DboSource extends DataSource {
|
|||
if ($keys === array_values($keys)) {
|
||||
$count = count($value);
|
||||
if ($count === 1) {
|
||||
$data = $this->__quoteFields($key) . ' = (';
|
||||
$data = $this->_quoteFields($key) . ' = (';
|
||||
} else {
|
||||
$data = $this->__quoteFields($key) . ' IN (';
|
||||
$data = $this->_quoteFields($key) . ' IN (';
|
||||
}
|
||||
if ($quoteValues) {
|
||||
if (is_object($model)) {
|
||||
|
@ -2398,9 +2398,9 @@ class DboSource extends DataSource {
|
|||
}
|
||||
}
|
||||
} elseif (is_numeric($key) && !empty($value)) {
|
||||
$data = $this->__quoteFields($value);
|
||||
$data = $this->_quoteFields($value);
|
||||
} else {
|
||||
$data = $this->__parseKey($model, trim($key), $value);
|
||||
$data = $this->_parseKey($model, trim($key), $value);
|
||||
}
|
||||
|
||||
if ($data != null) {
|
||||
|
@ -2421,8 +2421,8 @@ class DboSource extends DataSource {
|
|||
* @param mixed $value The value(s) to be inserted in the string
|
||||
* @return string
|
||||
*/
|
||||
private function __parseKey($model, $key, $value) {
|
||||
$operatorMatch = '/^((' . implode(')|(', $this->__sqlOps);
|
||||
protected function _parseKey($model, $key, $value) {
|
||||
$operatorMatch = '/^((' . implode(')|(', $this->_sqlOps);
|
||||
$operatorMatch .= '\\x20)|<[>=]?(?![^>]+>)\\x20?|[>=!]{1,3}(?!<)\\x20?)/is';
|
||||
$bound = (strpos($key, '?') !== false || (is_array($value) && strpos($key, ':') !== false));
|
||||
|
||||
|
@ -2441,7 +2441,7 @@ class DboSource extends DataSource {
|
|||
|
||||
$virtual = false;
|
||||
if (is_object($model) && $model->isVirtualField($key)) {
|
||||
$key = $this->__quoteFields($model->getVirtualField($key));
|
||||
$key = $this->_quoteFields($model->getVirtualField($key));
|
||||
$virtual = true;
|
||||
}
|
||||
|
||||
|
@ -2459,7 +2459,7 @@ class DboSource extends DataSource {
|
|||
|
||||
if (!$virtual && $key !== '?') {
|
||||
$isKey = (strpos($key, '(') !== false || strpos($key, ')') !== false);
|
||||
$key = $isKey ? $this->__quoteFields($key) : $this->name($key);
|
||||
$key = $isKey ? $this->_quoteFields($key) : $this->name($key);
|
||||
}
|
||||
|
||||
if ($bound) {
|
||||
|
@ -2507,7 +2507,7 @@ class DboSource extends DataSource {
|
|||
* @param string $conditions
|
||||
* @return string or false if no match
|
||||
*/
|
||||
private function __quoteFields($conditions) {
|
||||
protected function _quoteFields($conditions) {
|
||||
$start = $end = null;
|
||||
$original = $conditions;
|
||||
|
||||
|
@ -2518,7 +2518,7 @@ class DboSource extends DataSource {
|
|||
$end = preg_quote($this->endQuote);
|
||||
}
|
||||
$conditions = str_replace(array($start, $end), '', $conditions);
|
||||
$conditions = preg_replace_callback('/(?:[\'\"][^\'\"\\\]*(?:\\\.[^\'\"\\\]*)*[\'\"])|([a-z0-9_' . $start . $end . ']*\\.[a-z0-9_' . $start . $end . ']*)/i', array(&$this, '__quoteMatchedField'), $conditions);
|
||||
$conditions = preg_replace_callback('/(?:[\'\"][^\'\"\\\]*(?:\\\.[^\'\"\\\]*)*[\'\"])|([a-z0-9_' . $start . $end . ']*\\.[a-z0-9_' . $start . $end . ']*)/i', array(&$this, '_quoteMatchedField'), $conditions);
|
||||
|
||||
if ($conditions !== null) {
|
||||
return $conditions;
|
||||
|
@ -2532,7 +2532,7 @@ class DboSource extends DataSource {
|
|||
* @param string $match matched string
|
||||
* @return string quoted strig
|
||||
*/
|
||||
private function __quoteMatchedField($match) {
|
||||
protected function _quoteMatchedField($match) {
|
||||
if (is_numeric($match[0])) {
|
||||
return $match[0];
|
||||
}
|
||||
|
@ -2613,11 +2613,11 @@ class DboSource extends DataSource {
|
|||
$key = trim($key);
|
||||
|
||||
if (is_object($model) && $model->isVirtualField($key)) {
|
||||
$key = '(' . $this->__quoteFields($model->getVirtualField($key)) . ')';
|
||||
$key = '(' . $this->_quoteFields($model->getVirtualField($key)) . ')';
|
||||
}
|
||||
|
||||
if (strpos($key, '.')) {
|
||||
$key = preg_replace_callback('/([a-zA-Z0-9_-]{1,})\\.([a-zA-Z0-9_-]{1,})/', array(&$this, '__quoteMatchedField'), $key);
|
||||
$key = preg_replace_callback('/([a-zA-Z0-9_-]{1,})\\.([a-zA-Z0-9_-]{1,})/', array(&$this, '_quoteMatchedField'), $key);
|
||||
}
|
||||
if (!preg_match('/\s/', $key) && strpos($key, '.') === false) {
|
||||
$key = $this->name($key);
|
||||
|
@ -2649,7 +2649,7 @@ class DboSource extends DataSource {
|
|||
}
|
||||
}
|
||||
$group = implode(', ', $group);
|
||||
return ' GROUP BY ' . $this->__quoteFields($group);
|
||||
return ' GROUP BY ' . $this->_quoteFields($group);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -535,7 +535,7 @@ class Model extends Object {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
private $__associationKeys = array(
|
||||
protected $_associationKeys = array(
|
||||
'belongsTo' => array('className', 'foreignKey', 'conditions', 'fields', 'order', 'counterCache'),
|
||||
'hasOne' => array('className', 'foreignKey','conditions', 'fields','order', 'dependent'),
|
||||
'hasMany' => array('className', 'foreignKey', 'conditions', 'fields', 'order', 'limit', 'offset', 'dependent', 'exclusive', 'finderQuery', 'counterQuery'),
|
||||
|
@ -547,7 +547,7 @@ class Model extends Object {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
private $__associations = array('belongsTo', 'hasOne', 'hasMany', 'hasAndBelongsToMany');
|
||||
protected $_associations = array('belongsTo', 'hasOne', 'hasMany', 'hasAndBelongsToMany');
|
||||
|
||||
/**
|
||||
* Holds model associations temporarily to allow for dynamic (un)binding.
|
||||
|
@ -582,7 +582,7 @@ class Model extends Object {
|
|||
*
|
||||
* @var integer
|
||||
*/
|
||||
private $__insertID = null;
|
||||
protected $_insertID = null;
|
||||
|
||||
/**
|
||||
* Has the datasource been configured.
|
||||
|
@ -590,7 +590,7 @@ class Model extends Object {
|
|||
* @var boolean
|
||||
* @see Model::getDataSource
|
||||
*/
|
||||
private $__sourceConfigured = false;
|
||||
protected $_sourceConfigured = false;
|
||||
|
||||
/**
|
||||
* List of valid finder method options, supplied as the first parameter to find().
|
||||
|
@ -701,7 +701,7 @@ class Model extends Object {
|
|||
} elseif ($this->table === false) {
|
||||
$this->table = Inflector::tableize($this->name);
|
||||
}
|
||||
$this->__createLinks();
|
||||
$this->_createLinks();
|
||||
$this->Behaviors->init($this->alias, $this->actsAs);
|
||||
}
|
||||
|
||||
|
@ -731,7 +731,7 @@ class Model extends Object {
|
|||
public function __isset($name) {
|
||||
$className = false;
|
||||
|
||||
foreach ($this->__associations as $type) {
|
||||
foreach ($this->_associations as $type) {
|
||||
if (isset($name, $this->{$type}[$name])) {
|
||||
$className = empty($this->{$type}[$name]['className']) ? $name : $this->{$type}[$name]['className'];
|
||||
break;
|
||||
|
@ -772,7 +772,7 @@ class Model extends Object {
|
|||
'ds' => $this->useDbConfig
|
||||
));
|
||||
} else {
|
||||
$this->__constructLinkedModel($name, $className, $plugin);
|
||||
$this->_constructLinkedModel($name, $className, $plugin);
|
||||
}
|
||||
|
||||
if (!empty($assocKey)) {
|
||||
|
@ -841,7 +841,7 @@ class Model extends Object {
|
|||
}
|
||||
}
|
||||
}
|
||||
$this->__createLinks();
|
||||
$this->_createLinks();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -883,8 +883,8 @@ class Model extends Object {
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
private function __createLinks() {
|
||||
foreach ($this->__associations as $type) {
|
||||
protected function _createLinks() {
|
||||
foreach ($this->_associations as $type) {
|
||||
if (!is_array($this->{$type})) {
|
||||
$this->{$type} = explode(',', $this->{$type});
|
||||
|
||||
|
@ -910,14 +910,14 @@ class Model extends Object {
|
|||
$this->{$type}[$assoc] = array('className' => $plugin. '.' . $assoc);
|
||||
}
|
||||
}
|
||||
$this->__generateAssociation($type, $assoc);
|
||||
$this->_generateAssociation($type, $assoc);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Private helper method to create associated models of a given class.
|
||||
* Protected helper method to create associated models of a given class.
|
||||
*
|
||||
* @param string $assoc Association name
|
||||
* @param string $className Class name
|
||||
|
@ -929,7 +929,7 @@ class Model extends Object {
|
|||
* usage: $this->ModelName->modelMethods();
|
||||
* @return void
|
||||
*/
|
||||
private function __constructLinkedModel($assoc, $className = null, $plugin = null) {
|
||||
protected function _constructLinkedModel($assoc, $className = null, $plugin = null) {
|
||||
if (empty($className)) {
|
||||
$className = $assoc;
|
||||
}
|
||||
|
@ -956,11 +956,11 @@ class Model extends Object {
|
|||
* @param string $assocKey
|
||||
* @return void
|
||||
*/
|
||||
private function __generateAssociation($type, $assocKey) {
|
||||
protected function _generateAssociation($type, $assocKey) {
|
||||
$class = $assocKey;
|
||||
$dynamicWith = false;
|
||||
|
||||
foreach ($this->__associationKeys[$type] as $key) {
|
||||
foreach ($this->_associationKeys[$type] as $key) {
|
||||
|
||||
if (!isset($this->{$type}[$assocKey][$key]) || $this->{$type}[$assocKey][$key] === null) {
|
||||
$data = '';
|
||||
|
@ -1634,7 +1634,7 @@ class Model extends Object {
|
|||
}
|
||||
|
||||
if (!empty($joined) && $success === true) {
|
||||
$this->__saveMulti($joined, $this->id, $db);
|
||||
$this->_saveMulti($joined, $this->id, $db);
|
||||
}
|
||||
|
||||
if ($success && $count > 0) {
|
||||
|
@ -1667,7 +1667,7 @@ class Model extends Object {
|
|||
* @param DataSource $db
|
||||
* @return void
|
||||
*/
|
||||
private function __saveMulti($joined, $id, $db) {
|
||||
protected function _saveMulti($joined, $id, $db) {
|
||||
foreach ($joined as $assoc => $data) {
|
||||
|
||||
if (isset($this->hasAndBelongsToMany[$assoc])) {
|
||||
|
@ -2182,7 +2182,7 @@ class Model extends Object {
|
|||
|
||||
if (!empty($this->belongsTo)) {
|
||||
$keys = $this->find('first', array(
|
||||
'fields' => $this->__collectForeignKeys(),
|
||||
'fields' => $this->_collectForeignKeys(),
|
||||
'conditions' => array($this->alias . '.' . $this->primaryKey => $id)
|
||||
));
|
||||
}
|
||||
|
@ -2322,7 +2322,7 @@ class Model extends Object {
|
|||
* @param string $type
|
||||
* @return array
|
||||
*/
|
||||
private function __collectForeignKeys($type = 'belongsTo') {
|
||||
protected function _collectForeignKeys($type = 'belongsTo') {
|
||||
$result = array();
|
||||
|
||||
foreach ($this->{$type} as $assoc => $data) {
|
||||
|
@ -2742,7 +2742,7 @@ class Model extends Object {
|
|||
*/
|
||||
public function resetAssociations() {
|
||||
if (!empty($this->__backAssociation)) {
|
||||
foreach ($this->__associations as $type) {
|
||||
foreach ($this->_associations as $type) {
|
||||
if (isset($this->__backAssociation[$type])) {
|
||||
$this->{$type} = $this->__backAssociation[$type];
|
||||
}
|
||||
|
@ -2750,7 +2750,7 @@ class Model extends Object {
|
|||
$this->__backAssociation = array();
|
||||
}
|
||||
|
||||
foreach ($this->__associations as $type) {
|
||||
foreach ($this->_associations as $type) {
|
||||
foreach ($this->{$type} as $key => $name) {
|
||||
if (property_exists($this, $key) && !empty($this->{$key}->__backAssociation)) {
|
||||
$this->{$key}->resetAssociations();
|
||||
|
@ -2818,7 +2818,7 @@ class Model extends Object {
|
|||
|
||||
/**
|
||||
* Returns true if all fields pass validation. Will validate hasAndBelongsToMany associations
|
||||
* that use the 'with' key as well. Since __saveMulti is incapable of exiting a save operation.
|
||||
* that use the 'with' key as well. Since _saveMulti is incapable of exiting a save operation.
|
||||
*
|
||||
* Will validate the currently set data. Use Model::set() or Model::create() to set the active data.
|
||||
*
|
||||
|
@ -2829,7 +2829,7 @@ class Model extends Object {
|
|||
public function validates($options = array()) {
|
||||
$errors = $this->invalidFields($options);
|
||||
if (empty($errors) && $errors !== false) {
|
||||
$errors = $this->__validateWithModels($options);
|
||||
$errors = $this->_validateWithModels($options);
|
||||
}
|
||||
if (is_array($errors)) {
|
||||
return count($errors) === 0;
|
||||
|
@ -3007,7 +3007,7 @@ class Model extends Object {
|
|||
* @return boolean Failure of validation on with models.
|
||||
* @see Model::validates()
|
||||
*/
|
||||
private function __validateWithModels($options) {
|
||||
protected function _validateWithModels($options) {
|
||||
$valid = true;
|
||||
foreach ($this->hasAndBelongsToMany as $assoc => $association) {
|
||||
if (empty($association['with']) || !isset($this->data[$assoc])) {
|
||||
|
@ -3136,7 +3136,7 @@ class Model extends Object {
|
|||
* @return mixed Last inserted ID
|
||||
*/
|
||||
public function getInsertID() {
|
||||
return $this->__insertID;
|
||||
return $this->_insertID;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3146,7 +3146,7 @@ class Model extends Object {
|
|||
* @return void
|
||||
*/
|
||||
public function setInsertID($id) {
|
||||
$this->__insertID = $id;
|
||||
$this->_insertID = $id;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3202,8 +3202,8 @@ class Model extends Object {
|
|||
* @return DataSource A DataSource object
|
||||
*/
|
||||
public function getDataSource() {
|
||||
if (!$this->__sourceConfigured && $this->useTable !== false) {
|
||||
$this->__sourceConfigured = true;
|
||||
if (!$this->_sourceConfigured && $this->useTable !== false) {
|
||||
$this->_sourceConfigured = true;
|
||||
$this->setSource($this->useTable);
|
||||
}
|
||||
return ConnectionManager::getDataSource($this->useDbConfig);
|
||||
|
@ -3215,7 +3215,7 @@ class Model extends Object {
|
|||
* @return array
|
||||
*/
|
||||
public function associations() {
|
||||
return $this->__associations;
|
||||
return $this->_associations;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3227,7 +3227,7 @@ class Model extends Object {
|
|||
public function getAssociated($type = null) {
|
||||
if ($type == null) {
|
||||
$associated = array();
|
||||
foreach ($this->__associations as $assoc) {
|
||||
foreach ($this->_associations as $assoc) {
|
||||
if (!empty($this->{$assoc})) {
|
||||
$models = array_keys($this->{$assoc});
|
||||
foreach ($models as $m) {
|
||||
|
@ -3236,7 +3236,7 @@ class Model extends Object {
|
|||
}
|
||||
}
|
||||
return $associated;
|
||||
} elseif (in_array($type, $this->__associations)) {
|
||||
} elseif (in_array($type, $this->_associations)) {
|
||||
if (empty($this->{$type})) {
|
||||
return array();
|
||||
}
|
||||
|
@ -3249,7 +3249,7 @@ class Model extends Object {
|
|||
$this->hasAndBelongsToMany
|
||||
);
|
||||
if (array_key_exists($type, $assoc)) {
|
||||
foreach ($this->__associations as $a) {
|
||||
foreach ($this->_associations as $a) {
|
||||
if (isset($this->{$a}[$type])) {
|
||||
$assoc[$type]['association'] = $a;
|
||||
break;
|
||||
|
@ -3373,7 +3373,7 @@ class Model extends Object {
|
|||
}
|
||||
|
||||
/**
|
||||
* Private method. Clears cache for this model.
|
||||
* Clears cache for this model.
|
||||
*
|
||||
* @param string $type If null this deletes cached views if Cache.check is true
|
||||
* Will be used to allow deleting query cache also
|
||||
|
@ -3385,7 +3385,7 @@ class Model extends Object {
|
|||
if (Configure::read('Cache.check') === true) {
|
||||
$assoc[] = strtolower(Inflector::pluralize($this->alias));
|
||||
$assoc[] = strtolower(Inflector::underscore(Inflector::pluralize($this->alias)));
|
||||
foreach ($this->__associations as $key => $association) {
|
||||
foreach ($this->_associations as $key => $association) {
|
||||
foreach ($this->$association as $key => $className) {
|
||||
$check = strtolower(Inflector::pluralize($className['className']));
|
||||
if (!in_array($check, $assoc)) {
|
||||
|
|
|
@ -113,7 +113,7 @@ class CakeRequest implements ArrayAccess {
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
private $__input = '';
|
||||
protected $_input = '';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
@ -716,13 +716,13 @@ class CakeRequest implements ArrayAccess {
|
|||
* @return string contents of stdin
|
||||
*/
|
||||
protected function _readStdin() {
|
||||
if (empty($this->__input)) {
|
||||
if (empty($this->_input)) {
|
||||
$fh = fopen('php://input', 'r');
|
||||
$content = stream_get_contents($fh);
|
||||
fclose($fh);
|
||||
$this->__input = $content;
|
||||
$this->_input = $content;
|
||||
}
|
||||
return $this->__input;
|
||||
return $this->_input;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -71,7 +71,7 @@ class CakeRoute {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
private $__headerMap = array(
|
||||
protected $_headerMap = array(
|
||||
'type' => 'content_type',
|
||||
'method' => 'request_method',
|
||||
'server' => 'server_name'
|
||||
|
@ -180,8 +180,8 @@ class CakeRoute {
|
|||
}
|
||||
foreach ($this->defaults as $key => $val) {
|
||||
if ($key[0] === '[' && preg_match('/^\[(\w+)\]$/', $key, $header)) {
|
||||
if (isset($this->__headerMap[$header[1]])) {
|
||||
$header = $this->__headerMap[$header[1]];
|
||||
if (isset($this->_headerMap[$header[1]])) {
|
||||
$header = $this->_headerMap[$header[1]];
|
||||
} else {
|
||||
$header = 'http_' . $header[1];
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ class Router {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $__namedExpressions = array(
|
||||
protected static $_namedExpressions = array(
|
||||
'Action' => Router::ACTION,
|
||||
'Year' => Router::YEAR,
|
||||
'Month' => Router::MONTH,
|
||||
|
@ -168,10 +168,10 @@ class Router {
|
|||
* Gets the named route elements for use in app/Config/routes.php
|
||||
*
|
||||
* @return array Named route elements
|
||||
* @see Router::$__namedExpressions
|
||||
* @see Router::$_namedExpressions
|
||||
*/
|
||||
public static function getNamedExpressions() {
|
||||
return self::$__namedExpressions;
|
||||
return self::$_namedExpressions;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -458,7 +458,7 @@ class Router {
|
|||
$url = substr($url, 0, strpos($url, '?'));
|
||||
}
|
||||
|
||||
extract(self::__parseExtension($url));
|
||||
extract(self::_parseExtension($url));
|
||||
|
||||
for ($i = 0, $len = count(self::$routes); $i < $len; $i++) {
|
||||
$route =& self::$routes[$i];
|
||||
|
@ -485,7 +485,7 @@ class Router {
|
|||
* @param string $url
|
||||
* @return array Returns an array containing the altered URL and the parsed extension.
|
||||
*/
|
||||
private static function __parseExtension($url) {
|
||||
protected static function _parseExtension($url) {
|
||||
$ext = null;
|
||||
|
||||
if (self::$_parseExtensions) {
|
||||
|
|
|
@ -51,16 +51,6 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase {
|
|||
*/
|
||||
public $dropTables = true;
|
||||
|
||||
/**
|
||||
* The fixtures to be loaded in this test case. Fixtures are referenced using a dot notation:
|
||||
* - fixture_name : A fixtures that can be found in the main app folder and is named FixtureNameFixture
|
||||
* - core.fixture_name : A fixtures that can be found in the cake core folder and is named FixtureNameFixture
|
||||
* - plugin.plugin_name.fixture_name : A fixtures that can be found in the plugin "plugin_name" folder and is named FixtureNameFixture
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $fixtures = array();
|
||||
|
||||
/**
|
||||
* Configure values to restore at end of test.
|
||||
*
|
||||
|
@ -305,7 +295,7 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase {
|
|||
$i++;
|
||||
}
|
||||
if ($attrs) {
|
||||
$permutations = $this->__array_permute($attrs);
|
||||
$permutations = $this->_array_permute($attrs);
|
||||
|
||||
$permutationTokens = array();
|
||||
foreach ($permutations as $permutation) {
|
||||
|
@ -354,7 +344,7 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase {
|
|||
* @param array $items An array of items
|
||||
* @return array
|
||||
*/
|
||||
private function __array_permute($items, $perms = array()) {
|
||||
protected function _array_permute($items, $perms = array()) {
|
||||
static $permuted;
|
||||
if (empty($perms)) {
|
||||
$permuted = array();
|
||||
|
@ -369,7 +359,7 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase {
|
|||
$newPerms = $perms;
|
||||
list($tmp) = array_splice($newItems, $i, 1);
|
||||
array_unshift($newPerms, $tmp);
|
||||
$this->__array_permute($newItems, $newPerms);
|
||||
$this->_array_permute($newItems, $newPerms);
|
||||
}
|
||||
return $permuted;
|
||||
}
|
||||
|
|
|
@ -181,7 +181,7 @@ abstract class ControllerTestCase extends CakeTestCase {
|
|||
* @param string $url The url to test
|
||||
* @param array $options See options
|
||||
*/
|
||||
private function _testAction($url = '', $options = array()) {
|
||||
protected function _testAction($url = '', $options = array()) {
|
||||
$this->vars = $this->result = $this->view = $this->contents = $this->headers = null;
|
||||
|
||||
$options = array_merge(array(
|
||||
|
|
|
@ -35,21 +35,21 @@ class ClassRegistry {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
private $__objects = array();
|
||||
protected $_objects = array();
|
||||
|
||||
/**
|
||||
* Names of class names mapped to the object in the registry.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $__map = array();
|
||||
protected $_map = array();
|
||||
|
||||
/**
|
||||
* Default constructor parameter settings, indexed by type
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $__config = array();
|
||||
protected $_config = array();
|
||||
|
||||
/**
|
||||
* Return a singleton instance of the ClassRegistry.
|
||||
|
@ -103,7 +103,7 @@ class ClassRegistry {
|
|||
} else {
|
||||
$objects = array(array('class' => $class));
|
||||
}
|
||||
$defaults = isset($_this->__config['Model']) ? $_this->__config['Model'] : array();
|
||||
$defaults = isset($_this->_config['Model']) ? $_this->_config['Model'] : array();
|
||||
$count = count($objects);
|
||||
|
||||
foreach ($objects as $key => $settings) {
|
||||
|
@ -122,7 +122,7 @@ class ClassRegistry {
|
|||
}
|
||||
$alias = $settings['alias'];
|
||||
|
||||
if ($model = $_this->__duplicate($alias, $class)) {
|
||||
if ($model = $_this->_duplicate($alias, $class)) {
|
||||
$_this->map($alias, $class);
|
||||
return $model;
|
||||
}
|
||||
|
@ -179,8 +179,8 @@ class ClassRegistry {
|
|||
public static function addObject($key, $object) {
|
||||
$_this = ClassRegistry::getInstance();
|
||||
$key = Inflector::underscore($key);
|
||||
if (!isset($_this->__objects[$key])) {
|
||||
$_this->__objects[$key] = $object;
|
||||
if (!isset($_this->_objects[$key])) {
|
||||
$_this->_objects[$key] = $object;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -195,8 +195,8 @@ class ClassRegistry {
|
|||
public static function removeObject($key) {
|
||||
$_this = ClassRegistry::getInstance();
|
||||
$key = Inflector::underscore($key);
|
||||
if (isset($_this->__objects[$key])) {
|
||||
unset($_this->__objects[$key]);
|
||||
if (isset($_this->_objects[$key])) {
|
||||
unset($_this->_objects[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -209,9 +209,9 @@ class ClassRegistry {
|
|||
public static function isKeySet($key) {
|
||||
$_this = ClassRegistry::getInstance();
|
||||
$key = Inflector::underscore($key);
|
||||
if (isset($_this->__objects[$key])) {
|
||||
if (isset($_this->_objects[$key])) {
|
||||
return true;
|
||||
} elseif (isset($_this->__map[$key])) {
|
||||
} elseif (isset($_this->_map[$key])) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -224,7 +224,7 @@ class ClassRegistry {
|
|||
*/
|
||||
public static function keys() {
|
||||
$_this = ClassRegistry::getInstance();
|
||||
return array_keys($_this->__objects);
|
||||
return array_keys($_this->_objects);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -237,12 +237,12 @@ class ClassRegistry {
|
|||
$_this = ClassRegistry::getInstance();
|
||||
$key = Inflector::underscore($key);
|
||||
$return = false;
|
||||
if (isset($_this->__objects[$key])) {
|
||||
$return = $_this->__objects[$key];
|
||||
if (isset($_this->_objects[$key])) {
|
||||
$return = $_this->_objects[$key];
|
||||
} else {
|
||||
$key = $_this->__getMap($key);
|
||||
if (isset($_this->__objects[$key])) {
|
||||
$return = $_this->__objects[$key];
|
||||
$key = $_this->_getMap($key);
|
||||
if (isset($_this->_objects[$key])) {
|
||||
$return = $_this->_objects[$key];
|
||||
}
|
||||
}
|
||||
return $return;
|
||||
|
@ -264,11 +264,11 @@ class ClassRegistry {
|
|||
$param = $type;
|
||||
$type = 'Model';
|
||||
} elseif (is_null($param)) {
|
||||
unset($_this->__config[$type]);
|
||||
unset($_this->_config[$type]);
|
||||
} elseif (empty($param) && is_string($type)) {
|
||||
return isset($_this->__config[$type]) ? $_this->__config[$type] : null;
|
||||
return isset($_this->_config[$type]) ? $_this->_config[$type] : null;
|
||||
}
|
||||
$_this->__config[$type] = $param;
|
||||
$_this->_config[$type] = $param;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -278,7 +278,7 @@ class ClassRegistry {
|
|||
* @param string $class
|
||||
* @return boolean
|
||||
*/
|
||||
private function &__duplicate($alias, $class) {
|
||||
protected function &_duplicate($alias, $class) {
|
||||
$duplicate = false;
|
||||
if ($this->isKeySet($alias)) {
|
||||
$model = $this->getObject($alias);
|
||||
|
@ -301,8 +301,8 @@ class ClassRegistry {
|
|||
$_this = ClassRegistry::getInstance();
|
||||
$key = Inflector::underscore($key);
|
||||
$name = Inflector::underscore($name);
|
||||
if (!isset($_this->__map[$key])) {
|
||||
$_this->__map[$key] = $name;
|
||||
if (!isset($_this->_map[$key])) {
|
||||
$_this->_map[$key] = $name;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -313,7 +313,7 @@ class ClassRegistry {
|
|||
*/
|
||||
public static function mapKeys() {
|
||||
$_this = ClassRegistry::getInstance();
|
||||
return array_keys($_this->__map);
|
||||
return array_keys($_this->_map);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -322,9 +322,9 @@ class ClassRegistry {
|
|||
* @param string $key Key to find in map
|
||||
* @return string Mapped value
|
||||
*/
|
||||
private function __getMap($key) {
|
||||
if (isset($this->__map[$key])) {
|
||||
return $this->__map[$key];
|
||||
protected function _getMap($key) {
|
||||
if (isset($this->_map[$key])) {
|
||||
return $this->_map[$key];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -335,7 +335,7 @@ class ClassRegistry {
|
|||
*/
|
||||
public static function flush() {
|
||||
$_this = ClassRegistry::getInstance();
|
||||
$_this->__objects = array();
|
||||
$_this->__map = array();
|
||||
$_this->_objects = array();
|
||||
$_this->_map = array();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,28 +52,28 @@ class Folder {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
private $__messages = array();
|
||||
protected $_messages = array();
|
||||
|
||||
/**
|
||||
* Holds errors from last method.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $__errors = array();
|
||||
protected $_errors = array();
|
||||
|
||||
/**
|
||||
* Holds array of complete directory paths.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $__directories;
|
||||
protected $_directories;
|
||||
|
||||
/**
|
||||
* Holds array of complete file paths.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $__files;
|
||||
protected $_files;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -337,11 +337,11 @@ class Folder {
|
|||
|
||||
if ($recursive === false && is_dir($path)) {
|
||||
if (@chmod($path, intval($mode, 8))) {
|
||||
$this->__messages[] = __d('cake_dev', '%s changed to %s', $path, $mode);
|
||||
$this->_messages[] = __d('cake_dev', '%s changed to %s', $path, $mode);
|
||||
return true;
|
||||
}
|
||||
|
||||
$this->__errors[] = __d('cake_dev', '%s NOT changed to %s', $path, $mode);
|
||||
$this->_errors[] = __d('cake_dev', '%s NOT changed to %s', $path, $mode);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -358,14 +358,14 @@ class Folder {
|
|||
}
|
||||
|
||||
if (@chmod($fullpath, intval($mode, 8))) {
|
||||
$this->__messages[] = __d('cake_dev', '%s changed to %s', $fullpath, $mode);
|
||||
$this->_messages[] = __d('cake_dev', '%s changed to %s', $fullpath, $mode);
|
||||
} else {
|
||||
$this->__errors[] = __d('cake_dev', '%s NOT changed to %s', $fullpath, $mode);
|
||||
$this->_errors[] = __d('cake_dev', '%s NOT changed to %s', $fullpath, $mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($this->__errors)) {
|
||||
if (empty($this->_errors)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -389,28 +389,28 @@ class Folder {
|
|||
}
|
||||
return array();
|
||||
}
|
||||
$this->__files = array();
|
||||
$this->__directories = array($this->realpath($path));
|
||||
$this->_files = array();
|
||||
$this->_directories = array($this->realpath($path));
|
||||
$directories = array();
|
||||
|
||||
if ($exceptions === false) {
|
||||
$exceptions = true;
|
||||
}
|
||||
while (!empty($this->__directories)) {
|
||||
$dir = array_pop($this->__directories);
|
||||
while (!empty($this->_directories)) {
|
||||
$dir = array_pop($this->_directories);
|
||||
$this->__tree($dir, $exceptions);
|
||||
$directories[] = $dir;
|
||||
}
|
||||
|
||||
if ($type === null) {
|
||||
return array($directories, $this->__files);
|
||||
return array($directories, $this->_files);
|
||||
}
|
||||
if ($type === 'dir') {
|
||||
return $directories;
|
||||
}
|
||||
$this->cd($original);
|
||||
|
||||
return $this->__files;
|
||||
return $this->_files;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -423,8 +423,8 @@ class Folder {
|
|||
public function __tree($path, $exceptions) {
|
||||
$this->path = $path;
|
||||
list($dirs, $files) = $this->read(false, $exceptions, true);
|
||||
$this->__directories = array_merge($this->__directories, $dirs);
|
||||
$this->__files = array_merge($this->__files, $files);
|
||||
$this->_directories = array_merge($this->_directories, $dirs);
|
||||
$this->_files = array_merge($this->_files, $files);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -445,7 +445,7 @@ class Folder {
|
|||
}
|
||||
|
||||
if (is_file($pathname)) {
|
||||
$this->__errors[] = __d('cake_dev', '%s is a file', $pathname);
|
||||
$this->_errors[] = __d('cake_dev', '%s is a file', $pathname);
|
||||
return false;
|
||||
}
|
||||
$pathname = rtrim($pathname, DS);
|
||||
|
@ -456,11 +456,11 @@ class Folder {
|
|||
$old = umask(0);
|
||||
if (mkdir($pathname, $mode)) {
|
||||
umask($old);
|
||||
$this->__messages[] = __d('cake_dev', '%s created', $pathname);
|
||||
$this->_messages[] = __d('cake_dev', '%s created', $pathname);
|
||||
return true;
|
||||
} else {
|
||||
umask($old);
|
||||
$this->__errors[] = __d('cake_dev', '%s NOT created', $pathname);
|
||||
$this->_errors[] = __d('cake_dev', '%s NOT created', $pathname);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -532,9 +532,9 @@ class Folder {
|
|||
}
|
||||
if (is_file($file) === true) {
|
||||
if (@unlink($file)) {
|
||||
$this->__messages[] = __d('cake_dev', '%s removed', $file);
|
||||
$this->_messages[] = __d('cake_dev', '%s removed', $file);
|
||||
} else {
|
||||
$this->__errors[] = __d('cake_dev', '%s NOT removed', $file);
|
||||
$this->_errors[] = __d('cake_dev', '%s NOT removed', $file);
|
||||
}
|
||||
} elseif (is_dir($file) === true && $this->delete($file) === false) {
|
||||
return false;
|
||||
|
@ -543,10 +543,10 @@ class Folder {
|
|||
}
|
||||
$path = substr($path, 0, strlen($path) - 1);
|
||||
if (rmdir($path) === false) {
|
||||
$this->__errors[] = __d('cake_dev', '%s NOT removed', $path);
|
||||
$this->_errors[] = __d('cake_dev', '%s NOT removed', $path);
|
||||
return false;
|
||||
} else {
|
||||
$this->__messages[] = __d('cake_dev', '%s removed', $path);
|
||||
$this->_messages[] = __d('cake_dev', '%s removed', $path);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -581,7 +581,7 @@ class Folder {
|
|||
$mode = $options['mode'];
|
||||
|
||||
if (!$this->cd($fromDir)) {
|
||||
$this->__errors[] = __d('cake_dev', '%s not found', $fromDir);
|
||||
$this->_errors[] = __d('cake_dev', '%s not found', $fromDir);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -590,7 +590,7 @@ class Folder {
|
|||
}
|
||||
|
||||
if (!is_writable($toDir)) {
|
||||
$this->__errors[] = __d('cake_dev', '%s not writable', $toDir);
|
||||
$this->_errors[] = __d('cake_dev', '%s not writable', $toDir);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -604,9 +604,9 @@ class Folder {
|
|||
if (copy($from, $to)) {
|
||||
chmod($to, intval($mode, 8));
|
||||
touch($to, filemtime($from));
|
||||
$this->__messages[] = __d('cake_dev', '%s copied to %s', $from, $to);
|
||||
$this->_messages[] = __d('cake_dev', '%s copied to %s', $from, $to);
|
||||
} else {
|
||||
$this->__errors[] = __d('cake_dev', '%s NOT copied to %s', $from, $to);
|
||||
$this->_errors[] = __d('cake_dev', '%s NOT copied to %s', $from, $to);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -617,11 +617,11 @@ class Folder {
|
|||
$old = umask(0);
|
||||
chmod($to, $mode);
|
||||
umask($old);
|
||||
$this->__messages[] = __d('cake_dev', '%s created', $to);
|
||||
$this->_messages[] = __d('cake_dev', '%s created', $to);
|
||||
$options = array_merge($options, array('to'=> $to, 'from'=> $from));
|
||||
$this->copy($options);
|
||||
} else {
|
||||
$this->__errors[] = __d('cake_dev', '%s not created', $to);
|
||||
$this->_errors[] = __d('cake_dev', '%s not created', $to);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -631,7 +631,7 @@ class Folder {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!empty($this->__errors)) {
|
||||
if (!empty($this->_errors)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -675,7 +675,7 @@ class Folder {
|
|||
* @return array
|
||||
*/
|
||||
public function messages() {
|
||||
return $this->__messages;
|
||||
return $this->_messages;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -684,7 +684,7 @@ class Folder {
|
|||
* @return array
|
||||
*/
|
||||
public function errors() {
|
||||
return $this->__errors;
|
||||
return $this->_errors;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1012,7 +1012,7 @@ class Set {
|
|||
* @param string $key
|
||||
* @return array
|
||||
*/
|
||||
private static function __flatten($results, $key = null) {
|
||||
protected static function _flatten($results, $key = null) {
|
||||
$stack = array();
|
||||
foreach ($results as $k => $r) {
|
||||
$id = $k;
|
||||
|
@ -1020,7 +1020,7 @@ class Set {
|
|||
$id = $key;
|
||||
}
|
||||
if (is_array($r) && !empty($r)) {
|
||||
$stack = array_merge($stack, Set::__flatten($r, $id));
|
||||
$stack = array_merge($stack, Set::_flatten($r, $id));
|
||||
} else {
|
||||
$stack[] = array('id' => $id, 'value' => $r);
|
||||
}
|
||||
|
@ -1041,7 +1041,7 @@ class Set {
|
|||
if (is_numeric(implode('', $originalKeys))) {
|
||||
$data = array_values($data);
|
||||
}
|
||||
$result = Set::__flatten(Set::extract($data, $path));
|
||||
$result = Set::_flatten(Set::extract($data, $path));
|
||||
list($keys, $values) = array(Set::extract($result, '{n}.id'), Set::extract($result, '{n}.value'));
|
||||
|
||||
$dir = strtolower($dir);
|
||||
|
|
|
@ -36,7 +36,7 @@ class Validation {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $__pattern = array(
|
||||
protected static $_pattern = array(
|
||||
'hostname' => '(?:[a-z0-9][-a-z0-9]*\.)*(?:[a-z0-9][-a-z0-9]{0,62})\.(?:(?:[a-z]{2}\.)?[a-z]{2,4}|museum|travel)'
|
||||
);
|
||||
|
||||
|
@ -407,14 +407,14 @@ class Validation {
|
|||
}
|
||||
|
||||
if (is_null($regex)) {
|
||||
$regex = '/^[a-z0-9!#$%&\'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&\'*+\/=?^_`{|}~-]+)*@' . self::$__pattern['hostname'] . '$/i';
|
||||
$regex = '/^[a-z0-9!#$%&\'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&\'*+\/=?^_`{|}~-]+)*@' . self::$_pattern['hostname'] . '$/i';
|
||||
}
|
||||
$return = self::_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('/@(' . self::$_pattern['hostname'] . ')$/i', $check, $regs)) {
|
||||
if (function_exists('getmxrr') && getmxrr($regs[1], $mxhosts)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -700,10 +700,10 @@ class Validation {
|
|||
* @return boolean Success
|
||||
*/
|
||||
public static function url($check, $strict = false) {
|
||||
self::__populateIp();
|
||||
self::_populateIp();
|
||||
$validChars = '([' . preg_quote('!"$&\'()*+,-.@_:;=~[]') . '\/0-9a-z\p{L}\p{N}]|(%[0-9a-f]{2}))';
|
||||
$regex = '/^(?:(?:https?|ftps?|file|news|gopher):\/\/)' . (!empty($strict) ? '' : '?') .
|
||||
'(?:' . self::$__pattern['IPv4'] . '|\[' . self::$__pattern['IPv6'] . '\]|' . self::$__pattern['hostname'] . ')(?::[1-9][0-9]{0,4})?' .
|
||||
'(?:' . self::$_pattern['IPv4'] . '|\[' . self::$_pattern['IPv6'] . '\]|' . self::$_pattern['hostname'] . ')(?::[1-9][0-9]{0,4})?' .
|
||||
'(?:\/?|\/' . $validChars . '*)?' .
|
||||
'(?:\?' . $validChars . '*)?' .
|
||||
'(?:#' . $validChars . '*)?$/iu';
|
||||
|
@ -794,7 +794,7 @@ class Validation {
|
|||
* @return void
|
||||
*/
|
||||
protected static function _defaults($params) {
|
||||
self::__reset();
|
||||
self::_reset();
|
||||
$defaults = array(
|
||||
'check' => null,
|
||||
'regex' => null,
|
||||
|
@ -847,8 +847,8 @@ class Validation {
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
private static function __populateIp() {
|
||||
if (!isset(self::$__pattern['IPv6'])) {
|
||||
protected static function _populateIp() {
|
||||
if (!isset(self::$_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})';
|
||||
|
@ -864,11 +864,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;
|
||||
self::$_pattern['IPv6'] = $pattern;
|
||||
}
|
||||
if (!isset(self::$__pattern['IPv4'])) {
|
||||
if (!isset(self::$_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;
|
||||
self::$_pattern['IPv4'] = $pattern;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -877,7 +877,7 @@ class Validation {
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
private static function __reset() {
|
||||
protected static function _reset() {
|
||||
self::$errors = array();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -218,10 +218,10 @@ class Xml {
|
|||
foreach ($value as $item) {
|
||||
$data = compact('dom', 'node', 'key', 'format');
|
||||
$data['value'] = $item;
|
||||
self::__createChild($data);
|
||||
self::_createChild($data);
|
||||
}
|
||||
} else { // Struct
|
||||
self::__createChild(compact('dom', 'node', 'key', 'value', 'format'));
|
||||
self::_createChild(compact('dom', 'node', 'key', 'value', 'format'));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -236,7 +236,7 @@ class Xml {
|
|||
* @param array $data Array with informations to create childs
|
||||
* @return void
|
||||
*/
|
||||
private static function __createChild($data) {
|
||||
protected static function _createChild($data) {
|
||||
extract($data);
|
||||
$childNS = $childValue = null;
|
||||
if (is_array($value)) {
|
||||
|
|
|
@ -76,14 +76,14 @@ class Helper extends Object {
|
|||
*
|
||||
* @var mixed
|
||||
*/
|
||||
private $__tainted = null;
|
||||
protected $_tainted = null;
|
||||
|
||||
/**
|
||||
* Holds the cleaned content.
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
private $__cleaned = null;
|
||||
protected $_cleaned = null;
|
||||
|
||||
/**
|
||||
* The View instance this helper is attached to
|
||||
|
@ -295,7 +295,7 @@ class Helper extends Object {
|
|||
* @return string|array cleaned content for output
|
||||
*/
|
||||
public function clean($output) {
|
||||
$this->__reset();
|
||||
$this->_reset();
|
||||
if (empty($output)) {
|
||||
return null;
|
||||
}
|
||||
|
@ -305,9 +305,9 @@ class Helper extends Object {
|
|||
}
|
||||
return $return;
|
||||
}
|
||||
$this->__tainted = $output;
|
||||
$this->__clean();
|
||||
return $this->__cleaned;
|
||||
$this->_tainted = $output;
|
||||
$this->_clean();
|
||||
return $this->_cleaned;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -620,7 +620,7 @@ class Helper extends Object {
|
|||
} elseif (empty($result) && isset($data[$habtmKey]) && is_array($data[$habtmKey])) {
|
||||
if (ClassRegistry::isKeySet($habtmKey)) {
|
||||
$model = ClassRegistry::getObject($habtmKey);
|
||||
$result = $this->__selectedArray($data[$habtmKey], $model->primaryKey);
|
||||
$result = $this->_selectedArray($data[$habtmKey], $model->primaryKey);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -745,7 +745,7 @@ class Helper extends Object {
|
|||
* @param string $key
|
||||
* @return array
|
||||
*/
|
||||
private function __selectedArray($data, $key = 'id') {
|
||||
protected function _selectedArray($data, $key = 'id') {
|
||||
if (!is_array($data)) {
|
||||
$model = $data;
|
||||
if (!empty($this->request->data[$model][$model])) {
|
||||
|
@ -771,9 +771,9 @@ class Helper extends Object {
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
private function __reset() {
|
||||
$this->__tainted = null;
|
||||
$this->__cleaned = null;
|
||||
protected function _reset() {
|
||||
$this->_tainted = null;
|
||||
$this->_cleaned = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -781,30 +781,30 @@ class Helper extends Object {
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
private function __clean() {
|
||||
protected function _clean() {
|
||||
if (get_magic_quotes_gpc()) {
|
||||
$this->__cleaned = stripslashes($this->__tainted);
|
||||
$this->_cleaned = stripslashes($this->_tainted);
|
||||
} else {
|
||||
$this->__cleaned = $this->__tainted;
|
||||
$this->_cleaned = $this->_tainted;
|
||||
}
|
||||
|
||||
$this->__cleaned = str_replace(array("&", "<", ">"), array("&amp;", "&lt;", "&gt;"), $this->__cleaned);
|
||||
$this->__cleaned = preg_replace('#(&\#*\w+)[\x00-\x20]+;#u', "$1;", $this->__cleaned);
|
||||
$this->__cleaned = preg_replace('#(&\#x*)([0-9A-F]+);*#iu', "$1$2;", $this->__cleaned);
|
||||
$this->__cleaned = html_entity_decode($this->__cleaned, ENT_COMPAT, "UTF-8");
|
||||
$this->__cleaned = preg_replace('#(<[^>]+[\x00-\x20\"\'\/])(on|xmlns)[^>]*>#iUu', "$1>", $this->__cleaned);
|
||||
$this->__cleaned = preg_replace('#([a-z]*)[\x00-\x20]*=[\x00-\x20]*([\`\'\"]*)[\\x00-\x20]*j[\x00-\x20]*a[\x00-\x20]*v[\x00-\x20]*a[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iUu', '$1=$2nojavascript...', $this->__cleaned);
|
||||
$this->__cleaned = preg_replace('#([a-z]*)[\x00-\x20]*=([\'\"]*)[\x00-\x20]*v[\x00-\x20]*b[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iUu', '$1=$2novbscript...', $this->__cleaned);
|
||||
$this->__cleaned = preg_replace('#([a-z]*)[\x00-\x20]*=*([\'\"]*)[\x00-\x20]*-moz-binding[\x00-\x20]*:#iUu','$1=$2nomozbinding...', $this->__cleaned);
|
||||
$this->__cleaned = preg_replace('#([a-z]*)[\x00-\x20]*=([\'\"]*)[\x00-\x20]*data[\x00-\x20]*:#Uu', '$1=$2nodata...', $this->__cleaned);
|
||||
$this->__cleaned = preg_replace('#(<[^>]+)style[\x00-\x20]*=[\x00-\x20]*([\`\'\"]*).*expression[\x00-\x20]*\([^>]*>#iU', "$1>", $this->__cleaned);
|
||||
$this->__cleaned = preg_replace('#(<[^>]+)style[\x00-\x20]*=[\x00-\x20]*([\`\'\"]*).*behaviour[\x00-\x20]*\([^>]*>#iU', "$1>", $this->__cleaned);
|
||||
$this->__cleaned = preg_replace('#(<[^>]+)style[\x00-\x20]*=[\x00-\x20]*([\`\'\"]*).*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:*[^>]*>#iUu', "$1>", $this->__cleaned);
|
||||
$this->__cleaned = preg_replace('#</*\w+:\w[^>]*>#i', "", $this->__cleaned);
|
||||
$this->_cleaned = str_replace(array("&", "<", ">"), array("&amp;", "&lt;", "&gt;"), $this->_cleaned);
|
||||
$this->_cleaned = preg_replace('#(&\#*\w+)[\x00-\x20]+;#u', "$1;", $this->_cleaned);
|
||||
$this->_cleaned = preg_replace('#(&\#x*)([0-9A-F]+);*#iu', "$1$2;", $this->_cleaned);
|
||||
$this->_cleaned = html_entity_decode($this->_cleaned, ENT_COMPAT, "UTF-8");
|
||||
$this->_cleaned = preg_replace('#(<[^>]+[\x00-\x20\"\'\/])(on|xmlns)[^>]*>#iUu', "$1>", $this->_cleaned);
|
||||
$this->_cleaned = preg_replace('#([a-z]*)[\x00-\x20]*=[\x00-\x20]*([\`\'\"]*)[\\x00-\x20]*j[\x00-\x20]*a[\x00-\x20]*v[\x00-\x20]*a[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iUu', '$1=$2nojavascript...', $this->_cleaned);
|
||||
$this->_cleaned = preg_replace('#([a-z]*)[\x00-\x20]*=([\'\"]*)[\x00-\x20]*v[\x00-\x20]*b[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iUu', '$1=$2novbscript...', $this->_cleaned);
|
||||
$this->_cleaned = preg_replace('#([a-z]*)[\x00-\x20]*=*([\'\"]*)[\x00-\x20]*-moz-binding[\x00-\x20]*:#iUu','$1=$2nomozbinding...', $this->_cleaned);
|
||||
$this->_cleaned = preg_replace('#([a-z]*)[\x00-\x20]*=([\'\"]*)[\x00-\x20]*data[\x00-\x20]*:#Uu', '$1=$2nodata...', $this->_cleaned);
|
||||
$this->_cleaned = preg_replace('#(<[^>]+)style[\x00-\x20]*=[\x00-\x20]*([\`\'\"]*).*expression[\x00-\x20]*\([^>]*>#iU', "$1>", $this->_cleaned);
|
||||
$this->_cleaned = preg_replace('#(<[^>]+)style[\x00-\x20]*=[\x00-\x20]*([\`\'\"]*).*behaviour[\x00-\x20]*\([^>]*>#iU', "$1>", $this->_cleaned);
|
||||
$this->_cleaned = preg_replace('#(<[^>]+)style[\x00-\x20]*=[\x00-\x20]*([\`\'\"]*).*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:*[^>]*>#iUu', "$1>", $this->_cleaned);
|
||||
$this->_cleaned = preg_replace('#</*\w+:\w[^>]*>#i', "", $this->_cleaned);
|
||||
do {
|
||||
$oldstring = $this->__cleaned;
|
||||
$this->__cleaned = preg_replace('#</*(applet|meta|xml|blink|link|style|script|embed|object|iframe|frame|frameset|ilayer|layer|bgsound|title|base)[^>]*>#i', "", $this->__cleaned);
|
||||
} while ($oldstring != $this->__cleaned);
|
||||
$this->__cleaned = str_replace(array("&", "<", ">"), array("&amp;", "&lt;", "&gt;"), $this->__cleaned);
|
||||
$oldstring = $this->_cleaned;
|
||||
$this->_cleaned = preg_replace('#</*(applet|meta|xml|blink|link|style|script|embed|object|iframe|frame|frameset|ilayer|layer|bgsound|title|base)[^>]*>#i', "", $this->_cleaned);
|
||||
} while ($oldstring != $this->_cleaned);
|
||||
$this->_cleaned = str_replace(array("&", "<", ">"), array("&amp;", "&lt;", "&gt;"), $this->_cleaned);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ class FormHelper extends AppHelper {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
private $__options = array(
|
||||
protected $_options = array(
|
||||
'day' => array(), 'minute' => array(), 'hour' => array(),
|
||||
'month' => array(), 'year' => array(), 'meridian' => array()
|
||||
);
|
||||
|
@ -1697,7 +1697,7 @@ class FormHelper extends AppHelper {
|
|||
(array)$attributes, array('secure' => self::SECURE_SKIP)
|
||||
));
|
||||
|
||||
if (is_string($options) && isset($this->__options[$options])) {
|
||||
if (is_string($options) && isset($this->_options[$options])) {
|
||||
$options = $this->__generateOptions($options);
|
||||
} elseif (!is_array($options)) {
|
||||
$options = array();
|
||||
|
@ -2451,8 +2451,8 @@ class FormHelper extends AppHelper {
|
|||
}
|
||||
break;
|
||||
}
|
||||
$this->__options[$name] = $data;
|
||||
return $this->__options[$name];
|
||||
$this->_options[$name] = $data;
|
||||
return $this->_options[$name];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -128,7 +128,7 @@ class HtmlHelper extends AppHelper {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
private $__includedScripts = array();
|
||||
protected $_includedScripts = array();
|
||||
/**
|
||||
* Options for the currently opened script block buffer if any.
|
||||
*
|
||||
|
@ -140,7 +140,7 @@ class HtmlHelper extends AppHelper {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
private $__docTypes = array(
|
||||
protected $_docTypes = array(
|
||||
'html4-strict' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">',
|
||||
'html4-trans' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">',
|
||||
'html4-frame' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">',
|
||||
|
@ -205,8 +205,8 @@ class HtmlHelper extends AppHelper {
|
|||
* @link http://book.cakephp.org/view/1439/docType
|
||||
*/
|
||||
public function docType($type = 'xhtml-strict') {
|
||||
if (isset($this->__docTypes[$type])) {
|
||||
return $this->__docTypes[$type];
|
||||
if (isset($this->_docTypes[$type])) {
|
||||
return $this->_docTypes[$type];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -484,10 +484,10 @@ class HtmlHelper extends AppHelper {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
if ($options['once'] && isset($this->__includedScripts[$url])) {
|
||||
if ($options['once'] && isset($this->_includedScripts[$url])) {
|
||||
return null;
|
||||
}
|
||||
$this->__includedScripts[$url] = true;
|
||||
$this->_includedScripts[$url] = true;
|
||||
|
||||
if (strpos($url, '://') === false) {
|
||||
if ($url[0] !== '/') {
|
||||
|
@ -1008,7 +1008,7 @@ class HtmlHelper extends AppHelper {
|
|||
$this->_minimizedAttributes = array_merge($this->_minimizedAttributes, $configs['minimizedAttributes']);
|
||||
}
|
||||
if (isset($configs['docTypes']) && is_array($configs['docTypes'])) {
|
||||
$this->__docTypes = array_merge($this->__docTypes, $configs['docTypes']);
|
||||
$this->_docTypes = array_merge($this->_docTypes, $configs['docTypes']);
|
||||
}
|
||||
if (isset($configs['attributeFormat'])) {
|
||||
$this->_attributeFormat = $configs['attributeFormat'];
|
||||
|
|
|
@ -52,7 +52,7 @@ class JsHelper extends AppHelper {
|
|||
* @var array
|
||||
* @see JsHelper::set()
|
||||
*/
|
||||
private $__jsVars = array();
|
||||
protected $_jsVars = array();
|
||||
|
||||
/**
|
||||
* Scripts that are queued for output
|
||||
|
@ -60,14 +60,14 @@ class JsHelper extends AppHelper {
|
|||
* @var array
|
||||
* @see JsHelper::buffer()
|
||||
*/
|
||||
private $__bufferedScripts = array();
|
||||
protected $_bufferedScripts = array();
|
||||
|
||||
/**
|
||||
* Current Javascript Engine that is being used
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $__engineName;
|
||||
protected $_engineName;
|
||||
|
||||
/**
|
||||
* The javascript variable created by set() variables.
|
||||
|
@ -92,7 +92,7 @@ class JsHelper extends AppHelper {
|
|||
$engineName = $className;
|
||||
list($plugin, $className) = pluginSplit($className);
|
||||
|
||||
$this->__engineName = $className . 'Engine';
|
||||
$this->_engineName = $className . 'Engine';
|
||||
$engineClass = $engineName . 'Engine';
|
||||
$this->helpers[] = $engineClass;
|
||||
parent::__construct($View, $settings);
|
||||
|
@ -118,9 +118,9 @@ class JsHelper extends AppHelper {
|
|||
* @return mixed Depends on the return of the dispatched method, or it could be an instance of the EngineHelper
|
||||
*/
|
||||
public function __call($method, $params) {
|
||||
if ($this->{$this->__engineName} && method_exists($this->{$this->__engineName}, $method)) {
|
||||
if ($this->{$this->_engineName} && method_exists($this->{$this->_engineName}, $method)) {
|
||||
$buffer = false;
|
||||
$engineHelper = $this->{$this->__engineName};
|
||||
$engineHelper = $this->{$this->_engineName};
|
||||
if (in_array(strtolower($method), $engineHelper->bufferedMethods)) {
|
||||
$buffer = true;
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ class JsHelper extends AppHelper {
|
|||
* @return string a JavaScript-safe/JSON representation of $val
|
||||
**/
|
||||
public function value($val, $quoteString = true) {
|
||||
return $this->{$this->__engineName}->value($val, $quoteString);
|
||||
return $this->{$this->_engineName}->value($val, $quoteString);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -197,7 +197,7 @@ class JsHelper extends AppHelper {
|
|||
}
|
||||
|
||||
if ($options['onDomReady']) {
|
||||
$script = $this->{$this->__engineName}->domReady($script);
|
||||
$script = $this->{$this->_engineName}->domReady($script);
|
||||
}
|
||||
$opts = $options;
|
||||
unset($opts['onDomReady'], $opts['cache'], $opts['clear']);
|
||||
|
@ -227,9 +227,9 @@ class JsHelper extends AppHelper {
|
|||
*/
|
||||
public function buffer($script, $top = false) {
|
||||
if ($top) {
|
||||
array_unshift($this->__bufferedScripts, $script);
|
||||
array_unshift($this->_bufferedScripts, $script);
|
||||
} else {
|
||||
$this->__bufferedScripts[] = $script;
|
||||
$this->_bufferedScripts[] = $script;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -241,10 +241,10 @@ class JsHelper extends AppHelper {
|
|||
*/
|
||||
public function getBuffer($clear = true) {
|
||||
$this->_createVars();
|
||||
$scripts = $this->__bufferedScripts;
|
||||
$scripts = $this->_bufferedScripts;
|
||||
if ($clear) {
|
||||
$this->__bufferedScripts = array();
|
||||
$this->__jsVars = array();
|
||||
$this->_bufferedScripts = array();
|
||||
$this->_jsVars = array();
|
||||
}
|
||||
return $scripts;
|
||||
}
|
||||
|
@ -255,9 +255,9 @@ class JsHelper extends AppHelper {
|
|||
* @return string Generated JSON object of all set vars
|
||||
*/
|
||||
protected function _createVars() {
|
||||
if (!empty($this->__jsVars)) {
|
||||
if (!empty($this->_jsVars)) {
|
||||
$setVar = (strpos($this->setVariable, '.')) ? $this->setVariable : 'window.' . $this->setVariable;
|
||||
$this->buffer($setVar . ' = ' . $this->object($this->__jsVars) . ';', true);
|
||||
$this->buffer($setVar . ' = ' . $this->object($this->_jsVars) . ';', true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -330,7 +330,7 @@ class JsHelper extends AppHelper {
|
|||
if ($data == null) {
|
||||
return false;
|
||||
}
|
||||
$this->__jsVars = array_merge($this->__jsVars, $data);
|
||||
$this->_jsVars = array_merge($this->_jsVars, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -37,13 +37,6 @@ class PaginatorHelper extends AppHelper {
|
|||
*/
|
||||
public $helpers = array('Html');
|
||||
|
||||
/**
|
||||
* Holds the default model for paged recordsets
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $__defaultModel = null;
|
||||
|
||||
/**
|
||||
* The class used for 'Ajax' pagination links. Defaults to JsHelper. You should make sure
|
||||
* that JsHelper is defined as a helper before PaginatorHelper, if you want to customize the JsHelper.
|
||||
|
@ -527,14 +520,14 @@ class PaginatorHelper extends AppHelper {
|
|||
* @return string Model name or null if the pagination isn't initialized.
|
||||
*/
|
||||
public function defaultModel() {
|
||||
if ($this->__defaultModel != null) {
|
||||
return $this->__defaultModel;
|
||||
if ($this->_defaultModel != null) {
|
||||
return $this->_defaultModel;
|
||||
}
|
||||
if (empty($this->request->params['paging'])) {
|
||||
return null;
|
||||
}
|
||||
list($this->__defaultModel) = array_keys($this->request->params['paging']);
|
||||
return $this->__defaultModel;
|
||||
list($this->_defaultModel) = array_keys($this->request->params['paging']);
|
||||
return $this->_defaultModel;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -138,7 +138,7 @@ class TextHelper extends AppHelper {
|
|||
* @return string
|
||||
* @see TextHelper::autoLinkUrls()
|
||||
*/
|
||||
private function _linkBareUrl($matches) {
|
||||
protected function _linkBareUrl($matches) {
|
||||
return $this->Html->link($matches[0], $matches[0], $this->_linkOptions);
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ class TextHelper extends AppHelper {
|
|||
* @return string
|
||||
* @see TextHelper::autoLinkUrls()
|
||||
*/
|
||||
private function _linkUrls($matches) {
|
||||
protected function _linkUrls($matches) {
|
||||
return $this->Html->link($matches[0], 'http://' . $matches[0], $this->_linkOptions);
|
||||
}
|
||||
|
||||
|
@ -160,7 +160,7 @@ class TextHelper extends AppHelper {
|
|||
* @return string
|
||||
* @see TextHelper::autoLinkUrls()
|
||||
*/
|
||||
private function _linkEmails($matches) {
|
||||
protected function _linkEmails($matches) {
|
||||
return $this->Html->link($matches[0], 'mailto:' . $matches[0], $this->_linkOptions);
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ class TimeHelper extends AppHelper {
|
|||
$time = time();
|
||||
}
|
||||
$this->__time = $time;
|
||||
return preg_replace_callback('/\%(\w+)/', array($this, '__translateSpecifier'), $format);
|
||||
return preg_replace_callback('/\%(\w+)/', array($this, '_translateSpecifier'), $format);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -77,7 +77,7 @@ class TimeHelper extends AppHelper {
|
|||
* @param array $specifier match from regular expression
|
||||
* @return string converted element
|
||||
*/
|
||||
private function __translateSpecifier($specifier) {
|
||||
protected function _translateSpecifier($specifier) {
|
||||
switch ($specifier[1]) {
|
||||
case 'a':
|
||||
$abday = __dc('cake', 'abday', 5);
|
||||
|
@ -140,7 +140,7 @@ class TimeHelper extends AppHelper {
|
|||
case 'r':
|
||||
$complete = __dc('cake', 't_fmt_ampm', 5);
|
||||
if ($complete != 't_fmt_ampm') {
|
||||
return str_replace('%p',$this->__translateSpecifier(array('%p', 'p')),$complete);
|
||||
return str_replace('%p',$this->_translateSpecifier(array('%p', 'p')),$complete);
|
||||
}
|
||||
break;
|
||||
case 'R':
|
||||
|
|
|
@ -208,7 +208,7 @@ class View extends Object {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
private $__passedVars = array(
|
||||
protected $_passedVars = array(
|
||||
'viewVars', 'autoLayout', 'ext', 'helpers', 'view', 'layout', 'name',
|
||||
'layoutPath', 'viewPath', 'request', 'plugin', 'passedArgs', 'cacheAction'
|
||||
);
|
||||
|
@ -225,7 +225,7 @@ class View extends Object {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
private $__paths = array();
|
||||
protected $_paths = array();
|
||||
|
||||
/**
|
||||
* boolean to indicate that helpers have been loaded.
|
||||
|
@ -241,9 +241,9 @@ class View extends Object {
|
|||
*/
|
||||
public function __construct($controller) {
|
||||
if (is_object($controller)) {
|
||||
$count = count($this->__passedVars);
|
||||
$count = count($this->_passedVars);
|
||||
for ($j = 0; $j < $count; $j++) {
|
||||
$var = $this->__passedVars[$j];
|
||||
$var = $this->_passedVars[$j];
|
||||
$this->{$var} = $controller->{$var};
|
||||
}
|
||||
}
|
||||
|
@ -742,8 +742,8 @@ class View extends Object {
|
|||
* @return array paths
|
||||
*/
|
||||
protected function _paths($plugin = null, $cached = true) {
|
||||
if ($plugin === null && $cached === true && !empty($this->__paths)) {
|
||||
return $this->__paths;
|
||||
if ($plugin === null && $cached === true && !empty($this->_paths)) {
|
||||
return $this->_paths;
|
||||
}
|
||||
$paths = array();
|
||||
$viewPaths = App::path('View');
|
||||
|
@ -758,7 +758,7 @@ class View extends Object {
|
|||
$paths = array_merge($paths, App::path('View', $plugin));
|
||||
}
|
||||
|
||||
$this->__paths = array_unique(array_merge($paths, $viewPaths, array_keys($corePaths)));
|
||||
return $this->__paths;
|
||||
$this->_paths = array_unique(array_merge($paths, $viewPaths, array_keys($corePaths)));
|
||||
return $this->_paths;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue