mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/15323] Allow Twig syntax in bbcode.html
PHPBB3-15323
This commit is contained in:
parent
1e605efaf1
commit
aabb9d2e48
2 changed files with 7 additions and 2 deletions
|
@ -501,7 +501,10 @@ class bbcode
|
|||
// Turn template blocks into PHP assignment statements for the values of $bbcode_tpl..
|
||||
$this->bbcode_template = array();
|
||||
|
||||
$matches = preg_match_all('#<!-- BEGIN (.*?) -->(.*?)<!-- END (?:.*?) -->#', $tpl, $match);
|
||||
// Capture the BBCode template matches
|
||||
// Allow phpBB template or the Twig syntax
|
||||
$matches = (preg_match_all('#<!-- BEGIN (.*?) -->(.*?)<!-- END (?:.*?) -->#', $tpl, $match)) ?:
|
||||
preg_match_all('#{% for (.*?) in .*? %}(.*?){% endfor %}#s', $tpl, $match);
|
||||
|
||||
for ($i = 0; $i < $matches; $i++)
|
||||
{
|
||||
|
|
|
@ -518,7 +518,9 @@ class factory implements \phpbb\textformatter\cache_interface
|
|||
protected function extract_templates($template)
|
||||
{
|
||||
// Capture the template fragments
|
||||
preg_match_all('#<!-- BEGIN (.*?) -->(.*?)<!-- END .*? -->#s', $template, $matches, PREG_SET_ORDER);
|
||||
// Allow either phpBB template or the Twig syntax
|
||||
preg_match_all('#<!-- BEGIN (.*?) -->(.*?)<!-- END .*? -->#s', $template, $matches, PREG_SET_ORDER) ?:
|
||||
preg_match_all('#{% for (.*?) in .*? %}(.*?){% endfor %}#s', $template, $matches, PREG_SET_ORDER);
|
||||
|
||||
$fragments = array();
|
||||
foreach ($matches as $match)
|
||||
|
|
Loading…
Add table
Reference in a new issue