Version Description
- to fix removing the escaped slashes of Cloudflare Integration [Details]
- [FEATURE] Compatible with Fast Velocity Minify
- [FEATURE] Microsoft IIS support
- to serve the sources of Rev Slider if the cdn integration is enabled
- to exclude woocommerce_items_in_cart cookie automatically
- to check wptouch-pro-view cookie
Download this release
Release Info
Developer | emrevona |
Plugin | WP Fastest Cache |
Version | 0.8.8.2 |
Comparing to | |
See all releases |
Code changes from version 0.8.8.1 to 0.8.8.2
- inc/admin.php +7 -6
- inc/cache.php +22 -6
- readme.txt +12 -6
- wpFastestCache.php +44 -25
inc/admin.php
CHANGED
@@ -289,9 +289,9 @@
|
|
289 |
$path = $this->getABSPATH();
|
290 |
}
|
291 |
|
292 |
-
if(isset($_SERVER["SERVER_SOFTWARE"]) && $_SERVER["SERVER_SOFTWARE"] && preg_match("/iis/i", $_SERVER["SERVER_SOFTWARE"])){
|
293 |
-
|
294 |
-
}
|
295 |
|
296 |
// if(isset($_SERVER["SERVER_SOFTWARE"]) && $_SERVER["SERVER_SOFTWARE"] && preg_match("/nginx/i", $_SERVER["SERVER_SOFTWARE"])){
|
297 |
// return array("The plugin does not work with Nginx. Only with Apache", "error");
|
@@ -336,8 +336,6 @@
|
|
336 |
return $res;
|
337 |
}else if($this->isPluginActive('far-future-expiration/far-future-expiration.php')){
|
338 |
return array("Far Future Expiration Plugin", "error");
|
339 |
-
}else if($this->isPluginActive('fast-velocity-minify/fvm.php')){
|
340 |
-
return array("Fast Velocity Minify needs to be deactived", "error");
|
341 |
}else if($this->isPluginActive('sg-cachepress/sg-cachepress.php')){
|
342 |
return array("SG Optimizer needs to be deactived", "error");
|
343 |
}else if($this->isPluginActive('adrotate/adrotate.php') || $this->isPluginActive('adrotate-pro/adrotate.php')){
|
@@ -609,6 +607,9 @@
|
|
609 |
// WeePie Cookie Allow: to serve cache if the cookie named wpca_consent is set
|
610 |
if($this->isPluginActive('wp-cookie-allow/wp-cookie-allow.php')){
|
611 |
$consent_cookie = "RewriteCond %{HTTP:Cookie} wpca_consent=1"."\n";
|
|
|
|
|
|
|
612 |
}
|
613 |
|
614 |
if($this->is_trailing_slash()){
|
@@ -635,7 +636,7 @@
|
|
635 |
"RewriteCond %{QUERY_STRING} !.+"."\n".$loggedInUser.
|
636 |
$consent_cookie.
|
637 |
"RewriteCond %{HTTP:Cookie} !comment_author_"."\n".
|
638 |
-
"RewriteCond %{HTTP:Cookie} !
|
639 |
"RewriteCond %{HTTP:Cookie} !safirmobilswitcher=mobil"."\n".
|
640 |
'RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]'."\n".$mobile;
|
641 |
|
289 |
$path = $this->getABSPATH();
|
290 |
}
|
291 |
|
292 |
+
// if(isset($_SERVER["SERVER_SOFTWARE"]) && $_SERVER["SERVER_SOFTWARE"] && preg_match("/iis/i", $_SERVER["SERVER_SOFTWARE"])){
|
293 |
+
// return array("The plugin does not work with Microsoft IIS. Only with Apache", "error");
|
294 |
+
// }
|
295 |
|
296 |
// if(isset($_SERVER["SERVER_SOFTWARE"]) && $_SERVER["SERVER_SOFTWARE"] && preg_match("/nginx/i", $_SERVER["SERVER_SOFTWARE"])){
|
297 |
// return array("The plugin does not work with Nginx. Only with Apache", "error");
|
336 |
return $res;
|
337 |
}else if($this->isPluginActive('far-future-expiration/far-future-expiration.php')){
|
338 |
return array("Far Future Expiration Plugin", "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')){
|
607 |
// WeePie Cookie Allow: to serve cache if the cookie named wpca_consent is set
|
608 |
if($this->isPluginActive('wp-cookie-allow/wp-cookie-allow.php')){
|
609 |
$consent_cookie = "RewriteCond %{HTTP:Cookie} wpca_consent=1"."\n";
|
610 |
+
$consent_cookie .= "RewriteCond %{HTTP:Cookie} !wpca_cc [OR]"."\n";
|
611 |
+
$consent_cookie .= "RewriteCond %{HTTP:Cookie} wpca_consent=1"."\n";
|
612 |
+
$consent_cookie .= "RewriteCond %{HTTP:Cookie} wpca_cc=functional,analytical,social-media,advertising,other"."\n";
|
613 |
}
|
614 |
|
615 |
if($this->is_trailing_slash()){
|
636 |
"RewriteCond %{QUERY_STRING} !.+"."\n".$loggedInUser.
|
637 |
$consent_cookie.
|
638 |
"RewriteCond %{HTTP:Cookie} !comment_author_"."\n".
|
639 |
+
"RewriteCond %{HTTP:Cookie} !woocommerce_items_in_cart"."\n".
|
640 |
"RewriteCond %{HTTP:Cookie} !safirmobilswitcher=mobil"."\n".
|
641 |
'RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]'."\n".$mobile;
|
642 |
|
inc/cache.php
CHANGED
@@ -224,10 +224,10 @@
|
|
224 |
}
|
225 |
}
|
226 |
|
227 |
-
// to check
|
228 |
foreach ((array)$_COOKIE as $cookie_key => $cookie_value){
|
229 |
-
if(preg_match("/^wp\_woocommerce\_session/", $cookie_key)){
|
230 |
-
|
231 |
ob_start(array($this, "cdn_rewrite"));
|
232 |
|
233 |
return 0;
|
@@ -261,7 +261,7 @@
|
|
261 |
$wpca_enabled = (isset($wpca_settings_general['general_plugin_status']) && $wpca_settings_general['general_plugin_status'] == '1');
|
262 |
|
263 |
if($wpca_enabled){
|
264 |
-
if(!isset($_COOKIE["wpca_consent"]) || (isset($_COOKIE["wpca_consent"]) && $_COOKIE["wpca_consent"] == 0)){
|
265 |
ob_start(array($this, "cdn_rewrite"));
|
266 |
|
267 |
return 0;
|
@@ -275,6 +275,16 @@
|
|
275 |
return 0;
|
276 |
}
|
277 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
278 |
if(preg_match("/\?/", $_SERVER["REQUEST_URI"]) && !preg_match("/\/\?fdx\_switcher\=true/", $_SERVER["REQUEST_URI"])){ // for WP Mobile Edition
|
279 |
if(preg_match("/\?amp(\=1)?/i", $_SERVER["REQUEST_URI"])){
|
280 |
//
|
@@ -578,8 +588,6 @@
|
|
578 |
return $buffer;
|
579 |
}else if($this->is_json($buffer)){
|
580 |
return $buffer;
|
581 |
-
}else if(isset($_COOKIE["wptouch-pro-view"])){
|
582 |
-
return $buffer."<!-- \$_COOKIE['wptouch-pro-view'] has been set -->";
|
583 |
}else if($this->isPasswordProtected($buffer)){
|
584 |
return $buffer."<!-- Password protected content has been detected -->";
|
585 |
}else if($this->isWpLogin($buffer)){
|
@@ -760,12 +768,20 @@
|
|
760 |
public function cdn_rewrite($content){
|
761 |
if($this->cdn){
|
762 |
$content = preg_replace_callback("/(srcset|src|href|data-bg-url|data-lazyload|data-source-url|data-srcsmall|data-srclarge|data-srcfull|data-slide-img|data-lazy-original)\s{0,2}\=[\'\"]([^\'\"]+)[\'\"]/i", array($this, 'cdn_replace_urls'), $content);
|
|
|
763 |
//url()
|
764 |
$content = preg_replace_callback("/(url)\(([^\)\>]+)\)/i", array($this, 'cdn_replace_urls'), $content);
|
|
|
765 |
//{"concatemoji":"http:\/\/your_url.com\/wp-includes\/js\/wp-emoji-release.min.js?ver=4.7"}
|
766 |
$content = preg_replace_callback("/\{\"concatemoji\"\:\"[^\"]+\"\}/i", array($this, 'cdn_replace_urls'), $content);
|
|
|
767 |
//<script>var loaderRandomImages=["https:\/\/www.site.com\/wp-content\/uploads\/2016\/12\/image.jpg"];</script>
|
768 |
$content = preg_replace_callback("/[\"\']([^\'\"]+)[\"\']\s*\:\s*[\"\']https?\:\\\\\/\\\\\/[^\"\']+[\"\']/i", array($this, 'cdn_replace_urls'), $content);
|
|
|
|
|
|
|
|
|
|
|
769 |
}
|
770 |
|
771 |
return $content;
|
224 |
}
|
225 |
}
|
226 |
|
227 |
+
// to check woocommerce_items_in_cart
|
228 |
foreach ((array)$_COOKIE as $cookie_key => $cookie_value){
|
229 |
+
//if(preg_match("/^wp\_woocommerce\_session/", $cookie_key)){
|
230 |
+
if(preg_match("/^woocommerce\_items\_in\_cart/", $cookie_key)){
|
231 |
ob_start(array($this, "cdn_rewrite"));
|
232 |
|
233 |
return 0;
|
261 |
$wpca_enabled = (isset($wpca_settings_general['general_plugin_status']) && $wpca_settings_general['general_plugin_status'] == '1');
|
262 |
|
263 |
if($wpca_enabled){
|
264 |
+
if(!isset($_COOKIE["wpca_consent"]) || (isset($_COOKIE["wpca_consent"]) && $_COOKIE["wpca_consent"] == 0) || (isset($_COOKIE["wpca_cc"]) && $_COOKIE["wpca_cc"] != 'functional,analytical,social-media,advertising,other')){
|
265 |
ob_start(array($this, "cdn_rewrite"));
|
266 |
|
267 |
return 0;
|
275 |
return 0;
|
276 |
}
|
277 |
|
278 |
+
if(isset($_COOKIE) && isset($_COOKIE["wptouch-pro-view"])){
|
279 |
+
if($this->is_wptouch_smartphone()){
|
280 |
+
if($_COOKIE["wptouch-pro-view"] == "desktop"){
|
281 |
+
ob_start(array($this, "cdn_rewrite"));
|
282 |
+
|
283 |
+
return 0;
|
284 |
+
}
|
285 |
+
}
|
286 |
+
}
|
287 |
+
|
288 |
if(preg_match("/\?/", $_SERVER["REQUEST_URI"]) && !preg_match("/\/\?fdx\_switcher\=true/", $_SERVER["REQUEST_URI"])){ // for WP Mobile Edition
|
289 |
if(preg_match("/\?amp(\=1)?/i", $_SERVER["REQUEST_URI"])){
|
290 |
//
|
588 |
return $buffer;
|
589 |
}else if($this->is_json($buffer)){
|
590 |
return $buffer;
|
|
|
|
|
591 |
}else if($this->isPasswordProtected($buffer)){
|
592 |
return $buffer."<!-- Password protected content has been detected -->";
|
593 |
}else if($this->isWpLogin($buffer)){
|
768 |
public function cdn_rewrite($content){
|
769 |
if($this->cdn){
|
770 |
$content = preg_replace_callback("/(srcset|src|href|data-bg-url|data-lazyload|data-source-url|data-srcsmall|data-srclarge|data-srcfull|data-slide-img|data-lazy-original)\s{0,2}\=[\'\"]([^\'\"]+)[\'\"]/i", array($this, 'cdn_replace_urls'), $content);
|
771 |
+
|
772 |
//url()
|
773 |
$content = preg_replace_callback("/(url)\(([^\)\>]+)\)/i", array($this, 'cdn_replace_urls'), $content);
|
774 |
+
|
775 |
//{"concatemoji":"http:\/\/your_url.com\/wp-includes\/js\/wp-emoji-release.min.js?ver=4.7"}
|
776 |
$content = preg_replace_callback("/\{\"concatemoji\"\:\"[^\"]+\"\}/i", array($this, 'cdn_replace_urls'), $content);
|
777 |
+
|
778 |
//<script>var loaderRandomImages=["https:\/\/www.site.com\/wp-content\/uploads\/2016\/12\/image.jpg"];</script>
|
779 |
$content = preg_replace_callback("/[\"\']([^\'\"]+)[\"\']\s*\:\s*[\"\']https?\:\\\\\/\\\\\/[^\"\']+[\"\']/i", array($this, 'cdn_replace_urls'), $content);
|
780 |
+
|
781 |
+
// <script>
|
782 |
+
// jsFileLocation:"//domain.com/wp-content/plugins/revslider/public/assets/js/"
|
783 |
+
// </script>
|
784 |
+
$content = preg_replace_callback("/(jsFileLocation)\s*\:[\"\']([^\"\']+)[\"\']/i", array($this, 'cdn_replace_urls'), $content);
|
785 |
}
|
786 |
|
787 |
return $content;
|
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.9
|
7 |
-
Stable tag: 0.8.8.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -40,8 +40,9 @@ Wpfc does not support Wordpress Multisite yet.
|
|
40 |
9. Enable/Disable cache option for logged-in users
|
41 |
10. SSL support
|
42 |
11. CDN support
|
43 |
-
12.
|
44 |
-
13.
|
|
|
45 |
|
46 |
<h4>Performance Optimization</h4>
|
47 |
|
@@ -102,6 +103,14 @@ Wpfc does not support Wordpress Multisite yet.
|
|
102 |
|
103 |
== Changelog ==
|
104 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
= 0.8.8.1 =
|
106 |
* to update russian translation
|
107 |
* to set browser caching for Cloudflare
|
@@ -744,9 +753,6 @@ Wpfc does not create .htaccess automatically so you need to create empty one.
|
|
744 |
= How is "tmpWpfc" removed? =
|
745 |
When the cached files are deleted, they are moved to "tmpWpfc" instead of being deleted and a cron-job is set. Delete all files are so difficult for server so cron-job is set not to use a lot of CPU resources. Cron-job is set and it deletes 100 files every 5 minutes. When all files in "tmpWpfc" are deleted, cron-job is unset.
|
746 |
|
747 |
-
= How can stop caching for some pages? =
|
748 |
-
If you add <!-- [wpfcNOT] --> into source coude, creating cache stops. You can find it on visual and text editor after opening Add New Post panel.
|
749 |
-
|
750 |
= Does Wpfc work with WPMU (Wordpress Multisite) properly? =
|
751 |
No. Wpfc does not support Wordpress Multisite yet.
|
752 |
|
4 |
Tags: cache, performance, wp-cache, total cache, super cache
|
5 |
Requires at least: 3.3
|
6 |
Tested up to: 4.9
|
7 |
+
Stable tag: 0.8.8.2
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
40 |
9. Enable/Disable cache option for logged-in users
|
41 |
10. SSL support
|
42 |
11. CDN support
|
43 |
+
12. Cloudflare support
|
44 |
+
13. Preload Cache - Create the cache of all the site automatically
|
45 |
+
14. Exclude pages and user-agents
|
46 |
|
47 |
<h4>Performance Optimization</h4>
|
48 |
|
103 |
|
104 |
== Changelog ==
|
105 |
|
106 |
+
= 0.8.8.2 =
|
107 |
+
* to fix removing the escaped slashes of Cloudflare Integration [<a target="_blank" href="https://wordpress.org/support/topic/wpfc-cf-is-stripping-important-code/">Details</a>]
|
108 |
+
* <strong>[FEATURE]</strong> Compatible with Fast Velocity Minify
|
109 |
+
* <strong>[FEATURE]</strong> Microsoft IIS support
|
110 |
+
* to serve the sources of Rev Slider if the cdn integration is enabled
|
111 |
+
* to exclude woocommerce_items_in_cart cookie automatically
|
112 |
+
* to check wptouch-pro-view cookie
|
113 |
+
|
114 |
= 0.8.8.1 =
|
115 |
* to update russian translation
|
116 |
* to set browser caching for Cloudflare
|
753 |
= How is "tmpWpfc" removed? =
|
754 |
When the cached files are deleted, they are moved to "tmpWpfc" instead of being deleted and a cron-job is set. Delete all files are so difficult for server so cron-job is set not to use a lot of CPU resources. Cron-job is set and it deletes 100 files every 5 minutes. When all files in "tmpWpfc" are deleted, cron-job is unset.
|
755 |
|
|
|
|
|
|
|
756 |
= Does Wpfc work with WPMU (Wordpress Multisite) properly? =
|
757 |
No. Wpfc does not support Wordpress Multisite yet.
|
758 |
|
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.8.
|
7 |
Author: Emre Vona
|
8 |
Author URI: http://tr.linkedin.com/in/emrevona
|
9 |
Text Domain: wp-fastest-cache
|
@@ -916,8 +916,13 @@ GNU General Public License for more details.
|
|
916 |
}
|
917 |
}
|
918 |
|
919 |
-
|
920 |
-
|
|
|
|
|
|
|
|
|
|
|
921 |
|
922 |
//to clear pagination of homepage cache
|
923 |
$this->rm_folder_recursively($this->getWpContentDir()."/cache/all/page");
|
@@ -1534,27 +1539,31 @@ GNU General Public License for more details.
|
|
1534 |
}
|
1535 |
|
1536 |
public function rm_folder_recursively($dir, $i = 1) {
|
1537 |
-
|
1538 |
-
|
1539 |
-
|
1540 |
-
|
1541 |
-
|
1542 |
-
|
1543 |
-
|
1544 |
-
|
1545 |
-
|
1546 |
-
|
1547 |
-
|
1548 |
-
|
1549 |
-
|
1550 |
-
|
1551 |
-
|
1552 |
-
|
1553 |
-
|
1554 |
-
|
1555 |
-
|
1556 |
-
if(is_dir($dir)
|
1557 |
-
|
|
|
|
|
|
|
|
|
1558 |
}
|
1559 |
|
1560 |
return true;
|
@@ -1748,6 +1757,10 @@ GNU General Public License for more details.
|
|
1748 |
public function cdn_replace_urls($matches){
|
1749 |
if(count($this->cdn) > 0){
|
1750 |
foreach ($this->cdn as $key => $cdn) {
|
|
|
|
|
|
|
|
|
1751 |
if(preg_match("/manifest\.json\.php/i", $matches[0])){
|
1752 |
return $matches[0];
|
1753 |
}
|
@@ -1771,7 +1784,13 @@ GNU General Public License for more details.
|
|
1771 |
$cdn->file_types = str_replace(",", "|", $cdn->file_types);
|
1772 |
|
1773 |
if(!preg_match("/\.(".$cdn->file_types.")/i", $matches[0])){
|
1774 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1775 |
}
|
1776 |
|
1777 |
if($cdn->keywords){
|
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.8.2
|
7 |
Author: Emre Vona
|
8 |
Author URI: http://tr.linkedin.com/in/emrevona
|
9 |
Text Domain: wp-fastest-cache
|
916 |
}
|
917 |
}
|
918 |
|
919 |
+
if(file_exists($this->getWpContentDir()."/cache/all/index.html")){
|
920 |
+
@unlink($this->getWpContentDir()."/cache/all/index.html");
|
921 |
+
}
|
922 |
+
|
923 |
+
if(file_exists($this->getWpContentDir()."/cache/wpfc-mobile-cache/index.html")){
|
924 |
+
@unlink($this->getWpContentDir()."/cache/wpfc-mobile-cache/index.html");
|
925 |
+
}
|
926 |
|
927 |
//to clear pagination of homepage cache
|
928 |
$this->rm_folder_recursively($this->getWpContentDir()."/cache/all/page");
|
1539 |
}
|
1540 |
|
1541 |
public function rm_folder_recursively($dir, $i = 1) {
|
1542 |
+
if(is_dir($dir)){
|
1543 |
+
$files = @scandir($dir);
|
1544 |
+
foreach((array)$files as $file) {
|
1545 |
+
if($i > 50 && !preg_match("/wp-fastest-cache-premium/i", $dir)){
|
1546 |
+
return true;
|
1547 |
+
}else{
|
1548 |
+
$i++;
|
1549 |
+
}
|
1550 |
+
if ('.' === $file || '..' === $file) continue;
|
1551 |
+
if (is_dir("$dir/$file")){
|
1552 |
+
$this->rm_folder_recursively("$dir/$file", $i);
|
1553 |
+
}else{
|
1554 |
+
if(file_exists("$dir/$file")){
|
1555 |
+
@unlink("$dir/$file");
|
1556 |
+
}
|
1557 |
+
}
|
1558 |
+
}
|
1559 |
+
}
|
1560 |
+
|
1561 |
+
if(is_dir($dir)){
|
1562 |
+
$files_tmp = @scandir($dir);
|
1563 |
+
|
1564 |
+
if(!isset($files_tmp[2])){
|
1565 |
+
@rmdir($dir);
|
1566 |
+
}
|
1567 |
}
|
1568 |
|
1569 |
return true;
|
1757 |
public function cdn_replace_urls($matches){
|
1758 |
if(count($this->cdn) > 0){
|
1759 |
foreach ($this->cdn as $key => $cdn) {
|
1760 |
+
if($cdn->id == "cloudflare"){
|
1761 |
+
//nothing to do
|
1762 |
+
}
|
1763 |
+
|
1764 |
if(preg_match("/manifest\.json\.php/i", $matches[0])){
|
1765 |
return $matches[0];
|
1766 |
}
|
1784 |
$cdn->file_types = str_replace(",", "|", $cdn->file_types);
|
1785 |
|
1786 |
if(!preg_match("/\.(".$cdn->file_types.")/i", $matches[0])){
|
1787 |
+
if(preg_match("/js/", $cdn->file_types)){
|
1788 |
+
if(!preg_match("/\/revslider\/public\/assets\/js/", $matches[0])){
|
1789 |
+
continue;
|
1790 |
+
}
|
1791 |
+
}else{
|
1792 |
+
continue;
|
1793 |
+
}
|
1794 |
}
|
1795 |
|
1796 |
if($cdn->keywords){
|