mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Caching charset in h(). It's save round 50% over each call by helpers.
This commit is contained in:
parent
22073e3376
commit
6882d96bf8
1 changed files with 11 additions and 5 deletions
|
@ -204,13 +204,19 @@ if (!function_exists('array_combine')) {
|
||||||
if (is_array($text)) {
|
if (is_array($text)) {
|
||||||
return array_map('h', $text);
|
return array_map('h', $text);
|
||||||
}
|
}
|
||||||
if (empty($charset)) {
|
|
||||||
$charset = Configure::read('App.encoding');
|
static $defaultCharset = false;
|
||||||
|
if ($defaultCharset === false) {
|
||||||
|
$defaultCharset = Configure::read('App.encoding');
|
||||||
|
if ($defaultCharset === null) {
|
||||||
|
$defaultCharset = 'UTF-8';
|
||||||
}
|
}
|
||||||
if (empty($charset)) {
|
|
||||||
$charset = 'UTF-8';
|
|
||||||
}
|
}
|
||||||
|
if ($charset) {
|
||||||
return htmlspecialchars($text, ENT_QUOTES, $charset);
|
return htmlspecialchars($text, ENT_QUOTES, $charset);
|
||||||
|
} else {
|
||||||
|
return htmlspecialchars($text, ENT_QUOTES, $defaultCharset);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue