setParser($parser); } $this->content = $content; } public function process($item, $arguments = null, $scope = null) { $hash = sha1($this->content); $cacheFile = TEMP_FOLDER . "/.cache.$hash"; if (!file_exists($cacheFile) || isset($_GET['flush'])) { $content = $this->parseTemplateContent($this->content, "string sha1=$hash"); $fh = fopen($cacheFile, 'w'); fwrite($fh, $content); fclose($fh); } $val = $this->includeGeneratedTemplate($cacheFile, $item, $arguments, null, $scope); if ($this->cacheTemplate !== null) { $cacheTemplate = $this->cacheTemplate; } else { $cacheTemplate = static::config()->get('cache_template'); } if (!$cacheTemplate) { unlink($cacheFile); } return $val; } /** * @param boolean $cacheTemplate */ public function setCacheTemplate($cacheTemplate) { $this->cacheTemplate = (bool)$cacheTemplate; } /** * @return boolean */ public function getCacheTemplate() { return $this->cacheTemplate; } }