Example #1
0
 private function get_layout_cache_key()
 {
     if ($this->layout_cache_key != null) {
         return $this->layout_cache_key;
     }
     $layout_class_source = ClassLoader::instance()->get_element_content_by_name(get_class($this));
     $f = new File("/" . $this->layout_path);
     $layout_file_path = $f->getPath();
     $layout_file_size = $f->getSize();
     $layout_modification_time = $f->getModificationTime();
     $this->layout_cache_key = md5($layout_class_source . $layout_file_path . $layout_file_size . $layout_modification_time);
     return $this->layout_cache_key;
 }
Example #2
0
 public static function require_css_file($file, $media = CSS::MEDIA_ALL)
 {
     if ($file instanceof File) {
         $file_object = $file;
     } else {
         $file_object = new File($file);
     }
     if (!$file_object->exists()) {
         throw new Exception("Css not found : " . $file);
     } else {
         $path_with_hash = $file_object->getPath() . "?hash=" . md5($file_object->getModificationTime());
         self::require_css($path_with_hash, $media);
     }
 }
Example #3
0
 public static function require_script_file($file)
 {
     if ($file instanceof File) {
         $file_object = $file;
     } else {
         $file_object = new File($file);
     }
     if (!$file_object->exists()) {
         throw new Exception("Script not found : " . $file);
     } else {
         $path_with_hash = $file_object->getPath() . "?hash=" . md5($file_object->getModificationTime());
         self::require_script($path_with_hash);
     }
 }
Example #4
0
 private static function add_menu_entry($sitemap, $entry)
 {
     if (isset($entry["link"]) && isset($entry["key"])) {
         $sitemap_entry = new SitemapEntry();
         $sitemap_entry->setLoc($entry["link"]);
         $sitemap_entry->setPriority(1);
         $sitemap_entry->setChangeFreq(SitemapEntry::CHANGEFREQ_MONTHLY);
         $page_path = str_replace(".php", ".page.php", $entry["link"]);
         $f = new File("/contenuti" . $page_path);
         $mod_time = date("Y-m-d", $f->getModificationTime());
         $sitemap_entry->setLastMod($mod_time);
         $sitemap->addEntry($sitemap_entry);
     }
     if (isset($entry["childs"])) {
         $all_childs = $entry["childs"];
         foreach ($all_childs as $child) {
             self::add_menu_entry($sitemap, $child);
         }
     }
 }
Example #5
0
 /**
  * Returns the modification time of the file as Unix timestamp
  *
  * @return int
  */
 public function getModificationTime()
 {
     return (int) $this->originalFile->getModificationTime();
 }