diff options
Diffstat (limited to 'phpBB/includes/template/twig/lexer.php')
-rw-r--r-- | phpBB/includes/template/twig/lexer.php | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/phpBB/includes/template/twig/lexer.php b/phpBB/includes/template/twig/lexer.php index 70a21307ec..f60c58249c 100644 --- a/phpBB/includes/template/twig/lexer.php +++ b/phpBB/includes/template/twig/lexer.php @@ -42,11 +42,24 @@ class phpbb_template_twig_lexer extends Twig_Lexer */ if ($last_element->getValue() === 'IF') { - if (preg_match('#^\s*\.([a-zA-Z0-9\.]+)#', substr($this->code, $this->cursor), $match)) + if (preg_match('#^\s*\.([a-zA-Z0-9_\.]+)#', substr($this->code, $this->cursor), $match)) { $this->pushToken(Twig_Token::STRING_TYPE, stripcslashes($match[1])); $this->moveCursor($match[0]); } } + + /** + * This is some compatibility code to continue supporting expressions such as: + * <!-- DEFINE $VAR = 'foo' --> + */ + if ($last_element->getValue() === 'DEFINE') + { + if (preg_match('#^\s*\$([A-Z0-9]+)#', substr($this->code, $this->cursor), $match)) + { + $this->pushToken(Twig_Token::STRING_TYPE, stripcslashes($match[1])); + $this->moveCursor($match[1]); + } + } } } |