コード例 #1
0
ファイル: SandboxPrint.php プロジェクト: nmcteam/Twig
 public function compile($compiler)
 {
     $compiler->addDebugInfo($this)->write('if ($this->env->hasExtension(\'sandbox\') && is_object(')->subcompile($this->expr)->raw(')) {' . "\n")->indent()->write('$this->env->getExtension(\'sandbox\')->checkMethodAllowed(')->subcompile($this->expr)->raw(', \'__toString\');' . "\n")->outdent()->write('}' . "\n");
     parent::compile($compiler);
 }
コード例 #2
0
 /**
  * Compiles the node to PHP.
  *
  * @param Twig_Compiler A Twig_Compiler instance
  */
 public function compile(Twig_Compiler $compiler)
 {
     $compiler->addDebugInfo($this)->write('if (is_object(')->raw('$_tmp = ')->subcompile($this->removeNodeFilter($this->getNode('expr')))->raw(')) {' . "\n")->indent()->write('$this->env->getExtension(\'sandbox\')->checkMethodAllowed(')->raw('$_tmp, \'__toString\');' . "\n")->outdent()->write('}' . "\n");
     parent::compile($compiler);
 }