diff options
author | Nathaniel Guse <nathaniel.guse@gmail.com> | 2013-06-25 16:27:58 -0500 |
---|---|---|
committer | Nathaniel Guse <nathaniel.guse@gmail.com> | 2013-06-25 16:27:58 -0500 |
commit | 8bccba1a2fb5479ead0594b09dad95d4d22a5cec (patch) | |
tree | 1350934232ad0d2529d54910502c2a98f7692efe /phpBB/includes/template/twig/node/includephp.php | |
parent | e227f05e9a79994046a13dccefcd032b3011ab5b (diff) | |
download | forums-8bccba1a2fb5479ead0594b09dad95d4d22a5cec.tar forums-8bccba1a2fb5479ead0594b09dad95d4d22a5cec.tar.gz forums-8bccba1a2fb5479ead0594b09dad95d4d22a5cec.tar.bz2 forums-8bccba1a2fb5479ead0594b09dad95d4d22a5cec.tar.xz forums-8bccba1a2fb5479ead0594b09dad95d4d22a5cec.zip |
[feature/twig] INCLUDEPHP token, replace variable usage with $context
I could find no better way to do this...
PHPBB3-11598
Diffstat (limited to 'phpBB/includes/template/twig/node/includephp.php')
-rw-r--r-- | phpBB/includes/template/twig/node/includephp.php | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/phpBB/includes/template/twig/node/includephp.php b/phpBB/includes/template/twig/node/includephp.php index 0f964556f0..6e77fac55d 100644 --- a/phpBB/includes/template/twig/node/includephp.php +++ b/phpBB/includes/template/twig/node/includephp.php @@ -46,10 +46,13 @@ 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("include(\$this->getEnvironment()->get_phpbb_root_path() . ") - ->subcompile($this->getNode('expr'), true) - ->raw(");\n") + ->write("require(\$this->getEnvironment()->get_phpbb_root_path() . '") + ->raw($expr) + ->raw("');\n") ; if ($this->getAttribute('ignore_missing')) { |