mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[ticket/11724] Support "ELSE IF" and "ELSEIF" in the same way
PHPBB3-11724
This commit is contained in:
parent
26dac64d45
commit
d5c56c5d50
3 changed files with 11 additions and 1 deletions
|
@ -236,7 +236,8 @@ class phpbb_template_twig_lexer extends Twig_Lexer
|
||||||
// Replace our "div by" with Twig's divisibleby (Twig does not like test names with spaces)
|
// 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);
|
$code = preg_replace('# div by ([0-9]+)#', ' divisibleby($1)', $code);
|
||||||
|
|
||||||
return preg_replace_callback('#<!-- (ELSE)?IF((.*)[\s][\$|\.|!]([^\s]+)(.*))-->#', $callback, $code);
|
// (ELSE)?\s?IF; match IF|ELSEIF|ELSE IF; replace ELSE IF with ELSEIF
|
||||||
|
return preg_replace_callback('#<!-- (ELSE)?\s?IF(.+?)-->#', $callback, $code);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -62,6 +62,13 @@ class phpbb_template_template_test extends phpbb_template_template_test_case
|
||||||
array(),
|
array(),
|
||||||
'1!false',
|
'1!false',
|
||||||
),
|
),
|
||||||
|
array(
|
||||||
|
'if.html',
|
||||||
|
array('S_OTHER_OTHER_VALUE' => true),
|
||||||
|
array(),
|
||||||
|
array(),
|
||||||
|
'|S_OTHER_OTHER_VALUE|!false',
|
||||||
|
),
|
||||||
array(
|
array(
|
||||||
'if.html',
|
'if.html',
|
||||||
array('S_VALUE' => false, 'S_OTHER_VALUE' => true),
|
array('S_VALUE' => false, 'S_OTHER_VALUE' => true),
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
1
|
1
|
||||||
<!-- ELSEIF S_OTHER_VALUE -->
|
<!-- ELSEIF S_OTHER_VALUE -->
|
||||||
2
|
2
|
||||||
|
<!-- ELSE IF S_OTHER_OTHER_VALUE -->
|
||||||
|
|S_OTHER_OTHER_VALUE|
|
||||||
<!-- ELSE -->
|
<!-- ELSE -->
|
||||||
03
|
03
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
|
|
Loading…
Add table
Reference in a new issue