function get_cached_version($action) { require_once 'AMP/System/Cache/File.php'; $file_cache = new AMP_System_Cache_File(); $cache_key = AMP_CACHE_TOKEN_IMAGE . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; if (defined('AMP_SYSTEM_USER_ID') && AMP_SYSTEM_USER_ID) { $cache_key = AMP_System_Cache::identify($cache_key, AMP_SYSTEM_USER_ID); } $file_name = $file_cache->authorize($cache_key); $file_path = $file_cache->path($file_name); if ($this->_display($file_path)) { return true; } return $file_path; }
function AMP_cached_image_request() { require_once 'AMP/System/Cache/File.php'; $cache_key = AMP_CACHE_TOKEN_IMAGE . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; if (defined('AMP_SYSTEM_USER_ID') && AMP_SYSTEM_USER_ID) { $cache_key = AMP_System_Cache::identify($cache_key, AMP_SYSTEM_USER_ID); } $file_cache = new AMP_System_Cache_File(); $file_name = $file_cache->authorize($cache_key); $file_path = $file_cache->path($file_name); if (!file_exists($file_path)) { return false; } header("Content-Type: " . mime_content_type($file_path)); $fRef = fopen($file_path, 'r'); fpassthru($fRef); fclose($fRef); return true; }