0) { // Re-send headers header('Last-Modified: ' . gmdate('D, d M Y H:i:s T', $mod_time)); header('Expires: ' . gmdate('D, d M Y H:i:s T', time() + $mod_time_diff)); header('Cache-Control: max-age=' . $mod_time_diff); header('Status: 304 Not Modified', true, 304); // Prevent any output Event::add('system.display', array('expires', 'prevent_output')); // Exit to prevent other output exit; } } return false; } /** * Check headers already created to not step on download or Img_lib's feet * * @return boolean */ public static function check_headers() { foreach (headers_list() as $header) { if ( (session_cache_limiter() == '' and stripos($header, 'Last-Modified:') === 0) or stripos($header, 'Expires:') === 0 ) { return false; } } return true; } /** * Prevent any output from being displayed. Executed during system.display. * * @return void */ public static function prevent_output() { Kohana::$output = ''; } } // End expires