mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-06 19:34:27 +02:00
- removed block nesting checks for {capture}
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
10/07/2009
|
||||
- removed block nesting checks for {capture}
|
||||
|
||||
10/05/2009
|
||||
- added support of "isinstance" to {if} tag
|
||||
|
||||
|
@@ -1,15 +1,16 @@
|
||||
<?php
|
||||
/**
|
||||
* Smarty Internal Plugin Compile Capture
|
||||
*
|
||||
* Compiles the {capture} tag
|
||||
*
|
||||
* Compiles the {capture} tag
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
* @author Uwe Tews
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
/**
|
||||
* Smarty Internal Plugin Compile Capture Class
|
||||
*/
|
||||
*/
|
||||
class Smarty_Internal_Compile_Capture extends Smarty_Internal_CompileBase {
|
||||
/**
|
||||
* Compiles code for the {capture} tag
|
||||
@@ -20,22 +21,16 @@ class Smarty_Internal_Compile_Capture extends Smarty_Internal_CompileBase {
|
||||
*/
|
||||
public function compile($args, $compiler)
|
||||
{
|
||||
$this->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 = "<?php ob_start(); ?>";
|
||||
|
||||
|
@@ -1,15 +1,16 @@
|
||||
<?php
|
||||
/**
|
||||
* Smarty Internal Plugin Compile Capture Close
|
||||
*
|
||||
* Compiles the {/capture} tag
|
||||
*
|
||||
* Compiles the {/capture} tag
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
* @author Uwe Tews
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
/**
|
||||
* Smarty Internal Plugin Compile CaptureClose Class
|
||||
*/
|
||||
*/
|
||||
class Smarty_Internal_Compile_CaptureClose extends Smarty_Internal_CompileBase {
|
||||
/**
|
||||
* Compiles code for the {/capture} tag
|
||||
@@ -21,16 +22,19 @@ class Smarty_Internal_Compile_CaptureClose extends Smarty_Internal_CompileBase {
|
||||
public function compile($args, $compiler)
|
||||
{
|
||||
$this->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 = "<?php ";
|
||||
if (isset($saved_attr[1])) {
|
||||
$_output .= " \$_smarty_tpl->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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user