LiteSpeed Cache - Version 2.9.7.2

Version Description

  • May 2 2019 =
  • Conf: Enhanced compatibility when an option is not properly initialized.
  • Conf: Prevent non-array instance in widget from causing 500 error. (#210407)
  • CCSS: Increase CCSS generation timeout to 60s.
  • Media: Renamed lazyload CSS class to avoid conflicts with other plugins. (@DynamoProd)
  • JS: Improved W3 validator. (@istanbulantik)
  • QUIC: Synced cache tag prefix for static files cache.
  • ESI: Restored query strings to ESI admin bar for accurate rendering. (#977284)
  • ESI: Tweaked ESI init priority to honor LITESPEED_DISABLE_ALL const. ESI will now init after plugin loaded.
  • ESI: No longer initialize ESI if ESI option is OFF.
  • API: New "Disable All" API function.
  • API: New "Force public cache" API function.
  • Vary: Fixed an issue with saving vary groups.
  • IAPI: Fixed an issue where image md5 validation failed due to whitespace in the image path.
  • 3rd: Bypass all optimization/ESI/Cache features when entering Divi Theme Builder frontend editor.
  • 3rd: Fixed an issue where DIVI admin bar exit button didn't work when ESI was ON.
Download this release

Release Info

Developer hailite
Plugin Icon 128x128 LiteSpeed Cache
Version 2.9.7.2
Comparing to
See all releases

Code changes from version 2.9.7.1 to 2.9.7.2

admin/litespeed-cache-admin-settings.class.php CHANGED
@@ -1199,7 +1199,7 @@ class LiteSpeed_Cache_Admin_Settings
1199
  }
1200
 
1201
  // Save vary group settings
1202
- $this->_save_item( LiteSpeed_Cache_Config::VARY_GROUP ) ;
1203
  }
1204
 
1205
  /**
1199
  }
1200
 
1201
  // Save vary group settings
1202
+ $this->_save_item( LiteSpeed_Cache_Config::VARY_GROUP, 'array' ) ;
1203
  }
1204
 
1205
  /**
admin/tpl/inc/banner_promo.ajax.php CHANGED
@@ -4,7 +4,7 @@ if ( ! defined( 'WPINC' ) ) die ;
4
  $url = LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_UTIL, LiteSpeed_Cache_Utility::TYPE_SCORE_CHK, true ) ;
5
  $url = htmlspecialchars_decode( $url ) ;
6
  ?>
7
- <script type='text/javascript'>
8
  document.addEventListener( 'DOMContentLoaded', function( event ) {
9
  jQuery(document).ready( function() {
10
  jQuery.get( '<?php echo $url ?>' ) ;
4
  $url = LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_UTIL, LiteSpeed_Cache_Utility::TYPE_SCORE_CHK, true ) ;
5
  $url = htmlspecialchars_decode( $url ) ;
6
  ?>
7
+ <script>
8
  document.addEventListener( 'DOMContentLoaded', function( event ) {
9
  jQuery(document).ready( function() {
10
  jQuery.get( '<?php echo $url ?>' ) ;
admin/tpl/setting/settings_cdn.php CHANGED
@@ -191,9 +191,9 @@ $cdn_mapping = $this->config->get_item( LiteSpeed_Cache_Config::ITEM_CDN_MAPPING
191
  <a id='litespeed_modal_href' href="https://quic.cloud" target="_blank">Register for free at QUIC.cloud</a>
192
 
193
  <!-- <link rel="stylesheet" href="<?php echo LSWCP_PLUGIN_URL ; ?>css/iziModal.min.css"> -->
194
- <!-- <script type="text/javascript" src="<?php echo LSWCP_PLUGIN_URL ; ?>js/iziModal.min.js"></script> -->
195
  <!-- <div id="litespeed_modal"></div> -->
196
- <script type="text/javascript">
197
  // var litespeed_modal = jQuery("#litespeed_modal").iziModal({iframe: true});
198
  // jQuery("#litespeed_modal_href").click(function(event) {
199
  // event.preventDefault();
191
  <a id='litespeed_modal_href' href="https://quic.cloud" target="_blank">Register for free at QUIC.cloud</a>
192
 
193
  <!-- <link rel="stylesheet" href="<?php echo LSWCP_PLUGIN_URL ; ?>css/iziModal.min.css"> -->
194
+ <!-- <script src="<?php echo LSWCP_PLUGIN_URL ; ?>js/iziModal.min.js"></script> -->
195
  <!-- <div id="litespeed_modal"></div> -->
196
+ <script>
197
  // var litespeed_modal = jQuery("#litespeed_modal").iziModal({iframe: true});
198
  // jQuery("#litespeed_modal_href").click(function(event) {
199
  // event.preventDefault();
admin/tpl/setting/settings_crawler.php CHANGED
@@ -162,7 +162,7 @@ if ( !defined('WPINC') ) die;
162
  </div>
163
 
164
  <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.min.js"></script>
165
- <script type="text/javascript">
166
  var cookie_crawler = new Vue( {
167
  el: '#cookie_crawler',
168
  data: {
162
  </div>
163
 
164
  <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.min.js"></script>
165
+ <script>
166
  var cookie_crawler = new Vue( {
167
  el: '#cookie_crawler',
168
  data: {
admin/tpl/setting/settings_esi.php CHANGED
@@ -78,7 +78,7 @@ if ( ! defined( 'WPINC' ) ) die ;
78
  <td class='litespeed-vary-title'><?php echo $title ; ?></td>
79
  <td class='litespeed-vary-val'>
80
  <input type="text" class="litespeed-input-short"
81
- name="<?php echo LiteSpeed_Cache_Config::VARY_GROUP ; ?>[<?php echo $role ; ?>]"
82
  value="<?php echo $this->config->in_vary_group( $role ) ; ?>" />
83
  </td>
84
  </tr>
78
  <td class='litespeed-vary-title'><?php echo $title ; ?></td>
79
  <td class='litespeed-vary-val'>
80
  <input type="text" class="litespeed-input-short"
81
+ name="<?php echo LiteSpeed_Cache_Config::OPTION_NAME ; ?>[<?php echo LiteSpeed_Cache_Config::VARY_GROUP ; ?>][<?php echo $role ; ?>]"
82
  value="<?php echo $this->config->in_vary_group( $role ) ; ?>" />
83
  </td>
84
  </tr>
inc/api.class.php CHANGED
@@ -37,6 +37,19 @@ class LiteSpeed_Cache_API extends LiteSpeed_Cache_Const
37
  const WIDGET_OPID_ESIENABLE = LiteSpeed_Cache_ESI::WIDGET_OPID_ESIENABLE ;
38
  const WIDGET_OPID_TTL = LiteSpeed_Cache_ESI::WIDGET_OPID_TTL ;
39
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  /**
41
  * Force to set an option
42
  * Note: it will only affect the AFTER usage of that option
@@ -148,6 +161,17 @@ class LiteSpeed_Cache_API extends LiteSpeed_Cache_Const
148
  LiteSpeed_Cache_Control::force_cacheable( $reason ) ;
149
  }
150
 
 
 
 
 
 
 
 
 
 
 
 
151
  /**
152
  * Get current not cacheable status
153
  *
@@ -627,7 +651,7 @@ class LiteSpeed_Cache_API extends LiteSpeed_Cache_Const
627
  */
628
  public static function hook_init( $hook )
629
  {
630
- add_action('litespeed_init', $hook) ;
631
  }
632
 
633
  }
37
  const WIDGET_OPID_ESIENABLE = LiteSpeed_Cache_ESI::WIDGET_OPID_ESIENABLE ;
38
  const WIDGET_OPID_TTL = LiteSpeed_Cache_ESI::WIDGET_OPID_TTL ;
39
 
