ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Twig_Node_Sandbox Class Reference

Represents a sandbox node. More...

+ Inheritance diagram for Twig_Node_Sandbox:
+ Collaboration diagram for Twig_Node_Sandbox:

Public Member Functions

 __construct (Twig_NodeInterface $body, $lineno, $tag=null)
 
 compile (Twig_Compiler $compiler)
 Compiles the node to PHP. More...
 
- Public Member Functions inherited from Twig_Node
 __construct (array $nodes=array(), array $attributes=array(), $lineno=0, $tag=null)
 Constructor. More...
 
 __toString ()
 
 toXml ($asDom=false)
 
 compile (Twig_Compiler $compiler)
 Compiles the node to PHP. More...
 
 getTemplateLine ()
 
 getLine ()
 
 getNodeTag ()
 
 hasAttribute ($name)
 
 getAttribute ($name)
 
 setAttribute ($name, $value)
 
 removeAttribute ($name)
 
 hasNode ($name)
 
 getNode ($name)
 
 setNode ($name, $node=null)
 
 removeNode ($name)
 
 count ()
 
 getIterator ()
 
 setTemplateName ($name)
 
 getTemplateName ()
 
 setFilename ($name)
 
 getFilename ()
 
 compile (Twig_Compiler $compiler)
 Compiles the node to PHP. More...
 
 getLine ()
 
 getNodeTag ()
 

Additional Inherited Members

- Protected Attributes inherited from Twig_Node
 $nodes
 
 $attributes
 
 $lineno
 
 $tag
 

Detailed Description

Represents a sandbox node.

Author
Fabien Potencier fabie.nosp@m.n@sy.nosp@m.mfony.nosp@m..com

Definition at line 17 of file Sandbox.php.

Constructor & Destructor Documentation

◆ __construct()

Twig_Node_Sandbox::__construct ( Twig_NodeInterface  $body,
  $lineno,
  $tag = null 
)

Definition at line 19 of file Sandbox.php.

20 {
21 parent::__construct(array('body' => $body), array(), $lineno, $tag);
22 }
$lineno
Definition: Node.php:22

References Twig_Node\$lineno, and Twig_Node\$tag.

Member Function Documentation

◆ compile()

Twig_Node_Sandbox::compile ( Twig_Compiler  $compiler)

Compiles the node to PHP.

Reimplemented from Twig_Node.

Definition at line 24 of file Sandbox.php.

25 {
26 $compiler
27 ->addDebugInfo($this)
28 ->write("\$sandbox = \$this->env->getExtension('Twig_Extension_Sandbox');\n")
29 ->write("if (!\$alreadySandboxed = \$sandbox->isSandboxed()) {\n")
30 ->indent()
31 ->write("\$sandbox->enableSandbox();\n")
32 ->outdent()
33 ->write("}\n")
34 ->subcompile($this->getNode('body'))
35 ->write("if (!\$alreadySandboxed) {\n")
36 ->indent()
37 ->write("\$sandbox->disableSandbox();\n")
38 ->outdent()
39 ->write("}\n")
40 ;
41 }
addDebugInfo(Twig_NodeInterface $node)
Adds debugging information.
Definition: Compiler.php:212
getNode($name)
Definition: Node.php:186

References Twig_Compiler\addDebugInfo(), and Twig_Node\getNode().

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: