mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge branch '2.4' into 2.5
Conflicts: lib/Cake/VERSION.txt
This commit is contained in:
commit
6d45953525
77 changed files with 513 additions and 222 deletions
|
@ -109,6 +109,9 @@ p {
|
|||
padding: 6px 10px;
|
||||
text-align: right;
|
||||
}
|
||||
#header a, #footer a {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
/** containers **/
|
||||
div.form,
|
||||
|
|
|
@ -174,7 +174,7 @@ class Cache {
|
|||
}
|
||||
$cacheClass = $class . 'Engine';
|
||||
if (!is_subclass_of($cacheClass, 'CacheEngine')) {
|
||||
throw new CacheException(__d('cake_dev', 'Cache engines must use CacheEngine as a base class.'));
|
||||
throw new CacheException(__d('cake_dev', 'Cache engines must use %s as a base class.', 'CacheEngine'));
|
||||
}
|
||||
self::$_engines[$name] = new $cacheClass();
|
||||
if (!self::$_engines[$name]->init($config)) {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
<?php
|
||||
/**
|
||||
* Default routes that CakePHP provides as catch all routes.
|
||||
*
|
||||
* PHP 5
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
|
@ -26,7 +24,6 @@
|
|||
* created when your application has one or more plugins.
|
||||
*
|
||||
* - `/:prefix/:plugin` a plugin shortcut route.
|
||||
* - `/:prefix/:plugin/:action/*` a plugin shortcut route.
|
||||
* - `/:prefix/:plugin/:controller`
|
||||
* - `/:prefix/:plugin/:controller/:action/*`
|
||||
* - `/:prefix/:controller`
|
||||
|
@ -35,7 +32,6 @@
|
|||
* If plugins are found in your application the following routes are created:
|
||||
*
|
||||
* - `/:plugin` a plugin shortcut route.
|
||||
* - `/:plugin/:action/*` a plugin shortcut route.
|
||||
* - `/:plugin/:controller`
|
||||
* - `/:plugin/:controller/:action/*`
|
||||
*
|
||||
|
|
|
@ -71,7 +71,7 @@ class PhpReader implements ConfigReaderInterface {
|
|||
|
||||
include $file;
|
||||
if (!isset($config)) {
|
||||
throw new ConfigureException(__d('cake_dev', 'No variable $config found in %s', $file));
|
||||
throw new ConfigureException(__d('cake_dev', 'No variable %s found in %s', '$config', $file));
|
||||
}
|
||||
return $config;
|
||||
}
|
||||
|
|
|
@ -439,8 +439,7 @@ class ConsoleShell extends AppShell {
|
|||
*/
|
||||
protected function _routesReload() {
|
||||
if (!$this->_loadRoutes()) {
|
||||
$this->err(__d('cake_console', "There was an error loading the routes config. Please check that the file exists and is free of parse errors."));
|
||||
break;
|
||||
return $this->err(__d('cake_console', "There was an error loading the routes config. Please check that the file exists and is free of parse errors."));
|
||||
}
|
||||
$this->out(__d('cake_console', "Routes configuration reloaded, %d routes connected", count(Router::$routes)));
|
||||
}
|
||||
|
|
|
@ -122,7 +122,7 @@ class ServerShell extends AppShell {
|
|||
*/
|
||||
public function main() {
|
||||
if (version_compare(PHP_VERSION, '5.4.0') < 0) {
|
||||
$this->out(__d('cake_console', '<warning>This command is available on PHP5.4 or above</warning>'));
|
||||
$this->out(__d('cake_console', '<warning>This command is available on %s or above</warning>', 'PHP5.4'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -407,7 +407,7 @@ class ControllerTask extends BakeTask {
|
|||
* @return array Set of controllers
|
||||
*/
|
||||
public function listAll($useDbConfig = null) {
|
||||
if (is_null($useDbConfig)) {
|
||||
if ($useDbConfig === null) {
|
||||
$useDbConfig = $this->connection;
|
||||
}
|
||||
$this->__tables = $this->Model->getAllTables($useDbConfig);
|
||||
|
|
|
@ -243,7 +243,7 @@ class FixtureTask extends BakeTask {
|
|||
}
|
||||
|
||||
$tableInfo = $data['tables'][$useTable];
|
||||
if (is_null($modelImport)) {
|
||||
if ($modelImport === null) {
|
||||
$schema = $this->_generateSchema($tableInfo);
|
||||
}
|
||||
|
||||
|
|
|
@ -117,8 +117,8 @@ class ProjectTask extends AppShell {
|
|||
}
|
||||
$success = $this->corePath($path, $hardCode) === true;
|
||||
if ($success) {
|
||||
$this->out(__d('cake_console', ' * CAKE_CORE_INCLUDE_PATH set to %s in webroot/index.php', CAKE_CORE_INCLUDE_PATH));
|
||||
$this->out(__d('cake_console', ' * CAKE_CORE_INCLUDE_PATH set to %s in webroot/test.php', CAKE_CORE_INCLUDE_PATH));
|
||||
$this->out(__d('cake_console', ' * CAKE_CORE_INCLUDE_PATH set to %s in %s', CAKE_CORE_INCLUDE_PATH, 'webroot/index.php'));
|
||||
$this->out(__d('cake_console', ' * CAKE_CORE_INCLUDE_PATH set to %s in %s', CAKE_CORE_INCLUDE_PATH, 'webroot/test.php'));
|
||||
} else {
|
||||
$this->err(__d('cake_console', 'Unable to set CAKE_CORE_INCLUDE_PATH, you should change it in %s', $path . 'webroot' . DS . 'index.php'));
|
||||
$success = false;
|
||||
|
|
|
@ -119,9 +119,15 @@ class ShellDispatcher {
|
|||
* @return boolean Success.
|
||||
*/
|
||||
protected function _bootstrap() {
|
||||
define('ROOT', $this->params['root']);
|
||||
define('APP_DIR', $this->params['app']);
|
||||
define('APP', $this->params['working'] . DS);
|
||||
if (!defined('ROOT')) {
|
||||
define('ROOT', $this->params['root']);
|
||||
}
|
||||
if (!defined('APP_DIR')) {
|
||||
define('APP_DIR', $this->params['app']);
|
||||
}
|
||||
if (!defined('APP')) {
|
||||
define('APP', $this->params['working'] . DS);
|
||||
}
|
||||
if (!defined('WWW_ROOT')) {
|
||||
define('WWW_ROOT', APP . $this->params['webroot'] . DS);
|
||||
}
|
||||
|
|
|
@ -55,15 +55,14 @@
|
|||
$this-><?php echo $currentModelName; ?>->create();
|
||||
if ($this-><?php echo $currentModelName; ?>->save($this->request->data)) {
|
||||
<?php if ($wannaUseSession): ?>
|
||||
$this->Session->setFlash(__('The <?php echo strtolower($singularHumanName); ?> has been saved'));
|
||||
$this->Session->setFlash(__('The <?php echo strtolower($singularHumanName); ?> has been saved.'));
|
||||
return $this->redirect(array('action' => 'index'));
|
||||
} else {
|
||||
$this->Session->setFlash(__('The <?php echo strtolower($singularHumanName); ?> could not be saved. Please, try again.'));
|
||||
<?php else: ?>
|
||||
return $this->flash(__('<?php echo ucfirst(strtolower($currentModelName)); ?> saved.'), array('action' => 'index'));
|
||||
return $this->flash(__('The <?php echo strtolower($singularHumanName); ?> has been saved.'), array('action' => 'index'));
|
||||
<?php endif; ?>
|
||||
}
|
||||
<?php if ($wannaUseSession): ?>
|
||||
$this->Session->setFlash(__('The <?php echo strtolower($singularHumanName); ?> could not be saved. Please, try again.'));
|
||||
<?php endif; ?>
|
||||
}
|
||||
<?php
|
||||
foreach (array('belongsTo', 'hasAndBelongsToMany') as $assoc):
|
||||
|
@ -97,15 +96,14 @@
|
|||
if ($this->request->is('post') || $this->request->is('put')) {
|
||||
if ($this-><?php echo $currentModelName; ?>->save($this->request->data)) {
|
||||
<?php if ($wannaUseSession): ?>
|
||||
$this->Session->setFlash(__('The <?php echo strtolower($singularHumanName); ?> has been saved'));
|
||||
$this->Session->setFlash(__('The <?php echo strtolower($singularHumanName); ?> has been saved.'));
|
||||
return $this->redirect(array('action' => 'index'));
|
||||
} else {
|
||||
$this->Session->setFlash(__('The <?php echo strtolower($singularHumanName); ?> could not be saved. Please, try again.'));
|
||||
<?php else: ?>
|
||||
return $this->flash(__('The <?php echo strtolower($singularHumanName); ?> has been saved.'), array('action' => 'index'));
|
||||
<?php endif; ?>
|
||||
}
|
||||
<?php if ($wannaUseSession): ?>
|
||||
$this->Session->setFlash(__('The <?php echo strtolower($singularHumanName); ?> could not be saved. Please, try again.'));
|
||||
<?php endif; ?>
|
||||
} else {
|
||||
$options = array('conditions' => array('<?php echo $currentModelName; ?>.' . $this-><?php echo $currentModelName; ?>->primaryKey => $id));
|
||||
$this->request->data = $this-><?php echo $currentModelName; ?>->find('first', $options);
|
||||
|
@ -142,16 +140,15 @@
|
|||
$this->request->onlyAllow('post', 'delete');
|
||||
if ($this-><?php echo $currentModelName; ?>->delete()) {
|
||||
<?php if ($wannaUseSession): ?>
|
||||
$this->Session->setFlash(__('<?php echo ucfirst(strtolower($singularHumanName)); ?> deleted'));
|
||||
return $this->redirect(array('action' => 'index'));
|
||||
<?php else: ?>
|
||||
return $this->flash(__('<?php echo ucfirst(strtolower($singularHumanName)); ?> deleted'), array('action' => 'index'));
|
||||
<?php endif; ?>
|
||||
$this->Session->setFlash(__('The <?php echo strtolower($singularHumanName); ?> has been deleted.'));
|
||||
} else {
|
||||
$this->Session->setFlash(__('The <?php echo strtolower($singularHumanName); ?> could not be deleted. Please, try again.'));
|
||||
}
|
||||
<?php if ($wannaUseSession): ?>
|
||||
$this->Session->setFlash(__('<?php echo ucfirst(strtolower($singularHumanName)); ?> was not deleted'));
|
||||
<?php else: ?>
|
||||
return $this->flash(__('<?php echo ucfirst(strtolower($singularHumanName)); ?> was not deleted'), array('action' => 'index'));
|
||||
<?php endif; ?>
|
||||
return $this->redirect(array('action' => 'index'));
|
||||
<?php else: ?>
|
||||
return $this->flash(__('The <?php echo strtolower($singularHumanName); ?> has been deleted.'), array('action' => 'index'));
|
||||
} else {
|
||||
return $this->flash(__('The <?php echo strtolower($singularHumanName); ?> could not be deleted. Please, try again.'), array('action' => 'index'));
|
||||
}
|
||||
<?php endif; ?>
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ class <?php echo $controllerName; ?>Controller extends <?php echo $plugin; ?>App
|
|||
echo ");\n\n";
|
||||
endif;
|
||||
|
||||
echo trim($actions) . "\n";
|
||||
echo trim($actions);
|
||||
|
||||
endif; ?>
|
||||
}
|
||||
|
|
|
@ -179,8 +179,6 @@ if (!empty($associations['hasAndBelongsToMany'])):
|
|||
$out .= "\t\t\t'limit' => '',\n";
|
||||
$out .= "\t\t\t'offset' => '',\n";
|
||||
$out .= "\t\t\t'finderQuery' => '',\n";
|
||||
$out .= "\t\t\t'deleteQuery' => '',\n";
|
||||
$out .= "\t\t\t'insertQuery' => ''\n";
|
||||
$out .= "\t\t)";
|
||||
if ($i + 1 < $habtmCount) {
|
||||
$out .= ",";
|
||||
|
|
|
@ -59,11 +59,11 @@ endif;
|
|||
$settings = Cache::settings();
|
||||
if (!empty($settings)):
|
||||
echo '<span class="notice success">';
|
||||
echo __d('cake_dev', 'The %s is being used for core caching. To change the config edit APP/Config/core.php ', '<em>'. $settings['engine'] . 'Engine</em>');
|
||||
echo __d('cake_dev', 'The %s is being used for core caching. To change the config edit %s', '<em>'. $settings['engine'] . 'Engine</em>', 'APP/Config/core.php');
|
||||
echo '</span>';
|
||||
else:
|
||||
echo '<span class="notice">';
|
||||
echo __d('cake_dev', 'Your cache is NOT working. Please check the settings in APP/Config/core.php');
|
||||
echo __d('cake_dev', 'Your cache is NOT working. Please check the settings in %s', 'APP/Config/core.php');
|
||||
echo '</span>';
|
||||
endif;
|
||||
?>
|
||||
|
@ -80,7 +80,7 @@ endif;
|
|||
echo '<span class="notice">';
|
||||
echo __d('cake_dev', 'Your database configuration file is NOT present.');
|
||||
echo '<br/>';
|
||||
echo __d('cake_dev', 'Rename APP/Config/database.php.default to APP/Config/database.php');
|
||||
echo __d('cake_dev', 'Rename %s to %s', 'APP/Config/database.php.default', 'APP/Config/database.php');
|
||||
echo '</span>';
|
||||
endif;
|
||||
?>
|
||||
|
@ -123,7 +123,7 @@ if (isset($filePresent)):
|
|||
echo '<p><span class="notice">';
|
||||
echo __d('cake_dev', 'PCRE has not been compiled with Unicode support.');
|
||||
echo '<br/>';
|
||||
echo __d('cake_dev', 'Recompile PCRE with Unicode support by adding <code>--enable-unicode-properties</code> when configuring');
|
||||
echo __d('cake_dev', 'Recompile PCRE with Unicode support by adding %s when configuring', '<code>--enable-unicode-properties</code>');
|
||||
echo '</span></p>';
|
||||
}
|
||||
?>
|
||||
|
@ -147,9 +147,10 @@ if (isset($filePresent)):
|
|||
<h3><?php echo __d('cake_dev', 'Editing this Page'); ?></h3>
|
||||
<p>
|
||||
<?php
|
||||
echo __d('cake_dev', 'To change the content of this page, edit: APP/View/Pages/home.ctp.<br />
|
||||
To change its layout, edit: APP/View/Layouts/default.ctp.<br />
|
||||
You can also add some CSS styles for your pages at: APP/webroot/css.');
|
||||
echo __d('cake_dev', 'To change the content of this page, edit: %s.<br />
|
||||
To change its layout, edit: %s.<br />
|
||||
You can also add some CSS styles for your pages at: %s.',
|
||||
'APP/View/Pages/home.ctp', 'APP/View/Layouts/default.ctp', 'APP/webroot/css');
|
||||
?>
|
||||
</p>
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package app.webroot.css
|
||||
* @since CakePHP(tm)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
|
@ -110,6 +109,9 @@ p {
|
|||
padding: 6px 10px;
|
||||
text-align: right;
|
||||
}
|
||||
#header a, #footer a {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
/** containers **/
|
||||
div.form,
|
||||
|
|
|
@ -48,7 +48,7 @@ class ControllerAuthorize extends BaseAuthorize {
|
|||
public function controller(Controller $controller = null) {
|
||||
if ($controller) {
|
||||
if (!method_exists($controller, 'isAuthorized')) {
|
||||
throw new CakeException(__d('cake_dev', '$controller does not implement an isAuthorized() method.'));
|
||||
throw new CakeException(__d('cake_dev', '$controller does not implement an %s method.', 'isAuthorized()'));
|
||||
}
|
||||
}
|
||||
return parent::controller($controller);
|
||||
|
|
|
@ -495,7 +495,7 @@ class AuthComponent extends Component {
|
|||
throw new CakeException(__d('cake_dev', 'Authorization adapter "%s" was not found.', $class));
|
||||
}
|
||||
if (!method_exists($className, 'authorize')) {
|
||||
throw new CakeException(__d('cake_dev', 'Authorization objects must implement an %s method.', 'authorize'));
|
||||
throw new CakeException(__d('cake_dev', 'Authorization objects must implement an %s method.', 'authorize()'));
|
||||
}
|
||||
$settings = array_merge($global, (array)$settings);
|
||||
$this->_authorizeObjects[] = new $className($this->_Collection, $settings);
|
||||
|
@ -717,7 +717,7 @@ class AuthComponent extends Component {
|
|||
* @return string Redirect URL
|
||||
*/
|
||||
public function redirectUrl($url = null) {
|
||||
if (!is_null($url)) {
|
||||
if ($url !== null) {
|
||||
$redir = $url;
|
||||
$this->Session->write('Auth.redirect', $redir);
|
||||
} elseif ($this->Session->check('Auth.redirect')) {
|
||||
|
@ -784,7 +784,7 @@ class AuthComponent extends Component {
|
|||
throw new CakeException(__d('cake_dev', 'Authentication adapter "%s" was not found.', $class));
|
||||
}
|
||||
if (!method_exists($className, 'authenticate')) {
|
||||
throw new CakeException(__d('cake_dev', 'Authentication objects must implement an %s method.', 'authenticate'));
|
||||
throw new CakeException(__d('cake_dev', 'Authentication objects must implement an %s method.', 'authenticate()'));
|
||||
}
|
||||
$settings = array_merge($global, (array)$settings);
|
||||
$this->_authenticateObjects[] = new $className($this->_Collection, $settings);
|
||||
|
|
|
@ -219,7 +219,7 @@ class CookieComponent extends Component {
|
|||
$this->read();
|
||||
}
|
||||
|
||||
if (is_null($encrypt)) {
|
||||
if ($encrypt === null) {
|
||||
$encrypt = true;
|
||||
}
|
||||
$this->_encrypted = $encrypt;
|
||||
|
@ -262,7 +262,7 @@ class CookieComponent extends Component {
|
|||
if (empty($this->_values[$this->name])) {
|
||||
$this->_values[$this->name] = array();
|
||||
}
|
||||
if (is_null($key)) {
|
||||
if ($key === null) {
|
||||
return $this->_values[$this->name];
|
||||
}
|
||||
|
||||
|
@ -387,7 +387,7 @@ class CookieComponent extends Component {
|
|||
* @return integer Unix timestamp
|
||||
*/
|
||||
protected function _expire($expires = null) {
|
||||
if (is_null($expires)) {
|
||||
if ($expires === null) {
|
||||
return $this->_expires;
|
||||
}
|
||||
$this->_reset = $this->_expires;
|
||||
|
|
|
@ -228,7 +228,7 @@ class CakePlugin {
|
|||
* @return void
|
||||
*/
|
||||
public static function unload($plugin = null) {
|
||||
if (is_null($plugin)) {
|
||||
if ($plugin === null) {
|
||||
self::$_plugins = array();
|
||||
} else {
|
||||
unset(self::$_plugins[$plugin]);
|
||||
|
|
|
@ -340,7 +340,7 @@ class Configure {
|
|||
throw new ConfigureException(__d('cake_dev', 'There is no "%s" adapter.', $config));
|
||||
}
|
||||
if (!method_exists($reader, 'dump')) {
|
||||
throw new ConfigureException(__d('cake_dev', 'The "%s" adapter, does not have a dump() method.', $config));
|
||||
throw new ConfigureException(__d('cake_dev', 'The "%s" adapter, does not have a %s method.', $config, 'dump()'));
|
||||
}
|
||||
$values = self::$_values;
|
||||
if (!empty($keys) && is_array($keys)) {
|
||||
|
|
|
@ -161,7 +161,7 @@ class I18n {
|
|||
$_this->_lang = $lang;
|
||||
}
|
||||
|
||||
if (is_null($domain)) {
|
||||
if ($domain === null) {
|
||||
$domain = self::$defaultDomain;
|
||||
}
|
||||
if ($domain === '') {
|
||||
|
|
|
@ -65,7 +65,7 @@ class AclBehavior extends ModelBehavior {
|
|||
$model->{$type} = ClassRegistry::init($type);
|
||||
}
|
||||
if (!method_exists($model, 'parentNode')) {
|
||||
trigger_error(__d('cake_dev', 'Callback parentNode() not defined in %s', $model->alias), E_USER_WARNING);
|
||||
trigger_error(__d('cake_dev', 'Callback %s not defined in %s', 'parentNode()', $model->alias), E_USER_WARNING);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -269,7 +269,7 @@ class ContainableBehavior extends ModelBehavior {
|
|||
* @return array Containments
|
||||
*/
|
||||
public function containments(Model $Model, $contain, $containments = array(), $throwErrors = null) {
|
||||
$options = array('className', 'joinTable', 'with', 'foreignKey', 'associationForeignKey', 'conditions', 'fields', 'order', 'limit', 'offset', 'unique', 'finderQuery', 'deleteQuery', 'insertQuery');
|
||||
$options = array('className', 'joinTable', 'with', 'foreignKey', 'associationForeignKey', 'conditions', 'fields', 'order', 'limit', 'offset', 'unique', 'finderQuery');
|
||||
$keep = array();
|
||||
if ($throwErrors === null) {
|
||||
$throwErrors = (empty($this->settings[$Model->alias]) ? true : $this->settings[$Model->alias]['notices']);
|
||||
|
|
|
@ -513,7 +513,7 @@ class TranslateBehavior extends ModelBehavior {
|
|||
* @return mixed string or false
|
||||
*/
|
||||
protected function _getLocale(Model $Model) {
|
||||
if (!isset($Model->locale) || is_null($Model->locale)) {
|
||||
if (!isset($Model->locale) || $Model->locale === null) {
|
||||
$I18n = I18n::getInstance();
|
||||
$I18n->l10n->get(Configure::read('Config.language'));
|
||||
$Model->locale = $I18n->l10n->locale;
|
||||
|
@ -588,7 +588,7 @@ class TranslateBehavior extends ModelBehavior {
|
|||
|
||||
$this->_removeField($Model, $field);
|
||||
|
||||
if (is_null($association)) {
|
||||
if ($association === null) {
|
||||
if ($reset) {
|
||||
$this->runtime[$Model->alias]['fields'][] = $field;
|
||||
} else {
|
||||
|
@ -677,7 +677,7 @@ class TranslateBehavior extends ModelBehavior {
|
|||
|
||||
$this->_removeField($Model, $field);
|
||||
|
||||
if (!is_null($association) && (isset($Model->hasMany[$association]) || isset($Model->__backAssociation['hasMany'][$association]))) {
|
||||
if ($association !== null && (isset($Model->hasMany[$association]) || isset($Model->__backAssociation['hasMany'][$association]))) {
|
||||
$associations[] = $association;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -307,7 +307,7 @@ class TreeBehavior extends ModelBehavior {
|
|||
|
||||
extract($this->settings[$Model->alias]);
|
||||
|
||||
if (!is_null($overrideRecursive)) {
|
||||
if ($overrideRecursive !== null) {
|
||||
$recursive = $overrideRecursive;
|
||||
}
|
||||
if (!$order) {
|
||||
|
@ -353,7 +353,7 @@ class TreeBehavior extends ModelBehavior {
|
|||
public function generateTreeList(Model $Model, $conditions = null, $keyPath = null, $valuePath = null, $spacer = '_', $recursive = null) {
|
||||
$overrideRecursive = $recursive;
|
||||
extract($this->settings[$Model->alias]);
|
||||
if (!is_null($overrideRecursive)) {
|
||||
if ($overrideRecursive !== null) {
|
||||
$recursive = $overrideRecursive;
|
||||
}
|
||||
|
||||
|
@ -415,7 +415,7 @@ class TreeBehavior extends ModelBehavior {
|
|||
$id = $Model->id;
|
||||
}
|
||||
extract($this->settings[$Model->alias]);
|
||||
if (!is_null($overrideRecursive)) {
|
||||
if ($overrideRecursive !== null) {
|
||||
$recursive = $overrideRecursive;
|
||||
}
|
||||
$parentId = $Model->find('first', array('conditions' => array($Model->primaryKey => $id), 'fields' => array($parent), 'recursive' => -1));
|
||||
|
@ -448,7 +448,7 @@ class TreeBehavior extends ModelBehavior {
|
|||
$id = $Model->id;
|
||||
}
|
||||
extract($this->settings[$Model->alias]);
|
||||
if (!is_null($overrideRecursive)) {
|
||||
if ($overrideRecursive !== null) {
|
||||
$recursive = $overrideRecursive;
|
||||
}
|
||||
$result = $Model->find('first', array('conditions' => array($Model->escapeField() => $id), 'fields' => array($left, $right), 'recursive' => $recursive));
|
||||
|
@ -876,7 +876,7 @@ class TreeBehavior extends ModelBehavior {
|
|||
))));
|
||||
|
||||
foreach ($Model->find('all', array('conditions' => $scope, 'recursive' => 0)) as $instance) {
|
||||
if (is_null($instance[$Model->alias][$left]) || is_null($instance[$Model->alias][$right])) {
|
||||
if ($instance[$Model->alias][$left] === null || $instance[$Model->alias][$right] === null) {
|
||||
$errors[] = array('node', $instance[$Model->alias][$Model->primaryKey],
|
||||
'has invalid left or right values');
|
||||
} elseif ($instance[$Model->alias][$left] == $instance[$Model->alias][$right]) {
|
||||
|
|
|
@ -228,7 +228,7 @@ class BehaviorCollection extends ObjectCollection implements CakeEventListener {
|
|||
$method = $this->hasMethod($method, true);
|
||||
|
||||
if ($strict && empty($method)) {
|
||||
trigger_error(__d('cake_dev', "BehaviorCollection::dispatchMethod() - Method %s not found in any attached behavior", $method), E_USER_WARNING);
|
||||
trigger_error(__d('cake_dev', '%s - Method %s not found in any attached behavior', 'BehaviorCollection::dispatchMethod()', $method), E_USER_WARNING);
|
||||
return null;
|
||||
}
|
||||
if (empty($method)) {
|
||||
|
|
|
@ -366,7 +366,7 @@ class CakeSession {
|
|||
if (!self::start()) {
|
||||
return false;
|
||||
}
|
||||
if (is_null($name)) {
|
||||
if ($name === null) {
|
||||
return self::_returnSessionVars();
|
||||
}
|
||||
if (empty($name)) {
|
||||
|
@ -554,7 +554,6 @@ class CakeSession {
|
|||
'session.serialize_handler' => 'php',
|
||||
'session.use_cookies' => 1,
|
||||
'session.cookie_path' => self::$path,
|
||||
'session.auto_start' => 0,
|
||||
'session.save_path' => TMP . 'sessions',
|
||||
'session.save_handler' => 'files'
|
||||
)
|
||||
|
@ -565,7 +564,6 @@ class CakeSession {
|
|||
'ini' => array(
|
||||
'session.use_trans_sid' => 0,
|
||||
'url_rewriter.tags' => '',
|
||||
'session.auto_start' => 0,
|
||||
'session.use_cookies' => 1,
|
||||
'session.cookie_path' => self::$path,
|
||||
'session.save_handler' => 'user',
|
||||
|
@ -581,7 +579,6 @@ class CakeSession {
|
|||
'ini' => array(
|
||||
'session.use_trans_sid' => 0,
|
||||
'url_rewriter.tags' => '',
|
||||
'session.auto_start' => 0,
|
||||
'session.use_cookies' => 1,
|
||||
'session.cookie_path' => self::$path,
|
||||
'session.save_handler' => 'user',
|
||||
|
|
|
@ -677,7 +677,7 @@ class Mysql extends DboSource {
|
|||
* @return string Formatted length part of an index field
|
||||
*/
|
||||
protected function _buildIndexSubPart($lengths, $column) {
|
||||
if (is_null($lengths)) {
|
||||
if ($lengths === null) {
|
||||
return '';
|
||||
}
|
||||
if (!isset($lengths[$column])) {
|
||||
|
|
|
@ -753,11 +753,11 @@ class Postgres extends DboSource {
|
|||
|
||||
switch ($type) {
|
||||
case 'bool':
|
||||
$resultRow[$table][$column] = is_null($row[$index]) ? null : $this->boolean($row[$index]);
|
||||
$resultRow[$table][$column] = $row[$index] === null ? null : $this->boolean($row[$index]);
|
||||
break;
|
||||
case 'binary':
|
||||
case 'bytea':
|
||||
$resultRow[$table][$column] = is_null($row[$index]) ? null : stream_get_contents($row[$index]);
|
||||
$resultRow[$table][$column] = $row[$index] === null ? null : stream_get_contents($row[$index]);
|
||||
break;
|
||||
default:
|
||||
$resultRow[$table][$column] = $row[$index];
|
||||
|
|
|
@ -357,7 +357,7 @@ class Sqlite extends DboSource {
|
|||
foreach ($this->map as $col => $meta) {
|
||||
list($table, $column, $type) = $meta;
|
||||
$resultRow[$table][$column] = $row[$col];
|
||||
if ($type === 'boolean' && !is_null($row[$col])) {
|
||||
if ($type === 'boolean' && $row[$col] !== null) {
|
||||
$resultRow[$table][$column] = $this->boolean($resultRow[$table][$column]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -620,7 +620,7 @@ class Sqlserver extends DboSource {
|
|||
continue;
|
||||
}
|
||||
$resultRow[$table][$column] = $row[$col];
|
||||
if ($type === 'boolean' && !is_null($row[$col])) {
|
||||
if ($type === 'boolean' && $row[$col] !== null) {
|
||||
$resultRow[$table][$column] = $this->boolean($resultRow[$table][$column]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1035,7 +1035,7 @@ class DboSource extends DataSource {
|
|||
$recursive = $queryData['recursive'];
|
||||
}
|
||||
|
||||
if (!is_null($recursive)) {
|
||||
if ($recursive !== null) {
|
||||
$_recursive = $model->recursive;
|
||||
$model->recursive = $recursive;
|
||||
}
|
||||
|
@ -1123,7 +1123,7 @@ class DboSource extends DataSource {
|
|||
}
|
||||
}
|
||||
|
||||
if (!is_null($recursive)) {
|
||||
if ($recursive !== null) {
|
||||
$model->recursive = $_recursive;
|
||||
}
|
||||
return $resultSet;
|
||||
|
|
|
@ -464,8 +464,8 @@ class Model extends Object implements CakeEventListener {
|
|||
* - `limit`: The maximum number of associated rows you want returned.
|
||||
* - `offset`: The number of associated rows to skip over (given the current
|
||||
* conditions and order) before fetching and associating.
|
||||
* - `finderQuery`, `deleteQuery`, `insertQuery`: A complete SQL query CakePHP
|
||||
* can use to fetch, delete, or create new associated model records. This should
|
||||
* - `finderQuery`, A complete SQL query CakePHP
|
||||
* can use to fetch associated model records. This should
|
||||
* be used in situations that require very custom results.
|
||||
*
|
||||
* @var array
|
||||
|
@ -555,7 +555,7 @@ class Model extends Object implements CakeEventListener {
|
|||
'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'),
|
||||
'hasAndBelongsToMany' => array('className', 'joinTable', 'with', 'foreignKey', 'associationForeignKey', 'conditions', 'fields', 'order', 'limit', 'offset', 'unique', 'finderQuery', 'deleteQuery', 'insertQuery')
|
||||
'hasAndBelongsToMany' => array('className', 'joinTable', 'with', 'foreignKey', 'associationForeignKey', 'conditions', 'fields', 'order', 'limit', 'offset', 'unique', 'finderQuery')
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -2715,7 +2715,7 @@ class Model extends Object implements CakeEventListener {
|
|||
$this->id = $this->getID();
|
||||
|
||||
$query = $this->buildQuery($type, $query);
|
||||
if (is_null($query)) {
|
||||
if ($query === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ class Permission extends AppModel {
|
|||
* @param string $action Action (defaults to *)
|
||||
* @return boolean Success (true if ARO has access to action in ACO, false otherwise)
|
||||
*/
|
||||
public function check($aro, $aco, $action = "*") {
|
||||
public function check($aro, $aco, $action = '*') {
|
||||
if (!$aro || !$aco) {
|
||||
return false;
|
||||
}
|
||||
|
@ -91,17 +91,29 @@ class Permission extends AppModel {
|
|||
$acoPath = $this->Aco->node($aco);
|
||||
|
||||
if (!$aroPath || !$acoPath) {
|
||||
trigger_error(__d('cake_dev', "DbAcl::check() - Failed ARO/ACO node lookup in permissions check. Node references:\nAro: %s\nAco: %s", print_r($aro, true), print_r($aco, true)), E_USER_WARNING);
|
||||
trigger_error(__d('cake_dev',
|
||||
"%s - Failed ARO/ACO node lookup in permissions check. Node references:\nAro: %s\nAco: %s",
|
||||
'DbAcl::check()',
|
||||
print_r($aro, true),
|
||||
print_r($aco, true)),
|
||||
E_USER_WARNING
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$acoPath) {
|
||||
trigger_error(__d('cake_dev', "DbAcl::check() - Failed ACO node lookup in permissions check. Node references:\nAro: %s\nAco: %s", print_r($aro, true), print_r($aco, true)), E_USER_WARNING);
|
||||
trigger_error(__d('cake_dev',
|
||||
"%s - Failed ACO node lookup in permissions check. Node references:\nAro: %s\nAco: %s",
|
||||
'DbAcl::check()',
|
||||
print_r($aro, true),
|
||||
print_r($aco, true)),
|
||||
E_USER_WARNING
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($action !== '*' && !in_array('_' . $action, $permKeys)) {
|
||||
trigger_error(__d('cake_dev', "ACO permissions key %s does not exist in DbAcl::check()", $action), E_USER_NOTICE);
|
||||
trigger_error(__d('cake_dev', "ACO permissions key %s does not exist in %s", $action, 'DbAcl::check()'), E_USER_NOTICE);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -166,20 +178,20 @@ class Permission extends AppModel {
|
|||
* @return boolean Success
|
||||
* @throws AclException on Invalid permission key.
|
||||
*/
|
||||
public function allow($aro, $aco, $actions = "*", $value = 1) {
|
||||
public function allow($aro, $aco, $actions = '*', $value = 1) {
|
||||
$perms = $this->getAclLink($aro, $aco);
|
||||
$permKeys = $this->getAcoKeys($this->schema());
|
||||
$save = array();
|
||||
|
||||
if (!$perms) {
|
||||
trigger_error(__d('cake_dev', 'DbAcl::allow() - Invalid node'), E_USER_WARNING);
|
||||
trigger_error(__d('cake_dev', '%s - Invalid node', 'DbAcl::allow()'), E_USER_WARNING);
|
||||
return false;
|
||||
}
|
||||
if (isset($perms[0])) {
|
||||
$save = $perms[0][$this->alias];
|
||||
}
|
||||
|
||||
if ($actions === "*") {
|
||||
if ($actions === '*') {
|
||||
$save = array_combine($permKeys, array_pad(array(), count($permKeys), $value));
|
||||
} else {
|
||||
if (!is_array($actions)) {
|
||||
|
|
|
@ -516,7 +516,7 @@ class CakeResponse {
|
|||
*/
|
||||
protected function _sendHeader($name, $value = null) {
|
||||
if (!headers_sent()) {
|
||||
if (is_null($value)) {
|
||||
if ($value === null) {
|
||||
header($name);
|
||||
} else {
|
||||
header("{$name}: {$value}");
|
||||
|
@ -562,7 +562,7 @@ class CakeResponse {
|
|||
* @return array list of headers to be sent
|
||||
*/
|
||||
public function header($header = null, $value = null) {
|
||||
if (is_null($header)) {
|
||||
if ($header === null) {
|
||||
return $this->_headers;
|
||||
}
|
||||
$headers = is_array($header) ? $header : array($header => $value);
|
||||
|
@ -602,7 +602,7 @@ class CakeResponse {
|
|||
* @return string current message buffer if $content param is passed as null
|
||||
*/
|
||||
public function body($content = null) {
|
||||
if (is_null($content)) {
|
||||
if ($content === null) {
|
||||
return $this->_body;
|
||||
}
|
||||
return $this->_body = $content;
|
||||
|
@ -617,7 +617,7 @@ class CakeResponse {
|
|||
* @throws CakeException When an unknown status code is reached.
|
||||
*/
|
||||
public function statusCode($code = null) {
|
||||
if (is_null($code)) {
|
||||
if ($code === null) {
|
||||
return $this->_status;
|
||||
}
|
||||
if (!isset($this->_statusCodes[$code])) {
|
||||
|
@ -702,7 +702,7 @@ class CakeResponse {
|
|||
* @return mixed current content type or false if supplied an invalid content type
|
||||
*/
|
||||
public function type($contentType = null) {
|
||||
if (is_null($contentType)) {
|
||||
if ($contentType === null) {
|
||||
return $this->_contentType;
|
||||
}
|
||||
if (is_array($contentType)) {
|
||||
|
@ -765,7 +765,7 @@ class CakeResponse {
|
|||
* @return string current charset
|
||||
*/
|
||||
public function charset($charset = null) {
|
||||
if (is_null($charset)) {
|
||||
if ($charset === null) {
|
||||
return $this->_charset;
|
||||
}
|
||||
return $this->_charset = $charset;
|
||||
|
@ -1272,7 +1272,7 @@ class CakeResponse {
|
|||
|
||||
$extension = strtolower($file->ext());
|
||||
$download = $options['download'];
|
||||
if ((!$extension || $this->type($extension) === false) && is_null($download)) {
|
||||
if ((!$extension || $this->type($extension) === false) && $download === null) {
|
||||
$download = true;
|
||||
}
|
||||
|
||||
|
@ -1289,7 +1289,7 @@ class CakeResponse {
|
|||
if (!empty($contentType)) {
|
||||
$this->type($contentType);
|
||||
}
|
||||
if (is_null($options['name'])) {
|
||||
if ($options['name'] === null) {
|
||||
$name = $file->name;
|
||||
} else {
|
||||
$name = $options['name'];
|
||||
|
|
|
@ -231,7 +231,7 @@ class SmtpTransport extends AbstractTransport {
|
|||
* @throws SocketException
|
||||
*/
|
||||
protected function _smtpSend($data, $checkCode = '250') {
|
||||
if (!is_null($data)) {
|
||||
if ($data !== null) {
|
||||
$this->_socket->write($data . "\r\n");
|
||||
}
|
||||
while ($checkCode !== false) {
|
||||
|
|
|
@ -550,7 +550,7 @@ class HttpSocket extends CakeSocket {
|
|||
* @return mixed Either false on failure or a string containing the composed URL.
|
||||
*/
|
||||
public function url($url = null, $uriTemplate = null) {
|
||||
if (is_null($url)) {
|
||||
if ($url === null) {
|
||||
$url = '/';
|
||||
}
|
||||
if (is_string($url)) {
|
||||
|
|
|
@ -138,7 +138,7 @@ class HttpSocketResponse implements ArrayAccess {
|
|||
* @return boolean
|
||||
*/
|
||||
public function isRedirect() {
|
||||
return in_array($this->code, array(301, 302, 303, 307)) && !is_null($this->getHeader('Location'));
|
||||
return in_array($this->code, array(301, 302, 303, 307)) && $this->getHeader('Location') !== null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -80,6 +80,13 @@ class RedirectRoute extends CakeRoute {
|
|||
}
|
||||
if (isset($this->options['persist']) && is_array($redirect)) {
|
||||
$redirect += array('named' => $params['named'], 'pass' => $params['pass'], 'url' => array());
|
||||
if (is_array($this->options['persist'])) {
|
||||
foreach ($this->options['persist'] as $elem) {
|
||||
if (isset($params[$elem])) {
|
||||
$redirect[$elem] = $params[$elem];
|
||||
}
|
||||
}
|
||||
}
|
||||
$redirect = Router::reverse($redirect);
|
||||
}
|
||||
$status = 301;
|
||||
|
|
|
@ -183,7 +183,7 @@ class Router {
|
|||
* @throws RouterException
|
||||
*/
|
||||
public static function defaultRouteClass($routeClass = null) {
|
||||
if (is_null($routeClass)) {
|
||||
if ($routeClass === null) {
|
||||
return self::$_routeClass;
|
||||
}
|
||||
|
||||
|
|
|
@ -282,29 +282,17 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
$components = array('Acl', 'Auth');
|
||||
$this->Task->expects($this->any())->method('createFile')->will($this->returnValue(true));
|
||||
|
||||
$result = $this->Task->bake('Articles', '--actions--', $helpers, $components);
|
||||
$this->assertContains(' * @property Article $Article', $result);
|
||||
$this->assertContains(' * @property AclComponent $Acl', $result);
|
||||
$this->assertContains(' * @property AuthComponent $Auth', $result);
|
||||
$this->assertContains(' * @property PaginatorComponent $Paginator', $result);
|
||||
$this->assertContains('class ArticlesController extends AppController', $result);
|
||||
$this->assertContains("public \$components = array('Acl', 'Auth', 'Paginator')", $result);
|
||||
$this->assertContains("public \$helpers = array('Js', 'Time')", $result);
|
||||
$this->assertContains("--actions--", $result);
|
||||
$result = $this->Task->bake('Articles', null, $helpers, $components);
|
||||
$expected = file_get_contents(CAKE . 'Test' . DS . 'bake_compare' . DS . 'Controller' . DS . 'NoActions.ctp');
|
||||
$this->assertTextEquals($expected, $result);
|
||||
|
||||
$result = $this->Task->bake('Articles', null, array(), array());
|
||||
$expected = file_get_contents(CAKE . 'Test' . DS . 'bake_compare' . DS . 'Controller' . DS . 'NoHelpersOrComponents.ctp');
|
||||
$this->assertTextEquals($expected, $result);
|
||||
|
||||
$result = $this->Task->bake('Articles', 'scaffold', $helpers, $components);
|
||||
$this->assertContains("class ArticlesController extends AppController", $result);
|
||||
$this->assertContains("public \$scaffold", $result);
|
||||
$this->assertNotContains('@property', $result);
|
||||
$this->assertNotContains('helpers', $result);
|
||||
$this->assertNotContains('components', $result);
|
||||
|
||||
$result = $this->Task->bake('Articles', '--actions--', array(), array());
|
||||
$this->assertContains('class ArticlesController extends AppController', $result);
|
||||
$this->assertSame(substr_count($result, '@property'), 2);
|
||||
$this->assertContains("public \$components = array('Paginator')", $result);
|
||||
$this->assertNotContains('helpers', $result);
|
||||
$this->assertContains('--actions--', $result);
|
||||
$expected = file_get_contents(CAKE . 'Test' . DS . 'bake_compare' . DS . 'Controller' . DS . 'Scaffold.ctp');
|
||||
$this->assertTextEquals($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -348,30 +336,10 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
*/
|
||||
public function testBakeActionsUsingSessions() {
|
||||
$result = $this->Task->bakeActions('BakeArticles', null, true);
|
||||
|
||||
$this->assertContains('function index() {', $result);
|
||||
$this->assertContains('$this->BakeArticle->recursive = 0;', $result);
|
||||
$this->assertContains("\$this->set('bakeArticles', \$this->Paginator->paginate());", $result);
|
||||
|
||||
$this->assertContains('function view($id = null)', $result);
|
||||
$this->assertContains("throw new NotFoundException(__('Invalid bake article'));", $result);
|
||||
$this->assertContains("\$options = array('conditions' => array('BakeArticle.' . \$this->BakeArticle->primaryKey => \$id));", $result);
|
||||
$this->assertContains("\$this->set('bakeArticle', \$this->BakeArticle->find('first', \$options));", $result);
|
||||
|
||||
$this->assertContains('function add()', $result);
|
||||
$this->assertContains("if (\$this->request->is('post'))", $result);
|
||||
$this->assertContains('if ($this->BakeArticle->save($this->request->data))', $result);
|
||||
$this->assertContains("\$this->Session->setFlash(__('The bake article has been saved'));", $result);
|
||||
|
||||
$this->assertContains('function edit($id = null)', $result);
|
||||
$this->assertContains("\$this->Session->setFlash(__('The bake article could not be saved. Please, try again.'));", $result);
|
||||
|
||||
$this->assertContains('function delete($id = null)', $result);
|
||||
$this->assertContains('if ($this->BakeArticle->delete())', $result);
|
||||
$this->assertContains("\$this->Session->setFlash(__('Bake article deleted'));", $result);
|
||||
$expected = file_get_contents(CAKE . 'Test' . DS . 'bake_compare' . DS . 'Controller' . DS . 'ActionsUsingSessions.ctp');
|
||||
$this->assertTextEquals($expected, $result);
|
||||
|
||||
$result = $this->Task->bakeActions('BakeArticles', 'admin_', true);
|
||||
|
||||
$this->assertContains('function admin_index() {', $result);
|
||||
$this->assertContains('function admin_add()', $result);
|
||||
$this->assertContains('function admin_view($id = null)', $result);
|
||||
|
@ -386,29 +354,8 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
*/
|
||||
public function testBakeActionsWithNoSessions() {
|
||||
$result = $this->Task->bakeActions('BakeArticles', null, false);
|
||||
|
||||
$this->assertContains('function index() {', $result);
|
||||
$this->assertContains('$this->BakeArticle->recursive = 0;', $result);
|
||||
$this->assertContains("\$this->set('bakeArticles', \$this->Paginator->paginate());", $result);
|
||||
|
||||
$this->assertContains('function view($id = null)', $result);
|
||||
$this->assertContains("throw new NotFoundException(__('Invalid bake article'));", $result);
|
||||
$this->assertContains("\$this->set('bakeArticle', \$this->BakeArticle->find('first', \$options));", $result);
|
||||
|
||||
$this->assertContains('function add()', $result);
|
||||
$this->assertContains("if (\$this->request->is('post'))", $result);
|
||||
$this->assertContains('if ($this->BakeArticle->save($this->request->data))', $result);
|
||||
|
||||
$this->assertContains("\$this->flash(__('The bake article has been saved.'), array('action' => 'index'))", $result);
|
||||
|
||||
$this->assertContains('function edit($id = null)', $result);
|
||||
$this->assertContains("\$this->BakeArticle->BakeTag->find('list')", $result);
|
||||
$this->assertContains("\$this->set(compact('bakeTags'))", $result);
|
||||
|
||||
$this->assertContains('function delete($id = null)', $result);
|
||||
$this->assertContains("\$this->request->onlyAllow('post', 'delete')", $result);
|
||||
$this->assertContains('if ($this->BakeArticle->delete())', $result);
|
||||
$this->assertContains("\$this->flash(__('Bake article deleted'), array('action' => 'index'))", $result);
|
||||
$expected = file_get_contents(CAKE . 'Test' . DS . 'bake_compare' . DS . 'Controller' . DS . 'ActionsWithNoSessions.ctp');
|
||||
$this->assertTextEquals($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -193,7 +193,6 @@ class SomethingWithEmailComponent extends Component {
|
|||
public $components = array('Email');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ComponentTest class
|
||||
*
|
||||
|
|
|
@ -119,7 +119,6 @@ class MergePostsController extends MergeVarPluginAppController {
|
|||
public $uses = array();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test Case for Controller Merging of Vars.
|
||||
*
|
||||
|
|
|
@ -50,7 +50,6 @@ class ControllerTestAppController extends Controller {
|
|||
public $components = array('Cookie');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ControllerPost class
|
||||
*
|
||||
|
|
|
@ -131,7 +131,6 @@ class MyCustomExceptionRenderer extends ExceptionRenderer {
|
|||
class MissingWidgetThingException extends NotFoundException {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ExceptionRendererTest class
|
||||
*
|
||||
|
|
|
@ -1491,7 +1491,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
'dynamicWith' => true,
|
||||
'associationForeignKey' => 'join_b_id',
|
||||
'conditions' => '', 'fields' => '', 'order' => '', 'limit' => '', 'offset' => '',
|
||||
'finderQuery' => '', 'deleteQuery' => '', 'insertQuery' => ''
|
||||
'finderQuery' => ''
|
||||
));
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
|
@ -1568,8 +1568,6 @@ class ModelIntegrationTest extends BaseModelTest {
|
|||
'offset' => '',
|
||||
'unique' => true,
|
||||
'finderQuery' => '',
|
||||
'deleteQuery' => '',
|
||||
'insertQuery' => ''
|
||||
));
|
||||
|
||||
$this->assertSame($TestModel->hasAndBelongsToMany, $expected);
|
||||
|
|
|
@ -588,7 +588,7 @@ class ModelValidationTest extends BaseModelTest {
|
|||
$this->assertFalse($result, 'Save occurred even when with models failed. %s');
|
||||
$this->assertEquals($expectedError, $JoinThing->validationErrors);
|
||||
$count = $Something->find('count', array('conditions' => array('Something.id' => $data['Something']['id'])));
|
||||
$this->assertSame($count, 0);
|
||||
$this->assertSame(0, $count);
|
||||
|
||||
$data = array(
|
||||
'Something' => array(
|
||||
|
@ -651,7 +651,7 @@ class ModelValidationTest extends BaseModelTest {
|
|||
$this->assertEquals($expectedError, $JoinThing->validationErrors);
|
||||
|
||||
$count = $Something->find('count', array('conditions' => array('Something.id' => $data['Something']['id'])));
|
||||
$this->assertSame($count, 0);
|
||||
$this->assertSame(0, $count);
|
||||
|
||||
$joinRecords = $JoinThing->find('count', array(
|
||||
'conditions' => array('JoinThing.something_id' => $data['Something']['id'])
|
||||
|
@ -692,11 +692,11 @@ class ModelValidationTest extends BaseModelTest {
|
|||
$Author->create();
|
||||
$result = $Author->saveAll($data, array('validate' => 'first'));
|
||||
$this->assertTrue($result);
|
||||
$this->assertFalse(is_null($Author->id));
|
||||
$this->assertNotNull($Author->id);
|
||||
|
||||
$id = $Author->id;
|
||||
$count = $Author->find('count', array('conditions' => array('Author.id' => $id)));
|
||||
$this->assertSame($count, 1);
|
||||
$this->assertSame(1, $count);
|
||||
|
||||
$count = $Post->find('count', array(
|
||||
'conditions' => array('Post.author_id' => $id)
|
||||
|
@ -2315,7 +2315,7 @@ class ModelValidationTest extends BaseModelTest {
|
|||
),
|
||||
),
|
||||
);
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2376,7 +2376,7 @@ class ModelValidationTest extends BaseModelTest {
|
|||
),
|
||||
),
|
||||
);
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2517,7 +2517,6 @@ class MyCategoriesMyProduct extends CakeTestModel {
|
|||
public $name = 'MyCategoriesMyProduct';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* NumberTree class
|
||||
*
|
||||
|
|
|
@ -103,6 +103,22 @@ class RedirectRouteTest extends CakeTestCase {
|
|||
$result = $route->parse('/my_controllers/do_something/passme/named:param');
|
||||
$header = $route->response->header();
|
||||
$this->assertEquals(Router::url('/tags/add', true), $header['Location']);
|
||||
|
||||
$route = new RedirectRoute('/:lang/my_controllers', array('controller' => 'tags', 'action' => 'add'), array('lang' => '(nl|en)', 'persist' => array('lang')));
|
||||
$route->stop = false;
|
||||
$route->response = $this->getMock('CakeResponse', array('_sendHeader'));
|
||||
$result = $route->parse('/nl/my_controllers/');
|
||||
$header = $route->response->header();
|
||||
$this->assertEquals(Router::url('/tags/add/lang:nl', true), $header['Location']);
|
||||
|
||||
Router::$routes = array(); // reset default routes
|
||||
Router::connect('/:lang/preferred_controllers', array('controller' => 'tags', 'action' => 'add'), array('lang' => '(nl|en)', 'persist' => array('lang')));
|
||||
$route = new RedirectRoute('/:lang/my_controllers', array('controller' => 'tags', 'action' => 'add'), array('lang' => '(nl|en)', 'persist' => array('lang')));
|
||||
$route->stop = false;
|
||||
$route->response = $this->getMock('CakeResponse', array('_sendHeader'));
|
||||
$result = $route->parse('/nl/my_controllers/');
|
||||
$header = $route->response->header();
|
||||
$this->assertEquals(Router::url('/nl/preferred_controllers', true), $header['Location']);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -111,7 +111,6 @@ class StringsTestFixture extends CakeTestFixture {
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* CakeTestFixtureImportFixture class
|
||||
*
|
||||
|
@ -175,7 +174,6 @@ class FixturePrefixTest extends Model {
|
|||
public $useDbConfig = 'test';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test case for CakeTestFixture
|
||||
*
|
||||
|
|
|
@ -210,6 +210,28 @@ class ControllerTestCaseTest extends CakeTestCase {
|
|||
$this->assertEquals('written!', $Posts->Auth->Session->write('something'));
|
||||
}
|
||||
|
||||
/**
|
||||
* testGenerateWithComponentConfig
|
||||
*/
|
||||
public function testGenerateWithComponentConfig() {
|
||||
$Tests = $this->Case->generate('TestConfigs', array(
|
||||
));
|
||||
|
||||
$expected = array('some' => 'config');
|
||||
$settings = array_intersect_key($Tests->RequestHandler->settings, array('some' => 'foo'));
|
||||
$this->assertSame($expected, $settings, 'A mocked component should have the same config as an unmocked component');
|
||||
|
||||
$Tests = $this->Case->generate('TestConfigs', array(
|
||||
'components' => array(
|
||||
'RequestHandler' => array('isPut')
|
||||
)
|
||||
));
|
||||
|
||||
$expected = array('some' => 'config');
|
||||
$settings = array_intersect_key($Tests->RequestHandler->settings, array('some' => 'foo'));
|
||||
$this->assertSame($expected, $settings, 'A mocked component should have the same config as an unmocked component');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests ControllerTestCase::generate() using classes from plugins
|
||||
*/
|
||||
|
|
|
@ -217,19 +217,19 @@ class FileTest extends CakeTestCase {
|
|||
$this->assertTrue(is_resource($this->File->handle));
|
||||
|
||||
$result = $this->File->offset();
|
||||
$expecting = 0;
|
||||
$this->assertSame($result, $expecting);
|
||||
$expected = 0;
|
||||
$this->assertSame($expected, $result);
|
||||
|
||||
$data = file_get_contents(__FILE__);
|
||||
$success = $this->File->offset(5);
|
||||
$expecting = substr($data, 5, 3);
|
||||
$expected = substr($data, 5, 3);
|
||||
$result = $this->File->read(3);
|
||||
$this->assertTrue($success);
|
||||
$this->assertEquals($expecting, $result);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = $this->File->offset();
|
||||
$expecting = 5 + 3;
|
||||
$this->assertSame($result, $expecting);
|
||||
$expected = 5 + 3;
|
||||
$this->assertSame($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1042,7 +1042,7 @@ class HashTest extends CakeTestCase {
|
|||
1 => array('Person' => array('name' => 'Jeff')),
|
||||
);
|
||||
$a = Hash::sort($a, '{n}.Person.name', 'ASC', 'STRING');
|
||||
$this->assertEquals($a, $b);
|
||||
$this->assertSame($a, $b);
|
||||
|
||||
$names = array(
|
||||
array('employees' => array(
|
||||
|
@ -1065,7 +1065,38 @@ class HashTest extends CakeTestCase {
|
|||
array('employees' => array(array('name' => array()))),
|
||||
array('employees' => array(array('name' => array())))
|
||||
);
|
||||
$this->assertEquals($expected, $result);
|
||||
$this->assertSame($expected, $result);
|
||||
|
||||
$a = array(
|
||||
'SU' => array(
|
||||
'total_fulfillable' => 2
|
||||
),
|
||||
'AA' => array(
|
||||
'total_fulfillable' => 1
|
||||
),
|
||||
'LX' => array(
|
||||
'total_fulfillable' => 0
|
||||
),
|
||||
'BL' => array(
|
||||
'total_fulfillable' => 3
|
||||
),
|
||||
);
|
||||
$expected = array(
|
||||
'LX' => array(
|
||||
'total_fulfillable' => 0
|
||||
),
|
||||
'AA' => array(
|
||||
'total_fulfillable' => 1
|
||||
),
|
||||
'SU' => array(
|
||||
'total_fulfillable' => 2
|
||||
),
|
||||
'BL' => array(
|
||||
'total_fulfillable' => 3
|
||||
),
|
||||
);
|
||||
$result = Hash::sort($a, '{s}.total_fulfillable', 'asc');
|
||||
$this->assertSame($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2209,7 +2240,7 @@ class HashTest extends CakeTestCase {
|
|||
)
|
||||
)
|
||||
);
|
||||
$this->assertEquals($result, $expected);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$data = array('a.b.100.a' => null, 'a.b.200.a' => null);
|
||||
$expected = array(
|
||||
|
|
|
@ -7078,6 +7078,23 @@ class FormHelperTest extends CakeTestCase {
|
|||
'Delete',
|
||||
'/a'
|
||||
));
|
||||
|
||||
$result = $this->Form->postLink(
|
||||
'',
|
||||
array('controller' => 'items', 'action' => 'delete', 10),
|
||||
array('class' => 'btn btn-danger', 'escape' => false),
|
||||
'Confirm thing'
|
||||
);
|
||||
$this->assertTags($result, array(
|
||||
'form' => array(
|
||||
'method' => 'post', 'action' => '/items/delete/10',
|
||||
'name' => 'preg:/post_\w+/', 'id' => 'preg:/post_\w+/', 'style' => 'display:none;'
|
||||
),
|
||||
'input' => array('type' => 'hidden', 'name' => '_method', 'value' => 'POST'),
|
||||
'/form',
|
||||
'a' => array('class' => 'btn btn-danger', 'href' => '#', 'onclick' => 'preg:/if \(confirm\(\'Confirm thing\'\)\) \{ document\.post_\w+\.submit\(\); \} event\.returnValue = false; return false;/'),
|
||||
'/a'
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -219,7 +219,6 @@ class TestAfterHelper extends Helper {
|
|||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ViewTest class
|
||||
*
|
||||
|
|
|
@ -0,0 +1,91 @@
|
|||
|
||||
/**
|
||||
* index method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function index() {
|
||||
$this->BakeArticle->recursive = 0;
|
||||
$this->set('bakeArticles', $this->Paginator->paginate());
|
||||
}
|
||||
|
||||
/**
|
||||
* view method
|
||||
*
|
||||
* @throws NotFoundException
|
||||
* @param string $id
|
||||
* @return void
|
||||
*/
|
||||
public function view($id = null) {
|
||||
if (!$this->BakeArticle->exists($id)) {
|
||||
throw new NotFoundException(__('Invalid bake article'));
|
||||
}
|
||||
$options = array('conditions' => array('BakeArticle.' . $this->BakeArticle->primaryKey => $id));
|
||||
$this->set('bakeArticle', $this->BakeArticle->find('first', $options));
|
||||
}
|
||||
|
||||
/**
|
||||
* add method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function add() {
|
||||
if ($this->request->is('post')) {
|
||||
$this->BakeArticle->create();
|
||||
if ($this->BakeArticle->save($this->request->data)) {
|
||||
$this->Session->setFlash(__('The bake article has been saved.'));
|
||||
return $this->redirect(array('action' => 'index'));
|
||||
} else {
|
||||
$this->Session->setFlash(__('The bake article could not be saved. Please, try again.'));
|
||||
}
|
||||
}
|
||||
$bakeTags = $this->BakeArticle->BakeTag->find('list');
|
||||
$this->set(compact('bakeTags'));
|
||||
}
|
||||
|
||||
/**
|
||||
* edit method
|
||||
*
|
||||
* @throws NotFoundException
|
||||
* @param string $id
|
||||
* @return void
|
||||
*/
|
||||
public function edit($id = null) {
|
||||
if (!$this->BakeArticle->exists($id)) {
|
||||
throw new NotFoundException(__('Invalid bake article'));
|
||||
}
|
||||
if ($this->request->is('post') || $this->request->is('put')) {
|
||||
if ($this->BakeArticle->save($this->request->data)) {
|
||||
$this->Session->setFlash(__('The bake article has been saved.'));
|
||||
return $this->redirect(array('action' => 'index'));
|
||||
} else {
|
||||
$this->Session->setFlash(__('The bake article could not be saved. Please, try again.'));
|
||||
}
|
||||
} else {
|
||||
$options = array('conditions' => array('BakeArticle.' . $this->BakeArticle->primaryKey => $id));
|
||||
$this->request->data = $this->BakeArticle->find('first', $options);
|
||||
}
|
||||
$bakeTags = $this->BakeArticle->BakeTag->find('list');
|
||||
$this->set(compact('bakeTags'));
|
||||
}
|
||||
|
||||
/**
|
||||
* delete method
|
||||
*
|
||||
* @throws NotFoundException
|
||||
* @param string $id
|
||||
* @return void
|
||||
*/
|
||||
public function delete($id = null) {
|
||||
$this->BakeArticle->id = $id;
|
||||
if (!$this->BakeArticle->exists()) {
|
||||
throw new NotFoundException(__('Invalid bake article'));
|
||||
}
|
||||
$this->request->onlyAllow('post', 'delete');
|
||||
if ($this->BakeArticle->delete()) {
|
||||
$this->Session->setFlash(__('The bake article has been deleted.'));
|
||||
} else {
|
||||
$this->Session->setFlash(__('The bake article could not be deleted. Please, try again.'));
|
||||
}
|
||||
return $this->redirect(array('action' => 'index'));
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
|
||||
/**
|
||||
* index method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function index() {
|
||||
$this->BakeArticle->recursive = 0;
|
||||
$this->set('bakeArticles', $this->Paginator->paginate());
|
||||
}
|
||||
|
||||
/**
|
||||
* view method
|
||||
*
|
||||
* @throws NotFoundException
|
||||
* @param string $id
|
||||
* @return void
|
||||
*/
|
||||
public function view($id = null) {
|
||||
if (!$this->BakeArticle->exists($id)) {
|
||||
throw new NotFoundException(__('Invalid bake article'));
|
||||
}
|
||||
$options = array('conditions' => array('BakeArticle.' . $this->BakeArticle->primaryKey => $id));
|
||||
$this->set('bakeArticle', $this->BakeArticle->find('first', $options));
|
||||
}
|
||||
|
||||
/**
|
||||
* add method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function add() {
|
||||
if ($this->request->is('post')) {
|
||||
$this->BakeArticle->create();
|
||||
if ($this->BakeArticle->save($this->request->data)) {
|
||||
return $this->flash(__('The bake article has been saved.'), array('action' => 'index'));
|
||||
}
|
||||
}
|
||||
$bakeTags = $this->BakeArticle->BakeTag->find('list');
|
||||
$this->set(compact('bakeTags'));
|
||||
}
|
||||
|
||||
/**
|
||||
* edit method
|
||||
*
|
||||
* @throws NotFoundException
|
||||
* @param string $id
|
||||
* @return void
|
||||
*/
|
||||
public function edit($id = null) {
|
||||
if (!$this->BakeArticle->exists($id)) {
|
||||
throw new NotFoundException(__('Invalid bake article'));
|
||||
}
|
||||
if ($this->request->is('post') || $this->request->is('put')) {
|
||||
if ($this->BakeArticle->save($this->request->data)) {
|
||||
return $this->flash(__('The bake article has been saved.'), array('action' => 'index'));
|
||||
}
|
||||
} else {
|
||||
$options = array('conditions' => array('BakeArticle.' . $this->BakeArticle->primaryKey => $id));
|
||||
$this->request->data = $this->BakeArticle->find('first', $options);
|
||||
}
|
||||
$bakeTags = $this->BakeArticle->BakeTag->find('list');
|
||||
$this->set(compact('bakeTags'));
|
||||
}
|
||||
|
||||
/**
|
||||
* delete method
|
||||
*
|
||||
* @throws NotFoundException
|
||||
* @param string $id
|
||||
* @return void
|
||||
*/
|
||||
public function delete($id = null) {
|
||||
$this->BakeArticle->id = $id;
|
||||
if (!$this->BakeArticle->exists()) {
|
||||
throw new NotFoundException(__('Invalid bake article'));
|
||||
}
|
||||
$this->request->onlyAllow('post', 'delete');
|
||||
if ($this->BakeArticle->delete()) {
|
||||
return $this->flash(__('The bake article has been deleted.'), array('action' => 'index'));
|
||||
} else {
|
||||
return $this->flash(__('The bake article could not be deleted. Please, try again.'), array('action' => 'index'));
|
||||
}
|
||||
}
|
27
lib/Cake/Test/bake_compare/Controller/NoActions.ctp
Normal file
27
lib/Cake/Test/bake_compare/Controller/NoActions.ctp
Normal file
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
App::uses('AppController', 'Controller');
|
||||
/**
|
||||
* Articles Controller
|
||||
*
|
||||
* @property Article $Article
|
||||
* @property AclComponent $Acl
|
||||
* @property AuthComponent $Auth
|
||||
* @property PaginatorComponent $Paginator
|
||||
*/
|
||||
class ArticlesController extends AppController {
|
||||
|
||||
/**
|
||||
* Helpers
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $helpers = array('Js', 'Time');
|
||||
|
||||
/**
|
||||
* Components
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $components = array('Acl', 'Auth', 'Paginator');
|
||||
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
App::uses('AppController', 'Controller');
|
||||
/**
|
||||
* Articles Controller
|
||||
*
|
||||
* @property Article $Article
|
||||
* @property PaginatorComponent $Paginator
|
||||
*/
|
||||
class ArticlesController extends AppController {
|
||||
|
||||
/**
|
||||
* Components
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $components = array('Paginator');
|
||||
|
||||
}
|
16
lib/Cake/Test/bake_compare/Controller/Scaffold.ctp
Normal file
16
lib/Cake/Test/bake_compare/Controller/Scaffold.ctp
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
App::uses('AppController', 'Controller');
|
||||
/**
|
||||
* Articles Controller
|
||||
*
|
||||
*/
|
||||
class ArticlesController extends AppController {
|
||||
|
||||
/**
|
||||
* Scaffold
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
public $scaffold;
|
||||
|
||||
}
|
13
lib/Cake/Test/test_app/Controller/TestConfigsController.php
Normal file
13
lib/Cake/Test/test_app/Controller/TestConfigsController.php
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
App::uses('CakeErrorController', 'Controller');
|
||||
|
||||
class TestConfigsController extends CakeErrorController {
|
||||
|
||||
public $components = array(
|
||||
'RequestHandler' => array(
|
||||
'some' => 'config'
|
||||
)
|
||||
);
|
||||
|
||||
}
|
|
@ -364,7 +364,8 @@ abstract class ControllerTestCase extends CakeTestCase {
|
|||
'class' => $componentClass
|
||||
));
|
||||
}
|
||||
$componentObj = $this->getMock($componentClass, $methods, array($controllerObj->Components));
|
||||
$config = isset($controllerObj->components[$component]) ? $controllerObj->components[$component] : array();
|
||||
$componentObj = $this->getMock($componentClass, $methods, array($controllerObj->Components, $config));
|
||||
$controllerObj->Components->set($name, $componentObj);
|
||||
$controllerObj->Components->enable($name);
|
||||
}
|
||||
|
|
|
@ -248,7 +248,7 @@ class CakeTime {
|
|||
*/
|
||||
public static function convert($serverTime, $timezone) {
|
||||
static $serverTimezone = null;
|
||||
if (is_null($serverTimezone) || (date_default_timezone_get() !== $serverTimezone->getName())) {
|
||||
if ($serverTimezone === null || (date_default_timezone_get() !== $serverTimezone->getName())) {
|
||||
$serverTimezone = new DateTimeZone(date_default_timezone_get());
|
||||
}
|
||||
$serverOffset = $serverTimezone->getOffset(new DateTime('@' . $serverTime));
|
||||
|
@ -673,7 +673,7 @@ class CakeTime {
|
|||
public static function toRSS($dateString, $timezone = null) {
|
||||
$date = self::fromString($dateString, $timezone);
|
||||
|
||||
if (is_null($timezone)) {
|
||||
if ($timezone === null) {
|
||||
return date("r", $date);
|
||||
}
|
||||
|
||||
|
|
|
@ -289,7 +289,7 @@ class ClassRegistry {
|
|||
if (empty($param) && is_array($type)) {
|
||||
$param = $type;
|
||||
$type = 'Model';
|
||||
} elseif (is_null($param)) {
|
||||
} elseif ($param === null) {
|
||||
unset($_this->_config[$type]);
|
||||
} elseif (empty($param) && is_string($type)) {
|
||||
return isset($_this->_config[$type]) ? $_this->_config[$type] : null;
|
||||
|
|
|
@ -706,7 +706,7 @@ class Debugger {
|
|||
$self = Debugger::getInstance();
|
||||
$data = null;
|
||||
|
||||
if (is_null($format)) {
|
||||
if ($format === null) {
|
||||
return Debugger::outputAs();
|
||||
}
|
||||
|
||||
|
@ -815,7 +815,7 @@ class Debugger {
|
|||
if (is_object($var)) {
|
||||
return get_class($var);
|
||||
}
|
||||
if (is_null($var)) {
|
||||
if ($var === null) {
|
||||
return 'null';
|
||||
}
|
||||
if (is_string($var)) {
|
||||
|
@ -846,11 +846,11 @@ class Debugger {
|
|||
*/
|
||||
public static function checkSecurityKeys() {
|
||||
if (Configure::read('Security.salt') === 'DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi') {
|
||||
trigger_error(__d('cake_dev', 'Please change the value of \'Security.salt\' in app/Config/core.php to a salt value specific to your application'), E_USER_NOTICE);
|
||||
trigger_error(__d('cake_dev', 'Please change the value of %s in %s to a salt value specific to your application.', '\'Security.salt\'', 'APP/Config/core.php'), E_USER_NOTICE);
|
||||
}
|
||||
|
||||
if (Configure::read('Security.cipherSeed') === '76859309657453542496749683645') {
|
||||
trigger_error(__d('cake_dev', 'Please change the value of \'Security.cipherSeed\' in app/Config/core.php to a numeric (digits only) seed value specific to your application'), E_USER_NOTICE);
|
||||
trigger_error(__d('cake_dev', 'Please change the value of %s in %s to a numeric (digits only) seed value specific to your application.', '\'Security.cipherSeed\'', 'APP/Config/core.php'), E_USER_NOTICE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -395,7 +395,7 @@ class File {
|
|||
* @link http://book.cakephp.org/2.0/en/core-utility-libraries/file-folder.html#File::pwd
|
||||
*/
|
||||
public function pwd() {
|
||||
if (is_null($this->path)) {
|
||||
if ($this->path === null) {
|
||||
$this->path = $this->Folder->slashTerm($this->Folder->pwd()) . $this->name;
|
||||
}
|
||||
return $this->path;
|
||||
|
|
|
@ -816,7 +816,7 @@ class Hash {
|
|||
$stack = array();
|
||||
foreach ($data as $k => $r) {
|
||||
$id = $k;
|
||||
if (!is_null($key)) {
|
||||
if ($key !== null) {
|
||||
$id = $key;
|
||||
}
|
||||
if (is_array($r) && !empty($r)) {
|
||||
|
|
|
@ -225,7 +225,7 @@ abstract class ObjectCollection {
|
|||
}
|
||||
foreach ($name as $object => $objectPriority) {
|
||||
if (isset($this->_loaded[$object])) {
|
||||
if (is_null($objectPriority)) {
|
||||
if ($objectPriority === null) {
|
||||
$objectPriority = $this->defaultPriority;
|
||||
}
|
||||
$this->_loaded[$object]->settings['priority'] = $objectPriority;
|
||||
|
|
|
@ -935,7 +935,7 @@ class Set {
|
|||
$stack = array();
|
||||
foreach ($results as $k => $r) {
|
||||
$id = $k;
|
||||
if (!is_null($key)) {
|
||||
if ($key !== null) {
|
||||
$id = $key;
|
||||
}
|
||||
if (is_array($r) && !empty($r)) {
|
||||
|
|
|
@ -149,7 +149,7 @@ class Validation {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!is_null($regex)) {
|
||||
if ($regex !== null) {
|
||||
if (self::_check($check, $regex)) {
|
||||
return self::luhn($check, $deep);
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ class Validation {
|
|||
}
|
||||
break;
|
||||
default:
|
||||
self::$errors[] = __d('cake_dev', 'You must define the $operator parameter for Validation::comparison()');
|
||||
self::$errors[] = __d('cake_dev', 'You must define the $operator parameter for %s', 'Validation::comparison()');
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -272,7 +272,7 @@ class Validation {
|
|||
extract(self::_defaults($check));
|
||||
}
|
||||
if ($regex === null) {
|
||||
self::$errors[] = __d('cake_dev', 'You must define a regular expression for Validation::custom()');
|
||||
self::$errors[] = __d('cake_dev', 'You must define a regular expression for %s', 'Validation::custom()');
|
||||
return false;
|
||||
}
|
||||
return self::_check($check, $regex);
|
||||
|
@ -297,7 +297,7 @@ class Validation {
|
|||
* @return boolean Success
|
||||
*/
|
||||
public static function date($check, $format = 'ymd', $regex = null) {
|
||||
if (!is_null($regex)) {
|
||||
if ($regex !== null) {
|
||||
return self::_check($check, $regex);
|
||||
}
|
||||
|
||||
|
@ -390,7 +390,7 @@ class Validation {
|
|||
* @return boolean Success
|
||||
*/
|
||||
public static function decimal($check, $places = null, $regex = null) {
|
||||
if (is_null($regex)) {
|
||||
if ($regex === null) {
|
||||
$lnum = '[0-9]+';
|
||||
$dnum = "[0-9]*[\.]{$lnum}";
|
||||
$sign = '[+-]?';
|
||||
|
@ -430,7 +430,7 @@ class Validation {
|
|||
extract(self::_defaults($check));
|
||||
}
|
||||
|
||||
if (is_null($regex)) {
|
||||
if ($regex === null) {
|
||||
$regex = '/^[a-z0-9!#$%&\'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&\'*+\/=?^_`{|}~-]+)*@' . self::$_pattern['hostname'] . '$/i';
|
||||
}
|
||||
$return = self::_check($check, $regex);
|
||||
|
@ -612,7 +612,7 @@ class Validation {
|
|||
extract(self::_defaults($check));
|
||||
}
|
||||
|
||||
if (is_null($regex)) {
|
||||
if ($regex === null) {
|
||||
switch ($country) {
|
||||
case 'us':
|
||||
case 'ca':
|
||||
|
@ -649,7 +649,7 @@ class Validation {
|
|||
extract(self::_defaults($check));
|
||||
}
|
||||
|
||||
if (is_null($regex)) {
|
||||
if ($regex === null) {
|
||||
switch ($country) {
|
||||
case 'uk':
|
||||
$regex = '/\\A\\b[A-Z]{1,2}[0-9][A-Z0-9]? [0-9][ABD-HJLNP-UW-Z]{2}\\b\\z/i';
|
||||
|
@ -710,7 +710,7 @@ class Validation {
|
|||
extract(self::_defaults($check));
|
||||
}
|
||||
|
||||
if (is_null($regex)) {
|
||||
if ($regex === null) {
|
||||
switch ($country) {
|
||||
case 'dk':
|
||||
$regex = '/\\A\\b[0-9]{6}-[0-9]{4}\\b\\z/i';
|
||||
|
|
|
@ -315,7 +315,7 @@ class Xml {
|
|||
}
|
||||
|
||||
$child = $dom->createElement($key);
|
||||
if (!is_null($childValue)) {
|
||||
if ($childValue !== null) {
|
||||
$child->appendChild($dom->createTextNode($childValue));
|
||||
}
|
||||
if ($childNS) {
|
||||
|
|
|
@ -2884,7 +2884,7 @@ class FormHelper extends AppHelper {
|
|||
* @return array inputDefaults
|
||||
*/
|
||||
public function inputDefaults($defaults = null, $merge = false) {
|
||||
if (!is_null($defaults)) {
|
||||
if ($defaults !== null) {
|
||||
if ($merge) {
|
||||
$this->_inputDefaults = array_merge($this->_inputDefaults, (array)$defaults);
|
||||
} else {
|
||||
|
|
|
@ -308,7 +308,7 @@ class MootoolsEngineHelper extends JsBaseEngineHelper {
|
|||
public function drop($options = array()) {
|
||||
if (empty($options['drag'])) {
|
||||
trigger_error(
|
||||
__d('cake_dev', 'MootoolsEngine::drop() requires a "drag" option to properly function'), E_USER_WARNING
|
||||
__d('cake_dev', '%s requires a "drag" option to properly function'), 'MootoolsEngine::drop()', E_USER_WARNING
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ class PaginatorHelper extends AppHelper {
|
|||
$classname = $ajaxProvider . 'Helper';
|
||||
if (!class_exists($classname) || !method_exists($classname, 'link')) {
|
||||
throw new CakeException(
|
||||
__d('cake_dev', '%s does not implement a link() method, it is incompatible with PaginatorHelper', $classname)
|
||||
__d('cake_dev', '%s does not implement a %s method, it is incompatible with %s', $classname, 'link()', 'PaginatorHelper')
|
||||
);
|
||||
}
|
||||
parent::__construct($View, $settings);
|
||||
|
|
|
@ -260,7 +260,7 @@ class RssHelper extends AppHelper {
|
|||
default:
|
||||
$attrib = $att;
|
||||
}
|
||||
if (!is_null($val) && $escape) {
|
||||
if ($val !== null && $escape) {
|
||||
$val = h($val);
|
||||
}
|
||||
$elements[$key] = $this->elem($key, $attrib, $val);
|
||||
|
|
|
@ -58,7 +58,7 @@ class ScaffoldView extends View {
|
|||
|
||||
$scaffoldAction = 'scaffold.' . $name;
|
||||
|
||||
if (!is_null($this->subDir)) {
|
||||
if ($this->subDir !== null) {
|
||||
$subDir = strtolower($this->subDir) . DS;
|
||||
} else {
|
||||
$subDir = null;
|
||||
|
|
|
@ -972,7 +972,7 @@ class View extends Object {
|
|||
protected function _getViewFileName($name = null) {
|
||||
$subDir = null;
|
||||
|
||||
if (!is_null($this->subDir)) {
|
||||
if ($this->subDir !== null) {
|
||||
$subDir = $this->subDir . DS;
|
||||
}
|
||||
|
||||
|
@ -1054,7 +1054,7 @@ class View extends Object {
|
|||
}
|
||||
$subDir = null;
|
||||
|
||||
if (!is_null($this->layoutPath)) {
|
||||
if ($this->layoutPath !== null) {
|
||||
$subDir = $this->layoutPath . DS;
|
||||
}
|
||||
list($plugin, $name) = $this->pluginSplit($name);
|
||||
|
|
Loading…
Reference in a new issue