WP Fastest Cache - Version 0.9.1.7

Version Description

  • to clear cache of the store homepage after WooCommerce order
  • to fix vulnerability (discoverd by Gen Sato)
  • to clear cache after Woocommerce order status changed
  • to add WPFC_DISABLE_CLEARING_CACHE_AFTER_WOOCOMMERCE_ORDER_STATUS_CHANGED [Details]
Download this release

Release Info

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

Code changes from version 0.9.1.6 to 0.9.1.7

inc/cache.php CHANGED
@@ -1041,7 +1041,7 @@
1041
  if($create){
1042
  if (!is_user_logged_in() && !$this->isCommenter()){
1043
  if(!is_dir($cachFilePath)){
1044
- if(is_writable($this->getWpContentDir()) || ((is_dir($this->getWpContentDir()."/cache")) && (is_writable($this->getWpContentDir()."/cache")))){
1045
  if (@mkdir($cachFilePath, 0755, true)){
1046
 
1047
  $buffer = (string) apply_filters('wpfc_buffer_callback_filter', $buffer, $extension);
@@ -1060,12 +1060,12 @@
1060
  }
1061
 
1062
  if($extension == "html"){
1063
- if(!file_exists(WPFC_WP_CONTENT_DIR."/cache/index.html")){
1064
- @file_put_contents(WPFC_WP_CONTENT_DIR."/cache/index.html", "");
1065
  }
1066
  }else{
1067
- if(!file_exists(WPFC_WP_CONTENT_DIR."/cache/wpfc-minified/index.html")){
1068
- @file_put_contents(WPFC_WP_CONTENT_DIR."/cache/wpfc-minified/index.html", "");
1069
  }
1070
  }
1071
 
1041
  if($create){
1042
  if (!is_user_logged_in() && !$this->isCommenter()){
1043
  if(!is_dir($cachFilePath)){
1044
+ if(is_writable($this->getWpContentDir()) || ((is_dir($this->getWpContentDir("/cache"))) && (is_writable($this->getWpContentDir("/cache"))))){
1045
  if (@mkdir($cachFilePath, 0755, true)){
1046
 
1047
  $buffer = (string) apply_filters('wpfc_buffer_callback_filter', $buffer, $extension);
1060
  }
1061
 
1062
  if($extension == "html"){
1063
+ if(!file_exists($this->getWpContentDir("/cache/index.html"))){
1064
+ @file_put_contents($this->getWpContentDir("/cache/index.html"), "");
1065
  }
1066
  }else{
1067
+ if(!file_exists($this->getWpContentDir("/cache/wpfc-minified/index.html"))){
1068
+ @file_put_contents($this->getWpContentDir("/cache/wpfc-minified/index.html"), "");
1069
  }
1070
  }
1071
 
inc/single-preload.php CHANGED
@@ -9,6 +9,106 @@
9
  SinglePreloadWPFC::set_urls_with_terms();
10
  }
11
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  public static function set_id(){
13
  if(isset($_GET["post"]) && $_GET["post"]){
14
  static::$id = esc_sql($_GET["post"]);
@@ -77,109 +177,97 @@
77
  }
78
 
79
  public static function put_inline_js(){
80
- $screen = get_current_screen();
81
-
82
- if($screen->parent_base == "edit" && $screen->base == "post"){
83
- ?>
84
- <div id="wpfc-single-preload" class="notice notice-info is-dismissible" style="display: none;">
85
- <p id="wpfc-single-preload-info"><?php _e('Cache is generated for this content', 'wp-fastest-cache');?><label style="display: none;" id="wpfc-single-preload-error">0</label><label id="wpfc-single-preload-process" style="padding-left: 5px;"><span>0</span>/<span><?php echo count(static::$urls); ?></span></label></p>
86
-
87
- <script type="text/javascript">
88
- var WpfcSinglePreload = {
89
- error_message: "",
90
- init: function(){},
91
- change_status: function(){
92
- var type = "";
93
- var cached_number = parseInt(jQuery("#wpfc-single-preload-process span").first().text());
94
- var total = parseInt(jQuery("#wpfc-single-preload-process span").last().text());
95
- var error_number = parseInt(jQuery("#wpfc-single-preload-error").text());
96
-
97
- if(cached_number == total){
98
- type = "success";
99
- }
100
-
101
- if((error_number + cached_number) == total){
102
- if(error_number > cached_number){
103
- type = "error";
104
- }else{
105
- type = "success";
106
- }
107
- }
108
-
109
- if(type){
110
- var class_name = jQuery("#wpfc-single-preload").attr("class");
111
- class_name = class_name.replace("notice-info", "notice-" + type);
112
- jQuery("#wpfc-single-preload").attr("class", class_name);
113
-
114
- if(type == "success"){
115
- jQuery("#wpfc-single-preload p").text("<?php _e('Cache has been generated for this content successfully', 'wp-fastest-cache');?>");
116
- }else{
117
- if(this.error_message){
118
- this.error_message = "<?php _e('Cache has NOT been generated for this content successfully', 'wp-fastest-cache');?>" + "<br>" + "<?php _e('Reason:', 'wp-fastest-cache');?>" + " " + this.error_message;
119
- jQuery("#wpfc-single-preload p").html(this.error_message);
120
- }
121
- }
122
- }
123
- },
124
- increase_error: function(){
125
- var error_number = jQuery("#wpfc-single-preload-error").text();
126
- error_number = parseInt(error_number) + 1;
127
- jQuery("#wpfc-single-preload-error").text(error_number);
128
-
129
- this.change_status();
130
- },
131
- create_cache: function(url, user_agent){
132
- var self = this;
133
- jQuery("#wpfc-single-preload").show();
134
-
135
- jQuery.ajax({
136
- type: 'GET',
137
- url: ajaxurl,
138
- data: {"action": "wpfc_preload_single", "url": url, "user_agent": user_agent},
139
- dataType: "html",
140
- timeout: 10000,
141
- cache: false,
142
- success: function(data){
143
- if(data == "true"){
144
- var number = jQuery("#wpfc-single-preload-process span").first().text();
145
- number = parseInt(number) + 1;
146
-
147
- jQuery("#wpfc-single-preload-process span").first().text(number);
148
- }else{
149
- self.error_message = data;
150
- WpfcSinglePreload.increase_error();
151
- }
152
-
153
- self.change_status();
154
- },
155
- error: function(error){
156
- self.error_message = error.statusText;
157
- WpfcSinglePreload.increase_error();
158
- }
159
- });
160
- }
161
- };
162
-
163
-
164
- jQuery(document).ready(function(){
165
- if(jQuery("#message").find("a").attr("href")){
166
- WpfcSinglePreload.init();
167
-
168
- <?php
169
- foreach (self::$urls as $key => $value) {
170
- ?>
171
- setTimeout(function(){
172
- WpfcSinglePreload.create_cache("<?php echo $value["url"]; ?>", "<?php echo $value["user-agent"]; ?>");
173
- }, <?php echo $key*500;?>);
174
- <?php
175
- }
176
- ?>
177
- }
178
- });
179
- </script>
180
- </div>
181
- <?php
182
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
  }
184
  }
185
  ?>
9
  SinglePreloadWPFC::set_urls_with_terms();
10
  }
11
 
12
+ public static function add_meta_box(){
13
+ add_meta_box(
14
+ 'auto_cache_custom_meta_box', // this is HTML id
15
+ 'Auto Cache Settings',
16
+ array("SinglePreloadWPFC", "auto_cache_custom_box_html"), // the callback function
17
+ array('page', 'post', 'product'),
18
+ 'side',
19
+ 'high'
20
+ );
21
+ }
22
+
23
+ public static function auto_cache_custom_box_html(){
24
+ if($data = get_option("WpFastestCache_autocache")){
25
+ if($data == "yes"){
26
+ $yes_selected = "selected";
27
+ }else if($data == "no"){
28
+ $no_selected = "selected";
29
+ }
30
+ }else{
31
+ $no_selected = "selected";
32
+ }
33
+
34
+ ?>
35
+ <p>
36
+ <label>Enable:</label>
37
+ <select data-type='auto-cache-enable'>
38
+ <option <?php echo $yes_selected; ?> value="yes">Yes</option>
39
+ <option <?php echo $no_selected; ?> value="no">No</option>
40
+ </select>
41
+ <span class="spinner" style="float: none;display: inline-block;margin:0;"></span>
42
+ </p>
43
+
44
+ <p id="wpfc-single-preload-process" style="display: none;">
45
+ <label>Status: <span id="wpfc-single-preload-status-runnig">Running...</span><span id="wpfc-single-preload-status-completed" style="display: none; color: #33CD32; font-weight: bold;">Completed</span></label><br>
46
+ <label>Total: <span id="wpfc-single-preload-total-number"><?php echo count(self::$urls); ?></span></label><br>
47
+ <label>Cached: <span id="wpfc-single-preload-cached-number">0</span></label><br>
48
+ <label>Errors: <span id="wpfc-single-preload-error-number">0</span></label>
49
+ </p>
50
+
51
+
52
+
53
+ <p class="post-attributes-help-text">The cache will be created automatically after the contents are saved. <a href="https://www.wpfastestcache.com/features/automatic-cache/" target="_blank">More Info</a></p>
54
+
55
+ <script type="text/javascript">
56
+ var Wpfc_Single_Preload_save_settings = function(){
57
+ var enable_form = jQuery("#auto_cache_custom_meta_box select[data-type='auto-cache-enable']");
58
+
59
+ if(enable_form.length == 1){
60
+ enable_form.change(function(){
61
+ enable_form.attr("disabled", true);
62
+ jQuery("#auto_cache_custom_meta_box span.spinner").css({"visibility" : "visible"});
63
+
64
+ jQuery.ajax({
65
+ type: 'POST',
66
+ url: ajaxurl,
67
+ data: {"action": "wpfc_preload_single_save_settings", "is_enable": jQuery(this).val()},
68
+ dataType: "json",
69
+ cache: false,
70
+ success: function(data){
71
+ enable_form.attr("disabled", false);
72
+ jQuery("#auto_cache_custom_meta_box span.spinner").css({"visibility" : "hidden"});
73
+
74
+ console.log(data);
75
+ },
76
+ error: function(error){
77
+ enable_form.attr("disabled", false);
78
+ jQuery("#auto_cache_custom_meta_box span.spinner").css({"visibility" : "hidden"});
79
+
80
+ console.log(error.statusText);
81
+ }
82
+ });
83
+
84
+ });
85
+ }
86
+ };
87
+
88
+ Wpfc_Single_Preload_save_settings();
89
+
90
+ </script>
91
+
92
+ <?php
93
+ // Add the HTML for the post meta
94
+ }
95
+
96
+ public function save_settings(){
97
+ if(current_user_can('manage_options')){
98
+ $res = array("success" => true);
99
+
100
+ if(get_option("WpFastestCache_autocache")){
101
+ update_option("WpFastestCache_autocache", $_POST["is_enable"]);
102
+ }else{
103
+ add_option("WpFastestCache_autocache", $_POST["is_enable"], null, "yes");
104
+ }
105
+
106
+ wp_send_json($res);
107
+ }
108
+
109
+ wp_die("Must be admin");
110
+ }
111
+
112
  public static function set_id(){
113
  if(isset($_GET["post"]) && $_GET["post"]){
114
  static::$id = esc_sql($_GET["post"]);
177
  }
178
 
179
  public static function put_inline_js(){
180
+ if($data = get_option("WpFastestCache_autocache")){
181
+ if($data == "no"){
182
+ return false;
183
+ }
184
+ }else{
185
+ return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
  }
187
+ ?>
188
+
189
+ <script type="text/javascript">
190
+ var WpfcSinglePreload = {
191
+ error_message: "",
192
+ init: function(){
193
+ jQuery("#wpfc-single-preload-process").show("slow")
194
+ },
195
+ change_status: function(){
196
+ var error_number = jQuery("#wpfc-single-preload-error-number").text();
197
+ var cached_number = jQuery("#wpfc-single-preload-cached-number").text();
198
+ var total_number = jQuery("#wpfc-single-preload-total-number").text();
199
+
200
+ error_number = parseInt(error_number);
201
+ cached_number = parseInt(cached_number);
202
+ total_number = parseInt(total_number);
203
+
204
+ if(total_number == (cached_number + error_number)){
205
+ jQuery("#wpfc-single-preload-status-completed").show();
206
+ jQuery("#wpfc-single-preload-status-runnig").hide();
207
+ }
208
+ },
209
+ increase_error: function(){
210
+ var number = jQuery("#wpfc-single-preload-error-number").text();
211
+ number = parseInt(number) + 1;
212
+
213
+ jQuery("#wpfc-single-preload-error-number").text(number);
214
+
215
+ WpfcSinglePreload.change_status();
216
+ },
217
+ increase_cached: function(){
218
+ var number = jQuery("#wpfc-single-preload-cached-number").text();
219
+ number = parseInt(number) + 1;
220
+
221
+ jQuery("#wpfc-single-preload-cached-number").text(number);
222
+
223
+ WpfcSinglePreload.change_status();
224
+ },
225
+ create_cache: function(url, user_agent){
226
+ var self = this;
227
+ jQuery("#wpfc-single-preload").show();
228
+
229
+ jQuery.ajax({
230
+ type: 'GET',
231
+ url: ajaxurl,
232
+ data: {"action": "wpfc_preload_single", "url": url, "user_agent": user_agent},
233
+ dataType: "html",
234
+ timeout: 10000,
235
+ cache: false,
236
+ success: function(data){
237
+ if(data == "true"){
238
+ WpfcSinglePreload.increase_cached();
239
+ }else{
240
+ self.error_message = data;
241
+ WpfcSinglePreload.increase_error();
242
+ }
243
+ },
244
+ error: function(error){
245
+ self.error_message = error.statusText;
246
+ WpfcSinglePreload.increase_error();
247
+ }
248
+ });
249
+ }
250
+ };
251
+
252
+
253
+ jQuery(document).ready(function(){
254
+ if(jQuery("#message").find("a").attr("href")){
255
+ WpfcSinglePreload.init();
256
+
257
+ <?php
258
+ foreach (self::$urls as $key => $value) {
259
+ ?>
260
+ setTimeout(function(){
261
+ WpfcSinglePreload.create_cache("<?php echo $value["url"]; ?>", "<?php echo $value["user-agent"]; ?>");
262
+ }, <?php echo $key*500;?>);
263
+ <?php
264
+ }
265
+ ?>
266
+ }
267
+ });
268
+ </script>
269
+
270
+ <?php
271
  }
272
  }
273
  ?>
js/cdn/cdn.js CHANGED
@@ -247,7 +247,11 @@ var WpfcCDN = {
247
  modal.find("#cdn-url").css("background-color", "white");
248
  modal.find("#origin-url").css("background-color", "white");
249
  }else{
250
- modal.find(".wpfc-cdn-pages-container div.wiz-cont:visible #cdn-url").nextAll("label").html(res.error_message);
 
 
 
 
251
  }
252
  },
253
  error: function(e) {
247
  modal.find("#cdn-url").css("background-color", "white");
248
  modal.find("#origin-url").css("background-color", "white");
249
  }else{
250
+ if(WpfcCDN.id == "cloudflare"){
251
+ modal.find("label.wiz-error-msg").html(res.error_message);
252
+ }else{
253
+ modal.find(".wpfc-cdn-pages-container div.wiz-cont:visible #cdn-url").nextAll("label").html(res.error_message);
254
+ }
255
  }
256
  },
257
  error: function(e) {
readme.txt CHANGED
@@ -4,7 +4,7 @@ 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.7
7
- Stable tag: 0.9.1.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -125,17 +125,22 @@ The free version is enough to speed up your site but in the premium version ther
125
 
126
  == Changelog ==
127
 
 
 
 
 
 
 
128
  = 0.9.1.6 =
129
  * to fix Notice: Undefined variable: order_arr in preload.php on line 161
130
  * to fix Notice: Undefined property: stdClass::$go in preload.php on line 440
131
- * to start using the API Token system instead of Global API for CLoudflare [<a target="_blank" href="https://www.wpfastestcache.com/tutorial/wp-fastest-cache-cloudflare/">Details</a>]
132
  * to fix removing backslashes issue in the pre tag
133
  * to disable cache for the IP based urls on the bitnami servers
134
  * to disable cdn if the query string contains wc-api
135
 
136
  = 0.9.1.5 =
137
  * <strong>[FEATURE]</strong> to add Re-Order feture for Preload [<a target="_blank" href="https://www.wpfastestcache.com/features/re-order-preload/">Details</a>]
138
- * to add WPFC_DISABLE_CLEARING_CACHE_AFTER_WOOCOMMERCE_CHECKOUT_ORDER_PROCESSED [<a target="_blank" href="https://www.wpfastestcache.com/tutorial/woocommerce-settings/#after-order">Details</a>]
139
 
140
  = 0.9.1.4 =
141
  * to fix saving "Update Post" settings issue
4
  Tags: cache, caching, performance, wp-cache, total cache, super cache, cdn
5
  Requires at least: 3.3
6
  Tested up to: 5.7
7
+ Stable tag: 0.9.1.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
125
 
126
  == Changelog ==
127
 
128
+ = 0.9.1.7 =
129
+ * to clear cache of the store homepage after WooCommerce order
130
+ * to fix vulnerability (discoverd by Gen Sato)
131
+ * to clear cache after Woocommerce order status changed
132
+ * to add WPFC_DISABLE_CLEARING_CACHE_AFTER_WOOCOMMERCE_ORDER_STATUS_CHANGED [<a target="_blank" href="https://www.wpfastestcache.com/tutorial/woocommerce-settings/#after-order-status-changed">Details</a>]
133
+
134
  = 0.9.1.6 =
135
  * to fix Notice: Undefined variable: order_arr in preload.php on line 161
136
  * to fix Notice: Undefined property: stdClass::$go in preload.php on line 440
137
+ * to start using the API Token system instead of Global API for Cloudflare [<a target="_blank" href="https://www.wpfastestcache.com/tutorial/wp-fastest-cache-cloudflare/">Details</a>]
138
  * to fix removing backslashes issue in the pre tag
139
  * to disable cache for the IP based urls on the bitnami servers
140
  * to disable cdn if the query string contains wc-api
141
 
142
  = 0.9.1.5 =
143
  * <strong>[FEATURE]</strong> to add Re-Order feture for Preload [<a target="_blank" href="https://www.wpfastestcache.com/features/re-order-preload/">Details</a>]
 
144
 
145
  = 0.9.1.4 =
146
  * to fix saving "Update Post" settings issue
templates/cdn/cloudflare.php CHANGED
@@ -40,6 +40,7 @@
40
  <div class="wiz-input-cont">
41
  <label style="padding-right: 5px;" class="mc-input-label" for="origin-url">API Token:</label><input type="text" name="" value="" class="api-key" id="origin-url">
42
  <div id="cdn-url-loading"></div>
 
43
  </div>
44
  <p class="wpfc-bottom-note" style="margin-bottom:-10px;"><a target="_blank" href="https://www.wpfastestcache.com/tutorial/wp-fastest-cache-cloudflare/">Note: Please read How to Integrate Cloudflare into WP Fastest Cache</a></p>
45
  </div>
40
  <div class="wiz-input-cont">
41
  <label style="padding-right: 5px;" class="mc-input-label" for="origin-url">API Token:</label><input type="text" name="" value="" class="api-key" id="origin-url">
42
  <div id="cdn-url-loading"></div>
43
+ <label class="wiz-error-msg"></label>
44
  </div>
45
  <p class="wpfc-bottom-note" style="margin-bottom:-10px;"><a target="_blank" href="https://www.wpfastestcache.com/tutorial/wp-fastest-cache-cloudflare/">Note: Please read How to Integrate Cloudflare into WP Fastest Cache</a></p>
46
  </div>
uninstall.php CHANGED
@@ -26,6 +26,15 @@
26
  delete_option("WpFastestCacheCSSSIZE");
27
  delete_option("WpFastestCacheJS");
28
  delete_option("WpFastestCacheJSSIZE");
 
 
 
 
 
 
 
 
 
29
  delete_option("wpfc_server_location");
30
  delete_option("wpfc-group");
31
  delete_option("WpFc_credit");
26
  delete_option("WpFastestCacheCSSSIZE");
27
  delete_option("WpFastestCacheJS");
28
  delete_option("WpFastestCacheJSSIZE");
29
+ delete_option("WpFastestCacheXML");
30
+ delete_option("WpFastestCacheXMLSIZE");
31
+ delete_option("WpFastestCacheSVG");
32
+ delete_option("WpFastestCacheSVGSIZE");
33
+ delete_option("WpFastestCacheJSON");
34
+ delete_option("WpFastestCacheJSONSIZE");
35
+ delete_option("WpFastestCacheWOFF");
36
+ delete_option("WpFastestCacheWOFFSIZE");
37
+ delete_option("WpFastestCacheToolbarSettings");
38
  delete_option("wpfc_server_location");
39
  delete_option("wpfc-group");
40
  delete_option("WpFc_credit");
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.9.1.6
7
  Author: Emre Vona
8
  Author URI: http://tr.linkedin.com/in/emrevona
9
  Text Domain: wp-fastest-cache
@@ -130,11 +130,13 @@ GNU General Public License for more details.
130
  }
131
 
132
  if(defined("WPFC_DISABLE_CLEARING_CACHE_AFTER_WOOCOMMERCE_CHECKOUT_ORDER_PROCESSED") && WPFC_DISABLE_CLEARING_CACHE_AFTER_WOOCOMMERCE_CHECKOUT_ORDER_PROCESSED){
 
133
  }else{
134
  // to clear cache after new Woocommerce orders
135
- add_action('woocommerce_checkout_order_processed', array($this, 'clear_cache_after_woocommerce_checkout_order_processed'), 1, 1);
136
  }
137
 
 
138
  // kk Star Ratings: to clear the cache of the post after voting
139
  add_action('kksr_rate', array($this, 'clear_cache_on_kksr_rate'));
140
 
@@ -145,12 +147,19 @@ GNU General Public License for more details.
145
  add_action("wpfc_clear_all_cache", array($this, 'deleteCache'), 10, 1);
146
  add_action("wpfc_clear_post_cache_by_id", array($this, 'singleDeleteCache'), 10, 2);
147
 
148
- // to create cache for single content
 
149
  if(defined("WPFC_AUTOMATIC_CACHE") && WPFC_AUTOMATIC_CACHE){
150
- add_action('admin_notices', array( $this, 'single_preload_inline_js'));
 
 
 
151
  add_action('wp_ajax_wpfc_preload_single', array($this, "wpfc_preload_single_callback"));
152
  }
153
 
 
 
 
154
  // to add settings link
155
  add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array($this, 'action_links'));
156
 
@@ -281,13 +290,13 @@ GNU General Public License for more details.
281
  }
282
  }
283
  }else{
284
- if(preg_match("/wpfc-minified\/([^\/]+)\/([^\/]+)/", $this->current_url(), $path)){
285
  // for security
286
  if(preg_match("/\.{2,}/", $this->current_url())){
287
  die("May be Directory Traversal Attack");
288
  }
289
 
290
- if($sources = @scandir(WPFC_WP_CONTENT_DIR."/cache/wpfc-minified/".$path[1], 1)){
291
  if(isset($sources[0])){
292
  // $exist_url = str_replace($path[2], $sources[0], $this->current_url());
293
  // header('Location: ' . $exist_url, true, 301);
@@ -299,7 +308,7 @@ GNU General Public License for more details.
299
  header('Content-type: text/js');
300
  }
301
 
302
- echo file_get_contents(WPFC_WP_CONTENT_DIR."/cache/wpfc-minified/".$path[1]."/".$sources[0]);
303
  exit;
304
  }
305
  }
@@ -349,13 +358,20 @@ GNU General Public License for more details.
349
  SinglePreloadWPFC::create_cache();
350
  }
351
 
352
-
353
  public function single_preload_inline_js(){
354
  include_once('inc/single-preload.php');
355
  SinglePreloadWPFC::init();
356
  SinglePreloadWPFC::put_inline_js();
357
  }
 
 
 
 
358
 
 
 
 
 
359
 
360
  public function notify($message = array()){
361
  if(isset($message[0]) && $message[0]){
@@ -399,7 +415,7 @@ GNU General Public License for more details.
399
  $this->singleDeleteCache(false, $id);
400
  }
401
 
402
- public function clear_cache_after_woocommerce_checkout_order_processed($order_id = false){
403
  if(function_exists("wc_get_order")){
404
  if($order_id){
405
  $order = wc_get_order($order_id);
@@ -823,6 +839,11 @@ GNU General Public License for more details.
823
 
824
  $_GET["path"] = urldecode(esc_url_raw($_GET["path"]));
825
 
 
 
 
 
 
826
  $paths = array();
827
 
828
  array_push($paths, $this->getWpContentDir("/cache/all").$_GET["path"]);
@@ -1303,6 +1324,25 @@ GNU General Public License for more details.
1303
  }
1304
  }
1305
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1306
  if(file_exists($this->getWpContentDir("/cache/all/index.html"))){
1307
  @unlink($this->getWpContentDir("/cache/all/index.html"));
1308
  }
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.9.1.7
7
  Author: Emre Vona
8
  Author URI: http://tr.linkedin.com/in/emrevona
9
  Text Domain: wp-fastest-cache
130
  }
131
 
132
  if(defined("WPFC_DISABLE_CLEARING_CACHE_AFTER_WOOCOMMERCE_CHECKOUT_ORDER_PROCESSED") && WPFC_DISABLE_CLEARING_CACHE_AFTER_WOOCOMMERCE_CHECKOUT_ORDER_PROCESSED){
133
+ }else if(defined("WPFC_DISABLE_CLEARING_CACHE_AFTER_WOOCOMMERCE_ORDER_STATUS_CHANGED") && WPFC_DISABLE_CLEARING_CACHE_AFTER_WOOCOMMERCE_ORDER_STATUS_CHANGED){
134
  }else{
135
  // to clear cache after new Woocommerce orders
136
+ add_action('woocommerce_order_status_changed', array($this, 'clear_cache_after_woocommerce_order_status_changed'), 1, 1);
137
  }
138
 
139
+
140
  // kk Star Ratings: to clear the cache of the post after voting
141
  add_action('kksr_rate', array($this, 'clear_cache_on_kksr_rate'));
142
 
147
  add_action("wpfc_clear_all_cache", array($this, 'deleteCache'), 10, 1);
148
  add_action("wpfc_clear_post_cache_by_id", array($this, 'singleDeleteCache'), 10, 2);
149
 
150
+
151
+
152
  if(defined("WPFC_AUTOMATIC_CACHE") && WPFC_AUTOMATIC_CACHE){
153
+ // to create cache for single content
154
+ add_action("add_meta_boxes", array($this, "add_meta_box"), 10, 2);
155
+ add_action('admin_notices', array($this, 'single_preload_inline_js'));
156
+ add_action('wp_ajax_wpfc_preload_single_save_settings', array($this, "wpfc_preload_single_save_settings_callback"));
157
  add_action('wp_ajax_wpfc_preload_single', array($this, "wpfc_preload_single_callback"));
158
  }
159
 
160
+
161
+
162
+
163
  // to add settings link
164
  add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array($this, 'action_links'));
165
 
290
  }
