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 |
includephp.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 * Sections (c) 2009 Fabien Potencier, Armin Ronacher
08 * @license GNU General Public License, version 2 (GPL-2.0)
09 *
10 * For full copyright and license information, please see
11 * the docs/CREDITS.txt file.
12 *
13 */
14
15 namespace phpbb\template\twig\node;
16
17 class includephp extends \Twig_Node
18 {
19 /** @var \Twig_Environment */
20 protected $environment;
21
22 public function __construct(\Twig_Node_Expression $expr, \phpbb\template\twig\environment $environment, $lineno, $ignoreMissing = false, $tag = null)
23 {
24 $this->environment = $environment;
25
26 parent::__construct(array('expr' => $expr), array('ignore_missing' => (Boolean) $ignoreMissing), $lineno, $tag);
27 }
28
29 /**
30 * Compiles the node to PHP.
31 *
32 * @param \Twig_Compiler A Twig_Compiler instance
33 */
34 public function compile(\Twig_Compiler $compiler)
35 {
36 $compiler->addDebugInfo($this);
37
38 $config = $this->environment->get_phpbb_config();
39
40 if (!$config['tpl_allow_php'])
41 {
42 $compiler
43 ->write("// INCLUDEPHP Disabled\n")
44 ;
45
46 return;
47 }
48
49 if ($this->getAttribute('ignore_missing'))
50 {
51 $compiler
52 ->write("try {\n")
53 ->indent()
54 ;
55 }
56
57 $compiler
58 ->write("\$location = ")
59 ->subcompile($this->getNode('expr'))
60 ->raw(";\n")
61 ->write("if (phpbb_is_absolute(\$location)) {\n")
62 ->indent()
63 // Absolute path specified
64 ->write("require(\$location);\n")
65 ->outdent()
66 ->write("} else if (file_exists(\$this->getEnvironment()->get_phpbb_root_path() . \$location)) {\n")
67 ->indent()
68 // PHP file relative to phpbb_root_path
69 ->write("require(\$this->getEnvironment()->get_phpbb_root_path() . \$location);\n")
70 ->outdent()
71 ->write("} else {\n")
72 ->indent()
73 // Local path (behaves like INCLUDE)
74 ->write("require(\$this->getEnvironment()->getLoader()->getCacheKey(\$location));\n")
75 ->outdent()
76 ->write("}\n")
77 ;
78
79 if ($this->getAttribute('ignore_missing'))
80 {
81 $compiler
82 ->outdent()
83 ->write("} catch (\Twig_Error_Loader \$e) {\n")
84 ->indent()
85 ->write("// ignore missing template\n")
86 ->outdent()
87 ->write("}\n\n")
88 ;
89 }
90 }
91 }
92