WP Fastest Cache - Version 0.8.8.4

Version Description

  • to show language option via php instead of javascript
  • to show warning if there is no zone on Cloudflare
  • to fix Uncaught SyntaxError on cdn.js [Details]
  • refactoring of cdn_replace_urls()
  • [FEATURE] Clear Cache via URL [Details]
  • to add webm, ogg and mp4 extensions for browser cache
Download this release

Release Info

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

Code changes from version 0.8.8.3 to 0.8.8.4

Files changed (6) hide show
  1. inc/admin.php +51 -109
  2. inc/cache.php +10 -5
  3. inc/cdn.php +6 -2
  4. js/cdn/cdn.js +1 -1
  5. readme.txt +9 -1
  6. wpFastestCache.php +35 -2
inc/admin.php CHANGED
@@ -471,11 +471,14 @@
471
 
472
 
473
  $data = "# BEGIN LBCWpFastestCache"."\n".
474
- '<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|webp|js|css|swf|x-html|css|xml|js|woff|woff2|ttf|svg|eot)(\.gz)?$">'."\n".
475
  '<IfModule mod_expires.c>'."\n".
476
  'AddType application/font-woff2 .woff2'."\n".
477
  'ExpiresActive On'."\n".
478
  'ExpiresDefault A0'."\n".
 
 
 
479
  'ExpiresByType image/webp A2592000'."\n".
480
  'ExpiresByType image/gif A2592000'."\n".
481
  'ExpiresByType image/png A2592000'."\n".
@@ -1205,100 +1208,34 @@
1205
 
1206
 
1207
 
1208
-
1209
-
1210
-
1211
-
1212
-
1213
-
1214
-
1215
- <?php
1216
-
1217
- $tester_arr = array(
1218
- // "de-DE",
1219
- "es_CL",
1220
- "es_AR",
1221
- "es_GT",
1222
- "es_PE",
1223
- "es_VE",
1224
- "es_CO",
1225
- "es_MX",
1226
- "es_ES",
1227
- "es-ES",
1228
- // "fr-FR",
1229
- // "fr-BE",
1230
- // "fr-CA",
1231
- // "fr-FR",
1232
- // "it-IT",
1233
- // "ja",
1234
- "nl-NL",
1235
- "pt-PT",
1236
- "pt-BR",
1237
- "tr-TR",
1238
- "rebootyourpc.gr",
1239
- "nicheadvice.co.uk",
1240
- "addkenmerken.net",
1241
- "animefantastica.com",
1242
- "rynofitness.com.au",
1243
- "margotickets.com",
1244
- "berkatan.com",
1245
- "tiikr.com",
1246
- "enderwaffle.com",
1247
- "yenihobiler.com",
1248
- "weensu.dk",
1249
- "hobiblogu.com",
1250
- "pembeportakal.com",
1251
- "artclinic.org",
1252
- "rogers-immobilien.de",
1253
- "polyamory.dating",
1254
- "mygamer.com",
1255
- "gingerdomain.com",
1256
- "topclassprinting.com",
1257
- "camilazivit.com.br",
1258
- "spycoupon.in",
1259
- "groovypost.com",
1260
- "parkviewhomes.info",
1261
- "myparkviewhomes.com",
1262
- "kompressorcheck.de",
1263
- "bsty.vn",
1264
- "cutflower.com",
1265
- "sackkarre-tests.de",
1266
- "schraubstock-test.de",
1267
- "knarrenkasten-tests.de",
1268
- "zahlungserinnerung-vorlage.de",
1269
- "eigenbeleg-vorlage.de"
1270
- );
1271
-
1272
- if(in_array(get_bloginfo('language'), $tester_arr) || in_array(str_replace("www.", "", $_SERVER["HTTP_HOST"]), $tester_arr)){ ?>
1273
-
1274
- <?php if(class_exists("WpFastestCachePowerfulHtml")){ ?>
1275
- <?php if(method_exists("WpFastestCachePowerfulHtml", "lazy_load")){ ?>
1276
- <div class="questionCon">
1277
- <div class="question">Lazy Load</div>
1278
- <div class="inputCon">
1279
- <input type="hidden" value="<?php echo $wpFastestCacheLazyLoad_placeholder; ?>" id="wpFastestCacheLazyLoad_placeholder" name="wpFastestCacheLazyLoad_placeholder">
1280
- <input type="hidden" value="<?php echo $wpFastestCacheLazyLoad_keywords; ?>" id="wpFastestCacheLazyLoad_keywords" name="wpFastestCacheLazyLoad_keywords">
1281
- <input type="checkbox" <?php echo $wpFastestCacheLazyLoad; ?> id="wpFastestCacheLazyLoad" name="wpFastestCacheLazyLoad"><label for="wpFastestCacheLazyLoad">Load images and iframes when they enter the browsers viewport</label>
1282
- </div>
1283
- <div class="get-info"><a target="_blank" href="http://www.wpfastestcache.com/premium/lazy-load-reduce-http-request-and-page-load-time/"><img src="<?php echo plugins_url("wp-fastest-cache/images/info.png"); ?>" /></a></div>
1284
  </div>
 
 
1285
 
1286
- <?php
1287
- if(file_exists(WPFC_WP_PLUGIN_DIR."/wp-fastest-cache-premium/pro/templates/lazy-load.php")){
1288
- include_once WPFC_WP_PLUGIN_DIR."/wp-fastest-cache-premium/pro/templates/lazy-load.php";
1289
- }
1290
- ?>
1291
 
1292
- <?php }else{ ?>
1293
- <div class="questionCon update-needed">
1294
- <div class="question">Lazy Load</div>
1295
- <div class="inputCon"><input type="checkbox" id="wpFastestCacheLazyLoad" name="wpFastestCacheLazyLoad"><label for="wpFastestCacheLazyLoad">Lazy Load</label></div>
1296
- <div class="get-info"><a target="_blank" href="http://www.wpfastestcache.com/premium/lazy-load-reduce-http-request-and-page-load-time/"><img src="<?php echo plugins_url("wp-fastest-cache/images/info.png"); ?>" /></a></div>
1297
- </div>
1298
- <?php } ?>
1299
  <?php } ?>
1300
-
1301
  <?php } ?>
 
 
