mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-27 04:18:55 +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
|
$compiler
|
||||||
->write("if (phpbb_is_absolute('$expr')) {\n")
|
->write("\$location = ")
|
||||||
|
->subcompile($this->getNode('expr'))
|
||||||
|
->raw(";\n")
|
||||||
|
->write("if (phpbb_is_absolute(\$location)) {\n")
|
||||||
->indent()
|
->indent()
|
||||||
->write("require('$expr');\n")
|
->write("require(\$location);\n")
|
||||||
->outdent()
|
->outdent()
|
||||||
->write("} else {\n")
|
->write("} else {\n")
|
||||||
->indent()
|
->indent()
|
||||||
->write("require(\$this->getEnvironment()->get_phpbb_root_path() . '")
|
->write("require(\$this->getEnvironment()->get_phpbb_root_path() . \$location);\n")
|
||||||
->raw($expr)
|
|
||||||
->raw("');\n")
|
|
||||||
->outdent()
|
->outdent()
|
||||||
->write("}\n")
|
->write("}\n")
|
||||||
;
|
;
|
||||||
|
|
Loading…
Add table
Reference in a new issue