mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fix more coding standards problems.
This commit is contained in:
parent
c2f42343a3
commit
664b0538b8
11 changed files with 86 additions and 68 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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')))
|
||||
);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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':
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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'));
|
||||
|
|
Loading…
Reference in a new issue