mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 10:54:27 +02:00
- code cleanup
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
13/11/2010
|
||||
- bugfix overloading problem when $smarty->fetch()/display() have been used in plugins
|
||||
(introduced with 3.0.2)
|
||||
- code cleanup
|
||||
|
||||
===== Smarty 3.0.3 =====
|
||||
|
||||
|
@@ -564,19 +564,15 @@ class Smarty extends Smarty_Internal_Data {
|
||||
if (!isset($type)) {
|
||||
$type = $this->caching_type;
|
||||
}
|
||||
// already loaded?
|
||||
if (isset($this->cache_resource_objects[$type])) {
|
||||
return $this->cache_resource_objects[$type];
|
||||
}
|
||||
if (in_array($type, $this->cache_resource_types)) {
|
||||
$cache_resource_class = 'Smarty_Internal_CacheResource_' . ucfirst($type);
|
||||
return $this->cache_resource_objects[$type] = new $cache_resource_class($this);
|
||||
return new $cache_resource_class($this);
|
||||
}
|
||||
else {
|
||||
// try plugins dir
|
||||
$cache_resource_class = 'Smarty_CacheResource_' . ucfirst($type);
|
||||
if (Smarty_Internal_Plugin_Loader::loadPlugin($cache_resource_class, $this->plugins_dir)) {
|
||||
return $this->cache_resource_objects[$type] = new $cache_resource_class($this);
|
||||
if ($this->loadPlugin($cache_resource_class)) {
|
||||
return new $cache_resource_class($this);
|
||||
}
|
||||
else {
|
||||
throw new SmartyException("Unable to load cache resource '{$type}'");
|
||||
|
@@ -93,7 +93,7 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data {
|
||||
$rdelim = $smarty->right_delimiter;
|
||||
$smarty->left_delimiter = '{';
|
||||
$smarty->right_delimiter = '}';
|
||||
$_template = new Smarty_Template ($smarty->debug_tpl, $smarty);
|
||||
$_template = new Smarty_Internal_Template ($smarty->debug_tpl, $smarty);
|
||||
$_template->caching = false;
|
||||
$_template->force_compile = false;
|
||||
$_template->disableSecurity();
|
||||
|
@@ -95,7 +95,7 @@ class Smarty_Internal_Template extends Smarty_Internal_Data {
|
||||
// Template resource
|
||||
$this->template_resource = $template_resource;
|
||||
// copy block data of template inheritance
|
||||
if ($this->parent instanceof Smarty_Template or $this->parent instanceof Smarty_Internal_Template) {
|
||||
if ($this->parent instanceof Smarty_Internal_Template) {
|
||||
$this->block_data = $this->parent->block_data;
|
||||
}
|
||||
|
||||
@@ -455,7 +455,7 @@ class Smarty_Internal_Template extends Smarty_Internal_Data {
|
||||
if (!$this->resource_object->isEvaluated && empty($this->properties['file_dependency'][$this->templateUid])) {
|
||||
$this->properties['file_dependency'][$this->templateUid] = array($this->getTemplateFilepath(), $this->getTemplateTimestamp(),$this->resource_type);
|
||||
}
|
||||
if ($this->parent instanceof Smarty_Template or $this->parent instanceof Smarty_Internal_Template) {
|
||||
if ($this->parent instanceof Smarty_Internal_Template) {
|
||||
$this->parent->properties['file_dependency'] = array_merge($this->parent->properties['file_dependency'], $this->properties['file_dependency']);
|
||||
foreach($this->required_plugins as $code => $tmp1) {
|
||||
foreach($tmp1 as $name => $tmp) {
|
||||
@@ -859,7 +859,10 @@ class Smarty_Internal_Template extends Smarty_Internal_Data {
|
||||
if ($template == null) {
|
||||
return $this->smarty->fetch($this);
|
||||
} else {
|
||||
return $this->smarty->fetch($template, $cache_id, $compile_id, $parent, $display);
|
||||
if (!isset($parent)) {
|
||||
$parent = $this;
|
||||
}
|
||||
return $this->smarty->fetch($template, $cache_id, $compile_id, $parent, $display);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -872,6 +875,9 @@ class Smarty_Internal_Template extends Smarty_Internal_Data {
|
||||
if ($template == null) {
|
||||
return $this->smarty->display($this);
|
||||
} else {
|
||||
if (!isset($parent)) {
|
||||
$parent = $this;
|
||||
}
|
||||
return $this->smarty->display($template, $cache_id, $compile_id, $parent);
|
||||
}
|
||||
|
||||
@@ -953,10 +959,4 @@ class Smarty_Internal_Template extends Smarty_Internal_Data {
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* wrapper for template class
|
||||
*/
|
||||
class Smarty_Template extends Smarty_Internal_Template {
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user