Upgrade Twig library

This commit is contained in:
Michael Foster 2013-08-01 15:20:12 -04:00
parent 22f3a95e0e
commit 0fe5528574
133 changed files with 5080 additions and 1386 deletions

View file

@ -13,8 +13,7 @@
/**
* Represents a module node.
*
* @package twig
* @author Fabien Potencier <fabien@symfony.com>
* @author Fabien Potencier <fabien@symfony.com>
*/
class Twig_Node_SandboxedModule extends Twig_Node_Module
{
@ -24,7 +23,9 @@ class Twig_Node_SandboxedModule extends Twig_Node_Module
public function __construct(Twig_Node_Module $node, array $usedFilters, array $usedTags, array $usedFunctions)
{
parent::__construct($node->getNode('body'), $node->getNode('parent'), $node->getNode('blocks'), $node->getNode('macros'), $node->getNode('traits'), $node->getAttribute('filename'), $node->getLine(), $node->getNodeTag());
parent::__construct($node->getNode('body'), $node->getNode('parent'), $node->getNode('blocks'), $node->getNode('macros'), $node->getNode('traits'), $node->getAttribute('embedded_templates'), $node->getAttribute('filename'), $node->getLine(), $node->getNodeTag());
$this->setAttribute('index', $node->getAttribute('index'));
$this->usedFilters = $usedFilters;
$this->usedTags = $usedTags;
@ -33,9 +34,7 @@ class Twig_Node_SandboxedModule extends Twig_Node_Module
protected function compileDisplayBody(Twig_Compiler $compiler)
{
if (null === $this->getNode('parent')) {
$compiler->write("\$this->checkSecurity();\n");
}
$compiler->write("\$this->checkSecurity();\n");
parent::compileDisplayBody($compiler);
}
@ -45,7 +44,7 @@ class Twig_Node_SandboxedModule extends Twig_Node_Module
parent::compileDisplayFooter($compiler);
$compiler
->write("protected function checkSecurity() {\n")
->write("protected function checkSecurity()\n", "{\n")
->indent()
->write("\$this->env->getExtension('sandbox')->checkSecurity(\n")
->indent()
@ -54,16 +53,6 @@ class Twig_Node_SandboxedModule extends Twig_Node_Module
->write(!$this->usedFunctions ? "array()\n" : "array('".implode('\', \'', $this->usedFunctions)."')\n")
->outdent()
->write(");\n")
;
if (null !== $this->getNode('parent')) {
$compiler
->raw("\n")
->write("\$this->parent->checkSecurity();\n")
;
}
$compiler
->outdent()
->write("}\n\n")
;