1302
 
1303
 
1304
 
@@ -1306,22 +1243,29 @@
1306
  <div class="question">Language</div>
1307
  <div class="inputCon">
1308
  <select id="wpFastestCacheLanguage" name="wpFastestCacheLanguage">
1309
- <option value="cn">中文</option>
1310
- <option value="de">Deutsch</option>
1311
- <option value="eng">English</option>
1312
- <option value="es">Español</option>
1313
- <option value="fr">Français</option>
1314
- <option value="it">Italiana</option>
1315
- <option value="nl">Nederlands</option>
1316
- <option value="ja">日本語</option>
1317
- <option value="pl">Polski</option>
1318
- <option value="pt">Português</option>
1319
- <option value="ro">Română</option>
1320
- <option value="ru">Русский</option>
1321
- <option value="fi">Suomi</option>
1322
- <option value="sv">Svenska</option>
1323
- <option value="tr">Türkçe</option>
1324
- <!-- <option value="ukr">Українська</option> -->
 
 
 
 
 
 
 
1325
  </select>
1326
  </div>
1327
  </div>
@@ -1663,7 +1607,7 @@
1663
  if(get_bloginfo('language') == "tr-TR"){
1664
  $premium_price = "100TL";
1665
  }else{
1666
- $premium_price = "$39.99";
1667
  }
1668
 
1669
  ?>
@@ -2295,8 +2239,6 @@
2295
  jQuery(document).ready(function() {
2296
  Wpfclang.init("<?php echo $wpFastestCacheLanguage; ?>");
2297
  });
2298
-
2299
- document.getElementById("wpFastestCacheLanguage").value = "<?php echo $wpFastestCacheLanguage; ?>";
2300
  </script>
2301
  <?php
