Verzeichnisstruktur phpBB-3.2.0
- Veröffentlicht
- 06.01.2017
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. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
includeasset.php
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(), \$this->getEnvironment()->get_filesystem());\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("}\n")
53 ->write("\$asset->add_assets_version('{$config['assets_version']}');\n")
54 ->outdent()
55 ->write("}\n")
56 ->write("\$this->getEnvironment()->get_assets_bag()->add_{$this->get_setters_name()}(\$asset);")
57 ;
58 }
59
60 /**
61 * Get the name of the assets bag setter
62 *
63 * @return string (e.g. 'script')
64 */
65 abstract public function get_setters_name();
66 }
67