diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2013-08-30 19:53:54 +0200 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2013-08-30 19:53:54 +0200 |
commit | 9d6370751f1b998e3da448e16c1446b33ddd17d0 (patch) | |
tree | 42cd824be2e41034a05542bbe66a4ba3f721d9bb /phpBB/phpbb/template/twig/lexer.php | |
parent | afc12906b92c2cf126fa2ff9006583d0c4ef01ec (diff) | |
parent | 38a7aac0cceee521fbf2550750a85b4d6bf80ec1 (diff) | |
download | forums-9d6370751f1b998e3da448e16c1446b33ddd17d0.tar forums-9d6370751f1b998e3da448e16c1446b33ddd17d0.tar.gz forums-9d6370751f1b998e3da448e16c1446b33ddd17d0.tar.bz2 forums-9d6370751f1b998e3da448e16c1446b33ddd17d0.tar.xz forums-9d6370751f1b998e3da448e16c1446b33ddd17d0.zip |
Merge remote-tracking branch 'EXreaction/ticket/11724' into develop
* EXreaction/ticket/11724:
[ticket/11724] Handle ELSE IF separately
[ticket/11724] Replace spaces with tabs
[ticket/11724] Support "ELSE IF" and "ELSEIF" in the same way
Diffstat (limited to 'phpBB/phpbb/template/twig/lexer.php')
-rw-r--r-- | phpBB/phpbb/template/twig/lexer.php | 9 |
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); } |