LiteSpeed Cache - Version 4.4.6

Version Description

  • Dec 27 2022 =
  • Guest Restored document.referrer for organic traffic purpose when enabled Guest Mode. (michelefns)
  • Image Optimize Fixed a potential PHP notice when uploading images in WP w/ PHP7.4+. (titsmaker)
  • ESI Fixed the Customize-page-widget-esi-settings-can-not-update bug (#422 Abe)
  • 3rd Reverted ESI adminbar change of Elementor front pages for backward compatibility (#423 Abe)
  • 3rd Fixed potential PHP warning on ESI disabling when using Perfmatters. (Jeffrey Zhang)
  • Misc Check if HTTP_REFERER is set or not before using it in Router class. (#425 Abe)
Download this release

Release Info

Developer LiteSpeedTech
Plugin Icon 128x128 LiteSpeed Cache
Version 4.4.6
Comparing to
See all releases

Code changes from version 4.4.5 to 4.4.6

assets/js/guest.docref.js ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ var litespeed_docref = sessionStorage.getItem( 'litespeed_docref' );
2
+ if ( litespeed_docref ) {
3
+ document.referrer = litespeed_docref;
4
+ sessionStorage.removeItem( 'litespeed_docref' );
5
+ }
assets/js/guest.docref.min.js ADDED
@@ -0,0 +1 @@
 
1
+ var litespeed_docref=sessionStorage.getItem("litespeed_docref");litespeed_docref&&(document.referrer=litespeed_docref,sessionStorage.removeItem("litespeed_docref"));
assets/js/guest.js CHANGED
@@ -8,6 +8,9 @@ if ( ! litespeed_vary ) {
8
  } ).then( response => response.json() ).then( data => {
9
  console.log(data);
10
  if ( data.hasOwnProperty( 'reload' ) && data.reload == 'yes' ) {
 
 
 
11
  window.location.reload( true );
12
  }
13
  } );
8
  } ).then( response => response.json() ).then( data => {
9
  console.log(data);
10
  if ( data.hasOwnProperty( 'reload' ) && data.reload == 'yes' ) {
11
+ // Save doc.ref for organic traffic usage
12
+ sessionStorage.setItem( 'litespeed_docref', document.referrer );
13
+
14
  window.location.reload( true );
15
  }
16
  } );
assets/js/guest.min.js CHANGED
@@ -1 +1 @@
1
- var litespeed_vary=document.cookie.replace(/(?:(?:^|.*;\s*)_lscache_vary\s*\=\s*([^;]*).*$)|^.*$/,"$1");litespeed_vary||fetch("litespeed_url",{method:"POST",cache:"no-cache",redirect:"follow"}).then(e=>e.json()).then(e=>{console.log(e),e.hasOwnProperty("reload")&&"yes"==e.reload&&window.location.reload(!0)});
1
+ var litespeed_vary=document.cookie.replace(/(?:(?:^|.*;\s*)_lscache_vary\s*\=\s*([^;]*).*$)|^.*$/,"$1");litespeed_vary||fetch("litespeed_url",{method:"POST",cache:"no-cache",redirect:"follow"}).then(e=>e.json()).then(e=>{console.log(e),e.hasOwnProperty("reload")&&"yes"==e.reload&&(sessionStorage.setItem("litespeed_docref",document.referrer),window.location.reload(!0))});
lang/litespeed-cache.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the same license as the LiteSpeed Cache package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: LiteSpeed Cache 4.4.5\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/litespeed-cache\n"
7
- "POT-Creation-Date: 2021-11-30 15:07:18+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -53,7 +53,7 @@ msgstr ""
53
  msgid "CDN"
54
  msgstr ""
55
 
56
- #: src/admin-display.cls.php:123 src/gui.cls.php:602
57
  #: tpl/dash/dashboard.tpl.php:55 tpl/dash/network_dash.tpl.php:27
58
  msgid "Image Optimization"
59
  msgstr ""
@@ -123,7 +123,7 @@ msgstr ""
123
  msgid "OFF"
