<?php
namespace Moto\Twig\Widgets; use Twig_Compiler; use Twig_Node; class Widgets_Node extends Twig_Node { protected $_arguments = null; protected $_widgetName = null; public function __construct($widgetName, Twig_Node $arguments, Twig_Node $body, $lineno, $tag = null) { $this->_widgetName = $widgetName; $this->_arguments = $arguments; parent::__construct(array('body' => $body), array(), $lineno, $tag); } public function compile(Twig_Compiler $compiler) { $body = $this->getNode('body'); $args = array(); foreach($this->_arguments as $node) { $args[] = $node->getAttribute('value'); } $rrr = 1; $compiler ->addDebugInfo($this) ->write("\\Moto\\Application\n") ->write("if (!\$alreadySandboxed = \$sandbox->isSandboxed()) {\n") ->indent() ->write("\$sandbox->enableSandbox();\n") ->outdent() ->write("}\n") ->subcompile($this->getNode('body')) ->write("if (!\$alreadySandboxed) {\n") ->indent() ->write("\$sandbox->disableSandbox();\n") ->outdent() ->write("}\n") ; $compiler->addDebugInfo($this)->subcompile($args)->raw(";\n"); } } 