CMS  Version 3.9
scripts.inc
Go to the documentation of this file.
1 <?php
2 Fakoli::usingFeature("cache");
3 
4 while( ob_get_level() )
5 { ob_end_clean(); }
6 
7 $last_modified = Cache::get("script_cache_timestamp");
8 
9 if(array_key_exists("HTTP_IF_MODIFIED_SINCE",$_SERVER))
10 {
11  $date = $_SERVER["HTTP_IF_MODIFIED_SINCE"];
12  $if_modified_since=strtotime($date);
13 
14  if($if_modified_since >= $last_modified)
15  {
16  header("HTTP/1.1 304 Not Modified");
17  $noChange = true;
18  }
19 }
20 
21 
22 if (!$noChange)
23 {
25 }
26 
27 header("Last-Modified: ".date('r', $last_modified));
28 header("Cache-Control: max-age=300, must-revalidate");
29 header("Content-Type: text/javascript");
30 header("Pragma: private");
31 header("Expires: " . date(DATE_RFC822,strtotime(" 2 day")));
32 
33 if (!$noChange)
34 {
36  echo $content;
38 
40  {
41  header("Content-Length: ".strlen($content));
42  }
43 
44 }
45 ?>
static usingFeature()
Uses the specified framework feature(s).
Definition: core.inc:388
static getScriptsContent()
$date
Definition: event_list.inc:51
while(ob_get_level()) $last_modified
Definition: scripts.inc:7
if(array_key_exists("HTTP_IF_MODIFIED_SINCE", $_SERVER)) $content
Definition: styles.css.inc:24