291
  }
292
  }else{
293
+ if(preg_match("/\/([^\/]+)\/([^\/]+(\.css|\.js))(\?.+)?$/", $this->current_url(), $path)){
294
  // for security
295
  if(preg_match("/\.{2,}/", $this->current_url())){
296
  die("May be Directory Traversal Attack");
297
  }
298
 
299
+ if($sources = @scandir($this->getWpContentDir("/cache/wpfc-minified/").$path[1], 1)){
300
  if(isset($sources[0])){
301
  // $exist_url = str_replace($path[2], $sources[0], $this->current_url());
302
  // header('Location: ' . $exist_url, true, 301);
308
  header('Content-type: text/js');
309
  }
310
 
311
+ echo file_get_contents($this->getWpContentDir("/cache/wpfc-minified/").$path[1]."/".$sources[0]);
312
  exit;
313
  }
314
  }
358
  SinglePreloadWPFC::create_cache();
359
  }
360
 
 
361
  public function single_preload_inline_js(){
362
  include_once('inc/single-preload.php');
363
  SinglePreloadWPFC::init();
364
  SinglePreloadWPFC::put_inline_js();
365
  }
366
+ public function add_meta_box(){
367
+ include_once('inc/single-preload.php');
368
+ SinglePreloadWPFC::add_meta_box();
369
+ }
370
 
