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

includeasset.php

Zuletzt modifiziert: 09.10.2024, 12:55 - Dateigröße: 2.18 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  abstract class includeasset extends \Twig_Node
 17  {
 18      /** @var \Twig_Environment */
 19      protected $environment;
 20   
 21      public function __construct(\Twig_Node_Expression $expr, \phpbb\template\twig\environment $environment, $lineno, $tag = null)
 22      {
 23          $this->environment = $environment;
 24   
 25          parent::__construct(array('expr' => $expr), array(), $lineno, $tag);
 26      }
 27      /**
 28      * Compiles the node to PHP.
 29      *
 30      * @param \Twig_Compiler A Twig_Compiler instance
 31      */
 32      public function compile(\Twig_Compiler $compiler)
 33      {
 34          $compiler->addDebugInfo($this);
 35   
 36          $config = $this->environment->get_phpbb_config();
 37   
 38          $compiler
 39              ->write("\$asset_file = ")
 40              ->subcompile($this->getNode('expr'))
 41              ->raw(";\n")
 42              ->write("\$asset = new \phpbb\\template\\asset(\$asset_file, \$this->getEnvironment()->get_path_helper());\n")
 43              ->write("if (substr(\$asset_file, 0, 2) !== './' && \$asset->is_relative()) {\n")
 44              ->indent()
 45                  ->write("\$asset_path = \$asset->get_path();")
 46                  ->write("\$local_file = \$this->getEnvironment()->get_phpbb_root_path() . \$asset_path;\n")
 47                  ->write("if (!file_exists(\$local_file)) {\n")
 48                  ->indent()
 49                      ->write("\$local_file = \$this->getEnvironment()->findTemplate(\$asset_path);\n")
 50                      ->write("\$asset->set_path(\$local_file, true);\n")
 51                  ->outdent()
 52                  ->write("\$asset->add_assets_version('{$config['assets_version']}');\n")
 53                  ->write("\$asset_file = \$asset->get_url();\n")
 54                  ->write("}\n")
 55              ->outdent()
 56              ->write("}\n")
 57              ->write("\$context['definition']->append('{$this->get_definition_name()}', '")
 58          ;
 59   
 60          $this->append_asset($compiler);
 61   
 62          $compiler
 63              ->raw("\n');\n")
 64          ;
 65      }
 66   
 67      /**
 68      * Get the definition name
 69      *
 70      * @return string (e.g. 'SCRIPTS')
 71      */
 72      abstract public function get_definition_name();
 73   
 74      /**
 75      * Append the output code for the asset
 76      *
 77      * @param \Twig_Compiler A Twig_Compiler instance
 78      * @return null
 79      */
 80      abstract protected function append_asset(\Twig_Compiler $compiler);
 81  }
 82