projects
/
web/konrad/twig.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
(parent:
61f2b2a
)
Avoid strtolower call at every twig_escape_filter call
author
Jordi Boggiano
<j.boggiano@seld.be>
Mon, 6 May 2013 12:12:55 +0000 (14:12 +0200)
committer
Jordi Boggiano
<j.boggiano@seld.be>
Mon, 6 May 2013 12:12:55 +0000 (14:12 +0200)
lib/Twig/Extension/Core.php
patch
|
blob
|
history
diff --git
a/lib/Twig/Extension/Core.php
b/lib/Twig/Extension/Core.php
index
e0a6a33
..
8d984eb
100644
(file)
--- a/
lib/Twig/Extension/Core.php
+++ b/
lib/Twig/Extension/Core.php
@@
-885,7
+885,14
@@
function twig_escape_filter(Twig_Environment $env, $string, $strategy = 'html',
'iso8859-5' => true, 'iso-8859-5' => true, 'macroman' => true,
);
+ if (isset($htmlspecialcharsCharsets[$charset])) {
+ return htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, $charset);
+ }
+
if (isset($htmlspecialcharsCharsets[strtolower($charset)])) {
+ // cache the uppercase variant for future iterations
+ $htmlspecialcharsCharsets[$charset] = true;
+
return htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, $charset);
}