diff options
| author | Nathaniel Guse <nathaniel.guse@gmail.com> | 2013-07-01 09:19:30 -0500 |
|---|---|---|
| committer | Nathaniel Guse <nathaniel.guse@gmail.com> | 2013-07-01 09:19:30 -0500 |
| commit | 2c55671767e194fb37cae674c0730e4bc50c0356 (patch) | |
| tree | 4b4637a3e7cdfee463bba515637b4b647f6aa322 | |
| parent | c49d27329d5962f41ee850df2a0937528361151d (diff) | |
| download | forums-2c55671767e194fb37cae674c0730e4bc50c0356.tar forums-2c55671767e194fb37cae674c0730e4bc50c0356.tar.gz forums-2c55671767e194fb37cae674c0730e4bc50c0356.tar.bz2 forums-2c55671767e194fb37cae674c0730e4bc50c0356.tar.xz forums-2c55671767e194fb37cae674c0730e4bc50c0356.zip | |
[feature/twig] Fixing div by replacement
PHPBB3-11598
| -rw-r--r-- | phpBB/includes/template/twig/lexer.php | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/phpBB/includes/template/twig/lexer.php b/phpBB/includes/template/twig/lexer.php index 258b913a2c..a2afcf18be 100644 --- a/phpBB/includes/template/twig/lexer.php +++ b/phpBB/includes/template/twig/lexer.php @@ -177,12 +177,12 @@ class phpbb_template_twig_lexer extends Twig_Lexer // Replace .test with test|length $matches[1] = preg_replace('#\s\.([a-zA-Z_0-9]+)#', ' $1|length', $matches[1]); - // Replace our "div by" with Twig's divisibleby (Twig does not like test names with spaces?) - $matches[1] = preg_replace('# div by ([0-9]+)#', ' divisibleby($1)', $matches[1]); - return '<!-- IF' . $matches[1] . '-->'; }; + // Replace our "div by" with Twig's divisibleby (Twig does not like test names with spaces) + $code = preg_replace('# div by ([0-9]+)#', ' divisibleby($1)', $code); + return preg_replace_callback('#<!-- IF((.*)[\s][\$|\.|!]([^\s]+)(.*))-->#', $callback, $code); } |
