/** * Outputs frontpage HTML * * @param string $option the joomla component name * @param array $rows array of video data * @param array $rowsfeatured array of featured video data * @param object $pageNav page navigation object * @param int $total the total video count * @return Nothing */ function initiate($override=null) { global $mainframe; // set cache variables $cachedir = JPATH_SITE.'/administrator/cache/'; // Directory to cache files in (keep outside web root) $cachetime = 86400; // Seconds to cache files for $cacheext = 'cache'; // Extension to give cached files (usually cache, htm, txt) $page = 'http://archivefile'; // Requested page $cachefile = $cachedir . md5($page) . '.' . $cacheext; // Cache file to either load or create $cachefile_created = (@file_exists($cachefile)) ? @filemtime($cachefile) : 0; @clearstatcache(); if ($override == 2) { // Show file from cache if still valid if (time() - $cachetime < $cachefile_created) { $mainframe->enqueueMessage(_HWDVIDS_M_LOG_RUN); return; } } // Now the script has run, generate a new cache file $fp = @fopen($cachefile, 'w'); // save the contents of output buffer to the file @fwrite($fp, ob_get_contents()); @fclose($fp); $text = ''; $text.= hwd_vs_logs::archiveViews(); $text.= hwd_vs_logs::archiveFavours(); $text.= hwd_vs_logs::archiveVotes(); return $text; }