PEEL Shopping
Open source ecommerce : PEEL Shopping
Sandbox.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  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11 
18 {
19  protected $inAModule = false;
20  protected $tags;
21  protected $filters;
22  protected $functions;
23 
32  public function enterNode(Twig_NodeInterface $node, Twig_Environment $env)
33  {
34  if ($node instanceof Twig_Node_Module) {
35  $this->inAModule = true;
36  $this->tags = array();
37  $this->filters = array();
38  $this->functions = array();
39 
40  return $node;
41  } elseif ($this->inAModule) {
42  // look for tags
43  if ($node->getNodeTag()) {
44  $this->tags[] = $node->getNodeTag();
45  }
46 
47  // look for filters
48  if ($node instanceof Twig_Node_Expression_Filter) {
49  $this->filters[] = $node->getNode('filter')->getAttribute('value');
50  }
51 
52  // look for functions
53  if ($node instanceof Twig_Node_Expression_Function) {
54  $this->functions[] = $node->getAttribute('name');
55  }
56 
57  // wrap print to check __toString() calls
58  if ($node instanceof Twig_Node_Print) {
59  return new Twig_Node_SandboxedPrint($node->getNode('expr'), $node->getLine(), $node->getNodeTag());
60  }
61  }
62 
63  return $node;
64  }
65 
74  public function leaveNode(Twig_NodeInterface $node, Twig_Environment $env)
75  {
76  if ($node instanceof Twig_Node_Module) {
77  $this->inAModule = false;
78 
79  return new Twig_Node_SandboxedModule($node, array_unique($this->filters), array_unique($this->tags), array_unique($this->functions));
80  }
81 
82  return $node;
83  }
84 
88  public function getPriority()
89  {
90  return 0;
91  }
92 }
enterNode(Twig_NodeInterface $node, Twig_Environment $env)
Called before child nodes are visited.
Definition: Sandbox.php:32
Represents a module node.
Twig_Node_SandboxedPrint adds a check for the __toString() method when the variable is an object and ...
Twig_NodeVisitor_Sandbox implements sandboxing.
Definition: Sandbox.php:17
leaveNode(Twig_NodeInterface $node, Twig_Environment $env)
Called after child nodes are visited.
Definition: Sandbox.php:74
if(strlen($date2)== '10') if($type== 'users-by-age'&&a_priv('admin_users', true)) elseif($type== 'forums-count'&&a_priv('admin_content', true)) elseif($type== 'forums-categories'&&a_priv('admin_content', true)) elseif($type== 'users-count'&&a_priv('admin_users', true)) elseif($type== 'product-categories'&&a_priv('admin_products', true)) elseif($type== 'users-by-sex'&&a_priv('admin_users', true)) elseif($type== 'users-by-country'&&a_priv('admin_users', true)) elseif($type== 'sales'&&a_priv('admin_sales', true))
Definition: chart-data.php:160
getPriority()
{Returns the priority for this visitor.Priority should be between -10 and 10 (0 is the default)...
Definition: Sandbox.php:88
Represents a module node.
Definition: Module.php:18
Twig_NodeVisitorInterface is the interface the all node visitor classes must implement.
Represents a node in the AST.
Stores the Twig configuration.
Definition: Environment.php:17
Represents a node that outputs an expression.
Definition: Print.php:18

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