From dac1bd0913074b967db5ac3834d181b7f27ae45a Mon Sep 17 00:00:00 2001 From: phpnut Date: Wed, 20 Jun 2007 07:51:52 +0000 Subject: [PATCH] Correcting code structure to standards git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5315 3807eeeb-6ff5-0310-8944-8be069107fe0 --- app/webroot/test.php | 2 +- cake/basics.php | 34 +++++++++---------- cake/console/libs/acl.php | 2 +- cake/console/libs/api.php | 2 +- cake/console/libs/extract.php | 10 +++--- cake/console/libs/shell.php | 6 ++-- cake/console/libs/tasks/controller.php | 2 +- cake/console/libs/tasks/project.php | 18 +++++----- cake/console/libs/tasks/view.php | 2 +- .../libs/templates/skel/webroot/test.php | 2 +- cake/console/libs/templates/views/form.ctp | 2 +- cake/dispatcher.php | 2 +- cake/libs/class_registry.php | 4 +-- cake/libs/configure.php | 32 ++++++++--------- cake/libs/controller/components/cookie.php | 34 +++++++++---------- cake/libs/controller/components/email.php | 32 ++++++++--------- cake/libs/controller/components/security.php | 2 +- cake/libs/controller/controller.php | 8 ++--- cake/libs/controller/scaffold.php | 4 +-- cake/libs/i18n.php | 2 +- cake/libs/l10n.php | 2 +- cake/libs/model/datasources/datasource.php | 4 +-- .../model/datasources/dbo/dbo_firebird.php | 2 +- .../model/datasources/dbo/dbo_postgres.php | 2 +- cake/libs/model/datasources/dbo_source.php | 24 ++++++------- cake/libs/model/model.php | 2 +- cake/libs/object.php | 2 +- cake/libs/set.php | 2 +- cake/libs/validation.php | 20 +++++------ cake/libs/view/helper.php | 8 ++--- cake/libs/view/helpers/ajax.php | 8 ++--- cake/libs/view/helpers/cache.php | 2 +- cake/libs/view/helpers/form.php | 4 +-- cake/libs/view/helpers/html.php | 8 ++--- cake/libs/view/helpers/javascript.php | 8 ++--- cake/libs/view/templates/scaffolds/edit.ctp | 2 +- cake/libs/view/theme.php | 2 +- cake/libs/view/view.php | 2 +- .../model/datasources/dbo_source.test.php | 2 +- cake/tests/cases/libs/validation.test.php | 14 ++++---- .../cases/libs/view/helpers/ajax.test.php | 14 ++++---- cake/tests/lib/test_manager.php | 2 +- 42 files changed, 169 insertions(+), 169 deletions(-) diff --git a/app/webroot/test.php b/app/webroot/test.php index e3861086f..4ce4e70ad 100644 --- a/app/webroot/test.php +++ b/app/webroot/test.php @@ -74,7 +74,7 @@ if (empty( $_GET['output'])) { $_GET['output'] = 'html'; } -if (!defined('BASE_URL')){ +if (!defined('BASE_URL')) { $dispatch =& new Dispatcher(); define('BASE_URL', $dispatch->baseUrl()); } diff --git a/cake/basics.php b/cake/basics.php index 9aaf4b699..73bef7d7e 100644 --- a/cake/basics.php +++ b/cake/basics.php @@ -50,7 +50,7 @@ * Loads all models. */ function loadModels() { - if (!class_exists('Model')){ + if (!class_exists('Model')) { require LIBS . 'model' . DS . 'model.php'; } $path = Configure::getInstance(); @@ -86,7 +86,7 @@ * @deprecated */ function loadPluginModels($plugin) { - if (!class_exists('AppModel')){ + if (!class_exists('AppModel')) { loadModel(); } @@ -120,7 +120,7 @@ * @return boolean Success */ function loadView($viewClass) { - if (strpos($viewClass, '.') !== false){ + if (strpos($viewClass, '.') !== false) { list($plugin, $viewClass) = explode('.', $viewClass); $file = APP . 'plugins' . DS . Inflector::underscore($plugin) . DS . 'views' . DS . Inflector::underscore($viewClass) . '.php'; if (file_exists($file)) { @@ -159,7 +159,7 @@ * @return boolean Success */ function loadModel($name = null) { - if (!class_exists('Model')){ + if (!class_exists('Model')) { require LIBS . 'model' . DS . 'model.php'; } if (!class_exists('AppModel')) { @@ -171,7 +171,7 @@ Overloadable::overload('AppModel'); } - if (strpos($name, '.') !== false){ + if (strpos($name, '.') !== false) { list($plugin, $name) = explode('.', $name); $pluginAppModel = Inflector::camelize($plugin . '_app_model'); @@ -234,7 +234,7 @@ * * @return array Array of paths indexed by type */ - function paths(){ + function paths() { $directories = Configure::getInstance(); $paths = array(); @@ -254,7 +254,7 @@ $paths['Helpers'][] = $path; } - if (!class_exists('Folder')){ + if (!class_exists('Folder')) { uses('Folder'); } @@ -262,9 +262,9 @@ $plugins = $folder->ls(); $classPaths = array('models', 'models'.DS.'behaviors', 'controllers', 'controllers'.DS.'components', 'views'.DS.'helpers'); - foreach ($plugins[0] as $plugin){ - foreach ($classPaths as $path){ - if (strpos($path, DS) !== false){ + foreach ($plugins[0] as $plugin) { + foreach ($classPaths as $path) { + if (strpos($path, DS) !== false) { $key = explode(DS, $path); $key = $key[1]; } else { @@ -320,7 +320,7 @@ if ($name === null) { return true; } - if (strpos($name, '.') !== false){ + if (strpos($name, '.') !== false) { list($plugin, $name) = explode('.', $name); $pluginAppController = Inflector::camelize($plugin . '_app_controller'); @@ -351,7 +351,7 @@ if (file_exists($file)) { require($file); return true; - } elseif (!class_exists(Inflector::camelize($plugin) . 'Controller')){ + } elseif (!class_exists(Inflector::camelize($plugin) . 'Controller')) { if (file_exists(APP . 'plugins' . DS . $plugin . DS . 'controllers' . DS . $plugin . '_controller.php')) { require(APP . 'plugins' . DS . $plugin . DS . 'controllers' . DS . $plugin . '_controller.php'); return true; @@ -434,7 +434,7 @@ if (file_exists($file)) { require($file); return true; - } elseif (!class_exists(Inflector::camelize($plugin) . 'Controller')){ + } elseif (!class_exists(Inflector::camelize($plugin) . 'Controller')) { if (file_exists(APP . 'plugins' . DS . $plugin . DS . 'controllers' . DS . $plugin . '_controller.php')) { require(APP . 'plugins' . DS . $plugin . DS . 'controllers' . DS . $plugin . '_controller.php'); return true; @@ -464,7 +464,7 @@ if ($name === null) { return true; } - if (strpos($name, '.') !== false){ + if (strpos($name, '.') !== false) { list($plugin, $name) = explode('.', $name); } @@ -538,7 +538,7 @@ return true; } - if (strpos($name, '.') !== false){ + if (strpos($name, '.') !== false) { list($plugin, $name) = explode('.', $name); } @@ -609,7 +609,7 @@ if ($name === null) { return true; } - if (strpos($name, '.') !== false){ + if (strpos($name, '.') !== false) { list($plugin, $name) = explode('.', $name); } @@ -712,7 +712,7 @@ for ($i = 0; $i < $c; $i++) { $arg = $args[$i]; - if (strpos($arg, '.') !== false){ + if (strpos($arg, '.') !== false) { $file = explode('.', $arg); $plugin = Inflector::underscore($file[0]); unset($file[0]); diff --git a/cake/console/libs/acl.php b/cake/console/libs/acl.php index 6e54b4ee2..0ead98c90 100644 --- a/cake/console/libs/acl.php +++ b/cake/console/libs/acl.php @@ -199,7 +199,7 @@ class AclShell extends Shell { $this->_checkArgs(3, 'setParent'); $this->checkNodeType(); extract($this->__dataVars()); - if (!$this->Acl->{$class}->setParent($this->args[2], $this->args[1])){ + if (!$this->Acl->{$class}->setParent($this->args[2], $this->args[1])) { $this->out(__("Error in setting new parent. Please make sure the parent node exists, and is not a descendant of the node specified.", true), true); } else { $this->out(sprintf(__("Node parent set to %s", true), $this->args[2]) . "\n", true); diff --git a/cake/console/libs/api.php b/cake/console/libs/api.php index 62862dc91..f14136888 100644 --- a/cake/console/libs/api.php +++ b/cake/console/libs/api.php @@ -79,7 +79,7 @@ class ApiShell extends Shell { if (!preg_match('/' . Inflector::camelize($path) . '$/', $class)) { $class .= Inflector::camelize($path); } - } elseif (low($path) === low($class)){ + } elseif (low($path) === low($class)) { $class = Inflector::camelize($path); } diff --git a/cake/console/libs/extract.php b/cake/console/libs/extract.php index 22deb6665..97eb87726 100644 --- a/cake/console/libs/extract.php +++ b/cake/console/libs/extract.php @@ -69,7 +69,7 @@ class ExtractShell extends Shell{ var $__output = null; function initialize() { - if (isset($this->params['files']) && !is_array($this->params['files'])){ + if (isset($this->params['files']) && !is_array($this->params['files'])) { $this->files = explode(',', $this->params['files']); } @@ -90,7 +90,7 @@ class ExtractShell extends Shell{ $this->__output = APP . 'locale' . DS; } - if (empty($this->files)){ + if (empty($this->files)) { $this->files = $this->__searchDirectory(); } } @@ -142,7 +142,7 @@ class ExtractShell extends Shell{ $this->out(' -debug: Perform self test.'); $this->out(''); } - function __extractTokens(){ + function __extractTokens() { foreach ($this->files as $file) { $this->__file = $file; $this->out("Processing $file..."); @@ -400,7 +400,7 @@ class ExtractShell extends Shell{ fclose($fp); } } - function __mergeFiles($output){ + function __mergeFiles($output) { foreach ($output as $file => $content) { if (count($content) <= 1 && $file != $this->__filename) { @$output[$this->__filename][1] = array_unique(array_merge($output[$this->__filename][1], $content[1])); @@ -479,7 +479,7 @@ class ExtractShell extends Shell{ $this->out("\n", true); } function __searchDirectory($path = null) { - if ($path === null){ + if ($path === null) { $path = $this->path .DS; } $files = glob("$path*.{php,ctp,thtml,inc,tpl}", GLOB_BRACE); diff --git a/cake/console/libs/shell.php b/cake/console/libs/shell.php index e77e32a27..e174d61b8 100644 --- a/cake/console/libs/shell.php +++ b/cake/console/libs/shell.php @@ -115,7 +115,7 @@ class Shell extends Object { function __construct(&$dispatch) { $vars = array('params', 'args', 'shell', 'shellName'=> 'name', 'shellClass'=> 'className', 'shellCommand'=> 'command'); foreach ($vars as $key => $var) { - if (is_string($key)){ + if (is_string($key)) { $this->{$var} =& $dispatch->{$key}; } else { $this->{$var} =& $dispatch->{$var}; @@ -210,7 +210,7 @@ class Shell extends Object { foreach ($uses as $modelClass) { $modelKey = Inflector::underscore($modelClass); - if (!class_exists($modelClass)){ + if (!class_exists($modelClass)) { loadModel($modelClass); } if (class_exists($modelClass)) { @@ -416,7 +416,7 @@ class Shell extends Object { function help() { if ($this->command != null) { $this->err("Unknown {$this->name} command '$this->command'.\nFor usage, try 'cake {$this->shell} help'.\n\n"); - } else{ + } else { $this->Dispatch->help(); } } diff --git a/cake/console/libs/tasks/controller.php b/cake/console/libs/tasks/controller.php index 414418475..e60156ac7 100644 --- a/cake/console/libs/tasks/controller.php +++ b/cake/console/libs/tasks/controller.php @@ -545,7 +545,7 @@ class ControllerTask extends Shell { while ($admin == '') { $admin = $this->in("What would you like the admin route to be?", null, 'admin'); } - if ($this->Project->cakeAdmin($admin) !== true){ + if ($this->Project->cakeAdmin($admin) !== true) { $this->out('Unable to write to /app/config/core.php.'); $this->out('You need to enable CAKE_ADMIN in /app/config/core.php to use admin routing.'); exit(); diff --git a/cake/console/libs/tasks/project.php b/cake/console/libs/tasks/project.php index e9bb9c796..5a6dfdb01 100644 --- a/cake/console/libs/tasks/project.php +++ b/cake/console/libs/tasks/project.php @@ -150,16 +150,16 @@ class ProjectTask extends Shell { $this->out('The Welcome page was NOT created'); } - if ($this->cakeSessionString($path) === true ){ + if ($this->cakeSessionString($path) === true ) { $this->out('Random hash key created for CAKE_SESSION_STRING'); } else { $this->err('Unable to generate random hash for CAKE_SESSION_STRING, please change this yourself in ' . CONFIGS . 'core.php'); } $corePath = $this->corePath($path); - if ($corePath === true ){ + if ($corePath === true ) { $this->out('CAKE_CORE_INCLUDE_PATH set to ' . CAKE_CORE_INCLUDE_PATH); - } elseif ($corePath === false){ + } elseif ($corePath === false) { $this->err('Unable to to set CAKE_CORE_INCLUDE_PATH, please change this yourself in ' . $path . 'webroot' .DS .'index.php'); } @@ -200,14 +200,14 @@ class ProjectTask extends Shell { * * @return bool */ - function cakeSessionString($path){ + function cakeSessionString($path) { $File =& new File($path . 'config' . DS . 'core.php'); $contents = $File->read(); if (preg_match('/([\\t\\x20]*define\\(\\\'CAKE_SESSION_STRING\\\',[\\t\\x20\'A-z0-9]*\\);)/', $contents, $match)) { uses('Security'); $string = Security::generateAuthKey(); $result = str_replace($match[0], 'define(\'CAKE_SESSION_STRING\', \''.$string.'\');', $contents); - if ($File->write($result)){ + if ($File->write($result)) { return true; } else { return false; @@ -221,13 +221,13 @@ class ProjectTask extends Shell { * * @return bool */ - function corePath($path){ + function corePath($path) { if (dirname($path) !== CAKE_CORE_INCLUDE_PATH) { $File =& new File($path . 'webroot' . DS . 'index.php'); $contents = $File->read(); if (preg_match('/([\\t\\x20]*define\\(\\\'CAKE_CORE_INCLUDE_PATH\\\',[\\t\\x20\'A-z0-9]*\\);)/', $contents, $match)) { $result = str_replace($match[0], "\t\tdefine('CAKE_CORE_INCLUDE_PATH', '".CAKE_CORE_INCLUDE_PATH."');", $contents); - if ($File->write($result)){ + if ($File->write($result)) { return true; } else { return false; @@ -242,12 +242,12 @@ class ProjectTask extends Shell { * * @return bool */ - function cakeAdmin($name){ + function cakeAdmin($name) { $File =& new File($path . 'webroot' . DS . 'index.php'); $contents = $File->read(); if (preg_match('%([/\\t\\x20]*define\\(\'CAKE_ADMIN\',[\\t\\x20\'a-z]*\\);)%', $contents, $match)) { $result = str_replace($match[0], 'define(\'CAKE_ADMIN\', \''.$name.'\');', $contents); - if ($File->write($result)){ + if ($File->write($result)) { return true; } else { return false; diff --git a/cake/console/libs/tasks/view.php b/cake/console/libs/tasks/view.php index 371ba65b4..4dbb9c002 100644 --- a/cake/console/libs/tasks/view.php +++ b/cake/console/libs/tasks/view.php @@ -162,7 +162,7 @@ class ViewTask extends Shell { while ($admin == '') { $admin = $this->in("What would you like the admin route to be?", null, 'admin'); } - if ($this->Project->cakeAdmin($admin) !== true){ + if ($this->Project->cakeAdmin($admin) !== true) { $this->err('Unable to write to /app/config/core.php.'); $this->err('You need to enable CAKE_ADMIN in /app/config/core.php to use admin routing.'); exit(); diff --git a/cake/console/libs/templates/skel/webroot/test.php b/cake/console/libs/templates/skel/webroot/test.php index e3861086f..4ce4e70ad 100644 --- a/cake/console/libs/templates/skel/webroot/test.php +++ b/cake/console/libs/templates/skel/webroot/test.php @@ -74,7 +74,7 @@ if (empty( $_GET['output'])) { $_GET['output'] = 'html'; } -if (!defined('BASE_URL')){ +if (!defined('BASE_URL')) { $dispatch =& new Dispatcher(); define('BASE_URL', $dispatch->baseUrl()); } diff --git a/cake/console/libs/templates/views/form.ctp b/cake/console/libs/templates/views/form.ctp index 6bb2ff583..7451e7206 100644 --- a/cake/console/libs/templates/views/form.ctp +++ b/cake/console/libs/templates/views/form.ctp @@ -33,7 +33,7 @@ foreach ($fields as $field) { if ($action == 'add' && $field['name'] == $primaryKey) { continue; - } elseif (!in_array($field['name'], array('created', 'modified', 'updated'))){ + } elseif (!in_array($field['name'], array('created', 'modified', 'updated'))) { echo "\t\techo \$form->input('{$field['name']}');\n"; } } diff --git a/cake/dispatcher.php b/cake/dispatcher.php index 3aba33f50..45f6ef7fc 100644 --- a/cake/dispatcher.php +++ b/cake/dispatcher.php @@ -308,7 +308,7 @@ class Dispatcher extends Object { $controller->_initComponents(); $controller->constructClasses(); - if ($missingAction && !in_array('scaffold', array_keys($classVars))){ + if ($missingAction && !in_array('scaffold', array_keys($classVars))) { $this->start($controller); return $this->cakeError('missingAction', array( array( diff --git a/cake/libs/class_registry.php b/cake/libs/class_registry.php index 4a76826c7..9a871bb09 100644 --- a/cake/libs/class_registry.php +++ b/cake/libs/class_registry.php @@ -129,11 +129,11 @@ class ClassRegistry { $_this =& ClassRegistry::getInstance(); $key = Inflector::underscore($key); - if (isset($_this->__objects[$key])){ + if (isset($_this->__objects[$key])) { return $_this->__objects[$key]; } else { $key = $_this->__getMap($key); - if (isset($_this->__objects[$key])){ + if (isset($_this->__objects[$key])) { return $_this->__objects[$key]; } } diff --git a/cake/libs/configure.php b/cake/libs/configure.php index 567ccce66..e4425ab35 100644 --- a/cake/libs/configure.php +++ b/cake/libs/configure.php @@ -111,22 +111,22 @@ class Configure extends Object { * @param mixed $value Value to set for var * @access public */ - function write($config, $value = null){ + function write($config, $value = null) { $_this =& Configure::getInstance(); if (!is_array($config) && $value !== null) { $name = $_this->__configVarNames($config); - if (count($name) > 1){ + if (count($name) > 1) { $_this->{$name[0]}[$name[1]] = $value; } else { $_this->{$name[0]} = $value; } } else { - foreach ($config as $names => $value){ + foreach ($config as $names => $value) { $name = $_this->__configVarNames($names); - if (count($name) > 1){ + if (count($name) > 1) { $_this->{$name[0]}[$name[1]] = $value; } else { $_this->{$name[0]} = $value; @@ -166,17 +166,17 @@ class Configure extends Object { * @return string value of Configure::$var * @access public */ - function read($var = 'debug'){ + function read($var = 'debug') { $_this =& Configure::getInstance(); if ($var === 'debug') { - if (!isset($_this->debug)){ + if (!isset($_this->debug)) { $_this->debug = DEBUG; } return $_this->debug; } $name = $_this->__configVarNames($var); - if (count($name) > 1){ + if (count($name) > 1) { if (isset($_this->{$name[0]}[$name[1]])) { return $_this->{$name[0]}[$name[1]]; } @@ -198,11 +198,11 @@ class Configure extends Object { * @param string $var the var to be deleted * @access public */ - function delete($var = null){ + function delete($var = null) { $_this =& Configure::getInstance(); $name = $_this->__configVarNames($var); - if (count($name) > 1){ + if (count($name) > 1) { unset($_this->{$name[0]}[$name[1]]); } else { unset($_this->{$name[0]}); @@ -230,7 +230,7 @@ class Configure extends Object { return false; } - if (!isset($config)){ + if (!isset($config)) { trigger_error(sprintf(__("Configure::load() - no variable \$config found in %s.php", true), $fileName), E_USER_WARNING); return false; } @@ -268,9 +268,9 @@ class Configure extends Object { $content = ''; foreach ($data as $key => $value) { $content .= "\$config['$type']['$key']"; - if (is_array($value)){ + if (is_array($value)) { $content .= " = array("; - foreach ($value as $key1 => $value2){ + foreach ($value as $key1 => $value2) { $value2 = addslashes($value2); $content .= "'$key1' => '$value2', "; } @@ -294,7 +294,7 @@ class Configure extends Object { * @param boolean $write true if content should be written, false otherwise * @access private */ - function __writeConfig($content, $name, $write = true){ + function __writeConfig($content, $name, $write = true) { $file = CACHE . 'persistent' . DS . $name . '.php'; $_this =& Configure::getInstance(); if ($_this->read() > 0) { @@ -304,12 +304,12 @@ class Configure extends Object { } $cache = cache('persistent' . DS . $name . '.php', null, $expires); - if ($cache === null){ + if ($cache === null) { cache('persistent' . DS . $name . '.php', "cookieName)) { $this->name = $controller->cookieName; } - if (isset($controller->cookieTime)){ + if (isset($controller->cookieTime)) { $this->time = $controller->cookieTime; } - if (isset($controller->cookieKey)){ + if (isset($controller->cookieKey)) { $this->key = $controller->cookieKey; } if (isset($controller->cookiePath)) { @@ -214,7 +214,7 @@ class CookieComponent extends Object { * @access public */ function write($key, $value = null, $encrypt = true, $expires = null) { - if (is_null($encrypt)){ + if (is_null($encrypt)) { $encrypt = true; } @@ -224,7 +224,7 @@ class CookieComponent extends Object { if (!is_array($key) && $value !== null) { $name = $this->__cookieVarNames($key); - if (count($name) > 1){ + if (count($name) > 1) { $this->__values[$name[0]][$name[1]] = $value; $this->__write("[".$name[0]."][".$name[1]."]", $value); } else { @@ -232,10 +232,10 @@ class CookieComponent extends Object { $this->__write("[".$name[0]."]", $value); } } else { - foreach ($key as $names => $value){ + foreach ($key as $names => $value) { $name = $this->__cookieVarNames($names); - if (count($name) > 1){ + if (count($name) > 1) { $this->__values[$name[0]][$name[1]] = $value; $this->__write("[".$name[0]."][".$name[1]."]", $value); } else { @@ -260,12 +260,12 @@ class CookieComponent extends Object { $this->__values = $this->__decrypt($_COOKIE[$this->name]); } - if (is_null($key)){ + if (is_null($key)) { return $this->__values; } $name = $this->__cookieVarNames($key); - if (count($name) > 1){ + if (count($name) > 1) { if (isset($this->__values[$name[0]])) { $value = $this->__values[$name[0]][$name[1]]; return $value; @@ -294,7 +294,7 @@ class CookieComponent extends Object { function del($key) { $name = $this->__cookieVarNames($key); - if (count($name) > 1){ + if (count($name) > 1) { if (isset($this->__values[$name[0]])) { unset($this->__values[$name[0]][$name[1]]); $this->__delete("[".$name[0]."][".$name[1]."]"); @@ -360,9 +360,9 @@ class CookieComponent extends Object { * @return integer * @access private */ - function __expire($expires = null){ + function __expire($expires = null) { $now = time(); - if (is_null($expires)){ + if (is_null($expires)) { return $this->__expires; } $this->__reset = $this->__expires; @@ -382,7 +382,7 @@ class CookieComponent extends Object { function __write($name, $value) { setcookie($this->name . "$name", $this->__encrypt($value), $this->__expires, $this->path, $this->domain, $this->secure); - if (!is_null($this->__reset)){ + if (!is_null($this->__reset)) { $this->__expires = $this->__reset; $this->__reset = null; } @@ -405,7 +405,7 @@ class CookieComponent extends Object { * @access private */ function __encrypt($value) { - if (is_array($value)){ + if (is_array($value)) { $value = $this->__implode($value); } @@ -427,7 +427,7 @@ class CookieComponent extends Object { $type = $this->__type; foreach ($values as $name => $value) { - if (is_array($value)){ + if (is_array($value)) { foreach ($value as $key => $val) { $pos = strpos($val, 'Q2FrZQ==.'); $decrypted[$name][$key] = $this->__explode($val); @@ -494,7 +494,7 @@ class CookieComponent extends Object { $array = array(); foreach (explode(',', $string) as $pair) { $key = explode('|', $pair); - if (!isset($key[1])){ + if (!isset($key[1])) { return $key[0]; } $array[$key[0]] = $key[1]; diff --git a/cake/libs/controller/components/email.php b/cake/libs/controller/components/email.php index 4792b62db..3b77493bf 100644 --- a/cake/libs/controller/components/email.php +++ b/cake/libs/controller/components/email.php @@ -203,7 +203,7 @@ class EmailComponent extends Object{ * @param unknown_type $controller * @access public */ - function startup(&$controller){ + function startup(&$controller) { $this->Controller = & $controller; } /** @@ -213,14 +213,14 @@ class EmailComponent extends Object{ * @return unknown * @access public */ - function send($content = null){ + function send($content = null) { $this->__createHeader(); $this->subject = $this->__encode($this->subject); if ($this->template === null) { - if (is_array($content)){ + if (is_array($content)) { $message = null; - foreach ($content as $key => $value){ + foreach ($content as $key => $value) { $message .= $value . $this->_newLine; } } else { @@ -239,7 +239,7 @@ class EmailComponent extends Object{ $this->__message .= $this->_newLine .'--' . $this->__boundary . '--' . $this->_newLine . $this->_newLine; } - if ($this->_debug){ + if ($this->_debug) { $this->delivery = 'debug'; } $__method = '__'.$this->delivery; @@ -274,7 +274,7 @@ class EmailComponent extends Object{ function __renderTemplate($content) { $View = new View($this->Controller); $View->layout = $this->layout; - if ($this->sendAs === 'both'){ + if ($this->sendAs === 'both') { $htmlContent = $content; $msg = '--' . $this->__boundary . $this->_newLine; $msg .= 'Content-Type: text/plain; charset=' . $this->charset . $this->_newLine; @@ -302,7 +302,7 @@ class EmailComponent extends Object{ * * @access private */ - function __createBoundary(){ + function __createBoundary() { $this->__boundary = md5(uniqid(time())); } /** @@ -310,7 +310,7 @@ class EmailComponent extends Object{ * * @access private */ - function __createHeader(){ + function __createHeader() { $this->__header .= 'From: ' . $this->__formatAddress($this->from) . $this->_newLine; if (!empty($this->replyTo)) { $this->__header .= 'Reply-To: ' . $this->__formatAddress($this->replyTo) . $this->_newLine; @@ -359,10 +359,10 @@ class EmailComponent extends Object{ * @param string $message * @access private */ - function __formatMessage($message){ + function __formatMessage($message) { $message = $this->__wrap($message); - if ($this->sendAs === 'both'){ + if ($this->sendAs === 'both') { $this->__message = '--' . $this->__boundary . $this->_newLine; $this->__message .= 'Content-Type: text/plain; charset=' . $this->charset . $this->_newLine; $this->__message .= 'Content-Transfer-Encoding: 8bit' . $this->_newLine; @@ -384,7 +384,7 @@ class EmailComponent extends Object{ * * @access private */ - function __attachFiles(){ + function __attachFiles() { foreach ($this->attachments as $attachment) { $files[] = $this->__findFiles($attachment); } @@ -409,7 +409,7 @@ class EmailComponent extends Object{ * @return unknown * @access private */ - function __findFiles($attachment){ + function __findFiles($attachment) { foreach ($this->filePaths as $path) { if (file_exists($path . DS . $attachment)) { $file = $path . DS . $attachment; @@ -466,8 +466,8 @@ class EmailComponent extends Object{ * @return unknown * @access private */ - function __formatAddress($string){ - if (strpos($string, '<') !== false){ + function __formatAddress($string) { + if (strpos($string, '<') !== false) { $value = explode('<', $string); $string = $this->__encode($value[0]) . ' <' . $value[1]; } @@ -479,7 +479,7 @@ class EmailComponent extends Object{ * @return unknown * @access private */ - function __mail(){ + function __mail() { return @mail($this->to, $this->subject, $this->__message, $this->__header, $this->additionalParams); } /** @@ -487,7 +487,7 @@ class EmailComponent extends Object{ * * @access private */ - function __smtp(){ + function __smtp() { } /** diff --git a/cake/libs/controller/components/security.php b/cake/libs/controller/components/security.php index 389e1e9af..bf1c0e9f9 100644 --- a/cake/libs/controller/components/security.php +++ b/cake/libs/controller/components/security.php @@ -506,7 +506,7 @@ class SecurityComponent extends Object { } foreach ($k as $lookup) { - if (isset($controller->data[$newKey][$lookup])){ + if (isset($controller->data[$newKey][$lookup])) { unset($controller->data[$key][$lookup]); } elseif ($controller->data[$key][$lookup] === '0') { $merge[] = $lookup; diff --git a/cake/libs/controller/controller.php b/cake/libs/controller/controller.php index ffe2df095..4ee2241b8 100644 --- a/cake/libs/controller/controller.php +++ b/cake/libs/controller/controller.php @@ -342,7 +342,7 @@ class Controller extends Object { * @access public */ function constructClasses() { - if ($this->uses === null || ($this->uses === array())){ + if ($this->uses === null || ($this->uses === array())) { return false; } if (empty($this->passedArgs) || !isset($this->passedArgs['0'])) { @@ -359,7 +359,7 @@ class Controller extends Object { } if ($this->uses === false) { - if (!class_exists($this->modelClass)){ + if (!class_exists($this->modelClass)) { loadModel($plugin . $this->modelClass); } } @@ -399,7 +399,7 @@ class Controller extends Object { $object = null; $modelKey = Inflector::underscore($modelClass); - if (!class_exists($modelClass)){ + if (!class_exists($modelClass)) { loadModel($plugin . $modelClass); } @@ -610,7 +610,7 @@ class Controller extends Object { $viewClass = $this->view; if ($this->view != 'View') { - if (strpos($viewClass, '.') !== false){ + if (strpos($viewClass, '.') !== false) { list($plugin, $viewClass) = explode('.', $viewClass); } $viewClass = $viewClass . 'View'; diff --git a/cake/libs/controller/scaffold.php b/cake/libs/controller/scaffold.php index 66a112f03..1d03b0e20 100644 --- a/cake/libs/controller/scaffold.php +++ b/cake/libs/controller/scaffold.php @@ -207,7 +207,7 @@ class Scaffold extends Object { function __scaffoldView($params) { if ($this->controller->_beforeScaffold('view')) { - if (isset($params['pass'][0])){ + if (isset($params['pass'][0])) { $this->ScaffoldModel->id = $params['pass'][0]; } elseif (isset($this->controller->Session) && $this->controller->Session->valid != false) { $this->controller->Session->setFlash(sprintf(__("No id set for %s::view()", true), Inflector::humanize($this->modelKey))); @@ -334,7 +334,7 @@ class Scaffold extends Object { function __scaffoldDelete($params = array()) { if ($this->controller->_beforeScaffold('delete')) { - if (isset($params['pass'][0])){ + if (isset($params['pass'][0])) { $id = $params['pass'][0]; } elseif (isset($this->controller->Session) && $this->controller->Session->valid != false) { $this->controller->Session->setFlash(sprintf(__("No id set for %s::delete()", true), Inflector::humanize($this->modelKey))); diff --git a/cake/libs/i18n.php b/cake/libs/i18n.php index f365c8568..8ed274e36 100644 --- a/cake/libs/i18n.php +++ b/cake/libs/i18n.php @@ -361,7 +361,7 @@ class I18n extends Object { } if (isset($_this->__domains[$_this->category][$domain]["%po-header"]["plural-forms"])) { - $switch = preg_replace("/[(){}\\[\\]^\\s*\\]]+/", "", $_this->__domains[$_this->category][$domain]["%po-header"]["plural-forms"]); + $switch = preg_replace("/[() {}\\[\\]^\\s*\\]]+/", "", $_this->__domains[$_this->category][$domain]["%po-header"]["plural-forms"]); $_this->__domains[$_this->category][$domain]["%plural-c"] = $switch; } } diff --git a/cake/libs/l10n.php b/cake/libs/l10n.php index 5ddc1844e..7bec57538 100644 --- a/cake/libs/l10n.php +++ b/cake/libs/l10n.php @@ -335,7 +335,7 @@ class L10n extends Object { function get($language = null) { if (!is_null($language)) { return $this->__setLanguage($language); - } elseif ($this->__autoLanguage() === false){ + } elseif ($this->__autoLanguage() === false) { return $this->__setLanguage($language); } } diff --git a/cake/libs/model/datasources/datasource.php b/cake/libs/model/datasources/datasource.php index be5b7d828..73dc75e21 100644 --- a/cake/libs/model/datasources/datasource.php +++ b/cake/libs/model/datasources/datasource.php @@ -227,7 +227,7 @@ class DataSource extends Object { * @return void */ function __cacheDescription($object, $data = null) { - if ($this->cacheSources === false){ + if ($this->cacheSources === false) { return null; } if (Configure::read() > 0) { @@ -282,7 +282,7 @@ class DataSource extends Object { * @return mixed */ function describe($model) { - if ($this->cacheSources === false){ + if ($this->cacheSources === false) { return null; } diff --git a/cake/libs/model/datasources/dbo/dbo_firebird.php b/cake/libs/model/datasources/dbo/dbo_firebird.php index 0eb5eec77..ba5e32568 100644 --- a/cake/libs/model/datasources/dbo/dbo_firebird.php +++ b/cake/libs/model/datasources/dbo/dbo_firebird.php @@ -139,7 +139,7 @@ class DboFirebird extends DboSource { * @access protected */ function _execute($sql) { - if (strpos(strtolower($sql),"update") > 0){ + if (strpos(strtolower($sql),"update") > 0) { break; } return @ibase_query($this->connection, $sql ); diff --git a/cake/libs/model/datasources/dbo/dbo_postgres.php b/cake/libs/model/datasources/dbo/dbo_postgres.php index 9982f6fff..a6b2e9db5 100644 --- a/cake/libs/model/datasources/dbo/dbo_postgres.php +++ b/cake/libs/model/datasources/dbo/dbo_postgres.php @@ -222,7 +222,7 @@ class DboPostgres extends DboSource { switch($column) { case 'inet': - if (!strlen($data)){ + if (!strlen($data)) { return 'DEFAULT'; } else { $data = pg_escape_string($data); diff --git a/cake/libs/model/datasources/dbo_source.php b/cake/libs/model/datasources/dbo_source.php index 802f6da8d..b7557e10c 100644 --- a/cake/libs/model/datasources/dbo_source.php +++ b/cake/libs/model/datasources/dbo_source.php @@ -132,7 +132,7 @@ class DboSource extends DataSource { * @return array */ function listSources($data = null) { - if ($this->cacheSources === false){ + if ($this->cacheSources === false) { return null; } if ($this->_sources != null) { @@ -249,7 +249,7 @@ class DboSource extends DataSource { return $args[2]->find($query, $fields, $order, $recursive); } } else { - if (isset($args[1]) && $args[1] === true){ + if (isset($args[1]) && $args[1] === true) { return $this->fetchAll($args[0], true); } return $this->fetchAll($args[0], false); @@ -716,7 +716,7 @@ class DboSource extends DataSource { } } - if (!empty($ins)){ + if (!empty($ins)) { $query = r('{$__cakeID__$}', join(', ',$ins), $query); $fetch = $this->fetchAll($query, $model->cacheQueries, $model->name); } else { @@ -751,7 +751,7 @@ class DboSource extends DataSource { $row =& $resultSet[$i]; $q = $this->insertQueryData($query, $resultSet[$i], $association, $assocData, $model, $linkModel, $stack); - if ($q != false){ + if ($q != false) { $fetch = $this->fetchAll($q, $model->cacheQueries, $model->name); } else { $fetch = null; @@ -788,7 +788,7 @@ class DboSource extends DataSource { } } - function __mergeHasMany(&$resultSet, $merge, $association, &$model, &$linkModel){ + function __mergeHasMany(&$resultSet, $merge, $association, &$model, &$linkModel) { foreach ($resultSet as $key => $value) { $merged[$association] = array(); $count = 0; @@ -804,7 +804,7 @@ class DboSource extends DataSource { } $count++; } - if (isset($value[$model->name])){ + if (isset($value[$model->name])) { $resultSet[$key] = Set::pushDiff($resultSet[$key], $merged); unset($merged); unset($temp); @@ -844,15 +844,15 @@ class DboSource extends DataSource { $data[$association] = array(); } } else { - if (is_array($merge[0][$association])){ + if (is_array($merge[0][$association])) { foreach ($data[$association] as $k => $v) { - if (!is_array($v)){ + if (!is_array($v)) { $dataAssocTmp[$k] = $v; } } foreach ($merge[0][$association] as $k => $v) { - if (!is_array($v)){ + if (!is_array($v)) { $mergeAssocTmp[$k] = $v; } } @@ -868,7 +868,7 @@ class DboSource extends DataSource { } } else { if ($merge[0][$association] === false) { - if (!isset($data[$association])){ + if (!isset($data[$association])) { $data[$association] = array(); } } else { @@ -987,7 +987,7 @@ class DboSource extends DataSource { if (count($passedFields) === 1) { $match = strpos($passedFields[0], $assocFields[0]); $match1 = strpos($passedFields[0], 'COUNT('); - if ($match === false && $match1 === false){ + if ($match === false && $match1 === false) { $queryData['fields'] = array_unique(array_merge($passedFields, $assocFields)); } else { $queryData['fields'] = $passedFields; @@ -1524,7 +1524,7 @@ function conditionKeysToString($conditions, $quoteValues = true) { $keys = array_keys($value); if ($keys[0] === 0) { $data = $this->name($key) . ' IN ('; - if (strpos($value[0], '-!') === 0){ + if (strpos($value[0], '-!') === 0) { $value[0] = str_replace('-!', '', $value[0]); $data .= $value[0]; $data .= ')'; diff --git a/cake/libs/model/model.php b/cake/libs/model/model.php index 8004f803a..759ada6a2 100644 --- a/cake/libs/model/model.php +++ b/cake/libs/model/model.php @@ -1824,7 +1824,7 @@ class Model extends Overloadable { if ($groupPath == null && $recursive >= 1) { $this->recursive = -1; - } elseif ($groupPath && $recursive >= 1){ + } elseif ($groupPath && $recursive >= 1) { $this->recursive = 0; } $result = $this->findAll($conditions, $fields, $order, $limit); diff --git a/cake/libs/object.php b/cake/libs/object.php index fb76365e6..837718bac 100644 --- a/cake/libs/object.php +++ b/cake/libs/object.php @@ -90,7 +90,7 @@ class Object { require CAKE . 'dispatcher.php'; } $dispatcher =& new Dispatcher(); - if (isset($this->plugin)){ + if (isset($this->plugin)) { $extra['plugin'] = $this->plugin; } if (in_array('return', $extra, true)) { diff --git a/cake/libs/set.php b/cake/libs/set.php index 25ea4696a..fe45681f4 100644 --- a/cake/libs/set.php +++ b/cake/libs/set.php @@ -486,7 +486,7 @@ class Set extends Object { foreach ($val1 as $key => $val) { if (isset($val2[$key]) && $val2[$key] != $val) { $out[$key] = $val; - } elseif (!array_key_exists($key, $val2)){ + } elseif (!array_key_exists($key, $val2)) { $out[$key] = $val; } } diff --git a/cake/libs/validation.php b/cake/libs/validation.php index 22fbb21ea..115704a0f 100644 --- a/cake/libs/validation.php +++ b/cake/libs/validation.php @@ -131,7 +131,7 @@ class Validation extends Object { } $this->regex = '/[^\\dA-Z]/i'; - if ($this->_check() === true){ + if ($this->_check() === true) { return false; } else { return true; @@ -177,7 +177,7 @@ class Validation extends Object { } $this->regex = '/[^\\s]/'; - if ($this->_check() === true){ + if ($this->_check() === true) { return false; } else { return true; @@ -210,7 +210,7 @@ class Validation extends Object { $this->check = str_replace(array('-', ' '), '', $this->check); - if (strlen($this->check) < 13){ + if (strlen($this->check) < 13) { return false; } @@ -341,7 +341,7 @@ class Validation extends Object { if (is_array($check)) { $this->_extract($check); } - if ($this->regex === null){ + if ($this->regex === null) { $this->errors[] = __('You must define a regular expression for Validation::custom()', true); return false; } @@ -375,8 +375,8 @@ class Validation extends Object { $search = array(); - if (is_array($format)){ - foreach ($format as $key => $value){ + if (is_array($format)) { + foreach ($format as $key => $value) { $search[$value] = $value; } } else { @@ -390,10 +390,10 @@ class Validation extends Object { $regex['My'] = '%^(Jan(uary)?|Feb(ruary)?|Ma(r(ch)?|y)|Apr(il)?|Ju((ly?)|(ne?))|Aug(ust)?|Oct(ober)?|(Sep(?=\\b|t)t?|Nov|Dec)(ember)?)[ /]((1[6-9]|[2-9]\\d)\\d{2})$%'; $regex['my'] = '%^(((0[123456789]|10|11|12)([- /.])(([1][9][0-9][0-9])|([2][0-9][0-9][0-9]))))$%'; - foreach ($search as $key){ + foreach ($search as $key) { $this->regex = $regex[$key]; - if ($this->_check() === true){ + if ($this->_check() === true) { return true; } } @@ -768,7 +768,7 @@ class Validation extends Object { * @access protected */ function _luhn() { - if ($this->deep === true){ + if ($this->deep === true) { if ($this->check == 0) { return false; } @@ -800,7 +800,7 @@ class Validation extends Object { * * @access private */ - function __reset(){ + function __reset() { $this->check = null; $this->regex = null; $this->country = null; diff --git a/cake/libs/view/helper.php b/cake/libs/view/helper.php index 9a0418569..913136653 100644 --- a/cake/libs/view/helper.php +++ b/cake/libs/view/helper.php @@ -197,7 +197,7 @@ class Helper extends Overloadable { } else { $path = WWW_ROOT . $this->themeWeb . $file; } - if (file_exists($path)){ + if (file_exists($path)) { $webPath = "{$this->webroot}" . $this->themeWeb . $file; } } @@ -211,7 +211,7 @@ class Helper extends Overloadable { * @return cleaned content for output * @access public */ - function clean($output){ + function clean($output) { $this->__reset(); if (is_array($output)) { foreach ($output as $key => $value) { @@ -614,7 +614,7 @@ class Helper extends Overloadable { * @return void * @access private */ - function __reset(){ + function __reset() { $this->__tainted = null; $this->__cleaned = null; } @@ -624,7 +624,7 @@ class Helper extends Overloadable { * @return void * @access private */ - function __clean(){ + function __clean() { if (get_magic_quotes_gpc()) { $this->__cleaned = stripslashes($this->__tainted); } else { diff --git a/cake/libs/view/helpers/ajax.php b/cake/libs/view/helpers/ajax.php index 857ff99d7..0409d46d9 100644 --- a/cake/libs/view/helpers/ajax.php +++ b/cake/libs/view/helpers/ajax.php @@ -552,7 +552,7 @@ class AjaxHelper extends AppHelper { * @return string JavaScript block to create a droppable element */ function dropRemote($id, $options = array(), $ajaxOptions = array()) { - $options['onDrop'] = "function(element, droppable){" . $this->remoteFunction($ajaxOptions) . "}"; + $options['onDrop'] = "function(element, droppable) {" . $this->remoteFunction($ajaxOptions) . "}"; $options = $this->_optionsToString($options, array('accept', 'overlap', 'hoverclass')); $options = $this->_buildOptions($options, $this->dropOptions); return $this->Javascript->codeBlock("Droppables.add('{$id}', {$options});"); @@ -643,7 +643,7 @@ class AjaxHelper extends AppHelper { if (empty($options['with'])) { $options['with'] = "Sortable.serialize('$id')"; } - $options['onUpdate'] = 'function(sortable){' . $this->remoteFunction($options) . '}'; + $options['onUpdate'] = 'function(sortable) {' . $this->remoteFunction($options) . '}'; } $options = $this->_optionsToString($options, array('tag', 'constraint', 'only', 'handle', 'hoverclass', 'scroll', 'tree', 'treeTag')); @@ -794,9 +794,9 @@ class AjaxHelper extends AppHelper { $name = 'on' . ucfirst($callback); $code = $options[$callback]; if ($name == 'onComplete') { - $callbacks[$name] = "function(request, json){" . $code . "}"; + $callbacks[$name] = "function(request, json) {" . $code . "}"; } else { - $callbacks[$name] = "function(request){" . $code . "}"; + $callbacks[$name] = "function(request) {" . $code . "}"; } if (isset($options['bind'])) { if ((is_array($options['bind']) && in_array($callback, $options['bind'])) || (is_string($options['bind']) && strpos($options['bind'], $callback) !== false)) { diff --git a/cake/libs/view/helpers/cache.php b/cake/libs/view/helpers/cache.php index 8b707ffa3..396cc8708 100644 --- a/cake/libs/view/helpers/cache.php +++ b/cake/libs/view/helpers/cache.php @@ -203,7 +203,7 @@ class CacheHelper extends AppHelper { } $cache = convertSlash($this->here); - if (empty($cache)){ + if (empty($cache)) { return; } diff --git a/cake/libs/view/helpers/form.php b/cake/libs/view/helpers/form.php index 7892cc717..bf09d281d 100644 --- a/cake/libs/view/helpers/form.php +++ b/cake/libs/view/helpers/form.php @@ -404,7 +404,7 @@ class FormHelper extends AppHelper { $legend = 'Edit '; } $legend .= Inflector::humanize(Inflector::underscore($this->model())); - } elseif (is_string($fieldset)){ + } elseif (is_string($fieldset)) { $legend = $fieldset; } elseif (isset($fieldset['legend'])) { $legend = $fields['legend']; @@ -1082,7 +1082,7 @@ class FormHelper extends AppHelper { $meridian = 'am'; $pos = strpos($selected, '-'); - if ($pos !== false){ + if ($pos !== false) { $date = explode('-', $selected); $days = explode(' ', $date[2]); $day = $days[0]; diff --git a/cake/libs/view/helpers/html.php b/cake/libs/view/helpers/html.php index e67a1b544..6d60a513b 100644 --- a/cake/libs/view/helpers/html.php +++ b/cake/libs/view/helpers/html.php @@ -226,9 +226,9 @@ class HtmlHelper extends AppHelper { * @return string A meta tag containing the specified character set. */ function charset($charset = null) { - if (is_null($charset)){ + if (is_null($charset)) { $charset = Configure::read('charset'); - if (is_null($charset)){ + if (is_null($charset)) { $charset = 'utf-8'; } } @@ -362,7 +362,7 @@ class HtmlHelper extends AppHelper { } foreach ($this->_crumbs as $crumb) { - if (!empty($crumb[1])){ + if (!empty($crumb[1])) { $out[] = $this->link($crumb[0], $crumb[1]); } else { $out[] = $crumb[0]; @@ -568,7 +568,7 @@ class HtmlHelper extends AppHelper { } else { $model = $this->model(); if (isset($htmlAttributes['value']) || (!class_exists($model) && !loadModel($model))) { - if (isset($htmlAttributes['value']) && $htmlAttributes['value'] == $value){ + if (isset($htmlAttributes['value']) && $htmlAttributes['value'] == $value) { $htmlAttributes['checked'] = 'checked'; } else { $htmlAttributes['checked'] = null; diff --git a/cake/libs/view/helpers/javascript.php b/cake/libs/view/helpers/javascript.php index 1c7ce8867..4b037e3a9 100644 --- a/cake/libs/view/helpers/javascript.php +++ b/cake/libs/view/helpers/javascript.php @@ -190,9 +190,9 @@ class JavascriptHelper extends AppHelper { } if (strpos($object, 'window') !== false || strpos($object, 'document') !== false || strpos($object, '$(') !== false || strpos($object, '"') !== false || strpos($object, '\'') !== false) { - $b = "Event.observe({$object}, '{$event}', function(event){ {$observer} }, {$useCapture});"; + $b = "Event.observe({$object}, '{$event}', function(event) { {$observer} }, {$useCapture});"; } elseif (strpos($object, '\'') === 0) { - $b = "Event.observe(" . substr($object, 1) . ", '{$event}', function(event){ {$observer} }, {$useCapture});"; + $b = "Event.observe(" . substr($object, 1) . ", '{$event}', function(event) { {$observer} }, {$useCapture});"; } else { $chars = array('#', ' ', ', ', '.', ':'); $found = false; @@ -205,7 +205,7 @@ class JavascriptHelper extends AppHelper { if ($found) { $this->_rules[$object] = $event; } else { - $b = "Event.observe(\$('{$object}'), '{$event}', function(event){ {$observer} }, {$useCapture});"; + $b = "Event.observe(\$('{$object}'), '{$event}', function(event) { {$observer} }, {$useCapture});"; } } @@ -355,7 +355,7 @@ class JavascriptHelper extends AppHelper { if ($val === null) { $val = 'null'; } - if (is_bool($val)){ + if (is_bool($val)) { $val = ife($val, 'true', 'false'); } } diff --git a/cake/libs/view/templates/scaffolds/edit.ctp b/cake/libs/view/templates/scaffolds/edit.ctp index 628938db1..946129361 100644 --- a/cake/libs/view/templates/scaffolds/edit.ctp +++ b/cake/libs/view/templates/scaffolds/edit.ctp @@ -32,7 +32,7 @@ foreach ($fields as $field) { if ($this->action == 'add' && $field['name'] == $primaryKey) { continue; - } elseif (!in_array($field['name'], array('created', 'modified', 'updated'))){ + } elseif (!in_array($field['name'], array('created', 'modified', 'updated'))) { echo "\t\t".$form->input($field['name'])."\n"; } } diff --git a/cake/libs/view/theme.php b/cake/libs/view/theme.php index e7044a98e..1cec69d20 100644 --- a/cake/libs/view/theme.php +++ b/cake/libs/view/theme.php @@ -61,7 +61,7 @@ class ThemeView extends View { $this->theme =& $controller->theme; if (!empty($this->theme)) { - if (is_dir(WWW_ROOT . 'themed' . DS . $this->theme)){ + if (is_dir(WWW_ROOT . 'themed' . DS . $this->theme)) { $this->themeWeb = 'themed/'. $this->theme .'/'; } $this->themeElement = 'themed'. DS . $this->theme . DS .'elements'. DS; diff --git a/cake/libs/view/view.php b/cake/libs/view/view.php index 67a4bd257..905229e2f 100644 --- a/cake/libs/view/view.php +++ b/cake/libs/view/view.php @@ -892,7 +892,7 @@ class View extends Object { unset ($out); return; } else { - if ($this->layout === 'xml'){ + if ($this->layout === 'xml') { header('Content-type: text/xml'); } $out = str_replace('', '', $out); diff --git a/cake/tests/cases/libs/model/datasources/dbo_source.test.php b/cake/tests/cases/libs/model/datasources/dbo_source.test.php index 24efff709..e8ab83eda 100644 --- a/cake/tests/cases/libs/model/datasources/dbo_source.test.php +++ b/cake/tests/cases/libs/model/datasources/dbo_source.test.php @@ -1618,7 +1618,7 @@ class DboSourceTest extends UnitTestCase { $this->assertEqual($result, $expected); } - function testMixedConditionsParsing(){ + function testMixedConditionsParsing() { $conditions[] = 'User.first_name = \'Firstname\''; $conditions[] = array('User.last_name' => 'Lastname'); $result = $this->db->conditions($conditions); diff --git a/cake/tests/cases/libs/validation.test.php b/cake/tests/cases/libs/validation.test.php index 059382593..59506031a 100644 --- a/cake/tests/cases/libs/validation.test.php +++ b/cake/tests/cases/libs/validation.test.php @@ -35,7 +35,7 @@ uses('Validation'); */ class ValidationTestCase extends UnitTestCase { - function testAlphaNumeric(){ + function testAlphaNumeric() { $validation = new Validation(); $this->assertTrue($validation->alphaNumeric('frferrf')); @@ -50,7 +50,7 @@ class ValidationTestCase extends UnitTestCase { $this->assertFalse($validation->alphaNumeric('')); } - function testAlphaNumericPassedAsArray(){ + function testAlphaNumericPassedAsArray() { $validation = new Validation(); $this->assertTrue($validation->alphaNumeric(array('check' => 'frferrf'))); @@ -65,14 +65,14 @@ class ValidationTestCase extends UnitTestCase { $this->assertFalse($validation->alphaNumeric(array('check' => ''))); } - function testBetween(){ + function testBetween() { $validation = new Validation(); $this->assertTrue($validation->between('abcdefg', 1, 7)); $this->assertTrue($validation->between('', 0, 7)); $this->assertFalse($validation->between('abcdefg', 1, 6)); } - function testBlank(){ + function testBlank() { $validation = new Validation(); $this->assertTrue($validation->blank('')); $this->assertTrue($validation->blank(' ')); @@ -83,7 +83,7 @@ class ValidationTestCase extends UnitTestCase { $this->assertFalse($validation->blank('Blank')); } - function testBlankAsArray(){ + function testBlankAsArray() { $validation = new Validation(); $this->assertTrue($validation->blank(array('check' => ''))); $this->assertTrue($validation->blank(array('check' => ' '))); @@ -94,7 +94,7 @@ class ValidationTestCase extends UnitTestCase { $this->assertFalse($validation->blank(array('check' => 'Blank'))); } - function testcc(){ + function testcc() { $validation = new Validation(); //American Express $this->assertTrue($validation->cc('370482756063980', array('amex'))); @@ -534,7 +534,7 @@ class ValidationTestCase extends UnitTestCase { $this->assertTrue($validation->cc('869972521242198', array('voyager'))); } - function testLuhn(){ + function testLuhn() { $validation = new Validation(); $validation->deep = true; diff --git a/cake/tests/cases/libs/view/helpers/ajax.test.php b/cake/tests/cases/libs/view/helpers/ajax.test.php index 9f9314ad1..ee10e82c7 100644 --- a/cake/tests/cases/libs/view/helpers/ajax.test.php +++ b/cake/tests/cases/libs/view/helpers/ajax.test.php @@ -84,11 +84,11 @@ class AjaxTest extends UnitTestCase { function testEvalScripts() { $result = $this->Ajax->link('Test Link', '/', array('id' => 'link1', 'update' => 'content', 'evalScripts' => false)); - $expected = 'Test Link'; + $expected = 'Test Link'; $this->assertEqual($result, $expected); $result = $this->Ajax->link('Test Link', '/', array('id' => 'link1', 'update' => 'content')); - $expected = 'Test Link'; + $expected = 'Test Link'; $this->assertEqual($result, $expected); } @@ -99,13 +99,13 @@ class AjaxTest extends UnitTestCase { $this->assertPattern('/]+id="PostTitle_autoComplete"[^<>]*><\/div>/', $result); $this->assertPattern('/]+class="auto_complete"[^<>]*><\/div>/', $result); $this->assertPattern('/<\/div>\s+'; + $expected = 'Test Link'; $this->assertEqual($result, $expected); } @@ -121,14 +121,14 @@ class AjaxTest extends UnitTestCase { $this->assertEqual($result, $expected); $result = $this->Ajax->dropRemote('droppable', array('accept' => 'crap'), array('url' => '/posts')); - $expected = ''; + $expected = ''; $this->assertEqual($result, $expected); } function testSubmitWithIndicator() { $result = $this->Ajax->submit('Add', array('div' => false, 'url' => "/controller/action", 'indicator' => 'loading', 'loading' => "doSomething()", 'complete' => 'doSomethingElse() ')); - $this->assertPattern('/onLoading:function\(request\){doSomething\(\);\s+Element.show\(\'loading\'\);}/', $result); - $this->assertPattern('/onComplete:function\(request, json\){doSomethingElse\(\) ;\s+Element.hide\(\'loading\'\);}/', $result); + $this->assertPattern('/onLoading:function\(request\) {doSomething\(\);\s+Element.show\(\'loading\'\);}/', $result); + $this->assertPattern('/onComplete:function\(request, json\) {doSomethingElse\(\) ;\s+Element.hide\(\'loading\'\);}/', $result); } function tearDown() { diff --git a/cake/tests/lib/test_manager.php b/cake/tests/lib/test_manager.php index a788b3c64..99d1064f6 100644 --- a/cake/tests/lib/test_manager.php +++ b/cake/tests/lib/test_manager.php @@ -327,7 +327,7 @@ class HtmlTestManager extends TestManager { return $noGroupTests; } - if (isset($_GET['app'])){ + if (isset($_GET['app'])) { $buffer = "

Available App Test Groups:

\n
    "; } else { $buffer = "

    Available Core Test Groups:

    \n
      ";