aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/phpbb/template/twig/lexer.php9
1 files changed, 6 insertions, 3 deletions
diff --git a/phpBB/phpbb/template/twig/lexer.php b/phpBB/phpbb/template/twig/lexer.php
index 3534311b7a..a33de70d69 100644
--- a/phpBB/phpbb/template/twig/lexer.php
+++ b/phpBB/phpbb/template/twig/lexer.php
@@ -219,6 +219,12 @@ class phpbb_template_twig_lexer extends Twig_Lexer
*/
protected function fix_if_tokens($code)
{
+ // Replace ELSE IF with ELSEIF
+ $code = preg_replace('#<!-- ELSE IF (.+?) -->#', '<!-- ELSEIF $1 -->', $code);
+
+ // 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);
+
$callback = function($matches)
{
$inner = $matches[2];
@@ -234,9 +240,6 @@ class phpbb_template_twig_lexer extends Twig_Lexer
return "<!-- {$matches[1]}IF{$inner}-->";
};
- // 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('#<!-- (ELSE)?IF((.*)[\s][\$|\.|!]([^\s]+)(.*))-->#', $callback, $code);
}