*/ public final function entityCache($ETag, $time) { $ETag = "\"{$ETag}\""; HttpHeaders::add('ETag: ' . $ETag); if (!empty($_SERVER['HTTP_IF_NONE_MATCH'])) { if (false !== strpos($_SERVER['HTTP_IF_NONE_MATCH'], $ETag)) { return 304; } # If none of the entity tags match, # then the server MAY perform the requested method as if the If-None-Match header field did not exist, # but MUST also ignore any If-Modified-Since header field(s) in the request. $_SERVER['HTTP_IF_MODIFIED_SINCE'] = null; } if (isset($_SERVER['HTTP_IF_MATCH']) && false === strpos($_SERVER['HTTP_IF_MATCH'], $ETag)) { return 412; } $time = (int) $time; HttpHeaders::add('Last-Modified: ' . gmdate('D, d M Y H:i:s \\G\\M\\T', $time)); # DATE_RFC1123 if (!empty($_SERVER['HTTP_IF_MODIFIED_SINCE']) && $time <= strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE'])) { return 304; } if (!empty($_SERVER['HTTP_IF_UNMODIFIED_SINCE']) && $time > strtotime($_SERVER['HTTP_IF_UNMODIFIED_SINCE'])) { return 412; } HttpHeaders::flush(); } } HttpUtils::init();