Add deprecation warnings if syntax like <--#include-->, <!--%import--> is used in template v2

This commit is contained in:
Kijin Sung 2023-10-23 14:17:30 +09:00
parent 6a2a2826ec
commit c42d059594
2 changed files with 15 additions and 0 deletions

View file

@ -932,6 +932,11 @@ class TemplateParser_v2
*/
protected function _addDeprecationMessages(string $content): string
{
// <!--#include-->, <!--%import-->, etc.
$content = preg_replace_callback('#<!--(\#include|%import|%unload|%load_js_plugin)\s?\(.+?-->#', function($match) {
return '<?php trigger_error("' . $match[1] . ' is not supported in template v2", \E_USER_WARNING); ?>';
}, $content);
// <block>
$content = preg_replace_callback('#<block(?=\s)#', function($match) {
return $match[0] . '<?php trigger_error("block element is not supported in template v2", \E_USER_WARNING); ?>';