Commit:    685109f51ed1a3c1fca7e9728276be490ce4ef46
Author:    Hannes Magnusson <[email protected]>         Wed, 20 Nov 2013 
14:14:28 -0800
Parents:   1573282c4c9a6d4d92fde8197e44f15679fd63f3
Branches:  master

Link:       
http://git.php.net/?p=web/php.git;a=commitdiff;h=685109f51ed1a3c1fca7e9728276be490ce4ef46

Log:
Automatically bump the CSS last-modified-timestamps

Changed paths:
  M  include/header.inc


Diff:
diff --git a/include/header.inc b/include/header.inc
index c107b98..7fab9fc 100755
--- a/include/header.inc
+++ b/include/header.inc
@@ -4,6 +4,12 @@ header("Expires: Thu, 19 Nov 1981 08:52:00 GMT");
 header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, 
pre-check=0");
 header("Pragma: no-cache");
 
+$cssfiles = array(200 => "theme-base.css", 
"theme-medium.css")+(array)$config["css"];
+foreach($cssfiles as $filename) {
+    $CSS[$filename] = @filemtime("styles/$filename");
+}
+
+
 // Version information for the mega drop down.
 include $_SERVER['DOCUMENT_ROOT'] . '/include/version.inc';
 
@@ -39,18 +45,9 @@ if (isset($shortname) && $shortname) {
 <?php endforeach ?>
 
  <link 
href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,600,400italic,600italic|Source+Code+Pro&amp;subset=latin,latin-ext'
 rel='stylesheet' type='text/css'>
- <link rel="stylesheet" type="text/css" href="<?php echo $STATIC_ROOT 
?>styles/theme-base.css?t=20131120b" media="screen" />
- <link rel="stylesheet" type="text/css" href="<?php echo $STATIC_ROOT 
?>styles/theme-medium.css?t=20131120" media="screen" />
-
- <?php
- if(isset($config['css']) && is_array($config['css'])):
-     foreach($config['css'] as $file):
- ?>
-      <link rel="stylesheet" type="text/css" href="<?php echo $STATIC_ROOT 
?>styles/<?= $file; ?>" media="screen" />
- <?php
-     endforeach;
- endif;
- ?>
+<?php foreach($CSS as $filename => $modified): ?>
+<link rel="stylesheet" type="text/css" href="<?php echo $STATIC_ROOT 
?>styles/<?php echo $filename?>?t=<?php echo $modified?>" media="screen" />
+<?php endforeach ?>
 
  <!--[if lte IE 7]>
  <link rel="stylesheet" type="text/css" href="<?php echo $STATIC_ROOT 
?>styles/workarounds.ie7.css" media="screen" />


--
PHP Webmaster List Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to