PEEL Shopping
Open source ecommerce : PEEL Shopping
smarty_resource_custom.php
Go to the documentation of this file.
1 <?php
18 abstract class Smarty_Resource_Custom extends Smarty_Resource {
19 
27  protected abstract function fetch($name, &$source, &$mtime);
28 
38  protected function fetchTimestamp($name)
39  {
40  return null;
41  }
42 
49  public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null)
50  {
51  $source->filepath = strtolower($source->type . ':' . $source->name);
52  $source->uid = sha1($source->type . ':' . $source->name);
53 
54  $mtime = $this->fetchTimestamp($source->name);
55  if ($mtime !== null) {
56  $source->timestamp = $mtime;
57  } else {
58  $this->fetch($source->name, $content, $timestamp);
59  $source->timestamp = isset($timestamp) ? $timestamp : false;
60  if( isset($content) )
61  $source->content = $content;
62  }
63  $source->exists = !!$source->timestamp;
64  }
65 
73  public function getContent(Smarty_Template_Source $source)
74  {
75  $this->fetch($source->name, $content, $timestamp);
76  if (isset($content)) {
77  return $content;
78  }
79 
80  throw new SmartyException("Unable to read template {$source->type} '{$source->name}'");
81  }
82 
89  protected function getBasename(Smarty_Template_Source $source)
90  {
91  return basename($source->name);
92  }
93 
94 }
95 
96 ?>
populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null)
populate Source Object with meta data from Resource
getContent(Smarty_Template_Source $source)
Load template's source into current template object.
fetchTimestamp($name)
Fetch template's modification timestamp from data source.
fetch($name, &$source, &$mtime)
fetch template and its modification time from data source
getBasename(Smarty_Template_Source $source)
Determine basename for compiled filename.

This documentation for Open ecommerce PEEL Shopping and PEEL.fr has been generated by Doxygen on Thu Oct 15 2015 14:41:17 - Peel ecommerce is a product of Agence web Advisto SAS. All rights reserved.