[ Index ] |
PHP Cross Reference of vtigercrm-6.1.0 |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Smarty Internal Plugin Resource Registered 4 * 5 * @package Smarty 6 * @subpackage TemplateResources 7 * @author Uwe Tews 8 * @author Rodney Rehm 9 */ 10 11 /** 12 * Smarty Internal Plugin Resource Registered 13 * 14 * Implements the registered resource for Smarty template 15 * 16 * @package Smarty 17 * @subpackage TemplateResources 18 * @deprecated 19 */ 20 class Smarty_Internal_Resource_Registered extends Smarty_Resource { 21 22 /** 23 * populate Source Object with meta data from Resource 24 * 25 * @param Smarty_Template_Source $source source object 26 * @param Smarty_Internal_Template $_template template object 27 * @return void 28 */ 29 public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null) 30 { 31 $source->filepath = $source->type . ':' . $source->name; 32 $source->uid = sha1($source->filepath); 33 if ($source->smarty->compile_check) { 34 $source->timestamp = $this->getTemplateTimestamp($source); 35 $source->exists = !!$source->timestamp; 36 } 37 } 38 39 /** 40 * populate Source Object with timestamp and exists from Resource 41 * 42 * @param Smarty_Template_Source $source source object 43 * @return void 44 */ 45 public function populateTimestamp(Smarty_Template_Source $source) 46 { 47 $source->timestamp = $this->getTemplateTimestamp($source); 48 $source->exists = !!$source->timestamp; 49 } 50 51 /** 52 * Get timestamp (epoch) the template source was modified 53 * 54 * @param Smarty_Template_Source $source source object 55 * @return integer|boolean timestamp (epoch) the template was modified, false if resources has no timestamp 56 */ 57 public function getTemplateTimestamp(Smarty_Template_Source $source) 58 { 59 // return timestamp 60 $time_stamp = false; 61 call_user_func_array($source->smarty->registered_resources[$source->type][0][1], array($source->name, &$time_stamp, $source->smarty)); 62 return is_numeric($time_stamp) ? (int) $time_stamp : $time_stamp; 63 } 64 65 /** 66 * Load template's source by invoking the registered callback into current template object 67 * 68 * @param Smarty_Template_Source $source source object 69 * @return string template source 70 * @throws SmartyException if source cannot be loaded 71 */ 72 public function getContent(Smarty_Template_Source $source) 73 { 74 // return template string 75 $t = call_user_func_array($source->smarty->registered_resources[$source->type][0][0], array($source->name, &$source->content, $source->smarty)); 76 if (is_bool($t) && !$t) { 77 throw new SmartyException("Unable to read template {$source->type} '{$source->name}'"); 78 } 79 return $source->content; 80 } 81 82 /** 83 * Determine basename for compiled filename 84 * 85 * @param Smarty_Template_Source $source source object 86 * @return string resource's basename 87 */ 88 protected function getBasename(Smarty_Template_Source $source) 89 { 90 return basename($source->name); 91 } 92 93 } 94 95 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:08:37 2014 | Cross-referenced by PHPXref 0.7.1 |