mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge pull request #1395 from dereuromark/master-cs
coding standards and simplification of else cases as well as some fixes
This commit is contained in:
commit
f27d4a8e42
42 changed files with 251 additions and 303 deletions
|
@ -123,8 +123,7 @@ class BakeShell extends AppShell {
|
|||
$this->Test->execute();
|
||||
break;
|
||||
case 'Q':
|
||||
exit(0);
|
||||
break;
|
||||
return $this->_stop();
|
||||
default:
|
||||
$this->out(__d('cake_console', 'You have made an invalid selection. Please choose a type of class to Bake by entering D, M, V, F, T, or C.'));
|
||||
}
|
||||
|
|
|
@ -172,7 +172,7 @@ class ConsoleShell extends AppShell {
|
|||
switch ($command) {
|
||||
case 'help':
|
||||
$this->help();
|
||||
break;
|
||||
break;
|
||||
case 'quit':
|
||||
case 'exit':
|
||||
return true;
|
||||
|
@ -182,7 +182,7 @@ class ConsoleShell extends AppShell {
|
|||
foreach ($this->models as $model) {
|
||||
$this->out(" - {$model}");
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case preg_match("/^(\w+) bind (\w+) (\w+)/", $command, $tmp):
|
||||
foreach ($tmp as $data) {
|
||||
$data = strip_tags($data);
|
||||
|
@ -200,7 +200,7 @@ class ConsoleShell extends AppShell {
|
|||
} else {
|
||||
$this->out(__d('cake_console', "Please verify you are using valid models and association types"));
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case preg_match("/^(\w+) unbind (\w+) (\w+)/", $command, $tmp):
|
||||
foreach ($tmp as $data) {
|
||||
$data = strip_tags($data);
|
||||
|
@ -228,7 +228,7 @@ class ConsoleShell extends AppShell {
|
|||
} else {
|
||||
$this->out(__d('cake_console', "Please verify you are using valid models, valid current association, and valid association types"));
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case (strpos($command, "->find") > 0):
|
||||
// Remove any bad info
|
||||
$command = strip_tags($command);
|
||||
|
@ -285,7 +285,7 @@ class ConsoleShell extends AppShell {
|
|||
$this->out(__d('cake_console', "%s is not a valid model", $modelToCheck));
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
case (strpos($command, '->save') > 0):
|
||||
// Validate the model we're trying to save here
|
||||
$command = strip_tags($command);
|
||||
|
@ -302,7 +302,7 @@ class ConsoleShell extends AppShell {
|
|||
//@codingStandardsIgnoreEnd
|
||||
$this->out(__d('cake_console', 'Saved record for %s', $modelToSave));
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case preg_match("/^(\w+) columns/", $command, $tmp):
|
||||
$modelToCheck = strip_tags(str_replace($this->badCommandChars, "", $tmp[1]));
|
||||
|
||||
|
@ -321,31 +321,30 @@ class ConsoleShell extends AppShell {
|
|||
} else {
|
||||
$this->out(__d('cake_console', "Please verify that you selected a valid model"));
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case preg_match("/^routes\s+reload/i", $command, $tmp):
|
||||
if (!$this->_loadRoutes()) {
|
||||
$this->err(__d('cake_console', "There was an error loading the routes config. Please check that the file exists and is free of parse errors."));
|
||||
break;
|
||||
}
|
||||
$this->out(__d('cake_console', "Routes configuration reloaded, %d routes connected", count(Router::$routes)));
|
||||
break;
|
||||
break;
|
||||
case preg_match("/^routes\s+show/i", $command, $tmp):
|
||||
$this->out(print_r(Hash::combine(Router::$routes, '{n}.template', '{n}.defaults'), true));
|
||||
break;
|
||||
break;
|
||||
case (preg_match("/^route\s+(\(.*\))$/i", $command, $tmp) == true):
|
||||
//@codingStandardsIgnoreStart
|
||||
if ($url = eval('return array' . $tmp[1] . ';')) {
|
||||
//@codingStandardsIgnoreEnd
|
||||
$this->out(Router::url($url));
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case preg_match("/^route\s+(.*)/i", $command, $tmp):
|
||||
$this->out(var_export(Router::parse($tmp[1]), true));
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
$this->out(__d('cake_console', "Invalid command"));
|
||||
$this->out();
|
||||
break;
|
||||
}
|
||||
$command = '';
|
||||
}
|
||||
|
|
|
@ -76,16 +76,15 @@ class I18nShell extends AppShell {
|
|||
switch ($choice) {
|
||||
case 'e':
|
||||
$this->Extract->execute();
|
||||
break;
|
||||
break;
|
||||
case 'i':
|
||||
$this->initdb();
|
||||
break;
|
||||
break;
|
||||
case 'h':
|
||||
$this->out($this->OptionParser->help());
|
||||
break;
|
||||
break;
|
||||
case 'q':
|
||||
exit(0);
|
||||
break;
|
||||
return $this->_stop();
|
||||
default:
|
||||
$this->out(__d('cake_console', 'You have made an invalid selection. Please choose a command to execute by entering E, I, H, or Q.'));
|
||||
}
|
||||
|
|
|
@ -107,11 +107,10 @@ class SchemaShell extends AppShell {
|
|||
if ($File->exists()) {
|
||||
$this->out($File->read());
|
||||
return $this->_stop();
|
||||
} else {
|
||||
$file = $this->Schema->path . DS . $this->params['file'];
|
||||
$this->err(__d('cake_console', 'Schema file (%s) could not be found.', $file));
|
||||
return $this->_stop();
|
||||
}
|
||||
$file = $this->Schema->path . DS . $this->params['file'];
|
||||
$this->err(__d('cake_console', 'Schema file (%s) could not be found.', $file));
|
||||
return $this->_stop();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -185,10 +184,9 @@ class SchemaShell extends AppShell {
|
|||
if ($this->Schema->write($content)) {
|
||||
$this->out(__d('cake_console', 'Schema file: %s generated', $content['file']));
|
||||
return $this->_stop();
|
||||
} else {
|
||||
$this->err(__d('cake_console', 'Schema file: %s generated'));
|
||||
return $this->_stop();
|
||||
}
|
||||
$this->err(__d('cake_console', 'Schema file: %s generated'));
|
||||
return $this->_stop();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -304,7 +304,7 @@ class FixtureTask extends BakeTask {
|
|||
case 'integer':
|
||||
case 'float':
|
||||
$insert = $i + 1;
|
||||
break;
|
||||
break;
|
||||
case 'string':
|
||||
case 'binary':
|
||||
$isPrimaryUuid = (
|
||||
|
@ -319,22 +319,22 @@ class FixtureTask extends BakeTask {
|
|||
$insert = substr($insert, 0, (int)$fieldInfo['length'] - 2);
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case 'timestamp':
|
||||
$insert = time();
|
||||
break;
|
||||
break;
|
||||
case 'datetime':
|
||||
$insert = date('Y-m-d H:i:s');
|
||||
break;
|
||||
break;
|
||||
case 'date':
|
||||
$insert = date('Y-m-d');
|
||||
break;
|
||||
break;
|
||||
case 'time':
|
||||
$insert = date('H:i:s');
|
||||
break;
|
||||
break;
|
||||
case 'boolean':
|
||||
$insert = 1;
|
||||
break;
|
||||
break;
|
||||
case 'text':
|
||||
$insert = "Lorem ipsum dolor sit amet, aliquet feugiat.";
|
||||
$insert .= " Convallis morbi fringilla gravida,";
|
||||
|
@ -343,7 +343,7 @@ class FixtureTask extends BakeTask {
|
|||
$insert .= " vestibulum massa neque ut et, id hendrerit sit,";
|
||||
$insert .= " feugiat in taciti enim proin nibh, tempor dignissim, rhoncus";
|
||||
$insert .= " duis vestibulum nunc mattis convallis.";
|
||||
break;
|
||||
break;
|
||||
}
|
||||
$record[$field] = $insert;
|
||||
}
|
||||
|
|
|
@ -65,9 +65,8 @@ class PluginTask extends AppShell {
|
|||
$this->out(__d('cake_console', 'Plugin: %s already exists, no action taken', $plugin));
|
||||
$this->out(__d('cake_console', 'Path: %s', $pluginPath));
|
||||
return false;
|
||||
} else {
|
||||
$this->_interactive($plugin);
|
||||
}
|
||||
$this->_interactive($plugin);
|
||||
} else {
|
||||
return $this->_interactive();
|
||||
}
|
||||
|
|
|
@ -368,12 +368,9 @@ class ProjectTask extends AppShell {
|
|||
if ($File->write($result)) {
|
||||
Configure::write('Routing.prefixes', array($name));
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -250,9 +250,8 @@ class Scaffold {
|
|||
$success
|
||||
);
|
||||
return $this->_sendMessage($message);
|
||||
} else {
|
||||
return $this->controller->afterScaffoldSaveError($action);
|
||||
}
|
||||
return $this->controller->afterScaffoldSaveError($action);
|
||||
} else {
|
||||
if ($this->_validSession) {
|
||||
$this->controller->Session->setFlash(__d('cake', 'Please correct errors below.'));
|
||||
|
@ -309,14 +308,13 @@ class Scaffold {
|
|||
if ($this->ScaffoldModel->delete()) {
|
||||
$message = __d('cake', 'The %1$s with id: %2$s has been deleted.', Inflector::humanize($this->modelClass), $id);
|
||||
return $this->_sendMessage($message);
|
||||
} else {
|
||||
$message = __d('cake',
|
||||
'There was an error deleting the %1$s with id: %2$s',
|
||||
Inflector::humanize($this->modelClass),
|
||||
$id
|
||||
);
|
||||
return $this->_sendMessage($message);
|
||||
}
|
||||
$message = __d('cake',
|
||||
'There was an error deleting the %1$s with id: %2$s',
|
||||
Inflector::humanize($this->modelClass),
|
||||
$id
|
||||
);
|
||||
return $this->_sendMessage($message);
|
||||
} elseif ($this->controller->scaffoldError('delete') === false) {
|
||||
return $this->_scaffoldError();
|
||||
}
|
||||
|
@ -388,21 +386,21 @@ class Scaffold {
|
|||
case 'index':
|
||||
case 'list':
|
||||
$this->_scaffoldIndex($request);
|
||||
break;
|
||||
break;
|
||||
case 'view':
|
||||
$this->_scaffoldView($request);
|
||||
break;
|
||||
break;
|
||||
case 'add':
|
||||
case 'create':
|
||||
$this->_scaffoldSave($request, 'add');
|
||||
break;
|
||||
break;
|
||||
case 'edit':
|
||||
case 'update':
|
||||
$this->_scaffoldSave($request, 'edit');
|
||||
break;
|
||||
break;
|
||||
case 'delete':
|
||||
$this->_scaffoldDelete($request);
|
||||
break;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
throw new MissingActionException(array(
|
||||
|
|
|
@ -198,14 +198,13 @@ class ErrorHandler {
|
|||
'path' => Debugger::trimPath($file)
|
||||
);
|
||||
return Debugger::getInstance()->outputError($data);
|
||||
} else {
|
||||
$message = $error . ' (' . $code . '): ' . $description . ' in [' . $file . ', line ' . $line . ']';
|
||||
if (!empty($errorConfig['trace'])) {
|
||||
$trace = Debugger::trace(array('start' => 1, 'format' => 'log'));
|
||||
$message .= "\nTrace:\n" . $trace . "\n";
|
||||
}
|
||||
return CakeLog::write($log, $message);
|
||||
}
|
||||
$message = $error . ' (' . $code . '): ' . $description . ' in [' . $file . ', line ' . $line . ']';
|
||||
if (!empty($errorConfig['trace'])) {
|
||||
$trace = Debugger::trace(array('start' => 1, 'format' => 'log'));
|
||||
$message .= "\nTrace:\n" . $trace . "\n";
|
||||
}
|
||||
return CakeLog::write($log, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -254,28 +253,28 @@ class ErrorHandler {
|
|||
case E_USER_ERROR:
|
||||
$error = 'Fatal Error';
|
||||
$log = LOG_ERR;
|
||||
break;
|
||||
break;
|
||||
case E_WARNING:
|
||||
case E_USER_WARNING:
|
||||
case E_COMPILE_WARNING:
|
||||
case E_RECOVERABLE_ERROR:
|
||||
$error = 'Warning';
|
||||
$log = LOG_WARNING;
|
||||
break;
|
||||
break;
|
||||
case E_NOTICE:
|
||||
case E_USER_NOTICE:
|
||||
$error = 'Notice';
|
||||
$log = LOG_NOTICE;
|
||||
break;
|
||||
break;
|
||||
case E_STRICT:
|
||||
$error = 'Strict';
|
||||
$log = LOG_NOTICE;
|
||||
break;
|
||||
break;
|
||||
case E_DEPRECATED:
|
||||
case E_USER_DEPRECATED:
|
||||
$error = 'Deprecated';
|
||||
$log = LOG_NOTICE;
|
||||
break;
|
||||
break;
|
||||
}
|
||||
return array($error, $log);
|
||||
}
|
||||
|
|
|
@ -762,17 +762,16 @@ class TreeBehavior extends ModelBehavior {
|
|||
array($Model->escapeField() => $id)
|
||||
);
|
||||
return $Model->delete($id);
|
||||
} else {
|
||||
$edge = $this->_getMax($Model, $scope, $right, $recursive);
|
||||
if ($node[$right] == $edge) {
|
||||
$edge = $edge - 2;
|
||||
}
|
||||
$Model->id = $id;
|
||||
return $Model->save(
|
||||
array($left => $edge + 1, $right => $edge + 2, $parent => null),
|
||||
array('callbacks' => false, 'validate' => false)
|
||||
);
|
||||
}
|
||||
$edge = $this->_getMax($Model, $scope, $right, $recursive);
|
||||
if ($node[$right] == $edge) {
|
||||
$edge = $edge - 2;
|
||||
}
|
||||
$Model->id = $id;
|
||||
return $Model->save(
|
||||
array($left => $edge + 1, $right => $edge + 2, $parent => null),
|
||||
array('callbacks' => false, 'validate' => false)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -357,7 +357,7 @@ class DataSource extends Object {
|
|||
}
|
||||
}
|
||||
$type = $model->getColumnType($model->primaryKey);
|
||||
break;
|
||||
break;
|
||||
case '{$__cakeForeignKey__$}':
|
||||
foreach ($model->associations() as $name) {
|
||||
foreach ($model->$name as $assocName => $assoc) {
|
||||
|
@ -389,7 +389,7 @@ class DataSource extends Object {
|
|||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
if (empty($val) && $val !== '0') {
|
||||
return false;
|
||||
|
|
|
@ -195,17 +195,16 @@ class Mysql extends DboSource {
|
|||
if (!$result) {
|
||||
$result->closeCursor();
|
||||
return array();
|
||||
} else {
|
||||
$tables = array();
|
||||
|
||||
while ($line = $result->fetch(PDO::FETCH_NUM)) {
|
||||
$tables[] = $line[0];
|
||||
}
|
||||
|
||||
$result->closeCursor();
|
||||
parent::listSources($tables);
|
||||
return $tables;
|
||||
}
|
||||
$tables = array();
|
||||
|
||||
while ($line = $result->fetch(PDO::FETCH_NUM)) {
|
||||
$tables[] = $line[0];
|
||||
}
|
||||
|
||||
$result->closeCursor();
|
||||
parent::listSources($tables);
|
||||
return $tables;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -516,13 +515,13 @@ class Mysql extends DboSource {
|
|||
}
|
||||
$colList[] = $alter;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case 'drop':
|
||||
foreach ($column as $field => $col) {
|
||||
$col['name'] = $field;
|
||||
$colList[] = 'DROP ' . $this->name($field);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case 'change':
|
||||
foreach ($column as $field => $col) {
|
||||
if (!isset($col['name'])) {
|
||||
|
@ -530,7 +529,7 @@ class Mysql extends DboSource {
|
|||
}
|
||||
$colList[] = 'CHANGE ' . $this->name($field) . ' ' . $this->buildColumn($col);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$colList = array_merge($colList, $this->_alterIndexes($curTable, $indexes));
|
||||
|
@ -679,24 +678,23 @@ class Mysql extends DboSource {
|
|||
if (!$result) {
|
||||
$result->closeCursor();
|
||||
return array();
|
||||
} else {
|
||||
$tables = array();
|
||||
foreach ($result as $row) {
|
||||
$tables[$row['Name']] = (array)$row;
|
||||
unset($tables[$row['Name']]['queryString']);
|
||||
if (!empty($row['Collation'])) {
|
||||
$charset = $this->getCharsetName($row['Collation']);
|
||||
if ($charset) {
|
||||
$tables[$row['Name']]['charset'] = $charset;
|
||||
}
|
||||
}
|
||||
$tables = array();
|
||||
foreach ($result as $row) {
|
||||
$tables[$row['Name']] = (array)$row;
|
||||
unset($tables[$row['Name']]['queryString']);
|
||||
if (!empty($row['Collation'])) {
|
||||
$charset = $this->getCharsetName($row['Collation']);
|
||||
if ($charset) {
|
||||
$tables[$row['Name']]['charset'] = $charset;
|
||||
}
|
||||
}
|
||||
$result->closeCursor();
|
||||
if (is_string($name) && isset($tables[$name])) {
|
||||
return $tables[$name];
|
||||
}
|
||||
return $tables;
|
||||
}
|
||||
$result->closeCursor();
|
||||
if (is_string($name) && isset($tables[$name])) {
|
||||
return $tables[$name];
|
||||
}
|
||||
return $tables;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -300,9 +300,8 @@ class Postgres extends DboSource {
|
|||
}
|
||||
if (isset($this->_sequenceMap[$table][$field])) {
|
||||
return $this->_sequenceMap[$table][$field];
|
||||
} else {
|
||||
return "{$table}_{$field}_seq";
|
||||
}
|
||||
return "{$table}_{$field}_seq";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -516,13 +515,13 @@ class Postgres extends DboSource {
|
|||
$col['name'] = $field;
|
||||
$colList[] = 'ADD COLUMN ' . $this->buildColumn($col);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case 'drop':
|
||||
foreach ($column as $field => $col) {
|
||||
$col['name'] = $field;
|
||||
$colList[] = 'DROP COLUMN ' . $this->name($field);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case 'change':
|
||||
foreach ($column as $field => $col) {
|
||||
if (!isset($col['name'])) {
|
||||
|
@ -552,7 +551,7 @@ class Postgres extends DboSource {
|
|||
}
|
||||
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (isset($indexes['drop']['PRIMARY'])) {
|
||||
|
@ -748,21 +747,19 @@ class Postgres extends DboSource {
|
|||
switch ($type) {
|
||||
case 'bool':
|
||||
$resultRow[$table][$column] = is_null($row[$index]) ? null : $this->boolean($row[$index]);
|
||||
break;
|
||||
break;
|
||||
case 'binary':
|
||||
case 'bytea':
|
||||
$resultRow[$table][$column] = is_null($row[$index]) ? null : stream_get_contents($row[$index]);
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
$resultRow[$table][$column] = $row[$index];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $resultRow;
|
||||
} else {
|
||||
$this->_result->closeCursor();
|
||||
return false;
|
||||
}
|
||||
$this->_result->closeCursor();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -788,7 +785,6 @@ class Postgres extends DboSource {
|
|||
break;
|
||||
default:
|
||||
$result = (bool)$data;
|
||||
break;
|
||||
}
|
||||
|
||||
if ($quote) {
|
||||
|
|
|
@ -362,10 +362,9 @@ class Sqlite extends DboSource {
|
|||
}
|
||||
}
|
||||
return $resultRow;
|
||||
} else {
|
||||
$this->_result->closeCursor();
|
||||
return false;
|
||||
}
|
||||
$this->_result->closeCursor();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -167,17 +167,16 @@ class Sqlserver extends DboSource {
|
|||
if (!$result) {
|
||||
$result->closeCursor();
|
||||
return array();
|
||||
} else {
|
||||
$tables = array();
|
||||
|
||||
while ($line = $result->fetch(PDO::FETCH_NUM)) {
|
||||
$tables[] = $line[0];
|
||||
}
|
||||
|
||||
$result->closeCursor();
|
||||
parent::listSources($tables);
|
||||
return $tables;
|
||||
}
|
||||
$tables = array();
|
||||
|
||||
while ($line = $result->fetch(PDO::FETCH_NUM)) {
|
||||
$tables[] = $line[0];
|
||||
}
|
||||
|
||||
$result->closeCursor();
|
||||
parent::listSources($tables);
|
||||
return $tables;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -313,9 +312,8 @@ class Sqlserver extends DboSource {
|
|||
$result[] = $prepend . $fields[$i];
|
||||
}
|
||||
return $result;
|
||||
} else {
|
||||
return $fields;
|
||||
}
|
||||
return $fields;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -534,9 +532,8 @@ class Sqlserver extends DboSource {
|
|||
";
|
||||
} elseif (strpos($limit, 'FETCH') !== false) {
|
||||
return "SELECT {$fields} FROM {$table} {$alias} {$joins} {$conditions} {$group} {$order} {$limit}";
|
||||
} else {
|
||||
return "SELECT {$limit} {$fields} FROM {$table} {$alias} {$joins} {$conditions} {$group} {$order}";
|
||||
}
|
||||
return "SELECT {$limit} {$fields} FROM {$table} {$alias} {$joins} {$conditions} {$group} {$order}";
|
||||
case "schema":
|
||||
extract($data);
|
||||
|
||||
|
|
|
@ -592,25 +592,23 @@ class DboSource extends DataSource {
|
|||
$recursive = $params[5 + $off];
|
||||
}
|
||||
return $args[2]->find('all', compact('conditions', 'fields', 'order', 'limit', 'page', 'recursive'));
|
||||
}
|
||||
if (isset($params[3 + $off])) {
|
||||
$recursive = $params[3 + $off];
|
||||
}
|
||||
return $args[2]->find('first', compact('conditions', 'fields', 'order', 'recursive'));
|
||||
}
|
||||
if (isset($args[1]) && $args[1] === true) {
|
||||
return $this->fetchAll($args[0], true);
|
||||
} elseif (isset($args[1]) && !is_array($args[1])) {
|
||||
return $this->fetchAll($args[0], false);
|
||||
} elseif (isset($args[1]) && is_array($args[1])) {
|
||||
if (isset($args[2])) {
|
||||
$cache = $args[2];
|
||||
} else {
|
||||
if (isset($params[3 + $off])) {
|
||||
$recursive = $params[3 + $off];
|
||||
}
|
||||
return $args[2]->find('first', compact('conditions', 'fields', 'order', 'recursive'));
|
||||
}
|
||||
} else {
|
||||
if (isset($args[1]) && $args[1] === true) {
|
||||
return $this->fetchAll($args[0], true);
|
||||
} elseif (isset($args[1]) && !is_array($args[1])) {
|
||||
return $this->fetchAll($args[0], false);
|
||||
} elseif (isset($args[1]) && is_array($args[1])) {
|
||||
if (isset($args[2])) {
|
||||
$cache = $args[2];
|
||||
} else {
|
||||
$cache = true;
|
||||
}
|
||||
return $this->fetchAll($args[0], $args[1], array('cache' => $cache));
|
||||
$cache = true;
|
||||
}
|
||||
return $this->fetchAll($args[0], $args[1], array('cache' => $cache));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -632,9 +630,8 @@ class DboSource extends DataSource {
|
|||
$this->fetchVirtualField($resultRow);
|
||||
}
|
||||
return $resultRow;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1569,7 +1566,7 @@ class DboSource extends DataSource {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case 'hasMany':
|
||||
$assocData['fields'] = $this->fields($linkModel, $association, $assocData['fields']);
|
||||
if (!empty($assocData['foreignKey'])) {
|
||||
|
@ -1585,7 +1582,7 @@ class DboSource extends DataSource {
|
|||
'offset' => $assocData['offset'],
|
||||
'group' => null
|
||||
);
|
||||
break;
|
||||
break;
|
||||
case 'hasAndBelongsToMany':
|
||||
$joinFields = array();
|
||||
$joinAssoc = null;
|
||||
|
@ -1622,7 +1619,7 @@ class DboSource extends DataSource {
|
|||
'conditions' => $this->getConstraint('hasAndBelongsToMany', $model, $linkModel, $joinAlias, $assocData, $association)
|
||||
))
|
||||
);
|
||||
break;
|
||||
break;
|
||||
}
|
||||
if (isset($query)) {
|
||||
return $this->buildStatement($query, $model);
|
||||
|
@ -2596,22 +2593,22 @@ class DboSource extends DataSource {
|
|||
switch ($operator) {
|
||||
case '=':
|
||||
$operator = 'IN';
|
||||
break;
|
||||
break;
|
||||
case '!=':
|
||||
case '<>':
|
||||
$operator = 'NOT IN';
|
||||
break;
|
||||
break;
|
||||
}
|
||||
$value = "({$value})";
|
||||
} elseif ($null || $value === 'NULL') {
|
||||
switch ($operator) {
|
||||
case '=':
|
||||
$operator = 'IS';
|
||||
break;
|
||||
break;
|
||||
case '!=':
|
||||
case '<>':
|
||||
$operator = 'IS NOT';
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($virtual) {
|
||||
|
|
|
@ -1058,34 +1058,34 @@ class Model extends Object implements CakeEventListener {
|
|||
switch ($key) {
|
||||
case 'fields':
|
||||
$data = '';
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'foreignKey':
|
||||
$data = (($type === 'belongsTo') ? Inflector::underscore($assocKey) : Inflector::singularize($this->table)) . '_id';
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'associationForeignKey':
|
||||
$data = Inflector::singularize($this->{$class}->table) . '_id';
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'with':
|
||||
$data = Inflector::camelize(Inflector::singularize($this->{$type}[$assocKey]['joinTable']));
|
||||
$dynamicWith = true;
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'joinTable':
|
||||
$tables = array($this->table, $this->{$class}->table);
|
||||
sort($tables);
|
||||
$data = $tables[0] . '_' . $tables[1];
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'className':
|
||||
$data = $class;
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'unique':
|
||||
$data = true;
|
||||
break;
|
||||
break;
|
||||
}
|
||||
$this->{$type}[$assocKey][$key] = $data;
|
||||
}
|
||||
|
@ -2281,7 +2281,7 @@ class Model extends Object implements CakeEventListener {
|
|||
$validationErrors[$association] = $this->{$association}->validationErrors;
|
||||
}
|
||||
$return[$association] = $validates;
|
||||
break;
|
||||
break;
|
||||
case 'hasMany':
|
||||
foreach ($values as $i => $value) {
|
||||
if (isset($values[$i][$association])) {
|
||||
|
@ -2297,7 +2297,7 @@ class Model extends Object implements CakeEventListener {
|
|||
$validates = false;
|
||||
}
|
||||
$return[$association] = $_return;
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -123,33 +123,32 @@ class Permission extends AppModel {
|
|||
|
||||
if (empty($perms)) {
|
||||
continue;
|
||||
} else {
|
||||
$perms = Hash::extract($perms, '{n}.' . $this->alias);
|
||||
foreach ($perms as $perm) {
|
||||
if ($action === '*') {
|
||||
}
|
||||
$perms = Hash::extract($perms, '{n}.' . $this->alias);
|
||||
foreach ($perms as $perm) {
|
||||
if ($action === '*') {
|
||||
|
||||
foreach ($permKeys as $key) {
|
||||
if (!empty($perm)) {
|
||||
if ($perm[$key] == -1) {
|
||||
return false;
|
||||
} elseif ($perm[$key] == 1) {
|
||||
$inherited[$key] = 1;
|
||||
}
|
||||
foreach ($permKeys as $key) {
|
||||
if (!empty($perm)) {
|
||||
if ($perm[$key] == -1) {
|
||||
return false;
|
||||
} elseif ($perm[$key] == 1) {
|
||||
$inherited[$key] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count($inherited) === count($permKeys)) {
|
||||
if (count($inherited) === count($permKeys)) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
switch ($perm['_' . $action]) {
|
||||
case -1:
|
||||
return false;
|
||||
case 0:
|
||||
continue;
|
||||
case 1:
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
switch ($perm['_' . $action]) {
|
||||
case -1:
|
||||
return false;
|
||||
case 0:
|
||||
continue;
|
||||
case 1:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -148,9 +148,8 @@ class CakeValidationRule {
|
|||
if (in_array($this->required, array('create', 'update'), true)) {
|
||||
if ($this->required === 'create' && !$this->isUpdate() || $this->required === 'update' && $this->isUpdate()) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->required;
|
||||
|
|
|
@ -382,11 +382,10 @@ class CakeSocket {
|
|||
if ($enableCryptoResult === true) {
|
||||
$this->encrypted = $enable;
|
||||
return true;
|
||||
} else {
|
||||
$errorMessage = __d('cake_dev', 'Unable to perform enableCrypto operation on CakeSocket');
|
||||
$this->setLastError(null, $errorMessage);
|
||||
throw new SocketException($errorMessage);
|
||||
}
|
||||
$errorMessage = __d('cake_dev', 'Unable to perform enableCrypto operation on CakeSocket');
|
||||
$this->setLastError(null, $errorMessage);
|
||||
throw new SocketException($errorMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1617,9 +1617,8 @@ class CakeEmail {
|
|||
$charset = strtoupper($this->charset);
|
||||
if (array_key_exists($charset, $this->_contentTypeCharset)) {
|
||||
return strtoupper($this->_contentTypeCharset[$charset]);
|
||||
} else {
|
||||
return strtoupper($this->charset);
|
||||
}
|
||||
return strtoupper($this->charset);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -87,9 +87,8 @@ class AclPerson extends CakeTestModel {
|
|||
}
|
||||
if (!$motherId) {
|
||||
return null;
|
||||
} else {
|
||||
return array('AclPerson' => array('id' => $motherId));
|
||||
}
|
||||
return array('AclPerson' => array('id' => $motherId));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3672,11 +3672,10 @@ class ContainableBehaviorTest extends CakeTestCase {
|
|||
if (!is_array($Model)) {
|
||||
$result = $Model->containments($contain);
|
||||
return $this->_containments($result['models']);
|
||||
} else {
|
||||
$result = $Model;
|
||||
foreach ($result as $i => $containment) {
|
||||
$result[$i] = array_diff_key($containment, array('instance' => true));
|
||||
}
|
||||
}
|
||||
$result = $Model;
|
||||
foreach ($result as $i => $containment) {
|
||||
$result[$i] = array_diff_key($containment, array('instance' => true));
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
|
|
@ -142,15 +142,15 @@ class TestBehavior extends ModelBehavior {
|
|||
switch ($settings['afterSave']) {
|
||||
case 'on':
|
||||
$model->data[$model->alias]['aftersave'] = $string;
|
||||
break;
|
||||
break;
|
||||
case 'test':
|
||||
unset($model->data[$model->alias]['name']);
|
||||
break;
|
||||
break;
|
||||
case 'test2':
|
||||
return false;
|
||||
case 'modify':
|
||||
$model->data[$model->alias]['name'] .= ' ' . $string;
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -241,7 +241,7 @@ class TestBehavior extends ModelBehavior {
|
|||
switch ($settings['afterDelete']) {
|
||||
case 'on':
|
||||
echo 'afterDelete success';
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -122,9 +122,8 @@ class CakeTestSuiteCommand extends PHPUnit_TextUI_Command {
|
|||
exit(PHPUnit_TextUI_TestRunner::SUCCESS_EXIT);
|
||||
} elseif (!isset($result) || $result->errorCount() > 0) {
|
||||
exit(PHPUnit_TextUI_TestRunner::EXCEPTION_EXIT);
|
||||
} else {
|
||||
exit(PHPUnit_TextUI_TestRunner::FAILURE_EXIT);
|
||||
}
|
||||
exit(PHPUnit_TextUI_TestRunner::FAILURE_EXIT);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -47,10 +47,9 @@ class CakeTestModel extends Model {
|
|||
case
|
||||
(is_string($queryData['fields']) && !($queryData['fields'] == $pk || $queryData['fields'] == $aliasedPk)) ||
|
||||
(is_array($queryData['fields']) && !(array_key_exists($pk, $queryData['fields']) || array_key_exists($aliasedPk, $queryData['fields']))):
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
$queryData['order'] = array($this->alias . '.' . $this->primaryKey => 'ASC');
|
||||
break;
|
||||
}
|
||||
return $queryData;
|
||||
}
|
||||
|
|
|
@ -97,14 +97,13 @@ class CakeTime {
|
|||
*
|
||||
* @param string $name Variable name
|
||||
* @param mixes $value Variable value
|
||||
* @return void
|
||||
*/
|
||||
public function __set($name, $value) {
|
||||
switch ($name) {
|
||||
case 'niceFormat':
|
||||
self::${$name} = $value;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -230,24 +230,24 @@ class Debugger {
|
|||
case E_USER_ERROR:
|
||||
$error = 'Fatal Error';
|
||||
$level = LOG_ERR;
|
||||
break;
|
||||
break;
|
||||
case E_WARNING:
|
||||
case E_USER_WARNING:
|
||||
case E_COMPILE_WARNING:
|
||||
case E_RECOVERABLE_ERROR:
|
||||
$error = 'Warning';
|
||||
$level = LOG_WARNING;
|
||||
break;
|
||||
break;
|
||||
case E_NOTICE:
|
||||
case E_USER_NOTICE:
|
||||
$error = 'Notice';
|
||||
$level = LOG_NOTICE;
|
||||
break;
|
||||
break;
|
||||
case E_DEPRECATED:
|
||||
case E_USER_DEPRECATED:
|
||||
$error = 'Deprecated';
|
||||
$level = LOG_NOTICE;
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -516,11 +516,10 @@ class Folder {
|
|||
umask($old);
|
||||
$this->_messages[] = __d('cake_dev', '%s created', $pathname);
|
||||
return true;
|
||||
} else {
|
||||
umask($old);
|
||||
$this->_errors[] = __d('cake_dev', '%s NOT created', $pathname);
|
||||
return false;
|
||||
}
|
||||
umask($old);
|
||||
$this->_errors[] = __d('cake_dev', '%s NOT created', $pathname);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
@ -810,9 +809,8 @@ class Folder {
|
|||
if (!empty($newparts)) {
|
||||
array_pop($newparts);
|
||||
continue;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
$newparts[] = $part;
|
||||
}
|
||||
|
|
|
@ -308,7 +308,7 @@ class Inflector {
|
|||
} else {
|
||||
self::$_transliteration = $rules + self::$_transliteration;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
default:
|
||||
foreach ($rules as $rule => $pattern) {
|
||||
|
@ -334,7 +334,6 @@ class Inflector {
|
|||
}
|
||||
}
|
||||
self::${$var}['rules'] = $rules + self::${$var}['rules'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -255,7 +255,6 @@ class Validation {
|
|||
break;
|
||||
default:
|
||||
self::$errors[] = __d('cake_dev', 'You must define the $operator parameter for Validation::comparison()');
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -817,9 +816,8 @@ class Validation {
|
|||
protected static function _check($check, $regex) {
|
||||
if (is_string($regex) && preg_match($regex, $check)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -662,18 +662,16 @@ class Helper extends Object {
|
|||
switch ($field) {
|
||||
case '_method':
|
||||
$name = $field;
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
$name = 'data[' . implode('][', $this->entity()) . ']';
|
||||
break;
|
||||
}
|
||||
|
||||
if (is_array($options)) {
|
||||
$options[$key] = $name;
|
||||
return $options;
|
||||
} else {
|
||||
return $name;
|
||||
}
|
||||
return $name;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -729,9 +727,8 @@ class Helper extends Object {
|
|||
if (is_array($options)) {
|
||||
$options[$key] = $result;
|
||||
return $options;
|
||||
} else {
|
||||
return $result;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -920,7 +917,7 @@ class Helper extends Object {
|
|||
do {
|
||||
$oldstring = $this->_cleaned;
|
||||
$this->_cleaned = preg_replace('#</*(applet|meta|xml|blink|link|style|script|embed|object|iframe|frame|frameset|ilayer|layer|bgsound|title|base)[^>]*>#i', "", $this->_cleaned);
|
||||
} while ($oldstring != $this->_cleaned);
|
||||
} while ($oldstring !== $this->_cleaned);
|
||||
$this->_cleaned = str_replace(array("&", "<", ">"), array("&amp;", "&lt;", "&gt;"), $this->_cleaned);
|
||||
}
|
||||
|
||||
|
|
|
@ -205,9 +205,8 @@ class FormHelper extends AppHelper {
|
|||
return $this->fieldset[$model]['fields'];
|
||||
} elseif (isset($this->fieldset[$model]['fields'][$field])) {
|
||||
return $this->fieldset[$model]['fields'][$field];
|
||||
} else {
|
||||
return isset($object->hasAndBelongsToMany[$field]) ? array('type' => 'multiple') : null;
|
||||
}
|
||||
return isset($object->hasAndBelongsToMany[$field]) ? array('type' => 'multiple') : null;
|
||||
}
|
||||
|
||||
if ($key === 'errors' && !isset($this->validationErrors[$model])) {
|
||||
|
@ -232,10 +231,9 @@ class FormHelper extends AppHelper {
|
|||
if ($key === 'validates') {
|
||||
if (empty($field)) {
|
||||
return $this->fieldset[$model]['validates'];
|
||||
} else {
|
||||
return isset($this->fieldset[$model]['validates'][$field]) ?
|
||||
$this->fieldset[$model]['validates'] : null;
|
||||
}
|
||||
return isset($this->fieldset[$model]['validates'][$field]) ?
|
||||
$this->fieldset[$model]['validates'] : null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -407,7 +405,7 @@ class FormHelper extends AppHelper {
|
|||
switch (strtolower($options['type'])) {
|
||||
case 'get':
|
||||
$htmlAttributes['method'] = 'get';
|
||||
break;
|
||||
break;
|
||||
case 'file':
|
||||
$htmlAttributes['enctype'] = 'multipart/form-data';
|
||||
$options['type'] = ($created) ? 'put' : 'post';
|
||||
|
@ -420,7 +418,6 @@ class FormHelper extends AppHelper {
|
|||
));
|
||||
default:
|
||||
$htmlAttributes['method'] = 'post';
|
||||
break;
|
||||
}
|
||||
$this->requestType = strtolower($options['type']);
|
||||
|
||||
|
@ -2456,16 +2453,16 @@ class FormHelper extends AppHelper {
|
|||
$selects[] = $this->year(
|
||||
$fieldName, $minYear, $maxYear, $attrs['Year']
|
||||
);
|
||||
break;
|
||||
break;
|
||||
case 'M':
|
||||
$attrs['Month']['value'] = $month;
|
||||
$attrs['Month']['monthNames'] = $monthNames;
|
||||
$selects[] = $this->month($fieldName, $attrs['Month']);
|
||||
break;
|
||||
break;
|
||||
case 'D':
|
||||
$attrs['Day']['value'] = $day;
|
||||
$selects[] = $this->day($fieldName, $attrs['Day']);
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$opt = implode($separator, $selects);
|
||||
|
@ -2477,7 +2474,7 @@ class FormHelper extends AppHelper {
|
|||
$attrs['Minute']['value'] = $min;
|
||||
$opt .= $this->hour($fieldName, true, $attrs['Hour']) . ':' .
|
||||
$this->minute($fieldName, $attrs['Minute']);
|
||||
break;
|
||||
break;
|
||||
case '12':
|
||||
$attrs['Hour']['value'] = $hour;
|
||||
$attrs['Minute']['value'] = $min;
|
||||
|
@ -2485,7 +2482,7 @@ class FormHelper extends AppHelper {
|
|||
$opt .= $this->hour($fieldName, false, $attrs['Hour']) . ':' .
|
||||
$this->minute($fieldName, $attrs['Minute']) . ' ' .
|
||||
$this->meridian($fieldName, $attrs['Meridian']);
|
||||
break;
|
||||
break;
|
||||
}
|
||||
return $opt;
|
||||
}
|
||||
|
@ -2573,9 +2570,8 @@ class FormHelper extends AppHelper {
|
|||
if (is_array($options)) {
|
||||
$options[$key] = $name;
|
||||
return $options;
|
||||
} else {
|
||||
return $name;
|
||||
}
|
||||
return $name;
|
||||
}
|
||||
return parent::_name($options, $field, $key);
|
||||
}
|
||||
|
@ -2719,20 +2715,20 @@ class FormHelper extends AppHelper {
|
|||
$data[sprintf('%02d', $i)] = sprintf('%02d', $i);
|
||||
$i += $interval;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case 'hour':
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$data[sprintf('%02d', $i)] = $i;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case 'hour24':
|
||||
for ($i = 0; $i <= 23; $i++) {
|
||||
$data[sprintf('%02d', $i)] = $i;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case 'meridian':
|
||||
$data = array('am' => 'am', 'pm' => 'pm');
|
||||
break;
|
||||
break;
|
||||
case 'day':
|
||||
$min = 1;
|
||||
$max = 31;
|
||||
|
@ -2747,7 +2743,7 @@ class FormHelper extends AppHelper {
|
|||
for ($i = $min; $i <= $max; $i++) {
|
||||
$data[sprintf('%02d', $i)] = $i;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case 'month':
|
||||
if ($options['monthNames'] === true) {
|
||||
$data['01'] = __d('cake', 'January');
|
||||
|
@ -2769,7 +2765,7 @@ class FormHelper extends AppHelper {
|
|||
$data[sprintf("%02s", $m)] = strftime("%m", mktime(1, 1, 1, $m, 1, 1999));
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case 'year':
|
||||
$current = intval(date('Y'));
|
||||
|
||||
|
@ -2791,7 +2787,7 @@ class FormHelper extends AppHelper {
|
|||
if ($options['order'] !== 'asc') {
|
||||
$data = array_reverse($data, true);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
$this->_options[$name] = $data;
|
||||
return $this->_options[$name];
|
||||
|
|
|
@ -235,7 +235,7 @@ class JqueryEngineHelper extends JsBaseEngineHelper {
|
|||
case 'slideDown':
|
||||
case 'slideUp':
|
||||
$effect = ".$name($speed);";
|
||||
break;
|
||||
break;
|
||||
}
|
||||
return $this->selection . $effect;
|
||||
}
|
||||
|
|
|
@ -147,25 +147,24 @@ abstract class JsBaseEngineHelper extends AppHelper {
|
|||
switch (true) {
|
||||
case (is_array($val) || is_object($val)):
|
||||
$val = $this->object($val);
|
||||
break;
|
||||
break;
|
||||
case ($val === null):
|
||||
$val = 'null';
|
||||
break;
|
||||
break;
|
||||
case (is_bool($val)):
|
||||
$val = ($val === true) ? 'true' : 'false';
|
||||
break;
|
||||
break;
|
||||
case (is_int($val)):
|
||||
$val = $val;
|
||||
break;
|
||||
break;
|
||||
case (is_float($val)):
|
||||
$val = sprintf("%.11f", $val);
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
$val = $this->escape($val);
|
||||
if ($quoteString) {
|
||||
$val = '"' . $val . '"';
|
||||
}
|
||||
break;
|
||||
}
|
||||
return $val;
|
||||
}
|
||||
|
|
|
@ -205,10 +205,10 @@ class MootoolsEngineHelper extends JsBaseEngineHelper {
|
|||
switch ($name) {
|
||||
case 'hide':
|
||||
$effect = 'setStyle("display", "none")';
|
||||
break;
|
||||
break;
|
||||
case 'show':
|
||||
$effect = 'setStyle("display", "")';
|
||||
break;
|
||||
break;
|
||||
case 'fadeIn':
|
||||
case 'fadeOut':
|
||||
case 'slideIn':
|
||||
|
@ -219,7 +219,7 @@ class MootoolsEngineHelper extends JsBaseEngineHelper {
|
|||
$effect .= "set(\"$effectName\", {duration:$speed}).";
|
||||
}
|
||||
$effect .= "$effectName(\"$direction\")";
|
||||
break;
|
||||
break;
|
||||
}
|
||||
return $this->selection . '.' . $effect . ';';
|
||||
}
|
||||
|
|
|
@ -491,22 +491,21 @@ class PaginatorHelper extends AppHelper {
|
|||
}
|
||||
$link = $this->link($title, $url, compact('escape', 'model') + $options);
|
||||
return $this->Html->tag($tag, $link, compact('class'));
|
||||
} else {
|
||||
unset($options['rel']);
|
||||
if (!$tag) {
|
||||
if ($disabledTag) {
|
||||
$tag = $disabledTag;
|
||||
$disabledTag = null;
|
||||
} else {
|
||||
$tag = $_defaults['tag'];
|
||||
}
|
||||
}
|
||||
if ($disabledTag) {
|
||||
$title = $this->Html->tag($disabledTag, $title, compact('escape') + $options);
|
||||
return $this->Html->tag($tag, $title, compact('class'));
|
||||
}
|
||||
return $this->Html->tag($tag, $title, compact('escape', 'class') + $options);
|
||||
}
|
||||
unset($options['rel']);
|
||||
if (!$tag) {
|
||||
if ($disabledTag) {
|
||||
$tag = $disabledTag;
|
||||
$disabledTag = null;
|
||||
} else {
|
||||
$tag = $_defaults['tag'];
|
||||
}
|
||||
}
|
||||
if ($disabledTag) {
|
||||
$title = $this->Html->tag($disabledTag, $title, compact('escape') + $options);
|
||||
return $this->Html->tag($tag, $title, compact('class'));
|
||||
}
|
||||
return $this->Html->tag($tag, $title, compact('escape', 'class') + $options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -628,10 +627,10 @@ class PaginatorHelper extends AppHelper {
|
|||
}
|
||||
$out = $start . $options['separator'][0] . $end . $options['separator'][1];
|
||||
$out .= $paging['count'];
|
||||
break;
|
||||
break;
|
||||
case 'pages':
|
||||
$out = $paging['page'] . $options['separator'] . $paging['pageCount'];
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
$map = array(
|
||||
'%page%' => $paging['page'],
|
||||
|
@ -648,7 +647,6 @@ class PaginatorHelper extends AppHelper {
|
|||
'{:page}', '{:pages}', '{:current}', '{:count}', '{:start}', '{:end}', '{:model}'
|
||||
);
|
||||
$out = str_replace($newKeys, array_values($map), $out);
|
||||
break;
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
|
|
|
@ -212,17 +212,17 @@ class PrototypeEngineHelper extends JsBaseEngineHelper {
|
|||
case 'hide':
|
||||
case 'show':
|
||||
$effect = $this->selection . '.' . $name . '();';
|
||||
break;
|
||||
break;
|
||||
case 'slideIn':
|
||||
case 'slideOut':
|
||||
$name = ($name === 'slideIn') ? 'slideDown' : 'slideUp';
|
||||
$effect = 'Effect.' . $name . '(' . $this->selection . $optionString . ');';
|
||||
break;
|
||||
break;
|
||||
case 'fadeIn':
|
||||
case 'fadeOut':
|
||||
$name = ($name === 'fadeIn') ? 'appear' : 'fade';
|
||||
$effect = $this->selection . '.' . $name . '(' . substr($optionString, 2) . ');';
|
||||
break;
|
||||
break;
|
||||
}
|
||||
return $effect;
|
||||
}
|
||||
|
|
|
@ -208,7 +208,7 @@ class RssHelper extends AppHelper {
|
|||
switch ($key) {
|
||||
case 'pubDate' :
|
||||
$val = $this->time($val);
|
||||
break;
|
||||
break;
|
||||
case 'category' :
|
||||
if (is_array($val) && !empty($val[0])) {
|
||||
foreach ($val as $category) {
|
||||
|
@ -224,7 +224,7 @@ class RssHelper extends AppHelper {
|
|||
} elseif (is_array($val) && isset($val['domain'])) {
|
||||
$attrib['domain'] = $val['domain'];
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case 'link':
|
||||
case 'guid':
|
||||
case 'comments':
|
||||
|
@ -234,7 +234,7 @@ class RssHelper extends AppHelper {
|
|||
$val = $val['url'];
|
||||
}
|
||||
$val = $this->url($val, true);
|
||||
break;
|
||||
break;
|
||||
case 'source':
|
||||
if (is_array($val) && isset($val['url'])) {
|
||||
$attrib['url'] = $this->url($val['url'], true);
|
||||
|
@ -243,7 +243,7 @@ class RssHelper extends AppHelper {
|
|||
$attrib['url'] = $this->url($val[0], true);
|
||||
$val = $val[1];
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case 'enclosure':
|
||||
if (is_string($val['url']) && is_file(WWW_ROOT . $val['url']) && file_exists(WWW_ROOT . $val['url'])) {
|
||||
if (!isset($val['length']) && strpos($val['url'], '://') === false) {
|
||||
|
@ -256,7 +256,7 @@ class RssHelper extends AppHelper {
|
|||
$val['url'] = $this->url($val['url'], true);
|
||||
$attrib = $val;
|
||||
$val = null;
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
$attrib = $att;
|
||||
}
|
||||
|
|
|
@ -75,10 +75,9 @@ class TimeHelper extends AppHelper {
|
|||
switch ($name) {
|
||||
case 'niceFormat':
|
||||
$this->_engine->{$name} = $value;
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
$this->{$name} = $value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -564,9 +564,8 @@ class View extends Object {
|
|||
//@codingStandardsIgnoreEnd
|
||||
unset($out);
|
||||
return false;
|
||||
} else {
|
||||
return substr($out, strlen($match[0]));
|
||||
}
|
||||
return substr($out, strlen($match[0]));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -402,13 +402,13 @@ if (!function_exists('cache')) {
|
|||
switch (strtolower($target)) {
|
||||
case 'cache':
|
||||
$filename = CACHE . $path;
|
||||
break;
|
||||
break;
|
||||
case 'public':
|
||||
$filename = WWW_ROOT . $path;
|
||||
break;
|
||||
break;
|
||||
case 'tmp':
|
||||
$filename = TMP . $path;
|
||||
break;
|
||||
break;
|
||||
}
|
||||
$timediff = $expires - $now;
|
||||
$filetime = false;
|
||||
|
|
Loading…
Reference in a new issue