mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge branch 'master' into 2.5
Conflicts: lib/Cake/Model/Datasource/DboSource.php lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php lib/Cake/Utility/Folder.php lib/Cake/VERSION.txt
This commit is contained in:
commit
d466e00644
48 changed files with 138 additions and 73 deletions
|
@ -21,6 +21,8 @@ matrix:
|
||||||
- PHPCS=1
|
- PHPCS=1
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
|
- sh -c "if [ '$TRAVIS_PHP_VERSION' != '5.2' ]; then composer global require 'phpunit/phpunit=3.7.33'; fi"
|
||||||
|
- sh -c "if [ '$TRAVIS_PHP_VERSION' != '5.2' ]; then ln -s ~/.composer/vendor/phpunit/phpunit/PHPUnit ./vendors/PHPUnit; fi"
|
||||||
- sudo locale-gen de_DE
|
- sudo locale-gen de_DE
|
||||||
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE cakephp_test;'; fi"
|
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE cakephp_test;'; fi"
|
||||||
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE cakephp_test2;'; fi"
|
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE cakephp_test2;'; fi"
|
||||||
|
|
|
@ -303,7 +303,7 @@ class ConsoleShell extends AppShell {
|
||||||
$validCurrentAssociation = false;
|
$validCurrentAssociation = false;
|
||||||
|
|
||||||
foreach ($currentAssociations as $model => $currentAssociation) {
|
foreach ($currentAssociations as $model => $currentAssociation) {
|
||||||
if ($model == $modelB && $association == $currentAssociation) {
|
if ($model === $modelB && $association === $currentAssociation) {
|
||||||
$validCurrentAssociation = true;
|
$validCurrentAssociation = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,7 +92,7 @@ class ServerShell extends AppShell {
|
||||||
}
|
}
|
||||||
|
|
||||||
// for windows
|
// for windows
|
||||||
if (substr($this->_documentRoot, -1, 1) == DIRECTORY_SEPARATOR) {
|
if (substr($this->_documentRoot, -1, 1) === DIRECTORY_SEPARATOR) {
|
||||||
$this->_documentRoot = substr($this->_documentRoot, 0, strlen($this->_documentRoot) - 1);
|
$this->_documentRoot = substr($this->_documentRoot, 0, strlen($this->_documentRoot) - 1);
|
||||||
}
|
}
|
||||||
if (preg_match("/^([a-z]:)[\\\]+(.+)$/i", $this->_documentRoot, $m)) {
|
if (preg_match("/^([a-z]:)[\\\]+(.+)$/i", $this->_documentRoot, $m)) {
|
||||||
|
|
|
@ -296,7 +296,7 @@ class DbConfigTask extends AppShell {
|
||||||
|
|
||||||
foreach ($oldConfigs as $key => $oldConfig) {
|
foreach ($oldConfigs as $key => $oldConfig) {
|
||||||
foreach ($configs as $config) {
|
foreach ($configs as $config) {
|
||||||
if ($oldConfig['name'] == $config['name']) {
|
if ($oldConfig['name'] === $config['name']) {
|
||||||
unset($oldConfigs[$key]);
|
unset($oldConfigs[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -414,7 +414,7 @@ class ExtractTask extends AppShell {
|
||||||
$mapCount = count($map);
|
$mapCount = count($map);
|
||||||
$strings = $this->_getStrings($position, $mapCount);
|
$strings = $this->_getStrings($position, $mapCount);
|
||||||
|
|
||||||
if ($mapCount == count($strings)) {
|
if ($mapCount === count($strings)) {
|
||||||
extract(array_combine($map, $strings));
|
extract(array_combine($map, $strings));
|
||||||
$category = isset($category) ? $category : 6;
|
$category = isset($category) ? $category : 6;
|
||||||
$category = intval($category);
|
$category = intval($category);
|
||||||
|
|
|
@ -632,13 +632,13 @@ class ModelTask extends BakeTask {
|
||||||
}
|
}
|
||||||
foreach ($tempFieldNames as $fieldName) {
|
foreach ($tempFieldNames as $fieldName) {
|
||||||
$assoc = false;
|
$assoc = false;
|
||||||
if ($fieldName != $model->primaryKey && $fieldName == $foreignKey) {
|
if ($fieldName !== $model->primaryKey && $fieldName === $foreignKey) {
|
||||||
$assoc = array(
|
$assoc = array(
|
||||||
'alias' => $tempOtherModel->name,
|
'alias' => $tempOtherModel->name,
|
||||||
'className' => $tempOtherModel->name,
|
'className' => $tempOtherModel->name,
|
||||||
'foreignKey' => $fieldName
|
'foreignKey' => $fieldName
|
||||||
);
|
);
|
||||||
} elseif ($otherTable == $model->table && $fieldName === 'parent_id') {
|
} elseif ($otherTable === $model->table && $fieldName === 'parent_id') {
|
||||||
$assoc = array(
|
$assoc = array(
|
||||||
'alias' => 'Child' . $model->name,
|
'alias' => 'Child' . $model->name,
|
||||||
'className' => $model->name,
|
'className' => $model->name,
|
||||||
|
|
|
@ -302,7 +302,7 @@ class TestTask extends BakeTask {
|
||||||
|
|
||||||
$position = strpos($class, $type);
|
$position = strpos($class, $type);
|
||||||
|
|
||||||
if ($position !== false && strlen($class) - $position == strlen($type)) {
|
if ($position !== false && (strlen($class) - $position) === strlen($type)) {
|
||||||
return $class;
|
return $class;
|
||||||
}
|
}
|
||||||
return $class . $type;
|
return $class . $type;
|
||||||
|
|
|
@ -151,7 +151,7 @@ class ViewTask extends BakeTask {
|
||||||
unset($methods[$i]);
|
unset($methods[$i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($method[0] === '_' || $method == strtolower($this->controllerName . 'Controller')) {
|
if ($method[0] === '_' || $method === strtolower($this->controllerName . 'Controller')) {
|
||||||
unset($methods[$i]);
|
unset($methods[$i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -609,7 +609,7 @@ class UpgradeShell extends AppShell {
|
||||||
|
|
||||||
$new = 'View' . DS . Inflector::camelize($old);
|
$new = 'View' . DS . Inflector::camelize($old);
|
||||||
$old = 'View' . DS . $old;
|
$old = 'View' . DS . $old;
|
||||||
if ($new == $old) {
|
if ($new === $old) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ class ConsoleInput {
|
||||||
* @param string $handle The location of the stream to use as input.
|
* @param string $handle The location of the stream to use as input.
|
||||||
*/
|
*/
|
||||||
public function __construct($handle = 'php://stdin') {
|
public function __construct($handle = 'php://stdin') {
|
||||||
$this->_canReadline = extension_loaded('readline') && $handle == 'php://stdin' ? true : false;
|
$this->_canReadline = extension_loaded('readline') && $handle === 'php://stdin' ? true : false;
|
||||||
$this->_input = fopen($handle, 'r');
|
$this->_input = fopen($handle, 'r');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
<?php
|
<?php
|
||||||
echo "\t<?php\n";
|
echo "\t<?php\n";
|
||||||
foreach ($fields as $field) {
|
foreach ($fields as $field) {
|
||||||
if (strpos($action, 'add') !== false && $field == $primaryKey) {
|
if (strpos($action, 'add') !== false && $field === $primaryKey) {
|
||||||
continue;
|
continue;
|
||||||
} elseif (!in_array($field, array('created', 'modified', 'updated'))) {
|
} elseif (!in_array($field, array('created', 'modified', 'updated'))) {
|
||||||
echo "\t\techo \$this->Form->input('{$field}');\n";
|
echo "\t\techo \$this->Form->input('{$field}');\n";
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
<?php echo $this->Html->charset(); ?>
|
<?php echo $this->Html->charset(); ?>
|
||||||
<title><?php echo $page_title; ?></title>
|
<title><?php echo $page_title; ?></title>
|
||||||
|
|
||||||
<?php if (Configure::read('debug') == 0): ?>
|
<?php if (!Configure::read('debug')): ?>
|
||||||
<meta http-equiv="Refresh" content="<?php echo $pause; ?>;url=<?php echo $url; ?>"/>
|
<meta http-equiv="Refresh" content="<?php echo $pause; ?>;url=<?php echo $url; ?>"/>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<style><!--
|
<style><!--
|
||||||
|
|
|
@ -462,7 +462,7 @@ class PhpAro {
|
||||||
$mapped = '';
|
$mapped = '';
|
||||||
|
|
||||||
if (is_array($aro)) {
|
if (is_array($aro)) {
|
||||||
if (isset($aro['model']) && isset($aro['foreign_key']) && $aro['model'] == $aroGroup) {
|
if (isset($aro['model']) && isset($aro['foreign_key']) && $aro['model'] === $aroGroup) {
|
||||||
$mapped = $aroGroup . '/' . $aro['foreign_key'];
|
$mapped = $aroGroup . '/' . $aro['foreign_key'];
|
||||||
} elseif (isset($aro[$model][$field])) {
|
} elseif (isset($aro[$model][$field])) {
|
||||||
$mapped = $aroGroup . '/' . $aro[$model][$field];
|
$mapped = $aroGroup . '/' . $aro[$model][$field];
|
||||||
|
@ -479,7 +479,7 @@ class PhpAro {
|
||||||
|
|
||||||
$aroModel = Inflector::camelize($aroModel);
|
$aroModel = Inflector::camelize($aroModel);
|
||||||
|
|
||||||
if ($aroModel == $model || $aroModel == $aroGroup) {
|
if ($aroModel === $model || $aroModel === $aroGroup) {
|
||||||
$mapped = $aroGroup . '/' . $aroValue;
|
$mapped = $aroGroup . '/' . $aroValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -723,7 +723,7 @@ class AuthComponent extends Component {
|
||||||
$redir = $this->Session->read('Auth.redirect');
|
$redir = $this->Session->read('Auth.redirect');
|
||||||
$this->Session->delete('Auth.redirect');
|
$this->Session->delete('Auth.redirect');
|
||||||
|
|
||||||
if (Router::normalize($redir) == Router::normalize($this->loginAction)) {
|
if (Router::normalize($redir) === Router::normalize($this->loginAction)) {
|
||||||
$redir = $this->loginRedirect;
|
$redir = $this->loginRedirect;
|
||||||
}
|
}
|
||||||
} elseif ($this->loginRedirect) {
|
} elseif ($this->loginRedirect) {
|
||||||
|
|
|
@ -392,7 +392,7 @@ class PaginatorComponent extends Component {
|
||||||
if (strpos($key, '.') !== false) {
|
if (strpos($key, '.') !== false) {
|
||||||
list($alias, $field) = explode('.', $key);
|
list($alias, $field) = explode('.', $key);
|
||||||
}
|
}
|
||||||
$correctAlias = ($object->alias == $alias);
|
$correctAlias = ($object->alias === $alias);
|
||||||
|
|
||||||
if ($correctAlias && $object->hasField($field)) {
|
if ($correctAlias && $object->hasField($field)) {
|
||||||
$order[$object->alias . '.' . $field] = $value;
|
$order[$object->alias . '.' . $field] = $value;
|
||||||
|
|
|
@ -525,7 +525,7 @@ class RequestHandlerComponent extends Component {
|
||||||
return $this->mapType($contentType);
|
return $this->mapType($contentType);
|
||||||
}
|
}
|
||||||
if (is_string($type)) {
|
if (is_string($type)) {
|
||||||
return ($type == $this->mapType($contentType));
|
return ($type === $this->mapType($contentType));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -230,7 +230,7 @@ class SecurityComponent extends Component {
|
||||||
$controller->request->params['requested'] != 1
|
$controller->request->params['requested'] != 1
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($this->_action == $this->blackHoleCallback) {
|
if ($this->_action === $this->blackHoleCallback) {
|
||||||
return $this->blackHole($controller, 'auth');
|
return $this->blackHole($controller, 'auth');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -362,7 +362,7 @@ class SecurityComponent extends Component {
|
||||||
$property = 'require' . $method;
|
$property = 'require' . $method;
|
||||||
if (is_array($this->$property) && !empty($this->$property)) {
|
if (is_array($this->$property) && !empty($this->$property)) {
|
||||||
$require = $this->$property;
|
$require = $this->$property;
|
||||||
if (in_array($this->_action, $require) || $this->$property == array('*')) {
|
if (in_array($this->_action, $require) || $this->$property === array('*')) {
|
||||||
if (!$this->request->is($method)) {
|
if (!$this->request->is($method)) {
|
||||||
if (!$this->blackHole($controller, $method)) {
|
if (!$this->blackHole($controller, $method)) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -384,7 +384,7 @@ class SecurityComponent extends Component {
|
||||||
if (is_array($this->requireSecure) && !empty($this->requireSecure)) {
|
if (is_array($this->requireSecure) && !empty($this->requireSecure)) {
|
||||||
$requireSecure = $this->requireSecure;
|
$requireSecure = $this->requireSecure;
|
||||||
|
|
||||||
if (in_array($this->_action, $requireSecure) || $this->requireSecure == array('*')) {
|
if (in_array($this->_action, $requireSecure) || $this->requireSecure === array('*')) {
|
||||||
if (!$this->request->is('ssl')) {
|
if (!$this->request->is('ssl')) {
|
||||||
if (!$this->blackHole($controller, 'secure')) {
|
if (!$this->blackHole($controller, 'secure')) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -405,7 +405,7 @@ class SecurityComponent extends Component {
|
||||||
if (is_array($this->requireAuth) && !empty($this->requireAuth) && !empty($this->request->data)) {
|
if (is_array($this->requireAuth) && !empty($this->requireAuth) && !empty($this->request->data)) {
|
||||||
$requireAuth = $this->requireAuth;
|
$requireAuth = $this->requireAuth;
|
||||||
|
|
||||||
if (in_array($this->request->params['action'], $requireAuth) || $this->requireAuth == array('*')) {
|
if (in_array($this->request->params['action'], $requireAuth) || $this->requireAuth === array('*')) {
|
||||||
if (!isset($controller->request->data['_Token'])) {
|
if (!isset($controller->request->data['_Token'])) {
|
||||||
if (!$this->blackHole($controller, 'auth')) {
|
if (!$this->blackHole($controller, 'auth')) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -668,7 +668,7 @@ class App {
|
||||||
$type = 'Console';
|
$type = 'Console';
|
||||||
} elseif (isset(self::$types[$originalType]['suffix'])) {
|
} elseif (isset(self::$types[$originalType]['suffix'])) {
|
||||||
$suffix = self::$types[$originalType]['suffix'];
|
$suffix = self::$types[$originalType]['suffix'];
|
||||||
$name .= ($suffix == $name) ? '' : $suffix;
|
$name .= ($suffix === $name) ? '' : $suffix;
|
||||||
}
|
}
|
||||||
if ($parent && isset(self::$types[$originalType]['extends'])) {
|
if ($parent && isset(self::$types[$originalType]['extends'])) {
|
||||||
$extends = self::$types[$originalType]['extends'];
|
$extends = self::$types[$originalType]['extends'];
|
||||||
|
|
|
@ -92,7 +92,8 @@ class ExceptionRenderer {
|
||||||
$this->controller = $this->_getController($exception);
|
$this->controller = $this->_getController($exception);
|
||||||
|
|
||||||
if (method_exists($this->controller, 'appError')) {
|
if (method_exists($this->controller, 'appError')) {
|
||||||
return $this->controller->appError($exception);
|
$this->controller->appError($exception);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
$method = $template = Inflector::variable(str_replace('Exception', '', get_class($exception)));
|
$method = $template = Inflector::variable(str_replace('Exception', '', get_class($exception)));
|
||||||
$code = $exception->getCode();
|
$code = $exception->getCode();
|
||||||
|
|
|
@ -165,7 +165,7 @@ class FileLog extends BaseLog {
|
||||||
|
|
||||||
if (!empty($this->_file)) {
|
if (!empty($this->_file)) {
|
||||||
$filename = $this->_file;
|
$filename = $this->_file;
|
||||||
} elseif ($type == 'error' || $type == 'warning') {
|
} elseif ($type === 'error' || $type === 'warning') {
|
||||||
$filename = 'error.log';
|
$filename = 'error.log';
|
||||||
} elseif (in_array($type, $debugTypes)) {
|
} elseif (in_array($type, $debugTypes)) {
|
||||||
$filename = 'debug.log';
|
$filename = 'debug.log';
|
||||||
|
|
|
@ -188,7 +188,7 @@ class ContainableBehavior extends ModelBehavior {
|
||||||
foreach (array('hasOne', 'belongsTo') as $type) {
|
foreach (array('hasOne', 'belongsTo') as $type) {
|
||||||
if (!empty($Model->{$type})) {
|
if (!empty($Model->{$type})) {
|
||||||
foreach ($Model->{$type} as $assoc => $data) {
|
foreach ($Model->{$type} as $assoc => $data) {
|
||||||
if ($Model->useDbConfig == $Model->{$assoc}->useDbConfig && !empty($data['fields'])) {
|
if ($Model->useDbConfig === $Model->{$assoc}->useDbConfig && !empty($data['fields'])) {
|
||||||
foreach ((array)$data['fields'] as $field) {
|
foreach ((array)$data['fields'] as $field) {
|
||||||
$query['fields'][] = (strpos($field, '.') === false ? $assoc . '.' : '') . $field;
|
$query['fields'][] = (strpos($field, '.') === false ? $assoc . '.' : '') . $field;
|
||||||
}
|
}
|
||||||
|
@ -203,7 +203,7 @@ class ContainableBehavior extends ModelBehavior {
|
||||||
$field = $Model->primaryKey;
|
$field = $Model->primaryKey;
|
||||||
} elseif (preg_match('/^.+\.\-\-[^-]+\-\-$/', $field)) {
|
} elseif (preg_match('/^.+\.\-\-[^-]+\-\-$/', $field)) {
|
||||||
list($modelName, $field) = explode('.', $field);
|
list($modelName, $field) = explode('.', $field);
|
||||||
if ($Model->useDbConfig == $Model->{$modelName}->useDbConfig) {
|
if ($Model->useDbConfig === $Model->{$modelName}->useDbConfig) {
|
||||||
$field = $modelName . '.' . (
|
$field = $modelName . '.' . (
|
||||||
($field === '--primaryKey--') ? $Model->$modelName->primaryKey : $field
|
($field === '--primaryKey--') ? $Model->$modelName->primaryKey : $field
|
||||||
);
|
);
|
||||||
|
|
|
@ -121,7 +121,7 @@ class TranslateBehavior extends ModelBehavior {
|
||||||
$this->_joinTable = $joinTable;
|
$this->_joinTable = $joinTable;
|
||||||
$this->_runtimeModel = $RuntimeModel;
|
$this->_runtimeModel = $RuntimeModel;
|
||||||
|
|
||||||
if (is_string($query['fields']) && "COUNT(*) AS {$db->name('count')}" == $query['fields']) {
|
if (is_string($query['fields']) && $query['fields'] === "COUNT(*) AS {$db->name('count')}") {
|
||||||
$query['fields'] = "COUNT(DISTINCT({$db->name($Model->escapeField())})) {$db->alias}count";
|
$query['fields'] = "COUNT(DISTINCT({$db->name($Model->escapeField())})) {$db->alias}count";
|
||||||
$query['joins'][] = array(
|
$query['joins'][] = array(
|
||||||
'type' => 'INNER',
|
'type' => 'INNER',
|
||||||
|
|
|
@ -228,7 +228,8 @@ class TreeBehavior extends ModelBehavior {
|
||||||
|
|
||||||
if (($node[$left] < $parentNode[$left]) && ($parentNode[$right] < $node[$right])) {
|
if (($node[$left] < $parentNode[$left]) && ($parentNode[$right] < $node[$right])) {
|
||||||
return false;
|
return false;
|
||||||
} elseif ($node[$Model->primaryKey] == $parentNode[$Model->primaryKey]) {
|
}
|
||||||
|
if ($node[$Model->primaryKey] === $parentNode[$Model->primaryKey]) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -951,7 +952,7 @@ class TreeBehavior extends ModelBehavior {
|
||||||
}
|
}
|
||||||
$parentNode = $parentNode[0];
|
$parentNode = $parentNode[0];
|
||||||
|
|
||||||
if (($Model->id == $parentId)) {
|
if (($Model->id === $parentId)) {
|
||||||
return false;
|
return false;
|
||||||
} elseif (($node[$left] < $parentNode[$left]) && ($parentNode[$right] < $node[$right])) {
|
} elseif (($node[$left] < $parentNode[$left]) && ($parentNode[$right] < $node[$right])) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -190,7 +190,7 @@ class BehaviorCollection extends ObjectCollection implements CakeEventListener {
|
||||||
parent::unload($name);
|
parent::unload($name);
|
||||||
}
|
}
|
||||||
foreach ($this->_methods as $m => $callback) {
|
foreach ($this->_methods as $m => $callback) {
|
||||||
if (is_array($callback) && $callback[0] == $name) {
|
if (is_array($callback) && $callback[0] === $name) {
|
||||||
unset($this->_methods[$m]);
|
unset($this->_methods[$m]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -230,7 +230,7 @@ class CakeSchema extends Object {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($this->plugin)) {
|
if (isset($this->plugin)) {
|
||||||
if ($model == $this->plugin . 'AppModel') {
|
if ($model === $this->plugin . 'AppModel') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$importModel = $model;
|
$importModel = $model;
|
||||||
|
@ -608,7 +608,7 @@ class CakeSchema extends Object {
|
||||||
|
|
||||||
$columns = array();
|
$columns = array();
|
||||||
foreach ($fields as $name => $value) {
|
foreach ($fields as $name => $value) {
|
||||||
if ($Obj->primaryKey == $name) {
|
if ($Obj->primaryKey === $name) {
|
||||||
$value['key'] = 'primary';
|
$value['key'] = 'primary';
|
||||||
}
|
}
|
||||||
if (!isset($db->columns[$value['type']])) {
|
if (!isset($db->columns[$value['type']])) {
|
||||||
|
|
|
@ -398,7 +398,7 @@ class Mysql extends DboSource {
|
||||||
|
|
||||||
if (!empty($conditions)) {
|
if (!empty($conditions)) {
|
||||||
$alias = $this->name($model->alias);
|
$alias = $this->name($model->alias);
|
||||||
if ($model->name == $model->alias) {
|
if ($model->name === $model->alias) {
|
||||||
$joins = implode(' ', $this->_getJoins($model));
|
$joins = implode(' ', $this->_getJoins($model));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -527,7 +527,7 @@ class Mysql extends DboSource {
|
||||||
$colList = array();
|
$colList = array();
|
||||||
foreach ($compare as $curTable => $types) {
|
foreach ($compare as $curTable => $types) {
|
||||||
$indexes = $tableParameters = $colList = array();
|
$indexes = $tableParameters = $colList = array();
|
||||||
if (!$table || $table == $curTable) {
|
if (!$table || $table === $curTable) {
|
||||||
$out .= 'ALTER TABLE ' . $this->fullTableName($curTable) . " \n";
|
$out .= 'ALTER TABLE ' . $this->fullTableName($curTable) . " \n";
|
||||||
foreach ($types as $type => $column) {
|
foreach ($types as $type => $column) {
|
||||||
if (isset($column['indexes'])) {
|
if (isset($column['indexes'])) {
|
||||||
|
|
|
@ -240,7 +240,7 @@ class Postgres extends DboSource {
|
||||||
'length' => $length
|
'length' => $length
|
||||||
);
|
);
|
||||||
if ($model instanceof Model) {
|
if ($model instanceof Model) {
|
||||||
if ($c->name == $model->primaryKey) {
|
if ($c->name === $model->primaryKey) {
|
||||||
$fields[$c->name]['key'] = 'primary';
|
$fields[$c->name]['key'] = 'primary';
|
||||||
if ($fields[$c->name]['type'] !== 'string') {
|
if ($fields[$c->name]['type'] !== 'string') {
|
||||||
$fields[$c->name]['length'] = 11;
|
$fields[$c->name]['length'] = 11;
|
||||||
|
@ -509,7 +509,7 @@ class Postgres extends DboSource {
|
||||||
$colList = array();
|
$colList = array();
|
||||||
foreach ($compare as $curTable => $types) {
|
foreach ($compare as $curTable => $types) {
|
||||||
$indexes = $colList = array();
|
$indexes = $colList = array();
|
||||||
if (!$table || $table == $curTable) {
|
if (!$table || $table === $curTable) {
|
||||||
$out .= 'ALTER TABLE ' . $this->fullTableName($curTable) . " \n";
|
$out .= 'ALTER TABLE ' . $this->fullTableName($curTable) . " \n";
|
||||||
foreach ($types as $type => $column) {
|
foreach ($types as $type => $column) {
|
||||||
if (isset($column['indexes'])) {
|
if (isset($column['indexes'])) {
|
||||||
|
@ -540,7 +540,7 @@ class Postgres extends DboSource {
|
||||||
|
|
||||||
$default = isset($col['default']) ? $col['default'] : null;
|
$default = isset($col['default']) ? $col['default'] : null;
|
||||||
$nullable = isset($col['null']) ? $col['null'] : null;
|
$nullable = isset($col['null']) ? $col['null'] : null;
|
||||||
$boolToInt = $original['type'] == 'boolean' && $col['type'] == 'integer';
|
$boolToInt = $original['type'] === 'boolean' && $col['type'] === 'integer';
|
||||||
unset($col['default'], $col['null']);
|
unset($col['default'], $col['null']);
|
||||||
if ($field !== $col['name']) {
|
if ($field !== $col['name']) {
|
||||||
$newName = $this->name($col['name']);
|
$newName = $this->name($col['name']);
|
||||||
|
|
|
@ -688,7 +688,7 @@ class Sqlserver extends DboSource {
|
||||||
} else {
|
} else {
|
||||||
$result = str_replace('DEFAULT NULL', 'NULL', $result);
|
$result = str_replace('DEFAULT NULL', 'NULL', $result);
|
||||||
}
|
}
|
||||||
} elseif (array_keys($column) == array('type', 'name')) {
|
} elseif (array_keys($column) === array('type', 'name')) {
|
||||||
$result .= ' NULL';
|
$result .= ' NULL';
|
||||||
} elseif (strpos($result, "DEFAULT N'")) {
|
} elseif (strpos($result, "DEFAULT N'")) {
|
||||||
$result = str_replace("DEFAULT N'", "DEFAULT '", $result);
|
$result = str_replace("DEFAULT N'", "DEFAULT '", $result);
|
||||||
|
|
|
@ -998,7 +998,7 @@ class DboSource extends DataSource {
|
||||||
for ($i = 0; $i < $count; $i++) {
|
for ($i = 0; $i < $count; $i++) {
|
||||||
$valueInsert[] = $this->value($values[$i], $Model->getColumnType($fields[$i]));
|
$valueInsert[] = $this->value($values[$i], $Model->getColumnType($fields[$i]));
|
||||||
$fieldInsert[] = $this->name($fields[$i]);
|
$fieldInsert[] = $this->name($fields[$i]);
|
||||||
if ($fields[$i] == $Model->primaryKey) {
|
if ($fields[$i] === $Model->primaryKey) {
|
||||||
$id = $values[$i];
|
$id = $values[$i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3196,7 +3196,7 @@ class DboSource extends DataSource {
|
||||||
$out = '';
|
$out = '';
|
||||||
|
|
||||||
foreach ($schema->tables as $curTable => $columns) {
|
foreach ($schema->tables as $curTable => $columns) {
|
||||||
if (!$tableName || $tableName == $curTable) {
|
if (!$tableName || $tableName === $curTable) {
|
||||||
$cols = $indexes = $tableParameters = array();
|
$cols = $indexes = $tableParameters = array();
|
||||||
$primary = null;
|
$primary = null;
|
||||||
$table = $this->fullTableName($curTable);
|
$table = $this->fullTableName($curTable);
|
||||||
|
|
|
@ -1488,7 +1488,7 @@ class Model extends Object implements CakeEventListener {
|
||||||
|
|
||||||
if (strpos($field, '.') !== false) {
|
if (strpos($field, '.') !== false) {
|
||||||
list($model, $field) = explode('.', $field);
|
list($model, $field) = explode('.', $field);
|
||||||
if ($model == $this->alias && isset($this->virtualFields[$field])) {
|
if ($model === $this->alias && isset($this->virtualFields[$field])) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1932,7 +1932,7 @@ class Model extends Object implements CakeEventListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ((array)$data as $row) {
|
foreach ((array)$data as $row) {
|
||||||
if ((is_string($row) && (strlen($row) == 36 || strlen($row) == 16)) || is_numeric($row)) {
|
if ((is_string($row) && (strlen($row) === 36 || strlen($row) === 16)) || is_numeric($row)) {
|
||||||
$newJoins[] = $row;
|
$newJoins[] = $row;
|
||||||
$values = array($id, $row);
|
$values = array($id, $row);
|
||||||
|
|
||||||
|
@ -3480,7 +3480,7 @@ class Model extends Object implements CakeEventListener {
|
||||||
if (!empty($oldConfig) && isset($db->config['prefix'])) {
|
if (!empty($oldConfig) && isset($db->config['prefix'])) {
|
||||||
$oldDb = ConnectionManager::getDataSource($oldConfig);
|
$oldDb = ConnectionManager::getDataSource($oldConfig);
|
||||||
|
|
||||||
if (!isset($this->tablePrefix) || (!isset($oldDb->config['prefix']) || $this->tablePrefix == $oldDb->config['prefix'])) {
|
if (!isset($this->tablePrefix) || (!isset($oldDb->config['prefix']) || $this->tablePrefix === $oldDb->config['prefix'])) {
|
||||||
$this->tablePrefix = $db->config['prefix'];
|
$this->tablePrefix = $db->config['prefix'];
|
||||||
}
|
}
|
||||||
} elseif (isset($db->config['prefix'])) {
|
} elseif (isset($db->config['prefix'])) {
|
||||||
|
|
|
@ -859,7 +859,7 @@ class CakeRequest implements ArrayAccess {
|
||||||
*/
|
*/
|
||||||
public function data($name) {
|
public function data($name) {
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
if (count($args) == 2) {
|
if (count($args) === 2) {
|
||||||
$this->data = Hash::insert($this->data, $name, $args[1]);
|
$this->data = Hash::insert($this->data, $name, $args[1]);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1151,7 +1151,7 @@ class CakeResponse {
|
||||||
$etagMatches = in_array('*', $etags) || in_array($responseTag, $etags);
|
$etagMatches = in_array('*', $etags) || in_array($responseTag, $etags);
|
||||||
}
|
}
|
||||||
if ($modifiedSince) {
|
if ($modifiedSince) {
|
||||||
$timeMatches = strtotime($this->modified()) == strtotime($modifiedSince);
|
$timeMatches = strtotime($this->modified()) === strtotime($modifiedSince);
|
||||||
}
|
}
|
||||||
$checks = compact('etagMatches', 'timeMatches');
|
$checks = compact('etagMatches', 'timeMatches');
|
||||||
if (empty($checks)) {
|
if (empty($checks)) {
|
||||||
|
|
|
@ -141,7 +141,7 @@ class AssetDispatcher extends DispatcherFilter {
|
||||||
protected function _deliverAsset(CakeResponse $response, $assetFile, $ext) {
|
protected function _deliverAsset(CakeResponse $response, $assetFile, $ext) {
|
||||||
ob_start();
|
ob_start();
|
||||||
$compressionEnabled = Configure::read('Asset.compress') && $response->compress();
|
$compressionEnabled = Configure::read('Asset.compress') && $response->compress();
|
||||||
if ($response->type($ext) == $ext) {
|
if ($response->type($ext) === $ext) {
|
||||||
$contentType = 'application/octet-stream';
|
$contentType = 'application/octet-stream';
|
||||||
$agent = env('HTTP_USER_AGENT');
|
$agent = env('HTTP_USER_AGENT');
|
||||||
if (preg_match('%Opera(/| )([0-9].[0-9]{1,2})%', $agent) || preg_match('/MSIE ([0-9].[0-9]{1,2})/', $agent)) {
|
if (preg_match('%Opera(/| )([0-9].[0-9]{1,2})%', $agent) || preg_match('/MSIE ([0-9].[0-9]{1,2})/', $agent)) {
|
||||||
|
|
|
@ -700,10 +700,10 @@ class Router {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the either the current request object, or the first one.
|
* Gets the current request object, or the first one.
|
||||||
*
|
*
|
||||||
* @param boolean $current Whether you want the request from the top of the stack or the first one.
|
* @param boolean $current True to get the current request object, or false to get the first one.
|
||||||
* @return CakeRequest or null.
|
* @return CakeRequest|null Null if stack is empty.
|
||||||
*/
|
*/
|
||||||
public static function getRequest($current = false) {
|
public static function getRequest($current = false) {
|
||||||
if ($current) {
|
if ($current) {
|
||||||
|
|
|
@ -1034,7 +1034,7 @@ EXPECTED;
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testPr() {
|
public function testPr() {
|
||||||
$this->skipIf(php_sapi_name() == 'cli', 'Skipping web test in cli mode');
|
$this->skipIf(php_sapi_name() === 'cli', 'Skipping web test in cli mode');
|
||||||
ob_start();
|
ob_start();
|
||||||
pr('this is a test');
|
pr('this is a test');
|
||||||
$result = ob_get_clean();
|
$result = ob_get_clean();
|
||||||
|
|
|
@ -1132,7 +1132,6 @@ class SecurityComponentTest extends CakeTestCase {
|
||||||
$this->assertFalse($this->Controller->Security->validatePost($this->Controller));
|
$this->assertFalse($this->Controller->Security->validatePost($this->Controller));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test that a requestAction's controller will have the _Token appended to
|
* test that a requestAction's controller will have the _Token appended to
|
||||||
* the params.
|
* the params.
|
||||||
|
|
|
@ -663,7 +663,7 @@ class CakeSessionTest extends CakeTestCase {
|
||||||
$this->assertEquals($expected, TestCakeSession::id());
|
$this->assertEquals($expected, TestCakeSession::id());
|
||||||
|
|
||||||
TestCakeSession::renew();
|
TestCakeSession::renew();
|
||||||
$this->assertFalse($expected == TestCakeSession::id());
|
$this->assertFalse($expected === TestCakeSession::id());
|
||||||
|
|
||||||
$expected = session_id();
|
$expected = session_id();
|
||||||
$this->assertEquals($expected, TestCakeSession::id());
|
$this->assertEquals($expected, TestCakeSession::id());
|
||||||
|
|
|
@ -1144,11 +1144,14 @@ class MysqlTest extends CakeTestCase {
|
||||||
$linkModel = $this->Model->Category2->{$assoc};
|
$linkModel = $this->Model->Category2->{$assoc};
|
||||||
$external = isset($assocData['external']);
|
$external = isset($assocData['external']);
|
||||||
|
|
||||||
if ($this->Model->Category2->alias == $linkModel->alias && $type !== 'hasAndBelongsToMany' && $type !== 'hasMany') {
|
if ($this->Model->Category2->alias === $linkModel->alias &&
|
||||||
|
$type !== 'hasAndBelongsToMany' &&
|
||||||
|
$type !== 'hasMany'
|
||||||
|
) {
|
||||||
$result = $this->Dbo->generateAssociationQuery($this->Model->Category2, $linkModel, $type, $assoc, $assocData, $queryData, $external);
|
$result = $this->Dbo->generateAssociationQuery($this->Model->Category2, $linkModel, $type, $assoc, $assocData, $queryData, $external);
|
||||||
$this->assertFalse(empty($result));
|
$this->assertFalse(empty($result));
|
||||||
} else {
|
} else {
|
||||||
if ($this->Model->Category2->useDbConfig == $linkModel->useDbConfig) {
|
if ($this->Model->Category2->useDbConfig === $linkModel->useDbConfig) {
|
||||||
$result = $this->Dbo->generateAssociationQuery($this->Model->Category2, $linkModel, $type, $assoc, $assocData, $queryData, $external);
|
$result = $this->Dbo->generateAssociationQuery($this->Model->Category2, $linkModel, $type, $assoc, $assocData, $queryData, $external);
|
||||||
$this->assertFalse(empty($result));
|
$this->assertFalse(empty($result));
|
||||||
}
|
}
|
||||||
|
@ -3173,9 +3176,9 @@ class MysqlTest extends CakeTestCase {
|
||||||
*
|
*
|
||||||
* @param array $data Column data
|
* @param array $data Column data
|
||||||
* @param string $expected Expected sql part
|
* @param string $expected Expected sql part
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
* @dataProvider buildColumnUnsignedProvider
|
* @dataProvider buildColumnUnsignedProvider
|
||||||
*/
|
*/
|
||||||
public function testBuildColumnUnsigned($data, $expected) {
|
public function testBuildColumnUnsigned($data, $expected) {
|
||||||
|
@ -3281,7 +3284,7 @@ class MysqlTest extends CakeTestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test getting `unsigned` field parameter from DB
|
* Test getting `unsigned` field parameter from DB
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testSchemaUnsigned() {
|
public function testSchemaUnsigned() {
|
||||||
|
|
|
@ -127,7 +127,7 @@ class HtmlCoverageReportTest extends CakeTestCase {
|
||||||
if (in_array($i + 1, array(5, 9, 2))) {
|
if (in_array($i + 1, array(5, 9, 2))) {
|
||||||
$class = 'uncovered';
|
$class = 'uncovered';
|
||||||
}
|
}
|
||||||
if ($i + 1 == 2) {
|
if ($i + 1 === 2) {
|
||||||
$class .= ' dead';
|
$class .= ' dead';
|
||||||
}
|
}
|
||||||
$this->assertTrue(strpos($class, $result) !== 0, 'Class name is wrong ' . $i);
|
$this->assertTrue(strpos($class, $result) !== 0, 'Class name is wrong ' . $i);
|
||||||
|
@ -175,7 +175,7 @@ class HtmlCoverageReportTest extends CakeTestCase {
|
||||||
if (in_array($i + 1, array(5, 9, 2))) {
|
if (in_array($i + 1, array(5, 9, 2))) {
|
||||||
$class = 'uncovered';
|
$class = 'uncovered';
|
||||||
}
|
}
|
||||||
if ($i + 1 == 2) {
|
if ($i + 1 === 2) {
|
||||||
$class .= ' dead';
|
$class .= ' dead';
|
||||||
}
|
}
|
||||||
$this->assertTrue(strpos($class, $result) !== 0, 'Class name is wrong ' . $i);
|
$this->assertTrue(strpos($class, $result) !== 0, 'Class name is wrong ' . $i);
|
||||||
|
|
|
@ -516,8 +516,8 @@ TEXT;
|
||||||
Debugger::dump($var);
|
Debugger::dump($var);
|
||||||
$result = ob_get_clean();
|
$result = ob_get_clean();
|
||||||
|
|
||||||
$open = php_sapi_name() == 'cli' ? "\n" : '<pre>';
|
$open = php_sapi_name() === 'cli' ? "\n" : '<pre>';
|
||||||
$close = php_sapi_name() == 'cli' ? "\n" : '</pre>';
|
$close = php_sapi_name() === 'cli' ? "\n" : '</pre>';
|
||||||
$expected = <<<TEXT
|
$expected = <<<TEXT
|
||||||
{$open}array(
|
{$open}array(
|
||||||
'People' => array(
|
'People' => array(
|
||||||
|
|
|
@ -7668,6 +7668,40 @@ class FormHelperTest extends CakeTestCase {
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test that security hashes for postLink include the url.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testPostLinkSecurityHash() {
|
||||||
|
$hash = Security::hash(
|
||||||
|
'/posts/delete/1' .
|
||||||
|
serialize(array()) .
|
||||||
|
'' .
|
||||||
|
Configure::read('Security.salt')
|
||||||
|
);
|
||||||
|
$hash .= '%3A';
|
||||||
|
$this->Form->request->params['_Token']['key'] = 'test';
|
||||||
|
|
||||||
|
$result = $this->Form->postLink('Delete', '/posts/delete/1');
|
||||||
|
$this->assertTags($result, array(
|
||||||
|
'form' => array(
|
||||||
|
'method' => 'post', 'action' => '/posts/delete/1',
|
||||||
|
'name', 'id', 'style' => 'display:none;'
|
||||||
|
),
|
||||||
|
array('input' => array('type' => 'hidden', 'name' => '_method', 'value' => 'POST')),
|
||||||
|
array('input' => array('type' => 'hidden', 'name' => 'data[_Token][key]', 'value' => 'test', 'id')),
|
||||||
|
'div' => array('style' => 'display:none;'),
|
||||||
|
array('input' => array('type' => 'hidden', 'name' => 'data[_Token][fields]', 'value' => $hash, 'id')),
|
||||||
|
array('input' => array('type' => 'hidden', 'name' => 'data[_Token][unlocked]', 'value' => '', 'id')),
|
||||||
|
'/div',
|
||||||
|
'/form',
|
||||||
|
'a' => array('href' => '#', 'onclick' => 'preg:/document\.post_\w+\.submit\(\); event\.returnValue = false; return false;/'),
|
||||||
|
'Delete',
|
||||||
|
'/a'
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test using postLink with N dimensional data.
|
* Test using postLink with N dimensional data.
|
||||||
*
|
*
|
||||||
|
|
|
@ -79,7 +79,7 @@ class TextHelperTest extends CakeTestCase {
|
||||||
*/
|
*/
|
||||||
public function testTextHelperProxyMethodCalls() {
|
public function testTextHelperProxyMethodCalls() {
|
||||||
$methods = array(
|
$methods = array(
|
||||||
'highlight', 'stripLinks', 'truncate', 'excerpt', 'toList',
|
'highlight', 'stripLinks', 'truncate', 'tail', 'excerpt', 'toList',
|
||||||
);
|
);
|
||||||
$String = $this->getMock('StringMock', $methods);
|
$String = $this->getMock('StringMock', $methods);
|
||||||
$Text = new TextHelperTestObject($this->View, array('engine' => 'StringMock'));
|
$Text = new TextHelperTestObject($this->View, array('engine' => 'StringMock'));
|
||||||
|
|
|
@ -472,7 +472,7 @@ class CakeTime {
|
||||||
public static function isToday($dateString, $timezone = null) {
|
public static function isToday($dateString, $timezone = null) {
|
||||||
$timestamp = self::fromString($dateString, $timezone);
|
$timestamp = self::fromString($dateString, $timezone);
|
||||||
$now = self::fromString('now', $timezone);
|
$now = self::fromString('now', $timezone);
|
||||||
return date('Y-m-d', $timestamp) == date('Y-m-d', $now);
|
return date('Y-m-d', $timestamp) === date('Y-m-d', $now);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -683,7 +683,7 @@ class Folder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_dir($from) && file_exists($to) && $options['scheme'] == Folder::OVERWRITE) {
|
if (is_dir($from) && file_exists($to) && $options['scheme'] === Folder::OVERWRITE) {
|
||||||
$this->delete($to);
|
$this->delete($to);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -700,7 +700,7 @@ class Folder {
|
||||||
} else {
|
} else {
|
||||||
$this->_errors[] = __d('cake_dev', '%s not created', $to);
|
$this->_errors[] = __d('cake_dev', '%s not created', $to);
|
||||||
}
|
}
|
||||||
} elseif (is_dir($from) && $options['scheme'] == Folder::MERGE) {
|
} elseif (is_dir($from) && $options['scheme'] === Folder::MERGE) {
|
||||||
$options = array('to' => $to, 'from' => $from) + $options;
|
$options = array('to' => $to, 'from' => $from) + $options;
|
||||||
$this->copy($options);
|
$this->copy($options);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1195,7 +1195,7 @@ class FormHelper extends AppHelper {
|
||||||
} elseif (isset($map[$type])) {
|
} elseif (isset($map[$type])) {
|
||||||
$options['type'] = $map[$type];
|
$options['type'] = $map[$type];
|
||||||
}
|
}
|
||||||
if ($fieldKey == $primaryKey) {
|
if ($fieldKey === $primaryKey) {
|
||||||
$options['type'] = 'hidden';
|
$options['type'] = 'hidden';
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
|
@ -1821,6 +1821,8 @@ class FormHelper extends AppHelper {
|
||||||
unset($options['target']);
|
unset($options['target']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->_lastAction = $formUrl;
|
||||||
|
|
||||||
$out = $this->Html->useTag('form', $formUrl, $formOptions);
|
$out = $this->Html->useTag('form', $formUrl, $formOptions);
|
||||||
$out .= $this->Html->useTag('hidden', '_method', array(
|
$out .= $this->Html->useTag('hidden', '_method', array(
|
||||||
'value' => $requestMethod
|
'value' => $requestMethod
|
||||||
|
|
|
@ -454,7 +454,7 @@ class HtmlHelper extends AppHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($options['rel'] == 'import') {
|
if ($options['rel'] === 'import') {
|
||||||
$out = sprintf(
|
$out = sprintf(
|
||||||
$this->_tags['style'],
|
$this->_tags['style'],
|
||||||
$this->_parseAttributes($options, array('rel', 'block'), '', ' '),
|
$this->_parseAttributes($options, array('rel', 'block'), '', ' '),
|
||||||
|
|
|
@ -267,15 +267,16 @@ class TextHelper extends AppHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Truncates text starting from the end.
|
* Truncates text.
|
||||||
*
|
*
|
||||||
* Cuts a string to the length of $length and replaces the first characters
|
* Cuts a string to the length of $length and replaces the last characters
|
||||||
* with the ellipsis if the text is longer than length.
|
* with the ellipsis if the text is longer than length.
|
||||||
*
|
*
|
||||||
* ### Options:
|
* ### Options:
|
||||||
*
|
*
|
||||||
* - `ellipsis` Will be used as Beginning and prepended to the trimmed string
|
* - `ellipsis` Will be used as Ending and appended to the trimmed string (`ending` is deprecated)
|
||||||
* - `exact` If false, $text will not be cut mid-word
|
* - `exact` If false, $text will not be cut mid-word
|
||||||
|
* - `html` If true, HTML tags would be handled correctly
|
||||||
*
|
*
|
||||||
* @see String::truncate()
|
* @see String::truncate()
|
||||||
*
|
*
|
||||||
|
@ -289,6 +290,29 @@ class TextHelper extends AppHelper {
|
||||||
return $this->_engine->truncate($text, $length, $options);
|
return $this->_engine->truncate($text, $length, $options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Truncates text starting from the end.
|
||||||
|
*
|
||||||
|
* Cuts a string to the length of $length and replaces the first characters
|
||||||
|
* with the ellipsis if the text is longer than length.
|
||||||
|
*
|
||||||
|
* ### Options:
|
||||||
|
*
|
||||||
|
* - `ellipsis` Will be used as Beginning and prepended to the trimmed string
|
||||||
|
* - `exact` If false, $text will not be cut mid-word
|
||||||
|
*
|
||||||
|
* @see String::tail()
|
||||||
|
*
|
||||||
|
* @param string $text String to truncate.
|
||||||
|
* @param integer $length Length of returned string, including ellipsis.
|
||||||
|
* @param array $options An array of html attributes and options.
|
||||||
|
* @return string Trimmed string.
|
||||||
|
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/text.html#TextHelper::tail
|
||||||
|
*/
|
||||||
|
public function tail($text, $length = 100, $options = array()) {
|
||||||
|
return $this->_engine->tail($text, $length, $options);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extracts an excerpt from the text surrounding the phrase with a number of characters on each side
|
* Extracts an excerpt from the text surrounding the phrase with a number of characters on each side
|
||||||
* determined by radius.
|
* determined by radius.
|
||||||
|
|
|
@ -388,13 +388,12 @@ class View extends Object {
|
||||||
* If an array, the following keys can be used:
|
* If an array, the following keys can be used:
|
||||||
* - `config` - Used to store the cached element in a custom cache configuration.
|
* - `config` - Used to store the cached element in a custom cache configuration.
|
||||||
* - `key` - Used to define the key used in the Cache::write(). It will be prefixed with `element_`
|
* - `key` - Used to define the key used in the Cache::write(). It will be prefixed with `element_`
|
||||||
* - `plugin` - Load an element from a specific plugin. This option is deprecated, see below.
|
* - `plugin` - (deprecated!) Load an element from a specific plugin. This option is deprecated, and
|
||||||
|
* will be removed in CakePHP 3.0. Use `Plugin.element_name` instead.
|
||||||
* - `callbacks` - Set to true to fire beforeRender and afterRender helper callbacks for this element.
|
* - `callbacks` - Set to true to fire beforeRender and afterRender helper callbacks for this element.
|
||||||
* Defaults to false.
|
* Defaults to false.
|
||||||
* - `ignoreMissing` - Used to allow missing elements. Set to true to not trigger notices.
|
* - `ignoreMissing` - Used to allow missing elements. Set to true to not trigger notices.
|
||||||
* @return string Rendered Element
|
* @return string Rendered Element
|
||||||
* @deprecated The `$options['plugin']` is deprecated and will be removed in CakePHP 3.0. Use
|
|
||||||
* `Plugin.element_name` instead.
|
|
||||||
*/
|
*/
|
||||||
public function element($name, $data = array(), $options = array()) {
|
public function element($name, $data = array(), $options = array()) {
|
||||||
$file = $plugin = null;
|
$file = $plugin = null;
|
||||||
|
|
Loading…
Reference in a new issue