40
+ /**
41
+ * Disable All
42
+ *
43
+ * @since 2.9.7.2
44
+ * @access public
45
+ */
46
+ public static function disable_all( $reason )
47
+ {
48
+ self::debug( '[API] Disabled_all due to ' . $reason ) ;
49
+
50
+ ! defined( 'LITESPEED_DISABLE_ALL' ) && define( 'LITESPEED_DISABLE_ALL', true ) ;
51
+ }
52
+
53
  /**
54
  * Force to set an option
55
  * Note: it will only affect the AFTER usage of that option
161
  LiteSpeed_Cache_Control::force_cacheable( $reason ) ;
162
  }
163
 
164
+ /**
165
+ * Set cache to force public cache if cacheable ( Will ignore most kinds of non-cacheable conditions )
166
+ *
167
+ * @since 2.9.7.2
168
+ * @access public
169
+ */
170
+ public static function set_force_public( $reason )
171
+ {
172
+ LiteSpeed_Cache_Control::set_public_forced( $reason ) ;
173
+ }
174
+
175
  /**
176
  * Get current not cacheable status
177
  *
651
  */
652
  public static function hook_init( $hook )
653
  {
654
+ add_action( 'litespeed_init', $hook ) ;
655
  }
656
 
657
  }
inc/const.cls.php CHANGED
@@ -626,6 +626,7 @@ class LiteSpeed_Cache_Const
626
  'LITESPEED_ON',
627
  'LITESPEED_ON_IN_SETTING',
628
  'LSCACHE_ADV_CACHE',
 
629
  ) ;
630
  $server_vars = array() ;
631
  foreach ( $consts as $v ) {
626
  'LITESPEED_ON',
627
  'LITESPEED_ON_IN_SETTING',
628
  'LSCACHE_ADV_CACHE',
629
+ 'LSWCP_TAG_PREFIX',
630
  ) ;
631
  $server_vars = array() ;
