mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-07 20:04:27 +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
|
||||
|
@@ -118,7 +118,7 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
// config var settings
|
||||
public $config_overwrite = true; //Controls whether variables with the same name overwrite each other.
|
||||
public $config_booleanize = true; //Controls whether config values of on/true/yes and off/false/no get converted to boolean
|
||||
public $config_read_hidden = true; //Controls whether hidden config sections/vars are read from the file.
|
||||
public $config_read_hidden = true; //Controls whether hidden config sections/vars are read from the file.
|
||||
// config vars
|
||||
public $config_vars = array();
|
||||
// assigned tpl vars
|
||||
@@ -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;
|
||||
}
|
||||
/**
|
||||
@@ -445,8 +445,8 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
// loop through plugin dirs and find the plugin
|
||||
foreach((array)$this->plugins_dir as $plugin_dir) {
|
||||
if (file_exists($plugin_dir . $plugin_filename)) {
|
||||
require_once($plugin_dir . $plugin_filename);
|
||||
return true;
|
||||
require_once($plugin_dir . $plugin_filename);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// no plugin loaded
|
||||
|
@@ -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,17 +199,19 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase {
|
||||
if ($this->mustCompile) {
|
||||
return true;
|
||||
}
|
||||
// read compiled template
|
||||
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);
|
||||
if ($found) {
|
||||
$_properties = unserialize($matches[1]);
|
||||
if (!empty($_properties['file_dependency'])) {
|
||||
foreach ($_properties['file_dependency'] as $file_to_check) {
|
||||
If (filemtime($file_to_check[0]) != $file_to_check[1]) {
|
||||
$this->mustCompile = true;
|
||||
return $this->mustCompile;
|
||||
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);
|
||||
if ($found) {
|
||||
$_properties = unserialize($matches[1]);
|
||||
if (!empty($_properties['file_dependency'])) {
|
||||
foreach ($_properties['file_dependency'] as $file_to_check) {
|
||||
If (filemtime($file_to_check[0]) != $file_to_check[1]) {
|
||||
$this->mustCompile = true;
|
||||
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