WP Fastest Cache - Version 0.8.8.9

Version Description

  • to fix url with replacing cdn-url on data-product_variations attribute
  • to increase browser cache time from 3 months to 4 months
  • to fix bug on language dropdown [Details]
  • to increase the value of Cloudflare Browser Cache Expiration to 6 months
  • to exclude Twitterbot user-agent
  • to fix PHP Warning: file_exists(): open_basedir restriction in effect
Download this release

Release Info

Developer emrevona
Plugin Icon 128x128 WP Fastest Cache
Version 0.8.8.9
Comparing to
See all releases

Code changes from version 0.8.8.8 to 0.8.8.9

Files changed (6) hide show
  1. inc/admin.php +30 -27
  2. inc/cache.php +5 -6
  3. inc/cdn.php +1 -1
  4. readme.txt +9 -1
  5. templates/exclude.php +2 -0
  6. wpFastestCache.php +78 -49
inc/admin.php CHANGED
@@ -266,8 +266,8 @@
266
  }
267
  }
268
 
269
- if(!is_dir($this->getWpContentDir()."/cache/all/")){
270
- if (@mkdir($this->getWpContentDir()."/cache/all/", 0755, true)){
271
  //
272
  }else{
273
  array_push($message, "- /wp-content/cache/all/ is needed to be created");
@@ -480,24 +480,24 @@
480
  'AddType application/font-woff2 .woff2'."\n".
481
  'ExpiresActive On'."\n".
482
  'ExpiresDefault A0'."\n".
483
- 'ExpiresByType video/webm A2592000'."\n".
484
- 'ExpiresByType video/ogg A2592000'."\n".
485
- 'ExpiresByType video/mp4 A2592000'."\n".
486
- 'ExpiresByType image/webp A2592000'."\n".
487
- 'ExpiresByType image/gif A2592000'."\n".
488
- 'ExpiresByType image/png A2592000'."\n".
489
- 'ExpiresByType image/jpg A2592000'."\n".
490
- 'ExpiresByType image/jpeg A2592000'."\n".
491
- 'ExpiresByType image/ico A2592000'."\n".
492
- 'ExpiresByType image/svg+xml A2592000'."\n".
493
- 'ExpiresByType text/css A2592000'."\n".
494
- 'ExpiresByType text/javascript A2592000'."\n".
495
- 'ExpiresByType application/javascript A2592000'."\n".
496
- 'ExpiresByType application/x-javascript A2592000'."\n".
497
- 'ExpiresByType application/font-woff2 A2592000'."\n".
498
  '</IfModule>'."\n".
499
  '<IfModule mod_headers.c>'."\n".
500
- 'Header set Expires "max-age=2592000, public"'."\n".
501
  'Header unset ETag'."\n".
502
  'Header set Connection keep-alive'."\n".
503
  'FileETag None'."\n".
@@ -1258,12 +1258,16 @@
1258
  "tr" => "Türkçe"
1259
  );
1260
  foreach($lang_array as $lang_array_key => $lang_array_value){
1261
- if(isset($this->options->wpFastestCacheLanguage) && $this->options->wpFastestCacheLanguage == $lang_array_key){
1262
- $option_selected = 'selected="selected"';
1263
- }else if($lang_array_key == "eng"){
1264
- $option_selected = 'selected="selected"';
 
 
1265
  }else{
1266
- $option_selected = "";
 
 
1267
  }
1268
 
1269
  echo '<option '.$option_selected.' value="'.$lang_array_key.'">'.$lang_array_value.'</option>';
@@ -1348,7 +1352,7 @@
1348
  <div class="questionCon right">
1349
  <div style="padding-left:11px;">
1350
  <label>You can delete all cache files</label><br>
1351
- <label>Target folder</label> <b><?php echo $this->getWpContentDir(); ?>/cache/all</b>
1352
  </div>
1353
  </div>
1354
  </form>
@@ -1362,9 +1366,8 @@
1362
  <div style="padding-left:11px;">
1363
  <label>If you modify any css file, you have to delete minified css files</label><br>
1364
  <label>All cache files will be removed as well</label><br>
1365
- <label>Target folder</label> <b><?php echo $this->getWpContentDir(); ?>/cache/all</b><br>
1366
- <!-- <label>Target folder</label> <b><?php echo $this->getWpContentDir(); ?>/cache/wpfc-mobile-cache</b><br> -->
1367
- <label>Target folder</label> <b><?php echo $this->getWpContentDir(); ?>/cache/wpfc-minified</b>
1368
  </div>
1369
  </div>
1370
  </form>
266
  }
267
  }