124
  msgstr ""
125
 
126
- #: src/admin-display.cls.php:281 src/gui.cls.php:593
127
  msgid "Settings"
128
  msgstr ""
129
 
@@ -687,57 +687,57 @@ msgstr ""
687
  msgid "Failed to write to %s."
688
  msgstr ""
689
 
690
- #: src/gui.cls.php:80
691
  msgid "Public Caches"
692
  msgstr ""
693
 
694
- #: src/gui.cls.php:81
695
  msgid "Public Cache Hits"
696
  msgstr ""
697
 
698
- #: src/gui.cls.php:82
699
  msgid "Private Caches"
700
  msgstr ""
701
 
702
- #: src/gui.cls.php:83
703
  msgid "Private Cache Hits"
704
  msgstr ""
705
 
706
- #: src/gui.cls.php:402
707
  msgid "Purge this page"
708
  msgstr ""
709
 
710
- #: src/gui.cls.php:410
711
  msgid "Mark this page as "
712
  msgstr ""
713
 
714
- #: src/gui.cls.php:422
715
  msgid "Forced cacheable"
716
  msgstr ""
717
 
718
- #: src/gui.cls.php:433
719
  msgid "Non cacheable"
720
  msgstr ""
721
 
722
- #: src/gui.cls.php:444
723
  msgid "Private cache"
724
  msgstr ""
725
 
726
- #: src/gui.cls.php:455
727
  msgid "No optimization"
728
  msgstr ""
729
 
730
- #: src/gui.cls.php:463
731
  msgid "More settings"
732
  msgstr ""
733
 
734
- #: src/gui.cls.php:470 src/gui.cls.php:478 src/gui.cls.php:486
735
- #: src/gui.cls.php:495 src/gui.cls.php:505 src/gui.cls.php:515
736
- #: src/gui.cls.php:525 src/gui.cls.php:535 src/gui.cls.php:545
737
- #: src/gui.cls.php:611 src/gui.cls.php:619 src/gui.cls.php:627
738
- #: src/gui.cls.php:636 src/gui.cls.php:646 src/gui.cls.php:656
739
- #: src/gui.cls.php:666 src/gui.cls.php:676 src/gui.cls.php:686
740
- #: src/gui.cls.php:696 tpl/page_optm/settings_media.tpl.php:125
741
  #: tpl/toolbox/purge.tpl.php:37 tpl/toolbox/purge.tpl.php:43
742
  #: tpl/toolbox/purge.tpl.php:52 tpl/toolbox/purge.tpl.php:61
743
  #: tpl/toolbox/purge.tpl.php:70 tpl/toolbox/purge.tpl.php:79
@@ -746,73 +746,73 @@ msgstr ""
746
  msgid "Purge All"
747
  msgstr ""
748
 
749
- #: src/gui.cls.php:478 src/gui.cls.php:569 src/gui.cls.php:619
750
  msgid "LSCache"
751
  msgstr ""
752
 
753
- #: src/gui.cls.php:486 src/gui.cls.php:627 tpl/toolbox/purge.tpl.php:43
754
  msgid "CSS/JS Cache"
755
  msgstr ""
756
 
757
- #: src/gui.cls.php:495 src/gui.cls.php:646 src/lang.cls.php:82
758
  #: tpl/dash/dashboard.tpl.php:396 tpl/toolbox/purge.tpl.php:52
759
  msgid "Object Cache"
760
  msgstr ""
761
 
762
- #: src/gui.cls.php:505 src/gui.cls.php:656 tpl/toolbox/purge.tpl.php:61
763
  msgid "Opcode Cache"
764
  msgstr ""
765
 
766
- #: src/gui.cls.php:535 src/gui.cls.php:686
767
  #: tpl/page_optm/settings_media.tpl.php:125 tpl/toolbox/purge.tpl.php:88
768
  msgid "LQIP Cache"
769
  msgstr ""
770
 
771
- #: src/gui.cls.php:545 src/gui.cls.php:696 src/lang.cls.php:142
772
  #: tpl/toolbox/purge.tpl.php:97
