if (!self::canCache()) { return false; } if (isset($_SESSION['customer_id']) || isset($_SESSION['user_id'])) { return false; } $session_keys = array('cart', 'wishlist', 'compare'); foreach ($session_keys as $session_key) { if (isset($_SESSION[$session_key]) && is_array($_SESSION[$session_key]) && count($_SESSION[$session_key]) > 0) { return false; } } return true; } public static function enablePageCache($language = 'en', $currency = 'usd') { if (!session_id()) { session_start(); } if (self::canPageCache()) { self::$page_cache_file = Journal2Cache::$path . '/' . Journal2Cache::$dir . implode('_', array(md5(self::getCurrentUrl()), $language, $currency, self::$device)); if (file_exists(self::$page_cache_file)) { echo file_get_contents(self::$page_cache_file); exit; } } } } Journal2Cache::$path = realpath(DIR_SYSTEM . '../'); Journal2Cache::$mobile_detect = new Mobile_Detect();