Version Description
Download this release
Release Info
Developer | satollo |
Plugin | Hyper Cache |
Version | 2.3.3 |
Comparing to | |
See all releases |
Code changes from version 2.2.5 to 2.3.3
- advanced-cache.php +96 -75
- hyper-cache-cron.php +33 -0
- by_BY.php → languages/by_BY.php +0 -0
- de_DE.php → languages/de_DE.php +0 -0
- en_US.php → languages/en_US.php +7 -1
- fr_FR.php → languages/fr_FR.php +0 -0
- it_IT.php → languages/it_IT.php +0 -0
- ru_RU.php → languages/ru_RU.php +0 -0
- zh_CN.php → languages/zh_CN.php +0 -0
- options.php +42 -3
- plugin.php +4 -4
- readme.txt +8 -5
advanced-cache.php
CHANGED
@@ -4,6 +4,9 @@
|
|
4 |
// From the config file
|
5 |
if (!$hyper_cache_enabled) return false;
|
6 |
|
|
|
|
|
|
|
7 |
// Do not cache post request (comments, plugins and so on)
|
8 |
if ($_SERVER["REQUEST_METHOD"] == 'POST') return false;
|
9 |
|
@@ -13,13 +16,14 @@ if (defined(SID) && SID != '') return false;
|
|
13 |
$hyper_uri = $_SERVER['REQUEST_URI'];
|
14 |
|
15 |
if ($hyper_cache_urls == 'default' && strpos($hyper_uri, '?') !== false) return false;
|
|
|
16 |
|
17 |
// Checks for rejected url
|
18 |
if ($hyper_cache_reject)
|
19 |
{
|
20 |
foreach($hyper_cache_reject as $uri)
|
21 |
{
|
22 |
-
if (substr($uri, 0, 1) == '"')
|
23 |
{
|
24 |
if ($uri == '"' . $hyper_uri . '"') return false;
|
25 |
}
|
@@ -36,18 +40,33 @@ if (count($hyper_cache_reject_agents) > 0)
|
|
36 |
}
|
37 |
}
|
38 |
|
|
|
|
|
|
|
39 |
// Do not use or cache pages when a wordpress user is logged on
|
40 |
foreach ($_COOKIE as $n=>$v)
|
41 |
{
|
42 |
// SHIT!!! This test cookie makes to cache not work!!!
|
43 |
if ($n == 'wordpress_test_cookie') continue;
|
44 |
// wp 2.5 and wp 2.3 have different cookie prefix, skip cache if a post password cookie is present, also
|
45 |
-
if (substr($n, 0, 14) == 'wordpressuser_' || substr($n, 0, 10) == 'wordpress_' || substr($n, 0, 12) == 'wp-postpass_')
|
46 |
{
|
47 |
return false;
|
48 |
}
|
49 |
}
|
50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
// Do not cache WP pages, even if those calls typically don't go throught this script
|
52 |
if (strpos($hyper_uri, '/wp-admin/') !== false || strpos($hyper_uri, '/wp-includes/') !== false || strpos($hyper_uri, '/wp-content/') !== false )
|
53 |
{
|
@@ -68,7 +87,7 @@ if (is_file($hyper_file))
|
|
68 |
// Load it and check is it's still valid
|
69 |
$hyper_data = unserialize(file_get_contents($hyper_file));
|
70 |
|
71 |
-
// Protect against broken cache files
|
72 |
if ($hyper_data != null)
|
73 |
{
|
74 |
|
@@ -78,13 +97,13 @@ if (is_file($hyper_file))
|
|
78 |
flush;
|
79 |
die();
|
80 |
}
|
81 |
-
|
82 |
if ($hyper_data['status'] == 404)
|
83 |
{
|
84 |
header("HTTP/1.1 404 Not Found");
|
85 |
$hyper_data = unserialize(file_get_contents(ABSPATH . 'wp-content/hyper-cache/404.dat'));
|
86 |
}
|
87 |
-
|
88 |
if (array_key_exists("HTTP_IF_MODIFIED_SINCE", $_SERVER))
|
89 |
{
|
90 |
$if_modified_since = strtotime(preg_replace('/;.*$/', '', $_SERVER["HTTP_IF_MODIFIED_SINCE"]));
|
@@ -98,25 +117,25 @@ if (is_file($hyper_file))
|
|
98 |
|
99 |
|
100 |
header('Last-Modified: ' . date("r", filectime($hyper_file)));
|
101 |
-
|
102 |
header('Content-Type: ' . $hyper_data['mime']);
|
103 |
-
|
104 |
// Send the cached html
|
105 |
if ($hyper_cache_gzip && strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false && strlen($hyper_data['gz']) > 0)
|
106 |
{
|
107 |
-
|
108 |
-
|
109 |
}
|
110 |
-
else
|
111 |
{
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
}
|
121 |
flush();
|
122 |
hyper_cache_clean();
|
@@ -129,7 +148,7 @@ if (is_file($hyper_file))
|
|
129 |
// with a pre compiled comment form...
|
130 |
foreach ($_COOKIE as $n=>$v )
|
131 |
{
|
132 |
-
if (substr($n, 0, 14) == 'comment_author')
|
133 |
{
|
134 |
unset($_COOKIE[$n]);
|
135 |
}
|
@@ -142,56 +161,58 @@ ob_start('hyper_cache_callback');
|
|
142 |
// Called whenever the page generation is ended
|
143 |
function hyper_cache_callback($buffer)
|
144 |
{
|
145 |
-
global $hyper_cache_charset, $hyper_cache_home, $hyper_cache_redirects, $hyper_redirect, $hyper_file, $hyper_cache_compress, $hyper_cache_name, $hyper_cache_gzip;
|
|
|
|
|
146 |
|
147 |
// WP is sending a redirect
|
148 |
if ($hyper_redirect)
|
149 |
{
|
150 |
if ($hyper_cache_redirects)
|
151 |
{
|
152 |
-
$data['location'] = $hyper_redirect;
|
153 |
hyper_cache_write($data);
|
154 |
-
}
|
155 |
return $buffer;
|
156 |
}
|
157 |
-
|
158 |
-
if (is_home() && $hyper_cache_home)
|
159 |
{
|
160 |
return $buffer;
|
161 |
}
|
162 |
-
|
163 |
-
if (is_feed() && !$hyper_cache_feed)
|
164 |
{
|
165 |
return $buffer;
|
166 |
}
|
167 |
-
|
168 |
$buffer = trim($buffer);
|
169 |
-
|
170 |
// Can be a trackback or other things without a body. We do not cache them, WP needs to get those calls.
|
171 |
if (strlen($buffer) == 0) return '';
|
172 |
-
|
173 |
if (!$hyper_cache_charset) $hyper_cache_charset = 'UTF-8';
|
174 |
-
|
175 |
-
if (is_feed())
|
176 |
{
|
177 |
$data['mime'] = 'text/xml;charset=' . $hyper_cache_charset;
|
178 |
-
}
|
179 |
-
else
|
180 |
{
|
181 |
$data['mime'] = 'text/html;charset=' . $hyper_cache_charset;
|
182 |
}
|
183 |
-
|
184 |
// Clean up a it the html, this is a energy saver plugin!
|
185 |
if ($hyper_cache_compress)
|
186 |
{
|
187 |
$buffer = hyper_cache_compress($buffer);
|
188 |
}
|
189 |
-
|
190 |
-
$buffer .= '<!-- hyper cache: ' . $hyper_cache_name . ' -->';
|
191 |
-
|
192 |
$data['html'] = $buffer;
|
193 |
-
|
194 |
-
if ($hyper_cache_gzip && function_exists('gzencode'))
|
195 |
{
|
196 |
$data['gz'] = gzencode($buffer);
|
197 |
}
|
@@ -202,13 +223,13 @@ function hyper_cache_callback($buffer)
|
|
202 |
{
|
203 |
$file = fopen(ABSPATH . 'wp-content/hyper-cache/404.dat', 'w');
|
204 |
fwrite($file, serialize($data));
|
205 |
-
fclose($file);
|
206 |
}
|
207 |
unset($data['html']);
|
208 |
unset($data['gz']);
|
209 |
$data['status'] = 404;
|
210 |
}
|
211 |
-
|
212 |
hyper_cache_write($data);
|
213 |
|
214 |
return $buffer;
|
@@ -217,21 +238,21 @@ function hyper_cache_callback($buffer)
|
|
217 |
function hyper_cache_write(&$data)
|
218 |
{
|
219 |
global $hyper_file, $hyper_cache_storage;
|
220 |
-
|
221 |
$data['uri'] = $_SERVER['REQUEST_URI'];
|
222 |
$data['referer'] = $_SERVER['HTTP_REFERER'];
|
223 |
-
$data['time'] = time();
|
224 |
$data['host'] = $_SERVER['HTTP_HOST'];
|
225 |
$data['agent'] = $_SERVER['HTTP_USER_AGENT'];
|
226 |
-
|
227 |
if ($hyper_cache_storage == 'minimize')
|
228 |
{
|
229 |
unset($data['html']);
|
230 |
}
|
231 |
-
|
232 |
$file = fopen($hyper_file, 'w');
|
233 |
fwrite($file, serialize($data));
|
234 |
-
fclose($file);
|
235 |
|
236 |
header('Last-Modified: ' . date("r", filectime($hyper_file)));
|
237 |
|
@@ -251,7 +272,7 @@ function hyper_cache_compress(&$buffer)
|
|
251 |
$buffer = ereg_replace("<p>\n", "<p>", $buffer);
|
252 |
$buffer = ereg_replace("</p>\n", "</p>", $buffer);
|
253 |
$buffer = ereg_replace("</li>\n", "</li>", $buffer);
|
254 |
-
$buffer = ereg_replace("</td>\n", "</td>", $buffer);
|
255 |
|
256 |
return $buffer;
|
257 |
}
|
@@ -260,9 +281,9 @@ function hyper_cache_compress(&$buffer)
|
|
260 |
function hyper_mobile_type()
|
261 |
{
|
262 |
global $hyper_cache_mobile, $hyper_cache_mobile_agents;
|
263 |
-
|
264 |
if (!$hyper_cache_mobile || !$hyper_cache_mobile_agents) return '';
|
265 |
-
|
266 |
$hyper_agent = strtolower($_SERVER['HTTP_USER_AGENT']);
|
267 |
//$hyper_agents = explode(',', "elaine/3.0,iphone,ipod,palm,eudoraweb,blazer,avantgo,windows ce,cellphone,small,mmef20,danger,hiptop,proxinet,newt,palmos,netfront,sharp-tq-gx10,sonyericsson,symbianos,up.browser,up.link,ts21i-10,mot-v,portalmmm,docomo,opera mini,palm,handspring,nokia,kyocera,samsung,motorola,mot,smartphone,blackberry,wap,playstation portable,lg,mmp,opwv,symbian,epoc");
|
268 |
foreach ($hyper_cache_mobile_agents as $hyper_a)
|
@@ -288,56 +309,56 @@ function hyper_cache_clean()
|
|
288 |
|
289 |
if (!$hyper_cache_clean_interval) return;
|
290 |
if (rand(1, 10) != 5) return;
|
291 |
-
|
292 |
$time = time();
|
293 |
$file = ABSPATH . 'wp-content/hyper-cache/last-clean.dat';
|
294 |
if (file_exists($file) && ($time - filectime($file) < $hyper_cache_clean_interval*60)) return;
|
295 |
-
|
296 |
touch(ABSPATH . 'wp-content/hyper-cache/last-clean.dat');
|
297 |
-
|
298 |
$path = ABSPATH . 'wp-content/hyper-cache';
|
299 |
-
if ($handle = @opendir($path))
|
300 |
{
|
301 |
-
while ($file = readdir($handle))
|
302 |
{
|
303 |
if ($file == '.' || $file == '..') continue;
|
304 |
-
|
305 |
$t = filectime($path . '/' . $file);
|
306 |
if ($time - $t > $hyper_cache_timeout) @unlink($path . '/' . $file);
|
307 |
}
|
308 |
-
closedir($handle);
|
309 |
}
|
310 |
}
|
311 |
|
312 |
if (!function_exists('gzdecode'))
|
313 |
{
|
314 |
-
|
315 |
{
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
|
329 |
-
|
330 |
-
|
331 |
|
332 |
-
|
333 |
-
|
334 |
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
|
339 |
$unpacked = $data;
|
340 |
-
|
341 |
}
|
342 |
}
|
343 |
|
4 |
// From the config file
|
5 |
if (!$hyper_cache_enabled) return false;
|
6 |
|
7 |
+
global $hyper_cache_stop;
|
8 |
+
$hyper_cache_stop = false;
|
9 |
+
|
10 |
// Do not cache post request (comments, plugins and so on)
|
11 |
if ($_SERVER["REQUEST_METHOD"] == 'POST') return false;
|
12 |
|
16 |
$hyper_uri = $_SERVER['REQUEST_URI'];
|
17 |
|
18 |
if ($hyper_cache_urls == 'default' && strpos($hyper_uri, '?') !== false) return false;
|
19 |
+
if (strpos($hyper_uri, 'robots.txt') !== false) return false;
|
20 |
|
21 |
// Checks for rejected url
|
22 |
if ($hyper_cache_reject)
|
23 |
{
|
24 |
foreach($hyper_cache_reject as $uri)
|
25 |
{
|
26 |
+
if (substr($uri, 0, 1) == '"')
|
27 |
{
|
28 |
if ($uri == '"' . $hyper_uri . '"') return false;
|
29 |
}
|
40 |
}
|
41 |
}
|
42 |
|
43 |
+
|
44 |
+
|
45 |
+
|
46 |
// Do not use or cache pages when a wordpress user is logged on
|
47 |
foreach ($_COOKIE as $n=>$v)
|
48 |
{
|
49 |
// SHIT!!! This test cookie makes to cache not work!!!
|
50 |
if ($n == 'wordpress_test_cookie') continue;
|
51 |
// wp 2.5 and wp 2.3 have different cookie prefix, skip cache if a post password cookie is present, also
|
52 |
+
if (substr($n, 0, 14) == 'wordpressuser_' || substr($n, 0, 10) == 'wordpress_' || substr($n, 0, 12) == 'wp-postpass_')
|
53 |
{
|
54 |
return false;
|
55 |
}
|
56 |
}
|
57 |
|
58 |
+
// Do nestes cycles in this order, usually no cookies are specified
|
59 |
+
if (count($hyper_cache_reject_cookies) > 0)
|
60 |
+
{
|
61 |
+
foreach ($hyper_cache_reject_cookies as $hyper_c)
|
62 |
+
{
|
63 |
+
foreach ($_COOKIE as $n=>$v)
|
64 |
+
{
|
65 |
+
if (substr($n, 0, strlen($hyper_c)) == $hyper_c) return false;
|
66 |
+
}
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
// Do not cache WP pages, even if those calls typically don't go throught this script
|
71 |
if (strpos($hyper_uri, '/wp-admin/') !== false || strpos($hyper_uri, '/wp-includes/') !== false || strpos($hyper_uri, '/wp-content/') !== false )
|
72 |
{
|
87 |
// Load it and check is it's still valid
|
88 |
$hyper_data = unserialize(file_get_contents($hyper_file));
|
89 |
|
90 |
+
// Protect against broken cache files
|
91 |
if ($hyper_data != null)
|
92 |
{
|
93 |
|
97 |
flush;
|
98 |
die();
|
99 |
}
|
100 |
+
|
101 |
if ($hyper_data['status'] == 404)
|
102 |
{
|
103 |
header("HTTP/1.1 404 Not Found");
|
104 |
$hyper_data = unserialize(file_get_contents(ABSPATH . 'wp-content/hyper-cache/404.dat'));
|
105 |
}
|
106 |
+
|
107 |
if (array_key_exists("HTTP_IF_MODIFIED_SINCE", $_SERVER))
|
108 |
{
|
109 |
$if_modified_since = strtotime(preg_replace('/;.*$/', '', $_SERVER["HTTP_IF_MODIFIED_SINCE"]));
|
117 |
|
118 |
|
119 |
header('Last-Modified: ' . date("r", filectime($hyper_file)));
|
120 |
+
|
121 |
header('Content-Type: ' . $hyper_data['mime']);
|
122 |
+
|
123 |
// Send the cached html
|
124 |
if ($hyper_cache_gzip && strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false && strlen($hyper_data['gz']) > 0)
|
125 |
{
|
126 |
+
header('Content-Encoding: gzip');
|
127 |
+
echo $hyper_data['gz'];
|
128 |
}
|
129 |
+
else
|
130 |
{
|
131 |
+
if (strlen($hyper_data['html']) > 0)
|
132 |
+
{
|
133 |
+
echo $hyper_data['html'];
|
134 |
+
}
|
135 |
+
else
|
136 |
+
{
|
137 |
+
echo gzdecode($hyper_data['gz']);
|
138 |
+
}
|
139 |
}
|
140 |
flush();
|
141 |
hyper_cache_clean();
|
148 |
// with a pre compiled comment form...
|
149 |
foreach ($_COOKIE as $n=>$v )
|
150 |
{
|
151 |
+
if (substr($n, 0, 14) == 'comment_author')
|
152 |
{
|
153 |
unset($_COOKIE[$n]);
|
154 |
}
|
161 |
// Called whenever the page generation is ended
|
162 |
function hyper_cache_callback($buffer)
|
163 |
{
|
164 |
+
global $hyper_cache_stop, $hyper_cache_charset, $hyper_cache_home, $hyper_cache_redirects, $hyper_redirect, $hyper_file, $hyper_cache_compress, $hyper_cache_name, $hyper_cache_gzip;
|
165 |
+
|
166 |
+
if ($hyper_cache_stop) return $buffer;
|
167 |
|
168 |
// WP is sending a redirect
|
169 |
if ($hyper_redirect)
|
170 |
{
|
171 |
if ($hyper_cache_redirects)
|
172 |
{
|
173 |
+
$data['location'] = $hyper_redirect;
|
174 |
hyper_cache_write($data);
|
175 |
+
}
|
176 |
return $buffer;
|
177 |
}
|
178 |
+
|
179 |
+
if (is_home() && $hyper_cache_home)
|
180 |
{
|
181 |
return $buffer;
|
182 |
}
|
183 |
+
|
184 |
+
if (is_feed() && !$hyper_cache_feed)
|
185 |
{
|
186 |
return $buffer;
|
187 |
}
|
188 |
+
|
189 |
$buffer = trim($buffer);
|
190 |
+
|
191 |
// Can be a trackback or other things without a body. We do not cache them, WP needs to get those calls.
|
192 |
if (strlen($buffer) == 0) return '';
|
193 |
+
|
194 |
if (!$hyper_cache_charset) $hyper_cache_charset = 'UTF-8';
|
195 |
+
|
196 |
+
if (is_feed())
|
197 |
{
|
198 |
$data['mime'] = 'text/xml;charset=' . $hyper_cache_charset;
|
199 |
+
}
|
200 |
+
else
|
201 |
{
|
202 |
$data['mime'] = 'text/html;charset=' . $hyper_cache_charset;
|
203 |
}
|
204 |
+
|
205 |
// Clean up a it the html, this is a energy saver plugin!
|
206 |
if ($hyper_cache_compress)
|
207 |
{
|
208 |
$buffer = hyper_cache_compress($buffer);
|
209 |
}
|
210 |
+
|
211 |
+
$buffer .= '<!-- hyper cache: ' . $hyper_cache_name . ' -->';
|
212 |
+
|
213 |
$data['html'] = $buffer;
|
214 |
+
|
215 |
+
if ($hyper_cache_gzip && function_exists('gzencode'))
|
216 |
{
|
217 |
$data['gz'] = gzencode($buffer);
|
218 |
}
|
223 |
{
|
224 |
$file = fopen(ABSPATH . 'wp-content/hyper-cache/404.dat', 'w');
|
225 |
fwrite($file, serialize($data));
|
226 |
+
fclose($file);
|
227 |
}
|
228 |
unset($data['html']);
|
229 |
unset($data['gz']);
|
230 |
$data['status'] = 404;
|
231 |
}
|
232 |
+
|
233 |
hyper_cache_write($data);
|
234 |
|
235 |
return $buffer;
|
238 |
function hyper_cache_write(&$data)
|
239 |
{
|
240 |
global $hyper_file, $hyper_cache_storage;
|
241 |
+
|
242 |
$data['uri'] = $_SERVER['REQUEST_URI'];
|
243 |
$data['referer'] = $_SERVER['HTTP_REFERER'];
|
244 |
+
$data['time'] = time();
|
245 |
$data['host'] = $_SERVER['HTTP_HOST'];
|
246 |
$data['agent'] = $_SERVER['HTTP_USER_AGENT'];
|
247 |
+
|
248 |
if ($hyper_cache_storage == 'minimize')
|
249 |
{
|
250 |
unset($data['html']);
|
251 |
}
|
252 |
+
|
253 |
$file = fopen($hyper_file, 'w');
|
254 |
fwrite($file, serialize($data));
|
255 |
+
fclose($file);
|
256 |
|
257 |
header('Last-Modified: ' . date("r", filectime($hyper_file)));
|
258 |
|
272 |
$buffer = ereg_replace("<p>\n", "<p>", $buffer);
|
273 |
$buffer = ereg_replace("</p>\n", "</p>", $buffer);
|
274 |
$buffer = ereg_replace("</li>\n", "</li>", $buffer);
|
275 |
+
$buffer = ereg_replace("</td>\n", "</td>", $buffer);
|
276 |
|
277 |
return $buffer;
|
278 |
}
|
281 |
function hyper_mobile_type()
|
282 |
{
|
283 |
global $hyper_cache_mobile, $hyper_cache_mobile_agents;
|
284 |
+
|
285 |
if (!$hyper_cache_mobile || !$hyper_cache_mobile_agents) return '';
|
286 |
+
|
287 |
$hyper_agent = strtolower($_SERVER['HTTP_USER_AGENT']);
|
288 |
//$hyper_agents = explode(',', "elaine/3.0,iphone,ipod,palm,eudoraweb,blazer,avantgo,windows ce,cellphone,small,mmef20,danger,hiptop,proxinet,newt,palmos,netfront,sharp-tq-gx10,sonyericsson,symbianos,up.browser,up.link,ts21i-10,mot-v,portalmmm,docomo,opera mini,palm,handspring,nokia,kyocera,samsung,motorola,mot,smartphone,blackberry,wap,playstation portable,lg,mmp,opwv,symbian,epoc");
|
289 |
foreach ($hyper_cache_mobile_agents as $hyper_a)
|
309 |
|
310 |
if (!$hyper_cache_clean_interval) return;
|
311 |
if (rand(1, 10) != 5) return;
|
312 |
+
|
313 |
$time = time();
|
314 |
$file = ABSPATH . 'wp-content/hyper-cache/last-clean.dat';
|
315 |
if (file_exists($file) && ($time - filectime($file) < $hyper_cache_clean_interval*60)) return;
|
316 |
+
|
317 |
touch(ABSPATH . 'wp-content/hyper-cache/last-clean.dat');
|
318 |
+
|
319 |
$path = ABSPATH . 'wp-content/hyper-cache';
|
320 |
+
if ($handle = @opendir($path))
|
321 |
{
|
322 |
+
while ($file = readdir($handle))
|
323 |
{
|
324 |
if ($file == '.' || $file == '..') continue;
|
325 |
+
|
326 |
$t = filectime($path . '/' . $file);
|
327 |
if ($time - $t > $hyper_cache_timeout) @unlink($path . '/' . $file);
|
328 |
}
|
329 |
+
closedir($handle);
|
330 |
}
|
331 |
}
|
332 |
|
333 |
if (!function_exists('gzdecode'))
|
334 |
{
|
335 |
+
function gzdecode ($data)
|
336 |
{
|
337 |
+
$flags = ord(substr($data, 3, 1));
|
338 |
+
$headerlen = 10;
|
339 |
+
$extralen = 0;
|
340 |
|
341 |
+
$filenamelen = 0;
|
342 |
+
if ($flags & 4) {
|
343 |
+
$extralen = unpack('v' ,substr($data, 10, 2));
|
344 |
|
345 |
+
$extralen = $extralen[1];
|
346 |
+
$headerlen += 2 + $extralen;
|
347 |
+
}
|
348 |
+
if ($flags & 8) // Filename
|
349 |
|
350 |
+
$headerlen = strpos($data, chr(0), $headerlen) + 1;
|
351 |
+
if ($flags & 16) // Comment
|
352 |
|
353 |
+
$headerlen = strpos($data, chr(0), $headerlen) + 1;
|
354 |
+
if ($flags & 2) // CRC at end of file
|
355 |
|
356 |
+
$headerlen += 2;
|
357 |
+
$unpacked = gzinflate(substr($data, $headerlen));
|
358 |
+
if ($unpacked === FALSE)
|
359 |
|
360 |
$unpacked = $data;
|
361 |
+
return $unpacked;
|
362 |
}
|
363 |
}
|
364 |
|
hyper-cache-cron.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
@include(dirname(__FILE__) . '/hyper-cache-config.php');
|
3 |
+
|
4 |
+
$action = $_GET['action'];
|
5 |
+
if (!$action || !$_GET['key'] || $_GET['key'] != $hyper_cache_cron_key)
|
6 |
+
{
|
7 |
+
sleep(3);
|
8 |
+
die('no valid call');
|
9 |
+
}
|
10 |
+
|
11 |
+
if ($action == 'invalidate')
|
12 |
+
{
|
13 |
+
$path = dirname(__FILE__) . '/hyper-cache';
|
14 |
+
if ($handle = @opendir($path))
|
15 |
+
{
|
16 |
+
while ($file = readdir($handle))
|
17 |
+
{
|
18 |
+
if ($file != '.' && $file != '..')
|
19 |
+
{
|
20 |
+
@unlink($path . '/' . $file);
|
21 |
+
}
|
22 |
+
}
|
23 |
+
closedir($handle);
|
24 |
+
}
|
25 |
+
else
|
26 |
+
{
|
27 |
+
die('ko');
|
28 |
+
}
|
29 |
+
die('ok');
|
30 |
+
}
|
31 |
+
|
32 |
+
die('unknown action');
|
33 |
+
?>
|
by_BY.php → languages/by_BY.php
RENAMED
File without changes
|
de_DE.php → languages/de_DE.php
RENAMED
File without changes
|
en_US.php → languages/en_US.php
RENAMED
@@ -27,6 +27,7 @@ $hyper_labels['expire_type_desc'] .= "<b>single pages strictly</b>: as 'single p
|
|
27 |
$hyper_labels['expire_type_desc'] .= "<b>all</b>: all the cached pages (the blog is always up to date)<br />";
|
28 |
$hyper_labels['expire_type_desc'] .= "Beware: when you use 'single pages strictly', a new post will appear on home page, but not on category and tag pages. If you use the 'last posts' widget/feature on sidebar it won't show updated.";
|
29 |
$hyper_labels['advanced_options'] = "Advanced options";
|
|
|
30 |
$hyper_labels['reject'] = "URI to reject";
|
31 |
$hyper_labels['reject_desc'] = "One per line. When a URI (eg. /video/my-new-performance) starts with one of the listed lines, it won't be cached.";
|
32 |
|
@@ -58,8 +59,13 @@ $hyper_labels['gzip_nogzencode_desc'] = "There is not 'gzencode' function, may b
|
|
58 |
|
59 |
// New from version 2.2.5
|
60 |
$hyper_labels['reject_agents'] = "User agents to reject";
|
61 |
-
$hyper_labels['reject_agents_desc'] = "A 'one per line' list of user agents that, when matched, makes to
|
62 |
$hyper_labels['mobile_agents'] = "Mobile user agents";
|
63 |
$hyper_labels['mobile_agents_desc'] = "A 'one per line' list of user agents to identify mobile devices.";
|
64 |
$hyper_labels['_notranslation'] = "Do not use translations for this configuration panel";
|
|
|
|
|
|
|
|
|
|
|
65 |
?>
|
27 |
$hyper_labels['expire_type_desc'] .= "<b>all</b>: all the cached pages (the blog is always up to date)<br />";
|
28 |
$hyper_labels['expire_type_desc'] .= "Beware: when you use 'single pages strictly', a new post will appear on home page, but not on category and tag pages. If you use the 'last posts' widget/feature on sidebar it won't show updated.";
|
29 |
$hyper_labels['advanced_options'] = "Advanced options";
|
30 |
+
|
31 |
$hyper_labels['reject'] = "URI to reject";
|
32 |
$hyper_labels['reject_desc'] = "One per line. When a URI (eg. /video/my-new-performance) starts with one of the listed lines, it won't be cached.";
|
33 |
|
59 |
|
60 |
// New from version 2.2.5
|
61 |
$hyper_labels['reject_agents'] = "User agents to reject";
|
62 |
+
$hyper_labels['reject_agents_desc'] = "A 'one per line' list of user agents that, when matched, makes to skip the caching process.";
|
63 |
$hyper_labels['mobile_agents'] = "Mobile user agents";
|
64 |
$hyper_labels['mobile_agents_desc'] = "A 'one per line' list of user agents to identify mobile devices.";
|
65 |
$hyper_labels['_notranslation'] = "Do not use translations for this configuration panel";
|
66 |
+
|
67 |
+
|
68 |
+
$hyper_labels['cron_key'] = "Cron action key";
|
69 |
+
$hyper_labels['cron_key_desc'] = "A complicate to guess key to start actions from cron calls (no single or double quotes, no spaces)";
|
70 |
+
|
71 |
?>
|
fr_FR.php → languages/fr_FR.php
RENAMED
File without changes
|
it_IT.php → languages/it_IT.php
RENAMED
File without changes
|
ru_RU.php → languages/ru_RU.php
RENAMED
File without changes
|
zh_CN.php → languages/zh_CN.php
RENAMED
File without changes
|
options.php
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
|
3 |
$options = get_option('hyper');
|
4 |
|
5 |
-
@include(
|
6 |
-
if (!$options['_notranslation'] && WPLANG != '') @include(
|
7 |
|
8 |
function hyper_request($name, $default=null)
|
9 |
{
|
@@ -92,6 +92,7 @@ if ($installed && isset($_POST['save']))
|
|
92 |
$buffer .= '$hyper_cache_enabled = ' . ($options['enabled']?'true':'false') . ";\n";
|
93 |
$buffer .= '$hyper_cache_compress = ' . ($options['compress']?'true':'false') . ";\n";
|
94 |
$buffer .= '$hyper_cache_timeout = ' . $options['timeout'] . ";\n";
|
|
|
95 |
$buffer .= '$hyper_cache_get = ' . ($options['get']?'true':'false') . ";\n";
|
96 |
$buffer .= '$hyper_cache_redirects = ' . ($options['redirects']?'true':'false') . ";\n";
|
97 |
$buffer .= '$hyper_cache_mobile = ' . ($options['mobile']?'true':'false') . ";\n";
|
@@ -143,9 +144,27 @@ if ($installed && isset($_POST['save']))
|
|
143 |
$buffer .= ");\n";
|
144 |
}
|
145 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
if (trim($options['mobile_agents']) != '')
|
147 |
{
|
148 |
-
$options['mobile_agents'] = str_replace('
|
149 |
$options['mobile_agents'] = str_replace("\r", "\n", $options['mobile_agents']);
|
150 |
$buffer .= '$hyper_cache_mobile_agents = array(';
|
151 |
$mobile_agents = explode("\n", $options['mobile_agents']);
|
@@ -207,6 +226,7 @@ if (!defined('WP_CACHE') ) {
|
|
207 |
?>
|
208 |
<p>To have more information about Hyper Cache read the <a href="http://www.satollo.com/english/wordpress/hyper-cache">official plugin page</a>
|
209 |
or write me to info@satollo.com.</p>
|
|
|
210 |
|
211 |
<p>Consider a <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2545483">DONATION</a> to support this plugin or
|
212 |
if it <strong>saved you a lot of money</strong> avoiding expensive hosting providers to sustain your blog traffic...</p>
|
@@ -354,6 +374,25 @@ if (!defined('WP_CACHE') ) {
|
|
354 |
<?php echo $hyper_labels['reject_agents_desc']; ?>
|
355 |
</td>
|
356 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
357 |
|
358 |
</table>
|
359 |
|
2 |
|
3 |
$options = get_option('hyper');
|
4 |
|
5 |
+
@include(dirname(__FILE__) . '/languages/en_US.php');
|
6 |
+
if (!$options['_notranslation'] && WPLANG != '') @include(dirname(__FILE__) . '/languages/' . WPLANG . '.php');
|
7 |
|
8 |
function hyper_request($name, $default=null)
|
9 |
{
|
92 |
$buffer .= '$hyper_cache_enabled = ' . ($options['enabled']?'true':'false') . ";\n";
|
93 |
$buffer .= '$hyper_cache_compress = ' . ($options['compress']?'true':'false') . ";\n";
|
94 |
$buffer .= '$hyper_cache_timeout = ' . $options['timeout'] . ";\n";
|
95 |
+
$buffer .= '$hyper_cache_cron_key = \'' . $options['cron_key'] . "';\n";
|
96 |
$buffer .= '$hyper_cache_get = ' . ($options['get']?'true':'false') . ";\n";
|
97 |
$buffer .= '$hyper_cache_redirects = ' . ($options['redirects']?'true':'false') . ";\n";
|
98 |
$buffer .= '$hyper_cache_mobile = ' . ($options['mobile']?'true':'false') . ";\n";
|
144 |
$buffer .= ");\n";
|
145 |
}
|
146 |
|
147 |
+
if (trim($options['reject_cookies']) != '')
|
148 |
+
{
|
149 |
+
$options['reject_cookies'] = str_replace(' ', "\n", $options['reject_cookies']);
|
150 |
+
$options['reject_cookies'] = str_replace("\r", "\n", $options['reject_cookies']);
|
151 |
+
$buffer .= '$hyper_cache_reject_cookies = array(';
|
152 |
+
$reject_cookies = explode("\n", $options['reject_cookies']);
|
153 |
+
$options['reject_cookies'] = '';
|
154 |
+
foreach ($reject_cookies as $c)
|
155 |
+
{
|
156 |
+
$c = trim($c);
|
157 |
+
if ($c == '') continue;
|
158 |
+
$buffer .= "\"" . addslashes(strtolower(trim($c))) . "\",";
|
159 |
+
$options['reject_cookies'] .= $c . "\n";
|
160 |
+
}
|
161 |
+
$buffer = rtrim($buffer, ',');
|
162 |
+
$buffer .= ");\n";
|
163 |
+
}
|
164 |
+
|
165 |
if (trim($options['mobile_agents']) != '')
|
166 |
{
|
167 |
+
$options['mobile_agents'] = str_replace(',', "\n", $options['mobile_agents']);
|
168 |
$options['mobile_agents'] = str_replace("\r", "\n", $options['mobile_agents']);
|
169 |
$buffer .= '$hyper_cache_mobile_agents = array(';
|
170 |
$mobile_agents = explode("\n", $options['mobile_agents']);
|
226 |
?>
|
227 |
<p>To have more information about Hyper Cache read the <a href="http://www.satollo.com/english/wordpress/hyper-cache">official plugin page</a>
|
228 |
or write me to info@satollo.com.</p>
|
229 |
+
|
230 |
|
231 |
<p>Consider a <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2545483">DONATION</a> to support this plugin or
|
232 |
if it <strong>saved you a lot of money</strong> avoiding expensive hosting providers to sustain your blog traffic...</p>
|
374 |
<?php echo $hyper_labels['reject_agents_desc']; ?>
|
375 |
</td>
|
376 |
</tr>
|
377 |
+
<tr valign="top">
|
378 |
+
<th scope="row"><label>Cookies that bypass Hyper Cache</label></th>
|
379 |
+
<td>
|
380 |
+
<textarea wrap="off" rows="5" cols="70" name="options[reject_cookies]"><?php echo htmlspecialchars($options['reject_cookies']); ?></textarea>
|
381 |
+
<br />
|
382 |
+
One per line insert cookie names that, if present, bypass the cache. The names specifies will
|
383 |
+
match if there is at least one cookie name <strong>starting</strong> with such name.
|
384 |
+
<?php if (defined('FBC_APP_KEY_OPTION')) { ?>
|
385 |
+
<br />
|
386 |
+
It seems you have <strong>Facebook Connect</strong> plugin installed. Add this cookie name to make it works
|
387 |
+
with Hyper Cache:<br />
|
388 |
+
<strong><?php echo get_option(FBC_APP_KEY_OPTION); ?>_user</strong>
|
389 |
+
<?php } ?>
|
390 |
+
|
391 |
+
</td>
|
392 |
+
</tr>
|
393 |
+
<tr valign="top">
|
394 |
+
<?php hyper_field_text('cron_key', $hyper_labels['cron_key'], $hyper_labels['cron_key_desc'], 'size="30"'); ?>
|
395 |
+
</tr>
|
396 |
|
397 |
</table>
|
398 |
|
plugin.php
CHANGED
@@ -1,15 +1,15 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Hyper Cache
|
4 |
-
Plugin URI: http://www.satollo.
|
5 |
Description: Hyper Cache is a features rich cache system WordPress. After an upgrade, DEACTIVATE, REACTIVATE and RECONFIGURE. ALWAYS!
|
6 |
-
Version: 2.2
|
7 |
Author: Satollo
|
8 |
-
Author URI: http://www.satollo.
|
9 |
Disclaimer: Use at your own risk. No warranty expressed or implied is provided.
|
10 |
|
11 |
---
|
12 |
-
Copyright 2008 Satollo (email : satollo
|
13 |
---
|
14 |
|
15 |
This program is free software; you can redistribute it and/or modify
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Hyper Cache
|
4 |
+
Plugin URI: http://www.satollo.net/plugins/hyper-cache
|
5 |
Description: Hyper Cache is a features rich cache system WordPress. After an upgrade, DEACTIVATE, REACTIVATE and RECONFIGURE. ALWAYS!
|
6 |
+
Version: 2.3.2
|
7 |
Author: Satollo
|
8 |
+
Author URI: http://www.satollo.net
|
9 |
Disclaimer: Use at your own risk. No warranty expressed or implied is provided.
|
10 |
|
11 |
---
|
12 |
+
Copyright 2008 Satollo (email : info@satollo.net)
|
13 |
---
|
14 |
|
15 |
This program is free software; you can redistribute it and/or modify
|
readme.txt
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
=== Hyper Cache ===
|
2 |
Tags: cache,chaching,speed,performance,super cache,wp cache
|
3 |
Requires at least: 2.1
|
4 |
-
Tested up to: 2.
|
5 |
-
Stable tag:
|
6 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2545483
|
7 |
Contributors: satollo,momo360modena
|
8 |
|
@@ -30,10 +30,12 @@ if you have issues to info@satollo.com.
|
|
30 |
|
31 |
**Check out my other plugins**:
|
32 |
|
33 |
-
* [
|
34 |
-
* [
|
35 |
* [Feed Layout](http://www.satollo.com/english/wordpress/feed-layout "Feed Layout WordPress plugin: the easy way to enrich your feed contents")
|
36 |
-
* [Dynatags](http://www.satollo.
|
|
|
|
|
37 |
|
38 |
Thanks to:
|
39 |
|
@@ -42,6 +44,7 @@ Thanks to:
|
|
42 |
* HypeScience, Martin Steldinger, Giorgio Guglielmino for test and bugs submissions
|
43 |
* Ishtiaq to ask me about compatibility with wp-pda
|
44 |
* Gene Steinberg to ask for an autoclean system
|
|
|
45 |
* many others I don't remember
|
46 |
|
47 |
== Installation ==
|
1 |
=== Hyper Cache ===
|
2 |
Tags: cache,chaching,speed,performance,super cache,wp cache
|
3 |
Requires at least: 2.1
|
4 |
+
Tested up to: 2.8.1
|
5 |
+
Stable tag: trunk
|
6 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2545483
|
7 |
Contributors: satollo,momo360modena
|
8 |
|
30 |
|
31 |
**Check out my other plugins**:
|
32 |
|
33 |
+
* [Post Layout](http://www.satollo.net/plugins/post-layout "Post Layout WordPress plugin: the easy way to enrich your posts")
|
34 |
+
* [Comment Notifier](http://www.satollo.net/plugins/comment-notifier "Keep your blog discussions on fire")
|
35 |
* [Feed Layout](http://www.satollo.com/english/wordpress/feed-layout "Feed Layout WordPress plugin: the easy way to enrich your feed contents")
|
36 |
+
* [Dynatags](http://www.satollo.net/plugins/dynatags "Dynatags WordPress plugin: Create your own custom short tag in seconds")
|
37 |
+
* [Header and Footer](http://www.satollo.net/plugins/header-footer)
|
38 |
+
* [Newsletter](http://www.satollo.net/plugins/newsletter)
|
39 |
|
40 |
Thanks to:
|
41 |
|
44 |
* HypeScience, Martin Steldinger, Giorgio Guglielmino for test and bugs submissions
|
45 |
* Ishtiaq to ask me about compatibility with wp-pda
|
46 |
* Gene Steinberg to ask for an autoclean system
|
47 |
+
* Marcis Gasun (fatcow.com) for Bielorussian translation
|
48 |
* many others I don't remember
|
49 |
|
50 |
== Installation ==
|