mirror of
https://github.com/phpbb/phpbb.git
synced 2025-02-24 12:03:21 +01:00
[feature/twig] Variable regular expressions should be lazy
PHPBB3-11598
This commit is contained in:
parent
0894a13770
commit
70a553e0b5
@ -98,15 +98,15 @@ class phpbb_template_twig_lexer extends Twig_Lexer
|
||||
|
||||
// Replace all of our language variables, {L_VARNAME}, with Twig style, {{ lang('NAME') }}
|
||||
// Appends any filters after lang()
|
||||
$code = preg_replace('#{L_([a-zA-Z0-9_\.]+)(\|[^}]+)?}#', '{{ lang(\'$1\')$2 }}', $code);
|
||||
$code = preg_replace('#{L_([a-zA-Z0-9_\.]+)(\|[^}]+?)?}#', '{{ lang(\'$1\')$2 }}', $code);
|
||||
|
||||
// Replace all of our escaped language variables, {LA_VARNAME}, with Twig style, {{ lang('NAME')|addslashes }}
|
||||
// Appends any filters after lang(), but before addslashes
|
||||
$code = preg_replace('#{LA_([a-zA-Z0-9_\.]+)(\|[^}]+)?}#', '{{ lang(\'$1\')$2|addslashes }}', $code);
|
||||
$code = preg_replace('#{LA_([a-zA-Z0-9_\.]+)(\|[^}]+?)?}#', '{{ lang(\'$1\')$2|addslashes }}', $code);
|
||||
|
||||
// Replace all of our variables, {VARNAME}, with Twig style, {{ VARNAME }}
|
||||
// Appends any filters
|
||||
$code = preg_replace('#{([a-zA-Z0-9_\.]+)(\|[^}]+)?}#', '{{ $1$2 }}', $code);
|
||||
$code = preg_replace('#{([a-zA-Z0-9_\.]+)(\|[^}]+?)?}#', '{{ $1$2 }}', $code);
|
||||
|
||||
return parent::tokenize($code, $filename);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user