- bugfix captured content could not be accessed globally

- bugfix Smarty2 wrapper functions could not be call from within plugins
This commit is contained in:
uwe.tews@googlemail.com
2010-11-15 22:54:59 +00:00
parent 21ed644f82
commit ef85c9f2ad
6 changed files with 14 additions and 4 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -1,4 +1,4 @@
{capture assign=debug_output}
{capture name='_smarty_debug' assign=debug_output}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>

View File

@@ -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;
}
}

View File

@@ -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':

View File

@@ -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);
}