WP Fastest Cache - Version 0.9.1.8

Version Description

  • to make compatible the preload feature with WPML
  • refactoring of clearing cache of content which is moved to trash
  • to fix Notice: Undefined variable: no_selected in single-preload.php on line 39
  • to add image/avif for browser caching
Download this release

Release Info

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

Code changes from version 0.9.1.7 to 0.9.1.8

inc/admin.php CHANGED
@@ -576,7 +576,7 @@
576
 
577
 
578
  $data = "# BEGIN LBCWpFastestCache"."\n".
579
- '<FilesMatch "\.(webm|ogg|mp4|ico|pdf|flv|jpg|jpeg|png|gif|webp|js|css|swf|x-html|css|xml|js|woff|woff2|otf|ttf|svg|eot)(\.gz)?$">'."\n".
580
  '<IfModule mod_expires.c>'."\n".
581
  'AddType application/font-woff2 .woff2'."\n".
582
  'AddType application/x-font-opentype .otf'."\n".
@@ -585,6 +585,7 @@
585
  'ExpiresByType video/webm A10368000'."\n".
586
  'ExpiresByType video/ogg A10368000'."\n".
587
  'ExpiresByType video/mp4 A10368000'."\n".
 
588
  'ExpiresByType image/webp A10368000'."\n".
589
  'ExpiresByType image/gif A10368000'."\n".
590
  'ExpiresByType image/png A10368000'."\n".
576
 
577
 
578
  $data = "# BEGIN LBCWpFastestCache"."\n".
579
+ '<FilesMatch "\.(webm|ogg|mp4|ico|pdf|flv|avif|jpg|jpeg|png|gif|webp|js|css|swf|x-html|css|xml|js|woff|woff2|otf|ttf|svg|eot)(\.gz)?$">'."\n".
580
  '<IfModule mod_expires.c>'."\n".
581
  'AddType application/font-woff2 .woff2'."\n".
582
  'AddType application/x-font-opentype .otf'."\n".
585
  'ExpiresByType video/webm A10368000'."\n".
586
  'ExpiresByType video/ogg A10368000'."\n".
587
  'ExpiresByType video/mp4 A10368000'."\n".
588
+ 'ExpiresByType image/avif A10368000'."\n".
589
  'ExpiresByType image/webp A10368000'."\n".
590
  'ExpiresByType image/gif A10368000'."\n".
591
  'ExpiresByType image/png A10368000'."\n".
inc/cache.php CHANGED
@@ -1117,6 +1117,10 @@
1117
  $action = true;
1118
  }
1119
 
 
 
 
 
1120
  if(isset($redux_builder_amp) && isset($redux_builder_amp['ampforwp-amp-takeover']) && ($redux_builder_amp['ampforwp-amp-takeover'] == true)){
1121
  $action = true;
1122
  }
1117
  $action = true;
1118
  }
1119
 
1120
+ if(preg_match("/\?amp\=1$/", $request_uri)){
1121
+ $action = true;
1122
+ }
1123
+
1124
  if(isset($redux_builder_amp) && isset($redux_builder_amp['ampforwp-amp-takeover']) && ($redux_builder_amp['ampforwp-amp-takeover'] == true)){
1125
  $action = true;
1126
  }
inc/cdn.php CHANGED
@@ -343,7 +343,7 @@
343
  $_GET["url"] = preg_replace("/http\:\/\//i", "https://", $_GET["url"]);
344
  }
345
 
346
- $response = wp_remote_get($_GET["url"], array('timeout' => 20, 'user-agent' => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:64.0) Gecko/20100101 Firefox/64.0"));
347
 
348
  $header = wp_remote_retrieve_headers($response);
349
 
343
  $_GET["url"] = preg_replace("/http\:\/\//i", "https://", $_GET["url"]);
344
  }
345
 
