| 1: | <?php | 
| 2: |  | 
| 3: |  | 
| 4: |  | 
| 5: |  | 
| 6: |  | 
| 7: |  | 
| 8: |  | 
| 9: |  | 
| 10: |  | 
| 11: |  | 
| 12: |  | 
| 13: |  | 
| 14: |  | 
| 15: |  | 
| 16: |  | 
| 17: | class Smarty_Internal_ParseTree_Dq extends Smarty_Internal_ParseTree | 
| 18: | { | 
| 19: |  | 
| 20: |  | 
| 21: |  | 
| 22: |  | 
| 23: |  | 
| 24: |  | 
| 25: | public function __construct($parser, Smarty_Internal_ParseTree $subtree) | 
| 26: | { | 
| 27: | $this->subtrees[] = $subtree; | 
| 28: | if ($subtree instanceof Smarty_Internal_ParseTree_Tag) { | 
| 29: | $parser->block_nesting_level = count($parser->compiler->_tag_stack); | 
| 30: | } | 
| 31: | } | 
| 32: |  | 
| 33: |  | 
| 34: |  | 
| 35: |  | 
| 36: |  | 
| 37: |  | 
| 38: |  | 
| 39: | public function append_subtree(Smarty_Internal_Templateparser $parser, Smarty_Internal_ParseTree $subtree) | 
| 40: | { | 
| 41: | $last_subtree = count($this->subtrees) - 1; | 
| 42: | if ($last_subtree >= 0 && $this->subtrees[ $last_subtree ] instanceof Smarty_Internal_ParseTree_Tag | 
| 43: | && $this->subtrees[ $last_subtree ]->saved_block_nesting < $parser->block_nesting_level | 
| 44: | ) { | 
| 45: | if ($subtree instanceof Smarty_Internal_ParseTree_Code) { | 
| 46: | $this->subtrees[ $last_subtree ]->data = | 
| 47: | $parser->compiler->appendCode( | 
| 48: | $this->subtrees[ $last_subtree ]->data, | 
| 49: | '<?php echo ' . $subtree->data . ';?>' | 
| 50: | ); | 
| 51: | } elseif ($subtree instanceof Smarty_Internal_ParseTree_DqContent) { | 
| 52: | $this->subtrees[ $last_subtree ]->data = | 
| 53: | $parser->compiler->appendCode( | 
| 54: | $this->subtrees[ $last_subtree ]->data, | 
| 55: | '<?php echo "' . $subtree->data . '";?>' | 
| 56: | ); | 
| 57: | } else { | 
| 58: | $this->subtrees[ $last_subtree ]->data = | 
| 59: | $parser->compiler->appendCode($this->subtrees[ $last_subtree ]->data, $subtree->data); | 
| 60: | } | 
| 61: | } else { | 
| 62: | $this->subtrees[] = $subtree; | 
| 63: | } | 
| 64: | if ($subtree instanceof Smarty_Internal_ParseTree_Tag) { | 
| 65: | $parser->block_nesting_level = count($parser->compiler->_tag_stack); | 
| 66: | } | 
| 67: | } | 
| 68: |  | 
| 69: |  | 
| 70: |  | 
| 71: |  | 
| 72: |  | 
| 73: |  | 
| 74: |  | 
| 75: |  | 
| 76: | public function to_smarty_php(Smarty_Internal_Templateparser $parser) | 
| 77: | { | 
| 78: | $code = ''; | 
| 79: | foreach ($this->subtrees as $subtree) { | 
| 80: | if ($code !== '') { | 
| 81: | $code .= '.'; | 
| 82: | } | 
| 83: | if ($subtree instanceof Smarty_Internal_ParseTree_Tag) { | 
| 84: | $more_php = $subtree->assign_to_var($parser); | 
| 85: | } else { | 
| 86: | $more_php = $subtree->to_smarty_php($parser); | 
| 87: | } | 
| 88: | $code .= $more_php; | 
| 89: | if (!$subtree instanceof Smarty_Internal_ParseTree_DqContent) { | 
| 90: | $parser->compiler->has_variable_string = true; | 
| 91: | } | 
| 92: | } | 
| 93: | return $code; | 
| 94: | } | 
| 95: | } | 
| 96: |  |