Beispiel #1
0
 /**
  * Parse the expiration time from a series of HTTP headers.
  *
  * @param array $headers
  * @return int|NULL
  *   Expiration tme as seconds since epoch, or NULL if not cacheable.
  */
 public static function parseExpiration($headers)
 {
     $headers = CRM_Utils_Array::rekey($headers, function ($k, $v) {
         return strtolower($k);
     });
     if (!empty($headers['cache-control'])) {
         $cc = self::parseCacheControl($headers['cache-control']);
         if ($cc['max-age'] && is_numeric($cc['max-age'])) {
             return CRM_Utils_Time::getTimeRaw() + $cc['max-age'];
         }
     }
     return NULL;
 }