public function getwidget() { $this->load->model('tool/nitro'); require_once DIR_SYSTEM . 'nitro/core/top.php'; if (!empty($_SESSION['NitroRenderTime']) && !empty($_SESSION['NitroNameOfCacheFile'])) { if (decideToShowFrontWidget()) { $renderTime = $_SESSION['NitroRenderTime']; $nameOfCacheFile = $_SESSION['NitroNameOfCacheFile']; $originalRenderTime = (double) getLoadTime($nameOfCacheFile); $faster = (int) ($originalRenderTime / $renderTime); require_once NITRO_FOLDER . 'core/frontwidget.php'; exit; } } }
function serveCacheIfNecessary() { if (!isset($_SESSION)) { session_start(); } if (passesPageCacheValidation() == false) { return false; } $cachefile = NITRO_PAGECACHE_FOLDER . generateNameOfCacheFile(); if (file_exists($cachefile) && time() - NITROCACHE_TIME < filemtime($cachefile)) { $before = microtime(true); header('Content-type: text/html; charset=utf-8'); serveBrowserCacheHeadersIfNecessary(); if (loadGzipHeadersIfNecessary() == true) { readfile($cachefile . '.gz'); } else { readfile($cachefile); } $after = microtime(true); if (decideToShowFrontWidget()) { $renderTime = $after - $before; $nameOfCacheFile = generateNameOfCacheFile(); $originalRenderTime = (double) getLoadTime(); $faster = (int) ($originalRenderTime / $renderTime); include NITRO_FOLDER . 'core/frontwidget.php'; } exit; } }