PEEL Shopping
Open source ecommerce : PEEL Shopping
smarty_internal_resource_php.php
Go to the documentation of this file.
1 <?php
2 
18  protected $short_open_tag;
19 
24  public function __construct()
25  {
26  $this->short_open_tag = ini_get( 'short_open_tag' );
27  }
28 
36  public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null)
37  {
38  $source->filepath = $this->buildFilepath($source, $_template);
39 
40  if ($source->filepath !== false) {
41  if (is_object($source->smarty->security_policy)) {
42  $source->smarty->security_policy->isTrustedResourceDir($source->filepath);
43  }
44 
45  $source->uid = sha1($source->filepath);
46  if ($source->smarty->compile_check) {
47  $source->timestamp = @filemtime($source->filepath);
48  $source->exists = !!$source->timestamp;
49  }
50  }
51  }
52 
59  public function populateTimestamp(Smarty_Template_Source $source)
60  {
61  $source->timestamp = @filemtime($source->filepath);
62  $source->exists = !!$source->timestamp;
63  }
64 
72  public function getContent(Smarty_Template_Source $source)
73  {
74  if ($source->timestamp) {
75  return '';
76  }
77  throw new SmartyException("Unable to read template {$source->type} '{$source->name}'");
78  }
79 
89  {
90  $_smarty_template = $_template;
91 
92  if (!$source->smarty->allow_php_templates) {
93  throw new SmartyException("PHP templates are disabled");
94  }
95  if (!$source->exists) {
96  if ($_template->parent instanceof Smarty_Internal_Template) {
97  $parent_resource = " in '{$_template->parent->template_resource}'";
98  } else {
99  $parent_resource = '';
100  }
101  throw new SmartyException("Unable to load template {$source->type} '{$source->name}'{$parent_resource}");
102  }
103 
104  // prepare variables
105  extract($_template->getTemplateVars());
106 
107  // include PHP template with short open tags enabled
108  @ini_set( 'short_open_tag', '1' );
109  include($source->filepath);
110  @ini_set( 'short_open_tag', $this->short_open_tag );
111  }
112 }
113 
114 ?>
populateTimestamp(Smarty_Template_Source $source)
populate Source Object with timestamp and exists from Resource
getContent(Smarty_Template_Source $source)
Load template's source from file into current template object.
renderUncompiled(Smarty_Template_Source $source, Smarty_Internal_Template $_template)
Render and output the template (without using the compiler)
buildFilepath(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null)
build template filepath by traversing the template_dir array
__construct()
Create a new PHP Resource.
populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null)
populate Source Object with meta data from Resource
getTemplateVars($varname=null, $_ptr=null, $search_parents=true)
Returns a single or all template variables.

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.