[ Index ]

PHP Cross Reference of phpBB-3.3.2-deutsch

title

Body

[close]

/phpbb/template/twig/node/ -> includenode.php (source)

   1  <?php
   2  /**
   3  *
   4  * This file is part of the phpBB Forum Software package.
   5  *
   6  * @copyright (c) phpBB Limited <https://www.phpbb.com>
   7  * @license GNU General Public License, version 2 (GPL-2.0)
   8  *
   9  * For full copyright and license information, please see
  10  * the docs/CREDITS.txt file.
  11  *
  12  */
  13  
  14  namespace phpbb\template\twig\node;
  15  
  16  class includenode extends \Twig\Node\IncludeNode
  17  {
  18      /**
  19      * Compiles the node to PHP.
  20      *
  21      * @param \Twig\Compiler A Twig\Compiler instance
  22      */
  23  	public function compile(\Twig\Compiler $compiler)
  24      {
  25          $compiler->addDebugInfo($this);
  26  
  27          $compiler
  28              ->write("\$location = ")
  29              ->subcompile($this->getNode('expr'))
  30              ->raw(";\n")
  31              ->write("\$namespace = false;\n")
  32              ->write("if (strpos(\$location, '@') === 0) {\n")
  33              ->indent()
  34                  ->write("\$namespace = substr(\$location, 1, strpos(\$location, '/') - 1);\n")
  35                  ->write("\$previous_look_up_order = \$this->env->getNamespaceLookUpOrder();\n")
  36  
  37                  // We set the namespace lookup order to be this namespace first, then the main path
  38                  ->write("\$this->env->setNamespaceLookUpOrder(array(\$namespace, '__main__'));\n")
  39              ->outdent()
  40              ->write("}\n")
  41          ;
  42  
  43          parent::compile($compiler);
  44  
  45          $compiler
  46              ->write("if (\$namespace) {\n")
  47              ->indent()
  48                  ->write("\$this->env->setNamespaceLookUpOrder(\$previous_look_up_order);\n")
  49              ->outdent()
  50              ->write("}\n")
  51          ;
  52      }
  53  }


Generated: Wed Nov 11 20:28:18 2020 Cross-referenced by PHPXref 0.7.1