mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 22:10:45 +02:00
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
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user