2302
  if(isset($_SERVER["SERVER_SOFTWARE"]) && $_SERVER["SERVER_SOFTWARE"] && !preg_match("/iis/i", $_SERVER["SERVER_SOFTWARE"]) && !preg_match("/nginx/i", $_SERVER["SERVER_SOFTWARE"])){
471
 
472
 
473
  $data = "# BEGIN LBCWpFastestCache"."\n".
474
+ '<FilesMatch "\.(webm|ogg|mp4|ico|pdf|flv|jpg|jpeg|png|gif|webp|js|css|swf|x-html|css|xml|js|woff|woff2|ttf|svg|eot)(\.gz)?$">'."\n".
475
  '<IfModule mod_expires.c>'."\n".
476
  'AddType application/font-woff2 .woff2'."\n".
477
  'ExpiresActive On'."\n".
478
  'ExpiresDefault A0'."\n".
479
+ 'ExpiresByType video/webm A2592000'."\n".
480
+ 'ExpiresByType video/ogg A2592000'."\n".
481
+ 'ExpiresByType video/mp4 A2592000'."\n".
482
  'ExpiresByType image/webp A2592000'."\n".
483
  'ExpiresByType image/gif A2592000'."\n".
484
  'ExpiresByType image/png A2592000'."\n".
1208
 
1209
 
1210
 
1211
+ <?php if(class_exists("WpFastestCachePowerfulHtml")){ ?>
1212
+ <?php if(method_exists("WpFastestCachePowerfulHtml", "lazy_load")){ ?>
1213
+ <div class="questionCon">
1214
+ <div class="question">Lazy Load</div>
1215
+ <div class="inputCon">
1216
+ <input type="hidden" value="<?php echo $wpFastestCacheLazyLoad_placeholder; ?>" id="wpFastestCacheLazyLoad_placeholder" name="wpFastestCacheLazyLoad_placeholder">
1217
+ <input type="hidden" value="<?php echo $wpFastestCacheLazyLoad_keywords; ?>" id="wpFastestCacheLazyLoad_keywords" name="wpFastestCacheLazyLoad_keywords">
1218
+ <input type="checkbox" <?php echo $wpFastestCacheLazyLoad; ?> id="wpFastestCacheLazyLoad" name="wpFastestCacheLazyLoad"><label for="wpFastestCacheLazyLoad">Load images and iframes when they enter the browsers viewport</label>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1219
  </div>
1220
+ <div class="get-info"><a target="_blank" href="http://www.wpfastestcache.com/premium/lazy-load-reduce-http-request-and-page-load-time/"><img src="<?php echo plugins_url("wp-fastest-cache/images/info.png"); ?>" /></a></div>
1221
+ </div>
1222
 
1223
+ <?php
1224
+ if(file_exists(WPFC_WP_PLUGIN_DIR."/wp-fastest-cache-premium/pro/templates/lazy-load.php")){
1225
+ include_once WPFC_WP_PLUGIN_DIR."/wp-fastest-cache-premium/pro/templates/lazy-load.php";
1226
+ }
1227
+ ?>
1228
 
1229
+ <?php }else{ ?>
1230
+ <div class="questionCon update-needed">
1231
+ <div class="question">Lazy Load</div>
1232
+ <div class="inputCon"><input type="checkbox" id="wpFastestCacheLazyLoad" name="wpFastestCacheLazyLoad"><label for="wpFastestCacheLazyLoad">Lazy Load</label></div>
1233
+ <div class="get-info"><a target="_blank" href="http://www.wpfastestcache.com/premium/lazy-load-reduce-http-request-and-page-load-time/"><img src="<?php echo plugins_url("wp-fastest-cache/images/info.png"); ?>" /></a></div>
1234
+ </div>
 
1235
  <?php } ?>
 
1236
  <?php } ?>
1237
+
1238
+
1239
 
1240
 
1241
 
1243
  <div class="question">Language</div>
1244
  <div class="inputCon">
1245
  <select id="wpFastestCacheLanguage" name="wpFastestCacheLanguage">
1246
+ <?php
1247
+ $lang_array = array(
1248
+ "cn" => "中文",
1249
+ "de" => "Deutsch",
1250
+ "eng" => "English",
1251
+ "es" => "Español",
1252
+ "fr" => "Français",
1253
+ "it" => "Italiana",
1254
+ "nl" => "Nederlands",
1255
+ "ja" => "日本語",
1256
+ "pl" => "Polski",
1257
+ "pt" => "Português",
1258
+ "ro" => "Română",
1259
+ "ru" => "Русский",
1260
+ "fi" => "Suomi",
1261
+ "sv" => "Svenska",
1262
+ "tr" => "Türkçe"
1263
+ );
1264
+ foreach($lang_array as $lang_array_key => $lang_array_value){
1265
+ $option_selected = ($this->options->wpFastestCacheLanguage == $lang_array_key) ? 'selected="selected"' : "";
1266
+ echo '<option '.$option_selected.' value="'.$lang_array_key.'">'.$lang_array_value.'</option>';
1267
+ }
1268
+ ?>
1269
  </select>
1270
  </div>
1271
  </div>
1607
  if(get_bloginfo('language') == "tr-TR"){
1608
  $premium_price = "100TL";
1609
  }else{
1610
+ $premium_price = "$49.99";
1611
  }
1612
 
1613
  ?>
2239
  jQuery(document).ready(function() {
2240
  Wpfclang.init("<?php echo $wpFastestCacheLanguage; ?>");
2241
  });
 
 
2242
  </script>
2243
  <?php
2244
  if(isset($_SERVER["SERVER_SOFTWARE"]) && $_SERVER["SERVER_SOFTWARE"] && !preg_match("/iis/i", $_SERVER["SERVER_SOFTWARE"]) && !preg_match("/nginx/i", $_SERVER["SERVER_SOFTWARE"])){
inc/cache.php CHANGED
@@ -97,14 +97,17 @@
97
  $this->cacheFilePath = $this->getWpContentDir()."/cache/all/".$_SERVER["REQUEST_URI"];
98
  }
99
  }
