diff --git a/lib/Cake/Console/Command/Task/ProjectTask.php b/lib/Cake/Console/Command/Task/ProjectTask.php index f5454fb54..6a3de9506 100644 --- a/lib/Cake/Console/Command/Task/ProjectTask.php +++ b/lib/Cake/Console/Command/Task/ProjectTask.php @@ -111,7 +111,7 @@ class ProjectTask extends AppShell { $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)); } else { - $this->err(__d('cake_console', 'Unable to set CAKE_CORE_INCLUDE_PATH, you should change it in %s', $path . 'webroot' . DS .'index.php')); + $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; } if ($success && $hardCode) { @@ -120,8 +120,8 @@ class ProjectTask extends AppShell { $Folder = new Folder($path); if (!$Folder->chmod($path . 'tmp', 0777)) { - $this->err(__d('cake_console', 'Could not set permissions on %s', $path . DS .'tmp')); - $this->out(__d('cake_console', 'chmod -R 0777 %s', $path . DS .'tmp')); + $this->err(__d('cake_console', 'Could not set permissions on %s', $path . DS . 'tmp')); + $this->out(__d('cake_console', 'chmod -R 0777 %s', $path . DS . 'tmp')); $success = false; } if ($success) { @@ -229,7 +229,7 @@ class ProjectTask extends AppShell { public function createHome($dir) { $app = basename($dir); $path = $dir . 'View' . DS . 'Pages' . DS; - $source = CAKE . 'Console' . DS . 'Templates' . DS .'default' . DS . 'views' . DS . 'home.ctp'; + $source = CAKE . 'Console' . DS . 'Templates' . DS . 'default' . DS . 'views' . DS . 'home.ctp'; include $source; return $this->createFile($path . 'home.ctp', $output); } diff --git a/lib/Cake/Console/Templates/skel/webroot/index.php b/lib/Cake/Console/Templates/skel/webroot/index.php index 2435ae184..f9a46f6e2 100644 --- a/lib/Cake/Console/Templates/skel/webroot/index.php +++ b/lib/Cake/Console/Templates/skel/webroot/index.php @@ -21,9 +21,9 @@ /** * Use the DS to separate the directories in other defines */ - if (!defined('DS')) { - define('DS', DIRECTORY_SEPARATOR); - } +if (!defined('DS')) { + define('DS', DIRECTORY_SEPARATOR); +} /** * These defines should only be edited if you have cake installed in @@ -35,17 +35,17 @@ * The full path to the directory which holds "app", WITHOUT a trailing DS. * */ - if (!defined('ROOT')) { - define('ROOT', dirname(dirname(dirname(__FILE__)))); - } +if (!defined('ROOT')) { + define('ROOT', dirname(dirname(dirname(__FILE__)))); +} /** * The actual directory name for the "app". * */ - if (!defined('APP_DIR')) { - define('APP_DIR', basename(dirname(dirname(__FILE__)))); - } +if (!defined('APP_DIR')) { + define('APP_DIR', basename(dirname(dirname(__FILE__)))); +} /** * The absolute path to the "cake" directory, WITHOUT a trailing DS. @@ -58,41 +58,44 @@ * * Leaving this constant undefined will result in it being defined in Cake/bootstrap.php */ - //define('CAKE_CORE_INCLUDE_PATH', __CAKE_PATH__); +//define('CAKE_CORE_INCLUDE_PATH', __CAKE_PATH__); /** * Editing below this line should NOT be necessary. * Change at your own risk. * */ - if (!defined('WEBROOT_DIR')) { - define('WEBROOT_DIR', basename(dirname(__FILE__))); - } - if (!defined('WWW_ROOT')) { - define('WWW_ROOT', dirname(__FILE__) . DS); - } +if (!defined('WEBROOT_DIR')) { + define('WEBROOT_DIR', basename(dirname(__FILE__))); +} +if (!defined('WWW_ROOT')) { + define('WWW_ROOT', dirname(__FILE__) . DS); +} - if (!defined('CAKE_CORE_INCLUDE_PATH')) { - if (function_exists('ini_set')) { - ini_set('include_path', ROOT . DS . 'lib' . PATH_SEPARATOR . ini_get('include_path')); - } - if (!include('Cake' . DS . 'bootstrap.php')) { - $failed = true; - } - } else { - if (!include(CAKE_CORE_INCLUDE_PATH . DS . 'Cake' . DS . 'bootstrap.php')) { - $failed = true; - } +if (!defined('CAKE_CORE_INCLUDE_PATH')) { + if (function_exists('ini_set')) { + ini_set('include_path', ROOT . DS . 'lib' . PATH_SEPARATOR . ini_get('include_path')); } - if (!empty($failed)) { - trigger_error("CakePHP core could not be found. Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php. It should point to the directory containing your " . DS . "cake core directory and your " . DS . "vendors root directory.", E_USER_ERROR); + if (!include 'Cake' . DS . 'bootstrap.php') { + $failed = true; } - - if (isset($_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO'] == '/favicon.ico') { - return; +} else { + if (!include CAKE_CORE_INCLUDE_PATH . DS . 'Cake' . DS . 'bootstrap.php') { + $failed = true; } +} +if (!empty($failed)) { + trigger_error("CakePHP core could not be found. Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php. It should point to the directory containing your " . DS . "cake core directory and your " . DS . "vendors root directory.", E_USER_ERROR); +} - App::uses('Dispatcher', 'Routing'); +if (isset($_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO'] == '/favicon.ico') { + return; +} - $Dispatcher = new Dispatcher(); - $Dispatcher->dispatch(new CakeRequest(), new CakeResponse(array('charset' => Configure::read('App.encoding')))); +App::uses('Dispatcher', 'Routing'); + +$Dispatcher = new Dispatcher(); +$Dispatcher->dispatch( + new CakeRequest(), + new CakeResponse(array('charset' => Configure::read('App.encoding'))) +); diff --git a/lib/Cake/Console/Templates/skel/webroot/test.php b/lib/Cake/Console/Templates/skel/webroot/test.php index 670e2ed44..bb07101ad 100644 --- a/lib/Cake/Console/Templates/skel/webroot/test.php +++ b/lib/Cake/Console/Templates/skel/webroot/test.php @@ -21,9 +21,9 @@ ini_set('display_errors', 1); /** * Use the DS to separate the directories in other defines */ - if (!defined('DS')) { - define('DS', DIRECTORY_SEPARATOR); - } +if (!defined('DS')) { + define('DS', DIRECTORY_SEPARATOR); +} /** * These defines should only be edited if you have cake installed in @@ -35,17 +35,17 @@ ini_set('display_errors', 1); * The full path to the directory which holds "app", WITHOUT a trailing DS. * */ - if (!defined('ROOT')) { - define('ROOT', dirname(dirname(dirname(__FILE__)))); - } +if (!defined('ROOT')) { + define('ROOT', dirname(dirname(dirname(__FILE__)))); +} /** * The actual directory name for the "app". * */ - if (!defined('APP_DIR')) { - define('APP_DIR', basename(dirname(dirname(__FILE__)))); - } +if (!defined('APP_DIR')) { + define('APP_DIR', basename(dirname(dirname(__FILE__)))); +} /** * The absolute path to the "Cake" directory, WITHOUT a trailing DS. @@ -55,7 +55,7 @@ ini_set('display_errors', 1); * * Leaving this constant undefined will result in it being defined in Cake/bootstrap.php */ - //define('CAKE_CORE_INCLUDE_PATH', __CAKE_PATH__); +//define('CAKE_CORE_INCLUDE_PATH', __CAKE_PATH__); /** * Editing below this line should not be necessary. @@ -73,11 +73,11 @@ if (!defined('CAKE_CORE_INCLUDE_PATH')) { if (function_exists('ini_set')) { ini_set('include_path', ROOT . DS . 'lib' . PATH_SEPARATOR . ini_get('include_path')); } - if (!include('Cake' . DS . 'bootstrap.php')) { + if (!include 'Cake' . DS . 'bootstrap.php') { $failed = true; } } else { - if (!include(CAKE_CORE_INCLUDE_PATH . DS . 'Cake' . DS . 'bootstrap.php')) { + if (!include CAKE_CORE_INCLUDE_PATH . DS . 'Cake' . DS . 'bootstrap.php') { $failed = true; } } diff --git a/lib/Cake/I18n/I18n.php b/lib/Cake/I18n/I18n.php index 13eeddd2a..9d2a4ffce 100644 --- a/lib/Cake/I18n/I18n.php +++ b/lib/Cake/I18n/I18n.php @@ -404,6 +404,8 @@ class I18n { public static function loadMo($filename) { $translations = false; + // @codingStandardsIgnoreStart + // Binary files extracted makes non-standard local variables if ($data = file_get_contents($filename)) { $translations = array(); $header = substr($data, 0, 20); @@ -433,6 +435,7 @@ class I18n { } } } + // @codingStandardsIgnoreEnd return $translations; } diff --git a/lib/Cake/Model/Datasource/Database/Mysql.php b/lib/Cake/Model/Datasource/Database/Mysql.php index 2cdcfda55..cc3f5860c 100644 --- a/lib/Cake/Model/Datasource/Database/Mysql.php +++ b/lib/Cake/Model/Datasource/Database/Mysql.php @@ -442,6 +442,8 @@ class Mysql extends DboSource { $old = version_compare($this->getVersion(), '4.1', '<='); if ($table) { $indices = $this->_execute('SHOW INDEX FROM ' . $table); + // @codingStandardsIgnoreStart + // MySQL columns don't match the cakephp conventions. while ($idx = $indices->fetch(PDO::FETCH_OBJ)) { if ($old) { $idx = (object)current((array)$idx); @@ -458,6 +460,7 @@ class Mysql extends DboSource { $index[$idx->Key_name]['column'] = $col; } } + // @codingStandardsIgnoreEnd $indices->closeCursor(); } return $index; diff --git a/lib/Cake/Model/Datasource/Database/Postgres.php b/lib/Cake/Model/Datasource/Database/Postgres.php index 48535be68..0bc35d5c1 100644 --- a/lib/Cake/Model/Datasource/Database/Postgres.php +++ b/lib/Cake/Model/Datasource/Database/Postgres.php @@ -200,6 +200,8 @@ class Postgres extends DboSource { array($table, $this->config['schema']) ); + // @codingStandardsIgnoreStart + // Postgres columns don't match the coding standards. foreach ($cols as $c) { $type = $c->type; if (!empty($c->oct_length) && $c->char_length === null) { @@ -257,6 +259,8 @@ class Postgres extends DboSource { } $this->_cacheDescription($table, $fields); } + // @codingStandardsIgnoreEnd + if (isset($model->sequence)) { $this->_sequenceMap[$table][$model->primaryKey] = $model->sequence; } diff --git a/lib/Cake/Model/Model.php b/lib/Cake/Model/Model.php index 7f316c9e9..c1df07e1d 100644 --- a/lib/Cake/Model/Model.php +++ b/lib/Cake/Model/Model.php @@ -2833,7 +2833,7 @@ class Model extends Object implements CakeEventListener { $field = $this->alias . '.' . $this->primaryKey; $value = $this->id; } - $query['conditions'] = array_merge($conditions, array($field . ' <' => $value)); + $query['conditions'] = array_merge($conditions, array($field . ' <' => $value)); $query['order'] = $field . ' DESC'; $query['limit'] = 1; $query['field'] = $field; diff --git a/lib/Cake/Utility/Set.php b/lib/Cake/Utility/Set.php index 8618317a3..fb296c7f3 100644 --- a/lib/Cake/Utility/Set.php +++ b/lib/Cake/Utility/Set.php @@ -175,9 +175,11 @@ class Set { } } elseif (is_array($value)) { if ($primary === true) { + // @codingStandardsIgnoreStart Legacy junk if (!isset($out->_name_)) { $out->_name_ = $key; } + // @codingStandardsIgnoreEnd $primary = false; foreach ($value as $key2 => $value2) { $out->{$key2} = Set::_map($value2, true); @@ -975,11 +977,13 @@ class Set { if (is_array($value)) { $new[$key] = (array)Set::reverse($value); } else { + // @codingStandardsIgnoreStart Legacy junk if (isset($value->_name_)) { $new = array_merge($new, Set::reverse($value)); } else { $new[$key] = Set::reverse($value); - } + } + // @codingStandardsIgnoreEnd } } if (isset($identity)) { diff --git a/lib/Cake/View/Helper/JqueryEngineHelper.php b/lib/Cake/View/Helper/JqueryEngineHelper.php index a05772294..850bd72d8 100644 --- a/lib/Cake/View/Helper/JqueryEngineHelper.php +++ b/lib/Cake/View/Helper/JqueryEngineHelper.php @@ -229,7 +229,7 @@ class JqueryEngineHelper extends JsBaseEngineHelper { $name = ($name == 'slideIn') ? 'slideDown' : 'slideUp'; case 'hide': case 'show': - case 'fadeIn': + case 'fadeIn': case 'fadeOut': case 'slideDown': case 'slideUp': diff --git a/lib/Cake/basics.php b/lib/Cake/basics.php index 009fba11b..df1a4c020 100644 --- a/lib/Cake/basics.php +++ b/lib/Cake/basics.php @@ -44,7 +44,7 @@ function config() { $args = func_get_args(); foreach ($args as $arg) { if (file_exists(APP . 'Config' . DS . $arg . '.php')) { - include_once(APP . 'Config' . DS . $arg . '.php'); + include_once APP . 'Config' . DS . $arg . '.php'; if (count($args) == 1) { return true; @@ -118,16 +118,16 @@ TEXT; if (!function_exists('sortByKey')) { - /** - * Sorts given $array by key $sortby. - * - * @param array $array Array to sort - * @param string $sortby Sort by this key - * @param string $order Sort order asc/desc (ascending or descending). - * @param integer $type Type of sorting to perform - * @return mixed Sorted array - * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#sortByKey - */ +/** + * Sorts given $array by key $sortby. + * + * @param array $array Array to sort + * @param string $sortby Sort by this key + * @param string $order Sort order asc/desc (ascending or descending). + * @param integer $type Type of sorting to perform + * @return mixed Sorted array + * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#sortByKey + */ function sortByKey(&$array, $sortby, $order = 'asc', $type = SORT_NUMERIC) { if (!is_array($array)) { return null; @@ -170,7 +170,7 @@ function h($text, $double = true, $charset = null) { return $texts; } elseif (is_object($text)) { if (method_exists($text, '__toString')) { - $text = (string) $text; + $text = (string)$text; } else { $text = '(object)' . get_class($text); } @@ -752,3 +752,4 @@ function convertSlash($string) { $string = str_replace('/', '_', $string); return $string; } + diff --git a/lib/Cake/bootstrap.php b/lib/Cake/bootstrap.php index f34b4001e..193f36ca7 100644 --- a/lib/Cake/bootstrap.php +++ b/lib/Cake/bootstrap.php @@ -50,7 +50,7 @@ if (!defined('WEBROOT_DIR')) { * Path to the application's directory. */ if (!defined('APP')) { - define('APP', ROOT . DS . APP_DIR.DS); + define('APP', ROOT . DS . APP_DIR . DS); } /** @@ -127,7 +127,7 @@ if (!defined('JS_URL')) { require CAKE . 'basics.php'; -require CAKE . 'Core' . DS .'App.php'; +require CAKE . 'Core' . DS . 'App.php'; require CAKE . 'Error' . DS . 'exceptions.php'; spl_autoload_register(array('App', 'load'));