mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-07 11:54:26 +02:00
- fixed problem with directory setter methodes
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
04/29/2009
|
||||
- fixed problem with directory setter methodes
|
||||
|
||||
04/28/2009
|
||||
- the {function} tag can no longer overwrite standard smarty tags
|
||||
- inherit functions defined by the {fuction} tag into subtemplates
|
||||
|
@@ -355,7 +355,7 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
*/
|
||||
public function setTemplateDir($template_dir)
|
||||
{
|
||||
$this->smarty->template_dir = (array)$template_dir;
|
||||
$this->template_dir = (array)$template_dir;
|
||||
return;
|
||||
}
|
||||
/**
|
||||
@@ -365,8 +365,8 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
*/
|
||||
public function addTemplateDir($template_dir)
|
||||
{
|
||||
$this->smarty->template_dir = array_merge((array)$this->smarty->template_dir, (array)$template_dir);
|
||||
$this->smarty->template_dir = array_unique($this->smarty->template_dir);
|
||||
$this->template_dir = array_merge((array)$this->template_dir, (array)$template_dir);
|
||||
$this->template_dir = array_unique($this->template_dir);
|
||||
return;
|
||||
}
|
||||
/**
|
||||
@@ -376,7 +376,7 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
*/
|
||||
public function setCompileDir($compile_dir)
|
||||
{
|
||||
$this->smarty->compile_dir = $compile_dir;
|
||||
$this->compile_dir = $compile_dir;
|
||||
return;
|
||||
}
|
||||
/**
|
||||
@@ -386,7 +386,7 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
*/
|
||||
public function setCacheDir($cache_dir)
|
||||
{
|
||||
$this->smarty->cache_dir = $cache_dir;
|
||||
$this->cache_dir = $cache_dir;
|
||||
return;
|
||||
}
|
||||
/**
|
||||
@@ -394,7 +394,7 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
*/
|
||||
public function enableCaching()
|
||||
{
|
||||
$this->smarty->caching = true;
|
||||
$this->caching = true;
|
||||
return;
|
||||
}
|
||||
/**
|
||||
@@ -404,7 +404,7 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
*/
|
||||
public function setCachingLifetime($lifetime)
|
||||
{
|
||||
$this->smarty->caching_lifetime = $lifetime;
|
||||
$this->caching_lifetime = $lifetime;
|
||||
return;
|
||||
}
|
||||
/**
|
||||
|
@@ -47,22 +47,22 @@ class Smarty_Internal_Compile_Extend extends Smarty_Internal_CompileBase {
|
||||
$this->compiler->trigger_template_error("\"" . $matches[0] . "\" missing name attribute");
|
||||
} else {
|
||||
// compile block content
|
||||
$tpl = $this->smarty->createTemplate('string:' . $matches[3]);
|
||||
$tpl->suppressHeader = true;
|
||||
$compiled_content = $tpl->getCompiledTemplate();
|
||||
$tpl->suppressHeader = false;
|
||||
$_tpl = $this->smarty->createTemplate('string:' . $matches[3]);
|
||||
$_tpl->suppressHeader = true;
|
||||
$_compiled_content = $_tpl->getCompiledTemplate();
|
||||
unset($_tpl);
|
||||
$_name = trim($_match[3], "\"'");
|
||||
|
||||
if (isset($this->compiler->template->block_data[$_name])) {
|
||||
if ($this->compiler->template->block_data[$_name]['mode'] == 'prepend') {
|
||||
$this->compiler->template->block_data[$_name]['compiled'] .= $compiled_content;
|
||||
$this->compiler->template->block_data[$_name]['compiled'] .= $_compiled_content;
|
||||
$this->compiler->template->block_data[$_name]['source'] .= $matches[3];
|
||||
} elseif ($this->compiler->template->block_data[$_name]['mode'] == 'append') {
|
||||
$this->compiler->template->block_data[$_name]['compiled'] = $compiled_content . $this->compiler->template->block_data[$_name]['compiled'];
|
||||
$this->compiler->template->block_data[$_name]['compiled'] = $_compiled_content . $this->compiler->template->block_data[$_name]['compiled'];
|
||||
$this->compiler->template->block_data[$_name]['source'] = $matches[3] . $this->compiler->template->block_data[$_name]['source'];
|
||||
}
|
||||
} else {
|
||||
$this->compiler->template->block_data[$_name]['compiled'] = $compiled_content;
|
||||
$this->compiler->template->block_data[$_name]['compiled'] = $_compiled_content;
|
||||
$this->compiler->template->block_data[$_name]['source'] = $matches[3];
|
||||
}
|
||||
// if (isset($this->compiler->template->block_data[$_name]['mode'])) {
|
||||
|
@@ -199,7 +199,8 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase {
|
||||
if ($this->mustCompile) {
|
||||
return true;
|
||||
}
|
||||
// read compiled template
|
||||
if ($this->smarty->compile_check) {
|
||||
// read compiled template to check file dependencies
|
||||
if ($this->compiled_template !== true && file_exists($this->getCompiledFilepath())) {
|
||||
$this->compiled_template = !$this->isEvaluated() ? file_get_contents($this->getCompiledFilepath()):'';
|
||||
$found = preg_match('~\<\?php /\*(.*)\*/ \?\>~', $this->compiled_template, $matches);
|
||||
@@ -216,6 +217,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $this->mustCompile;
|
||||
}
|
||||
|
||||
@@ -379,7 +381,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase {
|
||||
$this->rendered_content = null;
|
||||
return $this->isCached;
|
||||
}
|
||||
if (!empty($this->properties['file_dependency'])) {
|
||||
if (!empty($this->properties['file_dependency']) && $this->smarty->compile_check) {
|
||||
foreach ($this->properties['file_dependency'] as $file_to_check) {
|
||||
If (filemtime($file_to_check[0]) > $this->getCachedTimestamp()) {
|
||||
$this->rendered_content = null;
|
||||
|
Reference in New Issue
Block a user