773
  msgid "Gravatar Cache"
774
  msgstr ""
775
 
776
- #: src/gui.cls.php:569
777
  msgid "LiteSpeed Cache Purge All"
778
  msgstr ""
779
 
780
- #: src/gui.cls.php:585 tpl/cdn/entry.tpl.php:7 tpl/cdn/settings.tpl.php:194
781
  #: tpl/db_optm/entry.tpl.php:6
782
  msgid "Manage"
783
  msgstr ""
784
 
785
- #: src/gui.cls.php:636 tpl/cdn/manage.tpl.php:17
786
  msgid "Cloudflare"
787
  msgstr ""
788
 
789
- #: src/gui.cls.php:715 tpl/img_optm/summary.tpl.php:175
790
  msgid "Remove all previous unfinished image optimization requests."
791
  msgstr ""
792
 
793
- #: src/gui.cls.php:716 tpl/img_optm/summary.tpl.php:177
794
  msgid "Clean Up Unfinished Data"
795
  msgstr ""
796
 
797
- #: src/gui.cls.php:734
798
  msgid "Install %s"
799
  msgstr ""
800
 
801
- #: src/gui.cls.php:735
802
  msgid "Install Now"
803
  msgstr ""
804
 
805
- #: src/gui.cls.php:754
806
  msgid ""
807
  "<a href=\"%1$s\" %2$s>View version %3$s details</a> or <a href=\"%4$s\" %5$s "
808
  "target=\"_blank\">update now</a>."
809
  msgstr ""
810
 
811
- #: src/gui.cls.php:757
812
  msgid "View %1$s version %2$s details"
813
  msgstr ""
814
 
815
- #: src/gui.cls.php:762
816
  msgid "Update %s now"
817
  msgstr ""
818
 
@@ -1960,7 +1960,7 @@ msgstr ""
1960
  msgid "Dismiss this notice"
1961
  msgstr ""
1962
 
1963
- #. #-#-#-#-# litespeed-cache.pot (LiteSpeed Cache 4.4.5) #-#-#-#-#
1964
  #. Plugin Name of the plugin/theme
1965
  #: tpl/banner/new_version.php:59 tpl/banner/new_version_dev.tpl.php:12
1966
  #: tpl/cache/more_settings_tip.tpl.php:15 tpl/inc/admin_footer.php:8
2
  # This file is distributed under the same license as the LiteSpeed Cache package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: LiteSpeed Cache 4.4.6\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/litespeed-cache\n"
7
+ "POT-Creation-Date: 2021-12-27 13:11:18+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
53
  msgid "CDN"
54
  msgstr ""
55
 
56
+ #: src/admin-display.cls.php:123 src/gui.cls.php:603
57
  #: tpl/dash/dashboard.tpl.php:55 tpl/dash/network_dash.tpl.php:27
58
  msgid "Image Optimization"
59
  msgstr ""
123
  msgid "OFF"
124
  msgstr ""
125
 
126
+ #: src/admin-display.cls.php:281 src/gui.cls.php:594
127
  msgid "Settings"
128
  msgstr ""
129
 
687
  msgid "Failed to write to %s."
688
  msgstr ""
689
 
690
+ #: src/gui.cls.php:81
691
  msgid "Public Caches"
692
  msgstr ""
693
 
694
+ #: src/gui.cls.php:82
695
  msgid "Public Cache Hits"
696
  msgstr ""
697
 
698
+ #: src/gui.cls.php:83
699
  msgid "Private Caches"
700
  msgstr ""
701
 
702
+ #: src/gui.cls.php:84
703
  msgid "Private Cache Hits"
704
  msgstr ""
705
 
706
+ #: src/gui.cls.php:403
707
  msgid "Purge this page"
708
  msgstr ""
709
 
710
+ #: src/gui.cls.php:411
711
  msgid "Mark this page as "
712
  msgstr ""
713
 
714
+ #: src/gui.cls.php:423
715
  msgid "Forced cacheable"
