diff options
| author | Michael Foster <savetheinternet@tinyboard.org> | 2013-09-19 16:08:25 +1000 |
|---|---|---|
| committer | Michael Foster <savetheinternet@tinyboard.org> | 2013-09-19 16:08:25 +1000 |
| commit | 9c48084f3b5064d580a5c88a6fe9170599cf8879 (patch) | |
| tree | cfee62fb06abbd182568efa0395be2077a021fca /inc/lib/Twig/Environment.php | |
| parent | 01857d176a2a9a2e3816b9cbf32da0c58f6aac3d (diff) | |
upgrade twig library
Diffstat (limited to 'inc/lib/Twig/Environment.php')
| -rwxr-xr-x[-rw-r--r--] | inc/lib/Twig/Environment.php | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/inc/lib/Twig/Environment.php b/inc/lib/Twig/Environment.php index 3afa73d6..09ea4a25 100644..100755 --- a/inc/lib/Twig/Environment.php +++ b/inc/lib/Twig/Environment.php @@ -16,7 +16,7 @@ */ class Twig_Environment { - const VERSION = '1.13.1'; + const VERSION = '1.14.0-DEV'; protected $charset; protected $loader; @@ -44,6 +44,7 @@ class Twig_Environment protected $functionCallbacks; protected $filterCallbacks; protected $staging; + protected $templateClasses; /** * Constructor. @@ -107,6 +108,7 @@ class Twig_Environment $this->setCache($options['cache']); $this->functionCallbacks = array(); $this->filterCallbacks = array(); + $this->templateClasses = array(); $this->addExtension(new Twig_Extension_Core()); $this->addExtension(new Twig_Extension_Escaper($options['autoescape'])); @@ -262,7 +264,13 @@ class Twig_Environment */ public function getTemplateClass($name, $index = null) { - return $this->templateClassPrefix.md5($this->getLoader()->getCacheKey($name)).(null === $index ? '' : '_'.$index); + $suffix = null === $index ? '' : '_'.$index; + $cls = $name.$suffix; + if (isset($this->templateClasses[$cls])) { + return $this->templateClasses[$cls]; + } + + return $this->templateClasses[$cls] = $this->templateClassPrefix.hash('sha256', $this->getLoader()->getCacheKey($name)).$suffix; } /** @@ -728,7 +736,7 @@ class Twig_Environment public function addNodeVisitor(Twig_NodeVisitorInterface $visitor) { if ($this->extensionInitialized) { - throw new LogicException('Unable to add a node visitor as extensions have already been initialized.', $extension->getName()); + throw new LogicException('Unable to add a node visitor as extensions have already been initialized.'); } $this->staging->addNodeVisitor($visitor); |
