libs/sysplugins/smarty_internal_resource_extends.php Quellcode

smarty_internal_resource_extends.php
gehe zur Dokumentation dieser Datei
1 <?php
19 {
25  public $mbstring_overload = 0;
26 
35  public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null)
36  {
37  $uid = sha1(getcwd());
38  $sources = array();
39  $components = explode('|', $source->name);
40  $exists = true;
41  foreach ($components as $component) {
42  $s = Smarty_Resource::source(null, $source->smarty, $component);
43  if ($s->type == 'php') {
44  throw new SmartyException("Resource type {$s->type} cannot be used with the extends resource type");
45  }
46  $sources[$s->uid] = $s;
47  $uid .= realpath($s->filepath);
48  if ($_template && $_template->smarty->compile_check) {
49  $exists = $exists && $s->exists;
50  }
51  }
52  $source->components = $sources;
53  $source->filepath = $s->filepath;
54  $source->uid = sha1($uid);
55  if ($_template && $_template->smarty->compile_check) {
56  $source->timestamp = $s->timestamp;
57  $source->exists = $exists;
58  }
59  // need the template at getContent()
60  $source->template = $_template;
61  }
62 
68  public function populateTimestamp(Smarty_Template_Source $source)
69  {
70  $source->exists = true;
71  foreach ($source->components as $s) {
72  $source->exists = $source->exists && $s->exists;
73  }
74  $source->timestamp = $s->timestamp;
75  }
76 
85  public function getContent(Smarty_Template_Source $source)
86  {
87  if (!$source->exists) {
88  throw new SmartyException("Unable to read template {$source->type} '{$source->name}'");
89  }
90 
91  $_components = array_reverse($source->components);
92 
93  $_content = '';
94  foreach ($_components as $_component) {
95  // read content
96  $_content .= $_component->content;
97  }
98  return $_content;
99  }
100 
108  public function getBasename(Smarty_Template_Source $source)
109  {
110  return str_replace(':', '.', basename($source->filepath));
111  }
112 }




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.