mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-25 19:38:53 +00:00
[feature/twig] Fix includephp node
PHPBB3-11598
This commit is contained in:
parent
1b2e5503ac
commit
e9bbeeb1a4
1 changed files with 6 additions and 8 deletions
|
@ -46,19 +46,17 @@ class phpbb_template_twig_node_includephp extends Twig_Node
|
|||
;
|
||||
}
|
||||
|
||||
// Replace variables in the expression
|
||||
$expr = preg_replace('#{{ ([a-zA-Z0-9_]+) }}#', '\' . ((isset($context["$1"])) ? $context["$1"] : null) . \'', $this->getNode('expr')->getAttribute('value'));
|
||||
|
||||
$compiler
|
||||
->write("if (phpbb_is_absolute('$expr')) {\n")
|
||||
->write("\$location = ")
|
||||
->subcompile($this->getNode('expr'))
|
||||
->raw(";\n")
|
||||
->write("if (phpbb_is_absolute(\$location)) {\n")
|
||||
->indent()
|
||||
->write("require('$expr');\n")
|
||||
->write("require(\$location);\n")
|
||||
->outdent()
|
||||
->write("} else {\n")
|
||||
->indent()
|
||||
->write("require(\$this->getEnvironment()->get_phpbb_root_path() . '")
|
||||
->raw($expr)
|
||||
->raw("');\n")
|
||||
->write("require(\$this->getEnvironment()->get_phpbb_root_path() . \$location);\n")
|
||||
->outdent()
|
||||
->write("}\n")
|
||||
;
|
||||
|
|
Loading…
Add table
Reference in a new issue