update to smarty v3.1.24
[GitHub/Stricted/Domain-Control-Panel.git] / lib / api / smarty / sysplugins / smarty_internal_parsetree_tag.php
1 <?php
2 /**
3 * Smarty Internal Plugin Templateparser Parse Tree
4 * These are classes to build parse tree in the template parser
5 *
6 * @package Smarty
7 * @subpackage Compiler
8 * @author Thue Kristensen
9 * @author Uwe Tews
10 */
11
12 /**
13 * A complete smarty tag.
14 *
15 * @package Smarty
16 * @subpackage Compiler
17 * @ignore
18 */
19 class Smarty_Internal_ParseTree_Tag extends Smarty_Internal_ParseTree
20 {
21
22 /**
23 * Saved block nesting level
24 *
25 * @var int
26 */
27 public $saved_block_nesting;
28
29 /**
30 * Create parse tree buffer for Smarty tag
31 *
32 * @param object $parser parser object
33 * @param string $data content
34 */
35 public function __construct($parser, $data)
36 {
37 $this->parser = $parser;
38 $this->data = $data;
39 $this->saved_block_nesting = $parser->block_nesting_level;
40 }
41
42 /**
43 * Return buffer content
44 *
45 * @return string content
46 */
47 public function to_smarty_php()
48 {
49 return $this->data;
50 }
51
52 /**
53 * Return complied code that loads the evaluated output of buffer content into a temporary variable
54 *
55 * @return string template code
56 */
57 public function assign_to_var()
58 {
59 $var = sprintf('$_tmp%d', ++ Smarty_Internal_Templateparser::$prefix_number);
60 $tmp = $this->parser->compiler->appendCode('<?php ob_start();?>', $this->data);
61 $tmp = $this->parser->compiler->appendCode($tmp, "<?php {$var}=ob_get_clean();?>");
62 $this->parser->compiler->prefix_code[] = sprintf("%s", $tmp);
63
64 return $var;
65 }
66 }