632
  foreach ( $consts as $v ) {
inc/css.cls.php CHANGED
@@ -249,7 +249,7 @@ class LiteSpeed_Cache_CSS
249
 
250
  LiteSpeed_Cache_Log::debug( '[CSS] Generating: ', $data ) ;
251
 
252
- $json = LiteSpeed_Cache_Admin_API::post( LiteSpeed_Cache_Admin_API::IAPI_ACTION_CCSS, $data, true, false ) ;
253
 
254
  if ( empty( $json[ 'ccss' ] ) ) {
255
  LiteSpeed_Cache_Log::debug( '[CSS] empty ccss ' ) ;
249
 
250
  LiteSpeed_Cache_Log::debug( '[CSS] Generating: ', $data ) ;
251
 
252
+ $json = LiteSpeed_Cache_Admin_API::post( LiteSpeed_Cache_Admin_API::IAPI_ACTION_CCSS, $data, true, false, 60 ) ;
253
 
254
  if ( empty( $json[ 'ccss' ] ) ) {
255
  LiteSpeed_Cache_Log::debug( '[CSS] empty ccss ' ) ;
inc/esi.class.php CHANGED
@@ -42,6 +42,36 @@ class LiteSpeed_Cache_ESI
42
  * @access private
43
  */
44
  private function __construct()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  {
46
  add_action( 'template_include', 'LiteSpeed_Cache_ESI::esi_template', 100 ) ;
47
 
@@ -76,13 +106,6 @@ class LiteSpeed_Cache_ESI
76
  add_shortcode( 'esi', array( $this, 'shortcode' ) ) ;
77
  }
78
 
79
- /**
80
- * Overwrite wp_create_nonce func
81
- * @since 2.9.5
82
- */
83
- if ( ! is_admin() && ! function_exists( 'wp_create_nonce' ) ) {
84
- $this->_transform_nonce() ;
85
- }
86
  }
87
 
88
  /**
@@ -97,7 +120,7 @@ class LiteSpeed_Cache_ESI
97
  * If the nonce is in none_actions filter, convert it to ESI
98
  */
99
  function wp_create_nonce( $action = -1 ) {
100
- if ( LiteSpeed_Cache_ESI::get_instance()->is_nonce_action( $action ) ) {
101
  $params = array(
102
  'action' => $action,
103
  ) ;
@@ -282,7 +305,7 @@ class LiteSpeed_Cache_ESI
282
  return ;
283
  }
284
 
285
- add_filter('widget_display_callback', array($this, 'sub_widget_block'), 0, 3) ;
286
 
287
  // Add admin_bar esi
288
  if ( LiteSpeed_Cache_Router::is_logged_in() ) {
@@ -586,8 +609,13 @@ class LiteSpeed_Cache_ESI
586
  * @param array $args Parameter used to build the widget.
587
  * @return mixed Return false if display through esi, instance otherwise.
588
  */
589
- public function sub_widget_block( array $instance, WP_Widget $widget, array $args )
590
  {
 
 
 
 
 
591
  $name = get_class( $widget ) ;
592
  if ( ! isset( $instance[ LiteSpeed_Cache_Config::OPTION_NAME ] ) ) {
593
  return $instance ;
@@ -675,6 +703,20 @@ class LiteSpeed_Cache_ESI
675
  */
676
  public function load_admin_bar_block( $params )
677
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
678
  wp_admin_bar_render() ;
679
 
680
  if ( ! LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_ESI_CACHE_ADMBAR ) ) {
42
  * @access private
43
  */
44
  private function __construct()
45
+ {
46
+ /**
47
+ * Bypass ESI related funcs if disabled ESI to fix potential DIVI compatibility issue
48
+ * @since 2.9.7.2
49
+ */
50
+ if ( LiteSpeed_Cache_Router::is_ajax() || ! LiteSpeed_Cache_Router::esi_enabled() ) {
51
+ return ;
52
+ }
53
+
54
+ // Init ESI in `after_setup_theme` hook after detected if LITESPEED_DISABLE_ALL is ON or not
55
+ add_action( 'litespeed_initing', array( $this, 'esi_init' ) ) ;
56
+
57
+ /**
58
+ * Overwrite wp_create_nonce func
59
+ * @since 2.9.5
60
+ */
61
+ if ( ! is_admin() && ! function_exists( 'wp_create_nonce' ) ) {
62
+ $this->_transform_nonce() ;
63
+ }
64
+ }
65
+
66
+ /**
67
+ * Init ESI related hooks
68
+ *
69
+ * Load delayed by hook to give the ability to bypass by LITESPEED_DISABLE_ALL const
70
+ *
71
+ * @since 2.9.7.2
72
+ * @access public
73
+ */
74
+ public function esi_init()
75
  {
76
  add_action( 'template_include', 'LiteSpeed_Cache_ESI::esi_template', 100 ) ;
77
 
106
  add_shortcode( 'esi', array( $this, 'shortcode' ) ) ;
107
  }
108
 
 
 
 
 
 
 
 
109
  }
110
 
111
  /**
120
  * If the nonce is in none_actions filter, convert it to ESI
121
  */
122
  function wp_create_nonce( $action = -1 ) {
123
+ if ( ! defined( 'LITESPEED_DISABLE_ALL' ) && LiteSpeed_Cache_ESI::get_instance()->is_nonce_action( $action ) ) {
124
  $params = array(
125
  'action' => $action,
126
  ) ;
305
  return ;
306
  }
307
 
308
+ add_filter('widget_display_callback', array($this, 'sub_widget_block'), 0, 3) ;
309
 
310
  // Add admin_bar esi
311
  if ( LiteSpeed_Cache_Router::is_logged_in() ) {
609
  * @param array $args Parameter used to build the widget.
610
  * @return mixed Return false if display through esi, instance otherwise.
611
  */
612
+ public function sub_widget_block( $instance, WP_Widget $widget, array $args )
613
  {
614
+ // #210407
615
+ if ( ! is_array( $instance ) ) {
616
+ return $instance ;
617
+ }
618
+
619
  $name = get_class( $widget ) ;
620
  if ( ! isset( $instance[ LiteSpeed_Cache_Config::OPTION_NAME ] ) ) {
621
  return $instance ;
703
  */
704
  public function load_admin_bar_block( $params )
705
  {
706
+
707
+ if ( ! empty( $params[ 'ref' ] ) ) {
708
+ $ref_qs = parse_url( $params[ 'ref' ], PHP_URL_QUERY ) ;
709
+ if ( ! empty( $ref_qs ) ) {
710
+ parse_str( $ref_qs, $ref_qs_arr ) ;
711
+
712
+ if ( ! empty( $ref_qs_arr ) ) {
713
+ foreach ( $ref_qs_arr as $k => $v ) {
714
+ $_GET[ $k ] = $v ;
715
+ }
716
+ }
717
+ }
718
+ }
719
+
720
  wp_admin_bar_render() ;
721
 
722
  if ( ! LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_ESI_CACHE_ADMBAR ) ) {
inc/litespeed-cache.class.php CHANGED
@@ -26,7 +26,7 @@ class LiteSpeed_Cache
26
  const NAME = 'LiteSpeed Cache' ;
27
  const PLUGIN_NAME = 'litespeed-cache' ;
28
  const PLUGIN_FILE = 'litespeed-cache/litespeed-cache.php' ;
29
- const PLUGIN_VERSION = '2.9.7.1' ;
30
 
31
  const PAGE_EDIT_HTACCESS = 'lscache-edit-htaccess' ;
32
 
@@ -105,7 +105,7 @@ class LiteSpeed_Cache
105
  }
106
 
107
  if ( self::config( LiteSpeed_Cache_Config::OPID_DEBUG_DISABLE_ALL ) ) {
108
- define( 'LITESPEED_DISABLE_ALL', true ) ;
109
  }
110
 
111
  /**
@@ -139,6 +139,7 @@ class LiteSpeed_Cache
139
  /**
140
  * Added hook before init
141
  * @since 1.6.6
 
142
  */
143
  do_action( 'litespeed_before_init' ) ;
144
 
@@ -146,9 +147,7 @@ class LiteSpeed_Cache
146
  * Preload ESI functionality for ESI request uri recovery
147
  * @since 1.8.1
148
  */
149
- if ( ! LiteSpeed_Cache_Router::is_ajax() && LiteSpeed_Cache_Router::esi_enabled() ) {
150
- LiteSpeed_Cache_ESI::get_instance() ;
151
- }
152
  }
153
 
154
  /**
@@ -192,6 +191,8 @@ class LiteSpeed_Cache
192
  return ;
193
  }
194
 
 
 
195
  ob_start( array( $this, 'send_headers_force' ) ) ;
196
  add_action( 'shutdown', array( $this, 'send_headers' ), 0 ) ;
197
  add_action( 'wp_footer', 'LiteSpeed_Cache::footer_hook' ) ;
26
  const NAME = 'LiteSpeed Cache' ;
27
  const PLUGIN_NAME = 'litespeed-cache' ;
28
  const PLUGIN_FILE = 'litespeed-cache/litespeed-cache.php' ;
29
+ const PLUGIN_VERSION = '2.9.7.2' ;
30
 
31
  const PAGE_EDIT_HTACCESS = 'lscache-edit-htaccess' ;
32
 
105
  }
106
 
107
  if ( self::config( LiteSpeed_Cache_Config::OPID_DEBUG_DISABLE_ALL ) ) {
108
+ ! defined( 'LITESPEED_DISABLE_ALL' ) && define( 'LITESPEED_DISABLE_ALL', true ) ;
109
  }
110
 
111
  /**
139
  /**
140
  * Added hook before init
141
  * @since 1.6.6
142
+ * @deprecated 2.9.7.2 This can't be used by any plugin due to unpredictable plugin loading priority.
143
  */
144
  do_action( 'litespeed_before_init' ) ;
145
 
147
  * Preload ESI functionality for ESI request uri recovery
148
  * @since 1.8.1
149
  */
150
+ LiteSpeed_Cache_ESI::get_instance() ;
 
 
151
  }
152
 
153
  /**
191
  return ;
192
  }
193
 
194
+ do_action( 'litespeed_initing' ) ;
195
+
196
  ob_start( array( $this, 'send_headers_force' ) ) ;
197
  add_action( 'shutdown', array( $this, 'send_headers' ), 0 ) ;
198
  add_action( 'wp_footer', 'LiteSpeed_Cache::footer_hook' ) ;
inc/media.class.php CHANGED
@@ -415,7 +415,7 @@ eot;
415
  // Include lazyload lib js and init lazyload
416
  if ( $cfg_img_lazy || $cfg_iframe_lazy ) {
417
  if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_MEDIA_IMG_LAZYJS_INLINE ) ) {
418
- $lazy_lib = '<script type="text/javascript">' . Litespeed_File::read( LSCWP_DIR . self::LIB_FILE_IMG_LAZYLOAD ) . '</script>' ;
419
  } else {
420
  $lazy_lib_url = LSWCP_PLUGIN_URL . self::LIB_FILE_IMG_LAZYLOAD ;
421
  $lazy_lib = '<script src="' . $lazy_lib_url . '"></script>' ;
415
  // Include lazyload lib js and init lazyload
416
  if ( $cfg_img_lazy || $cfg_iframe_lazy ) {
417
  if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_MEDIA_IMG_LAZYJS_INLINE ) ) {
418
+ $lazy_lib = '<script>' . Litespeed_File::read( LSCWP_DIR . self::LIB_FILE_IMG_LAZYLOAD ) . '</script>' ;
419
  } else {
420
  $lazy_lib_url = LSWCP_PLUGIN_URL . self::LIB_FILE_IMG_LAZYLOAD ;
421
  $lazy_lib = '<script src="' . $lazy_lib_url . '"></script>' ;
inc/optimize.class.php CHANGED
@@ -555,7 +555,7 @@ class LiteSpeed_Cache_Optimize
555
  if ( $this->cfg_css_async ) {
556
  // Inline css async lib
557
  if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPT_OPTM_CSS_ASYNC_INLINE ) ) {
558
- $this->html_head .= '<script id="litespeed-css-async-lib" type="text/javascript">' . Litespeed_File::read( LSCWP_DIR . self::LIB_FILE_CSS_ASYNC ) . '</script>' ;
559
  }
560
  else {
561
  $css_async_lib_url = LSWCP_PLUGIN_URL . self::LIB_FILE_CSS_ASYNC ;
@@ -625,7 +625,7 @@ class LiteSpeed_Cache_Optimize
625
  * -> family: PT Sans:400,700|PT Sans Narrow:400|Montserrat:600
626
  * <link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,300,300italic,400italic,600,700,900&#038;subset=latin%2Clatin-ext' />
627
  */
628
- $html .='<script type="text/javascript">WebFontConfig={google:{families:[' ;
629
 
630
  $families = array() ;
631
  foreach ( $this->_ggfonts_urls as $v ) {
555
  if ( $this->cfg_css_async ) {
556
  // Inline css async lib
557
  if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPT_OPTM_CSS_ASYNC_INLINE ) ) {
558
+ $this->html_head .= '<script id="litespeed-css-async-lib">' . Litespeed_File::read( LSCWP_DIR . self::LIB_FILE_CSS_ASYNC ) . '</script>' ;
559
  }
560
  else {
561
  $css_async_lib_url = LSWCP_PLUGIN_URL . self::LIB_FILE_CSS_ASYNC ;
625
  * -> family: PT Sans:400,700|PT Sans Narrow:400|Montserrat:600
626
  * <link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,300,300italic,400italic,600,700,900&#038;subset=latin%2Clatin-ext' />
627
  */
628
+ $html .='<script>WebFontConfig={google:{families:[' ;
629
 
630
  $families = array() ;
631
  foreach ( $this->_ggfonts_urls as $v ) {
inc/utility.class.php CHANGED
@@ -329,6 +329,16 @@ class LiteSpeed_Cache_Utility
329
  */
330
  public static function str_hit_array( $needle, $haystack, $has_ttl = false )
331
  {
 
 
 
 
 
 
 
 
 
 
332
  $hit = false ;
333
  $this_ttl = 0 ;
334
  foreach( $haystack as $item ) {
329
  */
330
  public static function str_hit_array( $needle, $haystack, $has_ttl = false )
331
  {
332
+ /**
333
+ * Safety check to avoid PHP warning
334
+ * @see https://github.com/litespeedtech/lscache_wp/pull/131/commits/45fc03af308c7d6b5583d1664fad68f75fb6d017
335
+ */
336
+ if ( ! is_array( $haystack ) ) {
337
+ LiteSpeed_Cache_Log::debug( "[Util] ❌ bad param in str_hit_array()!" ) ;
338
+
339
+ return false ;
340
+ }
341
+
342
  $hit = false ;
343
  $this_ttl = 0 ;
344
  foreach( $haystack as $item ) {
includes/litespeed-cache-api.class.php CHANGED
@@ -37,6 +37,19 @@ class LiteSpeed_Cache_API extends LiteSpeed_Cache_Const
37
  const WIDGET_OPID_ESIENABLE = LiteSpeed_Cache_ESI::WIDGET_OPID_ESIENABLE ;
38
  const WIDGET_OPID_TTL = LiteSpeed_Cache_ESI::WIDGET_OPID_TTL ;
39
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  /**
41
  * Force to set an option
42
  * Note: it will only affect the AFTER usage of that option
@@ -148,6 +161,17 @@ class LiteSpeed_Cache_API extends LiteSpeed_Cache_Const
148
  LiteSpeed_Cache_Control::force_cacheable( $reason ) ;
149
  }
150
 
 
 
 
 
 
 
 
 
 
 
 
151
  /**
152
  * Get current not cacheable status
153
  *
@@ -627,7 +651,7 @@ class LiteSpeed_Cache_API extends LiteSpeed_Cache_Const
627
  */
628
  public static function hook_init( $hook )
629
  {
630
- add_action('litespeed_init', $hook) ;
631
  }
632
 
633
  }
37
  const WIDGET_OPID_ESIENABLE = LiteSpeed_Cache_ESI::WIDGET_OPID_ESIENABLE ;
38
  const WIDGET_OPID_TTL = LiteSpeed_Cache_ESI::WIDGET_OPID_TTL ;
39
 
40
+ /**
41
+ * Disable All
42
+ *
43
+ * @since 2.9.7.2
44
+ * @access public
45
+ */
46
+ public static function disable_all( $reason )
47
+ {
48
+ self::debug( '[API] Disabled_all due to ' . $reason ) ;
49
+
50
+ ! defined( 'LITESPEED_DISABLE_ALL' ) && define( 'LITESPEED_DISABLE_ALL', true ) ;
51
+ }
52
+
53
  /**
54
  * Force to set an option
55
  * Note: it will only affect the AFTER usage of that option
161
  LiteSpeed_Cache_Control::force_cacheable( $reason ) ;
162
  }
163
 
164
+ /**
165
+ * Set cache to force public cache if cacheable ( Will ignore most kinds of non-cacheable conditions )
166
+ *
167
+ * @since 2.9.7.2
168
+ * @access public
169
+ */
170
+ public static function set_force_public( $reason )
171
+ {
172
+ LiteSpeed_Cache_Control::set_public_forced( $reason ) ;
173
+ }
174
+
175
  /**
176
  * Get current not cacheable status
177
  *
651
  */
652
  public static function hook_init( $hook )
653
  {
654
+ add_action( 'litespeed_init', $hook ) ;
655
  }
656
 
657
  }
includes/litespeed-cache-esi.class.php CHANGED
@@ -42,6 +42,36 @@ class LiteSpeed_Cache_ESI
42
  * @access private
43
  */
44
  private function __construct()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  {
46
  add_action( 'template_include', 'LiteSpeed_Cache_ESI::esi_template', 100 ) ;
47
 
@@ -76,13 +106,6 @@ class LiteSpeed_Cache_ESI
76
  add_shortcode( 'esi', array( $this, 'shortcode' ) ) ;
77
  }
78
 
79
- /**
80
- * Overwrite wp_create_nonce func
81
- * @since 2.9.5
82
- */
83
- if ( ! is_admin() && ! function_exists( 'wp_create_nonce' ) ) {
84
- $this->_transform_nonce() ;
85
- }
86
  }
87
 
88
  /**
@@ -97,7 +120,7 @@ class LiteSpeed_Cache_ESI
97
  * If the nonce is in none_actions filter, convert it to ESI
98
  */
99
  function wp_create_nonce( $action = -1 ) {
100
- if ( LiteSpeed_Cache_ESI::get_instance()->is_nonce_action( $action ) ) {
101
  $params = array(
102
  'action' => $action,
103
  ) ;
@@ -282,7 +305,7 @@ class LiteSpeed_Cache_ESI
282
  return ;
283
  }
284
 
285
- add_filter('widget_display_callback', array($this, 'sub_widget_block'), 0, 3) ;
286
 
287
  // Add admin_bar esi
288
  if ( LiteSpeed_Cache_Router::is_logged_in() ) {
@@ -586,8 +609,13 @@ class LiteSpeed_Cache_ESI
586
  * @param array $args Parameter used to build the widget.
587
  * @return mixed Return false if display through esi, instance otherwise.
588
  */
589
- public function sub_widget_block( array $instance, WP_Widget $widget, array $args )
590
  {
 
 
 
 
 
591
  $name = get_class( $widget ) ;
592
  if ( ! isset( $instance[ LiteSpeed_Cache_Config::OPTION_NAME ] ) ) {
593
  return $instance ;
@@ -675,6 +703,20 @@ class LiteSpeed_Cache_ESI
675
  */
676
  public function load_admin_bar_block( $params )
677
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
678
  wp_admin_bar_render() ;
679
 
680
  if ( ! LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_ESI_CACHE_ADMBAR ) ) {
42
  * @access private
43
  */
44
  private function __construct()
45
+ {
46
+ /**
47
+ * Bypass ESI related funcs if disabled ESI to fix potential DIVI compatibility issue
48
+ * @since 2.9.7.2
49
+ */
50
+ if ( LiteSpeed_Cache_Router::is_ajax() || ! LiteSpeed_Cache_Router::esi_enabled() ) {
51
+ return ;
52
+ }
53
+
54
+ // Init ESI in `after_setup_theme` hook after detected if LITESPEED_DISABLE_ALL is ON or not
55
+ add_action( 'litespeed_initing', array( $this, 'esi_init' ) ) ;
56
+
57
+ /**
58
+ * Overwrite wp_create_nonce func
59
+ * @since 2.9.5
60
+ */
61
+ if ( ! is_admin() && ! function_exists( 'wp_create_nonce' ) ) {
62
+ $this->_transform_nonce() ;
63
+ }
64
+ }
65
+
66
+ /**
67
+ * Init ESI related hooks
68
+ *
69
+ * Load delayed by hook to give the ability to bypass by LITESPEED_DISABLE_ALL const
70
+ *
71
+ * @since 2.9.7.2
72
+ * @access public
73
+ */
74
+ public function esi_init()
75
  {
76
  add_action( 'template_include', 'LiteSpeed_Cache_ESI::esi_template', 100 ) ;
77
 
106
  add_shortcode( 'esi', array( $this, 'shortcode' ) ) ;
107
  }
108
 
 
 
 
 
 
 
 
109
  }
110
 
111
  /**
120
  * If the nonce is in none_actions filter, convert it to ESI
121
  */
122
  function wp_create_nonce( $action = -1 ) {
123
+ if ( ! defined( 'LITESPEED_DISABLE_ALL' ) && LiteSpeed_Cache_ESI::get_instance()->is_nonce_action( $action ) ) {
124
  $params = array(
125
  'action' => $action,
126
  ) ;
305
  return ;
306
  }
307
 
308
+ add_filter('widget_display_callback', array($this, 'sub_widget_block'), 0, 3) ;
309
 
310
  // Add admin_bar esi
311
  if ( LiteSpeed_Cache_Router::is_logged_in() ) {
609
  * @param array $args Parameter used to build the widget.
610
  * @return mixed Return false if display through esi, instance otherwise.
611
  */
612
+ public function sub_widget_block( $instance, WP_Widget $widget, array $args )
613
  {
614
+ // #210407
615
+ if ( ! is_array( $instance ) ) {
616
+ return $instance ;
617
+ }
618
+
619
  $name = get_class( $widget ) ;
620
  if ( ! isset( $instance[ LiteSpeed_Cache_Config::OPTION_NAME ] ) ) {
621
  return $instance ;
703
  */
704
  public function load_admin_bar_block( $params )
705
  {
706
+
707
+ if ( ! empty( $params[ 'ref' ] ) ) {
708
+ $ref_qs = parse_url( $params[ 'ref' ], PHP_URL_QUERY ) ;
709
+ if ( ! empty( $ref_qs ) ) {
710
+ parse_str( $ref_qs, $ref_qs_arr ) ;
711
+
712
+ if ( ! empty( $ref_qs_arr ) ) {
713
+ foreach ( $ref_qs_arr as $k => $v ) {
714
+ $_GET[ $k ] = $v ;
715
+ }
716
+ }
717
+ }
718
+ }
719
+
720
  wp_admin_bar_render() ;
721
 
722
  if ( ! LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_ESI_CACHE_ADMBAR ) ) {
includes/litespeed-cache-optimize.class.php CHANGED
@@ -555,7 +555,7 @@ class LiteSpeed_Cache_Optimize
555
  if ( $this->cfg_css_async ) {
556
  // Inline css async lib
557
  if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPT_OPTM_CSS_ASYNC_INLINE ) ) {
558
- $this->html_head .= '<script id="litespeed-css-async-lib" type="text/javascript">' . Litespeed_File::read( LSCWP_DIR . self::LIB_FILE_CSS_ASYNC ) . '</script>' ;
559
  }
560
  else {
561
  $css_async_lib_url = LSWCP_PLUGIN_URL . self::LIB_FILE_CSS_ASYNC ;
@@ -625,7 +625,7 @@ class LiteSpeed_Cache_Optimize
625
  * -> family: PT Sans:400,700|PT Sans Narrow:400|Montserrat:600
626
  * <link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,300,300italic,400italic,600,700,900&#038;subset=latin%2Clatin-ext' />
627
  */
628
- $html .='<script type="text/javascript">WebFontConfig={google:{families:[' ;
629
 
630
  $families = array() ;
631
  foreach ( $this->_ggfonts_urls as $v ) {
555
  if ( $this->cfg_css_async ) {
556
  // Inline css async lib
557
  if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPT_OPTM_CSS_ASYNC_INLINE ) ) {
558
+ $this->html_head .= '<script id="litespeed-css-async-lib">' . Litespeed_File::read( LSCWP_DIR . self::LIB_FILE_CSS_ASYNC ) . '</script>' ;
559
  }
560
  else {
561
  $css_async_lib_url = LSWCP_PLUGIN_URL . self::LIB_FILE_CSS_ASYNC ;
625
  * -> family: PT Sans:400,700|PT Sans Narrow:400|Montserrat:600
626
  * <link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,300,300italic,400italic,600,700,900&#038;subset=latin%2Clatin-ext' />
627
  */
628
+ $html .='<script>WebFontConfig={google:{families:[' ;
629
 
630
  $families = array() ;
631
  foreach ( $this->_ggfonts_urls as $v ) {
includes/litespeed-cache-utility.class.php CHANGED
@@ -329,6 +329,16 @@ class LiteSpeed_Cache_Utility
329
  */
330
  public static function str_hit_array( $needle, $haystack, $has_ttl = false )
331
  {
 
 
 
 
 
 
 
 
 
 
332
  $hit = false ;
333
  $this_ttl = 0 ;
334
  foreach( $haystack as $item ) {
329
  */
330
  public static function str_hit_array( $needle, $haystack, $has_ttl = false )
331
  {
332
+ /**
333
+ * Safety check to avoid PHP warning
334
+ * @see https://github.com/litespeedtech/lscache_wp/pull/131/commits/45fc03af308c7d6b5583d1664fad68f75fb6d017
335
+ */
336
+ if ( ! is_array( $haystack ) ) {
337
+ LiteSpeed_Cache_Log::debug( "[Util] ❌ bad param in str_hit_array()!" ) ;
338
+
339
+ return false ;
340
+ }
341
+
342
  $hit = false ;
343
  $this_ttl = 0 ;
344
  foreach( $haystack as $item ) {
includes/litespeed-cache.class.php CHANGED
@@ -26,7 +26,7 @@ class LiteSpeed_Cache
26
  const NAME = 'LiteSpeed Cache' ;
27
  const PLUGIN_NAME = 'litespeed-cache' ;
28
  const PLUGIN_FILE = 'litespeed-cache/litespeed-cache.php' ;
29
- const PLUGIN_VERSION = '2.9.7.1' ;
30
 
31
  const PAGE_EDIT_HTACCESS = 'lscache-edit-htaccess' ;
32
 
@@ -105,7 +105,7 @@ class LiteSpeed_Cache
105
  }
106
 
107
  if ( self::config( LiteSpeed_Cache_Config::OPID_DEBUG_DISABLE_ALL ) ) {
108
- define( 'LITESPEED_DISABLE_ALL', true ) ;
109
  }
110
 
111
  /**
@@ -139,6 +139,7 @@ class LiteSpeed_Cache
139
  /**
140
  * Added hook before init
141
  * @since 1.6.6
 
142
  */
143
  do_action( 'litespeed_before_init' ) ;
144
 
@@ -146,9 +147,7 @@ class LiteSpeed_Cache
146
  * Preload ESI functionality for ESI request uri recovery
147
  * @since 1.8.1
148
  */
149
- if ( ! LiteSpeed_Cache_Router::is_ajax() && LiteSpeed_Cache_Router::esi_enabled() ) {
150
- LiteSpeed_Cache_ESI::get_instance() ;
151
- }
152
  }
153
 
154
  /**
@@ -192,6 +191,8 @@ class LiteSpeed_Cache
192
  return ;
193
  }
194
 
 
 
195
  ob_start( array( $this, 'send_headers_force' ) ) ;
196
  add_action( 'shutdown', array( $this, 'send_headers' ), 0 ) ;
197
  add_action( 'wp_footer', 'LiteSpeed_Cache::footer_hook' ) ;
26
  const NAME = 'LiteSpeed Cache' ;
27
  const PLUGIN_NAME = 'litespeed-cache' ;
28
  const PLUGIN_FILE = 'litespeed-cache/litespeed-cache.php' ;
29
+ const PLUGIN_VERSION = '2.9.7.2' ;
30
 
31
  const PAGE_EDIT_HTACCESS = 'lscache-edit-htaccess' ;
32
 
105
  }
106
 
107
  if ( self::config( LiteSpeed_Cache_Config::OPID_DEBUG_DISABLE_ALL ) ) {
108
+ ! defined( 'LITESPEED_DISABLE_ALL' ) && define( 'LITESPEED_DISABLE_ALL', true ) ;
109
  }
110
 
111
  /**
139
  /**
140
  * Added hook before init
141
  * @since 1.6.6
142
+ * @deprecated 2.9.7.2 This can't be used by any plugin due to unpredictable plugin loading priority.
143
  */
144
  do_action( 'litespeed_before_init' ) ;
145
 
147
  * Preload ESI functionality for ESI request uri recovery
148
  * @since 1.8.1
149
  */
150
+ LiteSpeed_Cache_ESI::get_instance() ;
 
 
151
  }
152
 
153
  /**
191
  return ;
192
  }
193
 
194
+ do_action( 'litespeed_initing' ) ;
195
+
196
  ob_start( array( $this, 'send_headers_force' ) ) ;
197
  add_action( 'shutdown', array( $this, 'send_headers' ), 0 ) ;
198
  add_action( 'wp_footer', 'LiteSpeed_Cache::footer_hook' ) ;
js/lazyload.lib.js CHANGED
@@ -16,8 +16,8 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
16
  data_srcset: "srcset",
17
  data_sizes: "sizes",
18
  data_bg: "bg",
19
- class_loading: "loading",
20
- class_loaded: "loaded",
21
  class_error: "error",
22
  load_delay: 0,
23
  callback_load: null,
16
  data_srcset: "srcset",
17
  data_sizes: "sizes",
18
  data_bg: "bg",
19
+ class_loading: "litespeed-loading",
20
+ class_loaded: "litespeed-loaded",
21
  class_error: "error",
22
  load_delay: 0,
23
  callback_load: null,
js/lazyload.min.js CHANGED
@@ -1 +1 @@
1
- var _extends=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};!function(t,e){"object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.LazyLoad=e()}(this,function(){"use strict";var n={elements_selector:"img",container:document,threshold:300,thresholds:null,data_src:"src",data_srcset:"srcset",data_sizes:"sizes",data_bg:"bg",class_loading:"loading",class_loaded:"loaded",class_error:"error",load_delay:0,callback_load:null,callback_error:null,callback_set:null,callback_enter:null,callback_finish:null,to_webp:!1},s="data-",r="was-processed",o="ll-timeout",a="true",c=function(t,e){return t.getAttribute(s+e)},i=function(t,e,n){var o=s+e;null!==n?t.setAttribute(o,n):t.removeAttribute(o)},l=function(t){return c(t,r)===a},u=function(t,e){return i(t,o,e)},d=function(t){return c(t,o)},f=function(t,e){var n,o="LazyLoad::Initialized",s=new t(e);try{n=new CustomEvent(o,{detail:{instance:s}})}catch(t){(n=document.createEvent("CustomEvent")).initCustomEvent(o,!1,!1,{instance:s})}window.dispatchEvent(n)};var _=function(t,e){return e?t.replace(/\.(jpe?g|png)/gi,".webp"):t},t="undefined"!=typeof window,v=t&&!("onscroll"in window)||/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),e=t&&"IntersectionObserver"in window,h=t&&"classList"in document.createElement("p"),b=t&&!1,g=function(t,e,n,o){for(var s,r=0;s=t.children[r];r+=1)if("SOURCE"===s.tagName){var a=c(s,n);m(s,e,a,o)}},m=function(t,e,n,o){n&&t.setAttribute(e,_(n,o))},p={IMG:function(t,e){var n=b&&e.to_webp,o=e.data_srcset,s=t.parentNode;s&&"PICTURE"===s.tagName&&g(s,"srcset",o,n);var r=c(t,e.data_sizes);m(t,"sizes",r);var a=c(t,o);m(t,"srcset",a,n);var i=c(t,e.data_src);m(t,"src",i,n)},IFRAME:function(t,e){var n=c(t,e.data_src);m(t,"src",n)},VIDEO:function(t,e){var n=e.data_src,o=c(t,n);g(t,"src",n),m(t,"src",o),t.load()}},y=function(t,e){var n,o,s=e._settings,r=t.tagName,a=p[r];if(a)return a(t,s),e._updateLoadingCount(1),void(e._elements=(n=e._elements,o=t,n.filter(function(t){return t!==o})));!function(t,e){var n=b&&e.to_webp,o=c(t,e.data_src),s=c(t,e.data_bg);if(o){var r=_(o,n);t.style.backgroundImage='url("'+r+'")'}if(s){var a=_(s,n);t.style.backgroundImage=a}}(t,s)},w=function(t,e){h?t.classList.add(e):t.className+=(t.className?" ":"")+e},E=function(t,e){t&&t(e)},L="load",I="loadeddata",O="error",k=function(t,e,n){t.addEventListener(e,n)},A=function(t,e,n){t.removeEventListener(e,n)},C=function(t,e,n){A(t,L,e),A(t,I,e),A(t,O,n)},z=function(t,e,n){var o,s,r=n._settings,a=e?r.class_loaded:r.class_error,i=e?r.callback_load:r.callback_error,c=t.target;o=c,s=r.class_loading,h?o.classList.remove(s):o.className=o.className.replace(new RegExp("(^|\\s+)"+s+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,""),w(c,a),E(i,c),n._updateLoadingCount(-1)},N=function(n,o){var t,e,s,r=function t(e){z(e,!0,o),C(n,t,a)},a=function t(e){z(e,!1,o),C(n,r,t)};s=a,k(t=n,L,e=r),k(t,I,e),k(t,O,s)},x=["IMG","IFRAME","VIDEO"],M=function(t,e,n){R(t,n),e.unobserve(t)},S=function(t){var e=d(t);e&&(clearTimeout(e),u(t,null))};function R(t,e,n){var o=e._settings;!n&&l(t)||(E(o.callback_enter,t),-1<x.indexOf(t.tagName)&&(N(t,e),w(t,o.class_loading)),y(t,e),i(t,r,a),E(o.callback_set,t))}var j=function(t){return t.isIntersecting||0<t.intersectionRatio},T=function(t,e){this._settings=_extends({},n,t),this._setObserver(),this._loadingCount=0,this.update(e)};return T.prototype={_manageIntersection:function(t){var e,n,o,s,r,a=this._observer,i=this._settings.load_delay,c=t.target;i?j(t)?(e=c,n=a,s=(o=this)._settings.load_delay,(r=d(e))||(r=setTimeout(function(){M(e,n,o),S(e)},s),u(e,r))):S(c):j(t)&&M(c,a,this)},_onIntersection:function(t){t.forEach(this._manageIntersection.bind(this))},_setObserver:function(){var t;e&&(this._observer=new IntersectionObserver(this._onIntersection.bind(this),{root:(t=this._settings).container===document?null:t.container,rootMargin:t.thresholds||t.threshold+"px"}))},_updateLoadingCount:function(t){this._loadingCount+=t,0===this._elements.length&&0===this._loadingCount&&E(this._settings.callback_finish)},update:function(t){var e=this,n=this._settings,o=t||n.container.querySelectorAll(n.elements_selector);this._elements=Array.prototype.slice.call(o).filter(function(t){return!l(t)}),!v&&this._observer?this._elements.forEach(function(t){e._observer.observe(t)}):this.loadAll()},destroy:function(){var e=this;this._observer&&(this._elements.forEach(function(t){e._observer.unobserve(t)}),this._observer=null),this._elements=null,this._settings=null},load:function(t,e){R(t,this,e)},loadAll:function(){var e=this;this._elements.forEach(function(t){e.load(t)})}},t&&function(t,e){if(e)if(e.length)for(var n,o=0;n=e[o];o+=1)f(t,n);else f(t,e)}(T,window.lazyLoadOptions),T}),function(t,e){"use strict";var n,o,s=function(){n=new LazyLoad({elements_selector:"[data-lazyloaded]"}),o=function(){n.update()},t.MutationObserver&&new MutationObserver(o).observe(e.documentElement,{childList:!0,subtree:!0,attributes:!0})};t.addEventListener?t.addEventListener("load",s,!1):t.attachEvent("onload",s)}(window,document);
1
+ var _extends=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};!function(t,e){"object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.LazyLoad=e()}(this,function(){"use strict";var n={elements_selector:"img",container:document,threshold:300,thresholds:null,data_src:"src",data_srcset:"srcset",data_sizes:"sizes",data_bg:"bg",class_loading:"litespeed-loading",class_loaded:"litespeed-loaded",class_error:"error",load_delay:0,callback_load:null,callback_error:null,callback_set:null,callback_enter:null,callback_finish:null,to_webp:!1},s="data-",r="was-processed",o="ll-timeout",a="true",c=function(t,e){return t.getAttribute(s+e)},i=function(t,e,n){var o=s+e;null!==n?t.setAttribute(o,n):t.removeAttribute(o)},l=function(t){return c(t,r)===a},u=function(t,e){return i(t,o,e)},d=function(t){return c(t,o)},f=function(t,e){var n,o="LazyLoad::Initialized",s=new t(e);try{n=new CustomEvent(o,{detail:{instance:s}})}catch(t){(n=document.createEvent("CustomEvent")).initCustomEvent(o,!1,!1,{instance:s})}window.dispatchEvent(n)};var _=function(t,e){return e?t.replace(/\.(jpe?g|png)/gi,".webp"):t},t="undefined"!=typeof window,v=t&&!("onscroll"in window)||/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),e=t&&"IntersectionObserver"in window,h=t&&"classList"in document.createElement("p"),b=t&&!1,g=function(t,e,n,o){for(var s,r=0;s=t.children[r];r+=1)if("SOURCE"===s.tagName){var a=c(s,n);m(s,e,a,o)}},m=function(t,e,n,o){n&&t.setAttribute(e,_(n,o))},p={IMG:function(t,e){var n=b&&e.to_webp,o=e.data_srcset,s=t.parentNode;s&&"PICTURE"===s.tagName&&g(s,"srcset",o,n);var r=c(t,e.data_sizes);m(t,"sizes",r);var a=c(t,o);m(t,"srcset",a,n);var i=c(t,e.data_src);m(t,"src",i,n)},IFRAME:function(t,e){var n=c(t,e.data_src);m(t,"src",n)},VIDEO:function(t,e){var n=e.data_src,o=c(t,n);g(t,"src",n),m(t,"src",o),t.load()}},y=function(t,e){var n,o,s=e._settings,r=t.tagName,a=p[r];if(a)return a(t,s),e._updateLoadingCount(1),void(e._elements=(n=e._elements,o=t,n.filter(function(t){return t!==o})));!function(t,e){var n=b&&e.to_webp,o=c(t,e.data_src),s=c(t,e.data_bg);if(o){var r=_(o,n);t.style.backgroundImage='url("'+r+'")'}if(s){var a=_(s,n);t.style.backgroundImage=a}}(t,s)},w=function(t,e){h?t.classList.add(e):t.className+=(t.className?" ":"")+e},E=function(t,e){t&&t(e)},L="load",I="loadeddata",O="error",k=function(t,e,n){t.addEventListener(e,n)},A=function(t,e,n){t.removeEventListener(e,n)},C=function(t,e,n){A(t,L,e),A(t,I,e),A(t,O,n)},z=function(t,e,n){var o,s,r=n._settings,a=e?r.class_loaded:r.class_error,i=e?r.callback_load:r.callback_error,c=t.target;o=c,s=r.class_loading,h?o.classList.remove(s):o.className=o.className.replace(new RegExp("(^|\\s+)"+s+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,""),w(c,a),E(i,c),n._updateLoadingCount(-1)},N=function(n,o){var t,e,s,r=function t(e){z(e,!0,o),C(n,t,a)},a=function t(e){z(e,!1,o),C(n,r,t)};s=a,k(t=n,L,e=r),k(t,I,e),k(t,O,s)},x=["IMG","IFRAME","VIDEO"],M=function(t,e,n){R(t,n),e.unobserve(t)},S=function(t){var e=d(t);e&&(clearTimeout(e),u(t,null))};function R(t,e,n){var o=e._settings;!n&&l(t)||(E(o.callback_enter,t),-1<x.indexOf(t.tagName)&&(N(t,e),w(t,o.class_loading)),y(t,e),i(t,r,a),E(o.callback_set,t))}var j=function(t){return t.isIntersecting||0<t.intersectionRatio},T=function(t,e){this._settings=_extends({},n,t),this._setObserver(),this._loadingCount=0,this.update(e)};return T.prototype={_manageIntersection:function(t){var e,n,o,s,r,a=this._observer,i=this._settings.load_delay,c=t.target;i?j(t)?(e=c,n=a,s=(o=this)._settings.load_delay,(r=d(e))||(r=setTimeout(function(){M(e,n,o),S(e)},s),u(e,r))):S(c):j(t)&&M(c,a,this)},_onIntersection:function(t){t.forEach(this._manageIntersection.bind(this))},_setObserver:function(){var t;e&&(this._observer=new IntersectionObserver(this._onIntersection.bind(this),{root:(t=this._settings).container===document?null:t.container,rootMargin:t.thresholds||t.threshold+"px"}))},_updateLoadingCount:function(t){this._loadingCount+=t,0===this._elements.length&&0===this._loadingCount&&E(this._settings.callback_finish)},update:function(t){var e=this,n=this._settings,o=t||n.container.querySelectorAll(n.elements_selector);this._elements=Array.prototype.slice.call(o).filter(function(t){return!l(t)}),!v&&this._observer?this._elements.forEach(function(t){e._observer.observe(t)}):this.loadAll()},destroy:function(){var e=this;this._observer&&(this._elements.forEach(function(t){e._observer.unobserve(t)}),this._observer=null),this._elements=null,this._settings=null},load:function(t,e){R(t,this,e)},loadAll:function(){var e=this;this._elements.forEach(function(t){e.load(t)})}},t&&function(t,e){if(e)if(e.length)for(var n,o=0;n=e[o];o+=1)f(t,n);else f(t,e)}(T,window.lazyLoadOptions),T}),function(t,e){"use strict";var n,o,s=function(){n=new LazyLoad({elements_selector:"[data-lazyloaded]"}),o=function(){n.update()},t.MutationObserver&&new MutationObserver(o).observe(e.documentElement,{childList:!0,subtree:!0,attributes:!0})};t.addEventListener?t.addEventListener("load",s,!1):t.attachEvent("onload",s)}(window,document);
languages/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 2.9.7\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/litespeed-cache\n"
7
- "POT-Creation-Date: 2019-04-01 19:42:51+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -860,7 +860,7 @@ msgstr ""
860
  msgid "Rate %s on %s"
861
  msgstr ""
862
 
863
- #. #-#-#-#-# litespeed-cache.pot (LiteSpeed Cache 2.9.7) #-#-#-#-#
864
  #. Plugin Name of the plugin/theme
865
  #: admin/tpl/inc/admin_footer.php:6
866
  #: admin/tpl/inc/banner_promo.new_version.php:56 inc/gui.class.php:477
@@ -4235,15 +4235,15 @@ msgstr ""
4235
  msgid "Reset successfully."
4236
  msgstr ""
4237
 
4238
- #: inc/litespeed-cache.class.php:326 includes/litespeed-cache.class.php:326
4239
  msgid "Crawler blacklist is saved."
4240
  msgstr ""
4241
 
4242
- #: inc/litespeed-cache.class.php:337 includes/litespeed-cache.class.php:337
4243
  msgid "Notified LiteSpeed Web Server to purge everything."
4244
  msgstr ""
4245
 
4246
- #: inc/litespeed-cache.class.php:347 includes/litespeed-cache.class.php:347
4247
  msgid "Notified LiteSpeed Web Server to purge the list."
4248
  msgstr ""
4249
 
2
  # This file is distributed under the same license as the LiteSpeed Cache package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: LiteSpeed Cache 2.9.7.2\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/litespeed-cache\n"
7
+ "POT-Creation-Date: 2019-05-02 16:39:41+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
860
  msgid "Rate %s on %s"
861
  msgstr ""
862
 
863
+ #. #-#-#-#-# litespeed-cache.pot (LiteSpeed Cache 2.9.7.2) #-#-#-#-#
864
  #. Plugin Name of the plugin/theme
865
  #: admin/tpl/inc/admin_footer.php:6
866
  #: admin/tpl/inc/banner_promo.new_version.php:56 inc/gui.class.php:477
4235
  msgid "Reset successfully."
4236
  msgstr ""
4237
 
4238
+ #: inc/litespeed-cache.class.php:327 includes/litespeed-cache.class.php:327
4239
  msgid "Crawler blacklist is saved."
4240
  msgstr ""
4241
 
4242
+ #: inc/litespeed-cache.class.php:338 includes/litespeed-cache.class.php:338
4243
  msgid "Notified LiteSpeed Web Server to purge everything."
4244
  msgstr ""
4245
 
4246
+ #: inc/litespeed-cache.class.php:348 includes/litespeed-cache.class.php:348
4247
  msgid "Notified LiteSpeed Web Server to purge the list."
4248
  msgstr ""
4249
 
litespeed-cache.php CHANGED
@@ -15,7 +15,7 @@
15
  * Plugin Name: LiteSpeed Cache
16
  * Plugin URI: https://www.litespeedtech.com/products/cache-plugins/wordpress-acceleration
17
  * Description: High-performance page caching and site optimization from LiteSpeed
18
- * Version: 2.9.7.1
19
  * Author: LiteSpeed Technologies
20
  * Author URI: https://www.litespeedtech.com
21
  * License: GPLv3
15
  * Plugin Name: LiteSpeed Cache
16
  * Plugin URI: https://www.litespeedtech.com/products/cache-plugins/wordpress-acceleration
17
  * Description: High-performance page caching and site optimization from LiteSpeed
18
+ * Version: 2.9.7.2
19
  * Author: LiteSpeed Technologies
20
  * Author URI: https://www.litespeedtech.com
21
  * License: GPLv3
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: LiteSpeedTech
3
  Tags: caching, optimize, performance, pagespeed, seo, speed, image optimize, compress, object cache, redis, memcached, database cleaner
4
  Requires at least: 4.0
5
  Tested up to: 5.1.1
6
- Stable tag: 2.9.7.1
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl.html
9
 
@@ -287,6 +287,23 @@ Click on the `Advanced View` link at the top of the page, and several more tabs
287
 
288
  == Changelog ==
289
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
290
  = 2.9.7.1 - Apr 9 2019 =
291
  * <strong>Purge</script>: Purge All no longer includes Purge CCSS/Placeholder.
292
  * <strong>3rd</strong>: Divi Theme Builder no longer experiences nonce expiration issues in the contact form widget. (#475461)
3
  Tags: caching, optimize, performance, pagespeed, seo, speed, image optimize, compress, object cache, redis, memcached, database cleaner
4
  Requires at least: 4.0
5
  Tested up to: 5.1.1
6
+ Stable tag: 2.9.7.2
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl.html
9
 
287
 
288
  == Changelog ==
289
 
290
+ = 2.9.7.2 - May 2 2019 =
291
+ * <strong>Conf</strong>: Enhanced compatibility when an option is not properly initialized.
292
+ * <strong>Conf</strong>: Prevent non-array instance in widget from causing 500 error. (#210407)
293
+ * <strong>CCSS</strong>: Increase CCSS generation timeout to 60s.
294
+ * <strong>Media</strong>: Renamed lazyload CSS class to avoid conflicts with other plugins. (@DynamoProd)
295
+ * <strong>JS</strong>: Improved W3 validator. (@istanbulantik)
296
+ * <strong>QUIC</strong>: Synced cache tag prefix for static files cache.
297
+ * <strong>ESI</strong>: Restored query strings to ESI admin bar for accurate rendering. (#977284)
298
+ * <strong>ESI</strong>: Tweaked ESI init priority to honor LITESPEED_DISABLE_ALL const. ESI will now init after plugin loaded.
299
+ * 🐞<strong>ESI</strong>: No longer initialize ESI if ESI option is OFF.
300
+ * <strong>API</strong>: New "Disable All" API function.
301
+ * <strong>API</strong>: New "Force public cache" API function.
302
+ * 🐞<strong>Vary</strong>: Fixed an issue with saving vary groups.
303
+ * 🐞<strong>IAPI</strong>: Fixed an issue where image md5 validation failed due to whitespace in the image path.
304
+ * 🐞<strong>3rd</strong>: Bypass all optimization/ESI/Cache features when entering Divi Theme Builder frontend editor.
305
+ * 🐞<strong>3rd</strong>: Fixed an issue where DIVI admin bar exit button didn't work when ESI was ON.
306
+
307
  = 2.9.7.1 - Apr 9 2019 =
308
  * <strong>Purge</script>: Purge All no longer includes Purge CCSS/Placeholder.
309
  * <strong>3rd</strong>: Divi Theme Builder no longer experiences nonce expiration issues in the contact form widget. (#475461)
thirdparty/lscwp-3rd-divi-theme-builder.cls.php CHANGED
@@ -10,11 +10,26 @@
10
  if ( ! defined( 'ABSPATH' ) ) {
11
  die() ;
12
  }
 
 
13
  LiteSpeed_Cache_API::register( 'LiteSpeed_Cache_ThirdParty_Divi_Theme_Builder' ) ;
14
 
15
  class LiteSpeed_Cache_ThirdParty_Divi_Theme_Builder
16
  {
17
- private static $js_comment_box = false ;
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
  public static function detect()
20
  {
@@ -25,13 +40,16 @@ class LiteSpeed_Cache_ThirdParty_Divi_Theme_Builder
25
  */
26
  LiteSpeed_Cache_API::nonce_action( 'et-pb-contact-form-submit' ) ;
27
 
28
- if ( empty( $_GET['et_fb'] ) ) return ;
29
-
 
30
  add_action( 'et_fb_before_comments_template', 'LiteSpeed_Cache_ThirdParty_Divi_Theme_Builder::js_comment_box_on' ) ;
31
  add_action( 'et_fb_after_comments_template', 'LiteSpeed_Cache_ThirdParty_Divi_Theme_Builder::js_comment_box_off' ) ;
32
  add_filter( 'litespeed_cache_sub_esi_params-comment-form', 'LiteSpeed_Cache_ThirdParty_Divi_Theme_Builder::esi_comment_add_slash' ) ;
 
33
  }
34
 
 
35
  public static function js_comment_box_on() {
36
  self::$js_comment_box = true ;
37
  }
@@ -49,4 +67,5 @@ class LiteSpeed_Cache_ThirdParty_Divi_Theme_Builder
49
 
50
  return $params ;
51
  }
 
52
  }
10
  if ( ! defined( 'ABSPATH' ) ) {
11
  die() ;
12
  }
13
+
14
+ LiteSpeed_Cache_API::hook_init( 'LiteSpeed_Cache_ThirdParty_Divi_Theme_Builder::pre_load' ) ;
15
  LiteSpeed_Cache_API::register( 'LiteSpeed_Cache_ThirdParty_Divi_Theme_Builder' ) ;
16
 
17
  class LiteSpeed_Cache_ThirdParty_Divi_Theme_Builder
18
  {
19
+ // private static $js_comment_box = false ;
20
+
21
+ /**
22
+ * Check if is Edit mode in frontend, disable all LSCWP features to avoid breaking page builder
23
+ *
24
+ * @since 2.9.7.2 #435538 #581740 #977284
25
+ */
26
+ public static function pre_load()
27
+ {
28
+ if ( ! function_exists( 'et_setup_theme' ) ) return ;
29
+ if ( ! empty( $_GET[ 'et_fb' ] ) ) {
30
+ LiteSpeed_Cache_API::disable_all( 'divi edit mode' ) ;
31
+ }
32
+ }
33
 
34
  public static function detect()
35
  {
40
  */
41
  LiteSpeed_Cache_API::nonce_action( 'et-pb-contact-form-submit' ) ;
42
 
43
+ /*
44
+ // the comment box fix is for user using theme builder, ESI will load the wrong json string
45
+ // As we disabled all for edit mode, this is no more needed
46
  add_action( 'et_fb_before_comments_template', 'LiteSpeed_Cache_ThirdParty_Divi_Theme_Builder::js_comment_box_on' ) ;
47
  add_action( 'et_fb_after_comments_template', 'LiteSpeed_Cache_ThirdParty_Divi_Theme_Builder::js_comment_box_off' ) ;
48
  add_filter( 'litespeed_cache_sub_esi_params-comment-form', 'LiteSpeed_Cache_ThirdParty_Divi_Theme_Builder::esi_comment_add_slash' ) ;
49
+ */
50
  }
51
 
52
+ /*
53
  public static function js_comment_box_on() {
54
  self::$js_comment_box = true ;
55
  }
67
 
68
  return $params ;
69
  }
70
+ */
71
  }