mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
- optimization and cleanup of resource code
This commit is contained in:
@@ -1,7 +1,10 @@
|
|||||||
===== 3.1.30-dev ===== (xx.xx.xx)
|
===== 3.1.30-dev ===== (xx.xx.xx)
|
||||||
|
15.05.2016
|
||||||
|
- optimization and cleanup of resource code
|
||||||
|
|
||||||
10.05.2016
|
10.05.2016
|
||||||
- optimization of inheritance processing
|
- optimization of inheritance processing
|
||||||
|
|
||||||
07.05.2016
|
07.05.2016
|
||||||
-bugfix Only variables should be assigned by reference https://github.com/smarty-php/smarty/issues/227
|
-bugfix Only variables should be assigned by reference https://github.com/smarty-php/smarty/issues/227
|
||||||
|
|
||||||
|
@@ -121,7 +121,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
/**
|
/**
|
||||||
* smarty version
|
* smarty version
|
||||||
*/
|
*/
|
||||||
const SMARTY_VERSION = '3.1.30-dev/68';
|
const SMARTY_VERSION = '3.1.30-dev/69';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* define variable scopes
|
* define variable scopes
|
||||||
@@ -1138,7 +1138,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
*/
|
*/
|
||||||
public function _realpath($path, $realpath = null)
|
public function _realpath($path, $realpath = null)
|
||||||
{
|
{
|
||||||
$nds = DS == '/' ? '\\' : '/';
|
$nds = DS == '/' ? '\\' : '/';
|
||||||
// normalize DS
|
// normalize DS
|
||||||
$path = str_replace($nds, DS, $path);
|
$path = str_replace($nds, DS, $path);
|
||||||
preg_match('%^(?<root>(?:[[:alpha:]]:[\\\\]|/|[\\\\]{2}[[:alpha:]]+|[[:print:]]{2,}:[/]{2}|[\\\\])?)(?<path>(?:[[:print:]]*))$%',
|
preg_match('%^(?<root>(?:[[:alpha:]]:[\\\\]|/|[\\\\]{2}[[:alpha:]]+|[[:print:]]{2,}:[/]{2}|[\\\\])?)(?<path>(?:[[:print:]]*))$%',
|
||||||
|
@@ -46,9 +46,9 @@ abstract class Smarty_CacheResource
|
|||||||
*
|
*
|
||||||
* @param Smarty_Internal_Template $_template template object
|
* @param Smarty_Internal_Template $_template template object
|
||||||
* @param Smarty_Template_Cached $cached cached object
|
* @param Smarty_Template_Cached $cached cached object
|
||||||
* @param bool $update flag if called because cache update
|
* @param boolean $update flag if called because cache update
|
||||||
*
|
*
|
||||||
* @return bool true or false if the cached content does not exist
|
* @return boolean true or false if the cached content does not exist
|
||||||
*/
|
*/
|
||||||
abstract public function process(Smarty_Internal_Template $_template, Smarty_Template_Cached $cached = null,
|
abstract public function process(Smarty_Internal_Template $_template, Smarty_Template_Cached $cached = null,
|
||||||
$update = false);
|
$update = false);
|
||||||
@@ -63,6 +63,15 @@ abstract class Smarty_CacheResource
|
|||||||
*/
|
*/
|
||||||
abstract public function writeCachedContent(Smarty_Internal_Template $_template, $content);
|
abstract public function writeCachedContent(Smarty_Internal_Template $_template, $content);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read cached template from cache
|
||||||
|
*
|
||||||
|
* @param Smarty_Internal_Template $_template template object
|
||||||
|
*
|
||||||
|
* @return string content
|
||||||
|
*/
|
||||||
|
abstract function readCachedContent(Smarty_Internal_Template $_template);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return cached content
|
* Return cached content
|
||||||
*
|
*
|
||||||
|
@@ -43,7 +43,7 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource
|
|||||||
*/
|
*/
|
||||||
protected function fetchTimestamp($id, $name, $cache_id, $compile_id)
|
protected function fetchTimestamp($id, $name, $cache_id, $compile_id)
|
||||||
{
|
{
|
||||||
return null;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -63,9 +63,9 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource
|
|||||||
/**
|
/**
|
||||||
* Delete content from cache
|
* Delete content from cache
|
||||||
*
|
*
|
||||||
* @param string $name template name
|
* @param string|null $name template name
|
||||||
* @param string $cache_id cache id
|
* @param string|null $cache_id cache id
|
||||||
* @param string $compile_id compile id
|
* @param string|null $compile_id compile id
|
||||||
* @param integer|null $exp_time seconds till expiration time in seconds or null
|
* @param integer|null $exp_time seconds till expiration time in seconds or null
|
||||||
*
|
*
|
||||||
* @return integer number of deleted caches
|
* @return integer number of deleted caches
|
||||||
@@ -119,13 +119,14 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource
|
|||||||
/**
|
/**
|
||||||
* Read the cached template and process the header
|
* Read the cached template and process the header
|
||||||
*
|
*
|
||||||
* @param \Smarty_Internal_Template $_smarty_tpl do not change variable name, is used by compiled template
|
* @param \Smarty_Internal_Template $_smarty_tpl do not change variable name, is used by compiled template
|
||||||
* @param Smarty_Template_Cached $cached cached object
|
* @param Smarty_Template_Cached $cached cached object
|
||||||
* @param bool $update flag if called because cache update
|
* @param boolean $update flag if called because cache update
|
||||||
*
|
*
|
||||||
* @return boolean true or false if the cached content does not exist
|
* @return boolean true or false if the cached content does not exist
|
||||||
*/
|
*/
|
||||||
public function process(Smarty_Internal_Template $_smarty_tpl, Smarty_Template_Cached $cached = null, $update = false)
|
public function process(Smarty_Internal_Template $_smarty_tpl, Smarty_Template_Cached $cached = null,
|
||||||
|
$update = false)
|
||||||
{
|
{
|
||||||
if (!$cached) {
|
if (!$cached) {
|
||||||
$cached = $_smarty_tpl->cached;
|
$cached = $_smarty_tpl->cached;
|
||||||
@@ -164,7 +165,7 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource
|
|||||||
*
|
*
|
||||||
* @param Smarty_Internal_Template $_template template object
|
* @param Smarty_Internal_Template $_template template object
|
||||||
*
|
*
|
||||||
* @return string content
|
* @return string|boolean content
|
||||||
*/
|
*/
|
||||||
public function readCachedContent(Smarty_Internal_Template $_template)
|
public function readCachedContent(Smarty_Internal_Template $_template)
|
||||||
{
|
{
|
||||||
|
@@ -54,7 +54,7 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource
|
|||||||
*/
|
*/
|
||||||
public function populate(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template)
|
public function populate(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template)
|
||||||
{
|
{
|
||||||
$cached->filepath = sha1($_template->source->uid) . '#' . $this->sanitize($cached->source->resource) . '#' .
|
$cached->filepath = $_template->source->uid . '#' . $this->sanitize($cached->source->resource) . '#' .
|
||||||
$this->sanitize($cached->cache_id) . '#' . $this->sanitize($cached->compile_id);
|
$this->sanitize($cached->cache_id) . '#' . $this->sanitize($cached->compile_id);
|
||||||
|
|
||||||
$this->populateTimestamp($cached);
|
$this->populateTimestamp($cached);
|
||||||
@@ -76,19 +76,20 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource
|
|||||||
}
|
}
|
||||||
$cached->content = $content;
|
$cached->content = $content;
|
||||||
$cached->timestamp = (int) $timestamp;
|
$cached->timestamp = (int) $timestamp;
|
||||||
$cached->exists = $cached->timestamp;
|
$cached->exists = !!$cached->timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read the cached template and process the header
|
* Read the cached template and process the header
|
||||||
*
|
*
|
||||||
* @param \Smarty_Internal_Template $_smarty_tpl do not change variable name, is used by compiled template
|
* @param \Smarty_Internal_Template $_smarty_tpl do not change variable name, is used by compiled template
|
||||||
* @param Smarty_Template_Cached $cached cached object
|
* @param Smarty_Template_Cached $cached cached object
|
||||||
* @param bool $update flag if called because cache update
|
* @param boolean $update flag if called because cache update
|
||||||
*
|
*
|
||||||
* @return boolean true or false if the cached content does not exist
|
* @return boolean true or false if the cached content does not exist
|
||||||
*/
|
*/
|
||||||
public function process(Smarty_Internal_Template $_smarty_tpl, Smarty_Template_Cached $cached = null, $update = false)
|
public function process(Smarty_Internal_Template $_smarty_tpl, Smarty_Template_Cached $cached = null,
|
||||||
|
$update = false)
|
||||||
{
|
{
|
||||||
if (!$cached) {
|
if (!$cached) {
|
||||||
$cached = $_smarty_tpl->cached;
|
$cached = $_smarty_tpl->cached;
|
||||||
@@ -131,7 +132,7 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource
|
|||||||
*
|
*
|
||||||
* @param Smarty_Internal_Template $_template template object
|
* @param Smarty_Internal_Template $_template template object
|
||||||
*
|
*
|
||||||
* @return string content
|
* @return string|false content
|
||||||
*/
|
*/
|
||||||
public function readCachedContent(Smarty_Internal_Template $_template)
|
public function readCachedContent(Smarty_Internal_Template $_template)
|
||||||
{
|
{
|
||||||
@@ -226,7 +227,7 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource
|
|||||||
{
|
{
|
||||||
$string = trim($string, '|');
|
$string = trim($string, '|');
|
||||||
if (!$string) {
|
if (!$string) {
|
||||||
return null;
|
return '';
|
||||||
}
|
}
|
||||||
return preg_replace('#[^\w\|]+#S', '_', $string);
|
return preg_replace('#[^\w\|]+#S', '_', $string);
|
||||||
}
|
}
|
||||||
@@ -286,6 +287,10 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource
|
|||||||
protected function getMetaTimestamp(&$content)
|
protected function getMetaTimestamp(&$content)
|
||||||
{
|
{
|
||||||
extract(unpack('N1s/N1m/a*content', $content));
|
extract(unpack('N1s/N1m/a*content', $content));
|
||||||
|
/**
|
||||||
|
* @var int $s
|
||||||
|
* @var int $m
|
||||||
|
*/
|
||||||
return $s + ($m / 100000000);
|
return $s + ($m / 100000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -27,43 +27,31 @@ class Smarty_Internal_CacheResource_File extends Smarty_CacheResource
|
|||||||
*/
|
*/
|
||||||
public function populate(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template)
|
public function populate(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template)
|
||||||
{
|
{
|
||||||
$_cache_id = isset($_template->cache_id) ? preg_replace('![^\w\|]+!', '_', $_template->cache_id) : null;
|
$source = &$_template->source;
|
||||||
$_compile_id = isset($_template->compile_id) ? preg_replace('![^\w]+!', '_', $_template->compile_id) : null;
|
$smarty = &$_template->smarty;
|
||||||
$_filepath = sha1($_template->source->uid . $_template->smarty->_joined_template_dir);
|
$_compile_dir_sep = $smarty->use_sub_dirs ? DS : '^';
|
||||||
|
$_filepath = sha1($source->uid . $smarty->_joined_template_dir);
|
||||||
|
$cached->filepath = $smarty->getCacheDir();
|
||||||
|
if (isset($_template->cache_id)) {
|
||||||
|
$cached->filepath .= preg_replace(array('![^\w|]+!', '![|]+!'), array('_', $_compile_dir_sep),
|
||||||
|
$_template->cache_id) . $_compile_dir_sep;
|
||||||
|
}
|
||||||
|
if (isset($_template->compile_id)) {
|
||||||
|
$cached->filepath .= preg_replace('![^\w]+!', '_', $_template->compile_id) . $_compile_dir_sep;
|
||||||
|
}
|
||||||
// if use_sub_dirs, break file into directories
|
// if use_sub_dirs, break file into directories
|
||||||
if ($_template->smarty->use_sub_dirs) {
|
if ($smarty->use_sub_dirs) {
|
||||||
$_filepath = substr($_filepath, 0, 2) . DS . substr($_filepath, 2, 2) . DS . substr($_filepath, 4, 2) . DS .
|
$cached->filepath .= $_filepath[ 0 ] . $_filepath[ 1 ] . DS . $_filepath[ 2 ] . $_filepath[ 3 ] . DS .
|
||||||
$_filepath;
|
$_filepath[ 4 ] . $_filepath[ 5 ] . DS;
|
||||||
}
|
}
|
||||||
$_compile_dir_sep = $_template->smarty->use_sub_dirs ? DS : '^';
|
$cached->filepath .= $_filepath;
|
||||||
if (isset($_cache_id)) {
|
if (!empty($basename = $source->handler->getBasename($source))) {
|
||||||
$_cache_id = str_replace('|', $_compile_dir_sep, $_cache_id) . $_compile_dir_sep;
|
$cached->filepath .= '.' . $basename;
|
||||||
} else {
|
|
||||||
$_cache_id = '';
|
|
||||||
}
|
}
|
||||||
if (isset($_compile_id)) {
|
if ($smarty->cache_locking) {
|
||||||
$_compile_id = $_compile_id . $_compile_dir_sep;
|
$cached->lock_id = $cached->filepath . '.lock';
|
||||||
} else {
|
|
||||||
$_compile_id = '';
|
|
||||||
}
|
}
|
||||||
$_cache_dir = $_template->smarty->getCacheDir();
|
$cached->filepath .= '.php';
|
||||||
if ($_template->smarty->cache_locking) {
|
|
||||||
// create locking file name
|
|
||||||
// relative file name?
|
|
||||||
if (!preg_match('/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/', $_cache_dir)) {
|
|
||||||
$_lock_dir = rtrim(getcwd(), '/\\') . DS . $_cache_dir;
|
|
||||||
} else {
|
|
||||||
$_lock_dir = $_cache_dir;
|
|
||||||
}
|
|
||||||
$cached->lock_id = $_lock_dir . sha1($_cache_id . $_compile_id . $_template->source->uid) . '.lock';
|
|
||||||
}
|
|
||||||
// set basename
|
|
||||||
$_basename = $_template->source->handler->getBasename($_template->source);
|
|
||||||
if ($_basename === null) {
|
|
||||||
$_basename = basename(preg_replace('![^\w]+!', '_', $_template->source->name));
|
|
||||||
}
|
|
||||||
$cached->filepath =
|
|
||||||
$_cache_dir . $_cache_id . $_compile_id . $_filepath . '.' . $_basename . '.php';
|
|
||||||
$cached->timestamp = $cached->exists = is_file($cached->filepath);
|
$cached->timestamp = $cached->exists = is_file($cached->filepath);
|
||||||
if ($cached->exists) {
|
if ($cached->exists) {
|
||||||
$cached->timestamp = filemtime($cached->filepath);
|
$cached->timestamp = filemtime($cached->filepath);
|
||||||
@@ -88,13 +76,14 @@ class Smarty_Internal_CacheResource_File extends Smarty_CacheResource
|
|||||||
/**
|
/**
|
||||||
* Read the cached template and process its header
|
* Read the cached template and process its header
|
||||||
*
|
*
|
||||||
* @param \Smarty_Internal_Template $_smarty_tpl do not change variable name, is used by compiled template
|
* @param \Smarty_Internal_Template $_smarty_tpl do not change variable name, is used by compiled template
|
||||||
* @param Smarty_Template_Cached $cached cached object
|
* @param Smarty_Template_Cached $cached cached object
|
||||||
* @param bool $update flag if called because cache update
|
* @param bool $update flag if called because cache update
|
||||||
*
|
*
|
||||||
* @return boolean true or false if the cached content does not exist
|
* @return boolean true or false if the cached content does not exist
|
||||||
*/
|
*/
|
||||||
public function process(Smarty_Internal_Template $_smarty_tpl, Smarty_Template_Cached $cached = null, $update = false)
|
public function process(Smarty_Internal_Template $_smarty_tpl, Smarty_Template_Cached $cached = null,
|
||||||
|
$update = false)
|
||||||
{
|
{
|
||||||
$_smarty_tpl->cached->valid = false;
|
$_smarty_tpl->cached->valid = false;
|
||||||
if ($update && defined('HHVM_VERSION')) {
|
if ($update && defined('HHVM_VERSION')) {
|
||||||
|
@@ -64,10 +64,7 @@ class Smarty_Internal_Method_RegisterDefaultTemplateHandler
|
|||||||
$source->uid = sha1($source->filepath);
|
$source->uid = sha1($source->filepath);
|
||||||
} elseif ($_return === true) {
|
} elseif ($_return === true) {
|
||||||
$source->content = $_content;
|
$source->content = $_content;
|
||||||
$source->timestamp = $_timestamp;
|
$source->handler = Smarty_Resource::load($source->smarty, 'eval');
|
||||||
$source->exists = true;
|
|
||||||
$source->handler->recompiled = true;
|
|
||||||
$source->filepath = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -29,8 +29,7 @@ class Smarty_Internal_Resource_Eval extends Smarty_Resource_Recompiled
|
|||||||
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->uid = $source->filepath = sha1($source->name);
|
$source->uid = $source->filepath = sha1($source->name);
|
||||||
$source->timestamp = false;
|
$source->timestamp = $source->exists = true;
|
||||||
$source->exists = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -129,12 +129,9 @@ class Smarty_Internal_Resource_File extends Smarty_Resource
|
|||||||
$source->exists = true;
|
$source->exists = true;
|
||||||
$source->uid = sha1($source->filepath . ($source->isConfig ? $source->smarty->_joined_config_dir :
|
$source->uid = sha1($source->filepath . ($source->isConfig ? $source->smarty->_joined_config_dir :
|
||||||
$source->smarty->_joined_template_dir));
|
$source->smarty->_joined_template_dir));
|
||||||
if ($source->smarty->compile_check == 1) {
|
$source->timestamp = filemtime($source->filepath);
|
||||||
$source->timestamp = filemtime($source->filepath);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
$source->timestamp = false;
|
$source->timestamp = $source->exists = false;
|
||||||
$source->exists = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -101,7 +101,7 @@ class Smarty_Internal_Resource_Php extends Smarty_Internal_Resource_File
|
|||||||
$compiled->timestamp = $_template->source->timestamp;
|
$compiled->timestamp = $_template->source->timestamp;
|
||||||
$compiled->exists = $_template->source->exists;
|
$compiled->exists = $_template->source->exists;
|
||||||
$compiled->file_dependency[ $_template->source->uid ] =
|
$compiled->file_dependency[ $_template->source->uid ] =
|
||||||
array($compiled->filepath, $_template->source->getTimeStamp(),
|
array($compiled->filepath, $compiled->timestamp,
|
||||||
$_template->source->type,);
|
$_template->source->type,);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -30,10 +30,8 @@ class Smarty_Internal_Resource_Registered extends Smarty_Resource
|
|||||||
{
|
{
|
||||||
$source->filepath = $source->type . ':' . $source->name;
|
$source->filepath = $source->type . ':' . $source->name;
|
||||||
$source->uid = sha1($source->filepath . $source->smarty->_joined_template_dir);
|
$source->uid = sha1($source->filepath . $source->smarty->_joined_template_dir);
|
||||||
if ($source->smarty->compile_check) {
|
$source->timestamp = $this->getTemplateTimestamp($source);
|
||||||
$source->timestamp = $this->getTemplateTimestamp($source);
|
$source->exists = !!$source->timestamp;
|
||||||
$source->exists = !!$source->timestamp;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -36,8 +36,7 @@ class Smarty_Internal_Resource_Stream extends Smarty_Resource_Recompiled
|
|||||||
}
|
}
|
||||||
$source->uid = false;
|
$source->uid = false;
|
||||||
$source->content = $this->getContent($source);
|
$source->content = $this->getContent($source);
|
||||||
$source->timestamp = false;
|
$source->timestamp = $source->exists = !!$source->content;
|
||||||
$source->exists = !!$source->content;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -29,8 +29,7 @@ class Smarty_Internal_Resource_String extends Smarty_Resource
|
|||||||
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->uid = $source->filepath = sha1($source->name . $source->smarty->_joined_template_dir);
|
$source->uid = $source->filepath = sha1($source->name . $source->smarty->_joined_template_dir);
|
||||||
$source->timestamp = 0;
|
$source->timestamp = $source->exists = true;
|
||||||
$source->exists = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -94,4 +93,15 @@ class Smarty_Internal_Resource_String extends Smarty_Resource
|
|||||||
{
|
{
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Disable timestamp checks for string resource.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function checkTimestamps()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -431,9 +431,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
|
|||||||
) {
|
) {
|
||||||
// check file dependencies at compiled code
|
// check file dependencies at compiled code
|
||||||
foreach ($properties[ 'file_dependency' ] as $_file_to_check) {
|
foreach ($properties[ 'file_dependency' ] as $_file_to_check) {
|
||||||
if ($_file_to_check[ 2 ] == 'file' || $_file_to_check[ 2 ] == 'extends' ||
|
if ($_file_to_check[ 2 ] == 'file' || $_file_to_check[ 2 ] == 'php') {
|
||||||
$_file_to_check[ 2 ] == 'php'
|
|
||||||
) {
|
|
||||||
if ($tpl->source->filepath == $_file_to_check[ 0 ]) {
|
if ($tpl->source->filepath == $_file_to_check[ 0 ]) {
|
||||||
// do not recheck current template
|
// do not recheck current template
|
||||||
continue;
|
continue;
|
||||||
@@ -442,8 +440,6 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
|
|||||||
// file and php types can be checked without loading the respective resource handlers
|
// file and php types can be checked without loading the respective resource handlers
|
||||||
$mtime = is_file($_file_to_check[ 0 ]) ? filemtime($_file_to_check[ 0 ]) : false;
|
$mtime = is_file($_file_to_check[ 0 ]) ? filemtime($_file_to_check[ 0 ]) : false;
|
||||||
}
|
}
|
||||||
} elseif ($_file_to_check[ 2 ] == 'string') {
|
|
||||||
continue;
|
|
||||||
} else {
|
} else {
|
||||||
$handler = Smarty_Resource::load($tpl->smarty, $_file_to_check[ 2 ]);
|
$handler = Smarty_Resource::load($tpl->smarty, $_file_to_check[ 2 ]);
|
||||||
if ($handler->checkTimestamps()) {
|
if ($handler->checkTimestamps()) {
|
||||||
@@ -453,7 +449,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$mtime || $mtime > $_file_to_check[ 1 ]) {
|
if ($mtime === false || $mtime > $_file_to_check[ 1 ]) {
|
||||||
$is_valid = false;
|
$is_valid = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -160,12 +160,11 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data
|
|||||||
throw new SmartyException($function . '():Template object expected');
|
throw new SmartyException($function . '():Template object expected');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// get template object
|
// get template object
|
||||||
/* @var Smarty_Internal_Template $template */
|
/* @var Smarty_Internal_Template $template */
|
||||||
$saveVars = false;
|
$saveVars = false;
|
||||||
|
|
||||||
$template =
|
$template = $smarty->createTemplate($template, $cache_id, $compile_id, $parent ? $parent : $this, false);
|
||||||
$smarty->createTemplate($template, $cache_id, $compile_id, $parent ? $parent : $this, false);
|
|
||||||
if ($this->_objType == 1) {
|
if ($this->_objType == 1) {
|
||||||
// set caching in template object
|
// set caching in template object
|
||||||
$template->caching = $this->caching;
|
$template->caching = $this->caching;
|
||||||
|
@@ -382,9 +382,11 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
|||||||
$this->has_variable_string = false;
|
$this->has_variable_string = false;
|
||||||
$this->prefix_code = array();
|
$this->prefix_code = array();
|
||||||
// add file dependency
|
// add file dependency
|
||||||
$this->parent_compiler->template->compiled->file_dependency[ $this->template->source->uid ] =
|
if ($this->smarty->merge_compiled_includes || $this->template->source->handler->checkTimestamps()) {
|
||||||
array($this->template->source->filepath, $this->template->source->getTimeStamp(),
|
$this->parent_compiler->template->compiled->file_dependency[ $this->template->source->uid ] =
|
||||||
$this->template->source->type,);
|
array($this->template->source->filepath, $this->template->source->getTimeStamp(),
|
||||||
|
$this->template->source->type,);
|
||||||
|
}
|
||||||
$this->smarty->_current_file = $this->template->source->filepath;
|
$this->smarty->_current_file = $this->template->source->filepath;
|
||||||
// get template source
|
// get template source
|
||||||
if (!empty($this->template->source->components)) {
|
if (!empty($this->template->source->components)) {
|
||||||
|
@@ -13,6 +13,10 @@
|
|||||||
*
|
*
|
||||||
* @package Smarty
|
* @package Smarty
|
||||||
* @subpackage TemplateResources
|
* @subpackage TemplateResources
|
||||||
|
*
|
||||||
|
* @method renderUncompiled(Smarty_Template_Source $source, Smarty_Internal_Template $_template)
|
||||||
|
* @method populateCompiledFilepath(Smarty_Template_Compiled $compiled, Smarty_Internal_Template $_template)
|
||||||
|
* @method process(Smarty_Internal_Template $_smarty_tpl)
|
||||||
*/
|
*/
|
||||||
abstract class Smarty_Resource
|
abstract class Smarty_Resource
|
||||||
{
|
{
|
||||||
@@ -48,7 +52,7 @@ abstract class Smarty_Resource
|
|||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
public $hasCompiledHandler = false;
|
public $hasCompiledHandler = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load template's source into current template object
|
* Load template's source into current template object
|
||||||
*
|
*
|
||||||
@@ -110,7 +114,7 @@ abstract class Smarty_Resource
|
|||||||
*/
|
*/
|
||||||
public function getBasename(Smarty_Template_Source $source)
|
public function getBasename(Smarty_Template_Source $source)
|
||||||
{
|
{
|
||||||
return null;
|
return basename(preg_replace('![^\w]+!', '_', $source->name));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -30,6 +30,41 @@ abstract class Smarty_Resource_Recompiled extends Smarty_Resource
|
|||||||
*/
|
*/
|
||||||
public $hasCompiledHandler = true;
|
public $hasCompiledHandler = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* compile template from source
|
||||||
|
*
|
||||||
|
* @param Smarty_Internal_Template $_smarty_tpl do not change variable name, is used by compiled template
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function process(Smarty_Internal_Template $_smarty_tpl)
|
||||||
|
{
|
||||||
|
$compiled = &$_smarty_tpl->compiled;
|
||||||
|
$compiled->file_dependency = array();
|
||||||
|
$compiled->includes = array();
|
||||||
|
$compiled->nocache_hash = null;
|
||||||
|
$compiled->unifunc = null;
|
||||||
|
$level = ob_get_level();
|
||||||
|
ob_start();
|
||||||
|
$_smarty_tpl->loadCompiler();
|
||||||
|
// call compiler
|
||||||
|
try {
|
||||||
|
eval("?>" . $_smarty_tpl->compiler->compileTemplate($_smarty_tpl));
|
||||||
|
}
|
||||||
|
catch (Exception $e) {
|
||||||
|
unset($_smarty_tpl->compiler);
|
||||||
|
while (ob_get_level() > $level) {
|
||||||
|
ob_end_clean();
|
||||||
|
}
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
// release compiler object to free memory
|
||||||
|
unset($_smarty_tpl->compiler);
|
||||||
|
ob_get_clean();
|
||||||
|
$compiled->timestamp = time();
|
||||||
|
$compiled->exists = true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* populate Compiled Object with compiled filepath
|
* populate Compiled Object with compiled filepath
|
||||||
*
|
*
|
||||||
@@ -44,4 +79,14 @@ abstract class Smarty_Resource_Recompiled extends Smarty_Resource
|
|||||||
$compiled->timestamp = false;
|
$compiled->timestamp = false;
|
||||||
$compiled->exists = false;
|
$compiled->exists = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Disable timestamp checks for recompiled resource.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function checkTimestamps()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -29,17 +29,7 @@ abstract class Smarty_Resource_Uncompiled extends Smarty_Resource
|
|||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
public $hasCompiledHandler = true;
|
public $hasCompiledHandler = true;
|
||||||
|
|
||||||
/**
|
|
||||||
* Render and output the template (without using the compiler)
|
|
||||||
*
|
|
||||||
* @param Smarty_Template_Source $source source object
|
|
||||||
* @param Smarty_Internal_Template $_template template object
|
|
||||||
*
|
|
||||||
* @throws SmartyException on failure
|
|
||||||
*/
|
|
||||||
abstract public function renderUncompiled(Smarty_Template_Source $source, Smarty_Internal_Template $_template);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* populate compiled object with compiled filepath
|
* populate compiled object with compiled filepath
|
||||||
*
|
*
|
||||||
@@ -51,7 +41,9 @@ abstract class Smarty_Resource_Uncompiled extends Smarty_Resource
|
|||||||
$compiled->filepath = $_template->source->filepath;
|
$compiled->filepath = $_template->source->filepath;
|
||||||
$compiled->timestamp = $_template->source->timestamp;
|
$compiled->timestamp = $_template->source->timestamp;
|
||||||
$compiled->exists = $_template->source->exists;
|
$compiled->exists = $_template->source->exists;
|
||||||
$compiled->file_dependency[ $_template->source->uid ] =
|
if ($_template->smarty->merge_compiled_includes || $_template->source->handler->checkTimestamps()) {
|
||||||
array($compiled->filepath, $compiled->timestamp, $_template->source->type,);
|
$compiled->file_dependency[ $_template->source->uid ] =
|
||||||
|
array($compiled->filepath, $compiled->timestamp, $_template->source->type,);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -241,7 +241,7 @@ class Smarty_Template_Cached extends Smarty_Template_Resource_Base
|
|||||||
*
|
*
|
||||||
* @param Smarty_Internal_Template $_template template object
|
* @param Smarty_Internal_Template $_template template object
|
||||||
*
|
*
|
||||||
* @return string content
|
* @return string|false content
|
||||||
*/
|
*/
|
||||||
public function read(Smarty_Internal_Template $_template)
|
public function read(Smarty_Internal_Template $_template)
|
||||||
{
|
{
|
||||||
|
@@ -44,44 +44,36 @@ class Smarty_Template_Compiled extends Smarty_Template_Resource_Base
|
|||||||
**/
|
**/
|
||||||
public function populateCompiledFilepath(Smarty_Internal_Template $_template)
|
public function populateCompiledFilepath(Smarty_Internal_Template $_template)
|
||||||
{
|
{
|
||||||
$_compile_id = isset($_template->compile_id) ? preg_replace('![^\w]+!', '_', $_template->compile_id) : null;
|
$source = &$_template->source;
|
||||||
if ($_template->source->isConfig) {
|
$smarty = &$_template->smarty;
|
||||||
$_flag = '_' .
|
$this->filepath = $smarty->getCompileDir();
|
||||||
((int) $_template->smarty->config_read_hidden + (int) $_template->smarty->config_booleanize * 2 +
|
if (isset($_template->compile_id)) {
|
||||||
(int) $_template->smarty->config_overwrite * 4);
|
$this->filepath .= preg_replace('![^\w]+!', '_', $_template->compile_id) .
|
||||||
} else {
|
($smarty->use_sub_dirs ? DS : '^');
|
||||||
$_flag =
|
|
||||||
'_' . ((int) $_template->smarty->merge_compiled_includes + (int) $_template->smarty->escape_html * 2);
|
|
||||||
}
|
}
|
||||||
$_filepath = $_template->source->uid . $_flag;
|
|
||||||
// if use_sub_dirs, break file into directories
|
// if use_sub_dirs, break file into directories
|
||||||
if ($_template->smarty->use_sub_dirs) {
|
if ($smarty->use_sub_dirs) {
|
||||||
$_filepath = substr($_filepath, 0, 2) . DS . substr($_filepath, 2, 2) . DS . substr($_filepath, 4, 2) . DS .
|
$this->filepath .= $source->uid[ 0 ] . $source->uid[ 1 ] . DS . $source->uid[ 2 ] . $source->uid[ 3 ] . DS .
|
||||||
$_filepath;
|
$source->uid[ 4 ] . $source->uid[ 5 ] . DS;
|
||||||
}
|
}
|
||||||
if (isset($_compile_id)) {
|
$this->filepath .= $source->uid . '_';
|
||||||
$_filepath = $_compile_id . ($_template->smarty->use_sub_dirs ? DS : '^') . $_filepath;
|
if ($source->isConfig) {
|
||||||
}
|
$this->filepath .= (int) $smarty->config_read_hidden + (int) $smarty->config_booleanize * 2 +
|
||||||
// caching token
|
(int) $smarty->config_overwrite * 4;
|
||||||
if ($_template->caching) {
|
|
||||||
$_cache = '.cache';
|
|
||||||
} else {
|
} else {
|
||||||
$_cache = '';
|
$this->filepath .= (int) $smarty->merge_compiled_includes + (int) $smarty->escape_html * 2;
|
||||||
}
|
}
|
||||||
// set basename
|
$this->filepath .= '.' . $source->type;
|
||||||
$_basename = $_template->source->handler->getBasename($_template->source);
|
if (!empty($basename = $source->handler->getBasename($source))) {
|
||||||
if ($_basename === null) {
|
$this->filepath .= '.' . $basename;
|
||||||
$_basename = basename(preg_replace('![^\w]+!', '_', $_template->source->name));
|
|
||||||
}
|
}
|
||||||
// separate (optional) basename by dot
|
if ($_template->caching) {
|
||||||
if ($_basename) {
|
$this->filepath .= '.cache';
|
||||||
$_basename = '.' . $_basename;
|
|
||||||
}
|
}
|
||||||
|
$this->filepath .= '.php';
|
||||||
$this->filepath = $_template->smarty->getCompileDir() . $_filepath . '.' . $_template->source->type . $_basename . $_cache . '.php';
|
$this->timestamp = $this->exists = is_file($this->filepath);
|
||||||
$this->exists = is_file($this->filepath);
|
if ($this->exists) {
|
||||||
if (!$this->exists) {
|
$this->timestamp = filemtime($this->filepath);
|
||||||
$this->timestamp = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,40 +86,28 @@ class Smarty_Template_Compiled extends Smarty_Template_Resource_Base
|
|||||||
*/
|
*/
|
||||||
public function process(Smarty_Internal_Template $_smarty_tpl)
|
public function process(Smarty_Internal_Template $_smarty_tpl)
|
||||||
{
|
{
|
||||||
if (!$_smarty_tpl->source->handler->uncompiled) {
|
$source = &$_smarty_tpl->source;
|
||||||
if ($_smarty_tpl->source->handler->recompiled || !$this->exists || $_smarty_tpl->smarty->force_compile ||
|
$smarty = &$_smarty_tpl->smarty;
|
||||||
($_smarty_tpl->smarty->compile_check && $_smarty_tpl->source->getTimeStamp() > $this->getTimeStamp())
|
if ($source->handler->recompiled) {
|
||||||
|
$source->handler->process($_smarty_tpl);
|
||||||
|
} elseif (!$source->handler->uncompiled) {
|
||||||
|
if (!$this->exists || $smarty->force_compile ||
|
||||||
|
($smarty->compile_check && $source->getTimeStamp() > $this->getTimeStamp())
|
||||||
) {
|
) {
|
||||||
$this->compileTemplateSource($_smarty_tpl);
|
$this->compileTemplateSource($_smarty_tpl);
|
||||||
$compileCheck = $_smarty_tpl->smarty->compile_check;
|
$compileCheck = $smarty->compile_check;
|
||||||
$_smarty_tpl->smarty->compile_check = false;
|
$smarty->compile_check = false;
|
||||||
if ($_smarty_tpl->source->handler->recompiled) {
|
$this->loadCompiledTemplate($_smarty_tpl);
|
||||||
$level = ob_get_level();
|
$smarty->compile_check = $compileCheck;
|
||||||
ob_start();
|
|
||||||
try {
|
|
||||||
eval("?>" . $this->content);
|
|
||||||
}
|
|
||||||
catch (Exception $e) {
|
|
||||||
while (ob_get_level() > $level) {
|
|
||||||
ob_end_clean();
|
|
||||||
}
|
|
||||||
throw $e;
|
|
||||||
}
|
|
||||||
ob_get_clean();
|
|
||||||
$this->content = null;
|
|
||||||
} else {
|
|
||||||
$this->loadCompiledTemplate($_smarty_tpl);
|
|
||||||
}
|
|
||||||
$_smarty_tpl->smarty->compile_check = $compileCheck;
|
|
||||||
} else {
|
} else {
|
||||||
$_smarty_tpl->mustCompile = true;
|
$_smarty_tpl->mustCompile = true;
|
||||||
@include($this->filepath);
|
@include($this->filepath);
|
||||||
if ($_smarty_tpl->mustCompile) {
|
if ($_smarty_tpl->mustCompile) {
|
||||||
$this->compileTemplateSource($_smarty_tpl);
|
$this->compileTemplateSource($_smarty_tpl);
|
||||||
$compileCheck = $_smarty_tpl->smarty->compile_check;
|
$compileCheck = $smarty->compile_check;
|
||||||
$_smarty_tpl->smarty->compile_check = false;
|
$smarty->compile_check = false;
|
||||||
$this->loadCompiledTemplate($_smarty_tpl);
|
$this->loadCompiledTemplate($_smarty_tpl);
|
||||||
$_smarty_tpl->smarty->compile_check = $compileCheck;
|
$smarty->compile_check = $compileCheck;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$_smarty_tpl->_subTemplateRegister();
|
$_smarty_tpl->_subTemplateRegister();
|
||||||
@@ -139,7 +119,7 @@ class Smarty_Template_Compiled extends Smarty_Template_Resource_Base
|
|||||||
* Load fresh compiled template by including the PHP file
|
* Load fresh compiled template by including the PHP file
|
||||||
* HHVM requires a work around because of a PHP incompatibility
|
* HHVM requires a work around because of a PHP incompatibility
|
||||||
*
|
*
|
||||||
* @param \Smarty_Internal_Template $_smarty_tpl do not change variable name, is used by compiled template
|
* @param \Smarty_Internal_Template $_smarty_tpl do not change variable name, is used by compiled template
|
||||||
*/
|
*/
|
||||||
private function loadCompiledTemplate(Smarty_Internal_Template $_smarty_tpl)
|
private function loadCompiledTemplate(Smarty_Internal_Template $_smarty_tpl)
|
||||||
{
|
{
|
||||||
@@ -196,7 +176,6 @@ class Smarty_Template_Compiled extends Smarty_Template_Resource_Base
|
|||||||
*
|
*
|
||||||
* @param Smarty_Internal_Template $_template
|
* @param Smarty_Internal_Template $_template
|
||||||
*
|
*
|
||||||
* @return string
|
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function compileTemplateSource(Smarty_Internal_Template $_template)
|
public function compileTemplateSource(Smarty_Internal_Template $_template)
|
||||||
@@ -206,32 +185,14 @@ class Smarty_Template_Compiled extends Smarty_Template_Resource_Base
|
|||||||
$this->nocache_hash = null;
|
$this->nocache_hash = null;
|
||||||
$this->unifunc = null;
|
$this->unifunc = null;
|
||||||
// compile locking
|
// compile locking
|
||||||
if (!$_template->source->handler->recompiled) {
|
if ($saved_timestamp = $this->getTimeStamp()) {
|
||||||
if ($saved_timestamp = $this->getTimeStamp()) {
|
touch($this->filepath);
|
||||||
touch($this->filepath);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// call compiler
|
// call compiler
|
||||||
try {
|
$_template->loadCompiler();
|
||||||
$_template->loadCompiler();
|
$this->write($_template, $_template->compiler->compileTemplate($_template));
|
||||||
$code = $_template->compiler->compileTemplate($_template);
|
|
||||||
}
|
|
||||||
catch (Exception $e) {
|
|
||||||
// restore old timestamp in case of error
|
|
||||||
if (!$_template->source->handler->recompiled && $saved_timestamp) {
|
|
||||||
touch($this->filepath, $saved_timestamp);
|
|
||||||
}
|
|
||||||
throw $e;
|
|
||||||
}
|
|
||||||
// compiling succeeded
|
|
||||||
if ($_template->compiler->write_compiled_code) {
|
|
||||||
// write compiled template
|
|
||||||
$this->write($_template, $code);
|
|
||||||
$code = '';
|
|
||||||
}
|
|
||||||
// release compiler object to free memory
|
// release compiler object to free memory
|
||||||
unset($_template->compiler);
|
unset($_template->compiler);
|
||||||
return $code;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -253,11 +214,7 @@ class Smarty_Template_Compiled extends Smarty_Template_Resource_Base
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
} else {
|
|
||||||
$this->content = $code;
|
|
||||||
}
|
}
|
||||||
$this->timestamp = time();
|
|
||||||
$this->exists = true;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -60,8 +60,6 @@ class Smarty_Template_Config extends Smarty_Template_Source
|
|||||||
*/
|
*/
|
||||||
public $template_parser_class = 'Smarty_Internal_Configfileparser';
|
public $template_parser_class = 'Smarty_Internal_Configfileparser';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* initialize Source Object for given resource
|
* initialize Source Object for given resource
|
||||||
* Either [$_template] or [$smarty, $template_resource] must be specified
|
* Either [$_template] or [$smarty, $template_resource] must be specified
|
||||||
|
@@ -19,9 +19,9 @@ abstract class Smarty_Template_Resource_Base
|
|||||||
/**
|
/**
|
||||||
* Compiled Timestamp
|
* Compiled Timestamp
|
||||||
*
|
*
|
||||||
* @var integer
|
* @var integer|bool
|
||||||
*/
|
*/
|
||||||
public $timestamp = null;
|
public $timestamp = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compiled Existence
|
* Compiled Existence
|
||||||
@@ -106,7 +106,6 @@ abstract class Smarty_Template_Resource_Base
|
|||||||
* @param \Smarty_Internal_Template $_template
|
* @param \Smarty_Internal_Template $_template
|
||||||
* @param string $unifunc function with template code
|
* @param string $unifunc function with template code
|
||||||
*
|
*
|
||||||
* @return string
|
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function getRenderedTemplateCode(Smarty_Internal_Template $_template, $unifunc = null)
|
public function getRenderedTemplateCode(Smarty_Internal_Template $_template, $unifunc = null)
|
||||||
@@ -131,7 +130,6 @@ abstract class Smarty_Template_Resource_Base
|
|||||||
call_user_func($callback, $_template);
|
call_user_func($callback, $_template);
|
||||||
}
|
}
|
||||||
$_template->isRenderingCache = false;
|
$_template->isRenderingCache = false;
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
catch (Exception $e) {
|
catch (Exception $e) {
|
||||||
$_template->isRenderingCache = false;
|
$_template->isRenderingCache = false;
|
||||||
@@ -152,7 +150,7 @@ abstract class Smarty_Template_Resource_Base
|
|||||||
*/
|
*/
|
||||||
public function getTimeStamp()
|
public function getTimeStamp()
|
||||||
{
|
{
|
||||||
if ($this->exists && !isset($this->timestamp)) {
|
if ($this->exists && !$this->timestamp) {
|
||||||
$this->timestamp = filemtime($this->filepath);
|
$this->timestamp = filemtime($this->filepath);
|
||||||
}
|
}
|
||||||
return $this->timestamp;
|
return $this->timestamp;
|
||||||
|
@@ -135,8 +135,9 @@ class Smarty_Template_Source
|
|||||||
*/
|
*/
|
||||||
public function __construct(Smarty $smarty, $resource, $type, $name)
|
public function __construct(Smarty $smarty, $resource, $type, $name)
|
||||||
{
|
{
|
||||||
$this->handler = isset($smarty->_cache[ 'resource_handlers' ][ $type ]) ? $smarty->_cache[ 'resource_handlers' ][ $type ] :
|
$this->handler =
|
||||||
Smarty_Resource::load($smarty, $type);
|
isset($smarty->_cache[ 'resource_handlers' ][ $type ]) ? $smarty->_cache[ 'resource_handlers' ][ $type ] :
|
||||||
|
Smarty_Resource::load($smarty, $type);
|
||||||
$this->smarty = $smarty;
|
$this->smarty = $smarty;
|
||||||
$this->resource = $resource;
|
$this->resource = $resource;
|
||||||
$this->type = $type;
|
$this->type = $type;
|
||||||
@@ -182,7 +183,7 @@ class Smarty_Template_Source
|
|||||||
}
|
}
|
||||||
return $source;
|
return $source;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get source time stamp
|
* Get source time stamp
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user