public function decodeProperties($properties)
{
if (isset($properties['file_dependency'])) {
foreach ($properties['file_dependency'] as $key => $val) {
$this->properties['file_dependency'][$key] = $val;
}
}
$this->properties['version'] = isset($properties['version']) ? $properties['version'] : '';
// check file dependencies at compiled code
if ($this->properties['version'] != Brainy::SMARTY_VERSION) {
return false;
}
if ($this->smarty->compile_check && empty($this->compiled->properties) && !$this->compiled->isCompiled && !empty($this->properties['file_dependency'])) {
foreach ($this->properties['file_dependency'] as $_file_to_check) {
if ($_file_to_check[2] == 'file') {
if ($this->source->filepath == $_file_to_check[0] && isset($this->source->timestamp)) {
// do not recheck current template
$mtime = $this->source->timestamp;
} else {
// file and php types can be checked without loading the respective resource handlers
$mtime = @filemtime($_file_to_check[0]);
}
} elseif ($_file_to_check[2] == 'string') {
continue;
} else {
$source = \Box\Brainy\Resources\Resource::source(null, $this->smarty, $_file_to_check[0]);
$mtime = $source->timestamp;
}
if (!$mtime || $mtime > $_file_to_check[1]) {
return false;
}
}
}
// store data in reusable Smarty_Template_Compiled
$this->properties['unifunc'] = $properties['unifunc'];
$this->compiled->properties = $properties;
return true;
}