mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Minor optimization in h()
Minor optimizations in FormHelper, as calls to ArrayAccess methods are avoided now.
This commit is contained in:
parent
7bfdbff377
commit
e40ee2576b
2 changed files with 6 additions and 10 deletions
|
@ -186,11 +186,7 @@ if (!function_exists('sortByKey')) {
|
|||
if (is_string($double)) {
|
||||
$charset = $double;
|
||||
}
|
||||
if ($charset) {
|
||||
return htmlspecialchars($text, ENT_QUOTES, $charset, $double);
|
||||
} else {
|
||||
return htmlspecialchars($text, ENT_QUOTES, $defaultCharset, $double);
|
||||
}
|
||||
return htmlspecialchars($text, ENT_QUOTES, ($charset) ? $charset : $defaultCharset, $double);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -243,12 +243,12 @@ class FormHelper extends AppHelper {
|
|||
if (empty($options['url']['controller'])) {
|
||||
if (!empty($model) && $model != $this->defaultModel) {
|
||||
$options['url']['controller'] = Inflector::underscore(Inflector::pluralize($model));
|
||||
} elseif (!empty($this->request['controller'])) {
|
||||
$options['url']['controller'] = Inflector::underscore($this->request['controller']);
|
||||
} elseif (!empty($this->request->params['controller'])) {
|
||||
$options['url']['controller'] = Inflector::underscore($this->request->params['controller']);
|
||||
}
|
||||
}
|
||||
if (empty($options['action'])) {
|
||||
$options['action'] = $this->request['action'];
|
||||
$options['action'] = $this->request->params['action'];
|
||||
}
|
||||
|
||||
$actionDefaults = array(
|
||||
|
@ -307,9 +307,9 @@ class FormHelper extends AppHelper {
|
|||
$htmlAttributes = array_merge($options, $htmlAttributes);
|
||||
|
||||
$this->fields = array();
|
||||
if (isset($this->request['_Token']) && !empty($this->request['_Token'])) {
|
||||
if (isset($this->request->params['_Token']) && !empty($this->request->params['_Token'])) {
|
||||
$append .= $this->hidden('_Token.key', array(
|
||||
'value' => $this->request['_Token']['key'], 'id' => 'Token' . mt_rand())
|
||||
'value' => $this->request->params['_Token']['key'], 'id' => 'Token' . mt_rand())
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue