libs/sysplugins/smarty_internal_parsetree_dq.php Quellcode

smarty_internal_parsetree_dq.php
gehe zur Dokumentation dieser Datei
1 <?php
2 
19 {
26  public function __construct($parser, Smarty_Internal_ParseTree $subtree)
27  {
28  $this->parser = $parser;
29  $this->subtrees[] = $subtree;
30  if ($subtree instanceof Smarty_Internal_ParseTree_Tag) {
31  $this->parser->block_nesting_level = count($this->parser->compiler->_tag_stack);
32  }
33  }
34 
40  public function append_subtree(Smarty_Internal_ParseTree $subtree)
41  {
42  $last_subtree = count($this->subtrees) - 1;
43  if ($last_subtree >= 0 && $this->subtrees[$last_subtree] instanceof Smarty_Internal_ParseTree_Tag && $this->subtrees[$last_subtree]->saved_block_nesting < $this->parser->block_nesting_level) {
44  if ($subtree instanceof Smarty_Internal_ParseTree_Code) {
45  $this->subtrees[$last_subtree]->data = $this->parser->compiler->appendCode($this->subtrees[$last_subtree]->data, '<?php echo ' . $subtree->data . ';?>');
46  } elseif ($subtree instanceof Smarty_Internal_ParseTree_DqContent) {
47  $this->subtrees[$last_subtree]->data = $this->parser->compiler->appendCode($this->subtrees[$last_subtree]->data, '<?php echo "' . $subtree->data . '";?>');
48  } else {
49  $this->subtrees[$last_subtree]->data = $this->parser->compiler->appendCode($this->subtrees[$last_subtree]->data, $subtree->data);
50  }
51  } else {
52  $this->subtrees[] = $subtree;
53  }
54  if ($subtree instanceof Smarty_Internal_ParseTree_Tag) {
55  $this->parser->block_nesting_level = count($this->parser->compiler->_tag_stack);
56  }
57  }
58 
64  public function to_smarty_php()
65  {
66  $code = '';
67  foreach ($this->subtrees as $subtree) {
68  if ($code !== "") {
69  $code .= ".";
70  }
71  if ($subtree instanceof Smarty_Internal_ParseTree_Tag) {
72  $more_php = $subtree->assign_to_var();
73  } else {
74  $more_php = $subtree->to_smarty_php();
75  }
76 
77  $code .= $more_php;
78 
79  if (!$subtree instanceof Smarty_Internal_ParseTree_DqContent) {
80  $this->parser->compiler->has_variable_string = true;
81  }
82  }
83 
84  return $code;
85  }
86 }




Korrekturen, Hinweise und Ergänzungen

Bitte scheuen Sie sich nicht und melden Sie, was auf dieser Seite sachlich falsch oder irreführend ist, was ergänzt werden sollte, was fehlt usw. Dazu bitte oben aus dem Menü Seite den Eintrag Support Forum wählen. Es ist eine kostenlose Anmeldung erforderlich, um Anmerkungen zu posten. Unpassende Postings, Spam usw. werden kommentarlos entfernt.