mirror of
https://github.com/smarty-php/smarty.git
synced 2026-05-05 04:04:10 +02:00
- bugfix on modifier and block plugins with same name
This commit is contained in:
@@ -68,25 +68,26 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase
|
||||
$plugins_string = '';
|
||||
if (!empty($compiler->template->required_plugins['compiled'])) {
|
||||
$plugins_string = '<?php ';
|
||||
foreach($compiler->template->required_plugins['compiled'] as $plugin_name => $data) {
|
||||
$plugin = 'smarty_' . $data['type'] . '_' . $plugin_name;
|
||||
$plugins_string .= "if (!is_callable('{$plugin}')) include '{$data['file']}';\n";
|
||||
foreach($compiler->template->required_plugins['compiled'] as $tmp) {
|
||||
foreach($tmp as $data) {
|
||||
$plugins_string .= "if (!is_callable('{$data['function']}')) include '{$data['file']}';\n";
|
||||
}
|
||||
}
|
||||
$plugins_string .= '?>';
|
||||
}
|
||||
if (!empty($compiler->template->required_plugins['cache'])) {
|
||||
$plugins_string .= "<?php echo '/*%%SmartyNocache:{$compiler->template->properties['nocache_hash']}%%*/<?php ";
|
||||
foreach($compiler->template->required_plugins['cache'] as $plugin_name => $data) {
|
||||
$plugin = 'smarty_' . $data['type'] . '_' . $plugin_name;
|
||||
$plugins_string .= "if (!is_callable(\'{$plugin}\')) include \'{$data['file']}\';\n";
|
||||
foreach($compiler->template->required_plugins['nocache'] as $tmp) {
|
||||
foreach($tmp as $data) {
|
||||
$plugins_string .= "if (!is_callable('{$data['function']}')) include '{$data['file']}';\n";
|
||||
}
|
||||
}
|
||||
$plugins_string .= "?>/*/%%SmartyNocache:{$compiler->template->properties['nocache_hash']}%%*/';?>\n";
|
||||
}
|
||||
$compiler->template->properties['function'][$_name]['compiled'] = $plugins_string . $compiler->template->extracted_compiled_code;
|
||||
$compiler->template->properties['function'][$_name]['nocache_hash'] = $compiler->template->properties['nocache_hash'];
|
||||
$compiler->template->properties['function'][$_name]['has_nocache_code'] = $compiler->template->has_nocache_code;
|
||||
// $compiler->template->properties['function'][$_name]['plugins'] = $compiler->template->required_plugins;
|
||||
$this->compiler->smarty->template_functions[$_name] = $compiler->template->properties['function'][$_name];
|
||||
$compiler->template->properties['function'][$_name]['has_nocache_code'] = $compiler->template->has_nocache_code;
|
||||
$this->compiler->smarty->template_functions[$_name] = $compiler->template->properties['function'][$_name];
|
||||
// restore old compiler status
|
||||
$compiler->template->extracted_compiled_code = $saved_data[1];
|
||||
$compiler->template->extract_code = $saved_data[2];
|
||||
|
||||
Reference in New Issue
Block a user