Verzeichnisstruktur phpBB-3.1.0


Veröffentlicht
27.10.2014

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

includenode.php

Zuletzt modifiziert: 09.10.2024, 12:55 - Dateigröße: 1.31 KiB


01  <?php
02  /**
03  *
04  * This file is part of the phpBB Forum Software package.
05  *
06  * @copyright (c) phpBB Limited <https://www.phpbb.com>
07  * @license GNU General Public License, version 2 (GPL-2.0)
08  *
09  * 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   
17  class includenode extends \Twig_Node_Include
18  {
19      /**
20      * Compiles the node to PHP.
21      *
22      * @param \Twig_Compiler A Twig_Compiler instance
23      */
24      public function compile(\Twig_Compiler $compiler)
25      {
26          $compiler->addDebugInfo($this);
27   
28          $compiler
29              ->write("\$location = ")
30              ->subcompile($this->getNode('expr'))
31              ->raw(";\n")
32              ->write("\$namespace = false;\n")
33              ->write("if (strpos(\$location, '@') === 0) {\n")
34              ->indent()
35                  ->write("\$namespace = substr(\$location, 1, strpos(\$location, '/') - 1);\n")
36                  ->write("\$previous_look_up_order = \$this->env->getNamespaceLookUpOrder();\n")
37   
38                  // We set the namespace lookup order to be this namespace first, then the main path
39                  ->write("\$this->env->setNamespaceLookUpOrder(array(\$namespace, '__main__'));\n")
40              ->outdent()
41              ->write("}\n")
42          ;
43   
44          parent::compile($compiler);
45   
46          $compiler
47              ->write("if (\$namespace) {\n")
48              ->indent()
49                  ->write("\$this->env->setNamespaceLookUpOrder(\$previous_look_up_order);\n")
50              ->outdent()
51              ->write("}\n")
52          ;
53      }
54  }
55