mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-01-06 11:43:50 +00:00
Update Smarty to version 3.1.33
This commit is contained in:
@@ -2,17 +2,16 @@
|
||||
/**
|
||||
* Smarty Resource Plugin
|
||||
*
|
||||
* @package Smarty
|
||||
* @package Smarty
|
||||
* @subpackage TemplateResources
|
||||
* @author Rodney Rehm
|
||||
* @author Rodney Rehm
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty Resource Plugin
|
||||
*
|
||||
* Wrapper Implementation for custom resource plugins
|
||||
*
|
||||
* @package Smarty
|
||||
* @package Smarty
|
||||
* @subpackage TemplateResources
|
||||
*/
|
||||
abstract class Smarty_Resource_Custom extends Smarty_Resource
|
||||
@@ -28,11 +27,11 @@ abstract class Smarty_Resource_Custom extends Smarty_Resource
|
||||
|
||||
/**
|
||||
* Fetch template's modification timestamp from data source
|
||||
*
|
||||
* {@internal implementing this method is optional.
|
||||
* Only implement it if modification times can be accessed faster than loading the complete template source.}}
|
||||
*
|
||||
* @param string $name template name
|
||||
* @param string $name template name
|
||||
*
|
||||
* @return integer|boolean timestamp (epoch) the template was modified, or false if not found
|
||||
*/
|
||||
protected function fetchTimestamp($name)
|
||||
@@ -46,19 +45,19 @@ abstract class Smarty_Resource_Custom extends Smarty_Resource
|
||||
* @param Smarty_Template_Source $source source object
|
||||
* @param Smarty_Internal_Template $_template template object
|
||||
*/
|
||||
public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null)
|
||||
public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null)
|
||||
{
|
||||
$source->filepath = strtolower($source->type . ':' . $source->name);
|
||||
$source->filepath = $source->type . ':' . substr(preg_replace('/[^A-Za-z0-9.]/', '', $source->name), 0, 25);
|
||||
$source->uid = sha1($source->type . ':' . $source->name);
|
||||
|
||||
$mtime = $this->fetchTimestamp($source->name);
|
||||
if ($mtime !== null) {
|
||||
$source->timestamp = $mtime;
|
||||
} else {
|
||||
$this->fetch($source->name, $content, $timestamp);
|
||||
$source->timestamp = isset($timestamp) ? $timestamp : false;
|
||||
if( isset($content) )
|
||||
if (isset($content)) {
|
||||
$source->content = $content;
|
||||
}
|
||||
}
|
||||
$source->exists = !!$source->timestamp;
|
||||
}
|
||||
@@ -66,7 +65,8 @@ abstract class Smarty_Resource_Custom extends Smarty_Resource
|
||||
/**
|
||||
* Load template's source into current template object
|
||||
*
|
||||
* @param Smarty_Template_Source $source source object
|
||||
* @param Smarty_Template_Source $source source object
|
||||
*
|
||||
* @return string template source
|
||||
* @throws SmartyException if source cannot be loaded
|
||||
*/
|
||||
@@ -76,19 +76,18 @@ abstract class Smarty_Resource_Custom extends Smarty_Resource
|
||||
if (isset($content)) {
|
||||
return $content;
|
||||
}
|
||||
|
||||
throw new SmartyException("Unable to read template {$source->type} '{$source->name}'");
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine basename for compiled filename
|
||||
*
|
||||
* @param Smarty_Template_Source $source source object
|
||||
* @param Smarty_Template_Source $source source object
|
||||
*
|
||||
* @return string resource's basename
|
||||
*/
|
||||
protected function getBasename(Smarty_Template_Source $source)
|
||||
public function getBasename(Smarty_Template_Source $source)
|
||||
{
|
||||
return basename($source->name);
|
||||
return basename(substr(preg_replace('/[^A-Za-z0-9.]/', '', $source->name), 0, 25));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user