1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-26 01:04:10 +02:00

[feature/twig] Fixing div by replacement

PHPBB3-11598
This commit is contained in:
Nathaniel Guse 2013-07-01 09:19:30 -05:00
parent c49d27329d
commit 2c55671767

View File

@ -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);
}