mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
- bugfix change of 11.03.2014 cause again {capture} data could not been seen in other templates with {$smarty.capture.name} https://github.com/smarty-php/smarty/issues/153
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
===== 3.1.30-dev ===== (xx.xx.xx)
|
||||
27.03.2014
|
||||
- bugfix change of 11.03.2014 cause again {capture} data could not been seen in other templates with {$smarty.capture.name} https://github.com/smarty-php/smarty/issues/153
|
||||
|
||||
11.03.2014
|
||||
- optimization of capture and security handling
|
||||
- improvement $smarty->clearCompiledTemplate() should return on recompiled or uncompiled resources
|
||||
|
@@ -121,7 +121,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
/**
|
||||
* smarty version
|
||||
*/
|
||||
const SMARTY_VERSION = '3.1.30-dev/57';
|
||||
const SMARTY_VERSION = '3.1.30-dev/59';
|
||||
|
||||
/**
|
||||
* define variable scopes
|
||||
@@ -922,7 +922,6 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
}
|
||||
|
||||
/**
|
||||
* Set compile directory
|
||||
*
|
||||
* @param string $compile_dir directory to store compiled templates in
|
||||
*
|
||||
|
@@ -51,7 +51,7 @@ class Smarty_Internal_Compile_Capture extends Smarty_Internal_CompileBase
|
||||
if (!$name) {
|
||||
$compiler->trigger_template_error("missing or illegal \$smarty.{$tag} name attribute", null, true);
|
||||
}
|
||||
return "\$_smarty_tpl->ext->_capture->getBuffer(\$_smarty_tpl, '{$name}')";
|
||||
return "\$_smarty_tpl->smarty->ext->_capture->getBuffer(\$_smarty_tpl, '{$name}')";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -75,7 +75,7 @@ class Smarty_Internal_Compile_Capture extends Smarty_Internal_CompileBase
|
||||
$compiler->_cache[ 'capture_stack' ][] = array($compiler->nocache);
|
||||
// maybe nocache because of nocache variables
|
||||
$compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
|
||||
$_output = "<?php \$_smarty_tpl->ext->_capture->open(\$_smarty_tpl, $buffer, $assign, $append);\n?>\n";
|
||||
$_output = "<?php \$_smarty_tpl->smarty->ext->_capture->open(\$_smarty_tpl, $buffer, $assign, $append);\n?>\n";
|
||||
|
||||
return $_output;
|
||||
}
|
||||
@@ -109,6 +109,6 @@ class Smarty_Internal_Compile_CaptureClose extends Smarty_Internal_CompileBase
|
||||
|
||||
list($compiler->nocache) = array_pop($compiler->_cache[ 'capture_stack' ]);
|
||||
|
||||
return "<?php \$_smarty_tpl->ext->_capture->close(\$_smarty_tpl);\n?>\n";
|
||||
return "<?php \$_smarty_tpl->smarty->ext->_capture->close(\$_smarty_tpl);\n?>\n";
|
||||
}
|
||||
}
|
||||
|
@@ -37,6 +37,13 @@ class Smarty_Internal_Runtime_Capture
|
||||
*/
|
||||
private $countStack = array();
|
||||
|
||||
/**
|
||||
* Named buffer
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
private $namedBuffer = array();
|
||||
|
||||
/**
|
||||
* Flag if callbacks are registered
|
||||
*
|
||||
@@ -84,7 +91,6 @@ class Smarty_Internal_Runtime_Capture
|
||||
{
|
||||
$this->countStack[] = $this->captureCount;
|
||||
$this->captureCount = 0;
|
||||
$_template->_cache[ 'capture' ] = array();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -105,7 +111,7 @@ class Smarty_Internal_Runtime_Capture
|
||||
if (isset($append)) {
|
||||
$_template->append($append, ob_get_contents());
|
||||
}
|
||||
$_template->_cache[ 'capture' ][ $buffer ] = ob_get_clean();
|
||||
$this->namedBuffer[ $buffer ] = ob_get_clean();
|
||||
} else {
|
||||
$this->error($_template);
|
||||
}
|
||||
@@ -133,7 +139,7 @@ class Smarty_Internal_Runtime_Capture
|
||||
*/
|
||||
public function getBuffer(Smarty_Internal_Template $_template, $name)
|
||||
{
|
||||
return isset($_template->_cache[ 'capture' ][ $name ]) ? $_template->_cache[ 'capture' ][ $name ] : null;
|
||||
return isset($this->namedBuffer[ $name ]) ? $this->namedBuffer[ $name ] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user