mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
- make sure that property value is set
This commit is contained in:
@@ -289,14 +289,14 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $joined_template_dir = '';
|
public $_joined_template_dir = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* joined config directory string used in cache keys
|
* joined config directory string used in cache keys
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $joined_config_dir = '';
|
public $_joined_config_dir = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* default template handler
|
* default template handler
|
||||||
@@ -908,7 +908,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
public function setTemplateDir($template_dir, $isConfig = false)
|
public function setTemplateDir($template_dir, $isConfig = false)
|
||||||
{
|
{
|
||||||
$type = $isConfig ? 'config_dir' : 'template_dir';
|
$type = $isConfig ? 'config_dir' : 'template_dir';
|
||||||
$joined = 'joined_' . $type;
|
$joined = '_joined_' . $type;
|
||||||
$this->{$type} = (array) $template_dir;
|
$this->{$type} = (array) $template_dir;
|
||||||
$this->{$joined} = join(' # ', $this->{$type});
|
$this->{$joined} = join(' # ', $this->{$type});
|
||||||
$this->_cache[$type . '_new'] = true;
|
$this->_cache[$type . '_new'] = true;
|
||||||
@@ -928,7 +928,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
public function addTemplateDir($template_dir, $key = null, $isConfig = false)
|
public function addTemplateDir($template_dir, $key = null, $isConfig = false)
|
||||||
{
|
{
|
||||||
$type = $isConfig ? 'config_dir' : 'template_dir';
|
$type = $isConfig ? 'config_dir' : 'template_dir';
|
||||||
$joined = 'joined_' . $type;
|
$joined = '_joined_' . $type;
|
||||||
if (!isset($this->_cache[$type])) {
|
if (!isset($this->_cache[$type])) {
|
||||||
$this->{$type} = (array) $this->{$type};
|
$this->{$type} = (array) $this->{$type};
|
||||||
$this->{$joined} = join(' # ', $this->{$type});
|
$this->{$joined} = join(' # ', $this->{$type});
|
||||||
@@ -952,7 +952,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
{
|
{
|
||||||
$type = $isConfig ? 'config_dir' : 'template_dir';
|
$type = $isConfig ? 'config_dir' : 'template_dir';
|
||||||
if (!isset($this->_cache[$type])) {
|
if (!isset($this->_cache[$type])) {
|
||||||
$joined = 'joined_' . $type;
|
$joined = '_joined_' . $type;
|
||||||
$this->{$type} = (array) $this->{$type};
|
$this->{$type} = (array) $this->{$type};
|
||||||
$this->{$joined} = join(' # ', $this->{$type});
|
$this->{$joined} = join(' # ', $this->{$type});
|
||||||
$this->_cache[$type] = false;
|
$this->_cache[$type] = false;
|
||||||
|
@@ -444,7 +444,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
|
|||||||
if ($this->smarty->allow_ambiguous_resources) {
|
if ($this->smarty->allow_ambiguous_resources) {
|
||||||
$_templateId = Smarty_Resource::getUniqueTemplateName($this, $template_name) . "#{$cache_id}#{$compile_id}";
|
$_templateId = Smarty_Resource::getUniqueTemplateName($this, $template_name) . "#{$cache_id}#{$compile_id}";
|
||||||
} else {
|
} else {
|
||||||
$_templateId = $this->smarty->joined_template_dir . "#{$template_name}#{$cache_id}#{$compile_id}";
|
$_templateId = $this->smarty->_joined_template_dir . "#{$template_name}#{$cache_id}#{$compile_id}";
|
||||||
}
|
}
|
||||||
if (isset($_templateId[150])) {
|
if (isset($_templateId[150])) {
|
||||||
$_templateId = sha1($_templateId);
|
$_templateId = sha1($_templateId);
|
||||||
|
@@ -103,9 +103,15 @@ abstract class Smarty_Resource
|
|||||||
public function buildUniqueResourceName(Smarty $smarty, $resource_name, $isConfig = false)
|
public function buildUniqueResourceName(Smarty $smarty, $resource_name, $isConfig = false)
|
||||||
{
|
{
|
||||||
if ($isConfig) {
|
if ($isConfig) {
|
||||||
return get_class($this) . '#' . $smarty->joined_config_dir . '#' . $resource_name;
|
if (!isset($smarty->_joined_config_dir)) {
|
||||||
|
$smarty->getTemplateDir(null, true);
|
||||||
|
}
|
||||||
|
return get_class($this) . '#' . $smarty->_joined_config_dir . '#' . $resource_name;
|
||||||
} else {
|
} else {
|
||||||
return get_class($this) . '#' . $smarty->joined_template_dir . '#' . $resource_name;
|
if (!isset($smarty->_joined_template_dir)) {
|
||||||
|
$smarty->getTemplateDir();
|
||||||
|
}
|
||||||
|
return get_class($this) . '#' . $smarty->_joined_template_dir . '#' . $resource_name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user