From ef85c9f2ad897ef8315c7b54baa9f98f99fd459f Mon Sep 17 00:00:00 2001 From: "uwe.tews@googlemail.com" Date: Mon, 15 Nov 2010 22:54:59 +0000 Subject: [PATCH] - bugfix captured content could not be accessed globally - bugfix Smarty2 wrapper functions could not be call from within plugins --- change_log.txt | 2 ++ libs/Smarty.class.php | 2 +- libs/debug.tpl | 2 +- libs/sysplugins/smarty_internal_compile_capture.php | 2 +- .../smarty_internal_compile_private_special_variable.php | 2 +- libs/sysplugins/smarty_internal_template.php | 8 ++++++++ 6 files changed, 14 insertions(+), 4 deletions(-) diff --git a/change_log.txt b/change_log.txt index 6850dd28..aead15b7 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,6 +1,8 @@ 15/11/2010 - bugfix when using {$smarty.session} as object - bugfix scoping problem on $smarty object passed to filters +- bugfix captured content could not be accessed globally +- bugfix Smarty2 wrapper functions could not be call from within plugins 14/11/2010 - bugfix isset() did not allow multiple parameter diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index bfacad10..a0bb4ed4 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -223,7 +223,7 @@ class Smarty extends Smarty_Internal_Data { // default modifier public $default_modifiers = array(); // global internal smarty vars - public $_smarty_vars = array(); + static $_smarty_vars = array(); // start time for execution time calculation public $start_time = 0; // default file permissions diff --git a/libs/debug.tpl b/libs/debug.tpl index 9fd46b15..2a456ca9 100644 --- a/libs/debug.tpl +++ b/libs/debug.tpl @@ -1,4 +1,4 @@ -{capture assign=debug_output} +{capture name='_smarty_debug' assign=debug_output} diff --git a/libs/sysplugins/smarty_internal_compile_capture.php b/libs/sysplugins/smarty_internal_compile_capture.php index 2583aadc..74ade680 100644 --- a/libs/sysplugins/smarty_internal_compile_capture.php +++ b/libs/sysplugins/smarty_internal_compile_capture.php @@ -73,7 +73,7 @@ class Smarty_Internal_Compile_CaptureClose extends Smarty_Internal_CompileBase { if (isset($append)) { $_output .= " \$_smarty_tpl->append($append, ob_get_contents());"; } - $_output .= " \$_smarty_tpl->smarty->_smarty_vars['capture'][$buffer]=ob_get_clean();?>"; + $_output .= " Smarty::\$_smarty_vars['capture'][$buffer]=ob_get_clean();?>"; return $_output; } } diff --git a/libs/sysplugins/smarty_internal_compile_private_special_variable.php b/libs/sysplugins/smarty_internal_compile_private_special_variable.php index 49ec9096..22fd9517 100644 --- a/libs/sysplugins/smarty_internal_compile_private_special_variable.php +++ b/libs/sysplugins/smarty_internal_compile_private_special_variable.php @@ -31,7 +31,7 @@ class Smarty_Internal_Compile_Private_Special_Variable extends Smarty_Internal_C case 'section': return "\$_smarty_tpl->getVariable('smarty')->value$parameter"; case 'capture': - return "\$_smarty_tpl->smarty->_smarty_vars$parameter"; + return "Smarty::\$_smarty_vars$parameter"; case 'now': return 'time()'; case 'cookies': diff --git a/libs/sysplugins/smarty_internal_template.php b/libs/sysplugins/smarty_internal_template.php index 6b81ed0c..94f2deb9 100644 --- a/libs/sysplugins/smarty_internal_template.php +++ b/libs/sysplugins/smarty_internal_template.php @@ -69,6 +69,7 @@ class Smarty_Internal_Template extends Smarty_Internal_Data { public $smarty = null; // blocks for template inheritance public $block_data = array(); + public $wrapper = null; /** * Create template data object * @@ -964,6 +965,13 @@ class Smarty_Internal_Template extends Smarty_Internal_Data { return $this->$property_name = $args[0]; } } + // Smarty Backward Compatible wrapper + if (strpos($name,'_') !== false) { + if (!isset($this->wrapper)) { + $this->wrapper = new Smarty_Internal_Wrapper($this); + } + return $this->wrapper->convert($name, $args); + } // pass call to Smarty object return call_user_func_array(array($this->smarty,$name),$args); }