268
 
269
+ if(!is_dir($this->getWpContentDir("/cache/all/"))){
270
+ if (@mkdir($this->getWpContentDir("/cache/all/"), 0755, true)){
271
  //
272
  }else{
273
  array_push($message, "- /wp-content/cache/all/ is needed to be created");
480
  'AddType application/font-woff2 .woff2'."\n".
481
  'ExpiresActive On'."\n".
482
  'ExpiresDefault A0'."\n".
483
+ 'ExpiresByType video/webm A10368000'."\n".
484
+ 'ExpiresByType video/ogg A10368000'."\n".
485
+ 'ExpiresByType video/mp4 A10368000'."\n".
486
+ 'ExpiresByType image/webp A10368000'."\n".
487
+ 'ExpiresByType image/gif A10368000'."\n".
488
+ 'ExpiresByType image/png A10368000'."\n".
489
+ 'ExpiresByType image/jpg A10368000'."\n".
490
+ 'ExpiresByType image/jpeg A10368000'."\n".
491
+ 'ExpiresByType image/ico A10368000'."\n".
492
+ 'ExpiresByType image/svg+xml A10368000'."\n".
493
+ 'ExpiresByType text/css A10368000'."\n".
494
+ 'ExpiresByType text/javascript A10368000'."\n".
495
+ 'ExpiresByType application/javascript A10368000'."\n".
496
+ 'ExpiresByType application/x-javascript A10368000'."\n".
497
+ 'ExpiresByType application/font-woff2 A10368000'."\n".
498
  '</IfModule>'."\n".
499
  '<IfModule mod_headers.c>'."\n".
500
+ 'Header set Expires "max-age=A10368000, public"'."\n".
501
  'Header unset ETag'."\n".
502
  'Header set Connection keep-alive'."\n".
503
  'FileETag None'."\n".
1258
  "tr" => "Türkçe"
1259
  );
1260
  foreach($lang_array as $lang_array_key => $lang_array_value){
1261
+ $option_selected = "";
1262
+
1263
+ if(isset($this->options->wpFastestCacheLanguage) && $this->options->wpFastestCacheLanguage && $this->options->wpFastestCacheLanguage != "eng"){
1264
+ if(isset($this->options->wpFastestCacheLanguage) && $this->options->wpFastestCacheLanguage == $lang_array_key){
1265
+ $option_selected = 'selected="selected"';
1266
+ }
1267
  }else{
1268
+ if($lang_array_key == "eng"){
1269
+ $option_selected = 'selected="selected"';
1270
+ }
1271
  }
1272
 
1273
  echo '<option '.$option_selected.' value="'.$lang_array_key.'">'.$lang_array_value.'</option>';
1352
  <div class="questionCon right">
1353
  <div style="padding-left:11px;">
1354
  <label>You can delete all cache files</label><br>
1355
+ <label>Target folder</label> <b><?php echo $this->getWpContentDir("/cache/all"); ?></b>
1356
  </div>
1357
  </div>
1358
  </form>
1366
  <div style="padding-left:11px;">
1367
  <label>If you modify any css file, you have to delete minified css files</label><br>
1368
  <label>All cache files will be removed as well</label><br>
1369
+ <label>Target folder</label> <b><?php echo $this->getWpContentDir("/cache/all"); ?></b><br>
1370
+ <label>Target folder</label> <b><?php echo $this->getWpContentDir("/cache/wpfc-minified"); ?></b>
 
1371
  </div>
1372
  </div>
1373
  </form>
inc/cache.php CHANGED
@@ -81,20 +81,19 @@
81
  if($this->isMobile() && isset($this->options->wpFastestCacheMobile)){
82
  if(class_exists("WpFcMobileCache") && isset($this->options->wpFastestCacheMobileTheme)){
83
  $wpfc_mobile = new WpFcMobileCache();
84
- $this->cacheFilePath = $this->getWpContentDir()."/cache/".$wpfc_mobile->get_folder_name()."".$_SERVER["REQUEST_URI"];
85
  }
86
  }else{
87
  if($this->isPluginActive('gtranslate/gtranslate.php')){
88
  if(isset($_SERVER["HTTP_X_GT_LANG"])){
89
- //$this->cacheFilePath = $this->getWpContentDir()."/cache/all/".$_SERVER["HTTP_X_GT_LANG"];
90
- $this->cacheFilePath = $this->getWpContentDir()."/cache/all/".$_SERVER["HTTP_X_GT_LANG"].$_SERVER["REQUEST_URI"];
91
  }else if(isset($_SERVER["REDIRECT_URL"]) && $_SERVER["REDIRECT_URL"] != "/index.php"){
92
- $this->cacheFilePath = $this->getWpContentDir()."/cache/all/".$_SERVER["REDIRECT_URL"];
93
  }else if(isset($_SERVER["REQUEST_URI"])){
94
- $this->cacheFilePath = $this->getWpContentDir()."/cache/all/".$_SERVER["REQUEST_URI"];
95
  }
96
  }else{
97
- $this->cacheFilePath = $this->getWpContentDir()."/cache/all/".$_SERVER["REQUEST_URI"];
98
  }
99
  }
100
 
81
  if($this->isMobile() && isset($this->options->wpFastestCacheMobile)){
82
  if(class_exists("WpFcMobileCache") && isset($this->options->wpFastestCacheMobileTheme)){
83
  $wpfc_mobile = new WpFcMobileCache();
84
+ $this->cacheFilePath = $this->getWpContentDir("/cache/wpfc-mobile-cache").$_SERVER["REQUEST_URI"];
85
  }
86
  }else{
87
  if($this->isPluginActive('gtranslate/gtranslate.php')){
88
  if(isset($_SERVER["HTTP_X_GT_LANG"])){
89
+ $this->cacheFilePath = $this->getWpContentDir("/cache/all/").$_SERVER["HTTP_X_GT_LANG"].$_SERVER["REQUEST_URI"];
 
90
  }else if(isset($_SERVER["REDIRECT_URL"]) && $_SERVER["REDIRECT_URL"] != "/index.php"){
91
+ $this->cacheFilePath = $this->getWpContentDir("/cache/all/").$_SERVER["REDIRECT_URL"];
92
  }else if(isset($_SERVER["REQUEST_URI"])){
93
+ $this->cacheFilePath = $this->getWpContentDir("/cache/all/").$_SERVER["REQUEST_URI"];
94
  }
95
  }else{
96
+ $this->cacheFilePath = $this->getWpContentDir("/cache/all/").$_SERVER["REQUEST_URI"];
97
  }
98
  }
99
 
inc/cdn.php CHANGED
@@ -77,7 +77,7 @@
77
  "X-Auth-Key" => $key,
78
  "Content-Type" => "application/json"
79
  ),
80
- 'body' => '{"value":2073600}'
81
  );
