Got questions, comments, patches, etc.?
Contact Jason Woofenden
gitweb
/
contractor-progress.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
clients can put tasks on hold
[contractor-progress.git]
/
css_mangler.php
diff --git
a/css_mangler.php
b/css_mangler.php
index
40f0e8e
..
1b0d7d8
100644
(file)
--- a/
css_mangler.php
+++ b/
css_mangler.php
@@
-1,5
+1,6
@@
<?php
<?php
+require_once('code/wfpl/http.php');
require_once('code/wfpl/file.php');
require_once('code/ie_detect.php');
require_once('code/wfpl/file.php');
require_once('code/ie_detect.php');
@@
-13,18
+14,23
@@
function css_mangler() {
$file = substr($file, 1);
$file = substr($file, 1);
+ # links like style_77.css will return style.css
+
+ # This feature is used as part of a strategy to make sure that the css
+ # file is not cached longer than the html. Also I can shorten loading times
+ # by allowing caching forever.
+
$file = ereg_replace('_[0-9]*[.]css', '.css', $file);
$file = ereg_replace('_[0-9]*[.]css', '.css', $file);
- $mtime = filemtime($file);
- if($mtime === false) {
+ if(!file_exists($file)) {
+ header('HTTP/1.0 404 File Not Found');
header('Content-Type: text/plain');
header('Content-Type: text/plain');
- print("cannot stat $file");
+ print("File \"$file\" not found.");
return;
}
header('Content-Type: text/css');
return;
}
header('Content-Type: text/css');
- header('Last-Modified: '.gmdate('D, d M Y H:i:s', $mtime) . ' GMT');
- header('Last-Modified: '.gmdate('D, d M Y H:i:s', $mtime) . ' GMT');
+ http_cache_forever('private'); # serves different content for old IE versions, so no sharing the cache
if(ie5or6()) {
echo(ereg_replace("\n[^\n]*remove this line for IE 5.5 and 6[^\n]*\n", "\n", read_whole_file($file)));
if(ie5or6()) {
echo(ereg_replace("\n[^\n]*remove this line for IE 5.5 and 6[^\n]*\n", "\n", read_whole_file($file)));