WP Fastest Cache - Version 0.8.9.0

Version Description

  • to replace lazy load blank.gif with cdn-url
  • to exclude wishlist url of YITH WooCommerce Wishlist
  • refactoring of is_amp()
  • to add webm extension for cdn
  • refactoring of current_url()
Download this release

Release Info

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

Code changes from version 0.8.8.9 to 0.8.9.0

css/dialog.css CHANGED
@@ -246,7 +246,7 @@ button:focus {outline:0;}
246
  }
247
 
248
  .wpfc-checkbox-list label{
249
- width:130px;
250
  display:inline-block;
251
  margin-top:3px;
252
  color:#333333;
246
  }
247
 
248
  .wpfc-checkbox-list label{
249
+ width:110px;
250
  display:inline-block;
251
  margin-top:3px;
252
  color:#333333;
inc/admin.php CHANGED
@@ -119,6 +119,8 @@
119
 
120
  if(current_user_can('manage_options')){
121
  if($_POST["wpFastestCachePage"] == "options"){
 
 
122
  $this->saveOption();
123
  }else if($_POST["wpFastestCachePage"] == "deleteCache"){
124
  $this->deleteCache();
@@ -134,6 +136,46 @@
134
  }
135
  }
136
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
  public function addCacheTimeout(){
138
  if(isset($_POST["wpFastestCacheTimeOut"])){
139
  if($_POST["wpFastestCacheTimeOut"]){
@@ -252,15 +294,15 @@
252
  public function checkCachePathWriteable(){
253
  $message = array();
254
 
255
- if(!is_dir($this->getWpContentDir()."/cache/")){
256
- if (@mkdir($this->getWpContentDir()."/cache/", 0755, true)){
257
  //
258
  }else{
259
  array_push($message, "- /wp-content/cache/ is needed to be created");
260
  }
261
  }else{
262
- if (@mkdir($this->getWpContentDir()."/cache/testWpFc/", 0755, true)){
263
- rmdir($this->getWpContentDir()."/cache/testWpFc/");
264
  }else{
265
  array_push($message, "- /wp-content/cache/ permission has to be 755");
266
  }
@@ -273,8 +315,8 @@
273
  array_push($message, "- /wp-content/cache/all/ is needed to be created");
274
  }
275
  }else{
276
- if (@mkdir($this->getWpContentDir()."/cache/all/testWpFc/", 0755, true)){
277
- rmdir($this->getWpContentDir()."/cache/all/testWpFc/");
278
  }else{
279
  array_push($message, "- /wp-content/cache/all/ permission has to be 755");
280
  }
@@ -998,6 +1040,7 @@
998
  <?php
999
  $tester_arr_mobile = array(
1000
  "tr-TR",
 
1001
  "berkatan.com",
1002
  "yenihobiler.com",
1003
  "hobiblogu.com",
119
 
120
  if(current_user_can('manage_options')){
121
  if($_POST["wpFastestCachePage"] == "options"){
122
+ $this->exclude_urls();
123
+
124
  $this->saveOption();
125
  }else if($_POST["wpFastestCachePage"] == "deleteCache"){
126
  $this->deleteCache();
136
  }
137
  }
138
 
139
+ public function exclude_urls(){
140
+ // to exclude wishlist url of YITH WooCommerce Wishlist
141
+ if($this->isPluginActive('yith-woocommerce-wishlist/init.php')){
142
+ $wishlist_page_id = get_option("yith_wcwl_wishlist_page_id");
143
+ $permalink = urldecode(get_permalink($wishlist_page_id));
144
+
145
+ if(preg_match("/https?:\/\/[^\/]+\/(.+)/", $permalink, $out)){
146
+ $url = trim($out[1], "/");
147
+ }
148
+ }
149
+
150
+
151
+ if(isset($url) && $url){
152
+ $rules_std = array();
153
+ $rules_json = get_option("WpFastestCacheExclude");
154
+
155
+ $new_rule = new stdClass;
156
+ $new_rule->prefix = "exact";
157
+ $new_rule->content = $url;
158
+ $new_rule->type = "page";
159
+
160
+
161
+ if($rules_json === false){
162
+ array_push($rules_std, $new_rule);
163
+ add_option("WpFastestCacheExclude", json_encode($rules_std), null, "yes");
164
+ }else{
165
+ $rules_std = json_decode($rules_json);
166
+
167
+ if(!is_array($rules_std)){
168
+ $rules_std = array();
169
+ }
170
+
171
+ if(!in_array($new_rule, $rules_std)){
172
+ array_push($rules_std, $new_rule);
173
+ update_option("WpFastestCacheExclude", json_encode($rules_std));
174
+ }
175
+ }
176
+ }
177
+ }
178
+
179
  public function addCacheTimeout(){
180
  if(isset($_POST["wpFastestCacheTimeOut"])){
181
  if($_POST["wpFastestCacheTimeOut"]){
294
  public function checkCachePathWriteable(){
295
  $message = array();
296
 
297
+ if(!is_dir($this->getWpContentDir("/cache/"))){
298
+ if (@mkdir($this->getWpContentDir("/cache/"), 0755, true)){
299
  //
300
  }else{
301
  array_push($message, "- /wp-content/cache/ is needed to be created");
302
  }
303
  }else{
304
+ if (@mkdir($this->getWpContentDir("/cache/testWpFc/"), 0755, true)){
305
+ rmdir($this->getWpContentDir("/cache/testWpFc/"));
306
  }else{
307
  array_push($message, "- /wp-content/cache/ permission has to be 755");
308
  }
315
  array_push($message, "- /wp-content/cache/all/ is needed to be created");
316
  }
317
  }else{
318
+ if (@mkdir($this->getWpContentDir("/cache/all/testWpFc/"), 0755, true)){
319
+ rmdir($this->getWpContentDir("/cache/all/testWpFc/"));
320
  }else{
321
  array_push($message, "- /wp-content/cache/all/ permission has to be 755");
322
  }
1040
  <?php
1041
  $tester_arr_mobile = array(
1042
  "tr-TR",
1043
+ "tr",
1044
  "berkatan.com",
1045
  "yenihobiler.com",
1046
  "hobiblogu.com",
inc/cache.php CHANGED
@@ -102,7 +102,9 @@
102
  $language_negotiation_type = apply_filters('wpml_setting', false, 'language_negotiation_type');
103
  if ($this->isPluginActive('sitepress-multilingual-cms/sitepress.php') && 2 == $language_negotiation_type){
104
  $current_language = apply_filters('wpml_current_language', false);
 
105
  $this->cacheFilePath = str_replace('/cache/all/', '/cache/all/'.$current_language.'/', $this->cacheFilePath);
 
106
  }
107
 
108
 
@@ -687,10 +689,6 @@
687
  }else{
688
  $content = $this->cacheDate($content);
689
  $content = $this->minify($content);
690
-
691
- $content = $this->cdn_rewrite($content);
692
-
693
-
694
  $content = str_replace("<!--WPFC_FOOTER_START-->", "", $content);
695
 
696
 
@@ -724,6 +722,10 @@
724
  }
725
  }
726
 
 
 
 
 
727
  // WP Hide & Security Enhancer
728
  if($this->isPluginActive('wp-hide-security-enhancer/wp-hide.php')){
729
  global $wph;
@@ -957,7 +959,7 @@
957
  public function is_amp($content){
958
  $request_uri = trim($_SERVER["REQUEST_URI"], "/");
959
 
960
- if(preg_match("/^amp/", $request_uri) || preg_match("/amp$/", $request_uri)){
961
  if(preg_match("/<html[^\>]+amp[^\>]*>/i", $content)){
962
  return true;
963
  }
102
  $language_negotiation_type = apply_filters('wpml_setting', false, 'language_negotiation_type');
103
  if ($this->isPluginActive('sitepress-multilingual-cms/sitepress.php') && 2 == $language_negotiation_type){
104
  $current_language = apply_filters('wpml_current_language', false);
105
+
106
  $this->cacheFilePath = str_replace('/cache/all/', '/cache/all/'.$current_language.'/', $this->cacheFilePath);
107
+ $this->cacheFilePath = str_replace('/cache/wpfc-mobile-cache/', '/cache/wpfc-mobile-cache/'.$current_language.'/', $this->cacheFilePath);
108
  }
109
 
110
 
689
  }else{
690
  $content = $this->cacheDate($content);
691
  $content = $this->minify($content);
 
 
 
 
692
  $content = str_replace("<!--WPFC_FOOTER_START-->", "", $content);
693
 
694
 
722
  }
723
  }
724
 
725
+
726
+ $content = $this->cdn_rewrite($content);
727
+
728
+
729
  // WP Hide & Security Enhancer
730
  if($this->isPluginActive('wp-hide-security-enhancer/wp-hide.php')){
731
  global $wph;
959
  public function is_amp($content){
960
  $request_uri = trim($_SERVER["REQUEST_URI"], "/");
961
 
962
+ if(preg_match("/^amp/", $request_uri) || preg_match("/\/amp\//", $request_uri) || preg_match("/amp$/", $request_uri)){
963
  if(preg_match("/<html[^\>]+amp[^\>]*>/i", $content)){
964
  return true;
965
  }
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === WP Fastest Cache ===
2
  Contributors: emrevona
3
  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.9
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -103,6 +103,13 @@ Wpfc does not support Wordpress Multisite yet.
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
1
  === WP Fastest Cache ===
2
  Contributors: emrevona
3
  Donate link: http://profiles.wordpress.org/emrevona/
4
+ Tags: cache, caching, performance, wp-cache, total cache, super cache, cdn
5
  Requires at least: 3.3
6
  Tested up to: 5.0
7
+ Stable tag: 0.8.9.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
103
 
104
  == Changelog ==
105
 
106
+ = 0.8.9.0 =
107
+ * to replace lazy load blank.gif with cdn-url
108
+ * to exclude wishlist url of YITH WooCommerce Wishlist
109
+ * refactoring of is_amp()
110
+ * to add webm extension for cdn
111
+ * refactoring of current_url()
112
+
113
  = 0.8.8.9 =
114
  * to fix url with replacing cdn-url on data-product_variations attribute
115
  * to increase browser cache time from 3 months to 4 months
templates/cdn/file_types.php CHANGED
@@ -16,6 +16,7 @@
16
  "png",
17
  "svg",
18
  "ttf",
 
19
  "woff",
20
  "woff2"
21
  );
16
  "png",
17
  "svg",
18
  "ttf",
19
+ "webm",
20
  "woff",
21
  "woff2"
22
  );
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.9
7
  Author: Emre Vona
8
  Author URI: http://tr.linkedin.com/in/emrevona
9
  Text Domain: wp-fastest-cache
@@ -729,17 +729,32 @@ GNU General Public License for more details.
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;
@@ -767,7 +782,7 @@ GNU General Public License for more details.
767
  // }
768
 
769
  public function deleteWidgetCache(){
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"))){
@@ -776,7 +791,7 @@ GNU General Public License for more details.
776
  }
777
  }
778
 
779
- if(@rename($widget_cache_path, $this->getWpContentDir()."/cache/tmpWpfc/w".time())){
780
  //DONE
781
  }
782
  }
@@ -936,8 +951,8 @@ GNU General Public License for more details.
936
  }
937
  }
938
 
939
- public function delete_cache_of_term($term_id){
940
- $term = get_term($term_id);
941
 
942
  if(!$term || is_wp_error($term)){
943
  return false;
@@ -1032,7 +1047,7 @@ GNU General Public License for more details.
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
 
@@ -1065,7 +1080,7 @@ GNU General Public License for more details.
1065
  $this->deleteWidgetCache();
1066
 
1067
  if(is_dir($cache_path)){
1068
- if(@rename($cache_path, $this->getWpContentDir()."/cache/tmpWpfc/".time())){
1069
  delete_option("WpFastestCacheHTML");
1070
  delete_option("WpFastestCacheHTMLSIZE");
1071
  delete_option("WpFastestCacheMOBILE");
@@ -1079,7 +1094,7 @@ GNU General Public License for more details.
1079
 
1080
  if($minified){
1081
  if(is_dir($minified_cache_path)){
1082
- if(@rename($minified_cache_path, $this->getWpContentDir()."/cache/tmpWpfc/m".time())){
1083
  delete_option("WpFastestCacheCSS");
1084
  delete_option("WpFastestCacheCSSSIZE");
1085
  delete_option("WpFastestCacheJS");
@@ -1188,7 +1203,7 @@ GNU General Public License for more details.
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"){
@@ -1508,26 +1523,32 @@ GNU General Public License for more details.
1508
  }
1509
 
1510
  public function current_url(){
1511
- if(defined('WP_CLI')){
1512
- $_SERVER["SERVER_NAME"] = isset($_SERVER["SERVER_NAME"]) ? $_SERVER["SERVER_NAME"] : "";
1513
- $_SERVER["SERVER_PORT"] = isset($_SERVER["SERVER_PORT"]) ? $_SERVER["SERVER_PORT"] : 80;
1514
- }
 
 
 
 
 
 
1515
 
1516
- $pageURL = 'http';
1517
 
1518
- if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on'){
1519
- $pageURL .= 's';
1520
- }
1521
 
1522
- $pageURL .= '://';
1523
 
1524
- if($_SERVER['SERVER_PORT'] != '80'){
1525
- $pageURL .= $_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].$_SERVER['REQUEST_URI'];
1526
- }else{
1527
- $pageURL .= $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
1528
- }
1529
 
1530
- return $pageURL;
1531
  }
1532
 
1533
  public function wpfc_load_plugin_textdomain(){
3
  Plugin Name: WP Fastest Cache
4
  Plugin URI: http://wordpress.org/plugins/wp-fastest-cache/
5
  Description: The simplest and fastest WP Cache system
6
+ Version: 0.8.9.0
7
  Author: Emre Vona
8
  Author URI: http://tr.linkedin.com/in/emrevona
9
  Text Domain: wp-fastest-cache
729
  protected function getWpContentDir($path = false){
730
  /*
731
  Sample Paths;
732
+
733
+ /cache/
734
+
735
  /cache/all/
736
  /cache/all
737
  /cache/all/page
738
  /cache/all/index.html
739
 
740
+ /cache/wpfc-minified
741
+
742
+ /cache/wpfc-widget-cache
743
+
744
  /cache/wpfc-mobile-cache/
745
  /cache/wpfc-mobile-cache/page
746
  /cache/wpfc-mobile-cache/index.html
747
 
748
  /cache/tmpWpfc
749
+ /cache/tmpWpfc/
750
  /cache/tmpWpfc/mobile_
751
+ /cache/tmpWpfc/m
752
+ /cache/tmpWpfc/w
753
+
754
+
755
+ /cache/testWpFc/
756
+
757
+ /cache/all/testWpFc/
758
  */
759
  if($path){
760
  return WPFC_WP_CONTENT_DIR.$path;
782
  // }
783
 
784
  public function deleteWidgetCache(){
785
+ $widget_cache_path = $this->getWpContentDir("/cache/wpfc-widget-cache");
786
 
787
  if(is_dir($widget_cache_path)){
788
  if(!is_dir($this->getWpContentDir("/cache/tmpWpfc"))){
791
  }
792
  }
793
 
794
+ if(@rename($widget_cache_path, $this->getWpContentDir("/cache/tmpWpfc/w").time())){
795
  //DONE
796
  }
797
  }
951
  }
952
  }
953
 
954
+ public function delete_cache_of_term($term_taxonomy_id){
955
+ $term = get_term_by("term_taxonomy_id", $term_taxonomy_id);
956
 
957
  if(!$term || is_wp_error($term)){
958
  return false;
1047
  $minifed_deleted = false;
1048
 
1049
  $cache_path = $this->getWpContentDir("/cache/all");
1050
+ $minified_cache_path = $this->getWpContentDir("/cache/wpfc-minified");
1051
 
1052
  if(class_exists("WpFcMobileCache")){
1053
 
1080
  $this->deleteWidgetCache();
1081
 
1082
  if(is_dir($cache_path)){
1083
+ if(@rename($cache_path, $this->getWpContentDir("/cache/tmpWpfc/").time())){
1084
  delete_option("WpFastestCacheHTML");
1085
  delete_option("WpFastestCacheHTMLSIZE");
1086
  delete_option("WpFastestCacheMOBILE");
1094
 
1095
  if($minified){
1096
  if(is_dir($minified_cache_path)){
1097
+ if(@rename($minified_cache_path, $this->getWpContentDir("/cache/tmpWpfc/m").time())){
1098
  delete_option("WpFastestCacheCSS");
1099
  delete_option("WpFastestCacheCSSSIZE");
1100
  delete_option("WpFastestCacheJS");
1203
  foreach ((array)$files as $file) {
1204
  $mobile_file = str_replace("/cache/all/", "/cache/wpfc-mobile-cache/", $file);
1205
 
1206
+ @rename($file, $this->getWpContentDir("/cache/tmpWpfc/").time());
1207
  @rename($mobile_file, $this->getWpContentDir("/cache/tmpWpfc/mobile_").time());
1208
  }
1209
  }else if($rule->prefix == "exact"){
1523
  }
1524
 
1525
  public function current_url(){
1526
+ global $wp;
1527
+ $current_url = home_url($_SERVER['REQUEST_URI']);
1528
+
1529
+ return $current_url;
1530
+
1531
+
1532
+ // if(defined('WP_CLI')){
1533
+ // $_SERVER["SERVER_NAME"] = isset($_SERVER["SERVER_NAME"]) ? $_SERVER["SERVER_NAME"] : "";
1534
+ // $_SERVER["SERVER_PORT"] = isset($_SERVER["SERVER_PORT"]) ? $_SERVER["SERVER_PORT"] : 80;
1535
+ // }
1536
 
1537
+ // $pageURL = 'http';
1538
 
1539
+ // if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on'){
1540
+ // $pageURL .= 's';
1541
+ // }
1542
 
1543
+ // $pageURL .= '://';
1544
 
1545
+ // if($_SERVER['SERVER_PORT'] != '80'){
1546
+ // $pageURL .= $_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].$_SERVER['REQUEST_URI'];
1547
+ // }else{
1548
+ // $pageURL .= $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
1549
+ // }
1550
 
1551
+ // return $pageURL;
1552
  }
1553
 
1554
  public function wpfc_load_plugin_textdomain(){