2009-03-22 16:09:05 +00:00
|
|
|
<?php
|
|
|
|
|
/**
|
|
|
|
|
* Smarty Internal Plugin Compile Capture Close
|
2009-10-07 20:24:17 +00:00
|
|
|
*
|
|
|
|
|
* Compiles the {/capture} tag
|
|
|
|
|
*
|
2009-03-22 16:09:05 +00:00
|
|
|
* @package Smarty
|
|
|
|
|
* @subpackage Compiler
|
2009-10-07 20:24:17 +00:00
|
|
|
* @author Uwe Tews
|
2009-03-22 16:09:05 +00:00
|
|
|
*/
|
|
|
|
|
/**
|
|
|
|
|
* Smarty Internal Plugin Compile CaptureClose Class
|
2009-10-07 20:24:17 +00:00
|
|
|
*/
|
2009-03-22 16:09:05 +00:00
|
|
|
class Smarty_Internal_Compile_CaptureClose extends Smarty_Internal_CompileBase {
|
|
|
|
|
/**
|
|
|
|
|
* Compiles code for the {/capture} tag
|
|
|
|
|
*
|
|
|
|
|
* @param array $args array with attributes from parser
|
|
|
|
|
* @param object $compiler compiler object
|
|
|
|
|
* @return string compiled code
|
|
|
|
|
*/
|
|
|
|
|
public function compile($args, $compiler)
|
|
|
|
|
{
|
|
|
|
|
$this->compiler = $compiler;
|
2009-10-07 20:24:17 +00:00
|
|
|
// check and get attributes
|
2009-03-22 16:09:05 +00:00
|
|
|
$_attr = $this->_get_attributes($args);
|
|
|
|
|
|
2009-10-07 20:24:17 +00:00
|
|
|
list($buffer, $assign, $append) = array_pop($this->compiler->_capture_stack);
|
2009-03-22 16:09:05 +00:00
|
|
|
|
|
|
|
|
$_output = "<?php ";
|
2009-10-07 20:24:17 +00:00
|
|
|
if (isset($assign)) {
|
|
|
|
|
$_output .= " \$_smarty_tpl->assign($assign, ob_get_contents());";
|
|
|
|
|
}
|
|
|
|
|
if (isset($append)) {
|
|
|
|
|
$_output .= " \$_smarty_tpl->append($append, ob_get_contents());";
|
2009-03-22 16:09:05 +00:00
|
|
|
}
|
2009-10-07 20:24:17 +00:00
|
|
|
$_output .= " \$_smarty_tpl->smarty->_smarty_vars['capture'][$buffer]=ob_get_clean(); ?>\n";
|
2009-03-22 16:09:05 +00:00
|
|
|
return $_output;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
?>
|