716
  msgstr ""
717
 
718
+ #: src/gui.cls.php:434
719
  msgid "Non cacheable"
720
  msgstr ""
721
 
722
+ #: src/gui.cls.php:445
723
  msgid "Private cache"
724
  msgstr ""
725
 
726
+ #: src/gui.cls.php:456
727
  msgid "No optimization"
728
  msgstr ""
729
 
730
+ #: src/gui.cls.php:464
731
  msgid "More settings"
732
  msgstr ""
733
 
734
+ #: src/gui.cls.php:471 src/gui.cls.php:479 src/gui.cls.php:487
735
+ #: src/gui.cls.php:496 src/gui.cls.php:506 src/gui.cls.php:516
736
+ #: src/gui.cls.php:526 src/gui.cls.php:536 src/gui.cls.php:546
737
+ #: src/gui.cls.php:612 src/gui.cls.php:620 src/gui.cls.php:628
738
+ #: src/gui.cls.php:637 src/gui.cls.php:647 src/gui.cls.php:657
739
+ #: src/gui.cls.php:667 src/gui.cls.php:677 src/gui.cls.php:687
740
+ #: src/gui.cls.php:697 tpl/page_optm/settings_media.tpl.php:125
741
  #: tpl/toolbox/purge.tpl.php:37 tpl/toolbox/purge.tpl.php:43
742
  #: tpl/toolbox/purge.tpl.php:52 tpl/toolbox/purge.tpl.php:61
743
  #: tpl/toolbox/purge.tpl.php:70 tpl/toolbox/purge.tpl.php:79
746
  msgid "Purge All"
747
  msgstr ""
748
 
749
+ #: src/gui.cls.php:479 src/gui.cls.php:570 src/gui.cls.php:620
750
  msgid "LSCache"
751
  msgstr ""
752
 
753
+ #: src/gui.cls.php:487 src/gui.cls.php:628 tpl/toolbox/purge.tpl.php:43
754
  msgid "CSS/JS Cache"
755
  msgstr ""
756
 
757
+ #: src/gui.cls.php:496 src/gui.cls.php:647 src/lang.cls.php:82
758
  #: tpl/dash/dashboard.tpl.php:396 tpl/toolbox/purge.tpl.php:52
759
  msgid "Object Cache"
760
  msgstr ""
761
 
762
+ #: src/gui.cls.php:506 src/gui.cls.php:657 tpl/toolbox/purge.tpl.php:61
763
  msgid "Opcode Cache"
764
  msgstr ""
765
 
766
+ #: src/gui.cls.php:536 src/gui.cls.php:687
767
  #: tpl/page_optm/settings_media.tpl.php:125 tpl/toolbox/purge.tpl.php:88
768
  msgid "LQIP Cache"
769
  msgstr ""
770
 
771
+ #: src/gui.cls.php:546 src/gui.cls.php:697 src/lang.cls.php:142
772
  #: tpl/toolbox/purge.tpl.php:97
773
  msgid "Gravatar Cache"
774
  msgstr ""
775
 
776
+ #: src/gui.cls.php:570
777
  msgid "LiteSpeed Cache Purge All"
778
  msgstr ""
779
 
780
+ #: src/gui.cls.php:586 tpl/cdn/entry.tpl.php:7 tpl/cdn/settings.tpl.php:194
781
  #: tpl/db_optm/entry.tpl.php:6
782
  msgid "Manage"
783
  msgstr ""
784
 
785
+ #: src/gui.cls.php:637 tpl/cdn/manage.tpl.php:17
786
  msgid "Cloudflare"
787
  msgstr ""
788
 
789
+ #: src/gui.cls.php:716 tpl/img_optm/summary.tpl.php:175
790
  msgid "Remove all previous unfinished image optimization requests."
791
  msgstr ""
792
 
793
+ #: src/gui.cls.php:717 tpl/img_optm/summary.tpl.php:177
794
  msgid "Clean Up Unfinished Data"
795
  msgstr ""
