mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[feature/twig] Variable regular expressions should be lazy
PHPBB3-11598
This commit is contained in:
parent
0894a13770
commit
70a553e0b5
1 changed files with 3 additions and 3 deletions
|
@ -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') }}
|
// Replace all of our language variables, {L_VARNAME}, with Twig style, {{ lang('NAME') }}
|
||||||
// Appends any filters after lang()
|
// 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 }}
|
// Replace all of our escaped language variables, {LA_VARNAME}, with Twig style, {{ lang('NAME')|addslashes }}
|
||||||
// Appends any filters after lang(), but before 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 }}
|
// Replace all of our variables, {VARNAME}, with Twig style, {{ VARNAME }}
|
||||||
// Appends any filters
|
// 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);
|
return parent::tokenize($code, $filename);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue