LiteSpeed Cache - Version 2.3.1

Version Description

  • Jun 18 2018 =
  • [Improvement] New setting to disable Generate Critical CSS. (@cybmeta)
  • [Improvement] Added filter to can_cdn/can_optm check. (@Jacob)
  • [Update] Critical CSS Added 404 css. Limit cron interval.
  • [Update] AJAX will not bypass CDN anymore by default. (@Jacob)
  • [GUI] Show Disable All Features warning if it is on in Debug tab.
Download this release

Release Info

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

Code changes from version 2.2.7 to 2.3.1

Files changed (39) hide show
  1. admin/litespeed-cache-admin-display.class.php +9 -5
  2. admin/litespeed-cache-admin-report.class.php +5 -14
  3. admin/litespeed-cache-admin-settings.class.php +11 -16
  4. admin/tpl/inc/disabled_all.php +12 -0
  5. admin/tpl/manage/manage_purge.php +10 -0
  6. admin/tpl/setting/settings_cache.php +1 -1
  7. admin/tpl/setting/settings_excludes.php +2 -2
  8. admin/tpl/setting/settings_optimize.php +63 -3
  9. admin/tpl/setting/settings_tuning.php +1 -1
  10. cli/litespeed-cache-cli-admin.class.php +6 -0
  11. css/litespeed.css +8 -0
  12. inc/cdn.class.php +1 -33
  13. inc/config.class.php +38 -17
  14. inc/control.class.php +6 -6
  15. inc/css.cls.php +347 -0
  16. inc/gui.class.php +11 -0
  17. inc/litespeed-cache.class.php +6 -1
  18. inc/litespeed.autoload.php +1 -0
  19. inc/log.class.php +12 -6
  20. inc/optimize.class.php +16 -59
  21. inc/purge.class.php +22 -0
  22. inc/router.class.php +100 -6
  23. inc/task.class.php +32 -7
  24. inc/utility.class.php +7 -4
  25. includes/litespeed-cache-cdn.class.php +1 -33
  26. includes/litespeed-cache-config.class.php +38 -17
  27. includes/litespeed-cache-control.class.php +6 -6
  28. includes/litespeed-cache-gui.class.php +11 -0
  29. includes/litespeed-cache-log.class.php +12 -6
  30. includes/litespeed-cache-optimize.class.php +16 -59
  31. includes/litespeed-cache-purge.class.php +22 -0
  32. includes/litespeed-cache-router.class.php +100 -6
  33. includes/litespeed-cache-task.class.php +32 -7
  34. includes/litespeed-cache-utility.class.php +7 -4
  35. includes/litespeed-cache.class.php +6 -1
  36. includes/litespeed.autoload.php +1 -0
  37. languages/litespeed-cache.pot +231 -153
  38. litespeed-cache.php +1 -1
  39. readme.txt +13 -1
admin/litespeed-cache-admin-display.class.php CHANGED
@@ -348,12 +348,12 @@ class LiteSpeed_Cache_Admin_Display
348
  * Builds the html for a single notice.
349
  *
350
  * @since 1.0.7
351
- * @access private
352
  * @param string $color The color to use for the notice.
353
  * @param string $str The notice message.
354
  * @return string The built notice html.
355
  */
356
- private static function build_notice($color, $str)
357
  {
358
  return '<div class="' . $color . ' is-dismissible"><p>'. $str . '</p></div>' ;
359
  }
@@ -671,7 +671,7 @@ class LiteSpeed_Cache_Admin_Display
671
  * @param boolean $disabled If this input is disabled or not
672
  * @param int $cols The width of textarea
673
  */
674
- public function build_textarea( $id, $cols = false, $val = null, $disabled = false )
675
  {
676
  if ( strpos( $id, '[' ) === false ) {
677
  if ( $val === null ) {
@@ -688,7 +688,11 @@ class LiteSpeed_Cache_Admin_Display
688
  $cols = 80 ;
689
  }
690
 
691
- echo "<textarea name='" . LiteSpeed_Cache_Config::OPTION_NAME . "$id' rows='5' cols='$cols' $disabled>" . esc_textarea($val) . "</textarea>" ;
 
 
 
 
692
  }
693
 
694
  /**
@@ -705,7 +709,7 @@ class LiteSpeed_Cache_Admin_Display
705
  // Get default val for separate item
706
  $val = $this->config->get_item( $id, true ) ;
707
 
708
- $this->build_textarea( $id, $cols, $val ) ;
709
  }
710
 
711
  /**
348
  * Builds the html for a single notice.
349
  *
350
  * @since 1.0.7
351
+ * @access public
352
  * @param string $color The color to use for the notice.
353
  * @param string $str The notice message.
354
  * @return string The built notice html.
355
  */
356
+ public static function build_notice($color, $str)
357
  {
358
  return '<div class="' . $color . ' is-dismissible"><p>'. $str . '</p></div>' ;
359
  }
671
  * @param boolean $disabled If this input is disabled or not
672
  * @param int $cols The width of textarea
673
  */
674
+ public function build_textarea( $id, $cols = false, $val = null, $disabled = false, $cls = '' )
675
  {
676
  if ( strpos( $id, '[' ) === false ) {
677
  if ( $val === null ) {
688
  $cols = 80 ;
689
  }
690
 
691
+ if ( $cls ) {
692
+ $cls = " class='$cls' " ;
693
+ }
694
+
695
+ echo "<textarea name='" . LiteSpeed_Cache_Config::OPTION_NAME . "$id' rows='5' cols='$cols' $cls $disabled>" . esc_textarea($val) . "</textarea>" ;
696
  }
697
 
698
  /**
709
  // Get default val for separate item
710
  $val = $this->config->get_item( $id, true ) ;
711
 
712
+ $this->build_textarea( $id, $cols, $val, false, 'litespeed-textarea-success' ) ;
713
  }
714
 
715
  /**
admin/litespeed-cache-admin-report.class.php CHANGED
@@ -171,21 +171,12 @@ class LiteSpeed_Cache_Admin_Report
171
  }
172
  }
173
 
174
- $item_options = array(
175
- LiteSpeed_Cache_Config::EXCLUDE_OPTIMIZATION_ROLES,
176
- LiteSpeed_Cache_Config::EXCLUDE_CACHE_ROLES,
177
- LiteSpeed_Cache_Config::ITEM_CACHE_DROP_QS,
178
- LiteSpeed_Cache_Config::ITEM_CDN_MAPPING,
179
- LiteSpeed_Cache_Config::ITEM_SETTING_MODE,
180
- LiteSpeed_Cache_Config::ITEM_OPTM_JS_DEFER_EXC,
181
- LiteSpeed_Cache_Config::ITEM_MEDIA_LAZY_IMG_EXC,
182
- LiteSpeed_Cache_Config::ITEM_CRWL_AS_UIDS,
183
- LiteSpeed_Cache_Config::ITEM_ADV_PURGE_ALL_HOOKS,
184
- LiteSpeed_Cache_Config::ITEM_CDN_ORI_DIR,
185
- LiteSpeed_Cache_Config::ITEM_MEDIA_WEBP_ATTRIBUTE,
186
- ) ;
187
-
188
  foreach ( $item_options as $v ) {
 
 
 
 
189
  $options[ $v ] = get_option( $v ) ;
190
  }
191
 
171
  }
172
  }
173
 
174
+ $item_options = LiteSpeed_Cache_Config::get_instance()->stored_items() ;
 
 
 
 
 
 
 
 
 
 
 
 
 
175
  foreach ( $item_options as $v ) {
176
+ // bypass main conf
177
+ if ( $v == LiteSpeed_Cache_Config::OPTION_NAME ) {
178
+ continue ;
179
+ }
180
  $options[ $v ] = get_option( $v ) ;
181
  }
182
 
admin/litespeed-cache-admin-settings.class.php CHANGED
@@ -387,10 +387,8 @@ class LiteSpeed_Cache_Admin_Settings
387
  LiteSpeed_Cache_Purge::add( LiteSpeed_Cache_Tag::TYPE_LOGIN ) ;
388
  }
389
 
390
- $id = LiteSpeed_Cache_Config::OPID_CACHE_URI_PRIV ;
391
- if ( isset( $this->_input[ $id ]) ) {
392
- $this->_options[ $id ] = LiteSpeed_Cache_Utility::sanitize_lines( $this->_input[ $id ], 'relative' ) ;
393
- }
394
 
395
  $ids = array(
396
  LiteSpeed_Cache_Config::ITEM_CACHE_DROP_QS, // Update Drop Query String @since 1.7
@@ -458,15 +456,11 @@ class LiteSpeed_Cache_Admin_Settings
458
  */
459
  private function _validate_exclude()
460
  {
461
- $id = LiteSpeed_Cache_Config::OPID_FORCE_CACHE_URI ;
462
- if ( isset( $this->_input[ $id ] ) ) {
463
- $this->_options[ $id ] = LiteSpeed_Cache_Utility::sanitize_lines( $this->_input[ $id ], 'relative' ) ;
464
- }
465
 
466
- $id = LiteSpeed_Cache_Config::OPID_EXCLUDES_URI ;
467
- if ( isset( $this->_input[ $id ] ) ) {
468
- $this->_options[ $id ] = LiteSpeed_Cache_Utility::sanitize_lines( $this->_input[ $id ], 'relative' ) ;
469
- }
470
 
471
  $id = LiteSpeed_Cache_Config::OPID_EXCLUDES_QS ;
472
  if ( isset( $this->_input[ $id ] ) ) {
@@ -721,6 +715,9 @@ class LiteSpeed_Cache_Admin_Settings
721
  LiteSpeed_Cache_Config::OPID_OPTM_QS_RM,
722
  LiteSpeed_Cache_Config::OPID_OPTM_GGFONTS_RM,
723
  LiteSpeed_Cache_Config::OPID_OPTM_CSS_ASYNC,
 
 
 
724
  LiteSpeed_Cache_Config::OPID_OPTM_JS_DEFER,
725
  LiteSpeed_Cache_Config::OPID_OPTM_EMOJI_RM,
726
  LiteSpeed_Cache_Config::OPID_OPTM_EXC_JQUERY,
@@ -749,10 +746,8 @@ class LiteSpeed_Cache_Admin_Settings
749
  update_option( LiteSpeed_Cache_Config::ITEM_OPTM_CSS, $this->_input[ LiteSpeed_Cache_Config::ITEM_OPTM_CSS ] ) ;
750
 
751
  // prevent URI from optimization
752
- $id = LiteSpeed_Cache_Config::OPID_OPTM_EXCLUDES ;
753
- if ( isset( $this->_input[ $id ]) ) {
754
- $this->_options[ $id ] = LiteSpeed_Cache_Utility::sanitize_lines( $this->_input[ $id ], 'relative' ) ;
755
- }
756
 
757
  // Update js deferred excludes
758
  $id = LiteSpeed_Cache_Config::ITEM_OPTM_JS_DEFER_EXC ;
387
  LiteSpeed_Cache_Purge::add( LiteSpeed_Cache_Tag::TYPE_LOGIN ) ;
388
  }
389
 
390
+ $id = LiteSpeed_Cache_Config::ITEM_CACHE_URI_PRIV ;
391
+ $this->_save_item( $id, 'relative' ) ;
 
 
392
 
393
  $ids = array(
394
  LiteSpeed_Cache_Config::ITEM_CACHE_DROP_QS, // Update Drop Query String @since 1.7
456
  */
457
  private function _validate_exclude()
458
  {
459
+ $id = LiteSpeed_Cache_Config::ITEM_FORCE_CACHE_URI ;
460
+ $this->_save_item( $id, 'relative' ) ;
 
 
461
 
462
+ $id = LiteSpeed_Cache_Config::ITEM_EXCLUDES_URI ;
463
+ $this->_save_item( $id, 'relative' ) ;
 
 
464
 
465
  $id = LiteSpeed_Cache_Config::OPID_EXCLUDES_QS ;
466
  if ( isset( $this->_input[ $id ] ) ) {
715
  LiteSpeed_Cache_Config::OPID_OPTM_QS_RM,
716
  LiteSpeed_Cache_Config::OPID_OPTM_GGFONTS_RM,
717
  LiteSpeed_Cache_Config::OPID_OPTM_CSS_ASYNC,
718
+ LiteSpeed_Cache_Config::OPT_OPTM_CCSS_GEN,
719
+ LiteSpeed_Cache_Config::OPT_OPTM_CCSS_ASYNC,
720
+ LiteSpeed_Cache_Config::OPT_OPTM_CSS_ASYNC_INLINE,
721
  LiteSpeed_Cache_Config::OPID_OPTM_JS_DEFER,
722
  LiteSpeed_Cache_Config::OPID_OPTM_EMOJI_RM,
723
  LiteSpeed_Cache_Config::OPID_OPTM_EXC_JQUERY,
746
  update_option( LiteSpeed_Cache_Config::ITEM_OPTM_CSS, $this->_input[ LiteSpeed_Cache_Config::ITEM_OPTM_CSS ] ) ;
747
 
748
  // prevent URI from optimization
749
+ $id = LiteSpeed_Cache_Config::ITEM_OPTM_EXCLUDES ;
750
+ $this->_save_item( $id, 'relative' ) ;
 
 
751
 
752
  // Update js deferred excludes
753
  $id = LiteSpeed_Cache_Config::ITEM_OPTM_JS_DEFER_EXC ;
admin/tpl/inc/disabled_all.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'WPINC' ) ) die ;
3
+
4
+ if ( ! defined( 'LITESPEED_DISABLE_ALL' ) ) {
5
+ return ;
6
+ }
7
+
8
+ $err = __( 'Disable All Features', 'litespeed-cache' ) ;
9
+
10
+ // other plugin left cache expired rules in .htaccess which will cause conflicts
11
+ echo LiteSpeed_Cache_Admin_Display::build_notice( LiteSpeed_Cache_Admin_Display::NOTICE_RED, $err ) ;
12
+
admin/tpl/manage/manage_purge.php CHANGED
@@ -67,6 +67,16 @@ if ( LiteSpeed_Cache_Router::opcache_enabled() ) {
67
  ) ;
68
  }
69
 
 
 
 
 
 
 
 
 
 
 
70
  $_panels[] = array(
71
  'title' => __( 'Purge All', 'litespeed-cache' ),
72
  'desc' => __( 'Purge the cache entries created by this plugin', 'litespeed-cache' ),
67
  ) ;
68
  }
69
 
70
+ if ( LiteSpeed_Cache_CSS::has_ccss_cache() ) {
71
+ $_panels[] = array(
72
+ 'title' => __( 'Purge All', 'litespeed-cache' ) . ' - ' . __( 'Critical CSS', 'litespeed-cache' ),
73
+ 'desc' => __( 'This will delete all generated critical CSS files', 'litespeed-cache' ),
74
+ 'icon' => 'purge-cssjs',
75
+ 'append_url' => LiteSpeed_Cache_Purge::TYPE_PURGE_ALL_CCSS,
76
+ ) ;
77
+ }
78
+
79
+
80
  $_panels[] = array(
81
  'title' => __( 'Purge All', 'litespeed-cache' ),
82
  'desc' => __( 'Purge the cache entries created by this plugin', 'litespeed-cache' ),
admin/tpl/setting/settings_cache.php CHANGED
@@ -61,7 +61,7 @@ if ( ! defined( 'WPINC' ) ) die ;
61
  <tr <?php echo $_hide_in_basic_mode ; ?>>
62
  <th><?php echo __( 'Private Cached URIs', 'litespeed-cache' ) ; ?></th>
63
  <td>
64
- <?php $this->build_textarea(LiteSpeed_Cache_Config::OPID_CACHE_URI_PRIV); ?>
65
  <div class="litespeed-desc">
66
  <?php echo __('URI Paths containing these strings will NOT be cached as public.', 'litespeed-cache'); ?>
67
  <?php echo __('The URLs will be compared to the REQUEST_URI server variable.', 'litespeed-cache'); ?>
61
  <tr <?php echo $_hide_in_basic_mode ; ?>>
62
  <th><?php echo __( 'Private Cached URIs', 'litespeed-cache' ) ; ?></th>
63
  <td>
64
+ <?php $this->build_textarea2( LiteSpeed_Cache_Config::ITEM_CACHE_URI_PRIV ) ; ?>
65
  <div class="litespeed-desc">
66
  <?php echo __('URI Paths containing these strings will NOT be cached as public.', 'litespeed-cache'); ?>
67
  <?php echo __('The URLs will be compared to the REQUEST_URI server variable.', 'litespeed-cache'); ?>
admin/tpl/setting/settings_excludes.php CHANGED
@@ -13,7 +13,7 @@ if ( ! defined( 'WPINC' ) ) die ;
13
  <tr>
14
  <th><?php echo __( 'Force Cache URIs', 'litespeed-cache' ) ; ?></th>
15
  <td>
16
- <?php $this->build_textarea( LiteSpeed_Cache_Config::OPID_FORCE_CACHE_URI ) ; ?>
17
  <div class="litespeed-desc">
18
  <?php echo __('Paths containing these strings will be cached regardless of no-cacheable settings.', 'litespeed-cache'); ?>
19
  <?php echo __('The URLs will be compared to the REQUEST_URI server variable.', 'litespeed-cache'); ?>
@@ -31,7 +31,7 @@ if ( ! defined( 'WPINC' ) ) die ;
31
  <tr>
32
  <th><?php echo __( 'Do Not Cache URIs', 'litespeed-cache' ) ; ?></th>
33
  <td>
34
- <?php $this->build_textarea(LiteSpeed_Cache_Config::OPID_EXCLUDES_URI); ?>
35
  <div class="litespeed-desc">
36
  <?php echo __('Paths containing these strings will not be cached.', 'litespeed-cache'); ?>
37
  <?php echo __('The URLs will be compared to the REQUEST_URI server variable.', 'litespeed-cache'); ?>
13
  <tr>
14
  <th><?php echo __( 'Force Cache URIs', 'litespeed-cache' ) ; ?></th>
15
  <td>
16
+ <?php $this->build_textarea2( LiteSpeed_Cache_Config::ITEM_FORCE_CACHE_URI ) ; ?>
17
  <div class="litespeed-desc">
18
  <?php echo __('Paths containing these strings will be cached regardless of no-cacheable settings.', 'litespeed-cache'); ?>
19
  <?php echo __('The URLs will be compared to the REQUEST_URI server variable.', 'litespeed-cache'); ?>
31
  <tr>
32
  <th><?php echo __( 'Do Not Cache URIs', 'litespeed-cache' ) ; ?></th>
33
  <td>
34
+ <?php $this->build_textarea2( LiteSpeed_Cache_Config::ITEM_EXCLUDES_URI ) ; ?>
35
  <div class="litespeed-desc">
36
  <?php echo __('Paths containing these strings will not be cached.', 'litespeed-cache'); ?>
37
  <?php echo __('The URLs will be compared to the REQUEST_URI server variable.', 'litespeed-cache'); ?>
admin/tpl/setting/settings_optimize.php CHANGED
@@ -1,6 +1,8 @@
1
  <?php
2
  if ( ! defined( 'WPINC' ) ) die ;
3
 
 
 
4
  ?>
5
 
6
  <h3 class="litespeed-title-short">
@@ -131,8 +133,9 @@ if ( ! defined( 'WPINC' ) ) die ;
131
  <td>
132
  <?php $this->build_switch( LiteSpeed_Cache_Config::OPID_OPTM_CSS_ASYNC ) ; ?>
133
  <div class="litespeed-desc">
134
- <?php echo __( 'Optimize CSS delivery. This will load Google Fonts asynchronously too.', 'litespeed-cache' ) ; ?>
135
- <?php echo __( 'This can improve your speed score in services like Pingdom, GTmetrix and PageSpeed.', 'litespeed-cache' ) ; ?>
 
136
  <br /><font class="litespeed-success">
137
  <?php echo __('API', 'litespeed-cache'); ?>:
138
  <?php echo sprintf( __( 'Elements with attribute %s in html code will be excluded.', 'litespeed-cache' ), '<code>data-no-async="1"</code>' ) ; ?>
@@ -141,6 +144,63 @@ if ( ! defined( 'WPINC' ) ) die ;
141
  </td>
142
  </tr>
143
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
  <tr>
145
  <th><?php echo __( 'Load JS Deferred', 'litespeed-cache' ) ; ?></th>
146
  <td>
@@ -173,8 +233,8 @@ if ( ! defined( 'WPINC' ) ) die ;
173
  <div class="litespeed-desc">
174
  <?php echo __( 'Prefetching DNS can reduce latency for visiters.', 'litespeed-cache' ) ; ?>
175
  <?php echo __( 'For example', 'litespeed-cache' ) ; ?>: <code>//www.example.com</code>
176
- <a href="https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp:configuration:optimize#dns_prefetch" target="_blank"><?php echo __( 'Learn More', 'litespeed-cache' ) ; ?></a>
177
  <?php echo __( 'One per line.', 'litespeed-cache' ) ; ?>
 
178
  </div>
179
  </td>
180
  </tr>
1
  <?php
2
  if ( ! defined( 'WPINC' ) ) die ;
3
 
4
+ $last_critical_css_generated = LiteSpeed_Cache_CSS::get_summary() ;
5
+
6
  ?>
7
 
8
  <h3 class="litespeed-title-short">
133
  <td>
134
  <?php $this->build_switch( LiteSpeed_Cache_Config::OPID_OPTM_CSS_ASYNC ) ; ?>
135
  <div class="litespeed-desc">
136
+ <?php echo __( 'Optimize CSS delivery.', 'litespeed-cache' ) ; ?>
137
+ <?php echo __( 'This can improve your speed score in services like Pingdom, GTmetrix and PageSpeed.', 'litespeed-cache' ) ; ?><br />
138
+ <?php echo sprintf( __( 'When this option is turned %s, it will also load Google Fonts asynchronously.', 'litespeed-cache' ), '<code>' . __( 'ON', 'litespeed-cache' ) . '</code>' ) ; ?>
139
  <br /><font class="litespeed-success">
140
  <?php echo __('API', 'litespeed-cache'); ?>:
141
  <?php echo sprintf( __( 'Elements with attribute %s in html code will be excluded.', 'litespeed-cache' ), '<code>data-no-async="1"</code>' ) ; ?>
144
  </td>
145
  </tr>
146
 
147
+ <tr>
148
+ <th><?php echo __( 'Generate Critical CSS', 'litespeed-cache' ) ; ?></th>
149
+ <td>
150
+ <?php $this->build_switch( LiteSpeed_Cache_Config::OPT_OPTM_CCSS_GEN ) ; ?>
151
+ <div class="litespeed-desc">
152
+ <?php echo sprintf( __( 'Leave this option %1$s to allow communication with LiteSpeed CCSS server. If set to %2$s, Critical CSS will not be generated.', 'litespeed-cache' ), '<code>' . __( 'ON', 'litespeed-cache' ) . '</code>', '<code>' . __( 'OFF', 'litespeed-cache' ) . '</code>' ) ; ?><br />
153
+ <?php echo sprintf( __( 'This option only works if %1$s is %2$s.', 'litespeed-cache' ), '<code>' . __( 'Load CSS Asynchronously', 'litespeed-cache' ) . '</code>', '<code>' . __( 'ON', 'litespeed-cache' ) . '</code>' ) ; ?>
154
+ </div>
155
+ </td>
156
+ </tr>
157
+
158
+ <tr>
159
+ <th><?php echo __( 'Generate Critical CSS In Background', 'litespeed-cache' ) ; ?></th>
160
+ <td>
161
+ <?php $this->build_switch( LiteSpeed_Cache_Config::OPT_OPTM_CCSS_ASYNC ) ; ?>
162
+ <div class="litespeed-desc">
163
+ <?php echo __( 'Automatically generate critical CSS in the background via a cron-based queue.', 'litespeed-cache' ) ; ?>
164
+ <?php echo sprintf( __( 'If set to %s this is done in the foreground, which may slow down page load.', 'litespeed-cache' ), '<code>' . __('OFF', 'litespeed-cache') . '</code>' ) ; ?>
165
+ <a href="https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp:configuration:optimize#generate_critical_css" target="_blank"><?php echo __( 'Learn More', 'litespeed-cache' ) ; ?></a>
166
+ </div>
167
+
168
+ <?php if ( $last_critical_css_generated ) : ?>
169
+ <div class="litespeed-desc litespeed-left20">
170
+ <?php if ( ! empty( $last_critical_css_generated[ 'last_request' ] ) ) : ?>
171
+ <p>
172
+ <?php echo __( 'Last generated', 'litespeed-cache' ) . ': <code>' . LiteSpeed_Cache_Utility::readable_time( $last_critical_css_generated[ 'last_request' ] ) . '</code>' ; ?>
173
+ </p>
174
+ <p>
175
+ <?php echo __( 'Last requested cost', 'litespeed-cache' ) . ': <code>' . $last_critical_css_generated[ 'last_spent' ] . 's</code>' ; ?>
176
+ </p>
177
+ <?php endif ; ?>
178
+ <?php if ( ! empty( $last_critical_css_generated[ 'queue' ] ) ) : ?>
179
+ <div class="litespeed-callout-warning">
180
+ <h4><?php echo __( 'URL list in queue waiting for cron','litespeed-cache' ) ; ?></h4>
181
+ <p>
182
+ <?php echo implode( '<br />', $last_critical_css_generated[ 'queue' ] ) ; ?>
183
+ </p>
184
+ </p>
185
+ <a href="<?php echo LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_CSS, LiteSpeed_Cache_CSS::TYPE_GENERATE_CRITICAL ) ; ?>" class="litespeed-btn-success">
186
+ <?php echo __( 'Run Queue Manually', 'litespeed-cache' ) ; ?>
187
+ </a>
188
+ <?php endif ; ?>
189
+ </div>
190
+ <?php endif ; ?>
191
+ </td>
192
+ </tr>
193
+
194
+ <tr>
195
+ <th><?php echo __( 'Inline CSS Async Lib', 'litespeed-cache' ) ; ?></th>
196
+ <td>
197
+ <?php $this->build_switch( LiteSpeed_Cache_Config::OPT_OPTM_CSS_ASYNC_INLINE ) ; ?>
198
+ <div class="litespeed-desc">
199
+ <?php echo __( 'This will inline the asynchronous CSS library to avoid render blocking.', 'litespeed-cache' ) ; ?>
200
+ </div>
201
+ </td>
202
+ </tr>
203
+
204
  <tr>
205
  <th><?php echo __( 'Load JS Deferred', 'litespeed-cache' ) ; ?></th>
206
  <td>
233
  <div class="litespeed-desc">
234
  <?php echo __( 'Prefetching DNS can reduce latency for visiters.', 'litespeed-cache' ) ; ?>
235
  <?php echo __( 'For example', 'litespeed-cache' ) ; ?>: <code>//www.example.com</code>
 
236
  <?php echo __( 'One per line.', 'litespeed-cache' ) ; ?>
237
+ <a href="https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp:configuration:optimize#dns_prefetch" target="_blank"><?php echo __( 'Learn More', 'litespeed-cache' ) ; ?></a>
238
  </div>
239
  </td>
240
  </tr>
admin/tpl/setting/settings_tuning.php CHANGED
@@ -167,7 +167,7 @@ if ( ! defined( 'WPINC' ) ) die ;
167
  <tr>
168
  <th><?php echo __( 'URI Excludes', 'litespeed-cache' ) ; ?></th>
169
  <td>
170
- <?php $this->build_textarea(LiteSpeed_Cache_Config::OPID_OPTM_EXCLUDES); ?>
171
  <div class="litespeed-desc">
172
  <?php echo __( 'Prevent any optimization of listed pages.', 'litespeed-cache' ) ; ?>
173
  <?php echo __( 'Both full URLs and partial strings can be used.', 'litespeed-cache' ) ; ?>
167
  <tr>
168
  <th><?php echo __( 'URI Excludes', 'litespeed-cache' ) ; ?></th>
169
  <td>
170
+ <?php $this->build_textarea2( LiteSpeed_Cache_Config::ITEM_OPTM_EXCLUDES ) ; ?>
171
  <div class="litespeed-desc">
172
  <?php echo __( 'Prevent any optimization of listed pages.', 'litespeed-cache' ) ; ?>
173
  <?php echo __( 'Both full URLs and partial strings can be used.', 'litespeed-cache' ) ; ?>
cli/litespeed-cache-cli-admin.class.php CHANGED
@@ -53,6 +53,9 @@ class LiteSpeed_Cache_Cli_Admin
53
  LiteSpeed_Cache_Config::OPID_OPTM_QS_RM,
54
  LiteSpeed_Cache_Config::OPID_OPTM_GGFONTS_RM,
55
  LiteSpeed_Cache_Config::OPID_OPTM_CSS_ASYNC,
 
 
 
56
  LiteSpeed_Cache_Config::OPID_OPTM_JS_DEFER,
57
  LiteSpeed_Cache_Config::OPID_OPTM_EMOJI_RM,
58
  LiteSpeed_Cache_Config::OPID_OPTM_EXC_JQUERY,
@@ -162,6 +165,9 @@ class LiteSpeed_Cache_Cli_Admin
162
  case LiteSpeed_Cache_Config::OPID_OPTM_QS_RM:
163
  case LiteSpeed_Cache_Config::OPID_OPTM_GGFONTS_RM:
164
  case LiteSpeed_Cache_Config::OPID_OPTM_CSS_ASYNC:
 
 
 
165
  case LiteSpeed_Cache_Config::OPID_OPTM_JS_DEFER:
166
  case LiteSpeed_Cache_Config::OPID_OPTM_EMOJI_RM:
167
  case LiteSpeed_Cache_Config::OPID_OPTM_EXC_JQUERY:
53
  LiteSpeed_Cache_Config::OPID_OPTM_QS_RM,
54
  LiteSpeed_Cache_Config::OPID_OPTM_GGFONTS_RM,
55
  LiteSpeed_Cache_Config::OPID_OPTM_CSS_ASYNC,
56
+ LiteSpeed_Cache_Config::OPT_OPTM_CCSS_GEN,
57
+ LiteSpeed_Cache_Config::OPT_OPTM_CCSS_ASYNC,
58
+ LiteSpeed_Cache_Config::OPT_OPTM_CSS_ASYNC_INLINE,
59
  LiteSpeed_Cache_Config::OPID_OPTM_JS_DEFER,
60
  LiteSpeed_Cache_Config::OPID_OPTM_EMOJI_RM,
61
  LiteSpeed_Cache_Config::OPID_OPTM_EXC_JQUERY,
165
  case LiteSpeed_Cache_Config::OPID_OPTM_QS_RM:
166
  case LiteSpeed_Cache_Config::OPID_OPTM_GGFONTS_RM:
167
  case LiteSpeed_Cache_Config::OPID_OPTM_CSS_ASYNC:
168
+ case LiteSpeed_Cache_Config::OPT_OPTM_CCSS_GEN:
169
+ case LiteSpeed_Cache_Config::OPT_OPTM_CCSS_ASYNC:
170
+ case LiteSpeed_Cache_Config::OPT_OPTM_CSS_ASYNC_INLINE:
171
  case LiteSpeed_Cache_Config::OPID_OPTM_JS_DEFER:
172
  case LiteSpeed_Cache_Config::OPID_OPTM_EMOJI_RM:
173
  case LiteSpeed_Cache_Config::OPID_OPTM_EXC_JQUERY:
css/litespeed.css CHANGED
@@ -1648,6 +1648,10 @@ input.litespeed-input[type="file"]{
1648
 
1649
  /********************************* todo *******************************/
1650
 
 
 
 
 
1651
  /* input field */
1652
  .litespeed-textarea {
1653
  width: 60% ;
@@ -1711,6 +1715,10 @@ input.litespeed-input[type="file"]{
1711
  font-family: "Open Sans", Arial, sans-serif;
1712
  }
1713
 
 
 
 
 
1714
  .litespeed .litespeed-regular-text,
1715
  .litespeed-regular-text {
1716
  padding-left: 5px;
1648
 
1649
  /********************************* todo *******************************/
1650
 
1651
+ .litespeed-body .litespeed-textarea-success {
1652
+ border-color: #6699cc ;
1653
+ }
1654
+
1655
  /* input field */
1656
  .litespeed-textarea {
1657
  width: 60% ;
1715
  font-family: "Open Sans", Arial, sans-serif;
1716
  }
1717
 
1718
+ .litespeed-body textarea {
1719
+ border-color: #69B1FF ;
1720
+ }
1721
+
1722
  .litespeed .litespeed-regular-text,
1723
  .litespeed-regular-text {
1724
  padding-left: 5px;
inc/cdn.class.php CHANGED
@@ -37,7 +37,7 @@ class LiteSpeed_Cache_CDN
37
  {
38
  LiteSpeed_Cache_Log::debug2( 'CDN init' ) ;
39
 
40
- if ( ! $this->can_cdn() ) {
41
  if ( ! defined( self::BYPASS ) ) {
42
  define( self::BYPASS, true ) ;
43
  }
@@ -235,38 +235,6 @@ class LiteSpeed_Cache_CDN
235
  return $instance->content ;
236
  }
237
 
238
- /**
239
- * Check if it can use CDN replacement
240
- *
241
- * @since 1.2.3
242
- * @access public
243
- */
244
- public function can_cdn()
245
- {
246
- if ( is_admin() ) {
247
- return false ;
248
- }
249
-
250
- if ( is_feed() ) {
251
- return false ;
252
- }
253
-
254
- if ( is_preview() ) {
255
- return false ;
256
- }
257
-
258
- /**
259
- * Bypass login/reg page
260
- * @since 1.6
261
- */
262
- if ( in_array( $GLOBALS[ 'pagenow' ], array( 'wp-login.php', 'wp-register.php' ), true ) ) {
263
- LiteSpeed_Cache_Log::debug( 'CDN bypassed as is login/reg page' ) ;
264
- return false ;
265
- }
266
-
267
- return true ;
268
- }
269
-
270
  /**
271
  * Replace CDN url
272
  *
37
  {
38
  LiteSpeed_Cache_Log::debug2( 'CDN init' ) ;
39
 
40
+ if ( ! LiteSpeed_Cache_Router::can_cdn() ) {
41
  if ( ! defined( self::BYPASS ) ) {
42
  define( self::BYPASS, true ) ;
43
  }
235
  return $instance->content ;
236
  }
237
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
238
  /**
239
  * Replace CDN url
240
  *
inc/config.class.php CHANGED
@@ -35,6 +35,10 @@ class LiteSpeed_Cache_Config
35
  const ITEM_ADV_PURGE_ALL_HOOKS = 'litespeed-adv-purge_all_hooks' ;
36
  const ITEM_CDN_ORI_DIR = 'litespeed-cdn-ori_dir' ;
37
  const ITEM_MEDIA_WEBP_ATTRIBUTE = 'litespeed-media-webp_attribute' ;
 
 
 
 
38
 
39
  const ITEM_SETTING_MODE = 'litespeed-setting-mode' ;
40
  const ITEM_CRAWLER_HASH = 'litespeed-crawler-hash' ;
@@ -73,7 +77,6 @@ class LiteSpeed_Cache_Config
73
  const OPID_CACHE_RES = 'cache_resources' ;
74
  const OPID_CACHE_MOBILE = 'mobileview_enabled' ;
75
  const ID_MOBILEVIEW_LIST = 'mobileview_rules' ;
76
- const OPID_CACHE_URI_PRIV = 'cache_uri_priv' ;
77
  const OPID_CACHE_OBJECT = 'cache_object' ;
78
  const OPID_CACHE_OBJECT_KIND = 'cache_object_kind' ;
79
  const OPID_CACHE_OBJECT_HOST = 'cache_object_host' ;
@@ -130,8 +133,7 @@ class LiteSpeed_Cache_Config
130
  const PURGE_DATE = 'D' ;
131
  const PURGE_TERM = 'T' ; // include category|tag|tax
132
  const PURGE_POST_TYPE = 'PT' ;
133
- const OPID_FORCE_CACHE_URI = 'forced_cache_uri' ;
134
- const OPID_EXCLUDES_URI = 'excludes_uri' ;
135
  const OPID_EXCLUDES_QS = 'excludes_qs' ;
136
  const OPID_EXCLUDES_CAT = 'excludes_cat' ;
137
  const OPID_EXCLUDES_TAG = 'excludes_tag' ;
@@ -156,9 +158,11 @@ class LiteSpeed_Cache_Config
156
  const OPID_OPTM_QS_RM = 'optm_qs_rm' ;
157
  const OPID_OPTM_GGFONTS_RM = 'optm_ggfonts_rm' ;
158
  const OPID_OPTM_CSS_ASYNC = 'optm_css_async' ;
 
 
 
159
  const OPID_OPTM_JS_DEFER = 'optm_js_defer' ;
160
  const OPID_OPTM_EMOJI_RM = 'optm_emoji_rm' ;
161
- const OPID_OPTM_EXCLUDES = 'optm_excludes' ;
162
  const OPID_OPTM_EXC_JQUERY = 'optm_exclude_jquery' ;
163
  const OPID_OPTM_GGFONTS_ASYNC = 'optm_ggfonts_async' ;
164
  const OPID_OPTM_MAX_SIZE = 'optm_max_size' ;
@@ -293,6 +297,10 @@ class LiteSpeed_Cache_Config
293
  self::ITEM_OBJECT_NON_PERSISTENT_GROUPS,
294
  self::ITEM_CRWL_AS_UIDS,
295
  self::ITEM_ADV_PURGE_ALL_HOOKS,
 
 
 
 
296
  ) ;
297
  }
298
 
@@ -456,20 +464,20 @@ class LiteSpeed_Cache_Config
456
 
457
  switch ( $type ) {
458
  case 'forced_cache' :
459
- $id = self::OPID_FORCE_CACHE_URI ;
460
  break ;
461
 
462
  case 'private' :
463
- $id = self::OPID_CACHE_URI_PRIV ;
464
  break ;
465
 
466
  case 'nonoptimize' :
467
- $id = self::OPID_OPTM_EXCLUDES ;
468
  break ;
469
 
470
  case 'nocache' :
471
  default:
472
- $id = self::OPID_EXCLUDES_URI ;
473
  break ;
474
  }
475
 
@@ -477,12 +485,9 @@ class LiteSpeed_Cache_Config
477
  $list = $instance->get_item( $id ) ;
478
 
479
  $list[] = $_SERVER[ 'HTTP_REFERER' ] ;
480
- $list = array_map( 'LiteSpeed_Cache_Utility::make_relative', $list ) ;// Remove domain
481
- $list = array_unique( $list ) ;
482
- $list = array_filter( $list ) ;
483
- $list = implode( "\n", $list ) ;
484
 
485
- $instance->update_options( array( $id => $list ) ) ;
486
 
487
  // Purge this page & redirect
488
  LiteSpeed_Cache_Purge::purge_front() ;
@@ -627,7 +632,6 @@ class LiteSpeed_Cache_Config
627
  self::OPID_CACHE_RES => true,
628
  self::OPID_CACHE_MOBILE => false,
629
  self::ID_MOBILEVIEW_LIST => false,
630
- self::OPID_CACHE_URI_PRIV => '',
631
  self::OPID_CACHE_OBJECT => false,
632
  self::OPID_CACHE_OBJECT_KIND => false,
633
  self::OPID_CACHE_OBJECT_HOST => 'localhost',
@@ -662,8 +666,6 @@ class LiteSpeed_Cache_Config
662
  self::OPID_404_TTL => 3600,
663
  self::OPID_500_TTL => 3600,
664
  self::OPID_PURGE_BY_POST => implode('.', $default_purge_options),
665
- self::OPID_FORCE_CACHE_URI => '',
666
- self::OPID_EXCLUDES_URI => '',
667
  self::OPID_EXCLUDES_QS => '',
668
  self::OPID_EXCLUDES_CAT => '',
669
  self::OPID_EXCLUDES_TAG => '',
@@ -688,9 +690,11 @@ class LiteSpeed_Cache_Config
688
  self::OPID_OPTM_QS_RM => false,
689
  self::OPID_OPTM_GGFONTS_RM => false,
690
  self::OPID_OPTM_CSS_ASYNC => false,
 
 
 
691
  self::OPID_OPTM_JS_DEFER => false,
692
  self::OPID_OPTM_EMOJI_RM => false,
693
- self::OPID_OPTM_EXCLUDES => '',
694
  self::OPID_OPTM_EXC_JQUERY => true,
695
  self::OPID_OPTM_GGFONTS_ASYNC => false,
696
  self::OPID_OPTM_MAX_SIZE => 1.2,
@@ -996,6 +1000,23 @@ class LiteSpeed_Cache_Config
996
  LiteSpeed_Cache_Log::debug( "[Cfg] plugin_upgrade option adding CDN map" ) ;
997
  }
998
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
999
  $this->options = self::option_diff( $default_options, $this->options ) ;
1000
 
1001
  $res = $this->update_options() ;
35
  const ITEM_ADV_PURGE_ALL_HOOKS = 'litespeed-adv-purge_all_hooks' ;
36
  const ITEM_CDN_ORI_DIR = 'litespeed-cdn-ori_dir' ;
37
  const ITEM_MEDIA_WEBP_ATTRIBUTE = 'litespeed-media-webp_attribute' ;
38
+ const ITEM_FORCE_CACHE_URI = 'litespeed-forced_cache_uri' ;
39
+ const ITEM_CACHE_URI_PRIV = 'litespeed-cache_uri_priv' ;
40
+ const ITEM_OPTM_EXCLUDES = 'litespeed-optm_excludes' ;
41
+ const ITEM_EXCLUDES_URI = 'litespeed-excludes_uri' ;
42
 
43
  const ITEM_SETTING_MODE = 'litespeed-setting-mode' ;
44
  const ITEM_CRAWLER_HASH = 'litespeed-crawler-hash' ;
77
  const OPID_CACHE_RES = 'cache_resources' ;
78
  const OPID_CACHE_MOBILE = 'mobileview_enabled' ;
79
  const ID_MOBILEVIEW_LIST = 'mobileview_rules' ;
 
80
  const OPID_CACHE_OBJECT = 'cache_object' ;
81
  const OPID_CACHE_OBJECT_KIND = 'cache_object_kind' ;
82
  const OPID_CACHE_OBJECT_HOST = 'cache_object_host' ;
133
  const PURGE_DATE = 'D' ;
134
  const PURGE_TERM = 'T' ; // include category|tag|tax
135
  const PURGE_POST_TYPE = 'PT' ;
136
+
 
137
  const OPID_EXCLUDES_QS = 'excludes_qs' ;
138
  const OPID_EXCLUDES_CAT = 'excludes_cat' ;
139
  const OPID_EXCLUDES_TAG = 'excludes_tag' ;
158
  const OPID_OPTM_QS_RM = 'optm_qs_rm' ;
159
  const OPID_OPTM_GGFONTS_RM = 'optm_ggfonts_rm' ;
160
  const OPID_OPTM_CSS_ASYNC = 'optm_css_async' ;
161
+ const OPT_OPTM_CCSS_GEN = 'optm_ccss_gen' ;
162
+ const OPT_OPTM_CCSS_ASYNC = 'optm_ccss_async' ;
163
+ const OPT_OPTM_CSS_ASYNC_INLINE = 'optm_css_async_inline' ;
164
  const OPID_OPTM_JS_DEFER = 'optm_js_defer' ;
165
  const OPID_OPTM_EMOJI_RM = 'optm_emoji_rm' ;
 
166
  const OPID_OPTM_EXC_JQUERY = 'optm_exclude_jquery' ;
167
  const OPID_OPTM_GGFONTS_ASYNC = 'optm_ggfonts_async' ;
168
  const OPID_OPTM_MAX_SIZE = 'optm_max_size' ;
297
  self::ITEM_OBJECT_NON_PERSISTENT_GROUPS,
298
  self::ITEM_CRWL_AS_UIDS,
299
  self::ITEM_ADV_PURGE_ALL_HOOKS,
300
+ self::ITEM_FORCE_CACHE_URI,
301
+ self::ITEM_CACHE_URI_PRIV,
302
+ self::ITEM_OPTM_EXCLUDES,
303
+ self::ITEM_EXCLUDES_URI,
304
  ) ;
305
  }
306
 
464
 
465
  switch ( $type ) {
466
  case 'forced_cache' :
467
+ $id = self::ITEM_FORCE_CACHE_URI ;
468
  break ;
469
 
470
  case 'private' :
471
+ $id = self::ITEM_CACHE_URI_PRIV ;
472
  break ;
473
 
474
  case 'nonoptimize' :
475
+ $id = self::ITEM_OPTM_EXCLUDES ;
476
  break ;
477
 
478
  case 'nocache' :
479
  default:
480
+ $id = self::ITEM_EXCLUDES_URI ;
481
  break ;
482
  }
483
 
485
  $list = $instance->get_item( $id ) ;
486
 
487
  $list[] = $_SERVER[ 'HTTP_REFERER' ] ;
488
+ $list = LiteSpeed_Cache_Utility::sanitize_lines( $list, 'relative' ) ;
 
 
 
489
 
490
+ update_option( $id, $list ) ;
491
 
492
  // Purge this page & redirect
493
  LiteSpeed_Cache_Purge::purge_front() ;
632
  self::OPID_CACHE_RES => true,
633
  self::OPID_CACHE_MOBILE => false,
634
  self::ID_MOBILEVIEW_LIST => false,
 
635
  self::OPID_CACHE_OBJECT => false,
636
  self::OPID_CACHE_OBJECT_KIND => false,
637
  self::OPID_CACHE_OBJECT_HOST => 'localhost',
666
  self::OPID_404_TTL => 3600,
667
  self::OPID_500_TTL => 3600,
668
  self::OPID_PURGE_BY_POST => implode('.', $default_purge_options),
 
 
669
  self::OPID_EXCLUDES_QS => '',
670
  self::OPID_EXCLUDES_CAT => '',
671
  self::OPID_EXCLUDES_TAG => '',
690
  self::OPID_OPTM_QS_RM => false,
691
  self::OPID_OPTM_GGFONTS_RM => false,
692
  self::OPID_OPTM_CSS_ASYNC => false,
693
+ self::OPT_OPTM_CCSS_GEN => true,
694
+ self::OPT_OPTM_CCSS_ASYNC => true,
695
+ self::OPT_OPTM_CSS_ASYNC_INLINE => true,
696
  self::OPID_OPTM_JS_DEFER => false,
697
  self::OPID_OPTM_EMOJI_RM => false,
 
698
  self::OPID_OPTM_EXC_JQUERY => true,
699
  self::OPID_OPTM_GGFONTS_ASYNC => false,
700
  self::OPID_OPTM_MAX_SIZE => 1.2,
1000
  LiteSpeed_Cache_Log::debug( "[Cfg] plugin_upgrade option adding CDN map" ) ;
1001
  }
1002
 
1003
+ /**
1004
+ * Move Exclude settings to separate item
1005
+ * @since 2.3
1006
+ */
1007
+ if ( isset( $this->options[ 'forced_cache_uri' ] ) ) {
1008
+ update_option( LiteSpeed_Cache_Config::ITEM_FORCE_CACHE_URI, $this->options[ 'forced_cache_uri' ] ) ;
1009
+ }
1010
+ if ( isset( $this->options[ 'cache_uri_priv' ] ) ) {
1011
+ update_option( LiteSpeed_Cache_Config::ITEM_CACHE_URI_PRIV, $this->options[ 'cache_uri_priv' ] ) ;
1012
+ }
1013
+ if ( isset( $this->options[ 'optm_excludes' ] ) ) {
1014
+ update_option( LiteSpeed_Cache_Config::ITEM_OPTM_EXCLUDES, $this->options[ 'optm_excludes' ] ) ;
1015
+ }
1016
+ if ( isset( $this->options[ 'excludes_uri' ] ) ) {
1017
+ update_option( LiteSpeed_Cache_Config::ITEM_EXCLUDES_URI, $this->options[ 'excludes_uri' ] ) ;
1018
+ }
1019
+
1020
  $this->options = self::option_diff( $default_options, $this->options ) ;
1021
 
1022
  $res = $this->update_options() ;
inc/control.class.php CHANGED
@@ -514,9 +514,9 @@ class LiteSpeed_Cache_Control
514
  public static function finalize()
515
  {
516
  // Check if URI is forced cache
517
- $excludes = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_FORCE_CACHE_URI ) ;
518
  if ( ! empty( $excludes ) ) {
519
- $result = LiteSpeed_Cache_Utility::str_hit_array( $_SERVER[ 'REQUEST_URI' ], explode( "\n", $excludes ) ) ;
520
  if ( $result ) {
521
  self::force_cacheable() ;
522
  LiteSpeed_Cache_Log::debug( '[Ctrl] Forced cacheable due to setting: ' . $result ) ;
@@ -635,9 +635,9 @@ class LiteSpeed_Cache_Control
635
  // }
636
 
637
  // Check private cache URI setting
638
- $excludes = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CACHE_URI_PRIV ) ;
639
  if ( ! empty( $excludes ) ) {
640
- $result = LiteSpeed_Cache_Utility::str_hit_array( $_SERVER[ 'REQUEST_URI' ], explode( "\n", $excludes ) ) ;
641
  if ( $result ) {
642
  self::set_private( 'Admin cfg Private Cached URI: ' . $result ) ;
643
  }
@@ -646,9 +646,9 @@ class LiteSpeed_Cache_Control
646
  if ( ! self::is_forced_cacheable() ) {
647
 
648
  // Check if URI is excluded from cache
649
- $excludes = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_EXCLUDES_URI ) ;
650
  if ( ! empty( $excludes ) ) {
651
- $result = LiteSpeed_Cache_Utility::str_hit_array( $_SERVER[ 'REQUEST_URI' ], explode( "\n", $excludes ) ) ;
652
  if ( $result ) {
653
  return $this->_no_cache_for( 'Admin configured URI Do not cache: ' . $result ) ;
654
  }
514
  public static function finalize()
515
  {
516
  // Check if URI is forced cache
517
+ $excludes = LiteSpeed_Cache_Config::get_instance()->get_item( LiteSpeed_Cache_Config::ITEM_FORCE_CACHE_URI ) ;
518
  if ( ! empty( $excludes ) ) {
519
+ $result = LiteSpeed_Cache_Utility::str_hit_array( $_SERVER[ 'REQUEST_URI' ], $excludes ) ;
520
  if ( $result ) {
521
  self::force_cacheable() ;
522
  LiteSpeed_Cache_Log::debug( '[Ctrl] Forced cacheable due to setting: ' . $result ) ;
635
  // }
636
 
637
  // Check private cache URI setting
638
+ $excludes = LiteSpeed_Cache_Config::get_instance()->get_item( LiteSpeed_Cache_Config::ITEM_CACHE_URI_PRIV ) ;
639
  if ( ! empty( $excludes ) ) {
640
+ $result = LiteSpeed_Cache_Utility::str_hit_array( $_SERVER[ 'REQUEST_URI' ], $excludes ) ;
641
  if ( $result ) {
642
  self::set_private( 'Admin cfg Private Cached URI: ' . $result ) ;
643
  }
646
  if ( ! self::is_forced_cacheable() ) {
647
 
648
  // Check if URI is excluded from cache
649
+ $excludes = LiteSpeed_Cache_Config::get_instance()->get_item( LiteSpeed_Cache_Config::ITEM_EXCLUDES_URI ) ;
650
  if ( ! empty( $excludes ) ) {
651
+ $result = LiteSpeed_Cache_Utility::str_hit_array( $_SERVER[ 'REQUEST_URI' ], $excludes ) ;
652
  if ( $result ) {
653
  return $this->_no_cache_for( 'Admin configured URI Do not cache: ' . $result ) ;
654
  }
inc/css.cls.php ADDED
@@ -0,0 +1,347 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * The optimize css class.
5
+ *
6
+ * @since 2.3
7
+ * @package LiteSpeed_Cache
8
+ * @subpackage LiteSpeed_Cache/inc
9
+ * @author LiteSpeed Technologies <info@litespeedtech.com>
10
+ */
11
+
12
+ class LiteSpeed_Cache_CSS
13
+ {
14
+ private static $_instance ;
15
+
16
+ const TYPE_GENERATE_CRITICAL = 'generate_critical' ;
17
+
18
+ const DB_CCSS_SUMMARY = 'litespeed-ccss-summary' ;
19
+
20
+ /**
21
+ * Output critical css
22
+ *
23
+ * @since 1.3
24
+ * @since 2.3 Migrated from optimize.cls
25
+ * @access public
26
+ */
27
+ public static function prepend_ccss( $html_head )
28
+ {
29
+ // Get critical css for current page
30
+ // Note: need to consider mobile
31
+ $rules = self::get_instance()->_ccss() ;
32
+
33
+ // Append default critical css
34
+ $rules .= get_option( LiteSpeed_Cache_Config::ITEM_OPTM_CSS ) ;
35
+
36
+ $html_head = '<style id="litespeed-optm-css-rules">' . $rules . '</style>' . $html_head ;
37
+
38
+ return $html_head ;
39
+ }
40
+
41
+ /**
42
+ * Check if there is a queue for cron or not
43
+ *
44
+ * @since 2.3
45
+ * @access public
46
+ */
47
+ public static function has_queue()
48
+ {
49
+ $req_summary = self::get_summary() ;
50
+ if ( ! empty( $req_summary[ 'queue' ] ) ) {
51
+ return true ;
52
+ }
53
+
54
+ return false ;
55
+ }
56
+
57
+ /**
58
+ * Check if there is a ccss cache folder
59
+ *
60
+ * @since 2.3
61
+ * @access public
62
+ */
63
+ public static function has_ccss_cache()
64
+ {
65
+ return is_dir( LSCWP_CONTENT_DIR . '/cache/ccss' ) ;
66
+ }
67
+
68
+ /**
69
+ * Save ccss summary
70
+ *
71
+ * @since 2.3
72
+ * @access private
73
+ */
74
+ private function _save_summary( $data )
75
+ {
76
+ update_option( self::DB_CCSS_SUMMARY, $data ) ;
77
+ }
78
+
79
+ /**
80
+ * Read last time generated info
81
+ *
82
+ * @since 2.3
83
+ * @access public
84
+ */
85
+ public static function get_summary()
86
+ {
87
+ return get_option( self::DB_CCSS_SUMMARY, array() ) ;
88
+ }
89
+
90
+ /**
91
+ * Generate realpath of ccss
92
+ *
93
+ * @since 2.3
94
+ * @access public
95
+ */
96
+ public static function ccss_realpath( $ccss_type )
97
+ {
98
+ return LSCWP_CONTENT_DIR . "/cache/ccss/$ccss_type.css" ;
99
+ }
100
+
101
+ /**
102
+ * Delete file-based cache folder
103
+ *
104
+ * @since 2.3
105
+ * @access public
106
+ */
107
+ public function rm_cache_folder()
108
+ {
109
+ if ( file_exists( LSCWP_CONTENT_DIR . '/cache/ccss' ) ) {
110
+ Litespeed_File::rrmdir( LSCWP_CONTENT_DIR . '/cache/ccss' ) ;
111
+ }
112
+ }
113
+
114
+ /**
115
+ * The critical css content of the current page
116
+ *
117
+ * @since 2.3
118
+ * @access private
119
+ */
120
+ private function _ccss()
121
+ {
122
+ // If don't need to generate CCSS, bypass
123
+ if ( ! LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPT_OPTM_CCSS_GEN ) ) {
124
+ LiteSpeed_Cache_Log::debug( '[CSS] bypassed ccss due to setting' ) ;
125
+ return '' ;
126
+ }
127
+
128
+ $ccss_type = $this->_which_css() ;
129
+ $ccss_file = self::ccss_realpath( $ccss_type ) ;
130
+
131
+ if ( file_exists( $ccss_file ) ) {
132
+ LiteSpeed_Cache_Log::debug2( '[CSS] existing ccss ' . $ccss_file ) ;
133
+ return Litespeed_File::read( $ccss_file ) ;
134
+ }
135
+
136
+ // Check if is already in a request, bypass current one
137
+ $req_summary = self::get_summary() ;
138
+ if ( $req_summary && ! empty( $req_summary[ 'curr_request' ] ) && time() - $req_summary[ 'curr_request' ] < 300 ) {
139
+ return '' ;
140
+ }
141
+
142
+ global $wp ;
143
+ $request_url = home_url( $wp->request ) ;
144
+
145
+ // If generate in backend, log it and bypass
146
+ if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPT_OPTM_CCSS_ASYNC ) ) {
147
+ // Store it to prepare for cron
148
+ if ( empty( $req_summary[ 'queue' ] ) ) {
149
+ $req_summary[ 'queue' ] = array() ;
150
+ }
151
+ $req_summary[ 'queue' ][ $ccss_type ] = $request_url ;
152
+ LiteSpeed_Cache_Log::debug( '[CSS] Added queue [type] ' . $ccss_type . ' [url] ' . $request_url ) ;
153
+
154
+ $this->_save_summary( $req_summary ) ;
155
+ return '' ;
156
+ }
157
+
158
+ // generate on the fly
159
+ return $this->_generate_ccss( $request_url, $ccss_type ) ;
160
+ }
161
+
162
+ /**
163
+ * Cron ccss generation
164
+ *
165
+ * @since 2.3
166
+ * @access private
167
+ */
168
+ public static function cron_ccss( $continue = false )
169
+ {
170
+ $req_summary = self::get_summary() ;
171
+ if ( empty( $req_summary[ 'queue' ] ) ) {
172
+ return ;
173
+ }
174
+
175
+ // For cron, need to check request interval too
176
+ if ( ! $continue ) {
177
+ if ( $req_summary && ! empty( $req_summary[ 'curr_request' ] ) && time() - $req_summary[ 'curr_request' ] < 300 ) {
178
+ return ;
179
+ }
180
+ }
181
+
182
+ foreach ( $req_summary[ 'queue' ] as $k => $v ) {
183
+ LiteSpeed_Cache_Log::debug( '[CSS] cron job [type] ' . $k . ' [url] ' . $v ) ;
184
+
185
+ self::get_instance()->_generate_ccss( $v, $k ) ;
186
+
187
+ // only request first one
188
+ if ( ! $continue ) {
189
+ return ;
190
+ }
191
+ }
192
+ }
193
+
194
+ /**
195
+ * Send to LiteSpeed CSS API to generate CSS
196
+ *
197
+ * @since 2.3
198
+ * @access private
199
+ */
200
+ private function _generate_ccss( $request_url, $ccss_type )
201
+ {
202
+ $req_summary = self::get_summary() ;
203
+
204
+ $ccss_file = self::ccss_realpath( $ccss_type ) ;
205
+
206
+ // Update css request status
207
+ $req_summary[ 'curr_request' ] = time() ;
208
+ $this->_save_summary( $req_summary ) ;
209
+
210
+ // Generate critical css
211
+ $url = 'http://ccss.api.litespeedtech.com' ;
212
+
213
+ $data = array(
214
+ 'home_url' => home_url(),
215
+ 'url' => $request_url,
216
+ 'ccss_type' => $ccss_type,
217
+ ) ;
218
+
219
+ LiteSpeed_Cache_Log::debug( '[CSS] posting to : ' . $url, $data ) ;
220
+
221
+ $param = array(
222
+ 'v' => LiteSpeed_Cache::PLUGIN_VERSION,
223
+ 'data' => $data,
224
+ ) ;
225
+
226
+ $response = wp_remote_post( $url, array( 'body' => $param, 'timeout' => 15 ) ) ;
227
+
228
+ // Parse response data
229
+ if ( is_wp_error( $response ) ) {
230
+ $error_message = $response->get_error_message() ;
231
+ LiteSpeed_Cache_Log::debug( '[CSS] failed to post: ' . $error_message ) ;
232
+ return false ;
233
+ }
234
+
235
+ $json = json_decode( $response[ 'body' ], true ) ;
236
+ if ( ! is_array( $json ) ) {
237
+ LiteSpeed_Cache_Log::debug( '[CSS] failed to decode post json: ' . $response[ 'body' ] ) ;
238
+ return false ;
239
+ }
240
+
241
+ if ( ! empty( $json[ '_err' ] ) ) {
242
+ LiteSpeed_Cache_Log::debug( '[CSS] _err: ' . $json[ '_err' ] ) ;
243
+ return false ;
244
+ }
245
+
246
+ if ( empty( $json[ 'ccss' ] ) ) {
247
+ LiteSpeed_Cache_Log::debug( '[CSS] empty ccss ' ) ;
248
+ return false ;
249
+ }
250
+
251
+ // Write to file
252
+ Litespeed_File::save( $ccss_file, $json[ 'ccss' ], true ) ;
253
+
254
+ // Save summary data
255
+ $req_summary[ 'last_spent' ] = time() - $req_summary[ 'curr_request' ] ;
256
+ $req_summary[ 'last_request' ] = $req_summary[ 'curr_request' ] ;
257
+ $req_summary[ 'curr_request' ] = 0 ;
258
+ if ( empty( $req_summary[ 'ccss_type_history' ] ) ) {
259
+ $req_summary[ 'ccss_type_history' ] = array() ;
260
+ }
261
+ $req_summary[ 'ccss_type_history' ][ $ccss_type ] = $request_url ;
262
+ unset( $req_summary[ 'queue' ][ $ccss_type ] ) ;
263
+
264
+ $this->_save_summary( $req_summary ) ;
265
+
266
+ LiteSpeed_Cache_Log::debug( '[CSS] saved ccss ' . $ccss_file ) ;
267
+
268
+ LiteSpeed_Cache_Log::debug2( '[CSS] ccss con: ' . $json[ 'ccss' ] ) ;
269
+
270
+ return $json[ 'ccss' ] ;
271
+ }
272
+
273
+ /**
274
+ * The critical css file for current page
275
+ *
276
+ * @since 2.3
277
+ * @access private
278
+ */
279
+ private function _which_css()
280
+ {
281
+ $css = 'default' ;
282
+ if ( is_404() ) {
283
+ $css = '404' ;
284
+ }
285
+ elseif ( is_singular() ) {
286
+ $css = get_post_type() ;
287
+ }
288
+ elseif ( is_home() && get_option( 'show_on_front' ) == 'page' ) {
289
+ $css = 'home' ;
290
+ }
291
+ elseif ( is_front_page() ) {
292
+ $css = 'front' ;
293
+ }
294
+ elseif ( is_tax() ) {
295
+ $css = get_queried_object()->taxonomy ;
296
+ }
297
+ elseif ( is_category() ) {
298
+ $css = 'category' ;
299
+ }
300
+ elseif ( is_tag() ) {
301
+ $css = 'tag' ;
302
+ }
303
+
304
+ return $css ;
305
+ }
306
+
307
+ /**
308
+ * Handle all request actions from main cls
309
+ *
310
+ * @since 2.3
311
+ * @access public
312
+ */
313
+ public static function handler()
314
+ {
315
+ $instance = self::get_instance() ;
316
+
317
+ $type = LiteSpeed_Cache_Router::verify_type() ;
318
+
319
+ switch ( $type ) {
320
+ case self::TYPE_GENERATE_CRITICAL :
321
+ self::cron_ccss( true ) ;
322
+ break ;
323
+
324
+ default:
325
+ break ;
326
+ }
327
+
328
+ LiteSpeed_Cache_Admin::redirect() ;
329
+ }
330
+
331
+ /**
332
+ * Get the current instance object.
333
+ *
334
+ * @since 2.3
335
+ * @access public
336
+ * @return Current class instance.
337
+ */
338
+ public static function get_instance()
339
+ {
340
+ if ( ! isset( self::$_instance ) ) {
341
+ self::$_instance = new self() ;
342
+ }
343
+
344
+ return self::$_instance ;
345
+ }
346
+
347
+ }
inc/gui.class.php CHANGED
@@ -171,6 +171,8 @@ class LiteSpeed_Cache_GUI
171
  {
172
  include_once LSCWP_DIR . "admin/tpl/inc/banner_promo.php" ;
173
  include_once LSCWP_DIR . "admin/tpl/inc/banner_promo.slack.php" ;
 
 
174
  }
175
 
176
  /**
@@ -430,6 +432,15 @@ class LiteSpeed_Cache_GUI
430
  ) );
431
  }
432
 
 
 
 
 
 
 
 
 
 
433
  }
434
 
435
  /**
171
  {
172
  include_once LSCWP_DIR . "admin/tpl/inc/banner_promo.php" ;
173
  include_once LSCWP_DIR . "admin/tpl/inc/banner_promo.slack.php" ;
174
+
175
+ include_once LSCWP_DIR . "admin/tpl/inc/disabled_all.php" ;
176
  }
177
 
178
  /**
432
  ) );
433
  }
434
 
435
+ if ( LiteSpeed_Cache_CSS::has_ccss_cache() ) {
436
+ $wp_admin_bar->add_menu( array(
437
+ 'parent' => 'litespeed-menu',
438
+ 'id' => 'litespeed-purge-ccss',
439
+ 'title' => __( 'Purge All', 'litespeed-cache' ) . ' - ' . __( 'Critical CSS', 'litespeed-cache' ),
440
+ 'href' => LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_PURGE, LiteSpeed_Cache_Purge::TYPE_PURGE_ALL_CCSS ),
441
+ 'meta' => array( 'tabindex' => '0' ),
442
+ ) );
443
+ }
444
  }
445
 
446
  /**
inc/litespeed-cache.class.php CHANGED
@@ -19,7 +19,7 @@ class LiteSpeed_Cache
19
  private static $_instance ;
20
 
21
  const PLUGIN_NAME = 'litespeed-cache' ;
22
- const PLUGIN_VERSION = '2.2.7' ;
23
 
24
  const PAGE_EDIT_HTACCESS = 'lscache-edit-htaccess' ;
25
 
@@ -57,6 +57,7 @@ class LiteSpeed_Cache
57
  const ACTION_IAPI = 'iapi' ;
58
  const ACTION_CDN = 'cdn' ;
59
  const ACTION_REPORT = 'report' ;
 
60
  const ACTION_SAPI_PASSIVE_CALLBACK = 'sapi_passive_callback' ;
61
  const ACTION_SAPI_AGGRESSIVE_CALLBACK = 'sapi_aggressive_callback' ;
62
 
@@ -327,6 +328,10 @@ class LiteSpeed_Cache
327
  $msg = LiteSpeed_Cache_Import::handler() ;
328
  break ;
329
 
 
 
 
 
330
  case LiteSpeed_Cache::ACTION_CDN_CLOUDFLARE:
331
  $msg = LiteSpeed_Cache_CDN_Cloudflare::handler() ;
332
  break ;
19
  private static $_instance ;
20
 
21
  const PLUGIN_NAME = 'litespeed-cache' ;
22
+ const PLUGIN_VERSION = '2.3.1' ;
23
 
24
  const PAGE_EDIT_HTACCESS = 'lscache-edit-htaccess' ;
25
 
57
  const ACTION_IAPI = 'iapi' ;
58
  const ACTION_CDN = 'cdn' ;
59
  const ACTION_REPORT = 'report' ;
60
+ const ACTION_CSS = 'css' ;
61
  const ACTION_SAPI_PASSIVE_CALLBACK = 'sapi_passive_callback' ;
62
  const ACTION_SAPI_AGGRESSIVE_CALLBACK = 'sapi_aggressive_callback' ;
63
 
328
  $msg = LiteSpeed_Cache_Import::handler() ;
329
  break ;
330
 
331
+ case LiteSpeed_Cache::ACTION_CSS:
332
+ $msg = LiteSpeed_Cache_CSS::handler() ;
333
+ break ;
334
+
335
  case LiteSpeed_Cache::ACTION_CDN_CLOUDFLARE:
336
  $msg = LiteSpeed_Cache_CDN_Cloudflare::handler() ;
337
  break ;
inc/litespeed.autoload.php CHANGED
@@ -32,6 +32,7 @@ if ( !function_exists('_litespeed_autoload') ) {
32
  'LiteSpeed_Cache_Control' => 'inc/control.class.php',
33
  'LiteSpeed_Cache_Crawler' => 'inc/crawler.class.php',
34
  'LiteSpeed_Cache_Crawler_Sitemap' => 'inc/crawler-sitemap.class.php',
 
35
  'LiteSpeed_Cache_Data' => 'inc/data.class.php',
36
  'LiteSpeed_Cache_Doc' => 'inc/doc.cls.php',
37
  'LiteSpeed_Cache_ESI' => 'inc/esi.class.php',
32
  'LiteSpeed_Cache_Control' => 'inc/control.class.php',
33
  'LiteSpeed_Cache_Crawler' => 'inc/crawler.class.php',
34
  'LiteSpeed_Cache_Crawler_Sitemap' => 'inc/crawler-sitemap.class.php',
35
+ 'LiteSpeed_Cache_CSS' => 'inc/css.cls.php',
36
  'LiteSpeed_Cache_Data' => 'inc/data.class.php',
37
  'LiteSpeed_Cache_Doc' => 'inc/doc.cls.php',
38
  'LiteSpeed_Cache_ESI' => 'inc/esi.class.php',
inc/log.class.php CHANGED
@@ -235,17 +235,23 @@ class LiteSpeed_Cache_Log
235
  if ( defined( 'LSCWP_LOG_MORE' ) && $backtrace_limit !== false ) {
236
  $trace = version_compare( PHP_VERSION, '5.4.0', '<' ) ? debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS ) : debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, $backtrace_limit + 2 ) ;
237
  for ( $i=1 ; $i <= $backtrace_limit + 1 ; $i++ ) {// the 0st item is push()
238
- if ( empty( $trace[$i]['class'] ) ) {
239
- break ;
 
 
 
240
  }
241
- if ( $trace[$i]['class'] == 'LiteSpeed_Cache_Log' ) {
242
- continue ;
 
 
 
 
243
  }
244
- $log = str_replace('LiteSpeed_Cache', 'LSC', $trace[$i]['class']) . $trace[$i]['type'] . $trace[$i]['function'] . '()' ;
245
  if ( ! empty( $trace[$i-1]['line'] ) ) {
246
  $log .= '@' . $trace[$i-1]['line'] ;
247
  }
248
- $msg .= " \ $log" ;
249
  }
250
 
251
  }
235
  if ( defined( 'LSCWP_LOG_MORE' ) && $backtrace_limit !== false ) {
236
  $trace = version_compare( PHP_VERSION, '5.4.0', '<' ) ? debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS ) : debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, $backtrace_limit + 2 ) ;
237
  for ( $i=1 ; $i <= $backtrace_limit + 1 ; $i++ ) {// the 0st item is push()
238
+ if ( empty( $trace[ $i ][ 'class' ] ) ) {
239
+ if ( empty( $trace[ $i ][ 'file' ] ) ) {
240
+ break ;
241
+ }
242
+ $log = "\n" . $trace[ $i ][ 'file' ] ;
243
  }
244
+ else {
245
+ if ( $trace[$i]['class'] == 'LiteSpeed_Cache_Log' ) {
246
+ continue ;
247
+ }
248
+
249
+ $log = str_replace('LiteSpeed_Cache', 'LSC', $trace[$i]['class']) . $trace[$i]['type'] . $trace[$i]['function'] . '()' ;
250
  }
 
251
  if ( ! empty( $trace[$i-1]['line'] ) ) {
252
  $log .= '@' . $trace[$i-1]['line'] ;
253
  }
254
+ $msg .= " => $log" ;
255
  }
256
 
257
  }
inc/optimize.class.php CHANGED
@@ -16,6 +16,7 @@ class LiteSpeed_Cache_Optimize
16
 
17
  const DIR_MIN = '/min' ;
18
  const CSS_ASYNC_LIB = '/min/css_async.js' ;
 
19
 
20
  private $content ;
21
  private $http2_headers = array() ;
@@ -74,7 +75,7 @@ class LiteSpeed_Cache_Optimize
74
 
75
  $this->_static_request_check() ;
76
 
77
- if ( ! $this->_can_optm() ) {
78
  return ;
79
  }
80
 
@@ -90,7 +91,7 @@ class LiteSpeed_Cache_Optimize
90
 
91
  // Check if there is any critical css rules setting
92
  if ( $this->cfg_css_async ) {
93
- add_action( 'wp_head', array( $this, 'prepend_critical_css' ), 1 ) ;
94
  }
95
 
96
  /**
@@ -154,24 +155,6 @@ class LiteSpeed_Cache_Optimize
154
  remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' ) ;
155
  }
156
 
157
- /**
158
- * Output critical css
159
- *
160
- * @since 1.3
161
- * @access public
162
- * @return string The static file content
163
- */
164
- public function prepend_critical_css()
165
- {
166
-
167
- $rules = get_option( LiteSpeed_Cache_Config::ITEM_OPTM_CSS ) ;
168
- if ( ! $rules ) {
169
- return ;
170
- }
171
-
172
- echo '<style id="litespeed-optm-css-rules">' . $rules . '</style>' ;
173
- }
174
-
175
  /**
176
  * Check if the request is for static file
177
  *
@@ -185,9 +168,7 @@ class LiteSpeed_Cache_Optimize
185
  if ( ( $this->cfg_css_async || $this->cfg_ggfonts_async ) && strpos( $_SERVER[ 'REQUEST_URI' ], self::CSS_ASYNC_LIB ) !== false ) {
186
  LiteSpeed_Cache_Log::debug( '[Optm] start serving static file' ) ;
187
 
188
- $file = LSCWP_DIR . 'js/css_async.min.js' ;
189
-
190
- $content = Litespeed_File::read( $file ) ;
191
 
192
  $static_file = LSCWP_CONTENT_DIR . '/cache/js/css_async.js' ;
193
 
@@ -318,33 +299,6 @@ class LiteSpeed_Cache_Optimize
318
  return $src ;
319
  }
320
 
321
- /**
322
- * Check if can run optimize
323
- *
324
- * @since 1.3
325
- * @access private
326
- */
327
- private function _can_optm()
328
- {
329
- if ( is_admin() ) {
330
- return false ;
331
- }
332
-
333
- if ( is_feed() ) {
334
- return false ;
335
- }
336
-
337
- if ( is_preview() ) {
338
- return false ;
339
- }
340
-
341
- if ( LiteSpeed_Cache_Router::is_ajax() ) {
342
- return false ;
343
- }
344
-
345
- return true ;
346
- }
347
-
348
  /**
349
  * Run optimize process
350
  * NOTE: As this is after cache finalized, can NOT set any cache control anymore
@@ -365,9 +319,9 @@ class LiteSpeed_Cache_Optimize
365
  }
366
 
367
  // Check if hit URI excludes
368
- $excludes = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTM_EXCLUDES ) ;
369
  if ( ! empty( $excludes ) ) {
370
- $result = LiteSpeed_Cache_Utility::str_hit_array( $_SERVER[ 'REQUEST_URI' ], explode( "\n", $excludes ) ) ;
371
  if ( $result ) {
372
  LiteSpeed_Cache_Log::debug( '[Optm] bypass: hit URI Excludes setting: ' . $result ) ;
373
  return $content ;
@@ -398,7 +352,7 @@ class LiteSpeed_Cache_Optimize
398
  */
399
  private function _optimize()
400
  {
401
- if ( ! $this->_can_optm() ) {
402
  LiteSpeed_Cache_Log::debug( '[Optm] bypass: admin/feed/preview' ) ;
403
  return ;
404
  }
@@ -636,9 +590,15 @@ class LiteSpeed_Cache_Optimize
636
 
637
  // Append async compatibility lib to head
638
  if ( $this->cfg_css_async || $this->cfg_ggfonts_async ) {
639
- $css_async_lib_url = LiteSpeed_Cache_Utility::get_permalink_url( self::CSS_ASYNC_LIB ) ;
640
- $this->html_head .= "<script src='" . $css_async_lib_url . "' " . ( $this->cfg_js_defer ? 'defer' : '' ) . "></script>" ;// Don't exclude it from defer for now
641
- $this->append_http2( $css_async_lib_url, 'js' ) ; // async lib will be http/2 pushed always
 
 
 
 
 
 
642
  }
643
 
644
  if ( $this->cfg_ggfonts_async ) {
@@ -1226,6 +1186,3 @@ class LiteSpeed_Cache_Optimize
1226
  }
1227
 
1228
  }
1229
-
1230
-
1231
-
16
 
17
  const DIR_MIN = '/min' ;
18
  const CSS_ASYNC_LIB = '/min/css_async.js' ;
19
+ const CSS_ASYNC_LIB_FILE = 'js/css_async.min.js' ;
20
 
21
  private $content ;
22
  private $http2_headers = array() ;
75
 
76
  $this->_static_request_check() ;
77
 
78
+ if ( ! LiteSpeed_Cache_Router::can_optm() ) {
79
  return ;
80
  }
81
 
91
 
92
  // Check if there is any critical css rules setting
93
  if ( $this->cfg_css_async ) {
94
+ add_filter( 'litespeed_optm_html_head', 'LiteSpeed_Cache_CSS::prepend_ccss', 1 ) ;
95
  }
96
 
97
  /**
155
  remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' ) ;
156
  }
157
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
158
  /**
159
  * Check if the request is for static file
160
  *
168
  if ( ( $this->cfg_css_async || $this->cfg_ggfonts_async ) && strpos( $_SERVER[ 'REQUEST_URI' ], self::CSS_ASYNC_LIB ) !== false ) {
169
  LiteSpeed_Cache_Log::debug( '[Optm] start serving static file' ) ;
170
 
171
+ $content = Litespeed_File::read( LSCWP_DIR . self::CSS_ASYNC_LIB_FILE ) ;
 
 
172
 
173
  $static_file = LSCWP_CONTENT_DIR . '/cache/js/css_async.js' ;
174
 
299
  return $src ;
300
  }
301
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
302
  /**
303
  * Run optimize process
304
  * NOTE: As this is after cache finalized, can NOT set any cache control anymore
319
  }
320
 
321
  // Check if hit URI excludes
322
+ $excludes = LiteSpeed_Cache_Config::get_instance()->get_item( LiteSpeed_Cache_Config::ITEM_OPTM_EXCLUDES ) ;
323
  if ( ! empty( $excludes ) ) {
324
+ $result = LiteSpeed_Cache_Utility::str_hit_array( $_SERVER[ 'REQUEST_URI' ], $excludes ) ;
325
  if ( $result ) {
326
  LiteSpeed_Cache_Log::debug( '[Optm] bypass: hit URI Excludes setting: ' . $result ) ;
327
  return $content ;
352
  */
353
  private function _optimize()
354
  {
355
+ if ( ! LiteSpeed_Cache_Router::can_optm() ) {
356
  LiteSpeed_Cache_Log::debug( '[Optm] bypass: admin/feed/preview' ) ;
357
  return ;
358
  }
590
 
591
  // Append async compatibility lib to head
592
  if ( $this->cfg_css_async || $this->cfg_ggfonts_async ) {
593
+ // Inline css async lib
594
+ if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPT_OPTM_CSS_ASYNC_INLINE ) ) {
595
+ $this->html_head .= '<script id="litespeed-css-async-lib" type="text/javascript">' . Litespeed_File::read( LSCWP_DIR . self::CSS_ASYNC_LIB_FILE ) . '</script>' ;
596
+ }
597
+ else {
598
+ $css_async_lib_url = LiteSpeed_Cache_Utility::get_permalink_url( self::CSS_ASYNC_LIB ) ;
599
+ $this->html_head .= "<script id='litespeed-css-async-lib' src='" . $css_async_lib_url . "' " . ( $this->cfg_js_defer ? 'defer' : '' ) . "></script>" ;// Don't exclude it from defer for now
600
+ $this->append_http2( $css_async_lib_url, 'js' ) ; // async lib will be http/2 pushed always
601
+ }
602
  }
603
 
604
  if ( $this->cfg_ggfonts_async ) {
1186
  }
1187
 
1188
  }
 
 
 
inc/purge.class.php CHANGED
@@ -23,6 +23,7 @@ class LiteSpeed_Cache_Purge
23
  const TYPE_PURGE_ALL = 'purge_all' ;
24
  const TYPE_PURGE_ALL_LSCACHE = 'purge_all_lscache' ;
25
  const TYPE_PURGE_ALL_CSSJS = 'purge_all_cssjs' ;
 
26
  const TYPE_PURGE_ALL_OBJECT = 'purge_all_object' ;
27
  const TYPE_PURGE_ALL_OPCACHE = 'purge_all_opcache' ;
28
 
@@ -81,6 +82,10 @@ class LiteSpeed_Cache_Purge
81
  $instance->_purge_all_cssjs() ;
82
  break ;
83
 
 
 
 
 
84
  case self::TYPE_PURGE_ALL_OBJECT :
85
  $instance->_purge_all_object() ;
86
  break ;
@@ -133,6 +138,7 @@ class LiteSpeed_Cache_Purge
133
  {
134
  $this->_purge_all_lscache( true ) ;
135
  $this->_purge_all_cssjs( true ) ;
 
136
  $this->_purge_all_object( true ) ;
137
  $this->_purge_all_opcache( true ) ;
138
 
@@ -174,6 +180,22 @@ class LiteSpeed_Cache_Purge
174
  }
175
  }
176
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
177
  /**
178
  * Alerts LiteSpeed Web Server to purge pages.
179
  *
23
  const TYPE_PURGE_ALL = 'purge_all' ;
24
  const TYPE_PURGE_ALL_LSCACHE = 'purge_all_lscache' ;
25
  const TYPE_PURGE_ALL_CSSJS = 'purge_all_cssjs' ;
26
+ const TYPE_PURGE_ALL_CCSS = 'purge_all_ccss' ;
27
  const TYPE_PURGE_ALL_OBJECT = 'purge_all_object' ;
28
  const TYPE_PURGE_ALL_OPCACHE = 'purge_all_opcache' ;
29
 
82
  $instance->_purge_all_cssjs() ;
83
  break ;
84
 
85
+ case self::TYPE_PURGE_ALL_CCSS :
86
+ $instance->_purge_all_ccss() ;
87
+ break ;
88
+
89
  case self::TYPE_PURGE_ALL_OBJECT :
90
  $instance->_purge_all_object() ;
91
  break ;
138
  {
139
  $this->_purge_all_lscache( true ) ;
140
  $this->_purge_all_cssjs( true ) ;
141
+ $this->_purge_all_ccss( true ) ;
142
  $this->_purge_all_object( true ) ;
143
  $this->_purge_all_opcache( true ) ;
144
 
180
  }
181
  }
182
 
183
+ /**
184
+ * Delete all critical css
185
+ *
186
+ * @since 2.3
187
+ * @access private
188
+ */
189
+ private function _purge_all_ccss( $silence = false )
190
+ {
191
+ LiteSpeed_Cache_CSS::get_instance()->rm_cache_folder() ;
192
+
193
+ if ( ! $silence ) {
194
+ $msg = __( 'Cleaned all critical CSS files.', 'litespeed-cache' ) ;
195
+ ! defined( 'LITESPEED_PURGE_SILENT' ) && LiteSpeed_Cache_Admin_Display::succeed( $msg ) ;
196
+ }
197
+ }
198
+
199
  /**
200
  * Alerts LiteSpeed Web Server to purge pages.
201
  *
inc/router.class.php CHANGED
@@ -14,6 +14,7 @@
14
  class LiteSpeed_Cache_Router
15
  {
16
  private static $_instance ;
 
17
  private static $_esi_enabled ;
18
  private static $_is_ajax ;
19
  private static $_is_logged_in ;
@@ -23,6 +24,103 @@ class LiteSpeed_Cache_Router
23
  private static $_is_admin_ip ;
24
  private static $_frontend_path ;
25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  /**
27
  * Crawler simulate role
28
  *
@@ -385,6 +483,8 @@ class LiteSpeed_Cache_Router
385
  case LiteSpeed_Cache::ACTION_CDN_CLOUDFLARE:
386
  case LiteSpeed_Cache::ACTION_CDN_QUICCLOUD:
387
  case LiteSpeed_Cache::ACTION_IMPORT:
 
 
388
  if ( $_can_option && ! $_is_network_admin ) {
389
  self::$_action = $action ;
390
  }
@@ -396,12 +496,6 @@ class LiteSpeed_Cache_Router
396
  }
397
  return ;
398
 
399
- case LiteSpeed_Cache::ACTION_REPORT:
400
- if ( $_can_option && ! $_is_network_admin ) {
401
- self::$_action = $action ;
402
- }
403
- return ;
404
-
405
  case LiteSpeed_Cache::ACTION_SAPI_PASSIVE_CALLBACK :
406
  case LiteSpeed_Cache::ACTION_SAPI_AGGRESSIVE_CALLBACK :
407
  self::$_action = $action ;
14
  class LiteSpeed_Cache_Router
15
  {
16
  private static $_instance ;
17
+
18
  private static $_esi_enabled ;
19
  private static $_is_ajax ;
20
  private static $_is_logged_in ;
24
  private static $_is_admin_ip ;
25
  private static $_frontend_path ;
26
 
27
+ /**
28
+ * Check if can run optimize
29
+ *
30
+ * @since 1.3
31
+ * @since 2.3.1 Relocated from cdn.cls
32
+ * @access public
33
+ */
34
+ public static function can_optm()
35
+ {
36
+ $can = true ;
37
+
38
+ if ( is_admin() ) {
39
+ $can = false ;
40
+ }
41
+
42
+ if ( is_feed() ) {
43
+ $can = false ;
44
+ }
45
+
46
+ if ( is_preview() ) {
47
+ $can = false ;
48
+ }
49
+
50
+ if ( self::is_ajax() ) {
51
+ $can = false ;
52
+ }
53
+
54
+ if ( self::_is_login_page() ) {
55
+ LiteSpeed_Cache_Log::debug( '[Router] Optm bypassed: login/reg page' ) ;
56
+ $can = false ;
57
+ }
58
+
59
+ $can_final = apply_filters( 'litespeed_can_optm', $can ) ;
60
+
61
+ if ( $can_final != $can ) {
62
+ LiteSpeed_Cache_Log::debug( '[Router] Optm bypassed: filter' ) ;
63
+ }
64
+
65
+ return $can_final ;
66
+ }
67
+
68
+ /**
69
+ * Check if it can use CDN replacement
70
+ *
71
+ * @since 1.2.3
72
+ * @since 2.3.1 Relocated from cdn.cls
73
+ * @access public
74
+ */
75
+ public static function can_cdn()
76
+ {
77
+ $can = true ;
78
+
79
+ if ( is_admin() && ! self::is_ajax() ) {
80
+ $can = false ;
81
+ }
82
+
83
+ if ( is_feed() ) {
84
+ $can = false ;
85
+ }
86
+
87
+ if ( is_preview() ) {
88
+ $can = false ;
89
+ }
90
+
91
+ /**
92
+ * Bypass login/reg page
93
+ * @since 1.6
94
+ */
95
+ if ( self::_is_login_page() ) {
96
+ LiteSpeed_Cache_Log::debug( '[Router] CDN bypassed: login/reg page' ) ;
97
+ $can = false ;
98
+ }
99
+
100
+ $can_final = apply_filters( 'litespeed_can_cdn', $can ) ;
101
+
102
+ if ( $can_final != $can ) {
103
+ LiteSpeed_Cache_Log::debug( '[Router] CDN bypassed: filter' ) ;
104
+ }
105
+
106
+ return $can_final ;
107
+ }
108
+
109
+ /**
110
+ * Check if is login page or not
111
+ *
112
+ * @since 2.3.1
113
+ * @access protected
114
+ */
115
+ protected static function _is_login_page()
116
+ {
117
+ if ( in_array( $GLOBALS[ 'pagenow' ], array( 'wp-login.php', 'wp-register.php' ), true ) ) {
118
+ return true ;
119
+ }
120
+
121
+ return false ;
122
+ }
123
+
124
  /**
125
  * Crawler simulate role
126
  *
483
  case LiteSpeed_Cache::ACTION_CDN_CLOUDFLARE:
484
  case LiteSpeed_Cache::ACTION_CDN_QUICCLOUD:
485
  case LiteSpeed_Cache::ACTION_IMPORT:
486
+ case LiteSpeed_Cache::ACTION_REPORT:
487
+ case LiteSpeed_Cache::ACTION_CSS:
488
  if ( $_can_option && ! $_is_network_admin ) {
489
  self::$_action = $action ;
490
  }
496
  }
497
  return ;
498
 
 
 
 
 
 
 
499
  case LiteSpeed_Cache::ACTION_SAPI_PASSIVE_CALLBACK :
500
  case LiteSpeed_Cache::ACTION_SAPI_AGGRESSIVE_CALLBACK :
501
  self::$_action = $action ;
inc/task.class.php CHANGED
@@ -15,8 +15,9 @@ class LiteSpeed_Cache_Task
15
 
16
  const CRON_ACTION_HOOK_CRAWLER = 'litespeed_crawl_trigger' ;
17
  const CRON_ACTION_HOOK_IMGOPTM = 'litespeed_imgoptm_trigger' ;
 
18
  const CRON_FITLER_CRAWLER = 'litespeed_crawl_filter' ;
19
- const CRON_FITLER_IMGOPTM = 'litespeed_imgoptm_filter' ;
20
 
21
  /**
22
  * Init
@@ -46,6 +47,13 @@ class LiteSpeed_Cache_Task
46
  else {
47
  // wp_clear_scheduled_hook( self::CRON_ACTION_HOOK_IMGOPTM ) ;
48
  }
 
 
 
 
 
 
 
49
  }
50
 
51
  /**
@@ -104,12 +112,29 @@ class LiteSpeed_Cache_Task
104
  */
105
  public static function schedule_filter_imgoptm()
106
  {
107
- add_filter( 'cron_schedules', 'LiteSpeed_Cache_Task::lscache_cron_filter_imgoptm' ) ;
108
 
109
  // Schedule event here to see if it can lost again or not
110
  if( ! wp_next_scheduled( self::CRON_ACTION_HOOK_IMGOPTM ) ) {
111
  LiteSpeed_Cache_Log::debug( 'Cron log: ......img optimization cron hook register......' ) ;
112
- wp_schedule_event( time(), self::CRON_FITLER_IMGOPTM, self::CRON_ACTION_HOOK_IMGOPTM ) ;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113
  }
114
  }
115
 
@@ -137,12 +162,12 @@ class LiteSpeed_Cache_Task
137
  * @access public
138
  * @param array $schedules WP Hook
139
  */
140
- public static function lscache_cron_filter_imgoptm( $schedules )
141
  {
142
- if ( ! array_key_exists( self::CRON_FITLER_IMGOPTM, $schedules ) ) {
143
- $schedules[ self::CRON_FITLER_IMGOPTM ] = array(
144
  'interval' => 60,
145
- 'display' => __( 'LiteSpeed Cache Custom Cron ImgOptm', 'litespeed-cache' ),
146
  ) ;
147
  }
148
  return $schedules ;
15
 
16
  const CRON_ACTION_HOOK_CRAWLER = 'litespeed_crawl_trigger' ;
17
  const CRON_ACTION_HOOK_IMGOPTM = 'litespeed_imgoptm_trigger' ;
18
+ const CRON_ACTION_HOOK_CCSS = 'litespeed_ccss_trigger' ;
19
  const CRON_FITLER_CRAWLER = 'litespeed_crawl_filter' ;
20
+ const CRON_FITLER = 'litespeed_filter' ;
21
 
22
  /**
23
  * Init
47
  else {
48
  // wp_clear_scheduled_hook( self::CRON_ACTION_HOOK_IMGOPTM ) ;
49
  }
50
+
51
+ // Register ccss generation
52
+ if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPT_OPTM_CCSS_ASYNC ) && LiteSpeed_Cache_CSS::has_queue() ) {
53
+ self::schedule_filter_ccss() ;
54
+
55
+ add_action( self::CRON_ACTION_HOOK_CCSS, 'LiteSpeed_Cache_CSS::cron_ccss' ) ;
56
+ }
57
  }
58
 
59
  /**
112
  */
113
  public static function schedule_filter_imgoptm()
114
  {
115
+ add_filter( 'cron_schedules', 'LiteSpeed_Cache_Task::lscache_cron_filter' ) ;
116
 
117
  // Schedule event here to see if it can lost again or not
118
  if( ! wp_next_scheduled( self::CRON_ACTION_HOOK_IMGOPTM ) ) {
119
  LiteSpeed_Cache_Log::debug( 'Cron log: ......img optimization cron hook register......' ) ;
120
+ wp_schedule_event( time(), self::CRON_FITLER, self::CRON_ACTION_HOOK_IMGOPTM ) ;
121
+ }
122
+ }
123
+
124
+ /**
125
+ * Schedule cron ccss generation
126
+ *
127
+ * @since 2.3
128
+ * @access public
129
+ */
130
+ public static function schedule_filter_ccss()
131
+ {
132
+ add_filter( 'cron_schedules', 'LiteSpeed_Cache_Task::lscache_cron_filter' ) ;
133
+
134
+ // Schedule event here to see if it can lost again or not
135
+ if( ! wp_next_scheduled( self::CRON_ACTION_HOOK_CCSS ) ) {
136
+ LiteSpeed_Cache_Log::debug( 'Cron log: ......ccss cron hook register......' ) ;
137
+ wp_schedule_event( time(), self::CRON_FITLER, self::CRON_ACTION_HOOK_CCSS ) ;
138
  }
139
  }
140
 
162
  * @access public
163
  * @param array $schedules WP Hook
164
  */
165
+ public static function lscache_cron_filter( $schedules )
166
  {
167
+ if ( ! array_key_exists( self::CRON_FITLER, $schedules ) ) {
168
+ $schedules[ self::CRON_FITLER ] = array(
169
  'interval' => 60,
170
+ 'display' => __( 'LiteSpeed Cache Custom Cron Common', 'litespeed-cache' ),
171
  ) ;
172
  }
173
  return $schedules ;
inc/utility.class.php CHANGED
@@ -306,13 +306,16 @@ class LiteSpeed_Cache_Utility
306
  * @param bool $type String handler type
307
  * @return string
308
  */
309
- public static function sanitize_lines( $content, $type = null )
310
  {
311
- if ( ! $content ) {
312
- return $content ;
 
 
 
 
313
  }
314
 
315
- $arr = explode( "\n", $content ) ;
316
  $arr = array_map( 'trim', $arr ) ;
317
  if ( $type === 'uri' ) {
318
  $arr = array_map( 'LiteSpeed_Cache_Utility::url2uri', $arr ) ;
306
  * @param bool $type String handler type
307
  * @return string
308
  */
309
+ public static function sanitize_lines( $arr, $type = null )
310
  {
311
+ if ( ! $arr ) {
312
+ return $arr ;
313
+ }
314
+
315
+ if ( ! is_array( $arr ) ) {
316
+ $arr = explode( "\n", $arr ) ;
317
  }
318
 
 
319
  $arr = array_map( 'trim', $arr ) ;
320
  if ( $type === 'uri' ) {
321
  $arr = array_map( 'LiteSpeed_Cache_Utility::url2uri', $arr ) ;
includes/litespeed-cache-cdn.class.php CHANGED
@@ -37,7 +37,7 @@ class LiteSpeed_Cache_CDN
37
  {
38
  LiteSpeed_Cache_Log::debug2( 'CDN init' ) ;
39
 
40
- if ( ! $this->can_cdn() ) {
41
  if ( ! defined( self::BYPASS ) ) {
42
  define( self::BYPASS, true ) ;
43
  }
@@ -235,38 +235,6 @@ class LiteSpeed_Cache_CDN
235
  return $instance->content ;
236
  }
237
 
238
- /**
239
- * Check if it can use CDN replacement
240
- *
241
- * @since 1.2.3
242
- * @access public
243
- */
244
- public function can_cdn()
245
- {
246
- if ( is_admin() ) {
247
- return false ;
248
- }
249
-
250
- if ( is_feed() ) {
251
- return false ;
252
- }
253
-
254
- if ( is_preview() ) {
255
- return false ;
256
- }
257
-
258
- /**
259
- * Bypass login/reg page
260
- * @since 1.6
261
- */
262
- if ( in_array( $GLOBALS[ 'pagenow' ], array( 'wp-login.php', 'wp-register.php' ), true ) ) {
263
- LiteSpeed_Cache_Log::debug( 'CDN bypassed as is login/reg page' ) ;
264
- return false ;
265
- }
266
-
267
- return true ;
268
- }
269
-
270
  /**
271
  * Replace CDN url
272
  *
37
  {
38
  LiteSpeed_Cache_Log::debug2( 'CDN init' ) ;
39
 
40
+ if ( ! LiteSpeed_Cache_Router::can_cdn() ) {
41
  if ( ! defined( self::BYPASS ) ) {
42
  define( self::BYPASS, true ) ;
43
  }
235
  return $instance->content ;
236
  }
237
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
238
  /**
239
  * Replace CDN url
240
  *
includes/litespeed-cache-config.class.php CHANGED
@@ -35,6 +35,10 @@ class LiteSpeed_Cache_Config
35
  const ITEM_ADV_PURGE_ALL_HOOKS = 'litespeed-adv-purge_all_hooks' ;
36
  const ITEM_CDN_ORI_DIR = 'litespeed-cdn-ori_dir' ;
37
  const ITEM_MEDIA_WEBP_ATTRIBUTE = 'litespeed-media-webp_attribute' ;
 
 
 
 
38
 
39
  const ITEM_SETTING_MODE = 'litespeed-setting-mode' ;
40
  const ITEM_CRAWLER_HASH = 'litespeed-crawler-hash' ;
@@ -73,7 +77,6 @@ class LiteSpeed_Cache_Config
73
  const OPID_CACHE_RES = 'cache_resources' ;
74
  const OPID_CACHE_MOBILE = 'mobileview_enabled' ;
75
  const ID_MOBILEVIEW_LIST = 'mobileview_rules' ;
76
- const OPID_CACHE_URI_PRIV = 'cache_uri_priv' ;
77
  const OPID_CACHE_OBJECT = 'cache_object' ;
78
  const OPID_CACHE_OBJECT_KIND = 'cache_object_kind' ;
79
  const OPID_CACHE_OBJECT_HOST = 'cache_object_host' ;
@@ -130,8 +133,7 @@ class LiteSpeed_Cache_Config
130
  const PURGE_DATE = 'D' ;
131
  const PURGE_TERM = 'T' ; // include category|tag|tax
132
  const PURGE_POST_TYPE = 'PT' ;
133
- const OPID_FORCE_CACHE_URI = 'forced_cache_uri' ;
134
- const OPID_EXCLUDES_URI = 'excludes_uri' ;
135
  const OPID_EXCLUDES_QS = 'excludes_qs' ;
136
  const OPID_EXCLUDES_CAT = 'excludes_cat' ;
137
  const OPID_EXCLUDES_TAG = 'excludes_tag' ;
@@ -156,9 +158,11 @@ class LiteSpeed_Cache_Config
156
  const OPID_OPTM_QS_RM = 'optm_qs_rm' ;
157
  const OPID_OPTM_GGFONTS_RM = 'optm_ggfonts_rm' ;
158
  const OPID_OPTM_CSS_ASYNC = 'optm_css_async' ;
 
 
 
159
  const OPID_OPTM_JS_DEFER = 'optm_js_defer' ;
160
  const OPID_OPTM_EMOJI_RM = 'optm_emoji_rm' ;
161
- const OPID_OPTM_EXCLUDES = 'optm_excludes' ;
162
  const OPID_OPTM_EXC_JQUERY = 'optm_exclude_jquery' ;
163
  const OPID_OPTM_GGFONTS_ASYNC = 'optm_ggfonts_async' ;
164
  const OPID_OPTM_MAX_SIZE = 'optm_max_size' ;
@@ -293,6 +297,10 @@ class LiteSpeed_Cache_Config
293
  self::ITEM_OBJECT_NON_PERSISTENT_GROUPS,
294
  self::ITEM_CRWL_AS_UIDS,
295
  self::ITEM_ADV_PURGE_ALL_HOOKS,
 
 
 
 
296
  ) ;
297
  }
298
 
@@ -456,20 +464,20 @@ class LiteSpeed_Cache_Config
456
 
457
  switch ( $type ) {
458
  case 'forced_cache' :
459
- $id = self::OPID_FORCE_CACHE_URI ;
460
  break ;
461
 
462
  case 'private' :
463
- $id = self::OPID_CACHE_URI_PRIV ;
464
  break ;
465
 
466
  case 'nonoptimize' :
467
- $id = self::OPID_OPTM_EXCLUDES ;
468
  break ;
469
 
470
  case 'nocache' :
471
  default:
472
- $id = self::OPID_EXCLUDES_URI ;
473
  break ;
474
  }
475
 
@@ -477,12 +485,9 @@ class LiteSpeed_Cache_Config
477
  $list = $instance->get_item( $id ) ;
478
 
479
  $list[] = $_SERVER[ 'HTTP_REFERER' ] ;
480
- $list = array_map( 'LiteSpeed_Cache_Utility::make_relative', $list ) ;// Remove domain
481
- $list = array_unique( $list ) ;
482
- $list = array_filter( $list ) ;
483
- $list = implode( "\n", $list ) ;
484
 
485
- $instance->update_options( array( $id => $list ) ) ;
486
 
487
  // Purge this page & redirect
488
  LiteSpeed_Cache_Purge::purge_front() ;
@@ -627,7 +632,6 @@ class LiteSpeed_Cache_Config
627
  self::OPID_CACHE_RES => true,
628
  self::OPID_CACHE_MOBILE => false,
629
  self::ID_MOBILEVIEW_LIST => false,
630
- self::OPID_CACHE_URI_PRIV => '',
631
  self::OPID_CACHE_OBJECT => false,
632
  self::OPID_CACHE_OBJECT_KIND => false,
633
  self::OPID_CACHE_OBJECT_HOST => 'localhost',
@@ -662,8 +666,6 @@ class LiteSpeed_Cache_Config
662
  self::OPID_404_TTL => 3600,
663
  self::OPID_500_TTL => 3600,
664
  self::OPID_PURGE_BY_POST => implode('.', $default_purge_options),
665
- self::OPID_FORCE_CACHE_URI => '',
666
- self::OPID_EXCLUDES_URI => '',
667
  self::OPID_EXCLUDES_QS => '',
668
  self::OPID_EXCLUDES_CAT => '',
669
  self::OPID_EXCLUDES_TAG => '',
@@ -688,9 +690,11 @@ class LiteSpeed_Cache_Config
688
  self::OPID_OPTM_QS_RM => false,
689
  self::OPID_OPTM_GGFONTS_RM => false,
690
  self::OPID_OPTM_CSS_ASYNC => false,
 
 
 
691
  self::OPID_OPTM_JS_DEFER => false,
692
  self::OPID_OPTM_EMOJI_RM => false,
693
- self::OPID_OPTM_EXCLUDES => '',
694
  self::OPID_OPTM_EXC_JQUERY => true,
695
  self::OPID_OPTM_GGFONTS_ASYNC => false,
696
  self::OPID_OPTM_MAX_SIZE => 1.2,
@@ -996,6 +1000,23 @@ class LiteSpeed_Cache_Config
996
  LiteSpeed_Cache_Log::debug( "[Cfg] plugin_upgrade option adding CDN map" ) ;
997
  }
998
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
999
  $this->options = self::option_diff( $default_options, $this->options ) ;
1000
 
1001
  $res = $this->update_options() ;
35
  const ITEM_ADV_PURGE_ALL_HOOKS = 'litespeed-adv-purge_all_hooks' ;
36
  const ITEM_CDN_ORI_DIR = 'litespeed-cdn-ori_dir' ;
37
  const ITEM_MEDIA_WEBP_ATTRIBUTE = 'litespeed-media-webp_attribute' ;
38
+ const ITEM_FORCE_CACHE_URI = 'litespeed-forced_cache_uri' ;
39
+ const ITEM_CACHE_URI_PRIV = 'litespeed-cache_uri_priv' ;
40
+ const ITEM_OPTM_EXCLUDES = 'litespeed-optm_excludes' ;
41
+ const ITEM_EXCLUDES_URI = 'litespeed-excludes_uri' ;
42
 
43
  const ITEM_SETTING_MODE = 'litespeed-setting-mode' ;
44
  const ITEM_CRAWLER_HASH = 'litespeed-crawler-hash' ;
77
  const OPID_CACHE_RES = 'cache_resources' ;
78
  const OPID_CACHE_MOBILE = 'mobileview_enabled' ;
79
  const ID_MOBILEVIEW_LIST = 'mobileview_rules' ;
 
80
  const OPID_CACHE_OBJECT = 'cache_object' ;
81
  const OPID_CACHE_OBJECT_KIND = 'cache_object_kind' ;
82
  const OPID_CACHE_OBJECT_HOST = 'cache_object_host' ;
133
  const PURGE_DATE = 'D' ;
134
  const PURGE_TERM = 'T' ; // include category|tag|tax
135
  const PURGE_POST_TYPE = 'PT' ;
136
+
 
137
  const OPID_EXCLUDES_QS = 'excludes_qs' ;
138
  const OPID_EXCLUDES_CAT = 'excludes_cat' ;
139
  const OPID_EXCLUDES_TAG = 'excludes_tag' ;
158
  const OPID_OPTM_QS_RM = 'optm_qs_rm' ;
159
  const OPID_OPTM_GGFONTS_RM = 'optm_ggfonts_rm' ;
160
  const OPID_OPTM_CSS_ASYNC = 'optm_css_async' ;
161
+ const OPT_OPTM_CCSS_GEN = 'optm_ccss_gen' ;
162
+ const OPT_OPTM_CCSS_ASYNC = 'optm_ccss_async' ;
163
+ const OPT_OPTM_CSS_ASYNC_INLINE = 'optm_css_async_inline' ;
164
  const OPID_OPTM_JS_DEFER = 'optm_js_defer' ;
165
  const OPID_OPTM_EMOJI_RM = 'optm_emoji_rm' ;
 
166
  const OPID_OPTM_EXC_JQUERY = 'optm_exclude_jquery' ;
167
  const OPID_OPTM_GGFONTS_ASYNC = 'optm_ggfonts_async' ;
168
  const OPID_OPTM_MAX_SIZE = 'optm_max_size' ;
297
  self::ITEM_OBJECT_NON_PERSISTENT_GROUPS,
298
  self::ITEM_CRWL_AS_UIDS,
299
  self::ITEM_ADV_PURGE_ALL_HOOKS,
300
+ self::ITEM_FORCE_CACHE_URI,
301
+ self::ITEM_CACHE_URI_PRIV,
302
+ self::ITEM_OPTM_EXCLUDES,
303
+ self::ITEM_EXCLUDES_URI,
304
  ) ;
305
  }
306
 
464
 
465
  switch ( $type ) {
466
  case 'forced_cache' :
467
+ $id = self::ITEM_FORCE_CACHE_URI ;
468
  break ;
469
 
470
  case 'private' :
471
+ $id = self::ITEM_CACHE_URI_PRIV ;
472
  break ;
473
 
474
  case 'nonoptimize' :
475
+ $id = self::ITEM_OPTM_EXCLUDES ;
476
  break ;
477
 
478
  case 'nocache' :
479
  default:
480
+ $id = self::ITEM_EXCLUDES_URI ;
481
  break ;
482
  }
483
 
485
  $list = $instance->get_item( $id ) ;
486
 
487
  $list[] = $_SERVER[ 'HTTP_REFERER' ] ;
488
+ $list = LiteSpeed_Cache_Utility::sanitize_lines( $list, 'relative' ) ;
 
 
 
489
 
490
+ update_option( $id, $list ) ;
491
 
492
  // Purge this page & redirect
493
  LiteSpeed_Cache_Purge::purge_front() ;
632
  self::OPID_CACHE_RES => true,
633
  self::OPID_CACHE_MOBILE => false,
634
  self::ID_MOBILEVIEW_LIST => false,
 
635
  self::OPID_CACHE_OBJECT => false,
636
  self::OPID_CACHE_OBJECT_KIND => false,
637
  self::OPID_CACHE_OBJECT_HOST => 'localhost',
666
  self::OPID_404_TTL => 3600,
667
  self::OPID_500_TTL => 3600,
668
  self::OPID_PURGE_BY_POST => implode('.', $default_purge_options),
 
 
669
  self::OPID_EXCLUDES_QS => '',
670
  self::OPID_EXCLUDES_CAT => '',
671
  self::OPID_EXCLUDES_TAG => '',
690
  self::OPID_OPTM_QS_RM => false,
691
  self::OPID_OPTM_GGFONTS_RM => false,
692
  self::OPID_OPTM_CSS_ASYNC => false,
693
+ self::OPT_OPTM_CCSS_GEN => true,
694
+ self::OPT_OPTM_CCSS_ASYNC => true,
695
+ self::OPT_OPTM_CSS_ASYNC_INLINE => true,
696
  self::OPID_OPTM_JS_DEFER => false,
697
  self::OPID_OPTM_EMOJI_RM => false,
 
698
  self::OPID_OPTM_EXC_JQUERY => true,
699
  self::OPID_OPTM_GGFONTS_ASYNC => false,
700
  self::OPID_OPTM_MAX_SIZE => 1.2,
1000
  LiteSpeed_Cache_Log::debug( "[Cfg] plugin_upgrade option adding CDN map" ) ;
1001
  }
1002
 
1003
+ /**
1004
+ * Move Exclude settings to separate item
1005
+ * @since 2.3
1006
+ */
1007
+ if ( isset( $this->options[ 'forced_cache_uri' ] ) ) {
1008
+ update_option( LiteSpeed_Cache_Config::ITEM_FORCE_CACHE_URI, $this->options[ 'forced_cache_uri' ] ) ;
1009
+ }
1010
+ if ( isset( $this->options[ 'cache_uri_priv' ] ) ) {
1011
+ update_option( LiteSpeed_Cache_Config::ITEM_CACHE_URI_PRIV, $this->options[ 'cache_uri_priv' ] ) ;
1012
+ }
1013
+ if ( isset( $this->options[ 'optm_excludes' ] ) ) {
1014
+ update_option( LiteSpeed_Cache_Config::ITEM_OPTM_EXCLUDES, $this->options[ 'optm_excludes' ] ) ;
1015
+ }
1016
+ if ( isset( $this->options[ 'excludes_uri' ] ) ) {
1017
+ update_option( LiteSpeed_Cache_Config::ITEM_EXCLUDES_URI, $this->options[ 'excludes_uri' ] ) ;
1018
+ }
1019
+
1020
  $this->options = self::option_diff( $default_options, $this->options ) ;
1021
 
1022
  $res = $this->update_options() ;
includes/litespeed-cache-control.class.php CHANGED
@@ -514,9 +514,9 @@ class LiteSpeed_Cache_Control
514
  public static function finalize()
515
  {
516
  // Check if URI is forced cache
517
- $excludes = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_FORCE_CACHE_URI ) ;
518
  if ( ! empty( $excludes ) ) {
519
- $result = LiteSpeed_Cache_Utility::str_hit_array( $_SERVER[ 'REQUEST_URI' ], explode( "\n", $excludes ) ) ;
520
  if ( $result ) {
521
  self::force_cacheable() ;
522
  LiteSpeed_Cache_Log::debug( '[Ctrl] Forced cacheable due to setting: ' . $result ) ;
@@ -635,9 +635,9 @@ class LiteSpeed_Cache_Control
635
  // }
636
 
637
  // Check private cache URI setting
638
- $excludes = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CACHE_URI_PRIV ) ;
639
  if ( ! empty( $excludes ) ) {
640
- $result = LiteSpeed_Cache_Utility::str_hit_array( $_SERVER[ 'REQUEST_URI' ], explode( "\n", $excludes ) ) ;
641
  if ( $result ) {
642
  self::set_private( 'Admin cfg Private Cached URI: ' . $result ) ;
643
  }
@@ -646,9 +646,9 @@ class LiteSpeed_Cache_Control
646
  if ( ! self::is_forced_cacheable() ) {
647
 
648
  // Check if URI is excluded from cache
649
- $excludes = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_EXCLUDES_URI ) ;
650
  if ( ! empty( $excludes ) ) {
651
- $result = LiteSpeed_Cache_Utility::str_hit_array( $_SERVER[ 'REQUEST_URI' ], explode( "\n", $excludes ) ) ;
652
  if ( $result ) {
653
  return $this->_no_cache_for( 'Admin configured URI Do not cache: ' . $result ) ;
654
  }
514
  public static function finalize()
515
  {
516
  // Check if URI is forced cache
517
+ $excludes = LiteSpeed_Cache_Config::get_instance()->get_item( LiteSpeed_Cache_Config::ITEM_FORCE_CACHE_URI ) ;
518
  if ( ! empty( $excludes ) ) {
519
+ $result = LiteSpeed_Cache_Utility::str_hit_array( $_SERVER[ 'REQUEST_URI' ], $excludes ) ;
520
  if ( $result ) {
521
  self::force_cacheable() ;
522
  LiteSpeed_Cache_Log::debug( '[Ctrl] Forced cacheable due to setting: ' . $result ) ;
635
  // }
636
 
637
  // Check private cache URI setting
638
+ $excludes = LiteSpeed_Cache_Config::get_instance()->get_item( LiteSpeed_Cache_Config::ITEM_CACHE_URI_PRIV ) ;
639
  if ( ! empty( $excludes ) ) {
640
+ $result = LiteSpeed_Cache_Utility::str_hit_array( $_SERVER[ 'REQUEST_URI' ], $excludes ) ;
641
  if ( $result ) {
642
  self::set_private( 'Admin cfg Private Cached URI: ' . $result ) ;
643
  }
646
  if ( ! self::is_forced_cacheable() ) {
647
 
648
  // Check if URI is excluded from cache
649
+ $excludes = LiteSpeed_Cache_Config::get_instance()->get_item( LiteSpeed_Cache_Config::ITEM_EXCLUDES_URI ) ;
650
  if ( ! empty( $excludes ) ) {
651
+ $result = LiteSpeed_Cache_Utility::str_hit_array( $_SERVER[ 'REQUEST_URI' ], $excludes ) ;
652
  if ( $result ) {
653
  return $this->_no_cache_for( 'Admin configured URI Do not cache: ' . $result ) ;
654
  }
includes/litespeed-cache-gui.class.php CHANGED
@@ -171,6 +171,8 @@ class LiteSpeed_Cache_GUI
171
  {
172
  include_once LSCWP_DIR . "admin/tpl/inc/banner_promo.php" ;
173
  include_once LSCWP_DIR . "admin/tpl/inc/banner_promo.slack.php" ;
 
 
174
  }
175
 
176
  /**
@@ -430,6 +432,15 @@ class LiteSpeed_Cache_GUI
430
  ) );
431
  }
432
 
 
 
 
 
 
 
 
 
 
433
  }
434
 
435
  /**
171
  {
172
  include_once LSCWP_DIR . "admin/tpl/inc/banner_promo.php" ;
173
  include_once LSCWP_DIR . "admin/tpl/inc/banner_promo.slack.php" ;
174
+
175
+ include_once LSCWP_DIR . "admin/tpl/inc/disabled_all.php" ;
176
  }
177
 
178
  /**
432
  ) );
433
  }
434
 
435
+ if ( LiteSpeed_Cache_CSS::has_ccss_cache() ) {
436
+ $wp_admin_bar->add_menu( array(
437
+ 'parent' => 'litespeed-menu',
438
+ 'id' => 'litespeed-purge-ccss',
439
+ 'title' => __( 'Purge All', 'litespeed-cache' ) . ' - ' . __( 'Critical CSS', 'litespeed-cache' ),
440
+ 'href' => LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_PURGE, LiteSpeed_Cache_Purge::TYPE_PURGE_ALL_CCSS ),
441
+ 'meta' => array( 'tabindex' => '0' ),
442
+ ) );
443
+ }
444
  }
445
 
446
  /**
includes/litespeed-cache-log.class.php CHANGED
@@ -235,17 +235,23 @@ class LiteSpeed_Cache_Log
235
  if ( defined( 'LSCWP_LOG_MORE' ) && $backtrace_limit !== false ) {
236
  $trace = version_compare( PHP_VERSION, '5.4.0', '<' ) ? debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS ) : debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, $backtrace_limit + 2 ) ;
237
  for ( $i=1 ; $i <= $backtrace_limit + 1 ; $i++ ) {// the 0st item is push()
238
- if ( empty( $trace[$i]['class'] ) ) {
239
- break ;
 
 
 
240
  }
241
- if ( $trace[$i]['class'] == 'LiteSpeed_Cache_Log' ) {
242
- continue ;
 
 
 
 
243
  }
244
- $log = str_replace('LiteSpeed_Cache', 'LSC', $trace[$i]['class']) . $trace[$i]['type'] . $trace[$i]['function'] . '()' ;
245
  if ( ! empty( $trace[$i-1]['line'] ) ) {
246
  $log .= '@' . $trace[$i-1]['line'] ;
247
  }
248
- $msg .= " \ $log" ;
249
  }
250
 
251
  }
235
  if ( defined( 'LSCWP_LOG_MORE' ) && $backtrace_limit !== false ) {
236
  $trace = version_compare( PHP_VERSION, '5.4.0', '<' ) ? debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS ) : debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, $backtrace_limit + 2 ) ;
237
  for ( $i=1 ; $i <= $backtrace_limit + 1 ; $i++ ) {// the 0st item is push()
238
+ if ( empty( $trace[ $i ][ 'class' ] ) ) {
239
+ if ( empty( $trace[ $i ][ 'file' ] ) ) {
240
+ break ;
241
+ }
242
+ $log = "\n" . $trace[ $i ][ 'file' ] ;
243
  }
244
+ else {
245
+ if ( $trace[$i]['class'] == 'LiteSpeed_Cache_Log' ) {
246
+ continue ;
247
+ }
248
+
249
+ $log = str_replace('LiteSpeed_Cache', 'LSC', $trace[$i]['class']) . $trace[$i]['type'] . $trace[$i]['function'] . '()' ;
250
  }
 
251
  if ( ! empty( $trace[$i-1]['line'] ) ) {
252
  $log .= '@' . $trace[$i-1]['line'] ;
253
  }
254
+ $msg .= " => $log" ;
255
  }
256
 
257
  }
includes/litespeed-cache-optimize.class.php CHANGED
@@ -16,6 +16,7 @@ class LiteSpeed_Cache_Optimize
16
 
17
  const DIR_MIN = '/min' ;
18
  const CSS_ASYNC_LIB = '/min/css_async.js' ;
 
19
 
20
  private $content ;
21
  private $http2_headers = array() ;
@@ -74,7 +75,7 @@ class LiteSpeed_Cache_Optimize
74
 
75
  $this->_static_request_check() ;
76
 
77
- if ( ! $this->_can_optm() ) {
78
  return ;
79
  }
80
 
@@ -90,7 +91,7 @@ class LiteSpeed_Cache_Optimize
90
 
91
  // Check if there is any critical css rules setting
92
  if ( $this->cfg_css_async ) {
93
- add_action( 'wp_head', array( $this, 'prepend_critical_css' ), 1 ) ;
94
  }
95
 
96
  /**
@@ -154,24 +155,6 @@ class LiteSpeed_Cache_Optimize
154
  remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' ) ;
155
  }
156
 
157
- /**
158
- * Output critical css
159
- *
160
- * @since 1.3
161
- * @access public
162
- * @return string The static file content
163
- */
164
- public function prepend_critical_css()
165
- {
166
-
167
- $rules = get_option( LiteSpeed_Cache_Config::ITEM_OPTM_CSS ) ;
168
- if ( ! $rules ) {
169
- return ;
170
- }
171
-
172
- echo '<style id="litespeed-optm-css-rules">' . $rules . '</style>' ;
173
- }
174
-
175
  /**
176
  * Check if the request is for static file
177
  *
@@ -185,9 +168,7 @@ class LiteSpeed_Cache_Optimize
185
  if ( ( $this->cfg_css_async || $this->cfg_ggfonts_async ) && strpos( $_SERVER[ 'REQUEST_URI' ], self::CSS_ASYNC_LIB ) !== false ) {
186
  LiteSpeed_Cache_Log::debug( '[Optm] start serving static file' ) ;
187
 
188
- $file = LSCWP_DIR . 'js/css_async.min.js' ;
189
-
190
- $content = Litespeed_File::read( $file ) ;
191
 
192
  $static_file = LSCWP_CONTENT_DIR . '/cache/js/css_async.js' ;
193
 
@@ -318,33 +299,6 @@ class LiteSpeed_Cache_Optimize
318
  return $src ;
319
  }
320
 
321
- /**
322
- * Check if can run optimize
323
- *
324
- * @since 1.3
325
- * @access private
326
- */
327
- private function _can_optm()
328
- {
329
- if ( is_admin() ) {
330
- return false ;
331
- }
332
-
333
- if ( is_feed() ) {
334
- return false ;
335
- }
336
-
337
- if ( is_preview() ) {
338
- return false ;
339
- }
340
-
341
- if ( LiteSpeed_Cache_Router::is_ajax() ) {
342
- return false ;
343
- }
344
-
345
- return true ;
346
- }
347
-
348
  /**
349
  * Run optimize process
350
  * NOTE: As this is after cache finalized, can NOT set any cache control anymore
@@ -365,9 +319,9 @@ class LiteSpeed_Cache_Optimize
365
  }
366
 
367
  // Check if hit URI excludes
368
- $excludes = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTM_EXCLUDES ) ;
369
  if ( ! empty( $excludes ) ) {
370
- $result = LiteSpeed_Cache_Utility::str_hit_array( $_SERVER[ 'REQUEST_URI' ], explode( "\n", $excludes ) ) ;
371
  if ( $result ) {
372
  LiteSpeed_Cache_Log::debug( '[Optm] bypass: hit URI Excludes setting: ' . $result ) ;
373
  return $content ;
@@ -398,7 +352,7 @@ class LiteSpeed_Cache_Optimize
398
  */
399
  private function _optimize()
400
  {
401
- if ( ! $this->_can_optm() ) {
402
  LiteSpeed_Cache_Log::debug( '[Optm] bypass: admin/feed/preview' ) ;
403
  return ;
404
  }
@@ -636,9 +590,15 @@ class LiteSpeed_Cache_Optimize
636
 
637
  // Append async compatibility lib to head
638
  if ( $this->cfg_css_async || $this->cfg_ggfonts_async ) {
639
- $css_async_lib_url = LiteSpeed_Cache_Utility::get_permalink_url( self::CSS_ASYNC_LIB ) ;
640
- $this->html_head .= "<script src='" . $css_async_lib_url . "' " . ( $this->cfg_js_defer ? 'defer' : '' ) . "></script>" ;// Don't exclude it from defer for now
641
- $this->append_http2( $css_async_lib_url, 'js' ) ; // async lib will be http/2 pushed always
 
 
 
 
 
 
642
  }
643
 
644
  if ( $this->cfg_ggfonts_async ) {
@@ -1226,6 +1186,3 @@ class LiteSpeed_Cache_Optimize
1226
  }
1227
 
1228
  }
1229
-
1230
-
1231
-
16
 
17
  const DIR_MIN = '/min' ;
18
  const CSS_ASYNC_LIB = '/min/css_async.js' ;
19
+ const CSS_ASYNC_LIB_FILE = 'js/css_async.min.js' ;
20
 
21
  private $content ;
22
  private $http2_headers = array() ;
75
 
76
  $this->_static_request_check() ;
77
 
78
+ if ( ! LiteSpeed_Cache_Router::can_optm() ) {
79
  return ;
80
  }
81
 
91
 
92
  // Check if there is any critical css rules setting
93
  if ( $this->cfg_css_async ) {
94
+ add_filter( 'litespeed_optm_html_head', 'LiteSpeed_Cache_CSS::prepend_ccss', 1 ) ;
95
  }
96
 
97
  /**
155
  remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' ) ;
156
  }
157
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
158
  /**
159
  * Check if the request is for static file
160
  *
168
  if ( ( $this->cfg_css_async || $this->cfg_ggfonts_async ) && strpos( $_SERVER[ 'REQUEST_URI' ], self::CSS_ASYNC_LIB ) !== false ) {
169
  LiteSpeed_Cache_Log::debug( '[Optm] start serving static file' ) ;
170
 
171
+ $content = Litespeed_File::read( LSCWP_DIR . self::CSS_ASYNC_LIB_FILE ) ;
 
 
172
 
173
  $static_file = LSCWP_CONTENT_DIR . '/cache/js/css_async.js' ;
174
 
299
  return $src ;
300
  }
301
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
302
  /**
303
  * Run optimize process
304
  * NOTE: As this is after cache finalized, can NOT set any cache control anymore
319
  }
320
 
321
  // Check if hit URI excludes
322
+ $excludes = LiteSpeed_Cache_Config::get_instance()->get_item( LiteSpeed_Cache_Config::ITEM_OPTM_EXCLUDES ) ;
323
  if ( ! empty( $excludes ) ) {
324
+ $result = LiteSpeed_Cache_Utility::str_hit_array( $_SERVER[ 'REQUEST_URI' ], $excludes ) ;
325
  if ( $result ) {
326
  LiteSpeed_Cache_Log::debug( '[Optm] bypass: hit URI Excludes setting: ' . $result ) ;
327
  return $content ;
352
  */
353
  private function _optimize()
354
  {
355
+ if ( ! LiteSpeed_Cache_Router::can_optm() ) {
356
  LiteSpeed_Cache_Log::debug( '[Optm] bypass: admin/feed/preview' ) ;
357
  return ;
358
  }
590
 
591
  // Append async compatibility lib to head
592
  if ( $this->cfg_css_async || $this->cfg_ggfonts_async ) {
593
+ // Inline css async lib
594
+ if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPT_OPTM_CSS_ASYNC_INLINE ) ) {
595
+ $this->html_head .= '<script id="litespeed-css-async-lib" type="text/javascript">' . Litespeed_File::read( LSCWP_DIR . self::CSS_ASYNC_LIB_FILE ) . '</script>' ;
596
+ }
597
+ else {
598
+ $css_async_lib_url = LiteSpeed_Cache_Utility::get_permalink_url( self::CSS_ASYNC_LIB ) ;
599
+ $this->html_head .= "<script id='litespeed-css-async-lib' src='" . $css_async_lib_url . "' " . ( $this->cfg_js_defer ? 'defer' : '' ) . "></script>" ;// Don't exclude it from defer for now
600
+ $this->append_http2( $css_async_lib_url, 'js' ) ; // async lib will be http/2 pushed always
601
+ }
602
  }
603
 
604
  if ( $this->cfg_ggfonts_async ) {
1186
  }
1187
 
1188
  }
 
 
 
includes/litespeed-cache-purge.class.php CHANGED
@@ -23,6 +23,7 @@ class LiteSpeed_Cache_Purge
23
  const TYPE_PURGE_ALL = 'purge_all' ;
24
  const TYPE_PURGE_ALL_LSCACHE = 'purge_all_lscache' ;
25
  const TYPE_PURGE_ALL_CSSJS = 'purge_all_cssjs' ;
 
26
  const TYPE_PURGE_ALL_OBJECT = 'purge_all_object' ;
27
  const TYPE_PURGE_ALL_OPCACHE = 'purge_all_opcache' ;
28
 
@@ -81,6 +82,10 @@ class LiteSpeed_Cache_Purge
81
  $instance->_purge_all_cssjs() ;
82
  break ;
83
 
 
 
 
 
84
  case self::TYPE_PURGE_ALL_OBJECT :
85
  $instance->_purge_all_object() ;
86
  break ;
@@ -133,6 +138,7 @@ class LiteSpeed_Cache_Purge
133
  {
134
  $this->_purge_all_lscache( true ) ;
135
  $this->_purge_all_cssjs( true ) ;
 
136
  $this->_purge_all_object( true ) ;
137
  $this->_purge_all_opcache( true ) ;
138
 
@@ -174,6 +180,22 @@ class LiteSpeed_Cache_Purge
174
  }
175
  }
176
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
177
  /**
178
  * Alerts LiteSpeed Web Server to purge pages.
179
  *
23
  const TYPE_PURGE_ALL = 'purge_all' ;
24
  const TYPE_PURGE_ALL_LSCACHE = 'purge_all_lscache' ;
25
  const TYPE_PURGE_ALL_CSSJS = 'purge_all_cssjs' ;
26
+ const TYPE_PURGE_ALL_CCSS = 'purge_all_ccss' ;
27
  const TYPE_PURGE_ALL_OBJECT = 'purge_all_object' ;
28
  const TYPE_PURGE_ALL_OPCACHE = 'purge_all_opcache' ;
29
 
82
  $instance->_purge_all_cssjs() ;
83
  break ;
84
 
85
+ case self::TYPE_PURGE_ALL_CCSS :
86
+ $instance->_purge_all_ccss() ;
87
+ break ;
88
+
89
  case self::TYPE_PURGE_ALL_OBJECT :
90
  $instance->_purge_all_object() ;
91
  break ;
138
  {
139
  $this->_purge_all_lscache( true ) ;
140
  $this->_purge_all_cssjs( true ) ;
141
+ $this->_purge_all_ccss( true ) ;
142
  $this->_purge_all_object( true ) ;
143
  $this->_purge_all_opcache( true ) ;
144
 
180
  }
181
  }
182
 
183
+ /**
184
+ * Delete all critical css
185
+ *
186
+ * @since 2.3
187
+ * @access private
188
+ */
189
+ private function _purge_all_ccss( $silence = false )
190
+ {
191
+ LiteSpeed_Cache_CSS::get_instance()->rm_cache_folder() ;
192
+
193
+ if ( ! $silence ) {
194
+ $msg = __( 'Cleaned all critical CSS files.', 'litespeed-cache' ) ;
195
+ ! defined( 'LITESPEED_PURGE_SILENT' ) && LiteSpeed_Cache_Admin_Display::succeed( $msg ) ;
196
+ }
197
+ }
198
+
199
  /**
200
  * Alerts LiteSpeed Web Server to purge pages.
201
  *
includes/litespeed-cache-router.class.php CHANGED
@@ -14,6 +14,7 @@
14
  class LiteSpeed_Cache_Router
15
  {
16
  private static $_instance ;
 
17
  private static $_esi_enabled ;
18
  private static $_is_ajax ;
19
  private static $_is_logged_in ;
@@ -23,6 +24,103 @@ class LiteSpeed_Cache_Router
23
  private static $_is_admin_ip ;
24
  private static $_frontend_path ;
25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  /**
27
  * Crawler simulate role
28
  *
@@ -385,6 +483,8 @@ class LiteSpeed_Cache_Router
385
  case LiteSpeed_Cache::ACTION_CDN_CLOUDFLARE:
386
  case LiteSpeed_Cache::ACTION_CDN_QUICCLOUD:
387
  case LiteSpeed_Cache::ACTION_IMPORT:
 
 
388
  if ( $_can_option && ! $_is_network_admin ) {
389
  self::$_action = $action ;
390
  }
@@ -396,12 +496,6 @@ class LiteSpeed_Cache_Router
396
  }
397
  return ;
398
 
399
- case LiteSpeed_Cache::ACTION_REPORT:
400
- if ( $_can_option && ! $_is_network_admin ) {
401
- self::$_action = $action ;
402
- }
403
- return ;
404
-
405
  case LiteSpeed_Cache::ACTION_SAPI_PASSIVE_CALLBACK :
406
  case LiteSpeed_Cache::ACTION_SAPI_AGGRESSIVE_CALLBACK :
407
  self::$_action = $action ;
14
  class LiteSpeed_Cache_Router
15
  {
16
  private static $_instance ;
17
+
18
  private static $_esi_enabled ;
19
  private static $_is_ajax ;
20
  private static $_is_logged_in ;
24
  private static $_is_admin_ip ;
25
  private static $_frontend_path ;
26
 
27
+ /**
28
+ * Check if can run optimize
29
+ *
30
+ * @since 1.3
31
+ * @since 2.3.1 Relocated from cdn.cls
32
+ * @access public
33
+ */
34
+ public static function can_optm()
35
+ {
36
+ $can = true ;
37
+
38
+ if ( is_admin() ) {
39
+ $can = false ;
40
+ }
41
+
42
+ if ( is_feed() ) {
43
+ $can = false ;
44
+ }
45
+
46
+ if ( is_preview() ) {
47
+ $can = false ;
48
+ }
49
+
50
+ if ( self::is_ajax() ) {
51
+ $can = false ;
52
+ }
53
+
54
+ if ( self::_is_login_page() ) {
55
+ LiteSpeed_Cache_Log::debug( '[Router] Optm bypassed: login/reg page' ) ;
56
+ $can = false ;
57
+ }
58
+
59
+ $can_final = apply_filters( 'litespeed_can_optm', $can ) ;
60
+
61
+ if ( $can_final != $can ) {
62
+ LiteSpeed_Cache_Log::debug( '[Router] Optm bypassed: filter' ) ;
63
+ }
64
+
65
+ return $can_final ;
66
+ }
67
+
68
+ /**
69
+ * Check if it can use CDN replacement
70
+ *
71
+ * @since 1.2.3
72
+ * @since 2.3.1 Relocated from cdn.cls
73
+ * @access public
74
+ */
75
+ public static function can_cdn()
76
+ {
77
+ $can = true ;
78
+
79
+ if ( is_admin() && ! self::is_ajax() ) {
80
+ $can = false ;
81
+ }
82
+
83
+ if ( is_feed() ) {
84
+ $can = false ;
85
+ }
86
+
87
+ if ( is_preview() ) {
88
+ $can = false ;
89
+ }
90
+
91
+ /**
92
+ * Bypass login/reg page
93
+ * @since 1.6
94
+ */
95
+ if ( self::_is_login_page() ) {
96
+ LiteSpeed_Cache_Log::debug( '[Router] CDN bypassed: login/reg page' ) ;
97
+ $can = false ;
98
+ }
99
+
100
+ $can_final = apply_filters( 'litespeed_can_cdn', $can ) ;
101
+
102
+ if ( $can_final != $can ) {
103
+ LiteSpeed_Cache_Log::debug( '[Router] CDN bypassed: filter' ) ;
104
+ }
105
+
106
+ return $can_final ;
107
+ }
108
+
109
+ /**
110
+ * Check if is login page or not
111
+ *
112
+ * @since 2.3.1
113
+ * @access protected
114
+ */
115
+ protected static function _is_login_page()
116
+ {
117
+ if ( in_array( $GLOBALS[ 'pagenow' ], array( 'wp-login.php', 'wp-register.php' ), true ) ) {
118
+ return true ;
119
+ }
120
+
121
+ return false ;
122
+ }
123
+
124
  /**
125
  * Crawler simulate role
126
  *
483
  case LiteSpeed_Cache::ACTION_CDN_CLOUDFLARE:
484
  case LiteSpeed_Cache::ACTION_CDN_QUICCLOUD:
485
  case LiteSpeed_Cache::ACTION_IMPORT:
486
+ case LiteSpeed_Cache::ACTION_REPORT:
487
+ case LiteSpeed_Cache::ACTION_CSS:
488
  if ( $_can_option && ! $_is_network_admin ) {
489
  self::$_action = $action ;
490
  }
496
  }
497
  return ;
498
 
 
 
 
 
 
 
499
  case LiteSpeed_Cache::ACTION_SAPI_PASSIVE_CALLBACK :
500
  case LiteSpeed_Cache::ACTION_SAPI_AGGRESSIVE_CALLBACK :
501
  self::$_action = $action ;
includes/litespeed-cache-task.class.php CHANGED
@@ -15,8 +15,9 @@ class LiteSpeed_Cache_Task
15
 
16
  const CRON_ACTION_HOOK_CRAWLER = 'litespeed_crawl_trigger' ;
17
  const CRON_ACTION_HOOK_IMGOPTM = 'litespeed_imgoptm_trigger' ;
 
18
  const CRON_FITLER_CRAWLER = 'litespeed_crawl_filter' ;
19
- const CRON_FITLER_IMGOPTM = 'litespeed_imgoptm_filter' ;
20
 
21
  /**
22
  * Init
@@ -46,6 +47,13 @@ class LiteSpeed_Cache_Task
46
  else {
47
  // wp_clear_scheduled_hook( self::CRON_ACTION_HOOK_IMGOPTM ) ;
48
  }
 
 
 
 
 
 
 
49
  }
50
 
51
  /**
@@ -104,12 +112,29 @@ class LiteSpeed_Cache_Task
104
  */
105
  public static function schedule_filter_imgoptm()
106
  {
107
- add_filter( 'cron_schedules', 'LiteSpeed_Cache_Task::lscache_cron_filter_imgoptm' ) ;
108
 
109
  // Schedule event here to see if it can lost again or not
110
  if( ! wp_next_scheduled( self::CRON_ACTION_HOOK_IMGOPTM ) ) {
111
  LiteSpeed_Cache_Log::debug( 'Cron log: ......img optimization cron hook register......' ) ;
112
- wp_schedule_event( time(), self::CRON_FITLER_IMGOPTM, self::CRON_ACTION_HOOK_IMGOPTM ) ;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113
  }
114
  }
115
 
@@ -137,12 +162,12 @@ class LiteSpeed_Cache_Task
137
  * @access public
138
  * @param array $schedules WP Hook
139
  */
140
- public static function lscache_cron_filter_imgoptm( $schedules )
141
  {
142
- if ( ! array_key_exists( self::CRON_FITLER_IMGOPTM, $schedules ) ) {
143
- $schedules[ self::CRON_FITLER_IMGOPTM ] = array(
144
  'interval' => 60,
145
- 'display' => __( 'LiteSpeed Cache Custom Cron ImgOptm', 'litespeed-cache' ),
146
  ) ;
147
  }
148
  return $schedules ;
15
 
16
  const CRON_ACTION_HOOK_CRAWLER = 'litespeed_crawl_trigger' ;
17
  const CRON_ACTION_HOOK_IMGOPTM = 'litespeed_imgoptm_trigger' ;
18
+ const CRON_ACTION_HOOK_CCSS = 'litespeed_ccss_trigger' ;
19
  const CRON_FITLER_CRAWLER = 'litespeed_crawl_filter' ;
20
+ const CRON_FITLER = 'litespeed_filter' ;
21
 
22
  /**
23
  * Init
47
  else {
48
  // wp_clear_scheduled_hook( self::CRON_ACTION_HOOK_IMGOPTM ) ;
49
  }
50
+
51
+ // Register ccss generation
52
+ if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPT_OPTM_CCSS_ASYNC ) && LiteSpeed_Cache_CSS::has_queue() ) {
53
+ self::schedule_filter_ccss() ;
54
+
55
+ add_action( self::CRON_ACTION_HOOK_CCSS, 'LiteSpeed_Cache_CSS::cron_ccss' ) ;
56
+ }
57
  }
58
 
59
  /**
112
  */
113
  public static function schedule_filter_imgoptm()
114
  {
115
+ add_filter( 'cron_schedules', 'LiteSpeed_Cache_Task::lscache_cron_filter' ) ;
116
 
117
  // Schedule event here to see if it can lost again or not
118
  if( ! wp_next_scheduled( self::CRON_ACTION_HOOK_IMGOPTM ) ) {
119
  LiteSpeed_Cache_Log::debug( 'Cron log: ......img optimization cron hook register......' ) ;
120
+ wp_schedule_event( time(), self::CRON_FITLER, self::CRON_ACTION_HOOK_IMGOPTM ) ;
121
+ }
122
+ }
123
+
124
+ /**
125
+ * Schedule cron ccss generation
126
+ *
127
+ * @since 2.3
128
+ * @access public
129
+ */
130
+ public static function schedule_filter_ccss()
131
+ {
132
+ add_filter( 'cron_schedules', 'LiteSpeed_Cache_Task::lscache_cron_filter' ) ;
133
+
134
+ // Schedule event here to see if it can lost again or not
135
+ if( ! wp_next_scheduled( self::CRON_ACTION_HOOK_CCSS ) ) {
136
+ LiteSpeed_Cache_Log::debug( 'Cron log: ......ccss cron hook register......' ) ;
137
+ wp_schedule_event( time(), self::CRON_FITLER, self::CRON_ACTION_HOOK_CCSS ) ;
138
  }
139
  }
140
 
162
  * @access public
163
  * @param array $schedules WP Hook
164
  */
165
+ public static function lscache_cron_filter( $schedules )
166
  {
167
+ if ( ! array_key_exists( self::CRON_FITLER, $schedules ) ) {
168
+ $schedules[ self::CRON_FITLER ] = array(
169
  'interval' => 60,
170
+ 'display' => __( 'LiteSpeed Cache Custom Cron Common', 'litespeed-cache' ),
171
  ) ;
172
  }
173
  return $schedules ;
includes/litespeed-cache-utility.class.php CHANGED
@@ -306,13 +306,16 @@ class LiteSpeed_Cache_Utility
306
  * @param bool $type String handler type
307
  * @return string
308
  */
309
- public static function sanitize_lines( $content, $type = null )
310
  {
311
- if ( ! $content ) {
312
- return $content ;
 
 
 
 
313
  }
314
 
315
- $arr = explode( "\n", $content ) ;
316
  $arr = array_map( 'trim', $arr ) ;
317
  if ( $type === 'uri' ) {
318
  $arr = array_map( 'LiteSpeed_Cache_Utility::url2uri', $arr ) ;
306
  * @param bool $type String handler type
307
  * @return string
308
  */
309
+ public static function sanitize_lines( $arr, $type = null )
310
  {
311
+ if ( ! $arr ) {
312
+ return $arr ;
313
+ }
314
+
315
+ if ( ! is_array( $arr ) ) {
316
+ $arr = explode( "\n", $arr ) ;
317
  }
318
 
 
319
  $arr = array_map( 'trim', $arr ) ;
320
  if ( $type === 'uri' ) {
321
  $arr = array_map( 'LiteSpeed_Cache_Utility::url2uri', $arr ) ;
includes/litespeed-cache.class.php CHANGED
@@ -19,7 +19,7 @@ class LiteSpeed_Cache
19
  private static $_instance ;
20
 
21
  const PLUGIN_NAME = 'litespeed-cache' ;
22
- const PLUGIN_VERSION = '2.2.7' ;
23
 
24
  const PAGE_EDIT_HTACCESS = 'lscache-edit-htaccess' ;
25
 
@@ -57,6 +57,7 @@ class LiteSpeed_Cache
57
  const ACTION_IAPI = 'iapi' ;
58
  const ACTION_CDN = 'cdn' ;
59
  const ACTION_REPORT = 'report' ;
 
60
  const ACTION_SAPI_PASSIVE_CALLBACK = 'sapi_passive_callback' ;
61
  const ACTION_SAPI_AGGRESSIVE_CALLBACK = 'sapi_aggressive_callback' ;
62
 
@@ -327,6 +328,10 @@ class LiteSpeed_Cache
327
  $msg = LiteSpeed_Cache_Import::handler() ;
328
  break ;
329
 
 
 
 
 
330
  case LiteSpeed_Cache::ACTION_CDN_CLOUDFLARE:
331
  $msg = LiteSpeed_Cache_CDN_Cloudflare::handler() ;
332
  break ;
19
  private static $_instance ;
20
 
21
  const PLUGIN_NAME = 'litespeed-cache' ;
22
+ const PLUGIN_VERSION = '2.3.1' ;
23
 
24
  const PAGE_EDIT_HTACCESS = 'lscache-edit-htaccess' ;
25
 
57
  const ACTION_IAPI = 'iapi' ;
58
  const ACTION_CDN = 'cdn' ;
59
  const ACTION_REPORT = 'report' ;
60
+ const ACTION_CSS = 'css' ;
61
  const ACTION_SAPI_PASSIVE_CALLBACK = 'sapi_passive_callback' ;
62
  const ACTION_SAPI_AGGRESSIVE_CALLBACK = 'sapi_aggressive_callback' ;
63
 
328
  $msg = LiteSpeed_Cache_Import::handler() ;
329
  break ;
330
 
331
+ case LiteSpeed_Cache::ACTION_CSS:
332
+ $msg = LiteSpeed_Cache_CSS::handler() ;
333
+ break ;
334
+
335
  case LiteSpeed_Cache::ACTION_CDN_CLOUDFLARE:
336
  $msg = LiteSpeed_Cache_CDN_Cloudflare::handler() ;
337
  break ;
includes/litespeed.autoload.php CHANGED
@@ -32,6 +32,7 @@ if ( !function_exists('_litespeed_autoload') ) {
32
  'LiteSpeed_Cache_Control' => 'inc/control.class.php',
33
  'LiteSpeed_Cache_Crawler' => 'inc/crawler.class.php',
34
  'LiteSpeed_Cache_Crawler_Sitemap' => 'inc/crawler-sitemap.class.php',
 
35
  'LiteSpeed_Cache_Data' => 'inc/data.class.php',
36
  'LiteSpeed_Cache_Doc' => 'inc/doc.cls.php',
37
  'LiteSpeed_Cache_ESI' => 'inc/esi.class.php',
32
  'LiteSpeed_Cache_Control' => 'inc/control.class.php',
33
  'LiteSpeed_Cache_Crawler' => 'inc/crawler.class.php',
34
  'LiteSpeed_Cache_Crawler_Sitemap' => 'inc/crawler-sitemap.class.php',
35
+ 'LiteSpeed_Cache_CSS' => 'inc/css.cls.php',
36
  'LiteSpeed_Cache_Data' => 'inc/data.class.php',
37
  'LiteSpeed_Cache_Doc' => 'inc/doc.cls.php',
38
  'LiteSpeed_Cache_ESI' => 'inc/esi.class.php',
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.2.7\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/litespeed-cache\n"
7
- "POT-Creation-Date: 2018-06-04 14:18:31+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -30,14 +30,14 @@ msgstr ""
30
 
31
  #: admin/litespeed-cache-admin-display.class.php:151
32
  #: admin/tpl/setting/settings_cdn.php:217
33
- #: admin/tpl/setting/settings_cdn.php:260 inc/gui.class.php:356
34
- #: includes/litespeed-cache-gui.class.php:356
35
  msgid "Manage"
36
  msgstr ""
37
 
38
  #: admin/litespeed-cache-admin-display.class.php:153
39
- #: admin/litespeed-cache-admin-display.class.php:242 inc/gui.class.php:364
40
- #: includes/litespeed-cache-gui.class.php:364
41
  msgid "Settings"
42
  msgstr ""
43
 
@@ -45,8 +45,8 @@ msgstr ""
45
  msgid "Edit .htaccess"
46
  msgstr ""
47
 
48
- #: admin/litespeed-cache-admin-display.class.php:160 inc/gui.class.php:373
49
- #: includes/litespeed-cache-gui.class.php:373
50
  msgid "Image Optimization"
51
  msgstr ""
52
 
@@ -72,34 +72,39 @@ msgid ""
72
  "It is recommended that LiteSpeed Cache be purged after updating a plugin."
73
  msgstr ""
74
 
75
- #: admin/litespeed-cache-admin-display.class.php:794
76
- #: admin/litespeed-cache-admin-display.class.php:879
77
  #: admin/tpl/setting/settings_debug.php:35
78
  #: admin/tpl/setting/settings_inc.cache_mobile.php:67
79
  #: admin/tpl/setting/settings_media.php:73
80
- #: admin/tpl/setting/settings_optimize.php:160
 
 
 
81
  #: admin/tpl/setting/settings_tuning.php:21
82
  #: admin/tpl/setting/settings_tuning.php:57
83
  msgid "ON"
84
  msgstr ""
85
 
86
- #: admin/litespeed-cache-admin-display.class.php:795
87
- #: admin/litespeed-cache-admin-display.class.php:883
88
  #: admin/tpl/setting/settings_cdn.php:168
89
  #: admin/tpl/setting/settings_debug.php:29
90
  #: admin/tpl/setting/settings_inc.cache_object.php:149
 
 
91
  #: admin/tpl/setting/settings_tuning.php:18
92
  #: admin/tpl/setting/settings_tuning.php:54
93
  msgid "OFF"
94
  msgstr ""
95
 
96
- #: admin/litespeed-cache-admin-display.class.php:918
97
  msgid "Recommended value: %s"
98
  msgstr ""
99
 
100
- #: admin/litespeed-cache-admin-display.class.php:934
101
  #: admin/tpl/setting/settings_media.php:36
102
- #: admin/tpl/setting/settings_optimize.php:137
103
  #: admin/tpl/setting/settings_tuning.php:24
104
  #: admin/tpl/setting/settings_tuning.php:40
105
  #: admin/tpl/setting/settings_tuning.php:60
@@ -108,11 +113,11 @@ msgstr ""
108
  msgid "API"
109
  msgstr ""
110
 
111
- #: admin/litespeed-cache-admin-display.class.php:935
112
  msgid "Server variable(s) %s available to override this setting."
113
  msgstr ""
114
 
115
- #: admin/litespeed-cache-admin-display.class.php:937
116
  #: admin/tpl/image_optimization.php:151 admin/tpl/image_optimization.php:226
117
  #: admin/tpl/manage/manage_cdn.php:60
118
  #: admin/tpl/setting/settings_advanced.php:10
@@ -131,26 +136,27 @@ msgstr ""
131
  #: admin/tpl/setting/settings_inc.cache_object.php:150
132
  #: admin/tpl/setting/settings_media.php:8
133
  #: admin/tpl/setting/settings_media.php:107
134
- #: admin/tpl/setting/settings_optimize.php:8
135
- #: admin/tpl/setting/settings_optimize.php:176
 
136
  #: admin/tpl/setting/settings_purge.php:8
137
  #: admin/tpl/setting/settings_tuning.php:8
138
  msgid "Learn More"
139
  msgstr ""
140
 
141
- #: admin/litespeed-cache-admin-display.class.php:952
142
  msgid "%s groups"
143
  msgstr ""
144
 
145
- #: admin/litespeed-cache-admin-display.class.php:955
146
  msgid "%s images"
147
  msgstr ""
148
 
149
- #: admin/litespeed-cache-admin-display.class.php:965
150
  msgid "%s group"
151
  msgstr ""
152
 
153
- #: admin/litespeed-cache-admin-display.class.php:968
154
  msgid "%s image"
155
  msgstr ""
156
 
@@ -425,7 +431,7 @@ msgid "Site options saved."
425
  msgstr ""
426
 
427
  #: admin/litespeed-cache-admin-settings.class.php:342
428
- #: admin/litespeed-cache-admin-settings.class.php:1029
429
  msgid "Default Public Cache"
430
  msgstr ""
431
 
@@ -441,30 +447,30 @@ msgstr ""
441
  msgid "Feed"
442
  msgstr ""
443
 
444
- #: admin/litespeed-cache-admin-settings.class.php:870
445
  #: admin/tpl/setting/settings_debug.php:88
446
  msgid "Log File Size Limit"
447
  msgstr ""
448
 
449
- #: admin/litespeed-cache-admin-settings.class.php:952
450
  #: admin/tpl/setting/settings_crawler.php:13
451
  msgid "Delay"
452
  msgstr ""
453
 
454
- #: admin/litespeed-cache-admin-settings.class.php:953
455
  #: admin/tpl/setting/settings_crawler.php:37
456
  msgid "Run Duration"
457
  msgstr ""
458
 
459
- #: admin/litespeed-cache-admin-settings.class.php:954
460
  msgid "Cron Interval"
461
  msgstr ""
462
 
463
- #: admin/litespeed-cache-admin-settings.class.php:955
464
  msgid "Whole Interval"
465
  msgstr ""
466
 
467
- #: admin/litespeed-cache-admin-settings.class.php:956
468
  #: admin/tpl/setting/settings_crawler.php:73
469
  msgid "Threads"
470
  msgstr ""
@@ -547,7 +553,7 @@ msgstr ""
547
  #: admin/tpl/inc/check_cache_disabled.php:31 admin/tpl/manage/manage_cdn.php:15
548
  #: admin/tpl/setting/settings_debug.php:105
549
  #: admin/tpl/setting/settings_debug.php:138
550
- #: admin/tpl/setting/settings_optimize.php:13 admin/tpl/settings.php:163
551
  msgid "WARNING"
552
  msgstr ""
553
 
@@ -740,7 +746,7 @@ msgstr ""
740
  #: admin/tpl/setting/settings_general.php:140
741
  #: admin/tpl/setting/settings_inc.cache_browser.php:24
742
  #: admin/tpl/setting/settings_inc.cache_object.php:63
743
- #: admin/tpl/setting/settings_optimize.php:111
744
  msgid "seconds"
745
  msgstr ""
746
 
@@ -996,7 +1002,7 @@ msgstr ""
996
  #: admin/tpl/setting/settings_inc.exclude_cookies.php:22
997
  #: admin/tpl/setting/settings_inc.exclude_useragent.php:21
998
  #: admin/tpl/setting/settings_inc.media_webp.php:12
999
- #: admin/tpl/setting/settings_optimize.php:162
1000
  #: admin/tpl/setting/settings_tuning.php:20
1001
  #: admin/tpl/setting/settings_tuning.php:56
1002
  msgid "NOTE"
@@ -1103,10 +1109,10 @@ msgstr ""
1103
  msgid "Rate %s on %s"
1104
  msgstr ""
1105
 
1106
- #. #-#-#-#-# litespeed-cache.pot (LiteSpeed Cache 2.2.7) #-#-#-#-#
1107
  #. Plugin Name of the plugin/theme
1108
- #: admin/tpl/inc/admin_footer.php:6 inc/gui.class.php:348
1109
- #: includes/litespeed-cache-gui.class.php:348
1110
  msgid "LiteSpeed Cache"
1111
  msgstr ""
1112
 
@@ -1190,6 +1196,10 @@ msgstr ""
1190
  msgid "How to fix it?"
1191
  msgstr ""
1192
 
 
 
 
 
1193
  #: admin/tpl/inc/help_tabs.php:7
1194
  msgid "Overview"
1195
  msgstr ""
@@ -1297,8 +1307,8 @@ msgid ""
1297
  "dismissed. (<a %3$s>Learn More</a>)"
1298
  msgstr ""
1299
 
1300
- #: admin/tpl/manage/manage_cdn.php:11 inc/gui.class.php:407
1301
- #: includes/litespeed-cache-gui.class.php:407
1302
  msgid "Cloudflare"
1303
  msgstr ""
1304
 
@@ -1486,15 +1496,16 @@ msgstr ""
1486
 
1487
  #: admin/tpl/manage/manage_purge.php:39 admin/tpl/manage/manage_purge.php:45
1488
  #: admin/tpl/manage/manage_purge.php:54 admin/tpl/manage/manage_purge.php:63
1489
- #: admin/tpl/manage/manage_purge.php:71 inc/gui.class.php:382
1490
- #: inc/gui.class.php:390 inc/gui.class.php:398 inc/gui.class.php:407
1491
- #: inc/gui.class.php:417 inc/gui.class.php:427
1492
- #: includes/litespeed-cache-gui.class.php:382
1493
- #: includes/litespeed-cache-gui.class.php:390
1494
- #: includes/litespeed-cache-gui.class.php:398
1495
- #: includes/litespeed-cache-gui.class.php:407
1496
- #: includes/litespeed-cache-gui.class.php:417
1497
- #: includes/litespeed-cache-gui.class.php:427
 
1498
  msgid "Purge All"
1499
  msgstr ""
1500
 
@@ -1502,8 +1513,8 @@ msgstr ""
1502
  msgid "Purge the litespeed cache entries created by this plugin"
1503
  msgstr ""
1504
 
1505
- #: admin/tpl/manage/manage_purge.php:45 inc/gui.class.php:398
1506
- #: includes/litespeed-cache-gui.class.php:398
1507
  msgid "CSS/JS Cache"
1508
  msgstr ""
1509
 
@@ -1512,8 +1523,8 @@ msgid "This will purge all minified/combined CSS/JS entries only"
1512
  msgstr ""
1513
 
1514
  #: admin/tpl/manage/manage_purge.php:54
1515
- #: admin/tpl/setting/settings_inc.cache_object.php:28 inc/gui.class.php:417
1516
- #: includes/litespeed-cache-gui.class.php:417
1517
  msgid "Object Cache"
1518
  msgstr ""
1519
 
@@ -1521,8 +1532,8 @@ msgstr ""
1521
  msgid "Purge all the object caches"
1522
  msgstr ""
1523
 
1524
- #: admin/tpl/manage/manage_purge.php:63 inc/gui.class.php:427
1525
- #: includes/litespeed-cache-gui.class.php:427
1526
  msgid "Opcode Cache"
1527
  msgstr ""
1528
 
@@ -1530,50 +1541,59 @@ msgstr ""
1530
  msgid "Reset the entire opcode cache"
1531
  msgstr ""
1532
 
1533
- #: admin/tpl/manage/manage_purge.php:72
 
 
 
 
 
 
 
 
 
1534
  msgid "Purge the cache entries created by this plugin"
1535
  msgstr ""
1536
 
1537
- #: admin/tpl/manage/manage_purge.php:81
1538
  msgid "Empty Entire Cache"
1539
  msgstr ""
1540
 
1541
- #: admin/tpl/manage/manage_purge.php:82
1542
  msgid ""
1543
  "Clears all cache entries related to this site, <i>including other web "
1544
  "applications</i>."
1545
  msgstr ""
1546
 
1547
- #: admin/tpl/manage/manage_purge.php:83
1548
  msgid "This action should only be used if things are cached incorrectly."
1549
  msgstr ""
1550
 
1551
- #: admin/tpl/manage/manage_purge.php:87
1552
  msgid "This will clear EVERYTHING inside the cache."
1553
  msgstr ""
1554
 
1555
- #: admin/tpl/manage/manage_purge.php:88
1556
  msgid "This may cause heavy load on the server."
1557
  msgstr ""
1558
 
1559
- #: admin/tpl/manage/manage_purge.php:89
1560
  msgid "If only the WordPress site should be purged, use purge all."
1561
  msgstr ""
1562
 
1563
- #: admin/tpl/manage/manage_purge.php:97 admin/tpl/manage.php:5
1564
  #: admin/tpl/network_settings.php:7 admin/tpl/settings.php:7
1565
  msgid "Purge"
1566
  msgstr ""
1567
 
1568
- #: admin/tpl/manage/manage_purge.php:130
1569
  msgid "Purge By..."
1570
  msgstr ""
1571
 
1572
- #: admin/tpl/manage/manage_purge.php:132
1573
  msgid "Select below for \"Purge by\" options."
1574
  msgstr ""
1575
 
1576
- #: admin/tpl/manage/manage_purge.php:133
1577
  #: admin/tpl/setting/settings_cache.php:73
1578
  #: admin/tpl/setting/settings_cache.php:90
1579
  #: admin/tpl/setting/settings_cdn.php:116
@@ -1590,7 +1610,7 @@ msgstr ""
1590
  #: admin/tpl/setting/settings_inc.exclude_cookies.php:19
1591
  #: admin/tpl/setting/settings_media.php:34
1592
  #: admin/tpl/setting/settings_media.php:96
1593
- #: admin/tpl/setting/settings_optimize.php:177
1594
  #: admin/tpl/setting/settings_purge.php:85
1595
  #: admin/tpl/setting/settings_tuning.php:38
1596
  #: admin/tpl/setting/settings_tuning.php:74
@@ -1599,44 +1619,44 @@ msgstr ""
1599
  msgid "One per line."
1600
  msgstr ""
1601
 
1602
- #: admin/tpl/manage/manage_purge.php:160
1603
  msgid "Category"
1604
  msgstr ""
1605
 
1606
- #: admin/tpl/manage/manage_purge.php:166
1607
  msgid "Post ID"
1608
  msgstr ""
1609
 
1610
- #: admin/tpl/manage/manage_purge.php:172
1611
  msgid "Tag"
1612
  msgstr ""
1613
 
1614
- #: admin/tpl/manage/manage_purge.php:178
1615
  msgid "URL"
1616
  msgstr ""
1617
 
1618
- #: admin/tpl/manage/manage_purge.php:184
1619
  msgid ""
1620
  "Purge pages by category name - e.g. %2$s should be used for the URL %1$s."
1621
  msgstr ""
1622
 
1623
- #: admin/tpl/manage/manage_purge.php:189
1624
  msgid "Purge pages by post ID."
1625
  msgstr ""
1626
 
1627
- #: admin/tpl/manage/manage_purge.php:193
1628
  msgid "Purge pages by tag name - e.g. %2$s should be used for the URL %1$s."
1629
  msgstr ""
1630
 
1631
- #: admin/tpl/manage/manage_purge.php:198
1632
  msgid "Purge pages by relative or full URL."
1633
  msgstr ""
1634
 
1635
- #: admin/tpl/manage/manage_purge.php:199
1636
  msgid "e.g. Use %s or %s."
1637
  msgstr ""
1638
 
1639
- #: admin/tpl/manage/manage_purge.php:212
1640
  msgid "Purge List"
1641
  msgstr ""
1642
 
@@ -2302,10 +2322,6 @@ msgstr ""
2302
  msgid "Developer Testing"
2303
  msgstr ""
2304
 
2305
- #: admin/tpl/setting/settings_debug.php:13
2306
- msgid "Disable All Features"
2307
- msgstr ""
2308
-
2309
  #: admin/tpl/setting/settings_debug.php:17
2310
  msgid ""
2311
  "This will disable LSCache and all optimization features for debug purpose."
@@ -2604,7 +2620,7 @@ msgid "Please visit the <a %s>Information</a> page on how to test the cache."
2604
  msgstr ""
2605
 
2606
  #: admin/tpl/setting/settings_general.php:53
2607
- #: admin/tpl/setting/settings_optimize.php:19
2608
  msgid "NOTICE"
2609
  msgstr ""
2610
 
@@ -3115,7 +3131,7 @@ msgid "Filter %s is supported."
3115
  msgstr ""
3116
 
3117
  #: admin/tpl/setting/settings_media.php:38
3118
- #: admin/tpl/setting/settings_optimize.php:138
3119
  #: admin/tpl/setting/settings_tuning.php:42
3120
  #: admin/tpl/setting/settings_tuning.php:78
3121
  #: admin/tpl/setting/settings_tuning.php:150
@@ -3225,126 +3241,127 @@ msgstr ""
3225
  msgid "This can improve quality at the cost of larger images."
3226
  msgstr ""
3227
 
3228
- #: admin/tpl/setting/settings_optimize.php:7
3229
  msgid "Optimization Settings"
3230
  msgstr ""
3231
 
3232
- #: admin/tpl/setting/settings_optimize.php:14
3233
  msgid ""
3234
  "Failed to create Optimizer table. Please follow <a %s>Table Creation "
3235
  "guidance from LiteSpeed Wiki</a> to finish setup."
3236
  msgstr ""
3237
 
3238
- #: admin/tpl/setting/settings_optimize.php:20
3239
  msgid ""
3240
  "Please test thoroughly when enabling any option in this list. After changing "
3241
  "Minify/Combine settings, please do a Purge All action."
3242
  msgstr ""
3243
 
3244
- #: admin/tpl/setting/settings_optimize.php:26
3245
  msgid "CSS Minify"
3246
  msgstr ""
3247
 
3248
- #: admin/tpl/setting/settings_optimize.php:30
3249
  msgid "Minify CSS files."
3250
  msgstr ""
3251
 
3252
- #: admin/tpl/setting/settings_optimize.php:36
3253
  msgid "Inline CSS Minify"
3254
  msgstr ""
3255
 
3256
- #: admin/tpl/setting/settings_optimize.php:40
3257
  msgid "Minify inline CSS code."
3258
  msgstr ""
3259
 
3260
- #: admin/tpl/setting/settings_optimize.php:46
3261
  msgid "CSS Combine"
3262
  msgstr ""
3263
 
3264
- #: admin/tpl/setting/settings_optimize.php:50
3265
  msgid "Combine CSS files."
3266
  msgstr ""
3267
 
3268
- #: admin/tpl/setting/settings_optimize.php:51
3269
- #: admin/tpl/setting/settings_optimize.php:92
3270
  msgid "How to Fix Problems Caused by CSS/JS Optimization."
3271
  msgstr ""
3272
 
3273
- #: admin/tpl/setting/settings_optimize.php:57
3274
  msgid "CSS HTTP/2 Push"
3275
  msgstr ""
3276
 
3277
- #: admin/tpl/setting/settings_optimize.php:61
3278
  msgid ""
3279
  "Pre-send internal CSS files to the browser before they are requested. "
3280
  "(Requires the HTTP/2 protocol)"
3281
  msgstr ""
3282
 
3283
- #: admin/tpl/setting/settings_optimize.php:67
3284
  msgid "JS Minify"
3285
  msgstr ""
3286
 
3287
- #: admin/tpl/setting/settings_optimize.php:71
3288
  msgid "Minify JS files."
3289
  msgstr ""
3290
 
3291
- #: admin/tpl/setting/settings_optimize.php:77
3292
  msgid "Inline JS Minify"
3293
  msgstr ""
3294
 
3295
- #: admin/tpl/setting/settings_optimize.php:81
3296
  msgid "Minify inline JS code."
3297
  msgstr ""
3298
 
3299
- #: admin/tpl/setting/settings_optimize.php:87
3300
- #: admin/tpl/setting/settings_optimize.php:163
3301
  msgid "JS Combine"
3302
  msgstr ""
3303
 
3304
- #: admin/tpl/setting/settings_optimize.php:91
3305
  msgid "Combine JS files."
3306
  msgstr ""
3307
 
3308
- #: admin/tpl/setting/settings_optimize.php:98
3309
  msgid "JS HTTP/2 Push"
3310
  msgstr ""
3311
 
3312
- #: admin/tpl/setting/settings_optimize.php:102
3313
  msgid ""
3314
  "Pre-send internal JS files to the browser before they are requested. "
3315
  "(Requires the HTTP/2 protocol)"
3316
  msgstr ""
3317
 
3318
- #: admin/tpl/setting/settings_optimize.php:108
3319
  msgid "CSS/JS Cache TTL"
3320
  msgstr ""
3321
 
3322
- #: admin/tpl/setting/settings_optimize.php:113
3323
  msgid ""
3324
  "Specify how long, in seconds, CSS/JS files are cached. Minimum is %1$s "
3325
  "seconds."
3326
  msgstr ""
3327
 
3328
- #: admin/tpl/setting/settings_optimize.php:120
3329
  msgid "HTML Minify"
3330
  msgstr ""
3331
 
3332
- #: admin/tpl/setting/settings_optimize.php:124
3333
  msgid "Minify HTML content."
3334
  msgstr ""
3335
 
3336
- #: admin/tpl/setting/settings_optimize.php:130
 
3337
  #: admin/tpl/setting/settings_tuning.php:134
3338
  msgid "Load CSS Asynchronously"
3339
  msgstr ""
3340
 
3341
- #: admin/tpl/setting/settings_optimize.php:134
3342
- msgid "Optimize CSS delivery. This will load Google Fonts asynchronously too."
3343
  msgstr ""
3344
 
3345
- #: admin/tpl/setting/settings_optimize.php:135
3346
- #: admin/tpl/setting/settings_optimize.php:150
3347
- #: admin/tpl/setting/settings_optimize.php:188
3348
  #: admin/tpl/setting/settings_tuning.php:103
3349
  #: admin/tpl/setting/settings_tuning.php:162
3350
  msgid ""
@@ -3352,47 +3369,104 @@ msgid ""
3352
  "PageSpeed."
3353
  msgstr ""
3354
 
3355
- #: admin/tpl/setting/settings_optimize.php:145
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3356
  msgid "Load JS Deferred"
3357
  msgstr ""
3358
 
3359
- #: admin/tpl/setting/settings_optimize.php:149
3360
  msgid "Doing so can help reduce resource contention and improve performance."
3361
  msgstr ""
3362
 
3363
- #: admin/tpl/setting/settings_optimize.php:156
3364
  msgid "Exclude JQuery"
3365
  msgstr ""
3366
 
3367
- #: admin/tpl/setting/settings_optimize.php:160
3368
  msgid ""
3369
  "Improve compatibility with inline JS by preventing jQuery optimization. "
3370
  "(Recommended Setting: %s)"
3371
  msgstr ""
3372
 
3373
- #: admin/tpl/setting/settings_optimize.php:163
3374
  msgid ""
3375
  "If there is any JS error related to %1$s when enabled %2$s, please try this "
3376
  "option."
3377
  msgstr ""
3378
 
3379
- #: admin/tpl/setting/settings_optimize.php:170
3380
  msgid "DNS Prefetch"
3381
  msgstr ""
3382
 
3383
- #: admin/tpl/setting/settings_optimize.php:174
3384
  msgid "Prefetching DNS can reduce latency for visiters."
3385
  msgstr ""
3386
 
3387
- #: admin/tpl/setting/settings_optimize.php:175
3388
  msgid "For example"
3389
  msgstr ""
3390
 
3391
- #: admin/tpl/setting/settings_optimize.php:183
3392
  msgid "Remove Comments"
3393
  msgstr ""
3394
 
3395
- #: admin/tpl/setting/settings_optimize.php:187
3396
  msgid "Remove the comments inside of JS/CSS files when minifying."
3397
  msgstr ""
3398
 
@@ -3783,39 +3857,39 @@ msgid ""
3783
  "admin before their natural expiration, if necessary."
3784
  msgstr ""
3785
 
3786
- #: inc/gui.class.php:277 includes/litespeed-cache-gui.class.php:277
3787
  msgid "Purge this page"
3788
  msgstr ""
3789
 
3790
- #: inc/gui.class.php:285 includes/litespeed-cache-gui.class.php:285
3791
  msgid "Mark this page as "
3792
  msgstr ""
3793
 
3794
- #: inc/gui.class.php:292 includes/litespeed-cache-gui.class.php:292
3795
  msgid "Forced cacheable"
3796
  msgstr ""
3797
 
3798
- #: inc/gui.class.php:299 includes/litespeed-cache-gui.class.php:299
3799
  msgid "Non cacheable"
3800
  msgstr ""
3801
 
3802
- #: inc/gui.class.php:306 includes/litespeed-cache-gui.class.php:306
3803
  msgid "Private cache"
3804
  msgstr ""
3805
 
3806
- #: inc/gui.class.php:313 includes/litespeed-cache-gui.class.php:313
3807
  msgid "No optimization"
3808
  msgstr ""
3809
 
3810
- #: inc/gui.class.php:320 includes/litespeed-cache-gui.class.php:320
3811
  msgid "More settings"
3812
  msgstr ""
3813
 
3814
- #: inc/gui.class.php:340 includes/litespeed-cache-gui.class.php:340
3815
  msgid "LiteSpeed Cache Purge All"
3816
  msgstr ""
3817
 
3818
- #: inc/gui.class.php:390 includes/litespeed-cache-gui.class.php:390
3819
  msgid "LSCache"
3820
  msgstr ""
3821
 
@@ -3894,15 +3968,15 @@ msgstr ""
3894
  msgid "Imported setting file %s successfully."
3895
  msgstr ""
3896
 
3897
- #: inc/litespeed-cache.class.php:262 includes/litespeed-cache.class.php:262
3898
  msgid "Crawler blacklist is saved."
3899
  msgstr ""
3900
 
3901
- #: inc/litespeed-cache.class.php:273 includes/litespeed-cache.class.php:273
3902
  msgid "Notified LiteSpeed Web Server to purge everything."
3903
  msgstr ""
3904
 
3905
- #: inc/litespeed-cache.class.php:283 includes/litespeed-cache.class.php:283
3906
  msgid "Notified LiteSpeed Web Server to purge the list."
3907
  msgstr ""
3908
 
@@ -3934,67 +4008,71 @@ msgstr ""
3934
  msgid "Original saved %s"
3935
  msgstr ""
3936
 
3937
- #: inc/purge.class.php:149 includes/litespeed-cache-purge.class.php:149
3938
  msgid "Purged all caches successfully."
3939
  msgstr ""
3940
 
3941
- #: inc/purge.class.php:172 includes/litespeed-cache-purge.class.php:172
3942
  msgid "Notified LiteSpeed Web Server to purge all LSCache entries."
3943
  msgstr ""
3944
 
3945
- #: inc/purge.class.php:191 includes/litespeed-cache-purge.class.php:191
 
 
 
 
3946
  msgid "Notified LiteSpeed Web Server to purge CSS/JS entries."
3947
  msgstr ""
3948
 
3949
- #: inc/purge.class.php:208 includes/litespeed-cache-purge.class.php:208
3950
  msgid "Opcode cache is not enabled."
3951
  msgstr ""
3952
 
3953
- #: inc/purge.class.php:220 includes/litespeed-cache-purge.class.php:220
3954
  msgid "Reset the entire opcode cache successfully."
3955
  msgstr ""
3956
 
3957
- #: inc/purge.class.php:239 includes/litespeed-cache-purge.class.php:239
3958
  msgid "Object cache is not enabled."
3959
  msgstr ""
3960
 
3961
- #: inc/purge.class.php:249 includes/litespeed-cache-purge.class.php:249
3962
  msgid "Purge all object caches successfully."
3963
  msgstr ""
3964
 
3965
- #: inc/purge.class.php:401 includes/litespeed-cache-purge.class.php:401
3966
  msgid "Notified LiteSpeed Web Server to purge the front page."
3967
  msgstr ""
3968
 
3969
- #: inc/purge.class.php:415 includes/litespeed-cache-purge.class.php:415
3970
  msgid "Notified LiteSpeed Web Server to purge pages."
3971
  msgstr ""
3972
 
3973
- #: inc/purge.class.php:435 includes/litespeed-cache-purge.class.php:435
3974
  msgid "Notified LiteSpeed Web Server to purge error pages."
3975
  msgstr ""
3976
 
3977
- #: inc/purge.class.php:463 includes/litespeed-cache-purge.class.php:463
3978
  msgid "Purge category %s"
3979
  msgstr ""
3980
 
3981
- #: inc/purge.class.php:490 includes/litespeed-cache-purge.class.php:490
3982
  msgid "Purge Post ID %s"
3983
  msgstr ""
3984
 
3985
- #: inc/purge.class.php:519 includes/litespeed-cache-purge.class.php:519
3986
  msgid "Purge tag %s"
3987
  msgstr ""
3988
 
3989
- #: inc/purge.class.php:553 includes/litespeed-cache-purge.class.php:553
3990
  msgid "Purge url %s"
3991
  msgstr ""
3992
 
3993
- #: inc/task.class.php:145 includes/litespeed-cache-task.class.php:145
3994
- msgid "LiteSpeed Cache Custom Cron ImgOptm"
3995
  msgstr ""
3996
 
3997
- #: inc/task.class.php:166 includes/litespeed-cache-task.class.php:166
3998
  msgid "LiteSpeed Cache Custom Cron Crawler"
3999
  msgstr ""
4000
 
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.3.1\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/litespeed-cache\n"
7
+ "POT-Creation-Date: 2018-06-18 13:56:03+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
30
 
31
  #: admin/litespeed-cache-admin-display.class.php:151
32
  #: admin/tpl/setting/settings_cdn.php:217
33
+ #: admin/tpl/setting/settings_cdn.php:260 inc/gui.class.php:358
34
+ #: includes/litespeed-cache-gui.class.php:358
35
  msgid "Manage"
36
  msgstr ""
37
 
38
  #: admin/litespeed-cache-admin-display.class.php:153
39
+ #: admin/litespeed-cache-admin-display.class.php:242 inc/gui.class.php:366
40
+ #: includes/litespeed-cache-gui.class.php:366
41
  msgid "Settings"
42
  msgstr ""
43
 
45
  msgid "Edit .htaccess"
46
  msgstr ""
47
 
48
+ #: admin/litespeed-cache-admin-display.class.php:160 inc/gui.class.php:375
49
+ #: includes/litespeed-cache-gui.class.php:375
50
  msgid "Image Optimization"
51
  msgstr ""
52
 
72
  "It is recommended that LiteSpeed Cache be purged after updating a plugin."
73
  msgstr ""
74
 
75
+ #: admin/litespeed-cache-admin-display.class.php:798
76
+ #: admin/litespeed-cache-admin-display.class.php:883
77
  #: admin/tpl/setting/settings_debug.php:35
78
  #: admin/tpl/setting/settings_inc.cache_mobile.php:67
79
  #: admin/tpl/setting/settings_media.php:73
80
+ #: admin/tpl/setting/settings_optimize.php:138
81
+ #: admin/tpl/setting/settings_optimize.php:152
82
+ #: admin/tpl/setting/settings_optimize.php:153
83
+ #: admin/tpl/setting/settings_optimize.php:220
84
  #: admin/tpl/setting/settings_tuning.php:21
85
  #: admin/tpl/setting/settings_tuning.php:57
86
  msgid "ON"
87
  msgstr ""
88
 
89
+ #: admin/litespeed-cache-admin-display.class.php:799
90
+ #: admin/litespeed-cache-admin-display.class.php:887
91
  #: admin/tpl/setting/settings_cdn.php:168
92
  #: admin/tpl/setting/settings_debug.php:29
93
  #: admin/tpl/setting/settings_inc.cache_object.php:149
94
+ #: admin/tpl/setting/settings_optimize.php:152
95
+ #: admin/tpl/setting/settings_optimize.php:164
96
  #: admin/tpl/setting/settings_tuning.php:18
97
  #: admin/tpl/setting/settings_tuning.php:54
98
  msgid "OFF"
99
  msgstr ""
100
 
101
+ #: admin/litespeed-cache-admin-display.class.php:922
102
  msgid "Recommended value: %s"
103
  msgstr ""
104
 
105
+ #: admin/litespeed-cache-admin-display.class.php:938
106
  #: admin/tpl/setting/settings_media.php:36
107
+ #: admin/tpl/setting/settings_optimize.php:140
108
  #: admin/tpl/setting/settings_tuning.php:24
109
  #: admin/tpl/setting/settings_tuning.php:40
110
  #: admin/tpl/setting/settings_tuning.php:60
113
  msgid "API"
114
  msgstr ""
115
 
116
+ #: admin/litespeed-cache-admin-display.class.php:939
117
  msgid "Server variable(s) %s available to override this setting."
118
  msgstr ""
119
 
120
+ #: admin/litespeed-cache-admin-display.class.php:941
121
  #: admin/tpl/image_optimization.php:151 admin/tpl/image_optimization.php:226
122
  #: admin/tpl/manage/manage_cdn.php:60
123
  #: admin/tpl/setting/settings_advanced.php:10
136
  #: admin/tpl/setting/settings_inc.cache_object.php:150
137
  #: admin/tpl/setting/settings_media.php:8
138
  #: admin/tpl/setting/settings_media.php:107
139
+ #: admin/tpl/setting/settings_optimize.php:10
140
+ #: admin/tpl/setting/settings_optimize.php:165
141
+ #: admin/tpl/setting/settings_optimize.php:237
142
  #: admin/tpl/setting/settings_purge.php:8
143
  #: admin/tpl/setting/settings_tuning.php:8
144
  msgid "Learn More"
145
  msgstr ""
146
 
147
+ #: admin/litespeed-cache-admin-display.class.php:956
148
  msgid "%s groups"
149
  msgstr ""
150
 
151
+ #: admin/litespeed-cache-admin-display.class.php:959
152
  msgid "%s images"
153
  msgstr ""
154
 
155
+ #: admin/litespeed-cache-admin-display.class.php:969
156
  msgid "%s group"
157
  msgstr ""
158
 
159
+ #: admin/litespeed-cache-admin-display.class.php:972
160
  msgid "%s image"
161
  msgstr ""
162
 
431
  msgstr ""
432
 
433
  #: admin/litespeed-cache-admin-settings.class.php:342
434
+ #: admin/litespeed-cache-admin-settings.class.php:1024
435
  msgid "Default Public Cache"
436
  msgstr ""
437
 
447
  msgid "Feed"
448
  msgstr ""
449
 
450
+ #: admin/litespeed-cache-admin-settings.class.php:865
451
  #: admin/tpl/setting/settings_debug.php:88
452
  msgid "Log File Size Limit"
453
  msgstr ""
454
 
455
+ #: admin/litespeed-cache-admin-settings.class.php:947
456
  #: admin/tpl/setting/settings_crawler.php:13
457
  msgid "Delay"
458
  msgstr ""
459
 
460
+ #: admin/litespeed-cache-admin-settings.class.php:948
461
  #: admin/tpl/setting/settings_crawler.php:37
462
  msgid "Run Duration"
463
  msgstr ""
464
 
465
+ #: admin/litespeed-cache-admin-settings.class.php:949
466
  msgid "Cron Interval"
467
  msgstr ""
468
 
469
+ #: admin/litespeed-cache-admin-settings.class.php:950
470
  msgid "Whole Interval"
471
  msgstr ""
472
 
473
+ #: admin/litespeed-cache-admin-settings.class.php:951
474
  #: admin/tpl/setting/settings_crawler.php:73
475
  msgid "Threads"
476
  msgstr ""
553
  #: admin/tpl/inc/check_cache_disabled.php:31 admin/tpl/manage/manage_cdn.php:15
554
  #: admin/tpl/setting/settings_debug.php:105
555
  #: admin/tpl/setting/settings_debug.php:138
556
+ #: admin/tpl/setting/settings_optimize.php:15 admin/tpl/settings.php:163
557
  msgid "WARNING"
558
  msgstr ""
559
 
746
  #: admin/tpl/setting/settings_general.php:140
747
  #: admin/tpl/setting/settings_inc.cache_browser.php:24
748
  #: admin/tpl/setting/settings_inc.cache_object.php:63
749
+ #: admin/tpl/setting/settings_optimize.php:113
750
  msgid "seconds"
751
  msgstr ""
752
 
1002
  #: admin/tpl/setting/settings_inc.exclude_cookies.php:22
1003
  #: admin/tpl/setting/settings_inc.exclude_useragent.php:21
1004
  #: admin/tpl/setting/settings_inc.media_webp.php:12
1005
+ #: admin/tpl/setting/settings_optimize.php:222
1006
  #: admin/tpl/setting/settings_tuning.php:20
1007
  #: admin/tpl/setting/settings_tuning.php:56
1008
  msgid "NOTE"
1109
  msgid "Rate %s on %s"
1110
  msgstr ""
1111
 
1112
+ #. #-#-#-#-# litespeed-cache.pot (LiteSpeed Cache 2.3.1) #-#-#-#-#
1113
  #. Plugin Name of the plugin/theme
1114
+ #: admin/tpl/inc/admin_footer.php:6 inc/gui.class.php:350
1115
+ #: includes/litespeed-cache-gui.class.php:350
1116
  msgid "LiteSpeed Cache"
1117
  msgstr ""
1118
 
1196
  msgid "How to fix it?"
1197
  msgstr ""
1198
 
1199
+ #: admin/tpl/inc/disabled_all.php:8 admin/tpl/setting/settings_debug.php:13
1200
+ msgid "Disable All Features"
1201
+ msgstr ""
1202
+
1203
  #: admin/tpl/inc/help_tabs.php:7
1204
  msgid "Overview"
1205
  msgstr ""
1307
  "dismissed. (<a %3$s>Learn More</a>)"
1308
  msgstr ""
1309
 
1310
+ #: admin/tpl/manage/manage_cdn.php:11 inc/gui.class.php:409
1311
+ #: includes/litespeed-cache-gui.class.php:409
1312
  msgid "Cloudflare"
1313
  msgstr ""
1314
 
1496
 
1497
  #: admin/tpl/manage/manage_purge.php:39 admin/tpl/manage/manage_purge.php:45
1498
  #: admin/tpl/manage/manage_purge.php:54 admin/tpl/manage/manage_purge.php:63
1499
+ #: admin/tpl/manage/manage_purge.php:72 admin/tpl/manage/manage_purge.php:81
1500
+ #: inc/gui.class.php:384 inc/gui.class.php:392 inc/gui.class.php:400
1501
+ #: inc/gui.class.php:409 inc/gui.class.php:419 inc/gui.class.php:429
1502
+ #: inc/gui.class.php:439 includes/litespeed-cache-gui.class.php:384
1503
+ #: includes/litespeed-cache-gui.class.php:392
1504
+ #: includes/litespeed-cache-gui.class.php:400
1505
+ #: includes/litespeed-cache-gui.class.php:409
1506
+ #: includes/litespeed-cache-gui.class.php:419
1507
+ #: includes/litespeed-cache-gui.class.php:429
1508
+ #: includes/litespeed-cache-gui.class.php:439
1509
  msgid "Purge All"
1510
  msgstr ""
1511
 
1513
  msgid "Purge the litespeed cache entries created by this plugin"
1514
  msgstr ""
1515
 
1516
+ #: admin/tpl/manage/manage_purge.php:45 inc/gui.class.php:400
1517
+ #: includes/litespeed-cache-gui.class.php:400
1518
  msgid "CSS/JS Cache"
1519
  msgstr ""
1520
 
1523
  msgstr ""
1524
 
1525
  #: admin/tpl/manage/manage_purge.php:54
1526
+ #: admin/tpl/setting/settings_inc.cache_object.php:28 inc/gui.class.php:419
1527
+ #: includes/litespeed-cache-gui.class.php:419
1528
  msgid "Object Cache"
1529
  msgstr ""
1530
 
1532
  msgid "Purge all the object caches"
1533
  msgstr ""
1534
 
1535
+ #: admin/tpl/manage/manage_purge.php:63 inc/gui.class.php:429
1536
+ #: includes/litespeed-cache-gui.class.php:429
1537
  msgid "Opcode Cache"
1538
  msgstr ""
1539
 
1541
  msgid "Reset the entire opcode cache"
1542
  msgstr ""
1543
 
1544
+ #: admin/tpl/manage/manage_purge.php:72 inc/gui.class.php:439
1545
+ #: includes/litespeed-cache-gui.class.php:439
1546
+ msgid "Critical CSS"
1547
+ msgstr ""
1548
+
1549
+ #: admin/tpl/manage/manage_purge.php:73
1550
+ msgid "This will delete all generated critical CSS files"
1551
+ msgstr ""
1552
+
1553
+ #: admin/tpl/manage/manage_purge.php:82
1554
  msgid "Purge the cache entries created by this plugin"
1555
  msgstr ""
1556
 
1557
+ #: admin/tpl/manage/manage_purge.php:91
1558
  msgid "Empty Entire Cache"
1559
  msgstr ""
1560
 
1561
+ #: admin/tpl/manage/manage_purge.php:92
1562
  msgid ""
1563
  "Clears all cache entries related to this site, <i>including other web "
1564
  "applications</i>."
1565
  msgstr ""
1566
 
1567
+ #: admin/tpl/manage/manage_purge.php:93
1568
  msgid "This action should only be used if things are cached incorrectly."
1569
  msgstr ""
1570
 
1571
+ #: admin/tpl/manage/manage_purge.php:97
1572
  msgid "This will clear EVERYTHING inside the cache."
1573
  msgstr ""
1574
 
1575
+ #: admin/tpl/manage/manage_purge.php:98
1576
  msgid "This may cause heavy load on the server."
1577
  msgstr ""
1578
 
1579
+ #: admin/tpl/manage/manage_purge.php:99
1580
  msgid "If only the WordPress site should be purged, use purge all."
1581
  msgstr ""
1582
 
1583
+ #: admin/tpl/manage/manage_purge.php:107 admin/tpl/manage.php:5
1584
  #: admin/tpl/network_settings.php:7 admin/tpl/settings.php:7
1585
  msgid "Purge"
1586
  msgstr ""
1587
 
1588
+ #: admin/tpl/manage/manage_purge.php:140
1589
  msgid "Purge By..."
1590
  msgstr ""
1591
 
1592
+ #: admin/tpl/manage/manage_purge.php:142
1593
  msgid "Select below for \"Purge by\" options."
1594
  msgstr ""
1595
 
1596
+ #: admin/tpl/manage/manage_purge.php:143
1597
  #: admin/tpl/setting/settings_cache.php:73
1598
  #: admin/tpl/setting/settings_cache.php:90
1599
  #: admin/tpl/setting/settings_cdn.php:116
1610
  #: admin/tpl/setting/settings_inc.exclude_cookies.php:19
1611
  #: admin/tpl/setting/settings_media.php:34
1612
  #: admin/tpl/setting/settings_media.php:96
1613
+ #: admin/tpl/setting/settings_optimize.php:236
1614
  #: admin/tpl/setting/settings_purge.php:85
1615
  #: admin/tpl/setting/settings_tuning.php:38
1616
  #: admin/tpl/setting/settings_tuning.php:74
1619
  msgid "One per line."
1620
  msgstr ""
1621
 
1622
+ #: admin/tpl/manage/manage_purge.php:170
1623
  msgid "Category"
1624
  msgstr ""
1625
 
1626
+ #: admin/tpl/manage/manage_purge.php:176
1627
  msgid "Post ID"
1628
  msgstr ""
1629
 
1630
+ #: admin/tpl/manage/manage_purge.php:182
1631
  msgid "Tag"
1632
  msgstr ""
1633
 
1634
+ #: admin/tpl/manage/manage_purge.php:188
1635
  msgid "URL"
1636
  msgstr ""
1637
 
1638
+ #: admin/tpl/manage/manage_purge.php:194
1639
  msgid ""
1640
  "Purge pages by category name - e.g. %2$s should be used for the URL %1$s."
1641
  msgstr ""
1642
 
1643
+ #: admin/tpl/manage/manage_purge.php:199
1644
  msgid "Purge pages by post ID."
1645
  msgstr ""
1646
 
1647
+ #: admin/tpl/manage/manage_purge.php:203
1648
  msgid "Purge pages by tag name - e.g. %2$s should be used for the URL %1$s."
1649
  msgstr ""
1650
 
1651
+ #: admin/tpl/manage/manage_purge.php:208
1652
  msgid "Purge pages by relative or full URL."
1653
  msgstr ""
1654
 
1655
+ #: admin/tpl/manage/manage_purge.php:209
1656
  msgid "e.g. Use %s or %s."
1657
  msgstr ""
1658
 
1659
+ #: admin/tpl/manage/manage_purge.php:222
1660
  msgid "Purge List"
1661
  msgstr ""
1662
 
2322
  msgid "Developer Testing"
2323
  msgstr ""
2324
 
 
 
 
 
2325
  #: admin/tpl/setting/settings_debug.php:17
2326
  msgid ""
2327
  "This will disable LSCache and all optimization features for debug purpose."
2620
  msgstr ""
2621
 
2622
  #: admin/tpl/setting/settings_general.php:53
2623
+ #: admin/tpl/setting/settings_optimize.php:21
2624
  msgid "NOTICE"
2625
  msgstr ""
2626
 
3131
  msgstr ""
3132
 
3133
  #: admin/tpl/setting/settings_media.php:38
3134
+ #: admin/tpl/setting/settings_optimize.php:141
3135
  #: admin/tpl/setting/settings_tuning.php:42
3136
  #: admin/tpl/setting/settings_tuning.php:78
3137
  #: admin/tpl/setting/settings_tuning.php:150
3241
  msgid "This can improve quality at the cost of larger images."
3242
  msgstr ""
3243
 
3244
+ #: admin/tpl/setting/settings_optimize.php:9
3245
  msgid "Optimization Settings"
3246
  msgstr ""
3247
 
3248
+ #: admin/tpl/setting/settings_optimize.php:16
3249
  msgid ""
3250
  "Failed to create Optimizer table. Please follow <a %s>Table Creation "
3251
  "guidance from LiteSpeed Wiki</a> to finish setup."
3252
  msgstr ""
3253
 
3254
+ #: admin/tpl/setting/settings_optimize.php:22
3255
  msgid ""
3256
  "Please test thoroughly when enabling any option in this list. After changing "
3257
  "Minify/Combine settings, please do a Purge All action."
3258
  msgstr ""
3259
 
3260
+ #: admin/tpl/setting/settings_optimize.php:28
3261
  msgid "CSS Minify"
3262
  msgstr ""
3263
 
3264
+ #: admin/tpl/setting/settings_optimize.php:32
3265
  msgid "Minify CSS files."
3266
  msgstr ""
3267
 
3268
+ #: admin/tpl/setting/settings_optimize.php:38
3269
  msgid "Inline CSS Minify"
3270
  msgstr ""
3271
 
3272
+ #: admin/tpl/setting/settings_optimize.php:42
3273
  msgid "Minify inline CSS code."
3274
  msgstr ""
3275
 
3276
+ #: admin/tpl/setting/settings_optimize.php:48
3277
  msgid "CSS Combine"
3278
  msgstr ""
3279
 
3280
+ #: admin/tpl/setting/settings_optimize.php:52
3281
  msgid "Combine CSS files."
3282
  msgstr ""
3283
 
3284
+ #: admin/tpl/setting/settings_optimize.php:53
3285
+ #: admin/tpl/setting/settings_optimize.php:94
3286
  msgid "How to Fix Problems Caused by CSS/JS Optimization."
3287
  msgstr ""
3288
 
3289
+ #: admin/tpl/setting/settings_optimize.php:59
3290
  msgid "CSS HTTP/2 Push"
3291
  msgstr ""
3292
 
3293
+ #: admin/tpl/setting/settings_optimize.php:63
3294
  msgid ""
3295
  "Pre-send internal CSS files to the browser before they are requested. "
3296
  "(Requires the HTTP/2 protocol)"
3297
  msgstr ""
3298
 
3299
+ #: admin/tpl/setting/settings_optimize.php:69
3300
  msgid "JS Minify"
3301
  msgstr ""
3302
 
3303
+ #: admin/tpl/setting/settings_optimize.php:73
3304
  msgid "Minify JS files."
3305
  msgstr ""
3306
 
3307
+ #: admin/tpl/setting/settings_optimize.php:79
3308
  msgid "Inline JS Minify"
3309
  msgstr ""
3310
 
3311
+ #: admin/tpl/setting/settings_optimize.php:83
3312
  msgid "Minify inline JS code."
3313
  msgstr ""
3314
 
3315
+ #: admin/tpl/setting/settings_optimize.php:89
3316
+ #: admin/tpl/setting/settings_optimize.php:223
3317
  msgid "JS Combine"
3318
  msgstr ""
3319
 
3320
+ #: admin/tpl/setting/settings_optimize.php:93
3321
  msgid "Combine JS files."
3322
  msgstr ""
3323
 
3324
+ #: admin/tpl/setting/settings_optimize.php:100
3325
  msgid "JS HTTP/2 Push"
3326
  msgstr ""
3327
 
3328
+ #: admin/tpl/setting/settings_optimize.php:104
3329
  msgid ""
3330
  "Pre-send internal JS files to the browser before they are requested. "
3331
  "(Requires the HTTP/2 protocol)"
3332
  msgstr ""
3333
 
3334
+ #: admin/tpl/setting/settings_optimize.php:110
3335
  msgid "CSS/JS Cache TTL"
3336
  msgstr ""
3337
 
3338
+ #: admin/tpl/setting/settings_optimize.php:115
3339
  msgid ""
3340
  "Specify how long, in seconds, CSS/JS files are cached. Minimum is %1$s "
3341
  "seconds."
3342
  msgstr ""
3343
 
3344
+ #: admin/tpl/setting/settings_optimize.php:122
3345
  msgid "HTML Minify"
3346
  msgstr ""
3347
 
3348
+ #: admin/tpl/setting/settings_optimize.php:126
3349
  msgid "Minify HTML content."
3350
  msgstr ""
3351
 
3352
+ #: admin/tpl/setting/settings_optimize.php:132
3353
+ #: admin/tpl/setting/settings_optimize.php:153
3354
  #: admin/tpl/setting/settings_tuning.php:134
3355
  msgid "Load CSS Asynchronously"
3356
  msgstr ""
3357
 
3358
+ #: admin/tpl/setting/settings_optimize.php:136
3359
+ msgid "Optimize CSS delivery."
3360
  msgstr ""
3361
 
3362
+ #: admin/tpl/setting/settings_optimize.php:137
3363
+ #: admin/tpl/setting/settings_optimize.php:210
3364
+ #: admin/tpl/setting/settings_optimize.php:248
3365
  #: admin/tpl/setting/settings_tuning.php:103
3366
  #: admin/tpl/setting/settings_tuning.php:162
3367
  msgid ""
3369
  "PageSpeed."
3370
  msgstr ""
3371
 
3372
+ #: admin/tpl/setting/settings_optimize.php:138
3373
+ msgid ""
3374
+ "When this option is turned %s, it will also load Google Fonts asynchronously."
3375
+ msgstr ""
3376
+
3377
+ #: admin/tpl/setting/settings_optimize.php:148
3378
+ msgid "Generate Critical CSS"
3379
+ msgstr ""
3380
+
3381
+ #: admin/tpl/setting/settings_optimize.php:152
3382
+ msgid ""
3383
+ "Leave this option %1$s to allow communication with LiteSpeed CCSS server. If "
3384
+ "set to %2$s, Critical CSS will not be generated."
3385
+ msgstr ""
3386
+
3387
+ #: admin/tpl/setting/settings_optimize.php:153
3388
+ msgid "This option only works if %1$s is %2$s."
3389
+ msgstr ""
3390
+
3391
+ #: admin/tpl/setting/settings_optimize.php:159
3392
+ msgid "Generate Critical CSS In Background"
3393
+ msgstr ""
3394
+
3395
+ #: admin/tpl/setting/settings_optimize.php:163
3396
+ msgid ""
3397
+ "Automatically generate critical CSS in the background via a cron-based queue."
3398
+ msgstr ""
3399
+
3400
+ #: admin/tpl/setting/settings_optimize.php:164
3401
+ msgid ""
3402
+ "If set to %s this is done in the foreground, which may slow down page load."
3403
+ msgstr ""
3404
+
3405
+ #: admin/tpl/setting/settings_optimize.php:172
3406
+ msgid "Last generated"
3407
+ msgstr ""
3408
+
3409
+ #: admin/tpl/setting/settings_optimize.php:175
3410
+ msgid "Last requested cost"
3411
+ msgstr ""
3412
+
3413
+ #: admin/tpl/setting/settings_optimize.php:180
3414
+ msgid "URL list in queue waiting for cron"
3415
+ msgstr ""
3416
+
3417
+ #: admin/tpl/setting/settings_optimize.php:186
3418
+ msgid "Run Queue Manually"
3419
+ msgstr ""
3420
+
3421
+ #: admin/tpl/setting/settings_optimize.php:195
3422
+ msgid "Inline CSS Async Lib"
3423
+ msgstr ""
3424
+
3425
+ #: admin/tpl/setting/settings_optimize.php:199
3426
+ msgid "This will inline the asynchronous CSS library to avoid render blocking."
3427
+ msgstr ""
3428
+
3429
+ #: admin/tpl/setting/settings_optimize.php:205
3430
  msgid "Load JS Deferred"
3431
  msgstr ""
3432
 
3433
+ #: admin/tpl/setting/settings_optimize.php:209
3434
  msgid "Doing so can help reduce resource contention and improve performance."
3435
  msgstr ""
3436
 
3437
+ #: admin/tpl/setting/settings_optimize.php:216
3438
  msgid "Exclude JQuery"
3439
  msgstr ""
3440
 
3441
+ #: admin/tpl/setting/settings_optimize.php:220
3442
  msgid ""
3443
  "Improve compatibility with inline JS by preventing jQuery optimization. "
3444
  "(Recommended Setting: %s)"
3445
  msgstr ""
3446
 
3447
+ #: admin/tpl/setting/settings_optimize.php:223
3448
  msgid ""
3449
  "If there is any JS error related to %1$s when enabled %2$s, please try this "
3450
  "option."
3451
  msgstr ""
3452
 
3453
+ #: admin/tpl/setting/settings_optimize.php:230
3454
  msgid "DNS Prefetch"
3455
  msgstr ""
3456
 
3457
+ #: admin/tpl/setting/settings_optimize.php:234
3458
  msgid "Prefetching DNS can reduce latency for visiters."
3459
  msgstr ""
3460
 
3461
+ #: admin/tpl/setting/settings_optimize.php:235
3462
  msgid "For example"
3463
  msgstr ""
3464
 
3465
+ #: admin/tpl/setting/settings_optimize.php:243
3466
  msgid "Remove Comments"
3467
  msgstr ""
3468
 
3469
+ #: admin/tpl/setting/settings_optimize.php:247
3470
  msgid "Remove the comments inside of JS/CSS files when minifying."
3471
  msgstr ""
3472
 
3857
  "admin before their natural expiration, if necessary."
3858
  msgstr ""
3859
 
3860
+ #: inc/gui.class.php:279 includes/litespeed-cache-gui.class.php:279
3861
  msgid "Purge this page"
3862
  msgstr ""
3863
 
3864
+ #: inc/gui.class.php:287 includes/litespeed-cache-gui.class.php:287
3865
  msgid "Mark this page as "
3866
  msgstr ""
3867
 
3868
+ #: inc/gui.class.php:294 includes/litespeed-cache-gui.class.php:294
3869
  msgid "Forced cacheable"
3870
  msgstr ""
3871
 
3872
+ #: inc/gui.class.php:301 includes/litespeed-cache-gui.class.php:301
3873
  msgid "Non cacheable"
3874
  msgstr ""
3875
 
3876
+ #: inc/gui.class.php:308 includes/litespeed-cache-gui.class.php:308
3877
  msgid "Private cache"
3878
  msgstr ""
3879
 
3880
+ #: inc/gui.class.php:315 includes/litespeed-cache-gui.class.php:315
3881
  msgid "No optimization"
3882
  msgstr ""
3883
 
3884
+ #: inc/gui.class.php:322 includes/litespeed-cache-gui.class.php:322
3885
  msgid "More settings"
3886
  msgstr ""
3887
 
3888
+ #: inc/gui.class.php:342 includes/litespeed-cache-gui.class.php:342
3889
  msgid "LiteSpeed Cache Purge All"
3890
  msgstr ""
3891
 
3892
+ #: inc/gui.class.php:392 includes/litespeed-cache-gui.class.php:392
3893
  msgid "LSCache"
3894
  msgstr ""
3895
 
3968
  msgid "Imported setting file %s successfully."
3969
  msgstr ""
3970
 
3971
+ #: inc/litespeed-cache.class.php:263 includes/litespeed-cache.class.php:263
3972
  msgid "Crawler blacklist is saved."
3973
  msgstr ""
3974
 
3975
+ #: inc/litespeed-cache.class.php:274 includes/litespeed-cache.class.php:274
3976
  msgid "Notified LiteSpeed Web Server to purge everything."
3977
  msgstr ""
3978
 
3979
+ #: inc/litespeed-cache.class.php:284 includes/litespeed-cache.class.php:284
3980
  msgid "Notified LiteSpeed Web Server to purge the list."
3981
  msgstr ""
3982
 
4008
  msgid "Original saved %s"
4009
  msgstr ""
4010
 
4011
+ #: inc/purge.class.php:155 includes/litespeed-cache-purge.class.php:155
4012
  msgid "Purged all caches successfully."
4013
  msgstr ""
4014
 
4015
+ #: inc/purge.class.php:178 includes/litespeed-cache-purge.class.php:178
4016
  msgid "Notified LiteSpeed Web Server to purge all LSCache entries."
4017
  msgstr ""
4018
 
4019
+ #: inc/purge.class.php:194 includes/litespeed-cache-purge.class.php:194
4020
+ msgid "Cleaned all critical CSS files."
4021
+ msgstr ""
4022
+
4023
+ #: inc/purge.class.php:213 includes/litespeed-cache-purge.class.php:213
4024
  msgid "Notified LiteSpeed Web Server to purge CSS/JS entries."
4025
  msgstr ""
4026
 
4027
+ #: inc/purge.class.php:230 includes/litespeed-cache-purge.class.php:230
4028
  msgid "Opcode cache is not enabled."
4029
  msgstr ""
4030
 
4031
+ #: inc/purge.class.php:242 includes/litespeed-cache-purge.class.php:242
4032
  msgid "Reset the entire opcode cache successfully."
4033
  msgstr ""
4034
 
4035
+ #: inc/purge.class.php:261 includes/litespeed-cache-purge.class.php:261
4036
  msgid "Object cache is not enabled."
4037
  msgstr ""
4038
 
4039
+ #: inc/purge.class.php:271 includes/litespeed-cache-purge.class.php:271
4040
  msgid "Purge all object caches successfully."
4041
  msgstr ""
4042
 
4043
+ #: inc/purge.class.php:423 includes/litespeed-cache-purge.class.php:423
4044
  msgid "Notified LiteSpeed Web Server to purge the front page."
4045
  msgstr ""
4046
 
4047
+ #: inc/purge.class.php:437 includes/litespeed-cache-purge.class.php:437
4048
  msgid "Notified LiteSpeed Web Server to purge pages."
4049
  msgstr ""
4050
 
4051
+ #: inc/purge.class.php:457 includes/litespeed-cache-purge.class.php:457
4052
  msgid "Notified LiteSpeed Web Server to purge error pages."
4053
  msgstr ""
4054
 
4055
+ #: inc/purge.class.php:485 includes/litespeed-cache-purge.class.php:485
4056
  msgid "Purge category %s"
4057
  msgstr ""
4058
 
4059
+ #: inc/purge.class.php:512 includes/litespeed-cache-purge.class.php:512
4060
  msgid "Purge Post ID %s"
4061
  msgstr ""
4062
 
4063
+ #: inc/purge.class.php:541 includes/litespeed-cache-purge.class.php:541
4064
  msgid "Purge tag %s"
4065
  msgstr ""
4066
 
4067
+ #: inc/purge.class.php:575 includes/litespeed-cache-purge.class.php:575
4068
  msgid "Purge url %s"
4069
  msgstr ""
4070
 
4071
+ #: inc/task.class.php:170 includes/litespeed-cache-task.class.php:170
4072
+ msgid "LiteSpeed Cache Custom Cron Common"
4073
  msgstr ""
4074
 
4075
+ #: inc/task.class.php:191 includes/litespeed-cache-task.class.php:191
4076
  msgid "LiteSpeed Cache Custom Cron Crawler"
4077
  msgstr ""
4078
 
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: WordPress plugin to connect to LSCache on LiteSpeed Web Server.
18
- * Version: 2.2.7
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: WordPress plugin to connect to LSCache on LiteSpeed Web Server.
18
+ * Version: 2.3.1
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: cache, wp-cache, litespeed, super cache, http2, total cache, optimize, object cache, redis, memcached, lazy load, database cleaner
4
  Requires at least: 4.0
5
  Tested up to: 4.9.5
6
- Stable tag: 2.2.7
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl.html
9
 
@@ -29,6 +29,7 @@ LSCWP supports WordPress Multisite and is compatible with most popular plugins,
29
  * Minify CSS, JavaScript, and HTML
30
  * Minify inline CSS/JS
31
  * Combine CSS/JS
 
32
  * Lazyload images/iframes
33
  * Multiple CDN support
34
  * Load CSS/JS Asynchronously
@@ -266,6 +267,17 @@ Click on the `Advanced View` link at the top of the page, and several more tabs
266
 
267
  == Changelog ==
268
 
 
 
 
 
 
 
 
 
 
 
 
269
  = 2.2.7 - Jun 4 2018 =
270
  * [IMPROVEMENT] Improved redirection for manual image pull to avoid too many redirections warning.
271
  * [IAPI] Increased credit limit.
3
  Tags: cache, wp-cache, litespeed, super cache, http2, total cache, optimize, object cache, redis, memcached, lazy load, database cleaner
4
  Requires at least: 4.0
5
  Tested up to: 4.9.5
6
+ Stable tag: 2.3.1
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl.html
9
 
29
  * Minify CSS, JavaScript, and HTML
30
  * Minify inline CSS/JS
31
  * Combine CSS/JS
32
+ * Automatically generate Critical CSS
33
  * Lazyload images/iframes
34
  * Multiple CDN support
35
  * Load CSS/JS Asynchronously
267
 
268
  == Changelog ==
269
 
270
+ = 2.3.1 - Jun 18 2018 =
271
+ * [Improvement] New setting to disable Generate Critical CSS. (@cybmeta)
272
+ * [Improvement] Added filter to can_cdn/can_optm check. (@Jacob)
273
+ * [Update] *Critical CSS* Added 404 css. Limit cron interval.
274
+ * [Update] AJAX will not bypass CDN anymore by default. (@Jacob)
275
+ * [GUI] Show Disable All Features warning if it is on in Debug tab.
276
+
277
+ = 2.3 - Jun 13 2018 =
278
+ * [NEW FEATURE] Automatically generate critical CSS. (@joeee @ivan_ivanov @3dseo)
279
+ * [BUGFIX] "Mark this page as..." from dropdown menu will not reset settings anymore. (@cbratschi)
280
+
281
  = 2.2.7 - Jun 4 2018 =
282
  * [IMPROVEMENT] Improved redirection for manual image pull to avoid too many redirections warning.
283
  * [IAPI] Increased credit limit.