/** * if cacheing is active and a cached file is availible it outputs the cache and exits the script * * @return void */ public function load() { // gets the current uri - example: /folder/folder2 $filename = $this->getCacheName(); // create the cache filename $cacheFilename = self::DIR_PAGES . $filename . '.cache.php'; $cacheFilenamePhpData = self::DIR_PAGES . $filename . '.cache.config.php'; $menuItemTranslation = false; $domain = false; $executedBlocks = array(); if (defined('GLOBAL_CACHING_ENABLED') && GLOBAL_CACHING_ENABLED && !$this->request->isXmlHttpRequest() && !$this->request->isPost() && $this->user->isAdmin() === false && is_file($cacheFilename) && is_file($cacheFilenamePhpData)) { include $cacheFilenamePhpData; if ($menuItemTranslation) { $menuItemTranslation = json_decode($menuItemTranslation); if (is_object($menuItemTranslation)) { if ($this->request->isXmlHttpRequest() === false && $this->route->isHTTPS() === false && $menuItemTranslation->menuItem->https === true) { $this->route->redirectToURL('https://' . $this->route->getRequestRoute()); } $this->route->setCurrentMenuItem($menuItemTranslation->menuItem); $this->route->setCurrentMenuItemTranslation($menuItemTranslation); $this->route->setCurrentDomain($domain); if ($this->isCachingActive($menuItemTranslation->menuItem)) { $this->blockParser->setExecutedBlocks(json_decode($executedBlocks)); // display the cached file to the client $contents = file_get_contents($cacheFilename); $content = $this->blockParser->parse($contents, 'outputFilter', true); echo eval('?>' . $content . '<?php '); exit; } } } } }