mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-06 19:34:27 +02:00
- fixed file dependency for {incude} inside {block} tag
- fixed not compiling on non existing compiled templates when compile_check = false
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
11/03/2009
|
||||
- fixed parser error on objects with special smarty vars
|
||||
- fixed file dependency for {incude} inside {block} tag
|
||||
- fixed not compiling on non existing compiled templates when compile_check = false
|
||||
|
||||
11/02/2009
|
||||
- added neq,lte,gte,mod as aliases to if conditions
|
||||
|
@@ -26,11 +26,11 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_CompileBase {
|
||||
$this->optional_attributes = array('assign');
|
||||
// check and get attributes
|
||||
$_attr = $this->_get_attributes($args);
|
||||
$save = array($_attr, $compiler->template->extracted_compiled_code, $compiler->template->extract_code);
|
||||
$save = array($_attr, $compiler->template->extracted_compiled_code, $compiler->template->extract_code);
|
||||
$this->_open_tag('block', $save);
|
||||
$compiler->template->extract_code = true;
|
||||
$compiler->template->extracted_compiled_code = '';
|
||||
$compiler->template->has_code = false;
|
||||
$compiler->template->has_code = false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -76,7 +76,14 @@ class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_CompileBase {
|
||||
$_output = $compiler->template->extracted_compiled_code;
|
||||
}
|
||||
$compiler->template->extracted_compiled_code = $saved_data[1];
|
||||
$compiler->template->extract_code = $saved_data[2];
|
||||
$compiler->template->extract_code = $saved_data[2];
|
||||
// check for includes in block tags
|
||||
preg_match('/(\<\?php \$_smarty_tpl-\>decodeProperties\(\')(.*)(\'.*\?\>)/', $_output, $matches);
|
||||
$_output = preg_replace(array('/(\<\?php \$_smarty_tpl-\>decodeProperties\(\')(.*)(\'.*\?\>.*\n)/', '/(\<\?php if\(\!defined\(\'SMARTY_DIR\'\)\))(.*)(\?\>.*\n)/'), '', $_output);
|
||||
if (isset($matches[2])) {
|
||||
$prop = unserialize($matches[2]);
|
||||
$compiler->template->properties['file_dependency'] = array_merge($compiler->template->properties['file_dependency'], $prop['file_dependency']);
|
||||
}
|
||||
return $_output;
|
||||
}
|
||||
}
|
||||
|
@@ -58,7 +58,7 @@ class Smarty_Internal_Compile_Extend extends Smarty_Internal_CompileBase {
|
||||
// compile block content
|
||||
$_tpl = $this->smarty->createTemplate('string:' . $block_content);
|
||||
$_tpl->template_filepath = $this->compiler->template->getTemplateFilepath();
|
||||
$_tpl->suppressFileDependency = true;
|
||||
// $_tpl->suppressFileDependency = true;
|
||||
$_compiled_content = $_tpl->getCompiledTemplate();
|
||||
unset($_tpl);
|
||||
$_name = trim($_match[3], "\"'}");
|
||||
|
@@ -111,7 +111,7 @@ class Smarty_Internal_Resource_Extend {
|
||||
// compile block content
|
||||
$_tpl = $this->smarty->createTemplate('string:' . $block_content);
|
||||
$_tpl->template_filepath = $this->template->getTemplateFilepath();
|
||||
$_tpl->suppressFileDependency = true;
|
||||
// $_tpl->suppressFileDependency = true;
|
||||
$_compiled_content = $_tpl->getCompiledTemplate();
|
||||
unset($_tpl);
|
||||
$_name = trim($_match[3], "\"'}");
|
||||
|
@@ -210,7 +210,8 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase {
|
||||
{
|
||||
$this->isExisting(true);
|
||||
if ($this->mustCompile === null) {
|
||||
$this->mustCompile = ($this->usesCompiler() && ($this->force_compile || $this->isEvaluated() || ($this->smarty->compile_check && $this->getCompiledTimestamp () !== $this->getTemplateTimestamp ())));
|
||||
$this->mustCompile = ($this->usesCompiler() && ($this->force_compile || $this->isEvaluated() || $this->getCompiledTimestamp () === false ||
|
||||
($this->smarty->compile_check && $this->getCompiledTimestamp () !== $this->getTemplateTimestamp ())));
|
||||
}
|
||||
return $this->mustCompile;
|
||||
}
|
||||
@@ -370,11 +371,11 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase {
|
||||
if ($this->getCachedTimestamp() === false) {
|
||||
return $this->isCached;
|
||||
}
|
||||
if (($this->caching == SMARTY_CACHING_LIFETIME_SAVED || ($this->caching == SMARTY_CACHING_LIFETIME_CURRENT && (time() <= ($this->getCachedTimestamp() + $this->cache_lifetime) || $this->cache_lifetime < 0)))) {
|
||||
if ($this->caching === SMARTY_CACHING_LIFETIME_SAVED || ($this->caching && (time() <= ($this->getCachedTimestamp() + $this->cache_lifetime) || $this->cache_lifetime < 0))) {
|
||||
$_start_time = $this->_get_time();
|
||||
$this->rendered_content = $this->cache_resource_object->getCachedContents($this);
|
||||
$this->cache_time += $this->_get_time() - $_start_time;
|
||||
if ($this->caching == SMARTY_CACHING_LIFETIME_SAVED && $this->properties['cache_lifetime'] >0 && (time() > ($this->getCachedTimestamp() + $this->properties['cache_lifetime']))) {
|
||||
if ($this->caching === SMARTY_CACHING_LIFETIME_SAVED && $this->properties['cache_lifetime'] >0 && (time() > ($this->getCachedTimestamp() + $this->properties['cache_lifetime']))) {
|
||||
$this->rendered_content = null;
|
||||
return $this->isCached;
|
||||
}
|
||||
|
Reference in New Issue
Block a user