mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge branch 'master' into 2.6
Conflicts: lib/Cake/Core/App.php
This commit is contained in:
commit
a2673d8bf0
25 changed files with 161 additions and 105 deletions
|
@ -56,7 +56,11 @@ class DbAclSchema extends CakeSchema {
|
|||
'alias' => array('type' => 'string', 'null' => true),
|
||||
'lft' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
|
||||
'rght' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
|
||||
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1))
|
||||
'indexes' => array(
|
||||
'PRIMARY' => array('column' => 'id', 'unique' => 1),
|
||||
'idx_acos_lft_rght' => array('column' => array('lft', 'rght'), 'unique' => 0),
|
||||
'idx_acos_alias' => array('column' => 'alias', 'unique' => 0)
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -70,7 +74,11 @@ class DbAclSchema extends CakeSchema {
|
|||
'alias' => array('type' => 'string', 'null' => true),
|
||||
'lft' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
|
||||
'rght' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
|
||||
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1))
|
||||
'indexes' => array(
|
||||
'PRIMARY' => array('column' => 'id','unique' => 1),
|
||||
'idx_aros_lft_rght' => array('column' => array('lft', 'rght'), 'unique' => 0),
|
||||
'idx_aros_alias' => array('column' => 'alias', 'unique' => 0)
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -85,7 +93,11 @@ class DbAclSchema extends CakeSchema {
|
|||
'_read' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2),
|
||||
'_update' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2),
|
||||
'_delete' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2),
|
||||
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1), 'ARO_ACO_KEY' => array('column' => array('aro_id', 'aco_id'), 'unique' => 1))
|
||||
'indexes' => array(
|
||||
'PRIMARY' => array('column' => 'id', 'unique' => 1),
|
||||
'ARO_ACO_KEY' => array('column' => array('aro_id', 'aco_id'), 'unique' => 1),
|
||||
'idx_aco_id' => array('column' => 'aco_id', 'unique' => 0)
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
|
|
|
@ -38,4 +38,15 @@ CREATE TABLE aros (
|
|||
lft INTEGER(10) DEFAULT NULL,
|
||||
rght INTEGER(10) DEFAULT NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
);
|
||||
|
||||
/* this indexes will improve acl perfomance */
|
||||
CREATE INDEX idx_acos_lft_rght ON `acos` (`lft`, `rhgt`);
|
||||
|
||||
CREATE INDEX idx_acos_alias ON `acos` (`alias`);
|
||||
|
||||
CREATE INDEX idx_aros_lft_rght ON `aros` (`lft`, `rhgt`);
|
||||
|
||||
CREATE INDEX idx_aros_alias ON `aros` (`alias`);
|
||||
|
||||
CREATE INDEX idx_aco_id ON `aros_acos` (`aco_id`);
|
|
@ -25,11 +25,18 @@ $dispatcher = 'Cake' . DS . 'Console' . DS . 'ShellDispatcher.php';
|
|||
|
||||
if (function_exists('ini_set')) {
|
||||
$root = dirname(dirname(dirname(__FILE__)));
|
||||
$appDir = basename(dirname(dirname(__FILE__)));
|
||||
$install = $root . DS . 'lib';
|
||||
$composerInstall = $root . DS . $appDir . DS . 'Vendor' . DS . 'cakephp' . DS . 'cakephp' . DS . 'lib';
|
||||
|
||||
// the following line differs from its sibling
|
||||
// the following lines differ from its sibling
|
||||
// /lib/Cake/Console/Templates/skel/Console/cake.php
|
||||
ini_set('include_path', $root . DS . 'lib' . PATH_SEPARATOR . ini_get('include_path'));
|
||||
unset($root);
|
||||
if (file_exists($composerInstall . DS . $dispatcher)) {
|
||||
$install = $composerInstall;
|
||||
}
|
||||
|
||||
ini_set('include_path', $install . PATH_SEPARATOR . ini_get('include_path'));
|
||||
unset($root, $appDir, $install, $composerInstall);
|
||||
}
|
||||
|
||||
if (!include $dispatcher) {
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
*/
|
||||
|
||||
App::uses('Hash', 'Utility');
|
||||
App::uses('CakePlugin', 'Core');
|
||||
|
||||
/**
|
||||
* Ini file configuration engine.
|
||||
|
@ -218,7 +219,7 @@ class IniReader implements ConfigReaderInterface {
|
|||
}
|
||||
|
||||
if ($plugin) {
|
||||
$file = App::pluginPath($plugin) . 'Config' . DS . $key;
|
||||
$file = CakePlugin::path($plugin) . 'Config' . DS . $key;
|
||||
} else {
|
||||
$file = $this->_path . $key;
|
||||
}
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
App::uses('CakePlugin', 'Core');
|
||||
|
||||
/**
|
||||
* PHP Reader allows Configure to load configuration values from
|
||||
* files containing simple PHP arrays.
|
||||
|
@ -49,7 +51,7 @@ class PhpReader implements ConfigReaderInterface {
|
|||
* Read a config file and return its contents.
|
||||
*
|
||||
* Files with `.` in the name will be treated as values in plugins. Instead of reading from
|
||||
* the initialized path, plugin keys will be located using App::pluginPath().
|
||||
* the initialized path, plugin keys will be located using CakePlugin::path().
|
||||
*
|
||||
* @param string $key The identifier to read from. If the key has a . it will be treated
|
||||
* as a plugin prefix.
|
||||
|
@ -105,7 +107,7 @@ class PhpReader implements ConfigReaderInterface {
|
|||
$key .= '.php';
|
||||
|
||||
if ($plugin) {
|
||||
$file = App::pluginPath($plugin) . 'Config' . DS . $key;
|
||||
$file = CakePlugin::path($plugin) . 'Config' . DS . $key;
|
||||
} else {
|
||||
$file = $this->_path . $key;
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
App::uses('AppShell', 'Console/Command');
|
||||
App::uses('Folder', 'Utility');
|
||||
App::uses('CakePlugin', 'Core');
|
||||
|
||||
/**
|
||||
* A shell class to help developers upgrade applications to CakePHP 2.0
|
||||
|
@ -102,7 +103,7 @@ class UpgradeShell extends AppShell {
|
|||
public function tests() {
|
||||
$this->_paths = array(APP . 'tests' . DS);
|
||||
if (!empty($this->params['plugin'])) {
|
||||
$this->_paths = array(App::pluginPath($this->params['plugin']) . 'tests' . DS);
|
||||
$this->_paths = array(CakePlugin::path($this->params['plugin']) . 'tests' . DS);
|
||||
}
|
||||
$patterns = array(
|
||||
array(
|
||||
|
@ -128,7 +129,7 @@ class UpgradeShell extends AppShell {
|
|||
$cwd = getcwd();
|
||||
|
||||
if (!empty($this->params['plugin'])) {
|
||||
chdir(App::pluginPath($this->params['plugin']));
|
||||
chdir(CakePlugin::path($this->params['plugin']));
|
||||
}
|
||||
|
||||
if (is_dir('plugins')) {
|
||||
|
@ -215,7 +216,7 @@ class UpgradeShell extends AppShell {
|
|||
$this->_paths = array_diff(App::path('views'), App::core('views'));
|
||||
|
||||
if (!empty($this->params['plugin'])) {
|
||||
$this->_paths = array(App::pluginPath($this->params['plugin']) . 'views' . DS);
|
||||
$this->_paths = array(CakePlugin::path($this->params['plugin']) . 'views' . DS);
|
||||
}
|
||||
|
||||
$patterns = array();
|
||||
|
@ -229,7 +230,7 @@ class UpgradeShell extends AppShell {
|
|||
CakePlugin::load($plugin);
|
||||
$pluginHelpers = array_merge(
|
||||
$pluginHelpers,
|
||||
App::objects('helper', App::pluginPath($plugin) . DS . 'views' . DS . 'helpers' . DS, false)
|
||||
App::objects('helper', CakePlugin::path($plugin) . DS . 'views' . DS . 'helpers' . DS, false)
|
||||
);
|
||||
}
|
||||
$helpers = array_merge($pluginHelpers, $helpers);
|
||||
|
@ -260,7 +261,7 @@ class UpgradeShell extends AppShell {
|
|||
APP
|
||||
);
|
||||
if (!empty($this->params['plugin'])) {
|
||||
$this->_paths = array(App::pluginPath($this->params['plugin']));
|
||||
$this->_paths = array(CakePlugin::path($this->params['plugin']));
|
||||
}
|
||||
|
||||
$patterns = array(
|
||||
|
@ -299,7 +300,7 @@ class UpgradeShell extends AppShell {
|
|||
APP
|
||||
);
|
||||
if (!empty($this->params['plugin'])) {
|
||||
$this->_paths = array(App::pluginPath($this->params['plugin']));
|
||||
$this->_paths = array(CakePlugin::path($this->params['plugin']));
|
||||
}
|
||||
$patterns = array(
|
||||
array(
|
||||
|
@ -354,7 +355,7 @@ class UpgradeShell extends AppShell {
|
|||
$this->_paths = array_merge($views, $controllers, $components);
|
||||
|
||||
if (!empty($this->params['plugin'])) {
|
||||
$pluginPath = App::pluginPath($this->params['plugin']);
|
||||
$pluginPath = CakePlugin::path($this->params['plugin']);
|
||||
$this->_paths = array(
|
||||
$pluginPath . 'controllers' . DS,
|
||||
$pluginPath . 'controllers' . DS . 'components' . DS,
|
||||
|
@ -411,7 +412,7 @@ class UpgradeShell extends AppShell {
|
|||
APP
|
||||
);
|
||||
if (!empty($this->params['plugin'])) {
|
||||
$this->_paths = array(App::pluginPath($this->params['plugin']));
|
||||
$this->_paths = array(CakePlugin::path($this->params['plugin']));
|
||||
}
|
||||
$patterns = array(
|
||||
array(
|
||||
|
@ -433,7 +434,7 @@ class UpgradeShell extends AppShell {
|
|||
APP
|
||||
);
|
||||
if (!empty($this->params['plugin'])) {
|
||||
$this->_paths = array(App::pluginPath($this->params['plugin']));
|
||||
$this->_paths = array(CakePlugin::path($this->params['plugin']));
|
||||
}
|
||||
$patterns = array(
|
||||
array(
|
||||
|
@ -564,7 +565,7 @@ class UpgradeShell extends AppShell {
|
|||
$this->_paths = array_merge($controllers, $components);
|
||||
|
||||
if (!empty($this->params['plugin'])) {
|
||||
$pluginPath = App::pluginPath($this->params['plugin']);
|
||||
$pluginPath = CakePlugin::path($this->params['plugin']);
|
||||
$this->_paths = array(
|
||||
$pluginPath . 'controllers' . DS,
|
||||
$pluginPath . 'controllers' . DS . 'components' . DS,
|
||||
|
|
|
@ -218,7 +218,7 @@ class ConsoleOptionParser {
|
|||
* Get or set the command name for shell/task.
|
||||
*
|
||||
* @param string $text The text to set, or null if you want to read
|
||||
* @return mixed If reading, the value of the command. If setting $this will be returned
|
||||
* @return string|$this If reading, the value of the command. If setting $this will be returned.
|
||||
*/
|
||||
public function command($text = null) {
|
||||
if ($text !== null) {
|
||||
|
@ -233,7 +233,7 @@ class ConsoleOptionParser {
|
|||
*
|
||||
* @param string|array $text The text to set, or null if you want to read. If an array the
|
||||
* text will be imploded with "\n"
|
||||
* @return mixed If reading, the value of the description. If setting $this will be returned
|
||||
* @return string|$this If reading, the value of the description. If setting $this will be returned.
|
||||
*/
|
||||
public function description($text = null) {
|
||||
if ($text !== null) {
|
||||
|
@ -251,7 +251,7 @@ class ConsoleOptionParser {
|
|||
* the options and arguments listing when help is generated.
|
||||
*
|
||||
* @param string|array $text Text when setting or null when reading. If an array the text will be imploded with "\n"
|
||||
* @return mixed If reading, the value of the epilog. If setting $this will be returned.
|
||||
* @return string|$this If reading, the value of the epilog. If setting $this will be returned.
|
||||
*/
|
||||
public function epilog($text = null) {
|
||||
if ($text !== null) {
|
||||
|
@ -284,7 +284,7 @@ class ConsoleOptionParser {
|
|||
* @param ConsoleInputOption|string $name The long name you want to the value to be parsed out as when options are parsed.
|
||||
* Will also accept an instance of ConsoleInputOption
|
||||
* @param array $options An array of parameters that define the behavior of the option
|
||||
* @return ConsoleOptionParser $this.
|
||||
* @return $this
|
||||
*/
|
||||
public function addOption($name, $options = array()) {
|
||||
if (is_object($name) && $name instanceof ConsoleInputOption) {
|
||||
|
@ -324,7 +324,7 @@ class ConsoleOptionParser {
|
|||
*
|
||||
* @param ConsoleInputArgument|string $name The name of the argument. Will also accept an instance of ConsoleInputArgument
|
||||
* @param array $params Parameters for the argument, see above.
|
||||
* @return ConsoleOptionParser $this.
|
||||
* @return $this
|
||||
*/
|
||||
public function addArgument($name, $params = array()) {
|
||||
if (is_object($name) && $name instanceof ConsoleInputArgument) {
|
||||
|
@ -354,7 +354,7 @@ class ConsoleOptionParser {
|
|||
*
|
||||
* @param array $args Array of arguments to add.
|
||||
* @see ConsoleOptionParser::addArgument()
|
||||
* @return ConsoleOptionParser $this
|
||||
* @return $this
|
||||
*/
|
||||
public function addArguments(array $args) {
|
||||
foreach ($args as $name => $params) {
|
||||
|
@ -369,7 +369,7 @@ class ConsoleOptionParser {
|
|||
*
|
||||
* @param array $options Array of options to add.
|
||||
* @see ConsoleOptionParser::addOption()
|
||||
* @return ConsoleOptionParser $this
|
||||
* @return $this
|
||||
*/
|
||||
public function addOptions(array $options) {
|
||||
foreach ($options as $name => $params) {
|
||||
|
@ -391,7 +391,7 @@ class ConsoleOptionParser {
|
|||
*
|
||||
* @param ConsoleInputSubcommand|string $name Name of the subcommand. Will also accept an instance of ConsoleInputSubcommand
|
||||
* @param array $options Array of params, see above.
|
||||
* @return ConsoleOptionParser $this.
|
||||
* @return $this
|
||||
*/
|
||||
public function addSubcommand($name, $options = array()) {
|
||||
if (is_object($name) && $name instanceof ConsoleInputSubcommand) {
|
||||
|
@ -414,7 +414,7 @@ class ConsoleOptionParser {
|
|||
* Add multiple subcommands at once.
|
||||
*
|
||||
* @param array $commands Array of subcommands.
|
||||
* @return ConsoleOptionParser $this
|
||||
* @return $this
|
||||
*/
|
||||
public function addSubcommands(array $commands) {
|
||||
foreach ($commands as $name => $params) {
|
||||
|
@ -597,6 +597,7 @@ class ConsoleOptionParser {
|
|||
$params[$name] = $value;
|
||||
return $params;
|
||||
}
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -24,11 +24,20 @@ $dispatcher = 'Cake' . DS . 'Console' . DS . 'ShellDispatcher.php';
|
|||
|
||||
if (function_exists('ini_set')) {
|
||||
$root = dirname(dirname(dirname(__FILE__)));
|
||||
$appDir = basename(dirname(dirname(__FILE__)));
|
||||
$install = $root . DS . 'lib';
|
||||
$composerInstall = $root . DS . $appDir . DS . 'Vendor' . DS . 'cakephp' . DS . 'cakephp' . DS . 'lib';
|
||||
|
||||
// the following line differs from its sibling
|
||||
// the following lines differ from its sibling
|
||||
// /app/Console/cake.php
|
||||
ini_set('include_path', $root . PATH_SEPARATOR . __CAKE_PATH__ . PATH_SEPARATOR . ini_get('include_path'));
|
||||
unset($root);
|
||||
if (file_exists($composerInstall . DS . $dispatcher)) {
|
||||
$install = $composerInstall;
|
||||
} elseif (!file_exists($install . DS . $dispatcher)) {
|
||||
$install = $root . PATH_SEPARATOR . __CAKE_PATH__;
|
||||
}
|
||||
|
||||
ini_set('include_path', $install . PATH_SEPARATOR . ini_get('include_path'));
|
||||
unset($root, $appDir, $install, $composerInstall);
|
||||
}
|
||||
|
||||
if (!include $dispatcher) {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
|
@ -164,7 +162,7 @@ class DigestAuthenticate extends BasicAuthenticate {
|
|||
}
|
||||
$keys = $match = array();
|
||||
$req = array('nonce' => 1, 'nc' => 1, 'cnonce' => 1, 'qop' => 1, 'username' => 1, 'uri' => 1, 'response' => 1);
|
||||
preg_match_all('/(\w+)=([\'"]?)([a-zA-Z0-9@=.\/_-]+)\2/', $digest, $match, PREG_SET_ORDER);
|
||||
preg_match_all('/(\w+)=([\'"]?)([a-zA-Z0-9\:\#\%@=.\/_-]+)\2/', $digest, $match, PREG_SET_ORDER);
|
||||
|
||||
foreach ($match as $i) {
|
||||
$keys[$i[1]] = $i[3];
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
*/
|
||||
|
||||
App::uses('Inflector', 'Utility');
|
||||
App::uses('CakePlugin', 'Core');
|
||||
|
||||
/**
|
||||
* App is responsible for path management, class location and class loading.
|
||||
|
@ -223,7 +224,7 @@ class App {
|
|||
|
||||
if (!empty($plugin)) {
|
||||
$path = array();
|
||||
$pluginPath = self::pluginPath($plugin);
|
||||
$pluginPath = CakePlugin::path($plugin);
|
||||
$packageFormat = self::_packageFormat();
|
||||
if (!empty($packageFormat[$type])) {
|
||||
foreach ($packageFormat[$type] as $f) {
|
||||
|
@ -360,7 +361,7 @@ class App {
|
|||
* @param string $plugin CamelCased/lower_cased plugin name to find the path of.
|
||||
* @return string full path to the plugin.
|
||||
* @link http://book.cakephp.org/2.0/en/core-utility-libraries/app.html#App::pluginPath
|
||||
* @deprecated 2.6 Use `CakePlugin::path()` instead.
|
||||
* @deprecated Use `CakePlugin::path()` instead.
|
||||
*/
|
||||
public static function pluginPath($plugin) {
|
||||
return CakePlugin::path($plugin);
|
||||
|
@ -553,7 +554,7 @@ class App {
|
|||
$paths[] = APP . $package . DS;
|
||||
$paths[] = CAKE . $package . DS;
|
||||
} else {
|
||||
$pluginPath = self::pluginPath($plugin);
|
||||
$pluginPath = CakePlugin::path($plugin);
|
||||
$paths[] = $pluginPath . 'Lib' . DS . $package . DS;
|
||||
$paths[] = $pluginPath . $package . DS;
|
||||
}
|
||||
|
|
|
@ -89,6 +89,8 @@ class AclNode extends Model {
|
|||
)),
|
||||
'order' => $db->name("{$type}.lft") . ' DESC'
|
||||
);
|
||||
|
||||
$conditionsAfterJoin = array();
|
||||
|
||||
foreach ($path as $i => $alias) {
|
||||
$j = $i - 1;
|
||||
|
@ -98,18 +100,23 @@ class AclNode extends Model {
|
|||
'alias' => "{$type}{$i}",
|
||||
'type' => 'INNER',
|
||||
'conditions' => array(
|
||||
$db->name("{$type}{$i}.lft") . ' > ' . $db->name("{$type}{$j}.lft"),
|
||||
$db->name("{$type}{$i}.rght") . ' < ' . $db->name("{$type}{$j}.rght"),
|
||||
$db->name("{$type}{$i}.alias") . ' = ' . $db->value($alias, 'string'),
|
||||
$db->name("{$type}{$j}.id") . ' = ' . $db->name("{$type}{$i}.parent_id")
|
||||
$db->name("{$type}{$i}.alias") . ' = ' . $db->value($alias, 'string')
|
||||
)
|
||||
);
|
||||
|
||||
// it will be better if this conditions will performs after join operation
|
||||
$conditionsAfterJoin[] = $db->name("{$type}{$j}.id") . ' = ' . $db->name("{$type}{$i}.parent_id");
|
||||
$conditionsAfterJoin[] = $db->name("{$type}{$i}.rght") . ' < ' . $db->name("{$type}{$j}.rght");
|
||||
$conditionsAfterJoin[] = $db->name("{$type}{$i}.lft") . ' > ' . $db->name("{$type}{$j}.lft");
|
||||
|
||||
$queryData['conditions'] = array('or' => array(
|
||||
$db->name("{$type}.lft") . ' <= ' . $db->name("{$type}0.lft") . ' AND ' . $db->name("{$type}.rght") . ' >= ' . $db->name("{$type}0.rght"),
|
||||
$db->name("{$type}.lft") . ' <= ' . $db->name("{$type}{$i}.lft") . ' AND ' . $db->name("{$type}.rght") . ' >= ' . $db->name("{$type}{$i}.rght"))
|
||||
);
|
||||
}
|
||||
|
||||
$queryData['conditions'] = array_merge($queryData['conditions'], $conditionsAfterJoin);
|
||||
|
||||
$result = $db->read($this, $queryData, -1);
|
||||
$path = array_values($path);
|
||||
|
||||
|
|
|
@ -362,7 +362,7 @@ class ModelValidator implements ArrayAccess, IteratorAggregate, Countable {
|
|||
* Sets the I18n domain for validation messages. This method is chainable.
|
||||
*
|
||||
* @param string $validationDomain [optional] The validation domain to be used.
|
||||
* @return ModelValidator
|
||||
* @return $this
|
||||
*/
|
||||
public function setValidationDomain($validationDomain = null) {
|
||||
if (empty($validationDomain)) {
|
||||
|
@ -547,7 +547,7 @@ class ModelValidator implements ArrayAccess, IteratorAggregate, Countable {
|
|||
* @param string $field The name of the field where the rule is to be added
|
||||
* @param string|array|CakeValidationSet $name name of the rule to be added or list of rules for the field
|
||||
* @param array|CakeValidationRule $rule or list of rules to be added to the field's rule set
|
||||
* @return ModelValidator this instance
|
||||
* @return $this
|
||||
*/
|
||||
public function add($field, $name, $rule = null) {
|
||||
$this->_parseRules();
|
||||
|
@ -586,7 +586,7 @@ class ModelValidator implements ArrayAccess, IteratorAggregate, Countable {
|
|||
*
|
||||
* @param string $field The name of the field from which the rule will be removed
|
||||
* @param string $rule the name of the rule to be removed
|
||||
* @return ModelValidator this instance
|
||||
* @return $this
|
||||
*/
|
||||
public function remove($field, $rule = null) {
|
||||
$this->_parseRules();
|
||||
|
|
|
@ -191,7 +191,7 @@ class CakeValidationSet implements ArrayAccess, IteratorAggregate, Countable {
|
|||
*
|
||||
* @param string $name The name under which the rule should be set
|
||||
* @param CakeValidationRule|array $rule The validation rule to be set
|
||||
* @return CakeValidationSet this instance
|
||||
* @return $this
|
||||
*/
|
||||
public function setRule($name, $rule) {
|
||||
if (!($rule instanceof CakeValidationRule)) {
|
||||
|
@ -213,7 +213,7 @@ class CakeValidationSet implements ArrayAccess, IteratorAggregate, Countable {
|
|||
* }}}
|
||||
*
|
||||
* @param string $name The name under which the rule should be unset
|
||||
* @return CakeValidationSet this instance
|
||||
* @return $this
|
||||
*/
|
||||
public function removeRule($name) {
|
||||
unset($this->_rules[$name]);
|
||||
|
@ -234,7 +234,7 @@ class CakeValidationSet implements ArrayAccess, IteratorAggregate, Countable {
|
|||
*
|
||||
* @param array $rules The rules to be set
|
||||
* @param boolean $mergeVars [optional] If true, merges vars instead of replace. Defaults to true.
|
||||
* @return ModelField
|
||||
* @return $this
|
||||
*/
|
||||
public function setRules($rules = array(), $mergeVars = true) {
|
||||
if ($mergeVars === false) {
|
||||
|
|
|
@ -602,7 +602,7 @@ class CakeRequest implements ArrayAccess {
|
|||
* This modifies the parameters available through `$request->params`.
|
||||
*
|
||||
* @param array $params Array of parameters to merge in
|
||||
* @return The current object, you can chain this method.
|
||||
* @return $this
|
||||
*/
|
||||
public function addParams($params) {
|
||||
$this->params = array_merge($this->params, (array)$params);
|
||||
|
@ -614,7 +614,7 @@ class CakeRequest implements ArrayAccess {
|
|||
* Provides an easy way to modify, here, webroot and base.
|
||||
*
|
||||
* @param array $paths Array of paths to merge in
|
||||
* @return CakeRequest the current object, you can chain this method.
|
||||
* @return $this
|
||||
*/
|
||||
public function addPaths($paths) {
|
||||
foreach (array('webroot', 'here', 'base') as $element) {
|
||||
|
@ -855,7 +855,7 @@ class CakeRequest implements ArrayAccess {
|
|||
* will be created for you.
|
||||
*
|
||||
* @param string $name Dot separated name of the value to read/write, one or more args.
|
||||
* @return mixed Either the value being read, or this so you can chain consecutive writes.
|
||||
* @return mixed|$this Either the value being read, or $this so you can chain consecutive writes.
|
||||
*/
|
||||
public function data($name) {
|
||||
$args = func_get_args();
|
||||
|
|
|
@ -583,7 +583,7 @@ class CakeResponse {
|
|||
}
|
||||
|
||||
/**
|
||||
* Acccessor for the location header.
|
||||
* Accessor for the location header.
|
||||
*
|
||||
* Get/Set the Location header value.
|
||||
*
|
||||
|
|
|
@ -451,7 +451,7 @@ class CakeEmail {
|
|||
* @param string|array $email Null to get, String with email,
|
||||
* Array with email as key, name as value or email as value (without name)
|
||||
* @param string $name Name
|
||||
* @return CakeEmail $this
|
||||
* @return $this
|
||||
*/
|
||||
public function addTo($email, $name = null) {
|
||||
return $this->_addEmail('_to', $email, $name);
|
||||
|
@ -478,7 +478,7 @@ class CakeEmail {
|
|||
* @param string|array $email Null to get, String with email,
|
||||
* Array with email as key, name as value or email as value (without name)
|
||||
* @param string $name Name
|
||||
* @return CakeEmail $this
|
||||
* @return $this
|
||||
*/
|
||||
public function addCc($email, $name = null) {
|
||||
return $this->_addEmail('_cc', $email, $name);
|
||||
|
@ -505,7 +505,7 @@ class CakeEmail {
|
|||
* @param string|array $email Null to get, String with email,
|
||||
* Array with email as key, name as value or email as value (without name)
|
||||
* @param string $name Name
|
||||
* @return CakeEmail $this
|
||||
* @return $this
|
||||
*/
|
||||
public function addBcc($email, $name = null) {
|
||||
return $this->_addEmail('_bcc', $email, $name);
|
||||
|
@ -545,7 +545,7 @@ class CakeEmail {
|
|||
* EmailPattern setter/getter
|
||||
*
|
||||
* @param string $regex for email address validation
|
||||
* @return string|CakeEmail
|
||||
* @return string|$this
|
||||
*/
|
||||
public function emailPattern($regex = null) {
|
||||
if ($regex === null) {
|
||||
|
@ -562,7 +562,7 @@ class CakeEmail {
|
|||
* @param string|array $email String with email,
|
||||
* Array with email as key, name as value or email as value (without name)
|
||||
* @param string $name Name
|
||||
* @return CakeEmail $this
|
||||
* @return $this
|
||||
*/
|
||||
protected function _setEmail($varName, $email, $name) {
|
||||
if (!is_array($email)) {
|
||||
|
@ -610,7 +610,7 @@ class CakeEmail {
|
|||
* Array with email as key, name as value or email as value (without name)
|
||||
* @param string $name Name
|
||||
* @param string $throwMessage Exception message
|
||||
* @return CakeEmail $this
|
||||
* @return $this
|
||||
* @throws SocketException
|
||||
*/
|
||||
protected function _setEmailSingle($varName, $email, $name, $throwMessage) {
|
||||
|
@ -630,7 +630,7 @@ class CakeEmail {
|
|||
* @param string|array $email String with email,
|
||||
* Array with email as key, name as value or email as value (without name)
|
||||
* @param string $name Name
|
||||
* @return CakeEmail $this
|
||||
* @return $this
|
||||
* @throws SocketException
|
||||
*/
|
||||
protected function _addEmail($varName, $email, $name) {
|
||||
|
@ -658,7 +658,7 @@ class CakeEmail {
|
|||
* Get/Set Subject.
|
||||
*
|
||||
* @param string $subject Subject string.
|
||||
* @return string|CakeEmail
|
||||
* @return string|$this
|
||||
*/
|
||||
public function subject($subject = null) {
|
||||
if ($subject === null) {
|
||||
|
@ -672,7 +672,7 @@ class CakeEmail {
|
|||
* Sets headers for the message
|
||||
*
|
||||
* @param array $headers Associative array containing headers to be set.
|
||||
* @return CakeEmail $this
|
||||
* @return $this
|
||||
* @throws SocketException
|
||||
*/
|
||||
public function setHeaders($headers) {
|
||||
|
@ -687,7 +687,7 @@ class CakeEmail {
|
|||
* Add header for the message
|
||||
*
|
||||
* @param array $headers Headers to set.
|
||||
* @return object $this
|
||||
* @return $this
|
||||
* @throws SocketException
|
||||
*/
|
||||
public function addHeaders($headers) {
|
||||
|
@ -820,7 +820,7 @@ class CakeEmail {
|
|||
*
|
||||
* @param boolean|string $template Template name or null to not use
|
||||
* @param boolean|string $layout Layout name or null to not use
|
||||
* @return array|CakeEmail
|
||||
* @return array|$this
|
||||
*/
|
||||
public function template($template = false, $layout = false) {
|
||||
if ($template === false) {
|
||||
|
@ -840,7 +840,7 @@ class CakeEmail {
|
|||
* View class for render
|
||||
*
|
||||
* @param string $viewClass View class name.
|
||||
* @return string|CakeEmail
|
||||
* @return string|$this
|
||||
*/
|
||||
public function viewRender($viewClass = null) {
|
||||
if ($viewClass === null) {
|
||||
|
@ -854,7 +854,7 @@ class CakeEmail {
|
|||
* Variables to be set on render
|
||||
*
|
||||
* @param array $viewVars Variables to set for view.
|
||||
* @return array|CakeEmail
|
||||
* @return array|$this
|
||||
*/
|
||||
public function viewVars($viewVars = null) {
|
||||
if ($viewVars === null) {
|
||||
|
@ -868,7 +868,7 @@ class CakeEmail {
|
|||
* Theme to use when rendering
|
||||
*
|
||||
* @param string $theme Theme name.
|
||||
* @return string|CakeEmail
|
||||
* @return string|$this
|
||||
*/
|
||||
public function theme($theme = null) {
|
||||
if ($theme === null) {
|
||||
|
@ -882,7 +882,7 @@ class CakeEmail {
|
|||
* Helpers to be used in render
|
||||
*
|
||||
* @param array $helpers Helpers list.
|
||||
* @return array|CakeEmail
|
||||
* @return array|$this
|
||||
*/
|
||||
public function helpers($helpers = null) {
|
||||
if ($helpers === null) {
|
||||
|
@ -896,7 +896,7 @@ class CakeEmail {
|
|||
* Email format
|
||||
*
|
||||
* @param string $format Formatting string.
|
||||
* @return string|CakeEmail
|
||||
* @return string|$this
|
||||
* @throws SocketException
|
||||
*/
|
||||
public function emailFormat($format = null) {
|
||||
|
@ -914,7 +914,7 @@ class CakeEmail {
|
|||
* Transport name
|
||||
*
|
||||
* @param string $name Transport name.
|
||||
* @return string|CakeEmail
|
||||
* @return string|$this
|
||||
*/
|
||||
public function transport($name = null) {
|
||||
if ($name === null) {
|
||||
|
@ -928,7 +928,7 @@ class CakeEmail {
|
|||
/**
|
||||
* Return the transport class
|
||||
*
|
||||
* @return CakeEmail
|
||||
* @return AbstractTransport
|
||||
* @throws SocketException
|
||||
*/
|
||||
public function transportClass() {
|
||||
|
@ -951,7 +951,7 @@ class CakeEmail {
|
|||
* Message-ID
|
||||
*
|
||||
* @param boolean|string $message True to generate a new Message-ID, False to ignore (not send in email), String to set as Message-ID
|
||||
* @return boolean|string|CakeEmail
|
||||
* @return boolean|string|$this
|
||||
* @throws SocketException
|
||||
*/
|
||||
public function messageId($message = null) {
|
||||
|
@ -973,7 +973,7 @@ class CakeEmail {
|
|||
* Domain as top level (the part after @)
|
||||
*
|
||||
* @param string $domain Manually set the domain for CLI mailing
|
||||
* @return string|CakeEmail
|
||||
* @return string|$this
|
||||
*/
|
||||
public function domain($domain = null) {
|
||||
if ($domain === null) {
|
||||
|
@ -1027,7 +1027,7 @@ class CakeEmail {
|
|||
* attachment compatibility with outlook email clients.
|
||||
*
|
||||
* @param string|array $attachments String with the filename or array with filenames
|
||||
* @return array|CakeEmail Either the array of attachments when getting or $this when setting.
|
||||
* @return array|$this Either the array of attachments when getting or $this when setting.
|
||||
* @throws SocketException
|
||||
*/
|
||||
public function attachments($attachments = null) {
|
||||
|
@ -1070,7 +1070,7 @@ class CakeEmail {
|
|||
* Add attachments
|
||||
*
|
||||
* @param string|array $attachments String with the filename or array with filenames
|
||||
* @return CakeEmail $this
|
||||
* @return $this
|
||||
* @throws SocketException
|
||||
* @see CakeEmail::attachments()
|
||||
*/
|
||||
|
@ -1111,7 +1111,7 @@ class CakeEmail {
|
|||
* `$email->config(array('to' => 'bill@example.com'));`
|
||||
*
|
||||
* @param string|array $config String with configuration name (from email.php), array with config or null to return current config
|
||||
* @return string|array|CakeEmail
|
||||
* @return string|array|$this
|
||||
*/
|
||||
public function config($config = null) {
|
||||
if ($config === null) {
|
||||
|
@ -1259,7 +1259,7 @@ class CakeEmail {
|
|||
/**
|
||||
* Reset all CakeEmail internal variables to be able to send out a new email.
|
||||
*
|
||||
* @return CakeEmail $this
|
||||
* @return $this
|
||||
*/
|
||||
public function reset() {
|
||||
$this->_to = array();
|
||||
|
@ -1696,7 +1696,7 @@ class CakeEmail {
|
|||
/**
|
||||
* Return the Content-Transfer Encoding value based on the set charset
|
||||
*
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
protected function _getContentTransferEncoding() {
|
||||
$charset = strtoupper($this->charset);
|
||||
|
|
|
@ -242,6 +242,29 @@ DIGEST;
|
|||
$this->assertNull($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test parsing a full URI. While not part of the spec some mobile clients will do it wrong.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testParseAuthDataFullUri() {
|
||||
$digest = <<<DIGEST
|
||||
Digest username="admin",
|
||||
realm="192.168.0.2",
|
||||
nonce="53a7f9b83f61b",
|
||||
uri="http://192.168.0.2/pvcollection/sites/pull/HFD%200001.json#fragment",
|
||||
qop=auth,
|
||||
nc=00000001,
|
||||
cnonce="b85ff144e496e6e18d1c73020566ea3b",
|
||||
response="5894f5d9cd41d012bac09eeb89d2ddf2",
|
||||
opaque="6f65e91667cf98dd13464deaf2739fde"
|
||||
DIGEST;
|
||||
|
||||
$expected = 'http://192.168.0.2/pvcollection/sites/pull/HFD%200001.json#fragment';
|
||||
$result = $this->auth->parseAuthData($digest);
|
||||
$this->assertSame($expected, $result['uri']);
|
||||
}
|
||||
|
||||
/**
|
||||
* test parsing digest information with email addresses
|
||||
*
|
||||
|
|
|
@ -430,27 +430,6 @@ class AppTest extends CakeTestCase {
|
|||
App::build();
|
||||
}
|
||||
|
||||
/**
|
||||
* test that pluginPath can find paths for plugins.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testPluginPath() {
|
||||
App::build(array(
|
||||
'plugins' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)
|
||||
));
|
||||
CakePlugin::load(array('TestPlugin', 'TestPluginTwo'));
|
||||
|
||||
$path = App::pluginPath('TestPlugin');
|
||||
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS . 'TestPlugin' . DS;
|
||||
$this->assertEquals($expected, $path);
|
||||
|
||||
$path = App::pluginPath('TestPluginTwo');
|
||||
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS . 'TestPluginTwo' . DS;
|
||||
$this->assertEquals($expected, $path);
|
||||
App::build();
|
||||
}
|
||||
|
||||
/**
|
||||
* test that themePath can find paths for themes.
|
||||
*
|
||||
|
|
|
@ -23,6 +23,7 @@ App::uses('HtmlHelper', 'View/Helper');
|
|||
App::uses('FormHelper', 'View/Helper');
|
||||
App::uses('ClassRegistry', 'Utility');
|
||||
App::uses('Folder', 'Utility');
|
||||
App::uses('CakePlugin', 'Core');
|
||||
|
||||
if (!defined('FULL_BASE_URL')) {
|
||||
define('FULL_BASE_URL', 'http://cakephp.org');
|
||||
|
@ -931,7 +932,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
public function testPluginScriptTimestamping() {
|
||||
CakePlugin::load('TestPlugin');
|
||||
|
||||
$pluginPath = App::pluginPath('TestPlugin');
|
||||
$pluginPath = CakePlugin::path('TestPlugin');
|
||||
$pluginJsPath = $pluginPath . 'webroot/js';
|
||||
$this->skipIf(!is_writable($pluginJsPath), $pluginJsPath . ' is not Writable, timestamp testing has been skipped.');
|
||||
|
||||
|
|
|
@ -19,6 +19,9 @@
|
|||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
App::uses('Inflector', 'Utility');
|
||||
App::uses('CakePlugin', 'Core');
|
||||
|
||||
/**
|
||||
* Abstract class for common CoverageReport methods.
|
||||
* Provides several template methods for custom output.
|
||||
|
@ -102,7 +105,7 @@ abstract class BaseCoverageReport {
|
|||
if ($this->appTest) {
|
||||
$path .= APP_DIR . DS;
|
||||
} elseif ($this->pluginTest) {
|
||||
$path = App::pluginPath($this->pluginTest);
|
||||
$path = CakePlugin::path($this->pluginTest);
|
||||
} else {
|
||||
$path = CAKE;
|
||||
}
|
||||
|
|
|
@ -1062,7 +1062,7 @@ class CakeTime {
|
|||
/**
|
||||
* Get list of timezone identifiers
|
||||
*
|
||||
* @param integer|string $filter A regex to filter identifer
|
||||
* @param integer|string $filter A regex to filter identifier
|
||||
* Or one of DateTimeZone class constants (PHP 5.3 and above)
|
||||
* @param string $country A two-letter ISO 3166-1 compatible country code.
|
||||
* This option is only used when $filter is set to DateTimeZone::PER_COUNTRY (available only in PHP 5.3 and above)
|
||||
|
|
|
@ -174,7 +174,7 @@ class HtmlHelper extends AppHelper {
|
|||
* @param string $name Text for link
|
||||
* @param string $link URL for link (if empty it won't be a link)
|
||||
* @param string|array $options Link attributes e.g. array('id' => 'selected')
|
||||
* @return this HtmlHelper
|
||||
* @return $this
|
||||
* @see HtmlHelper::link() for details on $options that can be used.
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/html.html#creating-breadcrumb-trails-with-htmlhelper
|
||||
*/
|
||||
|
|
|
@ -145,7 +145,7 @@ class JqueryEngineHelper extends JsBaseEngineHelper {
|
|||
* Create javascript selector for a CSS rule
|
||||
*
|
||||
* @param string $selector The selector that is targeted
|
||||
* @return JqueryEngineHelper instance of $this. Allows chained methods.
|
||||
* @return $this
|
||||
*/
|
||||
public function get($selector) {
|
||||
if ($selector === 'window' || $selector === 'document') {
|
||||
|
|
|
@ -118,7 +118,7 @@ class MootoolsEngineHelper extends JsBaseEngineHelper {
|
|||
* Create javascript selector for a CSS rule
|
||||
*
|
||||
* @param string $selector The selector that is targeted
|
||||
* @return MootoolsEngineHelper instance of $this. Allows chained methods.
|
||||
* @return $this
|
||||
*/
|
||||
public function get($selector) {
|
||||
$this->_multipleSelection = false;
|
||||
|
|
|
@ -114,7 +114,7 @@ class PrototypeEngineHelper extends JsBaseEngineHelper {
|
|||
* Create javascript selector for a CSS rule
|
||||
*
|
||||
* @param string $selector The selector that is targeted
|
||||
* @return PrototypeEngineHelper instance of $this. Allows chained methods.
|
||||
* @return $this
|
||||
*/
|
||||
public function get($selector) {
|
||||
$this->_multiple = false;
|
||||
|
|
Loading…
Reference in a new issue