796
 
797
+ #: src/gui.cls.php:735
798
  msgid "Install %s"
799
  msgstr ""
800
 
801
+ #: src/gui.cls.php:736
802
  msgid "Install Now"
803
  msgstr ""
804
 
805
+ #: src/gui.cls.php:755
806
  msgid ""
807
  "<a href=\"%1$s\" %2$s>View version %3$s details</a> or <a href=\"%4$s\" %5$s "
808
  "target=\"_blank\">update now</a>."
809
  msgstr ""
810
 
811
+ #: src/gui.cls.php:758
812
  msgid "View %1$s version %2$s details"
813
  msgstr ""
814
 
815
+ #: src/gui.cls.php:763
816
  msgid "Update %s now"
817
  msgstr ""
818
 
1960
  msgid "Dismiss this notice"
1961
  msgstr ""
1962
 
1963
+ #. #-#-#-#-# litespeed-cache.pot (LiteSpeed Cache 4.4.6) #-#-#-#-#
1964
  #. Plugin Name of the plugin/theme
1965
  #: tpl/banner/new_version.php:59 tpl/banner/new_version_dev.tpl.php:12
1966
  #: tpl/cache/more_settings_tip.tpl.php:15 tpl/inc/admin_footer.php:8
litespeed-cache.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: LiteSpeed Cache
4
  * Plugin URI: https://www.litespeedtech.com/products/cache-plugins/wordpress-acceleration
5
  * Description: High-performance page caching and site optimization from LiteSpeed
6
- * Version: 4.4.5
7
  * Author: LiteSpeed Technologies
8
  * Author URI: https://www.litespeedtech.com
9
  * License: GPLv3
@@ -33,7 +33,7 @@ if ( defined( 'LSCWP_V' ) ) {
33
  return;
34
  }
35
 
36
- ! defined( 'LSCWP_V' ) && define( 'LSCWP_V', '4.4.5' );
37
 
38
  ! defined( 'LSCWP_CONTENT_DIR' ) && define( 'LSCWP_CONTENT_DIR', WP_CONTENT_DIR ) ;
39
  ! defined( 'LSCWP_DIR' ) && define( 'LSCWP_DIR', __DIR__ . '/' ) ;// Full absolute path '/var/www/html/***/wp-content/plugins/litespeed-cache/' or MU
3
  * Plugin Name: LiteSpeed Cache
4
  * Plugin URI: https://www.litespeedtech.com/products/cache-plugins/wordpress-acceleration
5
  * Description: High-performance page caching and site optimization from LiteSpeed
6
+ * Version: 4.4.6
7
  * Author: LiteSpeed Technologies
8
  * Author URI: https://www.litespeedtech.com
9
  * License: GPLv3
33
  return;
34
  }
35
 
36
+ ! defined( 'LSCWP_V' ) && define( 'LSCWP_V', '4.4.6' );
37
 
38
  ! defined( 'LSCWP_CONTENT_DIR' ) && define( 'LSCWP_CONTENT_DIR', WP_CONTENT_DIR ) ;
39
  ! defined( 'LSCWP_DIR' ) && define( 'LSCWP_DIR', __DIR__ . '/' ) ;// Full absolute path '/var/www/html/***/wp-content/plugins/litespeed-cache/' or MU
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: LiteSpeedTech
3
  Tags: caching, optimize, performance, pagespeed, core web vitals, seo, speed, image optimize, compress, object cache, redis, memcached, database cleaner
4
  Requires at least: 4.0
5
  Tested up to: 5.8.2
6
- Stable tag: 4.4.5
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl.html
9
 
@@ -249,6 +249,14 @@ The vast majority of plugins and themes are compatible with LiteSpeed Cache. The
249
 
250
  == Changelog ==
251
 
 
 
 
 
 
 
 
 
252
  = 4.4.5 - Dec 1 2021 =
253
  * **Data** Fixed potential PHP notice when generating CSS/JS optimized files w/ PHP v7.4+. (Sarah Richardson/silencedgd/slr1979)
