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

event.php

Zuletzt modifiziert: 09.10.2024, 12:55 - Dateigröße: 2.29 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 event extends \Twig_Node
 18  {
 19      /**
 20      * The subdirectory in which all template listener files must be placed
 21      * @var string
 22      */
 23      protected $listener_directory = 'event/';
 24   
 25      /** @var \Twig_Environment */
 26      protected $environment;
 27   
 28      public function __construct(\Twig_Node_Expression $expr, \phpbb\template\twig\environment $environment, $lineno, $tag = null)
 29      {
 30          $this->environment = $environment;
 31   
 32          parent::__construct(array('expr' => $expr), array(), $lineno, $tag);
 33      }
 34   
 35      /**
 36      * Compiles the node to PHP.
 37      *
 38      * @param \Twig_Compiler A Twig_Compiler instance
 39      */
 40      public function compile(\Twig_Compiler $compiler)
 41      {
 42          $compiler->addDebugInfo($this);
 43   
 44          $location = $this->listener_directory . $this->getNode('expr')->getAttribute('name');
 45   
 46          foreach ($this->environment->get_phpbb_extensions() as $ext_namespace => $ext_path)
 47          {
 48              $ext_namespace = str_replace('/', '_', $ext_namespace);
 49   
 50              if (defined('DEBUG'))
 51              {
 52                  // If debug mode is enabled, lets check for new/removed EVENT
 53                  //  templates on page load rather than at compile. This is
 54                  //  slower, but makes developing extensions easier (no need to
 55                  //  purge the cache when a new event template file is added)
 56                  $compiler
 57                      ->write("if (\$this->env->getLoader()->exists('@{$ext_namespace}/{$location}.html')) {\n")
 58                      ->indent()
 59                  ;
 60              }
 61   
 62              if (defined('DEBUG') || $this->environment->getLoader()->exists('@' . $ext_namespace . '/' . $location . '.html'))
 63              {
 64                  $compiler
 65                      ->write("\$previous_look_up_order = \$this->env->getNamespaceLookUpOrder();\n")
 66   
 67                      // We set the namespace lookup order to be this extension first, then the main path
 68                      ->write("\$this->env->setNamespaceLookUpOrder(array('{$ext_namespace}', '__main__'));\n")
 69                      ->write("\$this->env->loadTemplate('@{$ext_namespace}/{$location}.html')->display(\$context);\n")
 70                      ->write("\$this->env->setNamespaceLookUpOrder(\$previous_look_up_order);\n")
 71                  ;
 72              }
 73   
 74              if (defined('DEBUG'))
 75              {
 76                  $compiler
 77                      ->outdent()
 78                      ->write("}\n\n")
 79                  ;
 80              }
 81          }
 82      }
 83  }
 84