82
 
83
  $response = wp_remote_request('https://api.cloudflare.com/client/v4/zones/'.$zoneid.'/settings/browser_cache_ttl', $header);
77
  "X-Auth-Key" => $key,
78
  "Content-Type" => "application/json"
79
  ),
80
+ 'body' => '{"value":16070400}'
81
  );
82
 
83
  $response = wp_remote_request('https://api.cloudflare.com/client/v4/zones/'.$zoneid.'/settings/browser_cache_ttl', $header);
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://profiles.wordpress.org/emrevona/
4
  Tags: cache, performance, wp-cache, total cache, super cache, cdn
5
  Requires at least: 3.3
6
  Tested up to: 5.0
7
- Stable tag: 0.8.8.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -103,6 +103,14 @@ Wpfc does not support Wordpress Multisite yet.
103
 
104
  == Changelog ==
105
 
 
 
 
 
 
 
 
 
106
  = 0.8.8.8 =
107
  * to move "cache timeout" to under "delete cache" tab [<a target="_blank" href="https://www.wpfastestcache.com/features/cache-timeout-page/">Details</a>]
108
  * to prevent clearing cache after Ninja Form is submitted
4
  Tags: cache, performance, wp-cache, total cache, super cache, cdn
5
  Requires at least: 3.3
6
  Tested up to: 5.0
7
+ Stable tag: 0.8.8.9
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.8.9 =
107
+ * to fix url with replacing cdn-url on data-product_variations attribute
108
+ * to increase browser cache time from 3 months to 4 months
109
+ * to fix bug on language dropdown [<a target="_blank" href="https://wordpress.org/support/topic/bug-with-language-setting/">Details</a>]
110
+ * to increase the value of Cloudflare Browser Cache Expiration to 6 months
111
+ * to exclude Twitterbot user-agent
112
+ * to fix PHP Warning: file_exists(): open_basedir restriction in effect
113
+
114
  = 0.8.8.8 =