100
-
101
  //WPML language switch
102
  //https://wpml.org/forums/topic/wpml-language-switch-wp-fastest-cache-issue/
103
- if($this->isPluginActive('sitepress-multilingual-cms/sitepress.php')){
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
  $this->cacheFilePath = $this->cacheFilePath ? rtrim($this->cacheFilePath, "/")."/" : "";
109
  $this->cacheFilePath = str_replace("/cache/all//", "/cache/all/", $this->cacheFilePath);
110
 
@@ -320,7 +323,9 @@
320
  if(!$this->isPluginActive('really-simple-ssl-pro/really-simple-ssl-pro.php')){
321
  if(!$this->isPluginActive('ssl-insecure-content-fixer/ssl-insecure-content-fixer.php')){
322
  if(!$this->isPluginActive('https-redirection/https-redirection.php')){
323
- return 0;
 
 
324
  }
325
  }
326
  }
97
  $this->cacheFilePath = $this->getWpContentDir()."/cache/all/".$_SERVER["REQUEST_URI"];
98
  }
99
  }
100
+
101
  //WPML language switch
102
  //https://wpml.org/forums/topic/wpml-language-switch-wp-fastest-cache-issue/
103
+ $language_negotiation_type = apply_filters('wpml_setting', false, 'language_negotiation_type');
104
+ if ($this->isPluginActive('sitepress-multilingual-cms/sitepress.php') && 2 == $language_negotiation_type){
105
+ $current_language = apply_filters('wpml_current_language', false);
106
+ $this->cacheFilePath = str_replace('/cache/all/', '/cache/all/'.$current_language.'/', $this->cacheFilePath);
107
  }
108
 
109
+
110
+
111
  $this->cacheFilePath = $this->cacheFilePath ? rtrim($this->cacheFilePath, "/")."/" : "";
112
  $this->cacheFilePath = str_replace("/cache/all//", "/cache/all/", $this->cacheFilePath);
113
 
323
  if(!$this->isPluginActive('really-simple-ssl-pro/really-simple-ssl-pro.php')){
324
  if(!$this->isPluginActive('ssl-insecure-content-fixer/ssl-insecure-content-fixer.php')){
325
  if(!$this->isPluginActive('https-redirection/https-redirection.php')){
326
+ if(!$this->isPluginActive('better-wp-security/better-wp-security.php')){
327
+ return 0;
328
+ }
329
  }
330
  }
331
  }
inc/cdn.php CHANGED
@@ -144,7 +144,7 @@
144
  ),
145
  );
146
 
147
- $response = wp_remote_request('https://api.cloudflare.com/client/v4/zones', $header);
148
 
149
  if(!$response || is_wp_error($response)){
150
  $res = array("success" => false, "error_message" => $response->get_error_message());
@@ -160,8 +160,12 @@
160
  $res = array("success" => true, "zoneid" => $zone_value->id);
161
  }
162
  }
 
 
 
 
163
  }else{
164
- $res = array("success" => false, "error_message" => "No zone name ".$hostname);
165
  }
166
  }
167
  }
144
  ),
145
  );
146
 
147
+ $response = wp_remote_request('https://api.cloudflare.com/client/v4/zones/?status=active&page=1&per_page=1000', $header);
148
 
149
  if(!$response || is_wp_error($response)){
150
  $res = array("success" => false, "error_message" => $response->get_error_message());
160
  $res = array("success" => true, "zoneid" => $zone_value->id);
161
  }
162
  }
163
+
164
+ if(!$res["success"]){
165
+ $res = array("success" => false, "error_message" => "No zone name ".$hostname);
166
+ }
167
  }else{
168
+ $res = array("success" => false, "error_message" => "There is no zone");
169
  }
170
  }
171
  }
