libs/sysplugins/smarty_internal_function_call_handler.php Quellcode

smarty_internal_function_call_handler.php
gehe zur Dokumentation dieser Datei
1 <?php
20 {
33  public static function call($_name, Smarty_Internal_Template $_smarty_tpl, $_function, $_params, $_nocache)
34  {
35  $funcParam = $_smarty_tpl->properties['tpl_function'][$_name];
36  if (is_file($funcParam['compiled_filepath'])) {
37  // read compiled file
38  $code = file_get_contents($funcParam['compiled_filepath']);
39  // grab template function
40  if (preg_match("/\/\* {$_function} \*\/([\S\s]*?)\/\*\/ {$_function} \*\//", $code, $match)) {
41  // grab source info from file dependency
42  preg_match("/\s*'{$funcParam['uid']}'([\S\s]*?)\),/", $code, $match1);
43  unset($code);
44  $output = '';
45  // make PHP function known
46  eval($match[0]);
47  if (function_exists($_function)) {
48  // search cache file template
49  $tplPtr = $_smarty_tpl;
50  while (!isset($tplPtr->cached) && isset($tplPtr->parent)) {
51  $tplPtr = $tplPtr->parent;
52  }
53  // add template function code to cache file
54  if (isset($tplPtr->cached)) {
55  $cache = $tplPtr->cached;
56  $content = $cache->read($tplPtr);
57  if ($content) {
58  // check if we must update file dependency
59  if (!preg_match("/'{$funcParam['uid']}'([\S\s]*?)'nocache_hash'/", $content, $match2)) {
60  $content = preg_replace("/('file_dependency'([\S\s]*?)\()/", "\\1{$match1[0]}", $content);
61  }
62  $cache->write($tplPtr, $content . "<?php " . $match[0] . "?>\n");
63  }
64  }
65  return true;
66  }
67  }
68  }
69  return false;
70  }
71 }




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.