Exemple #1
0
 /**
  * get a Compiled Object of this source
  *
  * @param  Template $_template template objet
  * @return CompiledTemplate compiled object
  */
 public function getCompiled(Template $_template)
 {
     if ($this->compiledCache) {
         return $this->compiledCache;
     }
     $compiled = new CompiledTemplate($this);
     $this->handler->populateCompiledFilepath($compiled, $_template);
     $compiled->timestamp = false;
     if ($compiled->filepath && file_exists($compiled->filepath)) {
         try {
             $compiled->timestamp = filemtime($compiled->filepath);
         } catch (\Exception $e) {
         }
     }
     $compiled->exists = (bool) $compiled->timestamp;
     $this->compiledCache = $compiled;
     return $compiled;
 }
 /**
  * get a Compiled Object of this source
  *
  * @param  Template $_template template objet
  * @return Smarty_Template_Compiled compiled object
  */
 public function getCompiled(Template $_template)
 {
     // check runtime cache
     $_cache_key = $this->unique_resource . '#' . $_template->compile_id;
     if (isset(Resource::$compileds[$_cache_key])) {
         return Resource::$compileds[$_cache_key];
     }
     $compiled = new CompiledTemplate($this);
     $this->handler->populateCompiledFilepath($compiled, $_template);
     $compiled->timestamp = false;
     if ($compiled->filepath && file_exists($compiled->filepath)) {
         try {
             $compiled->timestamp = filemtime($compiled->filepath);
         } catch (Exception $e) {
         }
     }
     $compiled->exists = (bool) $compiled->timestamp;
     // runtime cache
     \Box\Brainy\Resources\Resource::$compileds[$_cache_key] = $compiled;
     return $compiled;
 }