mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-03 16:51:40 +09:00
Don't parse template v1 syntax (single braces) in CSS/JS context
This commit is contained in:
parent
49f57980dd
commit
01f34781df
1 changed files with 7 additions and 0 deletions
|
|
@ -822,6 +822,13 @@ class TemplateParser_v2
|
|||
return $this->_arrangeOutputFilters($match);
|
||||
}, $content);
|
||||
|
||||
// Exclude {single} curly braces in non-HTML contexts.
|
||||
$content = preg_replace_callback('#(<\?php \$this->config->context = \'(?:CSS|JS)\'; \?>)(.*?)(<\?php \$this->config->context = \'HTML\'; \?>)#s', function($match) {
|
||||
$warning = '<?php trigger_error("Template v1 syntax not allowed in CSS/JS context", \E_USER_WARNING); ?>';
|
||||
$match[2] = preg_replace('#(?<!\{)\{(?!\s)([^{}]+?)\}#', '{' . $warning . '$1}', $match[2]);
|
||||
return $match[1] . $match[2] . $match[3];
|
||||
}, $content);
|
||||
|
||||
// Convert {single} curly braces.
|
||||
$content = preg_replace_callback('#(?<!\{)\{(?!\s)([^{}]+?)\}#', [$this, '_arrangeOutputFilters'], $content);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue