WP Fastest Cache - Version 0.8.6.7

Version Description

  • to escape spaces in path for htaccess
  • to fix the error of htaccess not writeable warning
  • [FEATURE] WP AMP Accelerated Mobile Pages for WordPress and WooCommerce
  • [FEATURE] to support webp for leverage browser caching
  • [FEATURE] to exclude REST API url which start with /wp-json
  • [FEATURE] Google Fonts Async [Details]
  • [FEATURE] Random option for Photon CDN
Download this release

Release Info

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

Code changes from version 0.8.6.6 to 0.8.6.7

inc/admin.php CHANGED
@@ -341,26 +341,29 @@
341
  }else if($this->isPluginActive('mobilepress/mobilepress.php')){
342
  return $this->warningIncompatible("MobilePress", array("name" => "WPtouch Mobile", "url" => "https://wordpress.org/plugins/wptouch/"));
343
  }else if($this->isPluginActive('speed-booster-pack/speed-booster-pack.php')){
344
- return array("Speed Booster Pack needs to be deactive<br>", "error");
345
  }else if($this->isPluginActive('cdn-enabler/cdn-enabler.php')){
346
- return array("CDN Enabler needs to be deactive<br>This plugin has aldready CDN feature", "error");
347
  }else if($this->isPluginActive('wp-performance-score-booster/wp-performance-score-booster.php')){
348
- return array("WP Performance Score Booster needs to be deactive<br>This plugin has aldready Gzip, Leverage Browser Caching features", "error");
349
  }else if($this->isPluginActive('bwp-minify/bwp-minify.php')){
350
- return array("Better WordPress Minify needs to be deactive<br>This plugin has aldready Minify feature", "error");
351
  }else if($this->isPluginActive('check-and-enable-gzip-compression/richards-toolbox.php')){
352
- return array("Check and Enable GZIP compression needs to be deactive<br>This plugin has aldready Gzip feature", "error");
353
  }else if($this->isPluginActive('gzippy/gzippy.php')){
354
- return array("GZippy needs to be deactive<br>This plugin has aldready Gzip feature", "error");
355
  }else if($this->isPluginActive('gzip-ninja-speed-compression/gzip-ninja-speed.php')){
356
- return array("GZip Ninja Speed Compression needs to be deactive<br>This plugin has aldready Gzip feature", "error");
357
  }else if($this->isPluginActive('wordpress-gzip-compression/ezgz.php')){
358
- return array("WordPress Gzip Compression needs to be deactive<br>This plugin has aldready Gzip feature", "error");
359
  }else if($this->isPluginActive('filosofo-gzip-compression/filosofo-gzip-compression.php')){
360
- return array("GZIP Output needs to be deactive<br>This plugin has aldready Gzip feature", "error");
361
  }else if($this->isPluginActive('head-cleaner/head-cleaner.php')){
362
- return array("Head Cleaner needs to be deactive", "error");
 
 
363
  }else if(is_writable($path.".htaccess")){
 
364
  $htaccess = $this->insertLBCRule($htaccess, $post);
365
  $htaccess = $this->insertGzipRule($htaccess, $post);
366
  $htaccess = $this->insertRewriteRule($htaccess, $post);
@@ -383,15 +386,56 @@
383
  }
384
  }
385
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
386
  public function insertLBCRule($htaccess, $post){
387
  if(isset($post["wpFastestCacheLBC"]) && $post["wpFastestCacheLBC"] == "on"){
388
 
389
 
390
  $data = "# BEGIN LBCWpFastestCache"."\n".
391
- '<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf|x-html|css|xml|js|woff|woff2|ttf|svg|eot)(\.gz)?$">'."\n".
392
  '<IfModule mod_expires.c>'."\n".
393
  'ExpiresActive On'."\n".
394
  'ExpiresDefault A0'."\n".
 
395
  'ExpiresByType image/gif A2592000'."\n".
396
  'ExpiresByType image/png A2592000'."\n".
397
  'ExpiresByType image/jpg A2592000'."\n".
@@ -557,7 +601,10 @@
557
  $data = $data."RewriteCond %{DOCUMENT_ROOT}/".WPFC_WP_CONTENT_BASENAME."/cache/all/$1/index.html -f"."\n";
558
  }else{
559
  $data = $data."RewriteCond %{DOCUMENT_ROOT}/".WPFC_WP_CONTENT_BASENAME."/cache/all/$1/index.html -f [or]"."\n";
560
- $data = $data."RewriteCond ".WPFC_WP_CONTENT_DIR."/cache/all/".$this->getRewriteBase(true)."$1/index.html -f"."\n";
 
 
 
561
  }
562
 
563
  $data = $data.'RewriteRule ^(.*) "/'.$this->getRewriteBase().WPFC_WP_CONTENT_BASENAME.'/cache/all/'.$this->getRewriteBase(true).'$1/index.html" [L]'."\n";
@@ -712,6 +759,7 @@
712
  $this->systemMessage = count($this->systemMessage) > 0 ? $this->systemMessage : $this->getSystemMessage();
713
 
714
  $wpFastestCacheCombineCss = isset($this->options->wpFastestCacheCombineCss) ? 'checked="checked"' : "";
 
715
  $wpFastestCacheGzip = isset($this->options->wpFastestCacheGzip) ? 'checked="checked"' : "";
716
  $wpFastestCacheCombineJs = isset($this->options->wpFastestCacheCombineJs) ? 'checked="checked"' : "";
717
  $wpFastestCacheCombineJsPowerFul = isset($this->options->wpFastestCacheCombineJsPowerFul) ? 'checked="checked"' : "";
@@ -808,17 +856,54 @@
808
  </div>
809
 
810
 
 
 
811
  <?php
812
 
813
  $tester_arr = array(
 
814
  "berkatan.com",
 
815
  );
816
 
817
  if(in_array(get_bloginfo('language'), $tester_arr) || in_array(str_replace("www.", "", $_SERVER["HTTP_HOST"]), $tester_arr)){ ?>
818
- <div class="questionCon">
819
- <div class="question">Widget Cache</div>
820
- <div class="inputCon"><input type="checkbox" <?php echo $wpFastestCacheWidgetCache; ?> id="wpFastestCacheWidgetCache" name="wpFastestCacheWidgetCache"><label for="wpFastestCacheWidgetCache">Reduce the number of SQL queries</label></div>
821
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
822
  <?php } ?>
823
 
824
 
@@ -860,6 +945,7 @@
860
  "canliradyodinle.life",
861
  "canlitvturk.org",
862
  "haftahaftahamilelik.gen.tr",
 
863
  "canliradyodinle.fm"
864
  );
865
 
@@ -1024,6 +1110,41 @@
1024
  </div>
1025
  <?php } ?>
1026
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1027
  <?php
1028
 
1029
  $tester_arr = array(
341
  }else if($this->isPluginActive('mobilepress/mobilepress.php')){
342
  return $this->warningIncompatible("MobilePress", array("name" => "WPtouch Mobile", "url" => "https://wordpress.org/plugins/wptouch/"));
343
  }else if($this->isPluginActive('speed-booster-pack/speed-booster-pack.php')){
344
+ return array("Speed Booster Pack needs to be deactivated<br>", "error");
345
  }else if($this->isPluginActive('cdn-enabler/cdn-enabler.php')){
346
+ return array("CDN Enabler needs to be deactivated<br>This plugin has aldready CDN feature", "error");
347
  }else if($this->isPluginActive('wp-performance-score-booster/wp-performance-score-booster.php')){
348
+ return array("WP Performance Score Booster needs to be deactivated<br>This plugin has aldready Gzip, Leverage Browser Caching features", "error");
349
  }else if($this->isPluginActive('bwp-minify/bwp-minify.php')){
350
+ return array("Better WordPress Minify needs to be deactivated<br>This plugin has aldready Minify feature", "error");
351
  }else if($this->isPluginActive('check-and-enable-gzip-compression/richards-toolbox.php')){
352
+ return array("Check and Enable GZIP compression needs to be deactivated<br>This plugin has aldready Gzip feature", "error");
353
  }else if($this->isPluginActive('gzippy/gzippy.php')){
354
+ return array("GZippy needs to be deactivated<br>This plugin has aldready Gzip feature", "error");
355
  }else if($this->isPluginActive('gzip-ninja-speed-compression/gzip-ninja-speed.php')){
356
+ return array("GZip Ninja Speed Compression needs to be deactivated<br>This plugin has aldready Gzip feature", "error");
357
  }else if($this->isPluginActive('wordpress-gzip-compression/ezgz.php')){
358
+ return array("WordPress Gzip Compression needs to be deactivated<br>This plugin has aldready Gzip feature", "error");
359
  }else if($this->isPluginActive('filosofo-gzip-compression/filosofo-gzip-compression.php')){
360
+ return array("GZIP Output needs to be deactivated<br>This plugin has aldready Gzip feature", "error");
361
  }else if($this->isPluginActive('head-cleaner/head-cleaner.php')){
362
+ return array("Head Cleaner needs to be deactivated", "error");
363
+ }else if($this->isPluginActive('far-future-expiry-header/far-future-expiration.php')){
364
+ return array("Far Future Expiration Plugin needs to be deactivated", "error");
365
  }else if(is_writable($path.".htaccess")){
366
+ $htaccess = $this->insertWebp($htaccess);
367
  $htaccess = $this->insertLBCRule($htaccess, $post);
368
  $htaccess = $this->insertGzipRule($htaccess, $post);
369
  $htaccess = $this->insertRewriteRule($htaccess, $post);
386
  }
387
  }
388
 
389
+ public function insertWebp($htaccess){
390
+ $tester_arr = array(
391
+ //"tr-TR",
392
+ "berkatan.com",
393
+ "pembeportakal.com",
394
+ "wpfastestcache.com",
395
+ "zamknijkonto.pl",
396
+ "devv.zamknijkonto.pl",
397
+ "goldsgym.nl"
398
+ );
399
+
400
+ if(in_array(get_bloginfo('language'), $tester_arr) || in_array(str_replace("www.", "", $_SERVER["HTTP_HOST"]), $tester_arr)){
401
+ $data = "# BEGIN WEBPWpFastestCache"."\n".
402
+ "<IfModule mod_rewrite.c>"."\n".
403
+ "RewriteEngine On"."\n".
404
+ "RewriteCond %{HTTP_ACCEPT} image/webp"."\n".
405
+ "RewriteCond %{REQUEST_URI} jpg|png"."\n".
406
+ "RewriteCond %{DOCUMENT_ROOT}/$1.webp -f"."\n".
407
+ "RewriteRule ^(.*) \"/$1.webp\" [L]"."\n".
408
+ "</IfModule>"."\n".
409
+ "<IfModule mod_headers.c>"."\n".
410
+ "Header append Vary Accept env=REDIRECT_accept"."\n".
411
+ "Header set Expires \"max-age=2592000, public\""."\n".
412
+ "Header unset ETag"."\n".
413
+ "Header set Connection keep-alive"."\n".
414
+ "FileETag None"."\n".
415
+ "</IfModule>"."\n".
416
+ "AddType image/webp .webp"."\n".
417
+ "# END WEBPWpFastestCache"."\n";
418
+
419
+ if(!preg_match("/BEGIN\s*WEBPWpFastestCache/", $htaccess)){
420
+ $htaccess = $data.$htaccess;
421
+ }
422
+
423
+ return $htaccess;
424
+ }else{
425
+ return $htaccess;
426
+ }
427
+ }
428
+
429
  public function insertLBCRule($htaccess, $post){
430
  if(isset($post["wpFastestCacheLBC"]) && $post["wpFastestCacheLBC"] == "on"){
431
 
432
 
433
  $data = "# BEGIN LBCWpFastestCache"."\n".
434
+ '<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|webp|js|css|swf|x-html|css|xml|js|woff|woff2|ttf|svg|eot)(\.gz)?$">'."\n".
435
  '<IfModule mod_expires.c>'."\n".
436
  'ExpiresActive On'."\n".
437
  'ExpiresDefault A0'."\n".
438
+ 'ExpiresByType image/webp A2592000'."\n".
439
  'ExpiresByType image/gif A2592000'."\n".
440
  'ExpiresByType image/png A2592000'."\n".
441
  'ExpiresByType image/jpg A2592000'."\n".
601
  $data = $data."RewriteCond %{DOCUMENT_ROOT}/".WPFC_WP_CONTENT_BASENAME."/cache/all/$1/index.html -f"."\n";
602
  }else{
603
  $data = $data."RewriteCond %{DOCUMENT_ROOT}/".WPFC_WP_CONTENT_BASENAME."/cache/all/$1/index.html -f [or]"."\n";
604
+ // to escape spaces
605
+ $tmp_WPFC_WP_CONTENT_DIR = str_replace(" ", "\ ", WPFC_WP_CONTENT_DIR);
606
+
607
+ $data = $data."RewriteCond ".$tmp_WPFC_WP_CONTENT_DIR."/cache/all/".$this->getRewriteBase(true)."$1/index.html -f"."\n";
608
  }
609
 
610
  $data = $data.'RewriteRule ^(.*) "/'.$this->getRewriteBase().WPFC_WP_CONTENT_BASENAME.'/cache/all/'.$this->getRewriteBase(true).'$1/index.html" [L]'."\n";
759
  $this->systemMessage = count($this->systemMessage) > 0 ? $this->systemMessage : $this->getSystemMessage();
760
 
761
  $wpFastestCacheCombineCss = isset($this->options->wpFastestCacheCombineCss) ? 'checked="checked"' : "";
762
+ $wpFastestCacheGoogleFonts = isset($this->options->wpFastestCacheGoogleFonts) ? 'checked="checked"' : "";
763
  $wpFastestCacheGzip = isset($this->options->wpFastestCacheGzip) ? 'checked="checked"' : "";
764
  $wpFastestCacheCombineJs = isset($this->options->wpFastestCacheCombineJs) ? 'checked="checked"' : "";
765
  $wpFastestCacheCombineJsPowerFul = isset($this->options->wpFastestCacheCombineJsPowerFul) ? 'checked="checked"' : "";
856
  </div>
857
 
858
 
859
+
860
+
861
  <?php
862
 
863
  $tester_arr = array(
864
+ "tr-TR",
865
  "berkatan.com",
866
+ "hciwla.org"
867
  );
868
 
869
  if(in_array(get_bloginfo('language'), $tester_arr) || in_array(str_replace("www.", "", $_SERVER["HTTP_HOST"]), $tester_arr)){ ?>
870
+
871
+
872
+
873
+ <?php if(class_exists("WpFastestCachePowerfulHtml")){ ?>
874
+ <?php if(file_exists(WPFC_WP_CONTENT_DIR."/plugins/wp-fastest-cache-premium/pro/library/widget-cache.php")){ ?>
875
+ <?php include_once WPFC_WP_CONTENT_DIR."/plugins/wp-fastest-cache-premium/pro/library/widget-cache.php"; ?>
876
+
877
+ <?php if(class_exists("WpfcWidgetCache") && method_exists("WpfcWidgetCache", "add_filter_admin")){ ?>
878
+ <div class="questionCon">
879
+ <div class="question">Widget Cache</div>
880
+ <div class="inputCon"><input type="checkbox" <?php echo $wpFastestCacheWidgetCache; ?> id="wpFastestCacheWidgetCache" name="wpFastestCacheWidgetCache"><label for="wpFastestCacheWidgetCache">Reduce the number of SQL queries</label></div>
881
+ <div class="get-info"><a target="_blank" href="http://www.wpfastestcache.com/premium/widget-cache-reduce-the-number-of-sql-queries/"><img src="<?php echo plugins_url("wp-fastest-cache/images/info.png"); ?>" /></a></div>
882
+ </div>
883
+ <?php }else{ ?>
884
+ <div class="questionCon update-needed">
885
+ <div class="question">Widget Cache</div>
886
+ <div class="inputCon"><input type="checkbox" <?php echo $wpFastestCacheWidgetCache; ?> id="wpFastestCacheWidgetCache"><label for="wpFastestCacheWidgetCache">Reduce the number of SQL queries</label></div>
887
+ <div class="get-info"><a target="_blank" href="http://www.wpfastestcache.com/premium/widget-cache-reduce-the-number-of-sql-queries/"><img src="<?php echo plugins_url("wp-fastest-cache/images/info.png"); ?>" /></a></div>
888
+ </div>
889
+ <?php } ?>
890
+ <?php }else{ ?>
891
+ <div class="questionCon update-needed">
892
+ <div class="question">Widget Cache</div>
893
+ <div class="inputCon"><input type="checkbox" <?php echo $wpFastestCacheWidgetCache; ?> id="wpFastestCacheWidgetCache"><label for="wpFastestCacheWidgetCache">Reduce the number of SQL queries</label></div>
894
+ <div class="get-info"><a target="_blank" href="http://www.wpfastestcache.com/premium/widget-cache-reduce-the-number-of-sql-queries/"><img src="<?php echo plugins_url("wp-fastest-cache/images/info.png"); ?>" /></a></div>
895
+ </div>
896
+ <?php } ?>
897
+ <?php }else{ ?>
898
+ <div class="questionCon disabled">
899
+ <div class="question">Widget Cache</div>
900
+ <div class="inputCon"><input type="checkbox" <?php echo $wpFastestCacheWidgetCache; ?> id="wpFastestCacheWidgetCache"><label for="wpFastestCacheWidgetCache">Reduce the number of SQL queries</label></div>
901
+ <div class="get-info"><a target="_blank" href="http://www.wpfastestcache.com/premium/widget-cache-reduce-the-number-of-sql-queries/"><img src="<?php echo plugins_url("wp-fastest-cache/images/info.png"); ?>" /></a></div>
902
+ </div>
903
+ <?php } ?>
904
+
905
+
906
+
907
  <?php } ?>
908
 
909
 
945
  "canliradyodinle.life",
946
  "canlitvturk.org",
947
  "haftahaftahamilelik.gen.tr",
948
+ "tooxclusive.com",
949
  "canliradyodinle.fm"
950
  );
951
 
1110
  </div>
1111
  <?php } ?>
1112
 
1113
+
1114
+
1115
+
1116
+
1117
+ <?php if(class_exists("WpFastestCachePowerfulHtml")){ ?>
1118
+ <?php if(method_exists("WpFastestCachePowerfulHtml", "google_fonts")){ ?>
1119
+ <div class="questionCon">
1120
+ <div class="question">Google Fonts</div>
1121
+ <div class="inputCon"><input type="checkbox" <?php echo $wpFastestCacheGoogleFonts; ?> id="wpFastestCacheGoogleFonts" name="wpFastestCacheGoogleFonts"><label for="wpFastestCacheGoogleFonts">Load Google Fonts asynchronously </label></div>
1122
+ <div class="get-info"><a target="_blank" href="http://www.wpfastestcache.com/premium/google-fonts-optimize-css-delivery/"><img src="<?php echo plugins_url("wp-fastest-cache/images/info.png"); ?>" /></a></div>
1123
+ </div>
1124
+ <?php }else{ ?>
1125
+ <div class="questionCon update-needed">
1126
+ <div class="question">Google Fonts</div>
1127
+ <div class="inputCon"><input type="checkbox" id="wpFastestCacheGoogleFonts" name="wpFastestCacheGoogleFonts"><label for="wpFastestCacheGoogleFonts">Load Google Fonts asynchronously</label></div>
1128
+ <div class="get-info"><a target="_blank" href="http://www.wpfastestcache.com/premium/google-fonts-optimize-css-delivery/"><img src="<?php echo plugins_url("wp-fastest-cache/images/info.png"); ?>" /></a></div>
1129
+ </div>
1130
+ <?php } ?>
1131
+ <?php }else{ ?>
1132
+ <div class="questionCon disabled">
1133
+ <div class="question">Google Fonts</div>
1134
+ <div class="inputCon"><input type="checkbox" id="wpFastestCacheGoogleFonts" name="wpFastestCacheGoogleFonts"><label for="wpFastestCacheGoogleFonts">Load Google Fonts asynchronously</label></div>
1135
+ <div class="get-info"><a target="_blank" href="http://www.wpfastestcache.com/premium/google-fonts-optimize-css-delivery/"><img src="<?php echo plugins_url("wp-fastest-cache/images/info.png"); ?>" /></a></div>
1136
+ </div>
1137
+ <?php } ?>
1138
+
1139
+
1140
+
1141
+
1142
+
1143
+
1144
+
1145
+
1146
+
1147
+
1148
  <?php
1149
 
1150
  $tester_arr = array(
inc/cache.php CHANGED
@@ -362,6 +362,18 @@
362
  return false;
363
  }
364
 
 
 
 
 
 
 
 
 
 
 
 
 