371
+ public function wpfc_preload_single_save_settings_callback(){
372
+ include_once('inc/single-preload.php');
373
+ SinglePreloadWPFC::save_settings();
374
+ }
375
 
376
  public function notify($message = array()){
377
  if(isset($message[0]) && $message[0]){
415
  $this->singleDeleteCache(false, $id);
416
  }
417
 
418
+ public function clear_cache_after_woocommerce_order_status_changed($order_id = false){
419
  if(function_exists("wc_get_order")){
420
  if($order_id){
421
  $order = wc_get_order($order_id);
839
 
840
  $_GET["path"] = urldecode(esc_url_raw($_GET["path"]));
841
 
842
+ // for security
843
+ if(preg_match("/\.{2,}/", $_GET["path"])){
844
+ die("May be Directory Traversal Attack");
845
+ }
846
+
847
  $paths = array();
848
 
849
  array_push($paths, $this->getWpContentDir("/cache/all").$_GET["path"]);
1324
  }
1325
  }
1326
 
1327
+ if(function_exists("wc_get_page_id")){
1328
+ if($shop_id = wc_get_page_id('shop')){
1329
+ $store_url_path = preg_replace("/https?\:\/\/[^\/]+/i", "", get_permalink($shop_id));
1330
+
1331
+ if($store_url_path){
1332
+ $store_url_path = trim($store_url_path, "/");
1333
+
1334
+ if($store_url_path){
1335
+ @unlink($this->getWpContentDir("/cache/all/").$store_url_path."/index.html");
1336
+ @unlink($this->getWpContentDir("/cache/wpfc-mobile-cache/").$store_url_path."/index.html");
1337
+
1338
+ //to clear pagination of store homepage cache
1339
+ $this->rm_folder_recursively($this->getWpContentDir("/cache/all/").$store_url_path."/page");
1340
+ $this->rm_folder_recursively($this->getWpContentDir("/cache/wpfc-mobile-cache/").$store_url_path."/page");
1341
+ }
1342
+ }
1343
+ }
1344
+ }
1345
+
1346
  if(file_exists($this->getWpContentDir("/cache/all/index.html"))){
1347
  @unlink($this->getWpContentDir("/cache/all/index.html"));
1348
  }