aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/template/twig/lexer.php
diff options
context:
space:
mode:
authorNathan Guse <nathaniel.guse@gmail.com>2013-09-06 09:08:53 -0500
committerNathan Guse <nathaniel.guse@gmail.com>2013-09-06 09:08:53 -0500
commit65f52d7575a8a7fe83cbfe7c5f35215ef8fba5b0 (patch)
tree840e0dc69209f7d73764483bfac68f4c238d37ef /phpBB/phpbb/template/twig/lexer.php
parent11317ef261c7811ea137d19ee38593d289ea6150 (diff)
parentdd86e8d0ae0179cf50076cdb1a8020266b6432a5 (diff)
downloadforums-65f52d7575a8a7fe83cbfe7c5f35215ef8fba5b0.tar
forums-65f52d7575a8a7fe83cbfe7c5f35215ef8fba5b0.tar.gz
forums-65f52d7575a8a7fe83cbfe7c5f35215ef8fba5b0.tar.bz2
forums-65f52d7575a8a7fe83cbfe7c5f35215ef8fba5b0.tar.xz
forums-65f52d7575a8a7fe83cbfe7c5f35215ef8fba5b0.zip
Merge branch 'develop' of github.com:phpbb/phpbb3 into ticket/11816
# By David King (16) and others # Via David King (13) and others * 'develop' of github.com:phpbb/phpbb3: (67 commits) [ticket/11825] Move schema_data.php into includes/ instead of phpbb/ [ticket/11215] Remove unnecessary comment [ticket/11755] MySQL upgrader out of date [prep-release-3.0.12] Update Changelog for 3.0.12-RC3 release. [prep-release-3.0.12] Bumping version number for 3.0.12-RC3. [ticket/11823] Set up nginx server to match PHP files with characters after .php [ticket/11812] Fix empty define [ticket/11818] Update Symfony dependencies to 2.3.* [ticket/11791] Load adm/ events from styles/adm/event/ [ticket/11215] Fix helper_url_test.php tests [ticket/11215] Add newline back to .htaccess, fix wording [ticket/11215] Update comment in .htaccess [ticket/11215] Uncomment rewrite rules in .htaccess [ticket/11215] Make controller helper url() method use correct format [ticket/11215] Add commented-out URL rewrite capability to .htaccess [ticket/11821] Fix comma usage next to "You are receiving this notification". [ticket/11769] Allow using 0 as poster name [ticket/11769] Allow '0' as username [ticket/11215] Use new URL structure for controllers [ticket/11215] Everything appears to be working... ... Conflicts: phpBB/phpbb/template/twig/lexer.php tests/template/template_test.php
Diffstat (limited to 'phpBB/phpbb/template/twig/lexer.php')
-rw-r--r--phpBB/phpbb/template/twig/lexer.php11
1 files changed, 7 insertions, 4 deletions
diff --git a/phpBB/phpbb/template/twig/lexer.php b/phpBB/phpbb/template/twig/lexer.php
index 719066b659..22e2c4ed3e 100644
--- a/phpBB/phpbb/template/twig/lexer.php
+++ b/phpBB/phpbb/template/twig/lexer.php
@@ -130,7 +130,7 @@ class phpbb_template_twig_lexer extends Twig_Lexer
// E.g. 'asdf'"' -> asdf'"
// E.g. "asdf'"" -> asdf'"
// E.g. 'asdf'" -> 'asdf'"
- $matches[2] = preg_replace('#^([\'"])?(.+?)\1$#', '$2', $matches[2]);
+ $matches[2] = preg_replace('#^([\'"])?(.*?)\1$#', '$2', $matches[2]);
// Replace template variables with start/end to parse variables (' ~ TEST ~ '.html)
$matches[2] = preg_replace('#{([a-zA-Z0-9_\.$]+)}#', "'~ \$1 ~'", $matches[2]);
@@ -219,6 +219,12 @@ class phpbb_template_twig_lexer extends Twig_Lexer
*/
protected function fix_if_tokens($code)
{
+ // Replace ELSE IF with ELSEIF
+ $code = preg_replace('#<!-- ELSE IF (.+?) -->#', '<!-- ELSEIF $1 -->', $code);
+
+ // 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);
+
$callback = function($matches)
{
$inner = $matches[2];
@@ -234,9 +240,6 @@ class phpbb_template_twig_lexer extends Twig_Lexer
return "<!-- {$matches[1]}IF{$inner}-->";
};
- // 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('#<!-- (ELSE)?IF((.*) \(?!?[\$|\.]([^\s]+)(.*))-->#', $callback, $code);
}