mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge branch 'master' into 2.6
Conflicts: lib/Cake/VERSION.txt
This commit is contained in:
commit
4d6611b328
36 changed files with 260 additions and 95 deletions
|
@ -334,8 +334,7 @@ class SchemaShell extends AppShell {
|
||||||
$this->out("\n" . __d('cake_console', 'The following table(s) will be dropped.'));
|
$this->out("\n" . __d('cake_console', 'The following table(s) will be dropped.'));
|
||||||
$this->out(array_keys($drop));
|
$this->out(array_keys($drop));
|
||||||
|
|
||||||
if (
|
if (!empty($this->params['yes']) ||
|
||||||
!empty($this->params['yes']) ||
|
|
||||||
$this->in(__d('cake_console', 'Are you sure you want to drop the table(s)?'), array('y', 'n'), 'n') === 'y'
|
$this->in(__d('cake_console', 'Are you sure you want to drop the table(s)?'), array('y', 'n'), 'n') === 'y'
|
||||||
) {
|
) {
|
||||||
$this->out(__d('cake_console', 'Dropping table(s).'));
|
$this->out(__d('cake_console', 'Dropping table(s).'));
|
||||||
|
@ -345,8 +344,7 @@ class SchemaShell extends AppShell {
|
||||||
$this->out("\n" . __d('cake_console', 'The following table(s) will be created.'));
|
$this->out("\n" . __d('cake_console', 'The following table(s) will be created.'));
|
||||||
$this->out(array_keys($create));
|
$this->out(array_keys($create));
|
||||||
|
|
||||||
if (
|
if (!empty($this->params['yes']) ||
|
||||||
!empty($this->params['yes']) ||
|
|
||||||
$this->in(__d('cake_console', 'Are you sure you want to create the table(s)?'), array('y', 'n'), 'y') === 'y'
|
$this->in(__d('cake_console', 'Are you sure you want to create the table(s)?'), array('y', 'n'), 'y') === 'y'
|
||||||
) {
|
) {
|
||||||
$this->out(__d('cake_console', 'Creating table(s).'));
|
$this->out(__d('cake_console', 'Creating table(s).'));
|
||||||
|
@ -399,8 +397,7 @@ class SchemaShell extends AppShell {
|
||||||
|
|
||||||
$this->out("\n" . __d('cake_console', 'The following statements will run.'));
|
$this->out("\n" . __d('cake_console', 'The following statements will run.'));
|
||||||
$this->out(array_map('trim', $contents));
|
$this->out(array_map('trim', $contents));
|
||||||
if (
|
if (!empty($this->params['yes']) ||
|
||||||
!empty($this->params['yes']) ||
|
|
||||||
$this->in(__d('cake_console', 'Are you sure you want to alter the tables?'), array('y', 'n'), 'n') === 'y'
|
$this->in(__d('cake_console', 'Are you sure you want to alter the tables?'), array('y', 'n'), 'n') === 'y'
|
||||||
) {
|
) {
|
||||||
$this->out();
|
$this->out();
|
||||||
|
|
|
@ -242,8 +242,8 @@ class FixtureTask extends BakeTask {
|
||||||
$this->_Schema = new CakeSchema();
|
$this->_Schema = new CakeSchema();
|
||||||
$data = $this->_Schema->read(array('models' => false, 'connection' => $this->connection));
|
$data = $this->_Schema->read(array('models' => false, 'connection' => $this->connection));
|
||||||
if (!isset($data['tables'][$useTable])) {
|
if (!isset($data['tables'][$useTable])) {
|
||||||
$this->error('Could not find your selected table ' . $useTable);
|
$this->err("<warning>Warning:</warning> Could not find the '${useTable}' table for ${model}.");
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$tableInfo = $data['tables'][$useTable];
|
$tableInfo = $data['tables'][$useTable];
|
||||||
|
|
|
@ -521,8 +521,7 @@ class ConsoleOptionParser {
|
||||||
* @return string Generated help.
|
* @return string Generated help.
|
||||||
*/
|
*/
|
||||||
public function help($subcommand = null, $format = 'text', $width = 72) {
|
public function help($subcommand = null, $format = 'text', $width = 72) {
|
||||||
if (
|
if (isset($this->_subcommands[$subcommand]) &&
|
||||||
isset($this->_subcommands[$subcommand]) &&
|
|
||||||
$this->_subcommands[$subcommand]->parser() instanceof self
|
$this->_subcommands[$subcommand]->parser() instanceof self
|
||||||
) {
|
) {
|
||||||
$subparser = $this->_subcommands[$subcommand]->parser();
|
$subparser = $this->_subcommands[$subcommand]->parser();
|
||||||
|
|
|
@ -161,8 +161,7 @@ class ConsoleOutput {
|
||||||
public function __construct($stream = 'php://stdout') {
|
public function __construct($stream = 'php://stdout') {
|
||||||
$this->_output = fopen($stream, 'w');
|
$this->_output = fopen($stream, 'w');
|
||||||
|
|
||||||
if (
|
if ((DS === '\\' && !(bool)env('ANSICON')) ||
|
||||||
(DS === '\\' && !(bool)env('ANSICON')) ||
|
|
||||||
(function_exists('posix_isatty') && !posix_isatty($this->_output))
|
(function_exists('posix_isatty') && !posix_isatty($this->_output))
|
||||||
) {
|
) {
|
||||||
$this->_outputAs = self::PLAIN;
|
$this->_outputAs = self::PLAIN;
|
||||||
|
|
|
@ -240,8 +240,7 @@ class PaginatorComponent extends Component {
|
||||||
throw new NotFoundException();
|
throw new NotFoundException();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (!in_array('Paginator', $this->Controller->helpers) &&
|
||||||
!in_array('Paginator', $this->Controller->helpers) &&
|
|
||||||
!array_key_exists('Paginator', $this->Controller->helpers)
|
!array_key_exists('Paginator', $this->Controller->helpers)
|
||||||
) {
|
) {
|
||||||
$this->Controller->helpers[] = 'Paginator';
|
$this->Controller->helpers[] = 'Paginator';
|
||||||
|
|
|
@ -415,8 +415,7 @@ class SecurityComponent extends Component {
|
||||||
if ($this->Session->check('_Token')) {
|
if ($this->Session->check('_Token')) {
|
||||||
$tData = $this->Session->read('_Token');
|
$tData = $this->Session->read('_Token');
|
||||||
|
|
||||||
if (
|
if (!empty($tData['allowedControllers']) &&
|
||||||
!empty($tData['allowedControllers']) &&
|
|
||||||
!in_array($this->request->params['controller'], $tData['allowedControllers']) ||
|
!in_array($this->request->params['controller'], $tData['allowedControllers']) ||
|
||||||
!empty($tData['allowedActions']) &&
|
!empty($tData['allowedActions']) &&
|
||||||
!in_array($this->request->params['action'], $tData['allowedActions'])
|
!in_array($this->request->params['action'], $tData['allowedActions'])
|
||||||
|
|
|
@ -197,8 +197,7 @@ class Object {
|
||||||
protected function _mergeVars($properties, $class, $normalize = true) {
|
protected function _mergeVars($properties, $class, $normalize = true) {
|
||||||
$classProperties = get_class_vars($class);
|
$classProperties = get_class_vars($class);
|
||||||
foreach ($properties as $var) {
|
foreach ($properties as $var) {
|
||||||
if (
|
if (isset($classProperties[$var]) &&
|
||||||
isset($classProperties[$var]) &&
|
|
||||||
!empty($classProperties[$var]) &&
|
!empty($classProperties[$var]) &&
|
||||||
is_array($this->{$var}) &&
|
is_array($this->{$var}) &&
|
||||||
$this->{$var} != $classProperties[$var]
|
$this->{$var} != $classProperties[$var]
|
||||||
|
|
|
@ -153,9 +153,20 @@ class ExceptionRenderer {
|
||||||
try {
|
try {
|
||||||
$controller = new CakeErrorController($request, $response);
|
$controller = new CakeErrorController($request, $response);
|
||||||
$controller->startupProcess();
|
$controller->startupProcess();
|
||||||
|
$startup = true;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
if (!empty($controller) && $controller->Components->enabled('RequestHandler')) {
|
$startup = false;
|
||||||
|
}
|
||||||
|
// Retry RequestHandler, as another aspect of startupProcess()
|
||||||
|
// could have failed. Ignore any exceptions out of startup, as
|
||||||
|
// there could be userland input data parsers.
|
||||||
|
if ($startup === false &&
|
||||||
|
!empty($controller) &&
|
||||||
|
$controller->Components->enabled('RequestHandler')
|
||||||
|
) {
|
||||||
|
try {
|
||||||
$controller->RequestHandler->startup($controller);
|
$controller->RequestHandler->startup($controller);
|
||||||
|
} catch (Exception $e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -316,6 +316,8 @@ class I18n {
|
||||||
* @param string $header Type
|
* @param string $header Type
|
||||||
* @param int $n Number
|
* @param int $n Number
|
||||||
* @return int plural match
|
* @return int plural match
|
||||||
|
* @link http://localization-guide.readthedocs.org/en/latest/l10n/pluralforms.html
|
||||||
|
* @link https://developer.mozilla.org/en-US/docs/Mozilla/Localization/Localization_and_Plurals#List_of_Plural_Rules
|
||||||
*/
|
*/
|
||||||
protected function _pluralGuess($header, $n) {
|
protected function _pluralGuess($header, $n) {
|
||||||
if (!is_string($header) || $header === "nplurals=1;plural=0;" || !isset($header[0])) {
|
if (!is_string($header) || $header === "nplurals=1;plural=0;" || !isset($header[0])) {
|
||||||
|
@ -356,7 +358,15 @@ class I18n {
|
||||||
}
|
}
|
||||||
} elseif (strpos($header, "plurals=5")) {
|
} elseif (strpos($header, "plurals=5")) {
|
||||||
return $n == 1 ? 0 : ($n == 2 ? 1 : ($n >= 3 && $n <= 6 ? 2 : ($n >= 7 && $n <= 10 ? 3 : 4)));
|
return $n == 1 ? 0 : ($n == 2 ? 1 : ($n >= 3 && $n <= 6 ? 2 : ($n >= 7 && $n <= 10 ? 3 : 4)));
|
||||||
|
} elseif (strpos($header, "plurals=6")) {
|
||||||
|
return $n == 0 ? 0 :
|
||||||
|
($n == 1 ? 1 :
|
||||||
|
($n == 2 ? 2 :
|
||||||
|
($n % 100 >= 3 && $n % 100 <= 10 ? 3 :
|
||||||
|
($n % 100 >= 11 ? 4 : 5))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -48,8 +48,7 @@ class ConsoleLog extends BaseLog {
|
||||||
*/
|
*/
|
||||||
public function __construct($config = array()) {
|
public function __construct($config = array()) {
|
||||||
parent::__construct($config);
|
parent::__construct($config);
|
||||||
if (
|
if ((DS === '\\' && !(bool)env('ANSICON')) ||
|
||||||
(DS === '\\' && !(bool)env('ANSICON')) ||
|
|
||||||
(function_exists('posix_isatty') && !posix_isatty($this->_output))
|
(function_exists('posix_isatty') && !posix_isatty($this->_output))
|
||||||
) {
|
) {
|
||||||
$outputAs = ConsoleOutput::PLAIN;
|
$outputAs = ConsoleOutput::PLAIN;
|
||||||
|
|
|
@ -116,8 +116,7 @@ class AclNode extends Model {
|
||||||
$result = $db->read($this, $queryData, -1);
|
$result = $db->read($this, $queryData, -1);
|
||||||
$path = array_values($path);
|
$path = array_values($path);
|
||||||
|
|
||||||
if (
|
if (!isset($result[0][$type]) ||
|
||||||
!isset($result[0][$type]) ||
|
|
||||||
(!empty($path) && $result[0][$type]['alias'] != $path[count($path) - 1]) ||
|
(!empty($path) && $result[0][$type]['alias'] != $path[count($path) - 1]) ||
|
||||||
(empty($path) && $result[0][$type]['alias'] != $start)
|
(empty($path) && $result[0][$type]['alias'] != $start)
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -157,8 +157,7 @@ class TranslateBehavior extends ModelBehavior {
|
||||||
);
|
);
|
||||||
foreach ($fields as $key => $value) {
|
foreach ($fields as $key => $value) {
|
||||||
$field = (is_numeric($key)) ? $value : $key;
|
$field = (is_numeric($key)) ? $value : $key;
|
||||||
if (
|
if ($isAllFields ||
|
||||||
$isAllFields ||
|
|
||||||
in_array($Model->alias . '.' . $field, $query['fields']) ||
|
in_array($Model->alias . '.' . $field, $query['fields']) ||
|
||||||
in_array($field, $query['fields'])
|
in_array($field, $query['fields'])
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -494,8 +494,8 @@ class TreeBehavior extends ModelBehavior {
|
||||||
$item = $result[0];
|
$item = $result[0];
|
||||||
$results = $Model->find('all', array(
|
$results = $Model->find('all', array(
|
||||||
'conditions' => array($scope, $Model->escapeField($left) . ' <=' => $item[$left], $Model->escapeField($right) . ' >=' => $item[$right]),
|
'conditions' => array($scope, $Model->escapeField($left) . ' <=' => $item[$left], $Model->escapeField($right) . ' >=' => $item[$right]),
|
||||||
'fields' => $fields, 'order' => array($Model->escapeField($left) => 'asc'),
|
'fields' => $fields,
|
||||||
'order' => false,
|
'order' => array($Model->escapeField($left) => 'asc'),
|
||||||
'recursive' => $recursive
|
'recursive' => $recursive
|
||||||
));
|
));
|
||||||
return $results;
|
return $results;
|
||||||
|
|
|
@ -834,9 +834,7 @@ class DboSource extends DataSource {
|
||||||
$matches[1] . '(' . $this->name($matches[2]) . ')'
|
$matches[1] . '(' . $this->name($matches[2]) . ')'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (
|
if (preg_match('/^([\w-]+(\.[\w-]+|\(.*\))*)\s+' . preg_quote($this->alias) . '\s*([\w-]+)$/i', $data, $matches)) {
|
||||||
preg_match('/^([\w-]+(\.[\w-]+|\(.*\))*)\s+' . preg_quote($this->alias) . '\s*([\w-]+)$/i', $data, $matches
|
|
||||||
)) {
|
|
||||||
return $this->cacheMethod(
|
return $this->cacheMethod(
|
||||||
__FUNCTION__, $cacheKey,
|
__FUNCTION__, $cacheKey,
|
||||||
preg_replace(
|
preg_replace(
|
||||||
|
@ -1337,8 +1335,7 @@ class DboSource extends DataSource {
|
||||||
$assocResultSet = array();
|
$assocResultSet = array();
|
||||||
$prefetched = false;
|
$prefetched = false;
|
||||||
|
|
||||||
if (
|
if (($type === 'hasOne' || $type === 'belongsTo') &&
|
||||||
($type === 'hasOne' || $type === 'belongsTo') &&
|
|
||||||
isset($row[$LinkModel->alias], $joined[$Model->alias]) &&
|
isset($row[$LinkModel->alias], $joined[$Model->alias]) &&
|
||||||
in_array($LinkModel->alias, $joined[$Model->alias])
|
in_array($LinkModel->alias, $joined[$Model->alias])
|
||||||
) {
|
) {
|
||||||
|
@ -1361,8 +1358,7 @@ class DboSource extends DataSource {
|
||||||
foreach ($LinkModel->{$type1} as $assoc1 => $assocData1) {
|
foreach ($LinkModel->{$type1} as $assoc1 => $assocData1) {
|
||||||
$DeepModel = $LinkModel->{$assoc1};
|
$DeepModel = $LinkModel->{$assoc1};
|
||||||
|
|
||||||
if (
|
if ($type1 === 'belongsTo' ||
|
||||||
$type1 === 'belongsTo' ||
|
|
||||||
($type === 'belongsTo' && $DeepModel->alias === $modelAlias) ||
|
($type === 'belongsTo' && $DeepModel->alias === $modelAlias) ||
|
||||||
($DeepModel->alias !== $modelAlias)
|
($DeepModel->alias !== $modelAlias)
|
||||||
) {
|
) {
|
||||||
|
@ -1618,8 +1614,7 @@ class DboSource extends DataSource {
|
||||||
$assocFields = $this->fields($Model, null, "{$Model->alias}.{$Model->primaryKey}");
|
$assocFields = $this->fields($Model, null, "{$Model->alias}.{$Model->primaryKey}");
|
||||||
$passedFields = $queryData['fields'];
|
$passedFields = $queryData['fields'];
|
||||||
|
|
||||||
if (
|
if (count($passedFields) > 1 ||
|
||||||
count($passedFields) > 1 ||
|
|
||||||
(strpos($passedFields[0], $assocFields[0]) === false && !preg_match('/^[a-z]+\(/i', $passedFields[0]))
|
(strpos($passedFields[0], $assocFields[0]) === false && !preg_match('/^[a-z]+\(/i', $passedFields[0]))
|
||||||
) {
|
) {
|
||||||
$queryData['fields'] = array_merge($passedFields, $assocFields);
|
$queryData['fields'] = array_merge($passedFields, $assocFields);
|
||||||
|
|
|
@ -1312,8 +1312,7 @@ class Model extends Object implements CakeEventListener {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (isset($data['hour']) &&
|
||||||
isset($data['hour']) &&
|
|
||||||
isset($data['meridian']) &&
|
isset($data['meridian']) &&
|
||||||
!empty($data['hour']) &&
|
!empty($data['hour']) &&
|
||||||
$data['hour'] != 12 &&
|
$data['hour'] != 12 &&
|
||||||
|
|
|
@ -162,8 +162,7 @@ class CakeRequest implements ArrayAccess {
|
||||||
protected function _processPost() {
|
protected function _processPost() {
|
||||||
if ($_POST) {
|
if ($_POST) {
|
||||||
$this->data = $_POST;
|
$this->data = $_POST;
|
||||||
} elseif (
|
} elseif (($this->is('put') || $this->is('delete')) &&
|
||||||
($this->is('put') || $this->is('delete')) &&
|
|
||||||
strpos(env('CONTENT_TYPE'), 'application/x-www-form-urlencoded') === 0
|
strpos(env('CONTENT_TYPE'), 'application/x-www-form-urlencoded') === 0
|
||||||
) {
|
) {
|
||||||
$data = $this->_readInput();
|
$data = $this->_readInput();
|
||||||
|
@ -261,8 +260,7 @@ class CakeRequest implements ArrayAccess {
|
||||||
}
|
}
|
||||||
$endsWithIndex = '/webroot/index.php';
|
$endsWithIndex = '/webroot/index.php';
|
||||||
$endsWithLength = strlen($endsWithIndex);
|
$endsWithLength = strlen($endsWithIndex);
|
||||||
if (
|
if (strlen($uri) >= $endsWithLength &&
|
||||||
strlen($uri) >= $endsWithLength &&
|
|
||||||
substr($uri, -$endsWithLength) === $endsWithIndex
|
substr($uri, -$endsWithLength) === $endsWithIndex
|
||||||
) {
|
) {
|
||||||
$uri = '/';
|
$uri = '/';
|
||||||
|
|
|
@ -464,8 +464,7 @@ class CakeResponse {
|
||||||
);
|
);
|
||||||
|
|
||||||
$charset = false;
|
$charset = false;
|
||||||
if (
|
if ($this->_charset &&
|
||||||
$this->_charset &&
|
|
||||||
(strpos($this->_contentType, 'text/') === 0 || in_array($this->_contentType, $whitelist))
|
(strpos($this->_contentType, 'text/') === 0 || in_array($this->_contentType, $whitelist))
|
||||||
) {
|
) {
|
||||||
$charset = true;
|
$charset = true;
|
||||||
|
|
|
@ -1481,8 +1481,7 @@ class CakeEmail {
|
||||||
$msg[] = '--' . $boundary;
|
$msg[] = '--' . $boundary;
|
||||||
$msg[] = 'Content-Type: ' . $fileInfo['mimetype'];
|
$msg[] = 'Content-Type: ' . $fileInfo['mimetype'];
|
||||||
$msg[] = 'Content-Transfer-Encoding: base64';
|
$msg[] = 'Content-Transfer-Encoding: base64';
|
||||||
if (
|
if (!isset($fileInfo['contentDisposition']) ||
|
||||||
!isset($fileInfo['contentDisposition']) ||
|
|
||||||
$fileInfo['contentDisposition']
|
$fileInfo['contentDisposition']
|
||||||
) {
|
) {
|
||||||
$msg[] = 'Content-Disposition: attachment; filename="' . $filename . '"';
|
$msg[] = 'Content-Disposition: attachment; filename="' . $filename . '"';
|
||||||
|
|
|
@ -312,8 +312,7 @@ class HttpSocket extends CakeSocket {
|
||||||
if (isset($this->request['uri']['port'])) {
|
if (isset($this->request['uri']['port'])) {
|
||||||
$port = $this->request['uri']['port'];
|
$port = $this->request['uri']['port'];
|
||||||
}
|
}
|
||||||
if (
|
if (($scheme === 'http' && $port != 80) ||
|
||||||
($scheme === 'http' && $port != 80) ||
|
|
||||||
($scheme === 'https' && $port != 443) ||
|
($scheme === 'https' && $port != 443) ||
|
||||||
($port != 80 && $port != 443)
|
($port != 80 && $port != 443)
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -448,8 +448,7 @@ class CakeRoute {
|
||||||
}
|
}
|
||||||
|
|
||||||
// pull out named params if named params are greedy or a rule exists.
|
// pull out named params if named params are greedy or a rule exists.
|
||||||
if (
|
if (($greedyNamed || isset($allowedNamedParams[$key])) &&
|
||||||
($greedyNamed || isset($allowedNamedParams[$key])) &&
|
|
||||||
($value !== false && $value !== null) &&
|
($value !== false && $value !== null) &&
|
||||||
(!in_array($key, $prefixes))
|
(!in_array($key, $prefixes))
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -227,8 +227,7 @@ class Router {
|
||||||
* @throws RouterException
|
* @throws RouterException
|
||||||
*/
|
*/
|
||||||
protected static function _validateRouteClass($routeClass) {
|
protected static function _validateRouteClass($routeClass) {
|
||||||
if (
|
if ($routeClass !== 'CakeRoute' &&
|
||||||
$routeClass !== 'CakeRoute' &&
|
|
||||||
(!class_exists($routeClass) || !is_subclass_of($routeClass, 'CakeRoute'))
|
(!class_exists($routeClass) || !is_subclass_of($routeClass, 'CakeRoute'))
|
||||||
) {
|
) {
|
||||||
throw new RouterException(__d('cake_dev', 'Route class not found, or route class is not a subclass of CakeRoute'));
|
throw new RouterException(__d('cake_dev', 'Route class not found, or route class is not a subclass of CakeRoute'));
|
||||||
|
|
|
@ -1512,6 +1512,127 @@ class I18nTest extends CakeTestCase {
|
||||||
$this->assertTrue(in_array('25 everything else (from core translated)', $corePlurals));
|
$this->assertTrue(in_array('25 everything else (from core translated)', $corePlurals));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* testMoRulesFifteen method
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testMoRulesFifteen() {
|
||||||
|
Configure::write('Config.language', 'rule_15_mo');
|
||||||
|
$this->assertRulesFifteen();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* testPoRulesFifteen method
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testPoRulesFifteen() {
|
||||||
|
Configure::write('Config.language', 'rule_15_po');
|
||||||
|
$this->assertRulesFifteen();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Assertions for plural rules fifteen
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function assertRulesFifteen() {
|
||||||
|
$singular = $this->_singular();
|
||||||
|
$this->assertEquals('Plural Rule 15 (translated)', $singular);
|
||||||
|
|
||||||
|
$plurals = $this->_plural(111);
|
||||||
|
$this->assertTrue(in_array('0 is 0 (translated)', $plurals));
|
||||||
|
$this->assertTrue(in_array('1 is 1 (translated)', $plurals));
|
||||||
|
$this->assertTrue(in_array('2 is 2 (translated)', $plurals));
|
||||||
|
$this->assertTrue(in_array('3 ends with 03-10 (translated)', $plurals));
|
||||||
|
$this->assertTrue(in_array('4 ends with 03-10 (translated)', $plurals));
|
||||||
|
$this->assertTrue(in_array('5 ends with 03-10 (translated)', $plurals));
|
||||||
|
$this->assertTrue(in_array('6 ends with 03-10 (translated)', $plurals));
|
||||||
|
$this->assertTrue(in_array('7 ends with 03-10 (translated)', $plurals));
|
||||||
|
$this->assertTrue(in_array('8 ends with 03-10 (translated)', $plurals));
|
||||||
|
$this->assertTrue(in_array('9 ends with 03-10 (translated)', $plurals));
|
||||||
|
$this->assertTrue(in_array('10 ends with 03-10 (translated)', $plurals));
|
||||||
|
$this->assertTrue(in_array('11 ends with 11-99 (translated)', $plurals));
|
||||||
|
$this->assertTrue(in_array('12 ends with 11-99 (translated)', $plurals));
|
||||||
|
$this->assertTrue(in_array('13 ends with 11-99 (translated)', $plurals));
|
||||||
|
$this->assertTrue(in_array('14 ends with 11-99 (translated)', $plurals));
|
||||||
|
$this->assertTrue(in_array('15 ends with 11-99 (translated)', $plurals));
|
||||||
|
$this->assertTrue(in_array('16 ends with 11-99 (translated)', $plurals));
|
||||||
|
$this->assertTrue(in_array('17 ends with 11-99 (translated)', $plurals));
|
||||||
|
$this->assertTrue(in_array('18 ends with 11-99 (translated)', $plurals));
|
||||||
|
$this->assertTrue(in_array('19 ends with 11-99 (translated)', $plurals));
|
||||||
|
$this->assertTrue(in_array('20 ends with 11-99 (translated)', $plurals));
|
||||||
|
$this->assertTrue(in_array('31 ends with 11-99 (translated)', $plurals));
|
||||||
|
$this->assertTrue(in_array('42 ends with 11-99 (translated)', $plurals));
|
||||||
|
$this->assertTrue(in_array('53 ends with 11-99 (translated)', $plurals));
|
||||||
|
$this->assertTrue(in_array('64 ends with 11-99 (translated)', $plurals));
|
||||||
|
$this->assertTrue(in_array('75 ends with 11-99 (translated)', $plurals));
|
||||||
|
$this->assertTrue(in_array('86 ends with 11-99 (translated)', $plurals));
|
||||||
|
$this->assertTrue(in_array('97 ends with 11-99 (translated)', $plurals));
|
||||||
|
$this->assertTrue(in_array('98 ends with 11-99 (translated)', $plurals));
|
||||||
|
$this->assertTrue(in_array('99 ends with 11-99 (translated)', $plurals));
|
||||||
|
$this->assertTrue(in_array('100 everything else (translated)', $plurals));
|
||||||
|
$this->assertTrue(in_array('101 everything else (translated)', $plurals));
|
||||||
|
$this->assertTrue(in_array('102 everything else (translated)', $plurals));
|
||||||
|
$this->assertTrue(in_array('103 ends with 03-10 (translated)', $plurals));
|
||||||
|
$this->assertTrue(in_array('104 ends with 03-10 (translated)', $plurals));
|
||||||
|
$this->assertTrue(in_array('105 ends with 03-10 (translated)', $plurals));
|
||||||
|
$this->assertTrue(in_array('106 ends with 03-10 (translated)', $plurals));
|
||||||
|
$this->assertTrue(in_array('107 ends with 03-10 (translated)', $plurals));
|
||||||
|
$this->assertTrue(in_array('108 ends with 03-10 (translated)', $plurals));
|
||||||
|
$this->assertTrue(in_array('109 ends with 03-10 (translated)', $plurals));
|
||||||
|
$this->assertTrue(in_array('110 ends with 03-10 (translated)', $plurals));
|
||||||
|
$this->assertTrue(in_array('111 ends with 11-99 (translated)', $plurals));
|
||||||
|
|
||||||
|
$coreSingular = $this->_singularFromCore();
|
||||||
|
$this->assertEquals('Plural Rule 15 (from core translated)', $coreSingular);
|
||||||
|
|
||||||
|
$corePlurals = $this->_pluralFromCore(111);
|
||||||
|
$this->assertTrue(in_array('0 is 0 (from core translated)', $corePlurals));
|
||||||
|
$this->assertTrue(in_array('1 is 1 (from core translated)', $corePlurals));
|
||||||
|
$this->assertTrue(in_array('2 is 2 (from core translated)', $corePlurals));
|
||||||
|
$this->assertTrue(in_array('3 ends with 03-10 (from core translated)', $corePlurals));
|
||||||
|
$this->assertTrue(in_array('4 ends with 03-10 (from core translated)', $corePlurals));
|
||||||
|
$this->assertTrue(in_array('5 ends with 03-10 (from core translated)', $corePlurals));
|
||||||
|
$this->assertTrue(in_array('6 ends with 03-10 (from core translated)', $corePlurals));
|
||||||
|
$this->assertTrue(in_array('7 ends with 03-10 (from core translated)', $corePlurals));
|
||||||
|
$this->assertTrue(in_array('8 ends with 03-10 (from core translated)', $corePlurals));
|
||||||
|
$this->assertTrue(in_array('9 ends with 03-10 (from core translated)', $corePlurals));
|
||||||
|
$this->assertTrue(in_array('10 ends with 03-10 (from core translated)', $corePlurals));
|
||||||
|
$this->assertTrue(in_array('11 ends with 11-99 (from core translated)', $corePlurals));
|
||||||
|
$this->assertTrue(in_array('12 ends with 11-99 (from core translated)', $corePlurals));
|
||||||
|
$this->assertTrue(in_array('13 ends with 11-99 (from core translated)', $corePlurals));
|
||||||
|
$this->assertTrue(in_array('14 ends with 11-99 (from core translated)', $corePlurals));
|
||||||
|
$this->assertTrue(in_array('15 ends with 11-99 (from core translated)', $corePlurals));
|
||||||
|
$this->assertTrue(in_array('16 ends with 11-99 (from core translated)', $corePlurals));
|
||||||
|
$this->assertTrue(in_array('17 ends with 11-99 (from core translated)', $corePlurals));
|
||||||
|
$this->assertTrue(in_array('18 ends with 11-99 (from core translated)', $corePlurals));
|
||||||
|
$this->assertTrue(in_array('19 ends with 11-99 (from core translated)', $corePlurals));
|
||||||
|
$this->assertTrue(in_array('20 ends with 11-99 (from core translated)', $corePlurals));
|
||||||
|
$this->assertTrue(in_array('31 ends with 11-99 (from core translated)', $corePlurals));
|
||||||
|
$this->assertTrue(in_array('42 ends with 11-99 (from core translated)', $corePlurals));
|
||||||
|
$this->assertTrue(in_array('53 ends with 11-99 (from core translated)', $corePlurals));
|
||||||
|
$this->assertTrue(in_array('64 ends with 11-99 (from core translated)', $corePlurals));
|
||||||
|
$this->assertTrue(in_array('75 ends with 11-99 (from core translated)', $corePlurals));
|
||||||
|
$this->assertTrue(in_array('86 ends with 11-99 (from core translated)', $corePlurals));
|
||||||
|
$this->assertTrue(in_array('97 ends with 11-99 (from core translated)', $corePlurals));
|
||||||
|
$this->assertTrue(in_array('98 ends with 11-99 (from core translated)', $corePlurals));
|
||||||
|
$this->assertTrue(in_array('99 ends with 11-99 (from core translated)', $corePlurals));
|
||||||
|
$this->assertTrue(in_array('100 everything else (from core translated)', $corePlurals));
|
||||||
|
$this->assertTrue(in_array('101 everything else (from core translated)', $corePlurals));
|
||||||
|
$this->assertTrue(in_array('102 everything else (from core translated)', $corePlurals));
|
||||||
|
$this->assertTrue(in_array('103 ends with 03-10 (from core translated)', $corePlurals));
|
||||||
|
$this->assertTrue(in_array('104 ends with 03-10 (from core translated)', $corePlurals));
|
||||||
|
$this->assertTrue(in_array('105 ends with 03-10 (from core translated)', $corePlurals));
|
||||||
|
$this->assertTrue(in_array('106 ends with 03-10 (from core translated)', $corePlurals));
|
||||||
|
$this->assertTrue(in_array('107 ends with 03-10 (from core translated)', $corePlurals));
|
||||||
|
$this->assertTrue(in_array('108 ends with 03-10 (from core translated)', $corePlurals));
|
||||||
|
$this->assertTrue(in_array('109 ends with 03-10 (from core translated)', $corePlurals));
|
||||||
|
$this->assertTrue(in_array('110 ends with 03-10 (from core translated)', $corePlurals));
|
||||||
|
$this->assertTrue(in_array('111 ends with 11-99 (from core translated)', $corePlurals));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testSetLanguageWithSession method
|
* testSetLanguageWithSession method
|
||||||
*
|
*
|
||||||
|
@ -1964,11 +2085,12 @@ class I18nTest extends CakeTestCase {
|
||||||
/**
|
/**
|
||||||
* Plural method
|
* Plural method
|
||||||
*
|
*
|
||||||
|
* @param int $upTo For numbers upto (default to 25)
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function _plural() {
|
protected function _plural($upTo = 25) {
|
||||||
$plurals = array();
|
$plurals = array();
|
||||||
for ($number = 0; $number <= 25; $number++) {
|
for ($number = 0; $number <= $upTo; $number++) {
|
||||||
$plurals[] = sprintf(__n('%d = 1', '%d = 0 or > 1', (float)$number), (float)$number);
|
$plurals[] = sprintf(__n('%d = 1', '%d = 0 or > 1', (float)$number), (float)$number);
|
||||||
}
|
}
|
||||||
return $plurals;
|
return $plurals;
|
||||||
|
@ -1987,11 +2109,12 @@ class I18nTest extends CakeTestCase {
|
||||||
/**
|
/**
|
||||||
* pluralFromCore method
|
* pluralFromCore method
|
||||||
*
|
*
|
||||||
|
* @param int $upTo For numbers upto (default to 25)
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function _pluralFromCore() {
|
protected function _pluralFromCore($upTo = 25) {
|
||||||
$plurals = array();
|
$plurals = array();
|
||||||
for ($number = 0; $number <= 25; $number++) {
|
for ($number = 0; $number <= $upTo; $number++) {
|
||||||
$plurals[] = sprintf(__n('%d = 1 (from core)', '%d = 0 or > 1 (from core)', (float)$number), (float)$number);
|
$plurals[] = sprintf(__n('%d = 1 (from core)', '%d = 0 or > 1 (from core)', (float)$number), (float)$number);
|
||||||
}
|
}
|
||||||
return $plurals;
|
return $plurals;
|
||||||
|
|
|
@ -139,8 +139,7 @@ class ConsoleLogTest extends CakeTestCase {
|
||||||
TestCakeLog::config('test_console_log', array(
|
TestCakeLog::config('test_console_log', array(
|
||||||
'engine' => 'TestConsole',
|
'engine' => 'TestConsole',
|
||||||
));
|
));
|
||||||
if (
|
if ((DS === '\\' && !(bool)env('ANSICON')) ||
|
||||||
(DS === '\\' && !(bool)env('ANSICON')) ||
|
|
||||||
(function_exists('posix_isatty') && !posix_isatty(null))
|
(function_exists('posix_isatty') && !posix_isatty(null))
|
||||||
) {
|
) {
|
||||||
$expected = ConsoleOutput::PLAIN;
|
$expected = ConsoleOutput::PLAIN;
|
||||||
|
|
|
@ -81,8 +81,7 @@ class FileTest extends CakeTestCase {
|
||||||
'filesize' => filesize($file),
|
'filesize' => filesize($file),
|
||||||
'mime' => 'text/plain'
|
'mime' => 'text/plain'
|
||||||
);
|
);
|
||||||
if (
|
if (!function_exists('finfo_open') &&
|
||||||
!function_exists('finfo_open') &&
|
|
||||||
(!function_exists('mime_content_type') ||
|
(!function_exists('mime_content_type') ||
|
||||||
function_exists('mime_content_type') &&
|
function_exists('mime_content_type') &&
|
||||||
mime_content_type($this->File->pwd()) === false)
|
mime_content_type($this->File->pwd()) === false)
|
||||||
|
|
|
@ -186,6 +186,10 @@ class InflectorTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testInflectingPlurals() {
|
public function testInflectingPlurals() {
|
||||||
|
$this->assertEquals(Inflector::pluralize('axman'), 'axmen');
|
||||||
|
$this->assertEquals(Inflector::pluralize('man'), 'men');
|
||||||
|
$this->assertEquals(Inflector::pluralize('woman'), 'women');
|
||||||
|
$this->assertEquals(Inflector::pluralize('human'), 'humans');
|
||||||
$this->assertEquals(Inflector::pluralize('categoria'), 'categorias');
|
$this->assertEquals(Inflector::pluralize('categoria'), 'categorias');
|
||||||
$this->assertEquals(Inflector::pluralize('house'), 'houses');
|
$this->assertEquals(Inflector::pluralize('house'), 'houses');
|
||||||
$this->assertEquals(Inflector::pluralize('powerhouse'), 'powerhouses');
|
$this->assertEquals(Inflector::pluralize('powerhouse'), 'powerhouses');
|
||||||
|
|
BIN
lib/Cake/Test/test_app/Locale/rule_15_mo/LC_MESSAGES/core.mo
Normal file
BIN
lib/Cake/Test/test_app/Locale/rule_15_mo/LC_MESSAGES/core.mo
Normal file
Binary file not shown.
BIN
lib/Cake/Test/test_app/Locale/rule_15_mo/LC_MESSAGES/default.mo
Normal file
BIN
lib/Cake/Test/test_app/Locale/rule_15_mo/LC_MESSAGES/default.mo
Normal file
Binary file not shown.
25
lib/Cake/Test/test_app/Locale/rule_15_po/LC_MESSAGES/core.po
Normal file
25
lib/Cake/Test/test_app/Locale/rule_15_po/LC_MESSAGES/core.po
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: CakePHP Testsuite\n"
|
||||||
|
"POT-Creation-Date: 2014-12-06 19:20-0300\n"
|
||||||
|
"PO-Revision-Date: \n"
|
||||||
|
"Language-Team: CakePHP I18N & I10N Team <i10n.cakephp@gmail.com>\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n"
|
||||||
|
"X-Poedit-Language: Six Forms of Plurals\n"
|
||||||
|
"X-Poedit-SourceCharset: utf-8\n"
|
||||||
|
|
||||||
|
msgid "Plural Rule 1 (from core)"
|
||||||
|
msgstr "Plural Rule 15 (from core translated)"
|
||||||
|
|
||||||
|
msgid "%d = 1 (from core)"
|
||||||
|
msgid_plural "%d = 0 or > 1 (from core)"
|
||||||
|
msgstr[0] "%d is 0 (from core translated)"
|
||||||
|
msgstr[1] "%d is 1 (from core translated)"
|
||||||
|
msgstr[2] "%d is 2 (from core translated)"
|
||||||
|
msgstr[3] "%d ends with 03-10 (from core translated)"
|
||||||
|
msgstr[4] "%d ends with 11-99 (from core translated)"
|
||||||
|
msgstr[5] "%d everything else (from core translated)"
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: CakePHP Testsuite\n"
|
||||||
|
"POT-Creation-Date: 2014-12-06 19:20-0300\n"
|
||||||
|
"PO-Revision-Date: \n"
|
||||||
|
"Language-Team: CakePHP I18N & I10N Team <i10n.cakephp@gmail.com>\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n"
|
||||||
|
"X-Poedit-Language: Six Forms of Plurals\n"
|
||||||
|
"X-Poedit-SourceCharset: utf-8\n"
|
||||||
|
|
||||||
|
msgid "Plural Rule 1"
|
||||||
|
msgstr "Plural Rule 15 (translated)"
|
||||||
|
|
||||||
|
msgid "%d = 1"
|
||||||
|
msgid_plural "%d = 0 or > 1"
|
||||||
|
msgstr[0] "%d is 0 (translated)"
|
||||||
|
msgstr[1] "%d is 1 (translated)"
|
||||||
|
msgstr[2] "%d is 2 (translated)"
|
||||||
|
msgstr[3] "%d ends with 03-10 (translated)"
|
||||||
|
msgstr[4] "%d ends with 11-99 (translated)"
|
||||||
|
msgstr[5] "%d everything else (translated)"
|
||||||
|
|
|
@ -287,17 +287,25 @@ class CakeTestFixture {
|
||||||
$fields = array_unique($fields);
|
$fields = array_unique($fields);
|
||||||
$default = array_fill_keys($fields, null);
|
$default = array_fill_keys($fields, null);
|
||||||
foreach ($this->records as $record) {
|
foreach ($this->records as $record) {
|
||||||
$merge = array_values(array_merge($default, $record));
|
$mergeData = array_merge($default, $record);
|
||||||
|
$merge = array_values($mergeData);
|
||||||
if (count($fields) !== count($merge)) {
|
if (count($fields) !== count($merge)) {
|
||||||
throw new CakeException('Fixture invalid: Count of fields does not match count of values in ' . get_class($this));
|
|
||||||
|
$mergeFields = array_diff_key(array_keys($mergeData), $fields);
|
||||||
|
|
||||||
|
$message = 'Fixture invalid: Count of fields does not match count of values in ' . get_class($this) . "\n";
|
||||||
|
foreach ($mergeFields as $field) {
|
||||||
|
$message .= "The field '" . $field . "' is in the data fixture but not in the schema." . "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new CakeException($message);
|
||||||
}
|
}
|
||||||
$values[] = $merge;
|
$values[] = $merge;
|
||||||
}
|
}
|
||||||
$nested = $db->useNestedTransactions;
|
$nested = $db->useNestedTransactions;
|
||||||
$db->useNestedTransactions = false;
|
$db->useNestedTransactions = false;
|
||||||
$result = $db->insertMulti($this->table, $fields, $values);
|
$result = $db->insertMulti($this->table, $fields, $values);
|
||||||
if (
|
if ($this->primaryKey &&
|
||||||
$this->primaryKey &&
|
|
||||||
isset($this->fields[$this->primaryKey]['type']) &&
|
isset($this->fields[$this->primaryKey]['type']) &&
|
||||||
in_array($this->fields[$this->primaryKey]['type'], array('integer', 'biginteger'))
|
in_array($this->fields[$this->primaryKey]['type'], array('integer', 'biginteger'))
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -322,8 +322,7 @@ class CakeTime {
|
||||||
|
|
||||||
if (is_int($dateString) || is_numeric($dateString)) {
|
if (is_int($dateString) || is_numeric($dateString)) {
|
||||||
$date = (int)$dateString;
|
$date = (int)$dateString;
|
||||||
} elseif (
|
} elseif ($dateString instanceof DateTime &&
|
||||||
$dateString instanceof DateTime &&
|
|
||||||
$dateString->getTimezone()->getName() != date_default_timezone_get()
|
$dateString->getTimezone()->getName() != date_default_timezone_get()
|
||||||
) {
|
) {
|
||||||
$clone = clone $dateString;
|
$clone = clone $dateString;
|
||||||
|
|
|
@ -230,8 +230,7 @@ class Hash {
|
||||||
if (!preg_match($val, $prop)) {
|
if (!preg_match($val, $prop)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} elseif (
|
} elseif (($op === '=' && $prop != $val) ||
|
||||||
($op === '=' && $prop != $val) ||
|
|
||||||
($op === '!=' && $prop == $val) ||
|
($op === '!=' && $prop == $val) ||
|
||||||
($op === '>' && $prop <= $val) ||
|
($op === '>' && $prop <= $val) ||
|
||||||
($op === '<' && $prop >= $val) ||
|
($op === '<' && $prop >= $val) ||
|
||||||
|
|
|
@ -44,7 +44,7 @@ class Inflector {
|
||||||
'/sis$/i' => 'ses',
|
'/sis$/i' => 'ses',
|
||||||
'/([ti])um$/i' => '\1a',
|
'/([ti])um$/i' => '\1a',
|
||||||
'/(p)erson$/i' => '\1eople',
|
'/(p)erson$/i' => '\1eople',
|
||||||
'/(m)an$/i' => '\1en',
|
'/(?<!u)(m)an$/i' => '\1en',
|
||||||
'/(c)hild$/i' => '\1hildren',
|
'/(c)hild$/i' => '\1hildren',
|
||||||
'/(buffal|tomat)o$/i' => '\1\2oes',
|
'/(buffal|tomat)o$/i' => '\1\2oes',
|
||||||
'/(alumn|bacill|cact|foc|fung|nucle|radi|stimul|syllab|termin|vir)us$/i' => '\1i',
|
'/(alumn|bacill|cact|foc|fung|nucle|radi|stimul|syllab|termin|vir)us$/i' => '\1i',
|
||||||
|
|
|
@ -129,8 +129,7 @@ abstract class ObjectCollection {
|
||||||
if ($options['collectReturn'] === true) {
|
if ($options['collectReturn'] === true) {
|
||||||
$collected[] = $result;
|
$collected[] = $result;
|
||||||
}
|
}
|
||||||
if (
|
if ($options['break'] && ($result === $options['breakOn'] ||
|
||||||
$options['break'] && ($result === $options['breakOn'] ||
|
|
||||||
(is_array($options['breakOn']) && in_array($result, $options['breakOn'], true)))
|
(is_array($options['breakOn']) && in_array($result, $options['breakOn'], true)))
|
||||||
) {
|
) {
|
||||||
return $result;
|
return $result;
|
||||||
|
|
|
@ -320,8 +320,7 @@ class Helper extends Object {
|
||||||
if (!empty($options['pathPrefix']) && $path[0] !== '/') {
|
if (!empty($options['pathPrefix']) && $path[0] !== '/') {
|
||||||
$path = $options['pathPrefix'] . $path;
|
$path = $options['pathPrefix'] . $path;
|
||||||
}
|
}
|
||||||
if (
|
if (!empty($options['ext']) &&
|
||||||
!empty($options['ext']) &&
|
|
||||||
strpos($path, '?') === false &&
|
strpos($path, '?') === false &&
|
||||||
substr($path, -strlen($options['ext'])) !== $options['ext']
|
substr($path, -strlen($options['ext'])) !== $options['ext']
|
||||||
) {
|
) {
|
||||||
|
@ -543,8 +542,7 @@ class Helper extends Object {
|
||||||
$lastPart = isset($parts[$count - 1]) ? $parts[$count - 1] : null;
|
$lastPart = isset($parts[$count - 1]) ? $parts[$count - 1] : null;
|
||||||
|
|
||||||
// Either 'body' or 'date.month' type inputs.
|
// Either 'body' or 'date.month' type inputs.
|
||||||
if (
|
if (($count === 1 && $this->_modelScope && !$setScope) ||
|
||||||
($count === 1 && $this->_modelScope && !$setScope) ||
|
|
||||||
(
|
(
|
||||||
$count === 2 &&
|
$count === 2 &&
|
||||||
in_array($lastPart, $this->_fieldSuffixes) &&
|
in_array($lastPart, $this->_fieldSuffixes) &&
|
||||||
|
@ -556,8 +554,7 @@ class Helper extends Object {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0.name, 0.created.month style inputs. Excludes inputs with the modelScope in them.
|
// 0.name, 0.created.month style inputs. Excludes inputs with the modelScope in them.
|
||||||
if (
|
if ($count >= 2 &&
|
||||||
$count >= 2 &&
|
|
||||||
is_numeric($parts[0]) &&
|
is_numeric($parts[0]) &&
|
||||||
!is_numeric($parts[1]) &&
|
!is_numeric($parts[1]) &&
|
||||||
$this->_modelScope &&
|
$this->_modelScope &&
|
||||||
|
|
|
@ -534,8 +534,7 @@ class FormHelper extends AppHelper {
|
||||||
}
|
}
|
||||||
$out .= $this->submit($submit, $submitOptions);
|
$out .= $this->submit($submit, $submitOptions);
|
||||||
}
|
}
|
||||||
if (
|
if ($this->requestType !== 'get' &&
|
||||||
$this->requestType !== 'get' &&
|
|
||||||
isset($this->request['_Token']) &&
|
isset($this->request['_Token']) &&
|
||||||
!empty($this->request['_Token'])
|
!empty($this->request['_Token'])
|
||||||
) {
|
) {
|
||||||
|
@ -1201,8 +1200,7 @@ class FormHelper extends AppHelper {
|
||||||
if ($fieldKey === $primaryKey) {
|
if ($fieldKey === $primaryKey) {
|
||||||
$options['type'] = 'hidden';
|
$options['type'] = 'hidden';
|
||||||
}
|
}
|
||||||
if (
|
if ($options['type'] === 'number' &&
|
||||||
$options['type'] === 'number' &&
|
|
||||||
!isset($options['step'])
|
!isset($options['step'])
|
||||||
) {
|
) {
|
||||||
if ($type === 'decimal') {
|
if ($type === 'decimal') {
|
||||||
|
@ -1321,8 +1319,7 @@ class FormHelper extends AppHelper {
|
||||||
} elseif (is_array($div)) {
|
} elseif (is_array($div)) {
|
||||||
$divOptions = array_merge($divOptions, $div);
|
$divOptions = array_merge($divOptions, $div);
|
||||||
}
|
}
|
||||||
if (
|
if ($this->_extractOption('required', $options) !== false &&
|
||||||
$this->_extractOption('required', $options) !== false &&
|
|
||||||
$this->_introspectModel($this->model(), 'validates', $this->field())
|
$this->_introspectModel($this->model(), 'validates', $this->field())
|
||||||
) {
|
) {
|
||||||
$divOptions = $this->addClass($divOptions, 'required');
|
$divOptions = $this->addClass($divOptions, 'required');
|
||||||
|
@ -1365,8 +1362,7 @@ class FormHelper extends AppHelper {
|
||||||
$idKey = null;
|
$idKey = null;
|
||||||
if ($options['type'] === 'date' || $options['type'] === 'datetime') {
|
if ($options['type'] === 'date' || $options['type'] === 'datetime') {
|
||||||
$firstInput = 'M';
|
$firstInput = 'M';
|
||||||
if (
|
if (array_key_exists('dateFormat', $options) &&
|
||||||
array_key_exists('dateFormat', $options) &&
|
|
||||||
($options['dateFormat'] === null || $options['dateFormat'] === 'NONE')
|
($options['dateFormat'] === null || $options['dateFormat'] === 'NONE')
|
||||||
) {
|
) {
|
||||||
$firstInput = 'H';
|
$firstInput = 'H';
|
||||||
|
@ -1447,8 +1443,7 @@ class FormHelper extends AppHelper {
|
||||||
$value = current($this->value($valueOptions));
|
$value = current($this->value($valueOptions));
|
||||||
$output = '';
|
$output = '';
|
||||||
|
|
||||||
if (
|
if ((!isset($options['checked']) && !empty($value) && $value == $options['value']) ||
|
||||||
(!isset($options['checked']) && !empty($value) && $value == $options['value']) ||
|
|
||||||
!empty($options['checked'])
|
!empty($options['checked'])
|
||||||
) {
|
) {
|
||||||
$options['checked'] = 'checked';
|
$options['checked'] = 'checked';
|
||||||
|
@ -2090,8 +2085,7 @@ class FormHelper extends AppHelper {
|
||||||
$hasOptions = (count($options) > 0 || $showEmpty);
|
$hasOptions = (count($options) > 0 || $showEmpty);
|
||||||
// Secure the field if there are options, or its a multi select.
|
// Secure the field if there are options, or its a multi select.
|
||||||
// Single selects with no options don't submit, but multiselects do.
|
// Single selects with no options don't submit, but multiselects do.
|
||||||
if (
|
if ((!isset($secure) || $secure) &&
|
||||||
(!isset($secure) || $secure) &&
|
|
||||||
empty($attributes['disabled']) &&
|
empty($attributes['disabled']) &&
|
||||||
(!empty($attributes['multiple']) || $hasOptions)
|
(!empty($attributes['multiple']) || $hasOptions)
|
||||||
) {
|
) {
|
||||||
|
@ -2765,8 +2759,7 @@ class FormHelper extends AppHelper {
|
||||||
|
|
||||||
if ($name !== null) {
|
if ($name !== null) {
|
||||||
$isNumeric = is_numeric($name);
|
$isNumeric = is_numeric($name);
|
||||||
if (
|
if ((!$selectedIsArray && !$selectedIsEmpty && (string)$attributes['value'] == (string)$name) ||
|
||||||
(!$selectedIsArray && !$selectedIsEmpty && (string)$attributes['value'] == (string)$name) ||
|
|
||||||
($selectedIsArray && in_array((string)$name, $attributes['value'], !$isNumeric))
|
($selectedIsArray && in_array((string)$name, $attributes['value'], !$isNumeric))
|
||||||
) {
|
) {
|
||||||
if ($attributes['style'] === 'checkbox') {
|
if ($attributes['style'] === 'checkbox') {
|
||||||
|
@ -2786,8 +2779,7 @@ class FormHelper extends AppHelper {
|
||||||
$disabledIsNumeric = is_numeric($name);
|
$disabledIsNumeric = is_numeric($name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (
|
if ($hasDisabled &&
|
||||||
$hasDisabled &&
|
|
||||||
$disabledIsArray &&
|
$disabledIsArray &&
|
||||||
in_array((string)$name, $attributes['disabled'], !$disabledIsNumeric)
|
in_array((string)$name, $attributes['disabled'], !$disabledIsNumeric)
|
||||||
) {
|
) {
|
||||||
|
@ -2906,8 +2898,7 @@ class FormHelper extends AppHelper {
|
||||||
if ($min > $max) {
|
if ($min > $max) {
|
||||||
list($min, $max) = array($max, $min);
|
list($min, $max) = array($max, $min);
|
||||||
}
|
}
|
||||||
if (
|
if (!empty($options['value']) &&
|
||||||
!empty($options['value']) &&
|
|
||||||
(int)$options['value'] < $min &&
|
(int)$options['value'] < $min &&
|
||||||
(int)$options['value'] > 0
|
(int)$options['value'] > 0
|
||||||
) {
|
) {
|
||||||
|
|
Loading…
Reference in a new issue