365
  public function is_xml($buffer){
366
  if(preg_match("/^\s*\<\?xml/i", $buffer)){
367
  return true;
@@ -385,7 +397,7 @@
385
  return $buffer;
386
  }else if (is_user_logged_in() || $this->isCommenter()){
387
  return $buffer;
388
- } else if(isset($_SERVER["HTTP_ACCEPT"]) && preg_match("/json/i", $_SERVER["HTTP_ACCEPT"])){
389
  return $buffer;
390
  }else if(isset($_COOKIE["wptouch-pro-view"])){
391
  return $buffer."<!-- \$_COOKIE['wptouch-pro-view'] has been set -->";
@@ -505,7 +517,7 @@
505
  $content = $this->minify($content);
506
 
507
  if($this->cdn){
508
- $content = preg_replace_callback("/(srcset|src|href|data-lazyload)\=[\'\"]([^\'\"]+)[\'\"]/i", array($this, 'cdn_replace_urls'), $content);
509
  // url()
510
  $content = preg_replace_callback("/(url)\(([^\)]+)\)/i", array($this, 'cdn_replace_urls'), $content);
511
  // {"concatemoji":"http:\/\/your_url.com\/wp-includes\/js\/wp-emoji-release.min.js?ver=4.7"}
@@ -689,12 +701,9 @@
689
  public function is_amp($content){
690
  $request_uri = trim($_SERVER["REQUEST_URI"], "/");
691
 
692
- // https://wordpress.org/plugins/amp/
693
- if($this->isPluginActive('amp/amp.php')){
694
- if(preg_match("/amp$/", $request_uri)){
695
- if(preg_match("/<html[^\>]+amp[^\>]*>/i", $content)){
696
- return true;
697
- }
698
  }
699
  }
700
 
362
  return false;
363
  }
364
 
365
+ public function is_json(){
366
+ if(isset($_SERVER["HTTP_ACCEPT"]) && preg_match("/json/i", $_SERVER["HTTP_ACCEPT"])){
367
+ return true;
368
+ }
369
+
370
+ if(preg_match("/^\/wp-json/", $_SERVER["REQUEST_URI"])){
371
+ return true;
372
+ }
373
+
374
+ return false;
375
+ }
376
+
377
  public function is_xml($buffer){
378
  if(preg_match("/^\s*\<\?xml/i", $buffer)){
379
  return true;
397
  return $buffer;
398
  }else if (is_user_logged_in() || $this->isCommenter()){
399
  return $buffer;
400
+ }else if($this->is_json()){
401
  return $buffer;
402
  }else if(isset($_COOKIE["wptouch-pro-view"])){
403
  return $buffer."<!-- \$_COOKIE['wptouch-pro-view'] has been set -->";
517
  $content = $this->minify($content);
518
 
519
  if($this->cdn){
520
+ $content = preg_replace_callback("/(srcset|src|href|data-lazyload)\s{0,2}\=[\'\"]([^\'\"]+)[\'\"]/i", array($this, 'cdn_replace_urls'), $content);
521
  // url()
522
  $content = preg_replace_callback("/(url)\(([^\)]+)\)/i", array($this, 'cdn_replace_urls'), $content);
523
  // {"concatemoji":"http:\/\/your_url.com\/wp-includes\/js\/wp-emoji-release.min.js?ver=4.7"}
701
  public function is_amp($content){
702
  $request_uri = trim($_SERVER["REQUEST_URI"], "/");
703
 
704
+ if(preg_match("/amp$/", $request_uri)){
705
+ if(preg_match("/<html[^\>]+amp[^\>]*>/i", $content)){
706
+ return true;
 
 
 
707
  }
708
  }
709
 
inc/wp-polls.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class WpPollsForWpFc{
3
+ public function __construct(){
4
+
5
+ }
6
+
7
+ public function hook(){
8
+ add_action( 'wp_ajax_nopriv_wpfc_wppolls_ajax_request', array($this, "wpfc_wppolls_ajax_request"));
9
+ add_action( 'wp_ajax_wpfc_wppolls_ajax_request', array($this, "wpfc_wppolls_ajax_request"));
10
+ add_action( 'wp_footer', array($this, "wpfc_wp_polls") );
11
+
12
+ }
13
+
14
+ public function wpfc_wp_polls() { ?>
15
+ <script type="text/javascript">
16
+ jQuery(document).ready(function(){
17
+ var wpfcWpfcAjaxCall = function(polls){
18
+ if(polls.length > 0){
19
+ poll_id = polls.last().attr('id').match(/\d+/)[0];
20
+
21
+ jQuery.ajax({
22
+ type: 'POST',
23
+ url: pollsL10n.ajax_url,
24
+ dataType : "json",
25
+ data : {"action": "wpfc_wppolls_ajax_request", "poll_id": poll_id, "nonce" : "<?php echo wp_create_nonce('wpfcpoll'); ?>"},
26
+ cache: false,
27
+ success: function(data){
28
+ if(data === true){
29
+ poll_result(poll_id);
30
+ }else if(data === false){
31
+ poll_booth(poll_id);
32
+ }
33
+ polls.length = polls.length - 1;
34
+
35
+ setTimeout(function(){
36
+ wpfcWpfcAjaxCall(polls);
37
+ }, 1000);
38
+ }
39
+ });
40
+ }
41
+ };
42
+
43
+ var polls = jQuery('div[id^=\"polls-\"][id$=\"-loading\"]');
44
+ wpfcWpfcAjaxCall(polls);
45
+ });
46
+ </script><?php
47
+ }
48
+
49
+ public function wpfc_wppolls_ajax_request(){
50
+ if(wp_verify_nonce(esc_attr($_POST["nonce"]), 'wpfcpoll')){
51
+ $result = check_voted(esc_attr($_POST["poll_id"]));
52
+
53
+ if($result){
54
+ die("true");
55
+ }else{
56
+ die("false");
57
+ }
58
+ }else{
59
+ die("Expired: wpfcpoll");
60
+ }
61
+ }
62
+ }
63
+ ?>
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: emrevona
3
  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.7.2
7
- Stable tag: 0.8.6.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -101,9 +101,18 @@ Wpfc does not support Wordpress Multisite yet.
101
 
102
  == Changelog ==
103
 
 
 
 
 
 
 
 
 
 
104
  = 0.8.6.6 =
105
  * to make compatible with the new rules of wordpress
106
- * <strong>[FEATURE]</strong> Database Cleanup
107
  * to decode URLs in non-latin languages for singleDeleteCache()
108
  * to change the method of the premium update <a href="http://www.wpfastestcache.com/blog/premium-update-before-v1-3-6/">Details</a>
109
 
3
  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.7.3
7
+ Stable tag: 0.8.6.7
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.6.7 =
105
+ * to escape spaces in path for htaccess
106
+ * to fix the error of htaccess not writeable warning
107
+ * <strong>[FEATURE]</strong> WP AMP — Accelerated Mobile Pages for WordPress and WooCommerce
108
+ * <strong>[FEATURE]</strong> to support webp for leverage browser caching
109
+ * <strong>[FEATURE]</strong> to exclude REST API url which start with /wp-json
110
+ * <strong>[FEATURE]</strong> Google Fonts Async [<a target="_blank" href="http://www.wpfastestcache.com/premium/google-fonts-optimize-css-delivery/">Details</a>]
111
+ * <strong>[FEATURE]</strong> Random option for Photon CDN
112
+
113
  = 0.8.6.6 =
114
  * to make compatible with the new rules of wordpress
115
+ * <strong>[FEATURE]</strong> Database Cleanup [<a target="_blank" href="http://www.wpfastestcache.com/premium/database-cleanup-speed-up-databases/">Details</a>]
116
  * to decode URLs in non-latin languages for singleDeleteCache()
117
  * to change the method of the premium update <a href="http://www.wpfastestcache.com/blog/premium-update-before-v1-3-6/">Details</a>
118
 
templates/cdn/photon.php CHANGED
@@ -39,6 +39,7 @@
39
  <option value="http://i1.wp.com/<?php echo str_replace("www.", "", $_SERVER["HTTP_HOST"]); ?>">http://i1.wp.com</option>
40
  <option value="http://i2.wp.com/<?php echo str_replace("www.", "", $_SERVER["HTTP_HOST"]); ?>">http://i2.wp.com</option>
41
  <option value="http://i3.wp.com/<?php echo str_replace("www.", "", $_SERVER["HTTP_HOST"]); ?>">http://i3.wp.com</option>
 
42
  </select>
43
  <div id="cdn-url-loading"></div>
44
  <label class="wiz-error-msg"></label>
39
  <option value="http://i1.wp.com/<?php echo str_replace("www.", "", $_SERVER["HTTP_HOST"]); ?>">http://i1.wp.com</option>
40
  <option value="http://i2.wp.com/<?php echo str_replace("www.", "", $_SERVER["HTTP_HOST"]); ?>">http://i2.wp.com</option>
41
  <option value="http://i3.wp.com/<?php echo str_replace("www.", "", $_SERVER["HTTP_HOST"]); ?>">http://i3.wp.com</option>
42
+ <option value="random">Random</option>
43
  </select>
44
  <div id="cdn-url-loading"></div>
45
  <label class="wiz-error-msg"></label>
templates/updatepost.php CHANGED
@@ -48,7 +48,8 @@
48
  <label class="mc-input-label" style="margin-right: 5px;"><input type="radio" <?php echo $wpFastestCacheUpdatePost_type_post; ?> action-id="wpFastestCacheUpdatePost_type_post" id="wpFastestCacheUpdatePost_type_post" name="wpFastestCacheUpdatePost_type" value="post"></label>
49
  <label for="wpFastestCacheUpdatePost_type_post">Clear Cache of Post / Page</label><br>
50
  <label style="margin-left:24px;" for="wpFastestCacheUpdatePost_type_post">Clear Cache of Post Categories</label><br>
51
- <label style="margin-left:24px;" for="wpFastestCacheUpdatePost_type_post">Clear Cache of Post Tags</label>
 
52
  </div>
53
  <div class="wiz-input-cont">
54
  <label class="mc-input-label" style="margin-right: 5px;"><input type="radio" <?php echo $wpFastestCacheUpdatePost_type_all; ?> action-id="wpFastestCacheUpdatePost_type_all" id="wpFastestCacheUpdatePost_type_all" name="wpFastestCacheUpdatePost_type" value="all"></label>
48
  <label class="mc-input-label" style="margin-right: 5px;"><input type="radio" <?php echo $wpFastestCacheUpdatePost_type_post; ?> action-id="wpFastestCacheUpdatePost_type_post" id="wpFastestCacheUpdatePost_type_post" name="wpFastestCacheUpdatePost_type" value="post"></label>
49
  <label for="wpFastestCacheUpdatePost_type_post">Clear Cache of Post / Page</label><br>
50
  <label style="margin-left:24px;" for="wpFastestCacheUpdatePost_type_post">Clear Cache of Post Categories</label><br>
51
+ <label style="margin-left:24px;" for="wpFastestCacheUpdatePost_type_post">Clear Cache of Post Tags</label><br>
52
+ <label style="margin-left:24px;" for="wpFastestCacheUpdatePost_type_post">Clear Cache of Homepage</label>
53
  </div>
54
  <div class="wiz-input-cont">
55
  <label class="mc-input-label" style="margin-right: 5px;"><input type="radio" <?php echo $wpFastestCacheUpdatePost_type_all; ?> action-id="wpFastestCacheUpdatePost_type_all" id="wpFastestCacheUpdatePost_type_all" name="wpFastestCacheUpdatePost_type" value="all"></label>
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.6.6
7
  Author: Emre Vona
8
  Author URI: http://tr.linkedin.com/in/emrevona
9
  Text Domain: wp-fastest-cache
@@ -20,8 +20,8 @@ This program is distributed in the hope that it will be useful,
20
  but WITHOUT ANY WARRANTY; without even the implied warranty of
21
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
  GNU General Public License for more details.
23
- */
24
- // test
25
  if (!defined('WPFC_WP_CONTENT_BASENAME')) {
26
  if (!defined('WPFC_WP_PLUGIN_DIR')) {
27
  if(preg_match("/(\/trunk\/|\/wp-fastest-cache\/)$/", plugin_dir_path( __FILE__ ))){
@@ -88,9 +88,12 @@ GNU General Public License for more details.
88
  $this->rm_folder_recursively($this->getWpContentDir()."/cache/tmpWpfc");
89
  }
90
 
91
-
92
-
93
-
 
 
 
94
 
95
  if(isset($_GET) && isset($_GET["action"]) && in_array($_GET["action"], $optimize_image_ajax_requests)){
96
  if($this->isPluginActive("wp-fastest-cache-premium/wpFastestCachePremium.php")){
@@ -272,11 +275,10 @@ GNU General Public License for more details.
272
 
273
  public function wpfc_check_url_ajax_request_callback(){
274
  if(current_user_can('manage_options')){
275
- if(preg_match("/wp\.com/", $_GET["url"])){
276
- $res = array("success" => true);
277
- echo json_encode($res);
278
- exit;
279
  }
 
280
  $host = str_replace("www.", "", $_SERVER["HTTP_HOST"]);
281
  $_GET["url"] = esc_url_raw($_GET["url"]);
282
 
@@ -317,8 +319,8 @@ GNU General Public License for more details.
317
  }
318
  }
319
  }
320
- echo json_encode($res);
321
- exit;
322
  }else{
323
  wp_die("Must be admin");
324
  }
@@ -636,7 +638,6 @@ GNU General Public License for more details.
636
  if(isset($_GET["page"]) && $_GET["page"] == "wpfastestcacheoptions"){
637
  wp_enqueue_style("wp-fastest-cache-buycredit", plugins_url("wp-fastest-cache/css/buycredit.css"), array(), time(), "all");
638
  wp_enqueue_style("wp-fastest-cache-flaticon", plugins_url("wp-fastest-cache/css/flaticon.css"), array(), time(), "all");
639
- wp_enqueue_style("wp-fastest-cache-db-flaticon", plugins_url("wp-fastest-cache/css/db/flaticon.css"), array(), time(), "all");
640
  wp_enqueue_style("wp-fastest-cache-dialog", plugins_url("wp-fastest-cache/css/dialog.css"), array(), time(), "all");
641
  }
642
  }
@@ -870,39 +871,9 @@ GNU General Public License for more details.
870
  }
871
  }
872
 
873
- // Sometimes there is no path of post/page static pages
874
- if(get_option('page_on_front') == $post_id){
875
- @unlink($this->getWpContentDir()."/cache/all/index.html");
876
- @unlink($this->getWpContentDir()."/cache/wpfc-mobile-cache/index.html");
877
- }
878
-
879
- if(is_sticky($post_id)){
880
- @unlink($this->getWpContentDir()."/cache/all/index.html");
881
- @unlink($this->getWpContentDir()."/cache/wpfc-mobile-cache/index.html");
882
- }
883
-
884
- // to check the post appears on homepage
885
- if(!get_option('page_on_front')){
886
- $numberposts = get_option("posts_per_page") - count(get_option('sticky_posts'));
887
-
888
- if($numberposts > 0){
889
- $recent_posts = wp_get_recent_posts(array(
890
- 'numberposts' => $numberposts,
891
- 'orderby' => 'post_date',
892
- 'order' => 'DESC',
893
- 'post_type' => 'post',
894
- 'post_status' => 'publish',
895
- 'suppress_filters' => true
896
- ), ARRAY_A);
897
-
898
- foreach ((array)$recent_posts as $key => $value) {
899
- if($post_id == $value["ID"]){
900
- @unlink($this->getWpContentDir()."/cache/all/index.html");
901
- @unlink($this->getWpContentDir()."/cache/wpfc-mobile-cache/index.html");
902
- }
903
- }
904
- }
905
- }
906
 
907
  // to clear cache of cats which contains the post (only first page)
908
  foreach (wp_get_post_categories($post_id) as $cat_key => $cat_id) {
@@ -1073,14 +1044,12 @@ GNU General Public License for more details.
1073
 
1074
  if(!empty($_POST) && isset($_POST["wpFastestCachePreload"])){
1075
  foreach ($_POST as $key => $value) {
1076
- $key = esc_url_raw($key);
1077
- $value = esc_url_raw($value);
1078
 
1079
  preg_match("/wpFastestCachePreload_(.+)/", $key, $type);
1080
 
1081
  if(!empty($type)){
1082
- $value = preg_replace("/[^0-9]+/", "", $value);
1083
-
1084
  if($type[1] == "number"){
1085
  $preload_arr[$type[1]] = $value;
1086
  }else{
@@ -1566,13 +1535,19 @@ GNU General Public License for more details.
1566
  'wpfc' => true
1567
  );
1568
 
 
 
 
 
 
 
1569
  $schedules['weekly'] = array(
1570
  'interval' => 60*60*24*7,
1571
  'display' => __( 'Once a Week' ),
1572
  'wpfc' => true
1573
  );
1574
 
1575
- $schedules['weekly'] = array(
1576
  'interval' => 60*60*24*10,
1577
  'display' => __( 'Once Every 10 Days' ),
1578
  'wpfc' => true
@@ -1646,6 +1621,11 @@ GNU General Public License for more details.
1646
  return $matches[0];
1647
  }
1648
 
 
 
 
 
 
1649
  $cdn->file_types = str_replace(",", "|", $cdn->file_types);
1650
 
1651
  if(!preg_match("/\.(".$cdn->file_types.")/i", $matches[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.6.7
7
  Author: Emre Vona
8
  Author URI: http://tr.linkedin.com/in/emrevona
9
  Text Domain: wp-fastest-cache
20
  but WITHOUT ANY WARRANTY; without even the implied warranty of
21
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
  GNU General Public License for more details.
23
+ */
24
+ //test7
25
  if (!defined('WPFC_WP_CONTENT_BASENAME')) {
26
  if (!defined('WPFC_WP_PLUGIN_DIR')) {
27
  if(preg_match("/(\/trunk\/|\/wp-fastest-cache\/)$/", plugin_dir_path( __FILE__ ))){
88
  $this->rm_folder_recursively($this->getWpContentDir()."/cache/tmpWpfc");
89
  }
90
 
91
+ if($this->isPluginActive('wp-polls/wp-polls.php')){
92
+ //for WP-Polls
93
+ require_once "inc/wp-polls.php";
94
+ $wp_polls = new WpPollsForWpFc();
95
+ $wp_polls->hook();
96
+ }
97
 
98
  if(isset($_GET) && isset($_GET["action"]) && in_array($_GET["action"], $optimize_image_ajax_requests)){
99
  if($this->isPluginActive("wp-fastest-cache-premium/wpFastestCachePremium.php")){
275
 
276
  public function wpfc_check_url_ajax_request_callback(){
277
  if(current_user_can('manage_options')){
278
+ if(preg_match("/wp\.com/", $_GET["url"]) || $_GET["url"] == "random"){
279
+ wp_send_json(array("success" => true));
 
 
280
  }
281
+
282
  $host = str_replace("www.", "", $_SERVER["HTTP_HOST"]);
283
  $_GET["url"] = esc_url_raw($_GET["url"]);
284
 
319
  }
320
  }
321
  }
322
+
323
+ wp_send_json($res);
324
  }else{
325
  wp_die("Must be admin");
326
  }
638
  if(isset($_GET["page"]) && $_GET["page"] == "wpfastestcacheoptions"){
639
  wp_enqueue_style("wp-fastest-cache-buycredit", plugins_url("wp-fastest-cache/css/buycredit.css"), array(), time(), "all");
640
  wp_enqueue_style("wp-fastest-cache-flaticon", plugins_url("wp-fastest-cache/css/flaticon.css"), array(), time(), "all");
 
641
  wp_enqueue_style("wp-fastest-cache-dialog", plugins_url("wp-fastest-cache/css/dialog.css"), array(), time(), "all");
642
  }
643
  }
871
  }
872
  }
873
 
874
+ // to clear cache of homepage
875
+ @unlink($this->getWpContentDir()."/cache/all/index.html");
876
+ @unlink($this->getWpContentDir()."/cache/wpfc-mobile-cache/index.html");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
877
 
878
  // to clear cache of cats which contains the post (only first page)
879
  foreach (wp_get_post_categories($post_id) as $cat_key => $cat_id) {
1044
 
1045
  if(!empty($_POST) && isset($_POST["wpFastestCachePreload"])){
1046
  foreach ($_POST as $key => $value) {
1047
+ $key = esc_attr($key);
1048
+ $value = esc_attr($value);
1049
 
1050
  preg_match("/wpFastestCachePreload_(.+)/", $key, $type);
1051
 
1052
  if(!empty($type)){
 
 
1053
  if($type[1] == "number"){
1054
  $preload_arr[$type[1]] = $value;
1055
  }else{
1535
  'wpfc' => true
1536
  );
1537
 
1538
+ $schedules['everythreedays'] = array(
1539
+ 'interval' => 60*60*24*3,
1540
+ 'display' => __( 'Once Every 3 Days' ),
1541
+ 'wpfc' => true
1542
+ );
1543
+
1544
  $schedules['weekly'] = array(
1545
  'interval' => 60*60*24*7,
1546
  'display' => __( 'Once a Week' ),
1547
  'wpfc' => true
1548
  );
1549
 
1550
+ $schedules['everytendays'] = array(
1551
  'interval' => 60*60*24*10,
1552
  'display' => __( 'Once Every 10 Days' ),
1553
  'wpfc' => true
1621
  return $matches[0];
1622
  }
1623
 
1624
+ if(preg_match("/^\/\/random/", $cdn->cdnurl) || preg_match("/\/\/i\d\.wp\.com/", $cdn->cdnurl)){
1625
+ $cdn->cdnurl = "//i".rand(0,3).".wp.com/".str_replace("www.", "", $_SERVER["HTTP_HOST"]);
1626
+ $cdn->cdnurl = preg_replace("/\/\/i\d\.wp\.com/", "//i".rand(0,3).".wp.com", $cdn->cdnurl);
1627
+ }
1628
+
1629
  $cdn->file_types = str_replace(",", "|", $cdn->file_types);
1630
 
1631
  if(!preg_match("/\.(".$cdn->file_types.")/i", $matches[0])){