js/cdn/cdn.js CHANGED
@@ -34,7 +34,7 @@ var WpfcCDN = {
34
  self.click_event_add_new_keyword_button();
35
  self.add_new_keyword_keypress();
36
 
37
- if(self.id == "other" || self.id == "photon" || self.id == "cloudflare"){
38
  self.show_page("next");
39
  self.hide_button("back");
40
 
34
  self.click_event_add_new_keyword_button();
35
  self.add_new_keyword_keypress();
36
 
37
+ if(self.id == "other" || self.id == "photon" || self.id == "cloudflare"){
38
  self.show_page("next");
39
  self.hide_button("back");
40
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://profiles.wordpress.org/emrevona/
4
  Tags: cache, performance, wp-cache, total cache, super cache
5
  Requires at least: 3.3
6
  Tested up to: 4.9
7
- Stable tag: 0.8.8.3
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.3 =
107
  * to fix Revolution Slider Error
108
  * to make Cloudflare CDN integration work with sub-domains
4
  Tags: cache, performance, wp-cache, total cache, super cache
5
  Requires at least: 3.3
6
  Tested up to: 4.9
7
+ Stable tag: 0.8.8.4
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.4 =
107
+ * to show language option via php instead of javascript
108
+ * to show warning if there is no zone on Cloudflare
109
+ * to fix Uncaught SyntaxError on cdn.js [<a target="_blank" href="https://wordpress.org/support/topic/uncaught-syntaxerror-cdn-js/">Details</a>]
110
+ * refactoring of cdn_replace_urls()
111
+ * <strong>[FEATURE]</strong> Clear Cache via URL [<a target="_blank" href="https://www.wpfastestcache.com/features/clear-cache-via-url/">Details</a>]
112
+ * to add webm, ogg and mp4 extensions for browser cache
113
+
114
  = 0.8.8.3 =
115
  * to fix Revolution Slider Error
116
  * to make Cloudflare CDN integration work with sub-domains
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.3
7
  Author: Emre Vona
8
  Author URI: http://tr.linkedin.com/in/emrevona
9
  Text Domain: wp-fastest-cache
@@ -165,6 +165,37 @@ GNU General Public License for more details.
165
 
166
  add_action('init', array($this, "create_preload_cache"), 11);
167
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
168
  }else{
169
  $this->setCustomInterval();
170
 
@@ -1789,7 +1820,9 @@ GNU General Public License for more details.
1789
 
1790
  $cdn->file_types = str_replace(",", "|", $cdn->file_types);
1791
 
1792
- if(!preg_match("/\.(".$cdn->file_types.")/i", $matches[0])){
 
 
1793
  if(preg_match("/js/", $cdn->file_types)){
1794
  if(!preg_match("/\/revslider\/public\/assets\/js/", $matches[0])){
1795
  continue;
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.4
7
  Author: Emre Vona
8
  Author URI: http://tr.linkedin.com/in/emrevona
9
  Text Domain: wp-fastest-cache
165
 
166
  add_action('init', array($this, "create_preload_cache"), 11);
167
  }
168
+
169
+ if(isset($_GET) && isset($_GET["type"]) && preg_match("/^clearcache(andminified)*$/i", $_GET["type"])){
170
+ // /?action=wpfastestcache&type=clearcache&token=123
171
+ // /?action=wpfastestcache&type=clearcacheandminified&token=123
172
+
173
+ if(isset($_GET["token"]) && $_GET["token"]){
174
+ if(defined("WPFC_CLEAR_CACHE_URL_TOKEN") && WPFC_CLEAR_CACHE_URL_TOKEN){
175
+ if(WPFC_CLEAR_CACHE_URL_TOKEN == $_GET["token"]){
176
+ if($this->isPluginActive("wp-fastest-cache-premium/wpFastestCachePremium.php")){
177
+ include_once $this->get_premium_path("mobile-cache.php");
178
+ }
179
+
180
+ if($_GET["type"] == "clearcache"){
181
+ $this->deleteCache();
182
+ }
183
+
184
+ if($_GET["type"] == "clearcacheandminified"){
185
+ $this->deleteCache(true);
186
+ }
187
+
188
+ die("Done");
189
+ }else{
190
+ die("Wrong token");
191
+ }
192
+ }else{
193
+ die("WPFC_CLEAR_CACHE_URL_TOKEN must be defined");
194
+ }
195
+ }else{
196
+ die("Security token must be set.");
197
+ }
198
+ }
199
  }else{
200
  $this->setCustomInterval();
201
 
1820
 
1821
  $cdn->file_types = str_replace(",", "|", $cdn->file_types);
1822
 
1823
+ if(preg_match("/\.(".$cdn->file_types.")[\"\'\?\)\s]/i", $matches[0])){
1824
+ //nothing
1825
+ }else{
1826
  if(preg_match("/js/", $cdn->file_types)){
1827
  if(!preg_match("/\/revslider\/public\/assets\/js/", $matches[0])){
1828
  continue;