public function enterNode(Twig_NodeInterface $node, Twig_Environment $env) { if ($node instanceof Twig_Node_Module) { $this->inAModule = true; $this->tags = array(); $this->filters = array(); return $node; } elseif ($this->inAModule) { // look for tags if ($node->getNodeTag()) { $this->tags[$node->getNodeTag()] = true; } // look for filters if ($node instanceof Twig_Node_Expression_Filter) { foreach ($node->getFilters() as $filter) { $this->filters[$filter[0]] = true; } } // look for simple print statement ({{ article }}) if ($node instanceof Twig_Node_Print && $node->getExpression() instanceof Twig_Node_Expression_Name) { return new Twig_Node_SandboxPrint($node->getExpression(), $node->getLine(), $node->getNodeTag()); } } return $node; }
public function enterNode(Twig_NodeInterface $node, Twig_Environment $env) { if ($node instanceof Twig_Node_Filter) { $this->statusStack[] = $node->getFilters(); } elseif ($node instanceof Twig_Node_Print || $node instanceof Twig_Node_Text) { return $this->applyFilters($node); } return $node; }