|
Revision 1020, 1.0 kB
(checked in by sven, 2 years ago)
|
add expires header to CSS
|
- Property svn:eol-style set to
native
|
| Line | |
|---|
| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
require_once(dirname(dirname(__FILE__))."/includes.php"); |
|---|
| 4 |
|
|---|
| 5 |
header("Content-type: text/css; charset=utf-8"); |
|---|
| 6 |
|
|---|
| 7 |
$template_id = optional_param('template'); |
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
$template_name = $template_id; |
|---|
| 11 |
|
|---|
| 12 |
$css = templates_draw(array( |
|---|
| 13 |
'template' => $template_id, |
|---|
| 14 |
'context' => 'css' |
|---|
| 15 |
) |
|---|
| 16 |
); |
|---|
| 17 |
|
|---|
| 18 |
$etag = md5($css); |
|---|
| 19 |
|
|---|
| 20 |
header('Cache-Control: public'); |
|---|
| 21 |
header('Pragma: '); |
|---|
| 22 |
|
|---|
| 23 |
header('Expires: ' . gmdate("D, d M Y H:i:s", (time()+3600)) . " GMT"); |
|---|
| 24 |
header('ETag: ' . $etag . ''); |
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
if (array_key_exists('HTTP_IF_NONE_MATCH',$_SERVER)) { |
|---|
| 28 |
$if_none_match = preg_replace('/;.*$/', '', $_SERVER['HTTP_IF_NONE_MATCH']); |
|---|
| 29 |
if ($if_none_match == $etag) { |
|---|
| 30 |
header("{$_SERVER['SERVER_PROTOCOL']} 304 Not Modified"); |
|---|
| 31 |
exit; |
|---|
| 32 |
} |
|---|
| 33 |
} |
|---|
| 34 |
|
|---|
| 35 |
echo $css; |
|---|
| 36 |
|
|---|
| 37 |
?> |
|---|