From 9eab32ff6073ebe60b447d2086137474cb53a058 Mon Sep 17 00:00:00 2001 From: "Uwe.Tews" Date: Wed, 7 Oct 2009 20:24:17 +0000 Subject: [PATCH] - removed block nesting checks for {capture} --- change_log.txt | 3 +++ libs/sysplugins/internal.compile_capture.php | 27 ++++++++----------- .../internal.compile_captureclose.php | 22 ++++++++------- 3 files changed, 27 insertions(+), 25 deletions(-) diff --git a/change_log.txt b/change_log.txt index ce8e306b..d17f592c 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,3 +1,6 @@ +10/07/2009 +- removed block nesting checks for {capture} + 10/05/2009 - added support of "isinstance" to {if} tag diff --git a/libs/sysplugins/internal.compile_capture.php b/libs/sysplugins/internal.compile_capture.php index 9198ae2e..85c979be 100644 --- a/libs/sysplugins/internal.compile_capture.php +++ b/libs/sysplugins/internal.compile_capture.php @@ -1,15 +1,16 @@ compiler = $compiler; - $this->optional_attributes = array('name', 'assign'); + $this->compiler = $compiler; + $this->optional_attributes = array('name', 'assign', 'append'); // check and get attributes $_attr = $this->_get_attributes($args); - if (isset($_attr['name'])) - $buffer = $_attr['name']; - else - $buffer = "'default'"; + $buffer = isset($_attr['name']) ? $_attr['name'] : "'default'"; + $assign = isset($_attr['assign']) ? $_attr['assign'] : null; + $append = isset($_attr['append']) ? $_attr['append'] : null; - if (isset($_attr['assign'])) - $assign = $_attr['assign']; - else - $assign = null; - - $this->_open_tag('capture',array($buffer, $assign)); + $this->compiler->_capture_stack[] = array($buffer, $assign, $append); $_output = ""; diff --git a/libs/sysplugins/internal.compile_captureclose.php b/libs/sysplugins/internal.compile_captureclose.php index 162f752e..5d3d9a3c 100644 --- a/libs/sysplugins/internal.compile_captureclose.php +++ b/libs/sysplugins/internal.compile_captureclose.php @@ -1,15 +1,16 @@ compiler = $compiler; - // check and get attributes + // check and get attributes $_attr = $this->_get_attributes($args); - $saved_attr = $this->_close_tag(array('capture')); + list($buffer, $assign, $append) = array_pop($this->compiler->_capture_stack); $_output = "assign($saved_attr[1], ob_get_contents());"; + if (isset($assign)) { + $_output .= " \$_smarty_tpl->assign($assign, ob_get_contents());"; } - $_output .= " \$_smarty_tpl->smarty->_smarty_vars['capture'][$saved_attr[0]]=ob_get_clean(); ?>\n"; + if (isset($append)) { + $_output .= " \$_smarty_tpl->append($append, ob_get_contents());"; + } + $_output .= " \$_smarty_tpl->smarty->_smarty_vars['capture'][$buffer]=ob_get_clean(); ?>\n"; return $_output; } }