Version Description
- to espace empty spaces for webp rules
- to clear cache after new Woocommerce orders
- [FEATURE] Compatible with kk Star Ratings
- to clear the pages cache of the categories and tags
- [FEATURE] Compatible with All In One Schema.org Rich Snippets
- [FEATURE] Compatible with WPML Multilingual Plugin
- [FEATURE] Compatible with Cloudinary
Download this release
Release Info
Developer | emrevona |
Plugin | WP Fastest Cache |
Version | 0.8.7.3 |
Comparing to | |
See all releases |
Code changes from version 0.8.7.2 to 0.8.7.3
- inc/admin.php +7 -2
- inc/cache.php +10 -1
- inc/nonce-timeout.php +3 -2
- readme.txt +10 -2
- wpFastestCache.php +75 -28
inc/admin.php
CHANGED
@@ -334,8 +334,10 @@
|
|
334 |
return array("You have to set <strong><u><a href='".admin_url()."options-permalink.php"."'>permalinks</a></u></strong>", "error");
|
335 |
}else if($res = $this->checkSuperCache($path, $htaccess)){
|
336 |
return $res;
|
|
|
|
|
337 |
}else if($this->isPluginActive('sg-cachepress/sg-cachepress.php')){
|
338 |
-
return array("SG Optimizer needs to be
|
339 |
}else if($this->isPluginActive('adrotate/adrotate.php') || $this->isPluginActive('adrotate-pro/adrotate.php')){
|
340 |
return $this->warningIncompatible("AdRotate");
|
341 |
}else if($this->isPluginActive('mobilepress/mobilepress.php')){
|
@@ -414,8 +416,11 @@
|
|
414 |
if(ABSPATH == "//"){
|
415 |
$RewriteCond = "RewriteCond %{DOCUMENT_ROOT}/".$basename." -f"."\n";
|
416 |
}else{
|
|
|
|
|
|
|
417 |
$RewriteCond = "RewriteCond %{DOCUMENT_ROOT}/".$basename." -f [or]"."\n";
|
418 |
-
$RewriteCond = $RewriteCond."RewriteCond ".
|
419 |
}
|
420 |
|
421 |
|
334 |
return array("You have to set <strong><u><a href='".admin_url()."options-permalink.php"."'>permalinks</a></u></strong>", "error");
|
335 |
}else if($res = $this->checkSuperCache($path, $htaccess)){
|
336 |
return $res;
|
337 |
+
}else if($this->isPluginActive('fast-velocity-minify/fvm.php')){
|
338 |
+
return array("Fast Velocity Minify needs to be deactived", "error");
|
339 |
}else if($this->isPluginActive('sg-cachepress/sg-cachepress.php')){
|
340 |
+
return array("SG Optimizer needs to be deactived", "error");
|
341 |
}else if($this->isPluginActive('adrotate/adrotate.php') || $this->isPluginActive('adrotate-pro/adrotate.php')){
|
342 |
return $this->warningIncompatible("AdRotate");
|
343 |
}else if($this->isPluginActive('mobilepress/mobilepress.php')){
|
416 |
if(ABSPATH == "//"){
|
417 |
$RewriteCond = "RewriteCond %{DOCUMENT_ROOT}/".$basename." -f"."\n";
|
418 |
}else{
|
419 |
+
// to escape spaces
|
420 |
+
$tmp_ABSPATH = str_replace(" ", "\ ", ABSPATH);
|
421 |
+
|
422 |
$RewriteCond = "RewriteCond %{DOCUMENT_ROOT}/".$basename." -f [or]"."\n";
|
423 |
+
$RewriteCond = $RewriteCond."RewriteCond ".$tmp_ABSPATH."$1.webp -f"."\n";
|
424 |
}
|
425 |
|
426 |
|
inc/cache.php
CHANGED
@@ -90,6 +90,13 @@
|
|
90 |
$this->cacheFilePath = $this->getWpContentDir()."/cache/all/".$_SERVER["REQUEST_URI"];
|
91 |
}
|
92 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
|
94 |
$this->cacheFilePath = $this->cacheFilePath ? rtrim($this->cacheFilePath, "/")."/" : "";
|
95 |
$this->cacheFilePath = str_replace("/cache/all//", "/cache/all/", $this->cacheFilePath);
|
@@ -215,6 +222,8 @@
|
|
215 |
}else if(defined('WPFC_CACHE_QUERYSTRING') && WPFC_CACHE_QUERYSTRING){
|
216 |
//
|
217 |
}else{
|
|
|
|
|
218 |
return 0;
|
219 |
}
|
220 |
}
|
@@ -310,7 +319,7 @@
|
|
310 |
if($create_cache){
|
311 |
$this->startTime = microtime(true);
|
312 |
|
313 |
-
add_action('
|
314 |
add_action('get_footer', array($this, "wp_print_scripts_action"));
|
315 |
|
316 |
ob_start(array($this, "callback"));
|
90 |
$this->cacheFilePath = $this->getWpContentDir()."/cache/all/".$_SERVER["REQUEST_URI"];
|
91 |
}
|
92 |
}
|
93 |
+
|
94 |
+
//WPML language switch
|
95 |
+
//https://wpml.org/forums/topic/wpml-language-switch-wp-fastest-cache-issue/
|
96 |
+
if($this->isPluginActive('sitepress-multilingual-cms/sitepress.php')){
|
97 |
+
$current_language = apply_filters('wpml_current_language', false);
|
98 |
+
$this->cacheFilePath = str_replace('/cache/all/', '/cache/all/'.$current_language.'/', $this->cacheFilePath);
|
99 |
+
}
|
100 |
|
101 |
$this->cacheFilePath = $this->cacheFilePath ? rtrim($this->cacheFilePath, "/")."/" : "";
|
102 |
$this->cacheFilePath = str_replace("/cache/all//", "/cache/all/", $this->cacheFilePath);
|
222 |
}else if(defined('WPFC_CACHE_QUERYSTRING') && WPFC_CACHE_QUERYSTRING){
|
223 |
//
|
224 |
}else{
|
225 |
+
ob_start(array($this, "cdn_rewrite"));
|
226 |
+
|
227 |
return 0;
|
228 |
}
|
229 |
}
|
319 |
if($create_cache){
|
320 |
$this->startTime = microtime(true);
|
321 |
|
322 |
+
add_action('get_footer', array($this, "detect_current_page_type"));
|
323 |
add_action('get_footer', array($this, "wp_print_scripts_action"));
|
324 |
|
325 |
ob_start(array($this, "callback"));
|
inc/nonce-timeout.php
CHANGED
@@ -1,11 +1,12 @@
|
|
1 |
<?php
|
2 |
class WPFC_NONCE_TIMEOUT{
|
3 |
-
private $file_path =
|
4 |
private $file_name = "nonce_datas.txt";
|
5 |
private $prev_nonce = false;
|
6 |
private $current_nonce = false;
|
7 |
|
8 |
-
public function __construct(){
|
|
|
9 |
$this->set_current_nonce();
|
10 |
$this->set_prev_nonce();
|
11 |
}
|
1 |
<?php
|
2 |
class WPFC_NONCE_TIMEOUT{
|
3 |
+
private $file_path = "";
|
4 |
private $file_name = "nonce_datas.txt";
|
5 |
private $prev_nonce = false;
|
6 |
private $current_nonce = false;
|
7 |
|
8 |
+
public function __construct($cache_path){
|
9 |
+
$this->file_path = $cache_path;
|
10 |
$this->set_current_nonce();
|
11 |
$this->set_prev_nonce();
|
12 |
}
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://profiles.wordpress.org/emrevona/
|
|
4 |
Tags: cache, performance, wp-cache, total cache, super cache
|
5 |
Requires at least: 3.3
|
6 |
Tested up to: 4.8
|
7 |
-
Stable tag: 0.8.7.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -101,6 +101,15 @@ Wpfc does not support Wordpress Multisite yet.
|
|
101 |
|
102 |
== Changelog ==
|
103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
= 0.8.7.2 =
|
105 |
* to exclude the admins cookies for the cache automatically
|
106 |
* to clear the cache of category and tag after update
|
@@ -176,7 +185,6 @@ Wpfc does not support Wordpress Multisite yet.
|
|
176 |
* to clear the cache of post cats and the cache of post tags after update post
|
177 |
|
178 |
= 0.8.6.4 =
|
179 |
-
* <strong>[FEATURE]</strong> Compatible with kk Star Ratings
|
180 |
* to add aac, mp3, ogg extension for CDN
|
181 |
* to serve wp-emoji-release.min.js via cdn if CDN integration has been added
|
182 |
* not to show the cache for comment authors
|
4 |
Tags: cache, performance, wp-cache, total cache, super cache
|
5 |
Requires at least: 3.3
|
6 |
Tested up to: 4.8
|
7 |
+
Stable tag: 0.8.7.3
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
101 |
|
102 |
== Changelog ==
|
103 |
|
104 |
+
= 0.8.7.3 =
|
105 |
+
* to espace empty spaces for webp rules
|
106 |
+
* to clear cache after new Woocommerce orders
|
107 |
+
* <strong>[FEATURE]</strong> Compatible with kk Star Ratings
|
108 |
+
* to clear the pages cache of the categories and tags
|
109 |
+
* <strong>[FEATURE]</strong> Compatible with All In One Schema.org Rich Snippets
|
110 |
+
* <strong>[FEATURE]</strong> Compatible with WPML Multilingual Plugin
|
111 |
+
* <strong>[FEATURE]</strong> Compatible with Cloudinary
|
112 |
+
|
113 |
= 0.8.7.2 =
|
114 |
* to exclude the admins cookies for the cache automatically
|
115 |
* to clear the cache of category and tag after update
|
185 |
* to clear the cache of post cats and the cache of post tags after update post
|
186 |
|
187 |
= 0.8.6.4 =
|
|
|
188 |
* to add aac, mp3, ogg extension for CDN
|
189 |
* to serve wp-emoji-release.min.js via cdn if CDN integration has been added
|
190 |
* not to show the cache for comment authors
|
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.7.
|
7 |
Author: Emre Vona
|
8 |
Author URI: http://tr.linkedin.com/in/emrevona
|
9 |
Text Domain: wp-fastest-cache
|
@@ -100,34 +100,35 @@ GNU General Public License for more details.
|
|
100 |
add_action( 'wp_ajax_wpfc_remove_cdn_integration_ajax_request', array($this, 'wpfc_remove_cdn_integration_ajax_request_callback'));
|
101 |
add_action( 'wp_ajax_wpfc_save_cdn_integration_ajax_request', array($this, 'wpfc_save_cdn_integration_ajax_request_callback'));
|
102 |
add_action( 'wp_ajax_wpfc_cdn_template_ajax_request', array($this, 'wpfc_cdn_template_ajax_request_callback'));
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
add_action( 'wp_ajax_wpfc_check_url_ajax_request', array($this, 'wpfc_check_url_ajax_request_callback'));
|
108 |
-
|
109 |
add_action( 'wp_ajax_wpfc_cache_statics_get', array($this, 'wpfc_cache_statics_get_callback'));
|
110 |
-
|
111 |
-
|
112 |
add_action( 'wp_ajax_wpfc_db_statics', array($this, 'wpfc_db_statics_callback'));
|
113 |
add_action( 'wp_ajax_wpfc_db_fix', array($this, 'wpfc_db_fix_callback'));
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
add_action( 'rate_post', array($this, 'wp_postratings_clear_fastest_cache'), 10, 2);
|
|
|
|
|
|
|
120 |
|
|
|
|
|
121 |
|
122 |
-
|
123 |
-
add_action('
|
124 |
-
|
125 |
|
126 |
-
|
|
|
127 |
|
128 |
-
// to
|
129 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
|
|
|
131 |
if(is_dir($this->getWpContentDir()."/cache/tmpWpfc")){
|
132 |
$this->rm_folder_recursively($this->getWpContentDir()."/cache/tmpWpfc");
|
133 |
}
|
@@ -236,6 +237,10 @@ GNU General Public License for more details.
|
|
236 |
}
|
237 |
}
|
238 |
|
|
|
|
|
|
|
|
|
239 |
public function nonce_timeout(){
|
240 |
if(!is_user_logged_in()){
|
241 |
$run = false;
|
@@ -257,7 +262,7 @@ GNU General Public License for more details.
|
|
257 |
if($run){
|
258 |
include_once('inc/nonce-timeout.php');
|
259 |
|
260 |
-
$wpfc_nonce = new WPFC_NONCE_TIMEOUT();
|
261 |
|
262 |
if(!$wpfc_nonce->verify_nonce()){
|
263 |
$this->deleteCache();
|
@@ -266,6 +271,20 @@ GNU General Public License for more details.
|
|
266 |
}
|
267 |
}
|
268 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
269 |
public function wpfc_db_fix_callback(){
|
270 |
if($this->isPluginActive("wp-fastest-cache-premium/wpFastestCachePremium.php")){
|
271 |
include_once $this->get_premium_path("db.php");
|
@@ -388,6 +407,10 @@ GNU General Public License for more details.
|
|
388 |
if(isset($header["server"]) && preg_match("/squid/i", $header["server"])){
|
389 |
$res = array("success" => true);
|
390 |
}
|
|
|
|
|
|
|
|
|
391 |
}
|
392 |
}
|
393 |
|
@@ -908,6 +931,8 @@ GNU General Public License for more details.
|
|
908 |
}
|
909 |
|
910 |
public function singleDeleteCache($comment_id = false, $post_id = false){
|
|
|
|
|
911 |
if($comment_id){
|
912 |
$comment = get_comment($comment_id);
|
913 |
|
@@ -944,15 +969,30 @@ GNU General Public License for more details.
|
|
944 |
}
|
945 |
}
|
946 |
|
947 |
-
// to clear cache of homepage
|
948 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
949 |
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
|
954 |
-
|
955 |
-
$
|
|
|
|
|
|
|
|
|
|
|
956 |
}
|
957 |
}
|
958 |
}
|
@@ -967,8 +1007,13 @@ GNU General Public License for more details.
|
|
967 |
$path = preg_replace("/https?\:\/\/[^\/]+/i", "", $url);
|
968 |
$path = trim($path, "/");
|
969 |
|
|
|
970 |
@unlink($this->getWpContentDir()."/cache/all/".$path."/index.html");
|
971 |
@unlink($this->getWpContentDir()."/cache/wpfc-mobile-cache/".$path."/index.html");
|
|
|
|
|
|
|
|
|
972 |
}
|
973 |
}
|
974 |
}
|
@@ -1605,7 +1650,9 @@ GNU General Public License for more details.
|
|
1605 |
}
|
1606 |
}
|
1607 |
|
1608 |
-
|
|
|
|
|
1609 |
@rmdir($dir);
|
1610 |
}
|
1611 |
|
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.7.3
|
7 |
Author: Emre Vona
|
8 |
Author URI: http://tr.linkedin.com/in/emrevona
|
9 |
Text Domain: wp-fastest-cache
|
100 |
add_action( 'wp_ajax_wpfc_remove_cdn_integration_ajax_request', array($this, 'wpfc_remove_cdn_integration_ajax_request_callback'));
|
101 |
add_action( 'wp_ajax_wpfc_save_cdn_integration_ajax_request', array($this, 'wpfc_save_cdn_integration_ajax_request_callback'));
|
102 |
add_action( 'wp_ajax_wpfc_cdn_template_ajax_request', array($this, 'wpfc_cdn_template_ajax_request_callback'));
|
|
|
|
|
|
|
|
|
103 |
add_action( 'wp_ajax_wpfc_check_url_ajax_request', array($this, 'wpfc_check_url_ajax_request_callback'));
|
|
|
104 |
add_action( 'wp_ajax_wpfc_cache_statics_get', array($this, 'wpfc_cache_statics_get_callback'));
|
|
|
|
|
105 |
add_action( 'wp_ajax_wpfc_db_statics', array($this, 'wpfc_db_statics_callback'));
|
106 |
add_action( 'wp_ajax_wpfc_db_fix', array($this, 'wpfc_db_fix_callback'));
|
|
|
|
|
|
|
|
|
|
|
107 |
add_action( 'rate_post', array($this, 'wp_postratings_clear_fastest_cache'), 10, 2);
|
108 |
+
add_action( 'user_register', array($this, 'modify_htaccess_for_new_user'), 10, 1);
|
109 |
+
add_action( 'profile_update', array($this, 'modify_htaccess_for_new_user'), 10, 1);
|
110 |
+
add_action( 'edit_terms', array($this, 'delete_cache_of_term'), 10, 1);
|
111 |
|
112 |
+
// to check nonce is timeout or not
|
113 |
+
//add_action('init', array($this, "nonce_timeout"));
|
114 |
|
115 |
+
// to clear cache after new Woocommerce orders
|
116 |
+
add_action( 'woocommerce_checkout_order_processed', array($this, 'clear_cache_after_woocommerce_checkout_order_processed'), 1, 1);
|
|
|
117 |
|
118 |
+
// kk Star Ratings: to clear the cache of the post after voting
|
119 |
+
add_action( 'kksr_rate', array($this, 'clear_cache_on_kksr_rate'));
|
120 |
|
121 |
+
// to clear cache after ajax request by other plugins
|
122 |
+
if(isset($_POST["action"])){
|
123 |
+
// All In One Schema.org Rich Snippets
|
124 |
+
if(preg_match("/bsf_(update|submit)_rating/i", $_POST["action"])){
|
125 |
+
if(isset($_POST["post_id"])){
|
126 |
+
$this->singleDeleteCache(false, $_POST["post_id"]);
|
127 |
+
}
|
128 |
+
}
|
129 |
+
}
|
130 |
|
131 |
+
// to clear /tmpWpfc folder
|
132 |
if(is_dir($this->getWpContentDir()."/cache/tmpWpfc")){
|
133 |
$this->rm_folder_recursively($this->getWpContentDir()."/cache/tmpWpfc");
|
134 |
}
|
237 |
}
|
238 |
}
|
239 |
|
240 |
+
public function clear_cache_on_kksr_rate($id){
|
241 |
+
$this->singleDeleteCache(false, $id);
|
242 |
+
}
|
243 |
+
|
244 |
public function nonce_timeout(){
|
245 |
if(!is_user_logged_in()){
|
246 |
$run = false;
|
262 |
if($run){
|
263 |
include_once('inc/nonce-timeout.php');
|
264 |
|
265 |
+
$wpfc_nonce = new WPFC_NONCE_TIMEOUT(WPFC_WP_CONTENT_DIR."/cache/all");
|
266 |
|
267 |
if(!$wpfc_nonce->verify_nonce()){
|
268 |
$this->deleteCache();
|
271 |
}
|
272 |
}
|
273 |
|
274 |
+
public function clear_cache_after_woocommerce_checkout_order_processed($order_id = false){
|
275 |
+
if($order_id){
|
276 |
+
$order = wc_get_order($order_id);
|
277 |
+
|
278 |
+
if($order){
|
279 |
+
foreach($order->get_items() as $item_key => $item_values ){
|
280 |
+
if(method_exists($item_values, 'get_product_id')){
|
281 |
+
$this->singleDeleteCache(false, $item_values->get_product_id());
|
282 |
+
}
|
283 |
+
}
|
284 |
+
}
|
285 |
+
}
|
286 |
+
}
|
287 |
+
|
288 |
public function wpfc_db_fix_callback(){
|
289 |
if($this->isPluginActive("wp-fastest-cache-premium/wpFastestCachePremium.php")){
|
290 |
include_once $this->get_premium_path("db.php");
|
407 |
if(isset($header["server"]) && preg_match("/squid/i", $header["server"])){
|
408 |
$res = array("success" => true);
|
409 |
}
|
410 |
+
|
411 |
+
if(($response_code == 401) && (preg_match("/res\.cloudinary\.com/i", $_GET["url"]))){
|
412 |
+
$res = array("success" => true);
|
413 |
+
}
|
414 |
}
|
415 |
}
|
416 |
|
931 |
}
|
932 |
|
933 |
public function singleDeleteCache($comment_id = false, $post_id = false){
|
934 |
+
$to_clear_parents = true;
|
935 |
+
|
936 |
if($comment_id){
|
937 |
$comment = get_comment($comment_id);
|
938 |
|
969 |
}
|
970 |
}
|
971 |
|
972 |
+
// not to clear cache of homepage/cats/tags after ajax request by other plugins
|
973 |
+
if(isset($_POST) && isset($_POST["action"])){
|
974 |
+
// kk Star Rating
|
975 |
+
if($_POST["action"] == "kksr_ajax"){
|
976 |
+
$to_clear_parents = false;
|
977 |
+
}
|
978 |
+
|
979 |
+
// All In One Schema.org Rich Snippets
|
980 |
+
if(preg_match("/bsf_(update|submit)_rating/i", $_POST["action"])){
|
981 |
+
$to_clear_parents = false;
|
982 |
+
}
|
983 |
+
}
|
984 |
|
985 |
+
if($to_clear_parents){
|
986 |
+
// to clear cache of homepage
|
987 |
+
$this->deleteHomePageCache();
|
988 |
|
989 |
+
// to clear cache of cats and tags which contains the post (only first page)
|
990 |
+
global $wpdb;
|
991 |
+
$terms = $wpdb->get_results("SELECT * FROM `".$wpdb->prefix."term_relationships` WHERE `object_id`=".$post_id, ARRAY_A);
|
992 |
+
|
993 |
+
foreach ($terms as $term_key => $term_val){
|
994 |
+
$this->delete_cache_of_term($term_val["term_taxonomy_id"]);
|
995 |
+
}
|
996 |
}
|
997 |
}
|
998 |
}
|
1007 |
$path = preg_replace("/https?\:\/\/[^\/]+/i", "", $url);
|
1008 |
$path = trim($path, "/");
|
1009 |
|
1010 |
+
// to remove the cache of tag/cat
|
1011 |
@unlink($this->getWpContentDir()."/cache/all/".$path."/index.html");
|
1012 |
@unlink($this->getWpContentDir()."/cache/wpfc-mobile-cache/".$path."/index.html");
|
1013 |
+
|
1014 |
+
// to remove the cache of the pages
|
1015 |
+
$this->rm_folder_recursively($this->getWpContentDir()."/cache/all/".$path."/page");
|
1016 |
+
$this->rm_folder_recursively($this->getWpContentDir()."/cache/wpfc-mobile-cache/".$path."/page");
|
1017 |
}
|
1018 |
}
|
1019 |
}
|
1650 |
}
|
1651 |
}
|
1652 |
|
1653 |
+
$files_tmp = @scandir($dir);
|
1654 |
+
|
1655 |
+
if(is_dir($dir) && !isset($files_tmp[2])){
|
1656 |
@rmdir($dir);
|
1657 |
}
|
1658 |
|