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. |
|
(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
18 class includephp extends \Twig_Node
19 {
20 /** @var \Twig_Environment */
21 protected $environment;
22
23 public function __construct(\Twig_Node_Expression $expr, \phpbb\template\twig\environment $environment, $lineno, $ignoreMissing = false, $tag = null)
24 {
25 $this->environment = $environment;
26
27 parent::__construct(array('expr' => $expr), array('ignore_missing' => (Boolean) $ignoreMissing), $lineno, $tag);
28 }
29
30 /**
31 * Compiles the node to PHP.
32 *
33 * @param \Twig_Compiler A Twig_Compiler instance
34 */
35 public function compile(\Twig_Compiler $compiler)
36 {
37 $compiler->addDebugInfo($this);
38
39 $config = $this->environment->get_phpbb_config();
40
41 if (!$config['tpl_allow_php'])
42 {
43 $compiler
44 ->write("// INCLUDEPHP Disabled\n")
45 ;
46
47 return;
48 }
49
50 if ($this->getAttribute('ignore_missing')) {
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 $compiler
81 ->outdent()
82 ->write("} catch (\Twig_Error_Loader \$e) {\n")
83 ->indent()
84 ->write("// ignore missing template\n")
85 ->outdent()
86 ->write("}\n\n")
87 ;
88 }
89 }
90 }
91