mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-09 12:58:52 +00:00
[feature/twig] INCLUDEPHP behavior now supports local relative paths
As a last resort, now we use the Twig Loader to find the correct file to include to (most specific file first, then parent styles). Also allows using @namespace convention. This is ONLY done if the specified path is not an absolute path AND the file does not exist relative to the phpBB root path. PHPBB3-11598
This commit is contained in:
parent
59d13d0535
commit
02a8150bb6
1 changed files with 8 additions and 1 deletions
|
@ -52,11 +52,18 @@ class phpbb_template_twig_node_includephp extends Twig_Node
|
|||
->raw(";\n")
|
||||
->write("if (phpbb_is_absolute(\$location)) {\n")
|
||||
->indent()
|
||||
// Absolute path specified
|
||||
->write("require(\$location);\n")
|
||||
->outdent()
|
||||
->write("} else if (file_exists(\$this->getEnvironment()->get_phpbb_root_path() . \$location)) {\n")
|
||||
->indent()
|
||||
// PHP file relative to phpbb_root_path
|
||||
->write("require(\$this->getEnvironment()->get_phpbb_root_path() . \$location);\n")
|
||||
->outdent()
|
||||
->write("} else {\n")
|
||||
->indent()
|
||||
->write("require(\$this->getEnvironment()->get_phpbb_root_path() . \$location);\n")
|
||||
// Local path (behaves like INCLUDE)
|
||||
->write("require(\$this->getEnvironment()->getLoader()->getCacheKey(\$location));\n")
|
||||
->outdent()
|
||||
->write("}\n")
|
||||
;
|
||||
|
|
Loading…
Add table
Reference in a new issue