254
  * **API** Added `LITESPEED_ESI_OFF` constant to disable ESI, when defined before the WP `init` hook.
3
  Tags: caching, optimize, performance, pagespeed, core web vitals, seo, speed, image optimize, compress, object cache, redis, memcached, database cleaner
4
  Requires at least: 4.0
5
  Tested up to: 5.8.2
6
+ Stable tag: 4.4.6
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl.html
9
 
249
 
250
  == Changelog ==
251
 
252
+ = 4.4.6 - Dec 27 2022 =
253
+ * **Guest** Restored `document.referrer` for organic traffic purpose when enabled Guest Mode. (michelefns)
254
+ * **Image Optimize** Fixed a potential PHP notice when uploading images in WP w/ PHP7.4+. (titsmaker)
255
+ * **ESI** Fixed the Customize-page-widget-esi-settings-can-not-update bug (#422 Abe)
256
+ * **3rd** Reverted ESI adminbar change of Elementor front pages for backward compatibility (#423 Abe)
257
+ * **3rd** Fixed potential PHP warning on ESI disabling when using `Perfmatters`. (Jeffrey Zhang)
258
+ * **Misc** Check if HTTP_REFERER is set or not before using it in Router class. (#425 Abe)
259
+
260
  = 4.4.5 - Dec 1 2021 =
261
  * **Data** Fixed potential PHP notice when generating CSS/JS optimized files w/ PHP v7.4+. (Sarah Richardson/silencedgd/slr1979)
262
  * **API** Added `LITESPEED_ESI_OFF` constant to disable ESI, when defined before the WP `init` hook.
src/admin-settings.cls.php CHANGED
@@ -326,14 +326,16 @@ class Admin_Settings extends Base {
326
  $instance[ Conf::OPTION_NAME ][ ESI::WIDGET_O_TTL ] = $ttl ;
327
 
328
  $current = ! empty( $old_instance[ Conf::OPTION_NAME ] ) ? $old_instance[ Conf::OPTION_NAME ] : false ;
329
- if ( ! $current || $esi != $current[ ESI::WIDGET_O_ESIENABLE ] ) {
330
- Purge::purge_all( 'Wdiget ESI_enable changed' ) ;
331
- }
332
- elseif ( $ttl != 0 && $ttl != $current[ ESI::WIDGET_O_TTL ] ) {
333
- Purge::add( Tag::TYPE_WIDGET . $widget->id ) ;
334
- }
 
335
 
336
- Purge::purge_all( 'Wdiget saved' ) ;
 
337
  return $instance ;
338
  }
339
  }
326
  $instance[ Conf::OPTION_NAME ][ ESI::WIDGET_O_TTL ] = $ttl ;
327
 
328
  $current = ! empty( $old_instance[ Conf::OPTION_NAME ] ) ? $old_instance[ Conf::OPTION_NAME ] : false ;
329
+ if ( ! strpos( $_SERVER[ 'HTTP_REFERER' ], '/wp-admin/customize.php') ) {
330
+ if ( ! $current || $esi != $current[ ESI::WIDGET_O_ESIENABLE ] ) {
331
+ Purge::purge_all( 'Wdiget ESI_enable changed' ) ;
332
+ }
333
+ elseif ( $ttl != 0 && $ttl != $current[ ESI::WIDGET_O_TTL ] ) {
334
+ Purge::add( Tag::TYPE_WIDGET . $widget->id ) ;
335
+ }
336
 
337
+ Purge::purge_all( 'Wdiget saved' ) ;
338
+ }
339
  return $instance ;
340
  }
341
  }
src/gui.cls.php CHANGED
@@ -22,6 +22,7 @@ class GUI extends Base {
22
  );
23
 
24
  const LIB_GUEST_JS = 'assets/js/guest.min.js';
 
25
  const PHP_GUEST = 'guest.vary.php';
26
 
27
  const TYPE_DISMISS_WHM = 'whm';