115
  * to move "cache timeout" to under "delete cache" tab [<a target="_blank" href="https://www.wpfastestcache.com/features/cache-timeout-page/">Details</a>]
116
  * to prevent clearing cache after Ninja Form is submitted
templates/exclude.php CHANGED
@@ -458,6 +458,8 @@
458
 
459
  self.add_item(new Date().getTime(), {"type" : "useragent", "prefix" : "contain", "content" : "WhatsApp", "editable" : false});
460
 
 
 
461
 
462
  if(typeof this.rules != "undefined" && this.rules && this.rules.length > 0){
463
  jQuery.each(self.rules, function(i, e){
458
 
459
  self.add_item(new Date().getTime(), {"type" : "useragent", "prefix" : "contain", "content" : "WhatsApp", "editable" : false});
460
 
461
+ self.add_item(new Date().getTime(), {"type" : "useragent", "prefix" : "contain", "content" : "Twitterbot", "editable" : false});
462
+
463
 
464
  if(typeof this.rules != "undefined" && this.rules && this.rules.length > 0){
465
  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.8.8
7
  Author: Emre Vona
8
  Author URI: http://tr.linkedin.com/in/emrevona
9
  Text Domain: wp-fastest-cache
@@ -142,8 +142,8 @@ GNU General Public License for more details.
142
  }
143
 
144
  // to clear /tmpWpfc folder
145
- if(is_dir($this->getWpContentDir()."/cache/tmpWpfc")){
146
- $this->rm_folder_recursively($this->getWpContentDir()."/cache/tmpWpfc");
147
  }
148
 
149
  if($this->isPluginActive('wp-polls/wp-polls.php')){
@@ -582,9 +582,9 @@ GNU General Public License for more details.
582
 
583
  if(isset($url["path"])){
584
  if($url["path"] == "/"){
585
- $this->rm_folder_recursively($this->getWpContentDir()."/cache/all/index.html");
586
  }else{
587
- $this->rm_folder_recursively($this->getWpContentDir()."/cache/all".$url["path"]);
588
  }
589
  }
590
  }
@@ -691,11 +691,11 @@ GNU General Public License for more details.
691
 
692
  $paths = array();
693
 
694
- array_push($paths, $this->getWpContentDir()."/cache/all".$_GET["path"]);
695
 
696
  if(class_exists("WpFcMobileCache")){
697
  $wpfc_mobile = new WpFcMobileCache();
698
- array_push($paths, $this->getWpContentDir()."/cache/".$wpfc_mobile->get_folder_name()."".$_GET["path"]);
699
  }
700
 
701
  foreach ($paths as $key => $value){
@@ -726,8 +726,26 @@ GNU General Public License for more details.
726
  return "wp_fastest_cache";
727
  }
728
 
729
- protected function getWpContentDir(){
730
- return WPFC_WP_CONTENT_DIR;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
731
  }
732
 
733
  protected function getOptions(){
@@ -739,7 +757,7 @@ GNU General Public License for more details.
739
  }
740
 
741
  protected function get_excluded_useragent(){
742
- return "facebookexternalhit|LinkedInBot|WhatsApp|Mediatoolkitbot";
743
  }
744
 
745
  // protected function detectNewPost(){
@@ -752,8 +770,8 @@ GNU General Public License for more details.
752
  $widget_cache_path = $this->getWpContentDir()."/cache/wpfc-widget-cache";
753
 
754
  if(is_dir($widget_cache_path)){
755
- if(!is_dir($this->getWpContentDir()."/cache/tmpWpfc")){
756
- if(@mkdir($this->getWpContentDir()."/cache/tmpWpfc", 0755, true)){
757
  //tmpWpfc has been created
758
  }
759
  }
@@ -881,11 +899,11 @@ GNU General Public License for more details.
881
  if($this->isPluginActive('sitepress-multilingual-cms/sitepress.php')){
882
  $current_language = apply_filters('wpml_current_language', false);
883
 
884
- $path = $this->getWpContentDir()."/cache/all/".$current_language."/".$out[1];
885
- $mobile_path = $this->getWpContentDir()."/cache/wpfc-mobile-cache/".$current_language."/".$out[1];
886
  }else{
887
- $path = $this->getWpContentDir()."/cache/all/".$out[1];
888
- $mobile_path = $this->getWpContentDir()."/cache/wpfc-mobile-cache/".$out[1];
889
  }
890
 
891
  if(is_dir($path)){
@@ -935,12 +953,12 @@ GNU General Public License for more details.
935
  $path = urldecode($path);
936
 
937
  // to remove the cache of tag/cat
938
- @unlink($this->getWpContentDir()."/cache/all/".$path."/index.html");
939
- @unlink($this->getWpContentDir()."/cache/wpfc-mobile-cache/".$path."/index.html");
940
 
941
  // to remove the cache of the pages
942
- $this->rm_folder_recursively($this->getWpContentDir()."/cache/all/".$path."/page");
943
- $this->rm_folder_recursively($this->getWpContentDir()."/cache/wpfc-mobile-cache/".$path."/page");
944
  }
945
 
946
 
@@ -958,12 +976,12 @@ GNU General Public License for more details.
958
  $site_url_path = trim($site_url_path, "/");
959
 
960
  if($site_url_path){
961
- @unlink($this->getWpContentDir()."/cache/all/".$site_url_path."/index.html");
962
- @unlink($this->getWpContentDir()."/cache/wpfc-mobile-cache/".$site_url_path."/index.html");
963
 
964
  //to clear pagination of homepage cache
965
- $this->rm_folder_recursively($this->getWpContentDir()."/cache/all/".$site_url_path."/page");
966
- $this->rm_folder_recursively($this->getWpContentDir()."/cache/wpfc-mobile-cache/".$site_url_path."/page");
967
  }
968
  }
969
 
@@ -971,26 +989,26 @@ GNU General Public License for more details.
971
  $home_url_path = trim($home_url_path, "/");
972
 
973
  if($home_url_path){
974
- @unlink($this->getWpContentDir()."/cache/all/".$home_url_path."/index.html");
975
- @unlink($this->getWpContentDir()."/cache/wpfc-mobile-cache/".$home_url_path."/index.html");
976
 
977
  //to clear pagination of homepage cache
978
- $this->rm_folder_recursively($this->getWpContentDir()."/cache/all/".$home_url_path."/page");
979
- $this->rm_folder_recursively($this->getWpContentDir()."/cache/wpfc-mobile-cache/".$home_url_path."/page");
980
  }
981
  }
982
 
983
- if(file_exists($this->getWpContentDir()."/cache/all/index.html")){
984
- @unlink($this->getWpContentDir()."/cache/all/index.html");
985
  }
986
 
987
- if(file_exists($this->getWpContentDir()."/cache/wpfc-mobile-cache/index.html")){
988
- @unlink($this->getWpContentDir()."/cache/wpfc-mobile-cache/index.html");
989
  }
990
 
991
  //to clear pagination of homepage cache
992
- $this->rm_folder_recursively($this->getWpContentDir()."/cache/all/page");
993
- $this->rm_folder_recursively($this->getWpContentDir()."/cache/wpfc-mobile-cache/page");
994
 
995
 
996
  if($log){
@@ -1013,16 +1031,27 @@ GNU General Public License for more details.
1013
  $cache_deleted = false;
1014
  $minifed_deleted = false;
1015
 
1016
- $cache_path = $this->getWpContentDir()."/cache/all";
1017
  $minified_cache_path = $this->getWpContentDir()."/cache/wpfc-minified";
1018
 
1019
  if(class_exists("WpFcMobileCache")){
1020
- $wpfc_mobile = new WpFcMobileCache();
1021
- $wpfc_mobile->delete_cache($this->getWpContentDir());
 
 
 
 
 
 
 
 
 
 
 
1022
  }
1023
 
1024
- if(!is_dir($this->getWpContentDir()."/cache/tmpWpfc")){
1025
- if(@mkdir($this->getWpContentDir()."/cache/tmpWpfc", 0755, true)){
1026
  $created_tmpWpfc = true;
1027
  }else{
1028
  $created_tmpWpfc = false;
@@ -1140,33 +1169,33 @@ GNU General Public License for more details.
1140
  if($rule->prefix == "all"){
1141
  $this->deleteCache();
1142
  }else if($rule->prefix == "homepage"){
1143
- @unlink($this->getWpContentDir()."/cache/all/index.html");
1144
- @unlink($this->getWpContentDir()."/cache/wpfc-mobile-cache/index.html");
1145
 
1146
  if(isset($this->options->wpFastestCachePreload_homepage) && $this->options->wpFastestCachePreload_homepage){
1147
  $this->wpfc_remote_get(get_option("home"), "WP Fastest Cache Preload Bot - After Cache Timeout");
1148
  $this->wpfc_remote_get(get_option("home"), "WP Fastest Cache Preload iPhone Mobile Bot - After Cache Timeout");
1149
  }
1150
  }else if($rule->prefix == "startwith"){
1151
- if(!is_dir($this->getWpContentDir()."/cache/tmpWpfc")){
1152
- if(@mkdir($this->getWpContentDir()."/cache/tmpWpfc", 0755, true)){}
1153
  }
1154
 
1155
  $rule->content = trim($rule->content, "/");
1156
 
1157
- $files = glob($this->getWpContentDir()."/cache/all/".$rule->content."*");
1158
 
1159
  foreach ((array)$files as $file) {
1160
  $mobile_file = str_replace("/cache/all/", "/cache/wpfc-mobile-cache/", $file);
1161
 
1162
  @rename($file, $this->getWpContentDir()."/cache/tmpWpfc/".time());
1163
- @rename($mobile_file, $this->getWpContentDir()."/cache/tmpWpfc/mobile_".time());
1164
  }
1165
  }else if($rule->prefix == "exact"){
1166
  $rule->content = trim($rule->content, "/");
1167
 
1168
- @unlink($this->getWpContentDir()."/cache/all/".$rule->content."/index.html");
1169
- @unlink($this->getWpContentDir()."/cache/wpfc-mobile-cache/".$rule->content."/index.html");
1170
  }
1171
 
1172
  if($rule->prefix != "all"){
@@ -1555,7 +1584,7 @@ GNU General Public License for more details.
1555
  }
1556
 
1557
  if(preg_match("/data-product_variations\=[\"\'][^\"\']+[\"\']/i", $matches[0])){
1558
- $matches[0] = preg_replace("/(http(s?)\:)?".preg_quote("\/\/", "/")."(www\.)?/i", "", $matches[0]);
1559
  $matches[0] = preg_replace("/".preg_quote($cdn->originurl, "/")."/i", $cdnurl, $matches[0]);
1560
  }else if(preg_match("/\{\"concatemoji\"\:\"[^\"]+\"\}/i", $matches[0])){
1561
  $matches[0] = preg_replace("/(http(s?)\:)?".preg_quote("\/\/", "/")."(www\.)?/i", "", $matches[0]);
@@ -1591,7 +1620,7 @@ GNU General Public License for more details.
1591
  $url = preg_replace("/\?.*/", "", $url);
1592
  $path = preg_replace("/.+\/wp-content\/(.+)/", WPFC_WP_CONTENT_DIR."/"."$1", $url);
1593
 
1594
- if(file_exists($path)){
1595
  $filesize = filesize($path);
1596
 
1597
  if($filesize > 0){
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.9
7
  Author: Emre Vona
8
  Author URI: http://tr.linkedin.com/in/emrevona
9
  Text Domain: wp-fastest-cache
142
  }
143
 
144
  // to clear /tmpWpfc folder
145
+ if(is_dir($this->getWpContentDir("/cache/tmpWpfc"))){
146
+ $this->rm_folder_recursively($this->getWpContentDir("/cache/tmpWpfc"));
147
  }
148
 
149
  if($this->isPluginActive('wp-polls/wp-polls.php')){
582
 
583
  if(isset($url["path"])){
584
  if($url["path"] == "/"){
585
+ $this->rm_folder_recursively($this->getWpContentDir("/cache/all/index.html"));
586
  }else{
587
+ $this->rm_folder_recursively($this->getWpContentDir("/cache/all").$url["path"]);
588
  }
589
  }
590
  }
691
 
692
  $paths = array();
693
 
694
+ array_push($paths, $this->getWpContentDir("/cache/all").$_GET["path"]);
695
 
696
  if(class_exists("WpFcMobileCache")){
697
  $wpfc_mobile = new WpFcMobileCache();
698
+ array_push($paths, $this->getWpContentDir("/cache/wpfc-mobile-cache").$_GET["path"]);
699
  }
700
 
701
  foreach ($paths as $key => $value){
726
  return "wp_fastest_cache";
727
  }
728
 
729
+ protected function getWpContentDir($path = false){
730
+ /*
731
+ Sample Paths;
732
+ /cache/all/
733
+ /cache/all
734
+ /cache/all/page
735
+ /cache/all/index.html
736
+
737
+ /cache/wpfc-mobile-cache/
738
+ /cache/wpfc-mobile-cache/page
739
+ /cache/wpfc-mobile-cache/index.html
740
+
741
+ /cache/tmpWpfc
742
+ /cache/tmpWpfc/mobile_
743
+ */
744
+ if($path){
745
+ return WPFC_WP_CONTENT_DIR.$path;
746
+ }else{
747
+ return WPFC_WP_CONTENT_DIR;
748
+ }
749
  }
750
 
751
  protected function getOptions(){
757
  }
758
 
759
  protected function get_excluded_useragent(){
760
+ return "facebookexternalhit|Twitterbot|LinkedInBot|WhatsApp|Mediatoolkitbot";
761
  }
762
 
763
  // protected function detectNewPost(){
770
  $widget_cache_path = $this->getWpContentDir()."/cache/wpfc-widget-cache";
771
 
772
  if(is_dir($widget_cache_path)){
773
+ if(!is_dir($this->getWpContentDir("/cache/tmpWpfc"))){
774
+ if(@mkdir($this->getWpContentDir("/cache/tmpWpfc"), 0755, true)){
775
  //tmpWpfc has been created
776
  }
777
  }
899
  if($this->isPluginActive('sitepress-multilingual-cms/sitepress.php')){
900
  $current_language = apply_filters('wpml_current_language', false);
901
 
902
+ $path = $this->getWpContentDir("/cache/all/").$current_language."/".$out[1];
903
+ $mobile_path = $this->getWpContentDir("/cache/wpfc-mobile-cache/").$current_language."/".$out[1];
904
  }else{
905
+ $path = $this->getWpContentDir("/cache/all/").$out[1];
906
+ $mobile_path = $this->getWpContentDir("/cache/wpfc-mobile-cache/").$out[1];
907
  }
908
 
909
  if(is_dir($path)){
953
  $path = urldecode($path);
954
 
955
  // to remove the cache of tag/cat
956
+ @unlink($this->getWpContentDir("/cache/all/").$path."/index.html");
957
+ @unlink($this->getWpContentDir("/cache/wpfc-mobile-cache/").$path."/index.html");
958
 
959
  // to remove the cache of the pages
960
+ $this->rm_folder_recursively($this->getWpContentDir("/cache/all/").$path."/page");
961
+ $this->rm_folder_recursively($this->getWpContentDir("/cache/wpfc-mobile-cache/").$path."/page");
962
  }
963
 
964
 
976
  $site_url_path = trim($site_url_path, "/");
977
 
978
  if($site_url_path){
979
+ @unlink($this->getWpContentDir("/cache/all/").$site_url_path."/index.html");
980
+ @unlink($this->getWpContentDir("/cache/wpfc-mobile-cache/").$site_url_path."/index.html");
981
 
982
  //to clear pagination of homepage cache
983
+ $this->rm_folder_recursively($this->getWpContentDir("/cache/all/").$site_url_path."/page");
984
+ $this->rm_folder_recursively($this->getWpContentDir("/cache/wpfc-mobile-cache/").$site_url_path."/page");
985
  }
986
  }
987
 
989
  $home_url_path = trim($home_url_path, "/");
990
 
991
  if($home_url_path){
992
+ @unlink($this->getWpContentDir("/cache/all/").$home_url_path."/index.html");
993
+ @unlink($this->getWpContentDir("/cache/wpfc-mobile-cache/").$home_url_path."/index.html");
994
 
995
  //to clear pagination of homepage cache
996
+ $this->rm_folder_recursively($this->getWpContentDir("/cache/all/").$home_url_path."/page");
997
+ $this->rm_folder_recursively($this->getWpContentDir("/cache/wpfc-mobile-cache/").$home_url_path."/page");
998
  }
999
  }
1000
 
1001
+ if(file_exists($this->getWpContentDir("/cache/all/index.html"))){
1002
+ @unlink($this->getWpContentDir("/cache/all/index.html"));
1003
  }
1004
 
1005
+ if(file_exists($this->getWpContentDir("/cache/wpfc-mobile-cache/index.html"))){
1006
+ @unlink($this->getWpContentDir("/cache/wpfc-mobile-cache/index.html"));
1007
  }
1008
 
1009
  //to clear pagination of homepage cache
1010
+ $this->rm_folder_recursively($this->getWpContentDir("/cache/all/page"));
1011
+ $this->rm_folder_recursively($this->getWpContentDir("/cache/wpfc-mobile-cache/page"));
1012
 
1013
 
1014
  if($log){
1031
  $cache_deleted = false;
1032
  $minifed_deleted = false;
1033
 
1034
+ $cache_path = $this->getWpContentDir("/cache/all");
1035
  $minified_cache_path = $this->getWpContentDir()."/cache/wpfc-minified";
1036
 
1037
  if(class_exists("WpFcMobileCache")){
1038
+
1039
+
1040
+
1041
+
1042
+ if(is_dir($this->getWpContentDir("/cache/wpfc-mobile-cache"))){
1043
+ if(is_dir($this->getWpContentDir("/cache/tmpWpfc"))){
1044
+ rename($this->getWpContentDir("/cache/wpfc-mobile-cache"), $this->getWpContentDir("/cache/tmpWpfc/mobile_").time());
1045
+ }else if(@mkdir($this->getWpContentDir("/cache/tmpWpfc"), 0755, true)){
1046
+ rename($this->getWpContentDir("/cache/wpfc-mobile-cache"), $this->getWpContentDir("/cache/tmpWpfc/mobile_").time());
1047
+ }
1048
+ }
1049
+
1050
+
1051
  }
1052
 
1053
+ if(!is_dir($this->getWpContentDir("/cache/tmpWpfc"))){
1054
+ if(@mkdir($this->getWpContentDir("/cache/tmpWpfc"), 0755, true)){
1055
  $created_tmpWpfc = true;
1056
  }else{
1057
  $created_tmpWpfc = false;
1169
  if($rule->prefix == "all"){
1170
  $this->deleteCache();
1171
  }else if($rule->prefix == "homepage"){
1172
+ @unlink($this->getWpContentDir("/cache/all/index.html"));
1173
+ @unlink($this->getWpContentDir("/cache/wpfc-mobile-cache/index.html"));
1174
 
1175
  if(isset($this->options->wpFastestCachePreload_homepage) && $this->options->wpFastestCachePreload_homepage){
1176
  $this->wpfc_remote_get(get_option("home"), "WP Fastest Cache Preload Bot - After Cache Timeout");
1177
  $this->wpfc_remote_get(get_option("home"), "WP Fastest Cache Preload iPhone Mobile Bot - After Cache Timeout");
1178
  }
1179
  }else if($rule->prefix == "startwith"){
1180
+ if(!is_dir($this->getWpContentDir("/cache/tmpWpfc"))){
1181
+ if(@mkdir($this->getWpContentDir("/cache/tmpWpfc"), 0755, true)){}
1182
  }
1183
 
1184
  $rule->content = trim($rule->content, "/");
1185
 
1186
+ $files = glob($this->getWpContentDir("/cache/all/").$rule->content."*");
1187
 
1188
  foreach ((array)$files as $file) {
1189
  $mobile_file = str_replace("/cache/all/", "/cache/wpfc-mobile-cache/", $file);
1190
 
1191
  @rename($file, $this->getWpContentDir()."/cache/tmpWpfc/".time());
1192
+ @rename($mobile_file, $this->getWpContentDir("/cache/tmpWpfc/mobile_").time());
1193
  }
1194
  }else if($rule->prefix == "exact"){
1195
  $rule->content = trim($rule->content, "/");
1196
 
1197
+ @unlink($this->getWpContentDir("/cache/all/").$rule->content."/index.html");
1198
+ @unlink($this->getWpContentDir("/cache/wpfc-mobile-cache/").$rule->content."/index.html");
1199
  }
1200
 
1201
  if($rule->prefix != "all"){
1584
  }
1585
 
1586
  if(preg_match("/data-product_variations\=[\"\'][^\"\']+[\"\']/i", $matches[0])){
1587
+ $matches[0] = preg_replace("/(quot\;)(http(s?)\:)?".preg_quote("\/\/", "/")."(www\.)?/i", "$1", $matches[0]);
1588
  $matches[0] = preg_replace("/".preg_quote($cdn->originurl, "/")."/i", $cdnurl, $matches[0]);
1589
  }else if(preg_match("/\{\"concatemoji\"\:\"[^\"]+\"\}/i", $matches[0])){
1590
  $matches[0] = preg_replace("/(http(s?)\:)?".preg_quote("\/\/", "/")."(www\.)?/i", "", $matches[0]);
1620
  $url = preg_replace("/\?.*/", "", $url);
1621
  $path = preg_replace("/.+\/wp-content\/(.+)/", WPFC_WP_CONTENT_DIR."/"."$1", $url);
1622
 
1623
+ if(@file_exists($path)){
1624
  $filesize = filesize($path);
1625
 
1626
  if($filesize > 0){