PluginProbe
Autoptimize / 1.2
Autoptimize v1.2
2.2.2 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.5.0 2.5.1 2.6.0 2.6.1 2.6.2 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 All 107 releases
← All changes | config/default.php +11 -27 2.2.21.2 View file →
@@ -32,33 +32,17 @@
32 32
33 33 //Get data
34 34 $contents = file_get_contents(__FILE__.'.'.$encoding);
35 35
36 -// first check if we have to send 304
37 -$eTag=md5($contents);
38 -$modTime=filemtime(__FILE__.'.none');
36 +if(isset($encoding) && $encoding != 'none')
37 +{
38 + // Send compressed contents
39 + header('Content-Encoding: '.$encoding);
40 +}
41 +header('Vary: Accept-Encoding');
42 +header('Content-Length: '.strlen($contents));
39 43
40 -$eTagMatch = (isset($_SERVER['HTTP_IF_NONE_MATCH']) && strpos($_SERVER['HTTP_IF_NONE_MATCH'],$eTag));
41 -$modTimeMatch = (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) === $modTime);
44 +header('Content-type: %%CONTENT%%; charset=utf-8');
45 +header('Cache-Control: max-age=315360000, public, must-revalidate');
46 +header('Expires: '.gmdate('D, d M Y H:i:s', time() + 315360000).' GMT'); //10 years
42 47
43 -if (($modTimeMatch)||($eTagMatch)) {
44 - header('HTTP/1.1 304 Not Modified');
45 - header('Connection: close');
46 -} else {
47 - // send all sorts of headers
48 - $expireTime=60*60*24*356; // 1y max according to RFC
49 -
50 - if(isset($encoding) && $encoding != 'none')
51 - {
52 - header('Content-Encoding: '.$encoding);
53 - }
54 - header('Vary: Accept-Encoding');
55 - header('Content-Length: '.strlen($contents));
56 - header('Content-type: %%CONTENT%%; charset=utf-8');
57 - header('Cache-Control: max-age='.$expireTime.', public, immutable');
58 - header('Expires: '.gmdate('D, d M Y H:i:s', time() + $expireTime).' GMT'); //10 years
59 - header('ETag: ' . $eTag);
60 - header('Last-Modified: '.gmdate('D, d M Y H:i:s', $modTime).' GMT');
61 -
62 - // send output
63 - echo $contents;
64 -}
48 +echo $contents;