@@ -775,6 +776,11 @@ class GUI extends Base {
775
  public function finalize( $buffer ) {
776
  $buffer = $this->_clean_wrapper( $buffer );
777
 
 
 
 
 
 
778
  if ( defined( 'LITESPEED_GUEST' ) && LITESPEED_GUEST && strpos( $buffer, '</body>' ) !== false ) {
779
  $buffer = $this->_enqueue_guest_js( $buffer );
780
  }
@@ -782,6 +788,17 @@ class GUI extends Base {
782
  return $buffer;
783
  }
784
 
 
 
 
 
 
 
 
 
 
 
 
785
  /**
786
  * Append guest JS to update vary
787
  *
@@ -792,7 +809,7 @@ class GUI extends Base {
792
  // $guest_update_url = add_query_arg( 'litespeed_guest', 1, home_url( '/' ) );
793
  $guest_update_url = LSWCP_PLUGIN_URL . self::PHP_GUEST;
794
  $js_con = str_replace( 'litespeed_url', esc_url( $guest_update_url ), $js_con );
795
- $buffer = str_replace( '</body>', '<script data-no-optimize="1">' . $js_con . '</script></body>', $buffer );
796
  return $buffer;
797
  }
798
 
22
  );
23
 
24
  const LIB_GUEST_JS = 'assets/js/guest.min.js';
25
+ const LIB_GUEST_DOCREF_JS = 'assets/js/guest.docref.min.js';
26
  const PHP_GUEST = 'guest.vary.php';
27
 
28
  const TYPE_DISMISS_WHM = 'whm';
776
  public function finalize( $buffer ) {
777
  $buffer = $this->_clean_wrapper( $buffer );
778
 
779
+ // Maybe restore doc.ref
780
+ if ( $this->conf( Base::O_GUEST ) && strpos( $buffer, '<head>' ) !== false ) {
781
+ $buffer = $this->_enqueue_guest_docref_js( $buffer );
782
+ }
783
+
784
  if ( defined( 'LITESPEED_GUEST' ) && LITESPEED_GUEST && strpos( $buffer, '</body>' ) !== false ) {
785
  $buffer = $this->_enqueue_guest_js( $buffer );
786
  }
788
  return $buffer;
789
  }
790
 
791
+ /**
792
+ * Append guest restore doc.ref JS for organic traffic count
793
+ *
794
+ * @since 4.4.6
795
+ */
796
+ private function _enqueue_guest_docref_js( $buffer ) {
797
+ $js_con = File::read( LSCWP_DIR . self::LIB_GUEST_DOCREF_JS );
798
+ $buffer = preg_replace( '/<head>/', '<head><script data-no-optimize="1">' . $js_con . '</script>', $buffer, 1 );
799
+ return $buffer;
800
+ }
801
+
802
  /**
803
  * Append guest JS to update vary
804
  *
809
  // $guest_update_url = add_query_arg( 'litespeed_guest', 1, home_url( '/' ) );
810
  $guest_update_url = LSWCP_PLUGIN_URL . self::PHP_GUEST;
811
  $js_con = str_replace( 'litespeed_url', esc_url( $guest_update_url ), $js_con );
812
+ $buffer = preg_replace( '/<\/body>/', '<script data-no-optimize="1">' . $js_con . '</script></body>', $buffer, 1 );
813
  return $buffer;
814
  }
815
 
src/img-optm.cls.php CHANGED
@@ -271,7 +271,7 @@ class Img_Optm extends Base {
271
  }
272
  $this->_insert_img_optm( $data_to_add, 'post_id, optm_status, src' );
273
 
274
- unset( $this->_img_in_queue_missed );
275
  return $count;
276
  }
277
 
@@ -291,7 +291,7 @@ class Img_Optm extends Base {
291
  $this->_insert_img_optm( $data );
292
 
293
  $count = count( $this->_img_in_queue );
294
- unset( $this->_img_in_queue );
295
 
296
  Debug2::debug( '[Img_Optm] Added raw images [total] ' . $count );
297
 
271
  }
272
  $this->_insert_img_optm( $data_to_add, 'post_id, optm_status, src' );
273
 
274
+ $this->_img_in_queue_missed = array();
275
  return $count;
276
  }
277
 
291
  $this->_insert_img_optm( $data );
292
 
293
  $count = count( $this->_img_in_queue );
294
+ $this->_img_in_queue = array();
295
 
296
  Debug2::debug( '[Img_Optm] Added raw images [total] ' . $count );
297
 
src/router.cls.php CHANGED
@@ -190,7 +190,7 @@ class Router extends Base {
190
  if (
191
  ! empty( $_SERVER[ 'REQUEST_URI' ] ) &&
192
  strpos( $_SERVER[ 'REQUEST_URI' ], $rest_prefix . '/wp/v2/media' ) !== false &&
193
- strpos( $_SERVER[ 'HTTP_REFERER' ], 'wp-admin') !== false
194
  ) {
195
  Debug2::debug( '[Router] CDN bypassed: wp-json on admin page' );
196
  $can = false;
190
  if (
191
  ! empty( $_SERVER[ 'REQUEST_URI' ] ) &&
192
  strpos( $_SERVER[ 'REQUEST_URI' ], $rest_prefix . '/wp/v2/media' ) !== false &&
193
+ isset( $_SERVER[ 'HTTP_REFERER' ] ) && strpos( $_SERVER[ 'HTTP_REFERER' ], 'wp-admin') !== false
194
  ) {
195
  Debug2::debug( '[Router] CDN bypassed: wp-json on admin page' );
196
  $can = false;
thirdparty/elementor.cls.php CHANGED
@@ -18,7 +18,7 @@ class Elementor
18
  }
19
 
20
  if ( ! is_admin() ) {
21
- add_action( 'init', __CLASS__ . '::disable_litespeed_esi', 4 );
22
  }
23
 
24
  if ( isset( $_GET[ 'action' ] ) && $_GET[ 'action' ] === 'elementor' ) {
18
  }
19
 
20
  if ( ! is_admin() ) {
21
+ // add_action( 'init', __CLASS__ . '::disable_litespeed_esi', 4 ); // temporarily comment out this line for backward compatibility
22
  }
23
 
24
  if ( isset( $_GET[ 'action' ] ) && $_GET[ 'action' ] === 'elementor' ) {
thirdparty/perfmatters.cls.php CHANGED
@@ -7,10 +7,8 @@
7
  namespace LiteSpeed\Thirdparty;
8
  defined( 'WPINC' ) || exit;
9
 
10
- class Perfmatters
11
- {
12
- public static function preload()
13
- {
14
  if ( ! defined( 'PERFMATTERS_VERSION' ) ) return;
15
 
16
  if ( is_admin() ) return;
@@ -20,8 +18,7 @@ class Perfmatters
20
  }
21
  }
22
 
23
- public static function disable_litespeed_esi()
24
- {
25
- define( 'LITESPEED_ESI_OFF', true );
26
  }
27
  }
7
  namespace LiteSpeed\Thirdparty;
8
  defined( 'WPINC' ) || exit;
9
 
10
+ class Perfmatters {
11
+ public static function preload() {
 
 
12
  if ( ! defined( 'PERFMATTERS_VERSION' ) ) return;
13
 
14
  if ( is_admin() ) return;
18
  }
19
  }
20
 
21
+ public static function disable_litespeed_esi() {
22
+ defined( 'LITESPEED_ESI_OFF' ) || define( 'LITESPEED_ESI_OFF', true );
 
23
  }
24
  }
tpl/toolbox/beta_test.tpl.php CHANGED
@@ -4,6 +4,7 @@ defined( 'WPINC' ) || exit;
4
 
5
  // Existing public version list
6
  $v_list = array(
 
7
  '4.4.5',
8
  '4.4.4',
9
  '4.4.3',
4
 
5
  // Existing public version list
6
  $v_list = array(
7
+ '4.4.6',
8
  '4.4.5',
9
  '4.4.4',
10
  '4.4.3',