mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
Correcting code structure to standards
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5315 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
20dfa51702
commit
dac1bd0913
42 changed files with 169 additions and 169 deletions
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -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]);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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', "<?php\n\$config = array();\n", $expires);
|
||||
}
|
||||
|
||||
if ($write === true){
|
||||
if (!class_exists('File')){
|
||||
if ($write === true) {
|
||||
if (!class_exists('File')) {
|
||||
uses('File');
|
||||
}
|
||||
$fileClass = new File($file);
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
/**
|
||||
* Load Security class
|
||||
*/
|
||||
if (!class_exists('Security')){
|
||||
if (!class_exists('Security')) {
|
||||
uses('Security');
|
||||
}
|
||||
/**
|
||||
|
@ -162,14 +162,14 @@ class CookieComponent extends Object {
|
|||
* @deprecated use Controller::beforeFilter() to set the properties of the CookieComponent
|
||||
*/
|
||||
function initialize(&$controller) {
|
||||
if (is_object($controller)){
|
||||
if (is_object($controller)) {
|
||||
if (isset($controller->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];
|
||||
|
|
|
@ -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() {
|
||||
|
||||
}
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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)));
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 .= ')';
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -203,7 +203,7 @@ class CacheHelper extends AppHelper {
|
|||
}
|
||||
|
||||
$cache = convertSlash($this->here);
|
||||
if (empty($cache)){
|
||||
if (empty($cache)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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('<!--cachetime:'.$match['1'].'-->', '', $out);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -84,11 +84,11 @@ class AjaxTest extends UnitTestCase {
|
|||
|
||||
function testEvalScripts() {
|
||||
$result = $this->Ajax->link('Test Link', '/', array('id' => 'link1', 'update' => 'content', 'evalScripts' => false));
|
||||
$expected = '<a href="/" id="link1" onclick=" return false;">Test Link</a><script type="text/javascript">Event.observe(\'link1\', \'click\', function(event){ new Ajax.Updater(\'content\',\'/\', {asynchronous:true, evalScripts:false, requestHeaders:[\'X-Update\', \'content\']}) }, false);</script>';
|
||||
$expected = '<a href="/" id="link1" onclick=" return false;">Test Link</a><script type="text/javascript">Event.observe(\'link1\', \'click\', function(event) { new Ajax.Updater(\'content\',\'/\', {asynchronous:true, evalScripts:false, requestHeaders:[\'X-Update\', \'content\']}) }, false);</script>';
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$result = $this->Ajax->link('Test Link', '/', array('id' => 'link1', 'update' => 'content'));
|
||||
$expected = '<a href="/" id="link1" onclick=" return false;">Test Link</a><script type="text/javascript">Event.observe(\'link1\', \'click\', function(event){ new Ajax.Updater(\'content\',\'/\', {asynchronous:true, evalScripts:true, requestHeaders:[\'X-Update\', \'content\']}) }, false);</script>';
|
||||
$expected = '<a href="/" id="link1" onclick=" return false;">Test Link</a><script type="text/javascript">Event.observe(\'link1\', \'click\', function(event) { new Ajax.Updater(\'content\',\'/\', {asynchronous:true, evalScripts:true, requestHeaders:[\'X-Update\', \'content\']}) }, false);</script>';
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
|
@ -99,13 +99,13 @@ class AjaxTest extends UnitTestCase {
|
|||
$this->assertPattern('/<div[^<>]+id="PostTitle_autoComplete"[^<>]*><\/div>/', $result);
|
||||
$this->assertPattern('/<div[^<>]+class="auto_complete"[^<>]*><\/div>/', $result);
|
||||
$this->assertPattern('/<\/div>\s+<script type="text\/javascript">new Ajax\.Autocompleter\(\'PostTitle\', \'PostTitle_autoComplete\', \'\/posts\',/', $result);
|
||||
$this->assertPattern('/<script(.*)>(.*){minChars:2}\);/', $result);
|
||||
$this->assertPattern('/<script(.*)>(.*) {minChars:2}\);/', $result);
|
||||
$this->assertPattern('/<\/script>$/', $result);
|
||||
}
|
||||
|
||||
function testAsynchronous() {
|
||||
$result = $this->Ajax->link('Test Link', '/', array('id' => 'link1', 'update' => 'content', 'type' => 'synchronous'));
|
||||
$expected = '<a href="/" id="link1" onclick=" return false;">Test Link</a><script type="text/javascript">Event.observe(\'link1\', \'click\', function(event){ new Ajax.Updater(\'content\',\'/\', {asynchronous:false, evalScripts:true, requestHeaders:[\'X-Update\', \'content\']}) }, false);</script>';
|
||||
$expected = '<a href="/" id="link1" onclick=" return false;">Test Link</a><script type="text/javascript">Event.observe(\'link1\', \'click\', function(event) { new Ajax.Updater(\'content\',\'/\', {asynchronous:false, evalScripts:true, requestHeaders:[\'X-Update\', \'content\']}) }, false);</script>';
|
||||
$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 = '<script type="text/javascript">Droppables.add(\'droppable\', {accept:\'crap\', onDrop:function(element, droppable){new Ajax.Request(\'/posts\', {asynchronous:true, evalScripts:true})}});</script>';
|
||||
$expected = '<script type="text/javascript">Droppables.add(\'droppable\', {accept:\'crap\', onDrop:function(element, droppable) {new Ajax.Request(\'/posts\', {asynchronous:true, evalScripts:true})}});</script>';
|
||||
$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() {
|
||||
|
|
|
@ -327,7 +327,7 @@ class HtmlTestManager extends TestManager {
|
|||
return $noGroupTests;
|
||||
}
|
||||
|
||||
if (isset($_GET['app'])){
|
||||
if (isset($_GET['app'])) {
|
||||
$buffer = "<h3>Available App Test Groups:</h3>\n<ul>";
|
||||
} else {
|
||||
$buffer = "<h3>Available Core Test Groups:</h3>\n<ul>";
|
||||
|
|
Loading…
Add table
Reference in a new issue