summaryrefslogtreecommitdiff
path: root/system/helpers/expires.php
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2010-01-06 11:35:01 -0800
committerTim Almdal <tnalmdal@shaw.ca>2010-01-06 11:35:01 -0800
commita74fd27e5f238f91f39be14056692945eecedabc (patch)
tree6a4a3311536500b06178d5a8c620263b0130d3ea /system/helpers/expires.php
parent7778d4c05075e67f096d3d5365e5ae35e1b0a737 (diff)
Updated Kohana to r4737
Diffstat (limited to 'system/helpers/expires.php')
-rw-r--r--system/helpers/expires.php30
1 files changed, 15 insertions, 15 deletions
diff --git a/system/helpers/expires.php b/system/helpers/expires.php
index 5f599e13..f17b3cf8 100644
--- a/system/helpers/expires.php
+++ b/system/helpers/expires.php
@@ -2,9 +2,7 @@
/**
* Controls headers that effect client caching of pages
*
- * $Id: expires.php 4679 2009-11-10 01:45:52Z isaiah $
- *
- * @package Core
+ * @package Kohana
* @author Kohana Team
* @copyright (c) 2007-2009 Kohana Team
* @license http://kohanaphp.com/license
@@ -15,18 +13,19 @@ class expires_Core {
* Sets the amount of time before content expires
*
* @param integer Seconds before the content expires
- * @return integer Timestamp when the content expires
+ * @param integer Last modified timestamp in seconds(optional)
+ * @return integer Timestamp when the content expires
*/
public static function set($seconds = 60, $last_modified=null)
{
$now = time();
$expires = $now + $seconds;
- if (empty($last_modified))
- {
- $last_modified = $now;
- }
+ if (empty($last_modified))
+ {
+ $last_modified = $now;
+ }
- header('Last-Modified: '.gmdate('D, d M Y H:i:s T', $last_modified));
+ header('Last-Modified: '.gmdate('D, d M Y H:i:s T', $last_modified));
// HTTP 1.0
header('Expires: '.gmdate('D, d M Y H:i:s T', $expires));
@@ -70,19 +69,20 @@ class expires_Core {
* @uses expires::get()
*
* @param integer Maximum age of the content in seconds
- * @param integer Last modified timestamp in seconds
+ * @param integer Last modified timestamp in seconds(optional)
* @return integer|boolean Timestamp of the If-Modified-Since header or FALSE when header is lacking or malformed
*/
- public static function check($seconds = 60, $modified=null)
+ public static function check($seconds = 60, $modified=null))
{
if ($last_modified = expires::get())
{
$now = time();
- if (empty($modified))
- {
- $modified = $now;
- }
+ if (empty($last_modified))
+ {
+ $last_modified = $now;
+ }
+ $max_age = $expires - time();
if ($modified <= $last_modified)
{