PEEL Shopping
Open source ecommerce : PEEL Shopping
SandboxedModule.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of Twig.
5  *
6  * (c) 2009 Fabien Potencier
7  * (c) 2009 Armin Ronacher
8  *
9  * For the full copyright and license information, please view the LICENSE
10  * file that was distributed with this source code.
11  */
12 
19 {
20  protected $usedFilters;
21  protected $usedTags;
22  protected $usedFunctions;
23 
24  public function __construct(Twig_Node_Module $node, array $usedFilters, array $usedTags, array $usedFunctions)
25  {
26  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());
27 
28  $this->setAttribute('index', $node->getAttribute('index'));
29 
30  $this->usedFilters = $usedFilters;
31  $this->usedTags = $usedTags;
32  $this->usedFunctions = $usedFunctions;
33  }
34 
35  protected function compileDisplayBody(Twig_Compiler $compiler)
36  {
37  $compiler->write("\$this->checkSecurity();\n");
38 
39  parent::compileDisplayBody($compiler);
40  }
41 
42  protected function compileDisplayFooter(Twig_Compiler $compiler)
43  {
44  parent::compileDisplayFooter($compiler);
45 
46  $compiler
47  ->write("protected function checkSecurity()\n", "{\n")
48  ->indent()
49  ->write("\$this->env->getExtension('sandbox')->checkSecurity(\n")
50  ->indent()
51  ->write(!$this->usedTags ? "array(),\n" : "array('".implode('\', \'', $this->usedTags)."'),\n")
52  ->write(!$this->usedFilters ? "array(),\n" : "array('".implode('\', \'', $this->usedFilters)."'),\n")
53  ->write(!$this->usedFunctions ? "array()\n" : "array('".implode('\', \'', $this->usedFunctions)."')\n")
54  ->outdent()
55  ->write(");\n")
56  ->outdent()
57  ->write("}\n\n")
58  ;
59  }
60 }
getLine()
Definition: Node.php:109
Represents a module node.
__construct(Twig_Node_Module $node, array $usedFilters, array $usedTags, array $usedFunctions)
Compiles a node to PHP code.
Definition: Compiler.php:18
getNodeTag()
Definition: Node.php:114
getAttribute($name)
Gets an attribute.
Definition: Node.php:138
setAttribute($name, $value)
Sets an attribute.
Definition: Node.php:153
compileDisplayFooter(Twig_Compiler $compiler)
Represents a module node.
Definition: Module.php:18
compileDisplayBody(Twig_Compiler $compiler)
write()
Writes a string to the compiled code by adding indentation.
Definition: Compiler.php:121
getNode($name)
Gets a node by name.
Definition: Node.php:187

This documentation for Open ecommerce PEEL Shopping and PEEL.fr has been generated by Doxygen on Thu Oct 15 2015 14:41:19 - Peel ecommerce is a product of Agence web Advisto SAS. All rights reserved.