- bugfix on modifier and block plugins with same name

This commit is contained in:
Uwe.Tews
2010-02-05 17:03:22 +00:00
parent fde7a592f4
commit 3ad446bb21
5 changed files with 92 additions and 46 deletions
@@ -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];