Version Description
- to disable webp image extension if cloudflare subscription is free
- to fix cache deletion security issue of WP-PostRatings (CVE-2019-6726 by Sebastian Neef)
- to add do_action("wpfc_is_cacheable_action") the plugins to be able to detect that a page has been cached or not
- [FEATURE] exclude woocommerce_items_in_cart cookie [Details]
Download this release
Release Info
Developer | emrevona |
Plugin | WP Fastest Cache |
Version | 0.8.9.1 |
Comparing to | |
See all releases |
Code changes from version 0.8.9.0 to 0.8.9.1
- inc/admin.php +24 -1
- inc/cache.php +3 -0
- inc/cdn.php +21 -1
- readme.txt +8 -2
- templates/exclude.php +67 -19
- wpFastestCache.php +5 -2
inc/admin.php
CHANGED
@@ -380,6 +380,8 @@
|
|
380 |
return array("You have to set <strong><u><a href='".admin_url()."options-permalink.php"."'>permalinks</a></u></strong>", "error");
|
381 |
}else if($res = $this->checkSuperCache($path, $htaccess)){
|
382 |
return $res;
|
|
|
|
|
383 |
}else if($this->isPluginActive('far-future-expiration/far-future-expiration.php')){
|
384 |
return array("Far Future Expiration Plugin", "error");
|
385 |
}else if($this->isPluginActive('sg-cachepress/sg-cachepress.php')){
|
@@ -452,6 +454,26 @@
|
|
452 |
$webp = false;
|
453 |
}else{
|
454 |
$webp = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
455 |
}
|
456 |
}else{
|
457 |
$webp = false;
|
@@ -689,7 +711,7 @@
|
|
689 |
"RewriteCond %{QUERY_STRING} !.+"."\n".$loggedInUser.
|
690 |
$consent_cookie.
|
691 |
"RewriteCond %{HTTP:Cookie} !comment_author_"."\n".
|
692 |
-
"RewriteCond %{HTTP:Cookie} !woocommerce_items_in_cart"."\n".
|
693 |
"RewriteCond %{HTTP:Cookie} !safirmobilswitcher=mobil"."\n".
|
694 |
'RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]'."\n".$mobile;
|
695 |
|
@@ -1784,6 +1806,7 @@
|
|
1784 |
<option value="contain">Contain</option>
|
1785 |
<option value="exact">Exact</option>
|
1786 |
<option value="googleanalytics">has Google Analytics Parameters</option>
|
|
|
1787 |
</select>
|
1788 |
</div>
|
1789 |
<div class="wpfc-exclude-rule-line-middle">
|
380 |
return array("You have to set <strong><u><a href='".admin_url()."options-permalink.php"."'>permalinks</a></u></strong>", "error");
|
381 |
}else if($res = $this->checkSuperCache($path, $htaccess)){
|
382 |
return $res;
|
383 |
+
}else if($this->isPluginActive('fast-velocity-minify/fvm.php')){
|
384 |
+
return array("Fast Velocity Minify", "error");
|
385 |
}else if($this->isPluginActive('far-future-expiration/far-future-expiration.php')){
|
386 |
return array("Far Future Expiration Plugin", "error");
|
387 |
}else if($this->isPluginActive('sg-cachepress/sg-cachepress.php')){
|
454 |
$webp = false;
|
455 |
}else{
|
456 |
$webp = true;
|
457 |
+
|
458 |
+
$cdn_values = get_option("WpFastestCacheCDN");
|
459 |
+
|
460 |
+
if($cdn_values){
|
461 |
+
$std_obj = json_decode($cdn_values);
|
462 |
+
|
463 |
+
foreach($std_obj as $key => $value){
|
464 |
+
if($value->id == "cloudflare"){
|
465 |
+
include_once('cdn.php');
|
466 |
+
|
467 |
+
CdnWPFC::cloudflare_clear_cache();
|
468 |
+
$res = CdnWPFC::cloudflare_get_zone_id($value->cdnurl, $value->originurl);
|
469 |
+
|
470 |
+
if($res["success"] && ($res["plan"] == "free")){
|
471 |
+
$webp = false;
|
472 |
+
}
|
473 |
+
break;
|
474 |
+
}
|
475 |
+
}
|
476 |
+
}
|
477 |
}
|
478 |
}else{
|
479 |
$webp = false;
|
711 |
"RewriteCond %{QUERY_STRING} !.+"."\n".$loggedInUser.
|
712 |
$consent_cookie.
|
713 |
"RewriteCond %{HTTP:Cookie} !comment_author_"."\n".
|
714 |
+
//"RewriteCond %{HTTP:Cookie} !woocommerce_items_in_cart"."\n".
|
715 |
"RewriteCond %{HTTP:Cookie} !safirmobilswitcher=mobil"."\n".
|
716 |
'RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]'."\n".$mobile;
|
717 |
|
1806 |
<option value="contain">Contain</option>
|
1807 |
<option value="exact">Exact</option>
|
1808 |
<option value="googleanalytics">has Google Analytics Parameters</option>
|
1809 |
+
<option value="woocommerce_items_in_cart">has Woocommerce Items in Cart</option>
|
1810 |
</select>
|
1811 |
</div>
|
1812 |
<div class="wpfc-exclude-rule-line-middle">
|
inc/cache.php
CHANGED
@@ -736,6 +736,9 @@
|
|
736 |
|
737 |
if($this->cacheFilePath){
|
738 |
$this->createFolder($this->cacheFilePath, $content);
|
|
|
|
|
|
|
739 |
}
|
740 |
|
741 |
return $content."<!-- need to refresh to see cached version -->";
|
736 |
|
737 |
if($this->cacheFilePath){
|
738 |
$this->createFolder($this->cacheFilePath, $content);
|
739 |
+
|
740 |
+
|
741 |
+
do_action('wpfc_is_cacheable_action');
|
742 |
}
|
743 |
|
744 |
return $content."<!-- need to refresh to see cached version -->";
|
inc/cdn.php
CHANGED
@@ -160,7 +160,9 @@
|
|
160 |
if(isset($zone->result) && isset($zone->result[0])){
|
161 |
foreach ($zone->result as $zone_key => $zone_value) {
|
162 |
if(preg_match("/".$zone_value->name."/", $hostname)){
|
163 |
-
$res = array("success" => true,
|
|
|
|
|
164 |
}
|
165 |
}
|
166 |
|
@@ -176,6 +178,19 @@
|
|
176 |
return $res;
|
177 |
}
|
178 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
179 |
|
180 |
public static function cloudflare_change_settings(){
|
181 |
//admin OR author OR editor
|
@@ -194,6 +209,11 @@
|
|
194 |
$purge_cache = CdnWPFC::cloudflare_clear_cache($email, $key, $zone["zoneid"]);
|
195 |
$browser_caching = CdnWPFC::cloudflare_set_browser_caching($email, $key, $zone["zoneid"]);
|
196 |
|
|
|
|
|
|
|
|
|
|
|
197 |
if($minify["success"]){
|
198 |
if($rocket_loader["success"]){
|
199 |
if($browser_caching["success"]){
|
160 |
if(isset($zone->result) && isset($zone->result[0])){
|
161 |
foreach ($zone->result as $zone_key => $zone_value) {
|
162 |
if(preg_match("/".$zone_value->name."/", $hostname)){
|
163 |
+
$res = array("success" => true,
|
164 |
+
"zoneid" => $zone_value->id,
|
165 |
+
"plan" => $zone_value->plan->legacy_id);
|
166 |
}
|
167 |
}
|
168 |
|
178 |
return $res;
|
179 |
}
|
180 |
|
181 |
+
public static function cloudflare_remove_webp(){
|
182 |
+
$path = ABSPATH.".htaccess";
|
183 |
+
|
184 |
+
if(file_exists($path)){
|
185 |
+
if(is_writable($path)){
|
186 |
+
$htaccess = file_get_contents($path);
|
187 |
+
$htaccess = preg_replace("/#\s?BEGIN\s?WEBPWpFastestCache.*?#\s?END\s?WEBPWpFastestCache/s", "", $htaccess);
|
188 |
+
|
189 |
+
file_put_contents($path, $htaccess);
|
190 |
+
}
|
191 |
+
}
|
192 |
+
}
|
193 |
+
|
194 |
|
195 |
public static function cloudflare_change_settings(){
|
196 |
//admin OR author OR editor
|
209 |
$purge_cache = CdnWPFC::cloudflare_clear_cache($email, $key, $zone["zoneid"]);
|
210 |
$browser_caching = CdnWPFC::cloudflare_set_browser_caching($email, $key, $zone["zoneid"]);
|
211 |
|
212 |
+
if($zone["plan"] == "free"){
|
213 |
+
CdnWPFC::cloudflare_remove_webp();;
|
214 |
+
}
|
215 |
+
|
216 |
+
|
217 |
if($minify["success"]){
|
218 |
if($rocket_loader["success"]){
|
219 |
if($browser_caching["success"]){
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: emrevona
|
|
3 |
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.
|
7 |
-
Stable tag: 0.8.9.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -103,6 +103,12 @@ Wpfc does not support Wordpress Multisite yet.
|
|
103 |
|
104 |
== Changelog ==
|
105 |
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
= 0.8.9.0 =
|
107 |
* to replace lazy load blank.gif with cdn-url
|
108 |
* to exclude wishlist url of YITH WooCommerce Wishlist
|
3 |
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.1
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
103 |
|
104 |
== Changelog ==
|
105 |
|
106 |
+
= 0.8.9.1 =
|
107 |
+
* to disable webp image extension if cloudflare subscription is free
|
108 |
+
* to fix cache deletion security issue of WP-PostRatings (CVE-2019-6726 by Sebastian Neef)
|
109 |
+
* to add do_action("wpfc_is_cacheable_action") the plugins to be able to detect that a page has been cached or not
|
110 |
+
* <strong>[FEATURE]</strong> exclude woocommerce_items_in_cart cookie [<a target="_blank" href="https://www.wpfastestcache.com/tutorial/woocommerce-settings/#cart-widget">Details</a>]
|
111 |
+
|
112 |
= 0.8.9.0 =
|
113 |
* to replace lazy load blank.gif with cdn-url
|
114 |
* to exclude wishlist url of YITH WooCommerce Wishlist
|
templates/exclude.php
CHANGED
@@ -103,6 +103,7 @@
|
|
103 |
<option value="contain">Contains</option>
|
104 |
<option value="exact">Is Equal To</option>
|
105 |
<option value="googleanalytics">has Google Analytics Parameters</option>
|
|
|
106 |
</select>
|
107 |
</td>
|
108 |
<td width="300">
|
@@ -183,17 +184,27 @@
|
|
183 |
var clone_modal_id = "wpfc-modal-exclude-" + new Date().getTime();
|
184 |
|
185 |
clone_modal.find("select").change(function(e){
|
186 |
-
if(jQuery(this).val().match(/^(homepage|category|tag|archive|post|page|attachment|googleanalytics)$/)){
|
187 |
-
clone_modal.find("input[name='wpfc-exclude-rule-content']").hide();
|
188 |
clone_modal.find("input[name='wpfc-exclude-rule-content']").val(jQuery(this).val());
|
|
|
|
|
|
|
189 |
}else{
|
190 |
-
clone_modal.find("input[name='wpfc-exclude-rule-content']").show();
|
191 |
clone_modal.find("input[name='wpfc-exclude-rule-content']").val("");
|
|
|
|
|
|
|
192 |
}
|
193 |
});
|
194 |
|
195 |
-
|
196 |
-
|
|
|
|
|
|
|
|
|
197 |
}
|
198 |
|
199 |
clone_modal.attr("id", clone_modal_id);
|
@@ -201,6 +212,28 @@
|
|
201 |
clone_modal.find("input[name='wpfc-exclude-rule-content']").val(jQuery(this).attr("content"));
|
202 |
clone_modal.find("input[name='wpfc-exclude-rule-type']").val(jQuery(this).attr("type"));
|
203 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
204 |
if(e.type != "page"){
|
205 |
if(e.type == "useragent"){
|
206 |
clone_modal.find(".wpfc-condition-text").text("If User-Agent");
|
@@ -211,12 +244,6 @@
|
|
211 |
}else if(e.type == "cookie"){
|
212 |
clone_modal.find(".wpfc-condition-text").text("If Cookie");
|
213 |
}
|
214 |
-
|
215 |
-
clone_modal.find("select[name='wpfc-exclude-rule-prefix'] option").each(function(){
|
216 |
-
if(this.value != "contain"){
|
217 |
-
jQuery(this).remove();
|
218 |
-
}
|
219 |
-
});
|
220 |
}
|
221 |
|
222 |
|
@@ -290,6 +317,8 @@
|
|
290 |
title = "Attachments";
|
291 |
}else if(prefix == "googleanalytics"){
|
292 |
title = "Google Analytics Parameters";
|
|
|
|
|
293 |
}
|
294 |
|
295 |
return title;
|
@@ -310,7 +339,7 @@
|
|
310 |
}
|
311 |
|
312 |
if(type == "page" || type == "css" || type == "js"){
|
313 |
-
if(prefix.match(/^(homepage|category|tag|archive|post|page|attachment|googleanalytics)$/)){
|
314 |
if(prefix == "homepage"){
|
315 |
return "The " + b_start + "homepage" + b_end + " has been excluded";
|
316 |
}else{
|
@@ -352,13 +381,26 @@
|
|
352 |
clone_modal.attr("id", clone_modal_id);
|
353 |
clone_modal.find("input[name='wpfc-exclude-rule-type']").val(clone_modal_type);
|
354 |
|
355 |
-
|
356 |
-
|
357 |
-
if(
|
|
|
|
|
358 |
jQuery(this).remove();
|
359 |
}
|
360 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
361 |
|
|
|
362 |
if(clone_modal_type == "useragent"){
|
363 |
clone_modal.find(".wpfc-condition-text").text("If User-Agent");
|
364 |
}else if(clone_modal_type == "css"){
|
@@ -374,12 +416,18 @@
|
|
374 |
|
375 |
|
376 |
clone_modal.find("select").change(function(){
|
377 |
-
if(jQuery(this).val().match(/^(homepage|category|tag|archive|post|page|attachment|googleanalytics)$/)){
|
378 |
-
clone_modal.find("input[name='wpfc-exclude-rule-content']").hide();
|
379 |
clone_modal.find("input[name='wpfc-exclude-rule-content']").val(jQuery(this).val());
|
|
|
|
|
|
|
380 |
}else{
|
381 |
-
clone_modal.find("input[name='wpfc-exclude-rule-content']").show();
|
382 |
clone_modal.find("input[name='wpfc-exclude-rule-content']").val("");
|
|
|
|
|
|
|
383 |
}
|
384 |
});
|
385 |
|
103 |
<option value="contain">Contains</option>
|
104 |
<option value="exact">Is Equal To</option>
|
105 |
<option value="googleanalytics">has Google Analytics Parameters</option>
|
106 |
+
<option value="woocommerce_items_in_cart">has Woocommerce Items in Cart</option>
|
107 |
</select>
|
108 |
</td>
|
109 |
<td width="300">
|
184 |
var clone_modal_id = "wpfc-modal-exclude-" + new Date().getTime();
|
185 |
|
186 |
clone_modal.find("select").change(function(e){
|
187 |
+
if(jQuery(this).val().match(/^(homepage|category|tag|archive|post|page|attachment|googleanalytics|woocommerce_items_in_cart)$/)){
|
188 |
+
clone_modal.find("input[name='wpfc-exclude-rule-content']").closest("td").hide();
|
189 |
clone_modal.find("input[name='wpfc-exclude-rule-content']").val(jQuery(this).val());
|
190 |
+
|
191 |
+
jQuery(this).closest("td").width(395);
|
192 |
+
jQuery(this).width(395);
|
193 |
}else{
|
194 |
+
clone_modal.find("input[name='wpfc-exclude-rule-content']").closest("td").show();
|
195 |
clone_modal.find("input[name='wpfc-exclude-rule-content']").val("");
|
196 |
+
|
197 |
+
jQuery(this).closest("td").width(95);
|
198 |
+
jQuery(this).width(95);
|
199 |
}
|
200 |
});
|
201 |
|
202 |
+
|
203 |
+
if(e.prefix.match(/^(homepage|category|tag|archive|post|page|attachment|googleanalytics|woocommerce_items_in_cart)$/)){
|
204 |
+
clone_modal.find("input[name='wpfc-exclude-rule-content']").closest("td").hide();
|
205 |
+
|
206 |
+
clone_modal.find("select").closest("td").width(395);
|
207 |
+
clone_modal.find("select").width(395);
|
208 |
}
|
209 |
|
210 |
clone_modal.attr("id", clone_modal_id);
|
212 |
clone_modal.find("input[name='wpfc-exclude-rule-content']").val(jQuery(this).attr("content"));
|
213 |
clone_modal.find("input[name='wpfc-exclude-rule-type']").val(jQuery(this).attr("type"));
|
214 |
|
215 |
+
|
216 |
+
clone_modal.find("select[name='wpfc-exclude-rule-prefix'] option").each(function(){
|
217 |
+
if(this.value == "woocommerce_items_in_cart"){
|
218 |
+
if(e.type == "cookie"){
|
219 |
+
return;
|
220 |
+
}else{
|
221 |
+
jQuery(this).remove();
|
222 |
+
}
|
223 |
+
}else{
|
224 |
+
if(e.type != "page"){
|
225 |
+
if(this.value != "contain"){
|
226 |
+
jQuery(this).remove();
|
227 |
+
|
228 |
+
}
|
229 |
+
}
|
230 |
+
|
231 |
+
}
|
232 |
+
|
233 |
+
|
234 |
+
});
|
235 |
+
|
236 |
+
|
237 |
if(e.type != "page"){
|
238 |
if(e.type == "useragent"){
|
239 |
clone_modal.find(".wpfc-condition-text").text("If User-Agent");
|
244 |
}else if(e.type == "cookie"){
|
245 |
clone_modal.find(".wpfc-condition-text").text("If Cookie");
|
246 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
247 |
}
|
248 |
|
249 |
|
317 |
title = "Attachments";
|
318 |
}else if(prefix == "googleanalytics"){
|
319 |
title = "Google Analytics Parameters";
|
320 |
+
}else if(prefix == "woocommerce_items_in_cart"){
|
321 |
+
title = "Woocommerce Items in Cart";
|
322 |
}
|
323 |
|
324 |
return title;
|
339 |
}
|
340 |
|
341 |
if(type == "page" || type == "css" || type == "js"){
|
342 |
+
if(prefix.match(/^(homepage|category|tag|archive|post|page|attachment|googleanalytics|woocommerce_items_in_cart)$/)){
|
343 |
if(prefix == "homepage"){
|
344 |
return "The " + b_start + "homepage" + b_end + " has been excluded";
|
345 |
}else{
|
381 |
clone_modal.attr("id", clone_modal_id);
|
382 |
clone_modal.find("input[name='wpfc-exclude-rule-type']").val(clone_modal_type);
|
383 |
|
384 |
+
clone_modal.find("select[name='wpfc-exclude-rule-prefix'] option").each(function(){
|
385 |
+
if(this.value == "woocommerce_items_in_cart"){
|
386 |
+
if(clone_modal_type == "cookie"){
|
387 |
+
return;
|
388 |
+
}else{
|
389 |
jQuery(this).remove();
|
390 |
}
|
391 |
+
}else{
|
392 |
+
if(clone_modal_type != "page"){
|
393 |
+
if(this.value != "contain"){
|
394 |
+
jQuery(this).remove();
|
395 |
+
|
396 |
+
}
|
397 |
+
}
|
398 |
+
}
|
399 |
+
|
400 |
+
|
401 |
+
});
|
402 |
|
403 |
+
if(clone_modal_type != "page"){
|
404 |
if(clone_modal_type == "useragent"){
|
405 |
clone_modal.find(".wpfc-condition-text").text("If User-Agent");
|
406 |
}else if(clone_modal_type == "css"){
|
416 |
|
417 |
|
418 |
clone_modal.find("select").change(function(){
|
419 |
+
if(jQuery(this).val().match(/^(homepage|category|tag|archive|post|page|attachment|googleanalytics|woocommerce_items_in_cart)$/)){
|
420 |
+
clone_modal.find("input[name='wpfc-exclude-rule-content']").closest("td").hide();
|
421 |
clone_modal.find("input[name='wpfc-exclude-rule-content']").val(jQuery(this).val());
|
422 |
+
|
423 |
+
jQuery(this).closest("td").width(395);
|
424 |
+
jQuery(this).width(395);
|
425 |
}else{
|
426 |
+
clone_modal.find("input[name='wpfc-exclude-rule-content']").closest("td").show();
|
427 |
clone_modal.find("input[name='wpfc-exclude-rule-content']").val("");
|
428 |
+
|
429 |
+
jQuery(this).closest("td").width(95);
|
430 |
+
jQuery(this).width(95);
|
431 |
}
|
432 |
});
|
433 |
|
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
|
@@ -584,7 +584,10 @@ GNU General Public License for more details.
|
|
584 |
if($url["path"] == "/"){
|
585 |
$this->rm_folder_recursively($this->getWpContentDir("/cache/all/index.html"));
|
586 |
}else{
|
587 |
-
|
|
|
|
|
|
|
588 |
}
|
589 |
}
|
590 |
}
|
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.1
|
7 |
Author: Emre Vona
|
8 |
Author URI: http://tr.linkedin.com/in/emrevona
|
9 |
Text Domain: wp-fastest-cache
|
584 |
if($url["path"] == "/"){
|
585 |
$this->rm_folder_recursively($this->getWpContentDir("/cache/all/index.html"));
|
586 |
}else{
|
587 |
+
// to prevent changing path with ../ or with another method
|
588 |
+
if($url["path"] == realpath(".".$url["path"])){
|
589 |
+
$this->rm_folder_recursively($this->getWpContentDir("/cache/all").$url["path"]);
|
590 |
+
}
|
591 |
}
|
592 |
}
|
593 |
}
|