346
+ $response = wp_remote_get($_GET["url"], array('timeout' => 20, 'user-agent' => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36"));
347
 
348
  $header = wp_remote_retrieve_headers($response);
349
 
inc/preload.php CHANGED
@@ -2,6 +2,18 @@
2
  class PreloadWPFC{
3
  private static $exclude_rules = false;
4
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  public static function set_preload($slug){
6
  $preload_arr = array();
7
 
@@ -228,11 +240,11 @@
228
  if(count($recent_custom_posts) > 0){
229
  foreach ($recent_custom_posts as $key => $post) {
230
  if($mobile_theme){
231
- array_push($urls, array("url" => get_permalink($post["ID"]), "user-agent" => "mobile"));
232
  $number--;
233
  }
234
 
235
- array_push($urls, array("url" => get_permalink($post["ID"]), "user-agent" => "desktop"));
236
  $number--;
237
 
238
  $pre_load->customposttypes = $pre_load->customposttypes + 1;
@@ -264,11 +276,11 @@
264
  if(count($recent_posts) > 0){
265
  foreach ($recent_posts as $key => $post) {
266
  if($mobile_theme){
267
- array_push($urls, array("url" => get_permalink($post["ID"]), "user-agent" => "mobile"));
268
  $number--;
269
  }
270
 
271
- array_push($urls, array("url" => get_permalink($post["ID"]), "user-agent" => "desktop"));
272
  $number--;
273
 
274
  $pre_load->post = $pre_load->post + 1;
2
  class PreloadWPFC{
3
  private static $exclude_rules = false;
4
 
5
+ public static function wpml_get_permalink($post_id, $permalink){
6
+ $my_post_language_details = apply_filters( 'wpml_post_language_details', NULL, $post_id) ;
7
+
8
+ if(is_array($my_post_language_details) && isset($my_post_language_details["language_code"])){
9
+ $wpml_permalink = apply_filters( 'wpml_permalink', $permalink , $my_post_language_details["language_code"] );
10
+
11
+ return $wpml_permalink;
12
+ }
13
+
14
+ return $permalink;
15
+ }
16
+
17
  public static function set_preload($slug){
18
  $preload_arr = array();
19
 
240
  if(count($recent_custom_posts) > 0){
241
  foreach ($recent_custom_posts as $key => $post) {
242
  if($mobile_theme){
243
+ array_push($urls, array("url" => self::wpml_get_permalink($post["ID"], get_permalink($post["ID"])), "user-agent" => "mobile"));
244
  $number--;
245
  }
246
 
247
+ array_push($urls, array("url" => self::wpml_get_permalink($post["ID"], get_permalink($post["ID"])), "user-agent" => "desktop"));
248
  $number--;
249
 
250
  $pre_load->customposttypes = $pre_load->customposttypes + 1;
276
  if(count($recent_posts) > 0){
277
  foreach ($recent_posts as $key => $post) {
278
  if($mobile_theme){
279
+ array_push($urls, array("url" => self::wpml_get_permalink($post["ID"], get_permalink($post["ID"])), "user-agent" => "mobile"));
280
  $number--;
281
  }
282
 
283
+ array_push($urls, array("url" => self::wpml_get_permalink($post["ID"], get_permalink($post["ID"])), "user-agent" => "desktop"));
284
  $number--;
285
 
286
  $pre_load->post = $pre_load->post + 1;
inc/single-preload.php CHANGED
@@ -21,6 +21,9 @@
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";
21
  }
22
 
23
  public static function auto_cache_custom_box_html(){
24
+ $yes_selected = "";
25
+ $no_selected = "";
26
+
27
  if($data = get_option("WpFastestCache_autocache")){
28
  if($data == "yes"){
29
  $yes_selected = "selected";
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.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -125,6 +125,12 @@ The free version is enough to speed up your site but in the premium version ther
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)
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.8
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.8 =
129
+ * to make compatible the preload feature with WPML
130
+ * refactoring of clearing cache of content which is moved to trash
131
+ * to fix Notice: Undefined variable: no_selected in single-preload.php on line 39
132
+ * to add image/avif for browser caching
133
+
134
  = 0.9.1.7 =
135
  * to clear cache of the store homepage after WooCommerce order
136
  * to fix vulnerability (discoverd by Gen Sato)
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.7
7
  Author: Emre Vona
8
  Author URI: http://tr.linkedin.com/in/emrevona
9
  Text Domain: wp-fastest-cache
@@ -1121,11 +1121,24 @@ GNU General Public License for more details.
1121
 
1122
  $permalink = urldecode(get_permalink($post_id));
1123
 
 
 
1124
  //for trash contents
1125
- $permalink = rtrim($permalink, "/");
1126
- $permalink = preg_replace("/__trashed$/", "", $permalink);
1127
- //for /%postname%/%post_id% : sample-url__trashed/57595
1128
- $permalink = preg_replace("/__trashed\/(\d+)$/", "/$1", $permalink);
 
 
 
 
 
 
 
 
 
 
 
1129
 
1130
  if(preg_match("/https?:\/\/[^\/]+\/(.+)/", $permalink, $out)){
1131
  $path = $this->getWpContentDir("/cache/all/").$out[1];
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.8
7
  Author: Emre Vona
8
  Author URI: http://tr.linkedin.com/in/emrevona
9
  Text Domain: wp-fastest-cache
1121
 
1122
  $permalink = urldecode(get_permalink($post_id));
1123
 
1124
+
1125
+
1126
  //for trash contents
1127
+ if(preg_match("/\/\?p\=\d+/i", $permalink)){
1128
+ $post = get_post($post_id);
1129
+
1130
+ $clone_post = clone $post;
1131
+ $clone_post->post_status = 'publish';
1132
+
1133
+ $permalink = get_permalink($clone_post);
1134
+ $permalink = rtrim($permalink, "/");
1135
+
1136
+ $permalink = preg_replace("/__trashed$/", "", $permalink);
1137
+ //for /%postname%/%post_id% : sample-url__trashed/57595
1138
+ $permalink = preg_replace("/__trashed\/(\d+)$/", "/$1", $permalink);
1139
+ }
1140
+
1141
+
1142
 
1143
  if(preg_match("/https?:\/\/[^\/]+\/(.+)/", $permalink, $out)){
1144
  $path = $this->getWpContentDir("/cache/all/").$out[1];