28bbb938a9b46b0fc885ce79c45ba6b23ad3541c
[GitHub/Stricted/Domain-Control-Panel.git] / lib / api / smarty / sysplugins / smarty_internal_parsetree_tag.php
1 <?php
2 /**
3 * Smarty Internal Plugin Templateparser Parsetrees
4 * These are classes to build parsetrees 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 * Saved block nesting level
23 *
24 * @var int
25 */
26 public $saved_block_nesting;
27
28 /**
29 * Create parse tree buffer for Smarty tag
30 *
31 * @param object $parser parser object
32 * @param string $data content
33 */
34 public function __construct($parser, $data)
35 {
36 $this->parser = $parser;
37 $this->data = $data;
38 $this->saved_block_nesting = $parser->block_nesting_level;
39 }
40
41 /**
42 * Return buffer content
43 *
44 * @return string content
45 */
46 public function to_smarty_php()
47 {
48 return $this->data;
49 }
50
51 /**
52 * Return complied code that loads the evaluated output of buffer content into a temporary variable
53 *
54 * @return string template code
55 */
56 public function assign_to_var()
57 {
58 $var = sprintf('$_tmp%d', ++ Smarty_Internal_Templateparser::$prefix_number);
59 $this->parser->compiler->prefix_code[] = sprintf("<?php ob_start();?>%s<?php %s=ob_get_clean();?>", $this->data, $var);
60
61 return $var;
62 }
63 }