Version Description
- to exclude urls on preload
- to add exclude rule for admin cookie as default
- to prevent replace urls with cdn-url if the url has already been replaced with Jetpack
- to fix replacing origin-url with cdn-url for data-product_variations attribute
- to fix "Database Syntax Error" [Details]
- refactoring of read_file()
Download this release
Release Info
Developer | emrevona |
Plugin | WP Fastest Cache |
Version | 0.8.9.3 |
Comparing to | |
See all releases |
Code changes from version 0.8.9.2 to 0.8.9.3
- inc/admin.php +21 -1
- inc/cache.php +1 -1
- inc/preload.php +66 -18
- readme.txt +10 -2
- templates/exclude.php +8 -4
- wpFastestCache.php +20 -4
inc/admin.php
CHANGED
@@ -1303,10 +1303,16 @@
|
|
1303 |
<?php }else{ ?>
|
1304 |
<div class="questionCon update-needed">
|
1305 |
<div class="question">Lazy Load</div>
|
1306 |
-
<div class="inputCon"><input type="checkbox" id="wpFastestCacheLazyLoad" name="wpFastestCacheLazyLoad"><label for="wpFastestCacheLazyLoad">
|
1307 |
<div class="get-info"><a target="_blank" href="http://www.wpfastestcache.com/premium/lazy-load-reduce-http-request-and-page-load-time/"><img src="<?php echo plugins_url("wp-fastest-cache/images/info.png"); ?>" /></a></div>
|
1308 |
</div>
|
1309 |
<?php } ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
1310 |
<?php } ?>
|
1311 |
|
1312 |
|
@@ -2216,6 +2222,12 @@
|
|
2216 |
|
2217 |
<script type="text/javascript">
|
2218 |
jQuery("div.questionCon.disabled").click(function(e){
|
|
|
|
|
|
|
|
|
|
|
|
|
2219 |
if(typeof window.wpfc.tooltip != "undefined"){
|
2220 |
clearTimeout(window.wpfc.tooltip);
|
2221 |
}
|
@@ -2271,6 +2283,14 @@
|
|
2271 |
jQuery(this).attr('checked', true);
|
2272 |
}
|
2273 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2274 |
});
|
2275 |
</script>
|
2276 |
<script>
|
1303 |
<?php }else{ ?>
|
1304 |
<div class="questionCon update-needed">
|
1305 |
<div class="question">Lazy Load</div>
|
1306 |
+
<div class="inputCon"><input type="checkbox" id="wpFastestCacheLazyLoad" name="wpFastestCacheLazyLoad"><label for="wpFastestCacheLazyLoad">Load images and iframes when they enter the browsers viewport</label></div>
|
1307 |
<div class="get-info"><a target="_blank" href="http://www.wpfastestcache.com/premium/lazy-load-reduce-http-request-and-page-load-time/"><img src="<?php echo plugins_url("wp-fastest-cache/images/info.png"); ?>" /></a></div>
|
1308 |
</div>
|
1309 |
<?php } ?>
|
1310 |
+
<?php }else{ ?>
|
1311 |
+
<div class="questionCon disabled">
|
1312 |
+
<div class="question">Lazy Load</div>
|
1313 |
+
<div class="inputCon"><input type="checkbox" id="wpFastestCacheLazyLoad" name="wpFastestCacheLazyLoad"><label for="wpFastestCacheLazyLoad">Load images and iframes when they enter the browsers viewport</label></div>
|
1314 |
+
<div class="get-info"><a target="_blank" href="http://www.wpfastestcache.com/premium/lazy-load-reduce-http-request-and-page-load-time/"><img src="<?php echo plugins_url("wp-fastest-cache/images/info.png"); ?>" /></a></div>
|
1315 |
+
</div>
|
1316 |
<?php } ?>
|
1317 |
|
1318 |
|
2222 |
|
2223 |
<script type="text/javascript">
|
2224 |
jQuery("div.questionCon.disabled").click(function(e){
|
2225 |
+
if(e.target.tagName == "IMG"){
|
2226 |
+
if(e.target.src.match(/info\.png/)){
|
2227 |
+
return;
|
2228 |
+
}
|
2229 |
+
}
|
2230 |
+
|
2231 |
if(typeof window.wpfc.tooltip != "undefined"){
|
2232 |
clearTimeout(window.wpfc.tooltip);
|
2233 |
}
|
2283 |
jQuery(this).attr('checked', true);
|
2284 |
}
|
2285 |
});
|
2286 |
+
|
2287 |
+
//if "Lazy Load" has been selected both "Mobile" and "Mobile Theme" options enabled
|
2288 |
+
jQuery("#wpFastestCacheLazyLoad").click(function(e){
|
2289 |
+
if(jQuery(this).is(':checked')){
|
2290 |
+
jQuery("#wpFastestCacheMobile").attr('checked', true);
|
2291 |
+
jQuery("#wpFastestCacheMobileTheme").attr('checked', true);
|
2292 |
+
}
|
2293 |
+
});
|
2294 |
});
|
2295 |
</script>
|
2296 |
<script>
|
inc/cache.php
CHANGED
@@ -449,7 +449,7 @@
|
|
449 |
//"\/product"
|
450 |
//"\/product-category"
|
451 |
|
452 |
-
array_push($list, "\/cart", "\/checkout", "\/receipt", "\/confirmation", "\/wc-api\/");
|
453 |
}
|
454 |
}
|
455 |
|
449 |
//"\/product"
|
450 |
//"\/product-category"
|
451 |
|
452 |
+
array_push($list, "\/cart\/?$", "\/checkout", "\/receipt", "\/confirmation", "\/wc-api\/");
|
453 |
}
|
454 |
}
|
455 |
|
inc/preload.php
CHANGED
@@ -1,5 +1,7 @@
|
|
1 |
<?php
|
2 |
class PreloadWPFC{
|
|
|
|
|
3 |
public static function set_preload($slug){
|
4 |
$preload_arr = array();
|
5 |
|
@@ -120,25 +122,25 @@
|
|
120 |
|
121 |
if($where_query){
|
122 |
$where_query = preg_replace("/(\s*OR\s*)$/", "", $where_query);
|
123 |
-
|
|
|
124 |
|
125 |
-
|
|
|
|
|
|
|
|
|
|
|
126 |
|
127 |
-
|
128 |
-
foreach ($recent_custom_posts as $key => $post) {
|
129 |
-
if($mobile_theme){
|
130 |
-
array_push($urls, array("url" => get_permalink($post["ID"]), "user-agent" => "mobile"));
|
131 |
$number--;
|
132 |
-
}
|
133 |
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
$pre_load->customposttypes = -1;
|
141 |
-
}
|
142 |
}
|
143 |
|
144 |
|
@@ -313,12 +315,20 @@
|
|
313 |
$user_agent = "WP Fastest Cache Preload iPhone Mobile Bot";
|
314 |
}
|
315 |
|
316 |
-
|
317 |
-
|
|
|
318 |
}else{
|
319 |
-
$
|
|
|
|
|
|
|
|
|
320 |
}
|
321 |
|
|
|
|
|
|
|
322 |
echo $status." ".$arr["url"]." (".$arr["user-agent"].")<br>";
|
323 |
}
|
324 |
echo "<br>";
|
@@ -375,5 +385,43 @@
|
|
375 |
die();
|
376 |
}
|
377 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
378 |
}
|
379 |
?>
|
1 |
<?php
|
2 |
class PreloadWPFC{
|
3 |
+
private static $exclude_rules = false;
|
4 |
+
|
5 |
public static function set_preload($slug){
|
6 |
$preload_arr = array();
|
7 |
|
122 |
|
123 |
if($where_query){
|
124 |
$where_query = preg_replace("/(\s*OR\s*)$/", "", $where_query);
|
125 |
+
|
126 |
+
$recent_custom_posts = $wpdb->get_results("SELECT SQL_CALC_FOUND_ROWS ".$wpdb->prefix."posts.ID FROM ".$wpdb->prefix."posts WHERE 1=1 AND (".$where_query.") AND ((".$wpdb->prefix."posts.post_status = 'publish')) ORDER BY ".$wpdb->prefix."posts.ID DESC LIMIT ".$pre_load->customposttypes.", ".$number, ARRAY_A);
|
127 |
|
128 |
+
if(count($recent_custom_posts) > 0){
|
129 |
+
foreach ($recent_custom_posts as $key => $post) {
|
130 |
+
if($mobile_theme){
|
131 |
+
array_push($urls, array("url" => get_permalink($post["ID"]), "user-agent" => "mobile"));
|
132 |
+
$number--;
|
133 |
+
}
|
134 |
|
135 |
+
array_push($urls, array("url" => get_permalink($post["ID"]), "user-agent" => "desktop"));
|
|
|
|
|
|
|
136 |
$number--;
|
|
|
137 |
|
138 |
+
$pre_load->customposttypes = $pre_load->customposttypes + 1;
|
139 |
+
}
|
140 |
+
}else{
|
141 |
+
$pre_load->customposttypes = -1;
|
142 |
+
}
|
143 |
+
}
|
|
|
|
|
144 |
}
|
145 |
|
146 |
|
315 |
$user_agent = "WP Fastest Cache Preload iPhone Mobile Bot";
|
316 |
}
|
317 |
|
318 |
+
|
319 |
+
if(self::is_excluded($arr["url"])){
|
320 |
+
$status = "<strong style=\"color:blue;\">Excluded</strong>";
|
321 |
}else{
|
322 |
+
if($GLOBALS["wp_fastest_cache"]->wpfc_remote_get($arr["url"], $user_agent)){
|
323 |
+
$status = "<strong style=\"color:lightgreen;\">OK</strong>";
|
324 |
+
}else{
|
325 |
+
$status = "<strong style=\"color:red;\">ERROR</strong>";
|
326 |
+
}
|
327 |
}
|
328 |
|
329 |
+
|
330 |
+
|
331 |
+
|
332 |
echo $status." ".$arr["url"]." (".$arr["user-agent"].")<br>";
|
333 |
}
|
334 |
echo "<br>";
|
385 |
die();
|
386 |
}
|
387 |
}
|
388 |
+
|
389 |
+
public static function is_excluded($url){
|
390 |
+
$request_url = parse_url($url, PHP_URL_PATH);
|
391 |
+
$request_url = urldecode(trim($request_url, "/"));
|
392 |
+
|
393 |
+
if(!$request_url){
|
394 |
+
return false;
|
395 |
+
}
|
396 |
+
|
397 |
+
|
398 |
+
if(self::$exclude_rules === false){
|
399 |
+
if($json_data = get_option("WpFastestCacheExclude")){
|
400 |
+
self::$exclude_rules = json_decode($json_data);
|
401 |
+
}else{
|
402 |
+
self::$exclude_rules = array();
|
403 |
+
}
|
404 |
+
}
|
405 |
+
|
406 |
+
foreach((array)self::$exclude_rules as $key => $value){
|
407 |
+
if($value->prefix == "exact"){
|
408 |
+
if(strtolower($value->content) == strtolower($request_url)){
|
409 |
+
return true;
|
410 |
+
}
|
411 |
+
}else{
|
412 |
+
if($value->prefix == "startwith"){
|
413 |
+
$preg_match_rule = "^".preg_quote($value->content, "/");
|
414 |
+
}else if($value->prefix == "contain"){
|
415 |
+
$preg_match_rule = preg_quote($value->content, "/");
|
416 |
+
}
|
417 |
+
|
418 |
+
if(preg_match("/".$preg_match_rule."/i", $request_url)){
|
419 |
+
return true;
|
420 |
+
}
|
421 |
+
}
|
422 |
+
}
|
423 |
+
|
424 |
+
return false;
|
425 |
+
}
|
426 |
}
|
427 |
?>
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://profiles.wordpress.org/emrevona/
|
|
4 |
Tags: cache, caching, performance, wp-cache, total cache, super cache, cdn
|
5 |
Requires at least: 3.3
|
6 |
Tested up to: 5.1
|
7 |
-
Stable tag: 0.8.9.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -25,7 +25,7 @@ Cache system generates a static html file and saves. Other users reach to static
|
|
25 |
Setup of this plugin is so easy. You don't need to modify the .htacces file. It will be modified automatically.
|
26 |
|
27 |
<h4>Multisite Support</h4>
|
28 |
-
Wpfc
|
29 |
|
30 |
<h4>Features</h4>
|
31 |
|
@@ -103,6 +103,14 @@ Wpfc does not support Wordpress Multisite yet.
|
|
103 |
|
104 |
== Changelog ==
|
105 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
= 0.8.9.2 =
|
107 |
* to clear cache of author page after update/insert post
|
108 |
* to fix PHP Notice: Undefined offset: -1 in wp-fastest-cache/inc/js-utilities.php on line 47.
|
4 |
Tags: cache, caching, performance, wp-cache, total cache, super cache, cdn
|
5 |
Requires at least: 3.3
|
6 |
Tested up to: 5.1
|
7 |
+
Stable tag: 0.8.9.3
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
25 |
Setup of this plugin is so easy. You don't need to modify the .htacces file. It will be modified automatically.
|
26 |
|
27 |
<h4>Multisite Support</h4>
|
28 |
+
Wpfc supports Wordpress Multisite [<a target="_blank" href="https://www.wpfastestcache.com/blog/multi-site/">Details</a>]
|
29 |
|
30 |
<h4>Features</h4>
|
31 |
|
103 |
|
104 |
== Changelog ==
|
105 |
|
106 |
+
= 0.8.9.3 =
|
107 |
+
* to exclude urls on preload
|
108 |
+
* to add exclude rule for admin cookie as default
|
109 |
+
* to prevent replace urls with cdn-url if the url has already been replaced with Jetpack
|
110 |
+
* to fix replacing origin-url with cdn-url for data-product_variations attribute
|
111 |
+
* to fix "Database Syntax Error" [<a target="_blank" href="https://wordpress.org/support/topic/database-syntax-error-2/">Details</a>]
|
112 |
+
* refactoring of read_file()
|
113 |
+
|
114 |
= 0.8.9.2 =
|
115 |
* to clear cache of author page after update/insert post
|
116 |
* to fix PHP Notice: Undefined offset: -1 in wp-fastest-cache/inc/js-utilities.php on line 47.
|
templates/exclude.php
CHANGED
@@ -351,7 +351,11 @@
|
|
351 |
}else if(type == "useragent"){
|
352 |
return "User-Agent: " + request_uri;
|
353 |
}else if(type == "cookie"){
|
354 |
-
|
|
|
|
|
|
|
|
|
355 |
}
|
356 |
|
357 |
},
|
@@ -500,14 +504,14 @@
|
|
500 |
self.add_item(new Date().getTime(), {"type" : "page", "prefix" : "exact", "content" : "wp-login.php", "editable" : false});
|
501 |
//self.add_item(new Date().getTime(), {"prefix" : "startwith", "content" : "wp-content", "editable" : false});
|
502 |
self.add_item(new Date().getTime(), {"type" : "page", "prefix" : "startwith", "content" : "wp-admin", "editable" : false});
|
|
|
503 |
self.add_item(new Date().getTime(), {"type" : "useragent", "prefix" : "contain", "content" : "facebookexternalhit", "editable" : false});
|
504 |
-
|
505 |
self.add_item(new Date().getTime(), {"type" : "useragent", "prefix" : "contain", "content" : "LinkedInBot", "editable" : false});
|
506 |
-
|
507 |
self.add_item(new Date().getTime(), {"type" : "useragent", "prefix" : "contain", "content" : "WhatsApp", "editable" : false});
|
508 |
-
|
509 |
self.add_item(new Date().getTime(), {"type" : "useragent", "prefix" : "contain", "content" : "Twitterbot", "editable" : false});
|
510 |
|
|
|
|
|
511 |
|
512 |
if(typeof this.rules != "undefined" && this.rules && this.rules.length > 0){
|
513 |
jQuery.each(self.rules, function(i, e){
|
351 |
}else if(type == "useragent"){
|
352 |
return "User-Agent: " + request_uri;
|
353 |
}else if(type == "cookie"){
|
354 |
+
if(content == "Admin"){
|
355 |
+
return "Caching has been disabled for " + b_start + "Admin" + b_end + " users";
|
356 |
+
}else{
|
357 |
+
return "Cookie: " + request_uri;
|
358 |
+
}
|
359 |
}
|
360 |
|
361 |
},
|
504 |
self.add_item(new Date().getTime(), {"type" : "page", "prefix" : "exact", "content" : "wp-login.php", "editable" : false});
|
505 |
//self.add_item(new Date().getTime(), {"prefix" : "startwith", "content" : "wp-content", "editable" : false});
|
506 |
self.add_item(new Date().getTime(), {"type" : "page", "prefix" : "startwith", "content" : "wp-admin", "editable" : false});
|
507 |
+
|
508 |
self.add_item(new Date().getTime(), {"type" : "useragent", "prefix" : "contain", "content" : "facebookexternalhit", "editable" : false});
|
|
|
509 |
self.add_item(new Date().getTime(), {"type" : "useragent", "prefix" : "contain", "content" : "LinkedInBot", "editable" : false});
|
|
|
510 |
self.add_item(new Date().getTime(), {"type" : "useragent", "prefix" : "contain", "content" : "WhatsApp", "editable" : false});
|
|
|
511 |
self.add_item(new Date().getTime(), {"type" : "useragent", "prefix" : "contain", "content" : "Twitterbot", "editable" : false});
|
512 |
|
513 |
+
self.add_item(new Date().getTime(), {"type" : "cookie", "prefix" : "contain", "content" : "Admin", "editable" : false});
|
514 |
+
|
515 |
|
516 |
if(typeof this.rules != "undefined" && this.rules && this.rules.length > 0){
|
517 |
jQuery.each(self.rules, function(i, e){
|
wpFastestCache.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: WP Fastest Cache
|
4 |
Plugin URI: http://wordpress.org/plugins/wp-fastest-cache/
|
5 |
Description: The simplest and fastest WP Cache system
|
6 |
-
Version: 0.8.9.
|
7 |
Author: Emre Vona
|
8 |
Author URI: http://tr.linkedin.com/in/emrevona
|
9 |
Text Domain: wp-fastest-cache
|
@@ -1595,6 +1595,12 @@ GNU General Public License for more details.
|
|
1595 |
return $matches[0];
|
1596 |
}
|
1597 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1598 |
if(preg_match("/^\/\/random/", $cdn->cdnurl) || preg_match("/\/\/i\d\.wp\.com/", $cdn->cdnurl)){
|
1599 |
if(preg_match("/^\/\/random/", $cdn->cdnurl)){
|
1600 |
$cdnurl = "//i".rand(0,3).".wp.com/".str_replace("www.", "", $_SERVER["HTTP_HOST"]);
|
@@ -1634,8 +1640,13 @@ GNU General Public License for more details.
|
|
1634 |
}
|
1635 |
|
1636 |
if(preg_match("/data-product_variations\=[\"\'][^\"\']+[\"\']/i", $matches[0])){
|
1637 |
-
$
|
1638 |
-
$
|
|
|
|
|
|
|
|
|
|
|
1639 |
}else if(preg_match("/\{\"concatemoji\"\:\"[^\"]+\"\}/i", $matches[0])){
|
1640 |
$matches[0] = preg_replace("/(http(s?)\:)?".preg_quote("\/\/", "/")."(www\.)?/i", "", $matches[0]);
|
1641 |
$matches[0] = preg_replace("/".preg_quote($cdn->originurl, "/")."/i", $cdnurl, $matches[0]);
|
@@ -1668,7 +1679,12 @@ GNU General Public License for more details.
|
|
1668 |
public function read_file($url){
|
1669 |
if(!preg_match("/\.php/", $url)){
|
1670 |
$url = preg_replace("/\?.*/", "", $url);
|
1671 |
-
|
|
|
|
|
|
|
|
|
|
|
1672 |
|
1673 |
if(@file_exists($path)){
|
1674 |
$filesize = filesize($path);
|
3 |
Plugin Name: WP Fastest Cache
|
4 |
Plugin URI: http://wordpress.org/plugins/wp-fastest-cache/
|
5 |
Description: The simplest and fastest WP Cache system
|
6 |
+
Version: 0.8.9.3
|
7 |
Author: Emre Vona
|
8 |
Author URI: http://tr.linkedin.com/in/emrevona
|
9 |
Text Domain: wp-fastest-cache
|
1595 |
return $matches[0];
|
1596 |
}
|
1597 |
|
1598 |
+
//https://i0.wp.com/i0.wp.com/wpfc.com/stories.png
|
1599 |
+
if(preg_match("/i\d\.wp\.com/i", $matches[0])){
|
1600 |
+
return $matches[0];
|
1601 |
+
}
|
1602 |
+
|
1603 |
+
|
1604 |
if(preg_match("/^\/\/random/", $cdn->cdnurl) || preg_match("/\/\/i\d\.wp\.com/", $cdn->cdnurl)){
|
1605 |
if(preg_match("/^\/\/random/", $cdn->cdnurl)){
|
1606 |
$cdnurl = "//i".rand(0,3).".wp.com/".str_replace("www.", "", $_SERVER["HTTP_HOST"]);
|
1640 |
}
|
1641 |
|
1642 |
if(preg_match("/data-product_variations\=[\"\'][^\"\']+[\"\']/i", $matches[0])){
|
1643 |
+
$cdn->originurl = preg_quote($cdn->originurl, "/");
|
1644 |
+
$cdn->originurl = str_replace("\/", "\\\\\/", $cdn->originurl);
|
1645 |
+
|
1646 |
+
if(preg_match("/".$cdn->originurl."/", $matches[0])){
|
1647 |
+
$matches[0] = preg_replace("/(quot\;)(http(s?)\:)?".preg_quote("\/\/", "/")."(www\.)?/i", "$1", $matches[0]);
|
1648 |
+
$matches[0] = preg_replace("/".$cdn->originurl."/i", $cdnurl, $matches[0]);
|
1649 |
+
}
|
1650 |
}else if(preg_match("/\{\"concatemoji\"\:\"[^\"]+\"\}/i", $matches[0])){
|
1651 |
$matches[0] = preg_replace("/(http(s?)\:)?".preg_quote("\/\/", "/")."(www\.)?/i", "", $matches[0]);
|
1652 |
$matches[0] = preg_replace("/".preg_quote($cdn->originurl, "/")."/i", $cdnurl, $matches[0]);
|
1679 |
public function read_file($url){
|
1680 |
if(!preg_match("/\.php/", $url)){
|
1681 |
$url = preg_replace("/\?.*/", "", $url);
|
1682 |
+
|
1683 |
+
if(preg_match("/wp-content/", $url)){
|
1684 |
+
$path = preg_replace("/.+\/wp-content\/(.+)/", WPFC_WP_CONTENT_DIR."/"."$1", $url);
|
1685 |
+
}else if(preg_match("/wp-includes/", $url)){
|
1686 |
+
$path = preg_replace("/.+\/wp-includes\/(.+)/", ABSPATH."wp-includes/"."$1", $url);
|
1687 |
+
}
|
1688 |
|
1689 |
if(@file_exists($path)){
|
1690 |
$filesize = filesize($path);
|