diff --git a/phpBB/includes/template/twig/extension.php b/phpBB/includes/template/twig/extension.php index a3da61fcdb..1ea5f7b662 100644 --- a/phpBB/includes/template/twig/extension.php +++ b/phpBB/includes/template/twig/extension.php @@ -57,6 +57,7 @@ class phpbb_template_twig_extension extends Twig_Extension { return array( new Twig_SimpleFilter('subset', array($this, 'loop_subset'), array('needs_environment' => true)), + new Twig_SimpleFilter('addslashes', 'addslashes'), ); } diff --git a/phpBB/includes/template/twig/lexer.php b/phpBB/includes/template/twig/lexer.php index 1daa6c30c9..131cf654ef 100644 --- a/phpBB/includes/template/twig/lexer.php +++ b/phpBB/includes/template/twig/lexer.php @@ -62,8 +62,8 @@ class phpbb_template_twig_lexer extends Twig_Lexer // Replace all of our language variables, {L_VARNAME}, with Twig style, {{ lang('NAME') }} $code = preg_replace('#{L_([a-zA-Z0-9_\.]+)}#', '{{ lang(\'$1\') }}', $code); - // Replace all of our JS escaped language variables, {LA_VARNAME}, with Twig style, {{ lang('NAME')|escape('js') }} - $code = preg_replace('#{LA_([a-zA-Z0-9_\.]+)}#', '{{ lang(\'$1\')|escape(\'js\') }}', $code); + // Replace all of our escaped language variables, {LA_VARNAME}, with Twig style, {{ lang('NAME')|addslashes }} + $code = preg_replace('#{LA_([a-zA-Z0-9_\.]+)}#', '{{ lang(\'$1\')|addslashes }}', $code); // Replace all of our variables, {VARNAME}, with Twig style, {{ VARNAME }} $code = preg_replace('#{([a-zA-Z0-9_\.]+)}#', '{{ $1 }}', $code);