libs/sysplugins/smarty_internal_compile_private_object_function.php Quellcode

smarty_internal_compile_private_object_function.php
gehe zur Dokumentation dieser Datei
1 <?php
18 {
25  public $optional_attributes = array('_any');
26 
38  public function compile($args, $compiler, $parameter, $tag, $method)
39  {
40  // check and get attributes
41  $_attr = $this->getAttributes($compiler, $args);
42  if ($_attr['nocache'] === true) {
43  $compiler->tag_nocache = true;
44  }
45  unset($_attr['nocache']);
46  $_assign = null;
47  if (isset($_attr['assign'])) {
48  $_assign = $_attr['assign'];
49  unset($_attr['assign']);
50  }
51  // method or property ?
52  if (method_exists($compiler->smarty->registered_objects[$tag][0], $method)) {
53  // convert attributes into parameter array string
54  if ($compiler->smarty->registered_objects[$tag][2]) {
55  $_paramsArray = array();
56  foreach ($_attr as $_key => $_value) {
57  if (is_int($_key)) {
58  $_paramsArray[] = "$_key=>$_value";
59  } else {
60  $_paramsArray[] = "'$_key'=>$_value";
61  }
62  }
63  $_params = 'array(' . implode(",", $_paramsArray) . ')';
64  $return = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}({$_params},\$_smarty_tpl)";
65  } else {
66  $_params = implode(",", $_attr);
67  $return = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}({$_params})";
68  }
69  } else {
70  // object property
71  $return = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}";
72  }
73 
74  if (empty($_assign)) {
75  // This tag does create output
76  $compiler->has_output = true;
77  $output = "<?php echo {$return};?>\n";
78  } else {
79  $output = "<?php \$_smarty_tpl->assign({$_assign},{$return});?>\n";
80  }
81 
82  return $output;
83  }
84 }




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.