LiteSpeed Cache - Version 2.4

Version Description

  • Jul 2 2018 =
  • [NEW FEATURE] Image Optimization Added lossless optimization.
  • [NEW FEATURE] Image Optimization Added Request Orignal Images ON/OFF.
  • [NEW FEATURE] Image Optimization Added Request WebP ON/OFF. (@JMCA2)
  • [IMPROVEMENT] Image Optimization Improved optimization tools to archive maximum compression and score.
  • [IMPROVEMENT] Image Optimization Improved speed of image pull.
  • [IMPROVEMENT] Image Optimization Automatically recover credit after pulled.
  • [REFACTOR] Config Separated configure const class.
  • [BUGFIX] Report Report can be sent successfully with emoji now. (@music47ell)
  • [IAPI] New Europe Image Optimization server (EU3/EU4).
  • [IAPI] New America Image Optimization server (US3/US4/US5/US6).
  • [IAPI] New Asian Image Optimization server (AS3).
  • [IAPI] Refactored optimization process.
  • [IAPI] Increased credit limit.
  • [IAPI] Removed request interval limit.
  • [IAPI] IAPI v2.4.
  • We strongly recommended that you re-optimize your image library to get a better compression result.
Download this release

Release Info

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

Code changes from version 2.3.1 to 2.4

admin/litespeed-cache-admin-rules.class.php CHANGED
@@ -663,7 +663,7 @@ class LiteSpeed_Cache_Admin_Rules
663
  }
664
 
665
  // webp support
666
- $id = LiteSpeed_Cache_Config::OPID_MEDIA_IMG_WEBP ;
667
  if ( ! empty( $cfg[ $id ] ) ) {
668
  $new_rules[] = self::MARKER_WEBP . self::MARKER_START ;
669
  $new_rules[] = 'RewriteCond %{HTTP_ACCEPT} "image/webp"' ;
663
  }
664
 
665
  // webp support
666
+ $id = LiteSpeed_Cache_Config::OPT_MEDIA_WEBP_REPLACE ;
667
  if ( ! empty( $cfg[ $id ] ) ) {
668
  $new_rules[] = self::MARKER_WEBP . self::MARKER_START ;
669
  $new_rules[] = 'RewriteCond %{HTTP_ACCEPT} "image/webp"' ;
admin/litespeed-cache-admin-settings.class.php CHANGED
@@ -671,11 +671,13 @@ class LiteSpeed_Cache_Admin_Settings
671
  $ids = array(
672
  LiteSpeed_Cache_Config::OPID_MEDIA_IMG_LAZY,
673
  LiteSpeed_Cache_Config::OPID_MEDIA_IFRAME_LAZY,
674
- LiteSpeed_Cache_Config::OPID_MEDIA_IMG_OPTM_CRON_OFF,
675
- LiteSpeed_Cache_Config::OPID_MEDIA_IMG_WEBP_REPLACE_SRCSET,
676
- LiteSpeed_Cache_Config::OPID_MEDIA_IMG_WEBP_ONLY,
677
- LiteSpeed_Cache_Config::OPID_MEDIA_IMG_EXIF,
678
- LiteSpeed_Cache_Config::OPID_MEDIA_IMG_WEBP_LOSSLESS,
 
 
679
  ) ;
680
  foreach ( $ids as $id ) {
681
  $this->_options[ $id ] = self::parse_onoff( $this->_input, $id ) ;
@@ -1013,7 +1015,7 @@ class LiteSpeed_Cache_Admin_Settings
1013
  LiteSpeed_Cache_Config::OPID_CACHE_FAVICON,
1014
  LiteSpeed_Cache_Config::OPID_CACHE_RES,
1015
  LiteSpeed_Cache_Config::OPID_CACHE_BROWSER,
1016
- LiteSpeed_Cache_Config::OPID_MEDIA_IMG_WEBP,
1017
  ) ;
1018
  foreach ( $ids as $id ) {
1019
  $new_options[ $id ] = self::parse_onoff( $this->_input, $id ) ;
671
  $ids = array(
672
  LiteSpeed_Cache_Config::OPID_MEDIA_IMG_LAZY,
673
  LiteSpeed_Cache_Config::OPID_MEDIA_IFRAME_LAZY,
674
+ LiteSpeed_Cache_Config::OPT_MEDIA_OPTM_AUTO,
675
+ LiteSpeed_Cache_Config::OPT_MEDIA_OPTM_CRON,
676
+ LiteSpeed_Cache_Config::OPT_MEDIA_OPTM_ORI,
677
+ LiteSpeed_Cache_Config::OPT_MEDIA_OPTM_WEBP,
678
+ LiteSpeed_Cache_Config::OPT_MEDIA_OPTM_LOSSLESS,
679
+ LiteSpeed_Cache_Config::OPT_MEDIA_OPTM_EXIF,
680
+ LiteSpeed_Cache_Config::OPT_MEDIA_WEBP_REPLACE_SRCSET,
681
  ) ;
682
  foreach ( $ids as $id ) {
683
  $this->_options[ $id ] = self::parse_onoff( $this->_input, $id ) ;
1015
  LiteSpeed_Cache_Config::OPID_CACHE_FAVICON,
1016
  LiteSpeed_Cache_Config::OPID_CACHE_RES,
1017
  LiteSpeed_Cache_Config::OPID_CACHE_BROWSER,
1018
+ LiteSpeed_Cache_Config::OPT_MEDIA_WEBP_REPLACE,
1019
  ) ;
1020
  foreach ( $ids as $id ) {
1021
  $new_options[ $id ] = self::parse_onoff( $this->_input, $id ) ;
admin/tpl/image_optimization.php CHANGED
@@ -236,7 +236,7 @@ LiteSpeed_Cache_GUI::show_promo() ;
236
 
237
  <br />
238
 
239
- <a href="<?php echo LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_IMG_OPTM, LiteSpeed_Cache_Img_Optm::TYPE_IMG_BATCH_SWITCH_ORI ) ; ?>" class="litespeed-btn-danger">
240
  <?php echo __( 'Undo Optimization', 'litespeed-cache' ) ; ?>
241
  </a>
242
  <span class="litespeed-desc">
@@ -245,7 +245,7 @@ LiteSpeed_Cache_GUI::show_promo() ;
245
 
246
  <br />
247
 
248
- <a href="<?php echo LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_IMG_OPTM, LiteSpeed_Cache_Img_Optm::TYPE_IMG_BATCH_SWITCH_OPTM ) ; ?>" class="litespeed-btn-warning">
249
  <?php echo __( 'Re-do Optimization', 'litespeed-cache' ) ; ?>
250
  </a>
251
  <span class="litespeed-desc">
236
 
237
  <br />
238
 
239
+ <a href="<?php echo LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_IMG_OPTM, LiteSpeed_Cache_Img_Optm::TYPE_IMG_BATCH_SWITCH_ORI ) ; ?>" class="litespeed-btn-warning">
240
  <?php echo __( 'Undo Optimization', 'litespeed-cache' ) ; ?>
241
  </a>
242
  <span class="litespeed-desc">
245
 
246
  <br />
247
 
248
+ <a href="<?php echo LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_IMG_OPTM, LiteSpeed_Cache_Img_Optm::TYPE_IMG_BATCH_SWITCH_OPTM ) ; ?>" class="litespeed-btn-success">
249
  <?php echo __( 'Re-do Optimization', 'litespeed-cache' ) ; ?>
250
  </a>
251
  <span class="litespeed-desc">
admin/tpl/inc/disabled_all.php CHANGED
File without changes
admin/tpl/setting/settings_cdn.php CHANGED
@@ -32,6 +32,7 @@ if ( ! $cdn_mapping ) {
32
  <?php $this->build_switch( LiteSpeed_Cache_Config::OPID_CDN ) ; ?>
33
  <div class="litespeed-desc">
34
  <?php echo __( 'Enable Content Delivery Network use.', 'litespeed-cache' ) ; ?>
 
35
  </div>
36
  </td>
37
  </tr>
32
  <?php $this->build_switch( LiteSpeed_Cache_Config::OPID_CDN ) ; ?>
33
  <div class="litespeed-desc">
34
  <?php echo __( 'Enable Content Delivery Network use.', 'litespeed-cache' ) ; ?>
35
+ <?php echo sprintf( __( 'If using Cloudflare, leave this setting %s and use Cloudflare API setting below.', 'litespeed-cache' ), '<code>' . __( 'OFF', 'litespeed-cache' ) . '</code>' ) ; ?>
36
  </div>
37
  </td>
38
  </tr>
admin/tpl/setting/settings_inc.media_webp.php CHANGED
@@ -5,7 +5,7 @@ if ( ! defined( 'WPINC' ) ) die ;
5
  <tr>
6
  <th><?php echo __( 'Image WebP Replacement', 'litespeed-cache' ) ; ?></th>
7
  <td>
8
- <?php $this->build_switch( LiteSpeed_Cache_Config::OPID_MEDIA_IMG_WEBP ) ; ?>
9
  <div class="litespeed-desc">
10
  <?php echo sprintf( __( 'Significantly improve load time by replacing images with their optimized %s versions.', 'litespeed-cache' ), '.webp' ) ; ?>
11
  <br /><font class="litespeed-warning">
5
  <tr>
6
  <th><?php echo __( 'Image WebP Replacement', 'litespeed-cache' ) ; ?></th>
7
  <td>
8
+ <?php $this->build_switch( LiteSpeed_Cache_Config::OPT_MEDIA_WEBP_REPLACE ) ; ?>
9
  <div class="litespeed-desc">
10
  <?php echo sprintf( __( 'Significantly improve load time by replacing images with their optimized %s versions.', 'litespeed-cache' ), '.webp' ) ; ?>
11
  <br /><font class="litespeed-warning">
admin/tpl/setting/settings_media.php CHANGED
@@ -65,56 +65,53 @@ if ( ! defined( 'WPINC' ) ) die ;
65
  </td>
66
  </tr>
67
 
68
- <tr>
69
- <th><?php echo __( 'Disable Optimization Pull', 'litespeed-cache' ) ; ?></th>
70
  <td>
71
- <?php $this->build_switch( LiteSpeed_Cache_Config::OPID_MEDIA_IMG_OPTM_CRON_OFF ) ; ?>
72
  <div class="litespeed-desc">
73
- <?php echo sprintf( __( 'Set this option to %s to disable the cron job responsible for fetching optimized images from LiteSpeed\'s Image Server.', 'litespeed-cache' ), __( 'ON', 'litespeed-cache' ) ) ; ?>
74
  </div>
75
  </td>
76
  </tr>
77
 
78
- <?php
79
- if ( ! is_multisite() ) :
80
- // webp
81
- require LSCWP_DIR . 'admin/tpl/setting/settings_inc.media_webp.php' ;
82
-
83
- endif ;
84
- ?>
 
 
85
 
86
  <tr>
87
- <th><?php echo __( 'WebP Attribute To Replace', 'litespeed-cache' ) ; ?></th>
88
  <td>
89
- <?php $id = LiteSpeed_Cache_Config::ITEM_MEDIA_WEBP_ATTRIBUTE ; ?>
90
- <?php $this->build_textarea2( $id, 40 ) ; ?>
91
- <?php $this->recommended( $id, true ) ; ?>
92
  <div class="litespeed-desc">
93
- <?php echo __( 'Specify which element attributes will be replaced with WebP.', 'litespeed-cache' ) ; ?>
94
- <?php echo __( 'Only attributes listed here will be replaced.', 'litespeed-cache' ) ; ?>
95
- <br /><?php echo sprintf( __( 'Use the format %1$s or %2$s (element is optional).', 'litespeed-cache' ), '<code>element.attribute</code>', '<code>.attribute</code>' ) ; ?>
96
- <?php echo __('One per line.', 'litespeed-cache'); ?>
97
  </div>
98
  </td>
99
  </tr>
100
 
101
  <tr>
102
- <th><?php echo __( 'WebP For Extra srcset', 'litespeed-cache' ) ; ?></th>
103
  <td>
104
- <?php $this->build_switch( LiteSpeed_Cache_Config::OPID_MEDIA_IMG_WEBP_REPLACE_SRCSET ) ; ?>
105
  <div class="litespeed-desc">
106
- <?php echo sprintf( __( 'Enable replacement of WebP in %s elements that were generated outside of WordPress logic.', 'litespeed-cache' ), '<code>srcset</code>' ) ; ?>
107
- <a href="https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp:configuration:media#webp_for_extra_srcset" target="_blank"><?php echo __('Learn More', 'litespeed-cache') ; ?></a>
108
  </div>
109
  </td>
110
  </tr>
111
 
112
  <tr>
113
- <th><?php echo __( 'Only Request WebP', 'litespeed-cache' ) ; ?></th>
114
  <td>
115
- <?php $this->build_switch( LiteSpeed_Cache_Config::OPID_MEDIA_IMG_WEBP_ONLY ) ; ?>
116
  <div class="litespeed-desc">
117
- <?php echo __( 'Prevent images from being replaced with optimized versions when optimizing. WebP versions will still be generated.', 'litespeed-cache' ) ; ?>
 
118
  </div>
119
  </td>
120
  </tr>
@@ -122,7 +119,7 @@ if ( ! defined( 'WPINC' ) ) die ;
122
  <tr>
123
  <th><?php echo __( 'Preserve EXIF data', 'litespeed-cache' ) ; ?></th>
124
  <td>
125
- <?php $this->build_switch( LiteSpeed_Cache_Config::OPID_MEDIA_IMG_EXIF ) ; ?>
126
  <div class="litespeed-desc">
127
  <?php echo __( 'Preserve EXIF data (copyright, GPS, comments, keywords, etc) when optimizing.', 'litespeed-cache' ) ; ?>
128
  <?php echo __( 'This will increase the size of optimized files.', 'litespeed-cache' ) ; ?>
@@ -130,13 +127,36 @@ if ( ! defined( 'WPINC' ) ) die ;
130
  </td>
131
  </tr>
132
 
133
- <tr class="litespeed-hide">
134
- <th><?php echo __( 'WebP Lossless Compression', 'litespeed-cache' ) ; ?></th>
 
 
 
 
 
 
 
 
135
  <td>
136
- <?php $this->build_switch( LiteSpeed_Cache_Config::OPID_MEDIA_IMG_WEBP_LOSSLESS ) ; ?>
 
 
137
  <div class="litespeed-desc">
138
- <?php echo __( 'Generate WebP images using lossless compression.', 'litespeed-cache' ) ; ?>
139
- <?php echo __( 'This can improve quality at the cost of larger images.', 'litespeed-cache' ) ; ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
140
  </div>
141
  </td>
142
  </tr>
65
  </td>
66
  </tr>
67
 
68
+ <tr class="litespeed-hide">
69
+ <th><?php echo __( 'Optimize New Images', 'litespeed-cache' ) ; ?></th>
70
  <td>
71
+ <?php $this->build_switch( LiteSpeed_Cache_Config::OPT_MEDIA_OPTM_AUTO ) ; ?>
72
  <div class="litespeed-desc">
73
+ <?php echo __( 'Automatically request optimization for newly-uploaded images.', 'litespeed-cache' ) ; ?>
74
  </div>
75
  </td>
76
  </tr>
77
 
78
+ <tr>
79
+ <th><?php echo __( 'Optimization Cron', 'litespeed-cache' ) ; ?></th>
80
+ <td>
81
+ <?php $this->build_switch( LiteSpeed_Cache_Config::OPT_MEDIA_OPTM_CRON ) ; ?>
82
+ <div class="litespeed-desc">
83
+ <?php echo __( 'Disabling this will stop the cron job responsible for fetching optimized images from LiteSpeed\'s Image Server.', 'litespeed-cache' ) ; ?>
84
+ </div>
85
+ </td>
86
+ </tr>
87
 
88
  <tr>
89
+ <th><?php echo __( 'Optimize Original Images', 'litespeed-cache' ) ; ?></th>
90
  <td>
91
+ <?php $this->build_switch( LiteSpeed_Cache_Config::OPT_MEDIA_OPTM_ORI ) ; ?>
 
 
92
  <div class="litespeed-desc">
93
+ <?php echo __( 'Optimize images and save backups of the originals in the same folder.', 'litespeed-cache' ) ; ?>
 
 
 
94
  </div>
95
  </td>
96
  </tr>
97
 
98
  <tr>
99
+ <th><?php echo __( 'Optimize WebP Versions', 'litespeed-cache' ) ; ?></th>
100
  <td>
101
+ <?php $this->build_switch( LiteSpeed_Cache_Config::OPT_MEDIA_OPTM_WEBP ) ; ?>
102
  <div class="litespeed-desc">
103
+ <?php echo __( 'Request WebP versions of original images when doing optimization.', 'litespeed-cache' ) ; ?>
 
104
  </div>
105
  </td>
106
  </tr>
107
 
108
  <tr>
109
+ <th><?php echo __( 'Optimize Losslessly', 'litespeed-cache' ) ; ?></th>
110
  <td>
111
+ <?php $this->build_switch( LiteSpeed_Cache_Config::OPT_MEDIA_OPTM_LOSSLESS ) ; ?>
112
  <div class="litespeed-desc">
113
+ <?php echo __( 'Optimize images using lossless compression.', 'litespeed-cache' ) ; ?>
114
+ <?php echo __( 'This can improve quality but may result in larger images than lossy compression will.', 'litespeed-cache' ) ; ?>
115
  </div>
116
  </td>
117
  </tr>
119
  <tr>
120
  <th><?php echo __( 'Preserve EXIF data', 'litespeed-cache' ) ; ?></th>
121
  <td>
122
+ <?php $this->build_switch( LiteSpeed_Cache_Config::OPT_MEDIA_OPTM_EXIF ) ; ?>
123
  <div class="litespeed-desc">
124
  <?php echo __( 'Preserve EXIF data (copyright, GPS, comments, keywords, etc) when optimizing.', 'litespeed-cache' ) ; ?>
125
  <?php echo __( 'This will increase the size of optimized files.', 'litespeed-cache' ) ; ?>
127
  </td>
128
  </tr>
129
 
130
+ <?php
131
+ if ( ! is_multisite() ) :
132
+ // webp
133
+ require LSCWP_DIR . 'admin/tpl/setting/settings_inc.media_webp.php' ;
134
+
135
+ endif ;
136
+ ?>
137
+
138
+ <tr>
139
+ <th><?php echo __( 'WebP Attribute To Replace', 'litespeed-cache' ) ; ?></th>
140
  <td>
141
+ <?php $id = LiteSpeed_Cache_Config::ITEM_MEDIA_WEBP_ATTRIBUTE ; ?>
142
+ <?php $this->build_textarea2( $id, 40 ) ; ?>
143
+ <?php $this->recommended( $id, true ) ; ?>
144
  <div class="litespeed-desc">
145
+ <?php echo __( 'Specify which element attributes will be replaced with WebP.', 'litespeed-cache' ) ; ?>
146
+ <?php echo __( 'Only attributes listed here will be replaced.', 'litespeed-cache' ) ; ?>
147
+ <br /><?php echo sprintf( __( 'Use the format %1$s or %2$s (element is optional).', 'litespeed-cache' ), '<code>element.attribute</code>', '<code>.attribute</code>' ) ; ?>
148
+ <?php echo __('One per line.', 'litespeed-cache'); ?>
149
+ </div>
150
+ </td>
151
+ </tr>
152
+
153
+ <tr>
154
+ <th><?php echo __( 'WebP For Extra srcset', 'litespeed-cache' ) ; ?></th>
155
+ <td>
156
+ <?php $this->build_switch( LiteSpeed_Cache_Config::OPT_MEDIA_WEBP_REPLACE_SRCSET ) ; ?>
157
+ <div class="litespeed-desc">
158
+ <?php echo sprintf( __( 'Enable replacement of WebP in %s elements that were generated outside of WordPress logic.', 'litespeed-cache' ), '<code>srcset</code>' ) ; ?>
159
+ <a href="https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp:configuration:media#webp_for_extra_srcset" target="_blank"><?php echo __('Learn More', 'litespeed-cache') ; ?></a>
160
  </div>
161
  </td>
162
  </tr>
admin/tpl/settings.php CHANGED
@@ -99,9 +99,6 @@ else {
99
  $adv_mode = get_option( LiteSpeed_Cache_Config::ITEM_SETTING_MODE ) ;
100
  }
101
 
102
- $class_basic = $adv_mode ? '' : ' litespeed-setting-curr' ;
103
- $class_advanced = ! $adv_mode ? '' : ' litespeed-setting-curr' ;
104
-
105
  $hide_tabs = array() ;
106
  $_hide_in_basic_mode = '' ;
107
 
@@ -129,10 +126,6 @@ if ( ! $adv_mode ) {
129
  <span class="litespeed-desc">
130
  v<?php echo LiteSpeed_Cache::PLUGIN_VERSION ; ?>
131
  </span>
132
- <span class="litespeed-desc">
133
- <a href="admin.php?page=lscache-settings&mode=basic" class="litespeed-setting-basic <?php echo $class_basic ; ?>"><?php echo __( 'Basic View', 'litespeed-cache' ) ; ?></a>
134
- <a href="admin.php?page=lscache-settings&mode=advanced" class="litespeed-setting-advanced <?php echo $class_advanced ; ?>"><?php echo __( 'Advanced View', 'litespeed-cache' ) ; ?></a>
135
- </span>
136
  <hr class="wp-header-end">
137
  </div>
138
  <div class="litespeed-wrap">
@@ -153,6 +146,11 @@ if ( ! $adv_mode ) {
153
  $i ++ ;
154
  }
155
  ?>
 
 
 
 
 
156
  </h2>
157
  <div class="litespeed-body">
158
  <form method="post" action="options.php" id="litespeed_form_options" class="litespeed-relative">
99
  $adv_mode = get_option( LiteSpeed_Cache_Config::ITEM_SETTING_MODE ) ;
100
  }
101
 
 
 
 
102
  $hide_tabs = array() ;
103
  $_hide_in_basic_mode = '' ;
104
 
126
  <span class="litespeed-desc">
127
  v<?php echo LiteSpeed_Cache::PLUGIN_VERSION ; ?>
128
  </span>
 
 
 
 
129
  <hr class="wp-header-end">
130
  </div>
131
  <div class="litespeed-wrap">
146
  $i ++ ;
147
  }
148
  ?>
149
+ <?php if ( $adv_mode ) : ?>
150
+ <a href="admin.php?page=lscache-settings&mode=basic" class="litespeed-tab litespeed-advanced-tab-hide litespeed-right"><?php echo __( 'Hide Advanced Options', 'litespeed-cache' ) ; ?></a>
151
+ <?php else : ?>
152
+ <a href="admin.php?page=lscache-settings&mode=advanced" class="litespeed-tab litespeed-advanced-tab-show litespeed-right"><?php echo __( 'Show Advanced Options', 'litespeed-cache' ) ; ?></a>
153
+ <?php endif ; ?>
154
  </h2>
155
  <div class="litespeed-body">
156
  <form method="post" action="options.php" id="litespeed_form_options" class="litespeed-relative">
cli/litespeed-cache-cli-admin.class.php CHANGED
@@ -11,70 +11,14 @@ class LiteSpeed_Cache_Cli_Admin
11
 
12
  public function __construct()
13
  {
14
- self::$checkboxes = array(
15
- LiteSpeed_Cache_Config::OPID_CACHE_PRIV,
16
- LiteSpeed_Cache_Config::OPID_CACHE_COMMENTER,
17
- LiteSpeed_Cache_Config::OPID_CACHE_REST,
18
- LiteSpeed_Cache_Config::OPID_CACHE_PAGE_LOGIN,
19
- LiteSpeed_Cache_Config::OPID_CACHE_MOBILE,
20
- LiteSpeed_Cache_Config::OPID_PURGE_ON_UPGRADE,
21
- LiteSpeed_Cache_Config::OPID_CACHE_FAVICON,
22
- LiteSpeed_Cache_Config::OPID_CACHE_RES,
23
- LiteSpeed_Cache_Config::OPID_CACHE_OBJECT,
24
- LiteSpeed_Cache_Config::OPID_CACHE_OBJECT_KIND,
25
-
26
- LiteSpeed_Cache_Config::OPID_CHECK_ADVANCEDCACHE,
27
- LiteSpeed_Cache_Config::OPID_ESI_ENABLE,
28
- LiteSpeed_Cache_Config::OPID_ESI_CACHE_ADMBAR,
29
- LiteSpeed_Cache_Config::OPID_ESI_CACHE_COMMFORM,
30
- LiteSpeed_Cache_Config::CRWL_POSTS,
31
- LiteSpeed_Cache_Config::CRWL_PAGES,
32
- LiteSpeed_Cache_Config::CRWL_CATS,
33
- LiteSpeed_Cache_Config::CRWL_TAGS,
34
- LiteSpeed_Cache_Config::CRWL_CRON_ACTIVE,
35
- LiteSpeed_Cache_Config::OPID_DEBUG_DISABLE_ALL,
36
- LiteSpeed_Cache_Config::OPID_DEBUG_LEVEL,
37
- LiteSpeed_Cache_Config::OPID_HEARTBEAT,
38
- LiteSpeed_Cache_Config::OPID_DEBUG_COOKIE,
39
- LiteSpeed_Cache_Config::OPID_COLLAPS_QS,
40
- LiteSpeed_Cache_Config::OPID_LOG_FILTERS,
41
-
42
- LiteSpeed_Cache_Config::OPID_CSS_MINIFY,
43
- LiteSpeed_Cache_Config::OPID_CSS_INLINE_MINIFY,
44
- LiteSpeed_Cache_Config::OPID_CSS_COMBINE,
45
- LiteSpeed_Cache_Config::OPID_CSS_COMBINED_PRIORITY,
46
- LiteSpeed_Cache_Config::OPID_CSS_HTTP2,
47
- LiteSpeed_Cache_Config::OPID_JS_MINIFY,
48
- LiteSpeed_Cache_Config::OPID_JS_INLINE_MINIFY,
49
- LiteSpeed_Cache_Config::OPID_JS_COMBINE,
50
- LiteSpeed_Cache_Config::OPID_JS_COMBINED_PRIORITY,
51
- LiteSpeed_Cache_Config::OPID_JS_HTTP2,
52
- LiteSpeed_Cache_Config::OPID_HTML_MINIFY,
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,
62
- LiteSpeed_Cache_Config::OPID_OPTM_GGFONTS_ASYNC,
63
- LiteSpeed_Cache_Config::OPID_OPTM_RM_COMMENT,
64
-
65
- LiteSpeed_Cache_Config::OPID_CDN,
66
- LiteSpeed_Cache_Config::OPID_CDN_QUIC,
67
- LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE,
68
-
69
- LiteSpeed_Cache_Config::OPID_MEDIA_IMG_LAZY,
70
- LiteSpeed_Cache_Config::OPID_MEDIA_IFRAME_LAZY,
71
- LiteSpeed_Cache_Config::OPID_MEDIA_IMG_OPTM_CRON_OFF,
72
- LiteSpeed_Cache_Config::OPID_MEDIA_IMG_WEBP,
73
- LiteSpeed_Cache_Config::OPID_MEDIA_IMG_WEBP_REPLACE_SRCSET,
74
- LiteSpeed_Cache_Config::OPID_MEDIA_IMG_WEBP_ONLY,
75
- LiteSpeed_Cache_Config::OPID_MEDIA_IMG_EXIF,
76
- LiteSpeed_Cache_Config::OPID_MEDIA_IMG_WEBP_LOSSLESS,
77
- ) ;
78
  self::$purges = array(
79
  'purge_' . LiteSpeed_Cache_Config::PURGE_ALL_PAGES => LiteSpeed_Cache_Config::PURGE_ALL_PAGES,
80
  'purge_' . LiteSpeed_Cache_Config::PURGE_FRONT_PAGE => LiteSpeed_Cache_Config::PURGE_FRONT_PAGE,
@@ -131,62 +75,7 @@ class LiteSpeed_Cache_Cli_Admin
131
  $options[ LiteSpeed_Cache_Config::ID_MOBILEVIEW_LIST ] = 'Mobile|Android|Silk/|Kindle|BlackBerry|Opera\ Mini|Opera\ Mobi' ;
132
  }
133
  //fall through
134
- case LiteSpeed_Cache_Config::OPID_CACHE_PRIV:
135
- case LiteSpeed_Cache_Config::OPID_CACHE_COMMENTER:
136
- case LiteSpeed_Cache_Config::OPID_CACHE_REST:
137
- case LiteSpeed_Cache_Config::OPID_CACHE_PAGE_LOGIN:
138
- case LiteSpeed_Cache_Config::OPID_PURGE_ON_UPGRADE:
139
- case LiteSpeed_Cache_Config::OPID_CACHE_FAVICON:
140
- case LiteSpeed_Cache_Config::OPID_CACHE_RES:
141
- case LiteSpeed_Cache_Config::OPID_CACHE_OBJECT:
142
- case LiteSpeed_Cache_Config::OPID_CACHE_OBJECT_KIND:
143
-
144
- case LiteSpeed_Cache_Config::OPID_CHECK_ADVANCEDCACHE:
145
- case LiteSpeed_Cache_Config::OPID_ESI_ENABLE:
146
- case LiteSpeed_Cache_Config::OPID_ESI_CACHE_ADMBAR:
147
- case LiteSpeed_Cache_Config::OPID_ESI_CACHE_COMMFORM:
148
- case LiteSpeed_Cache_Config::CRWL_POSTS:
149
- case LiteSpeed_Cache_Config::CRWL_PAGES:
150
- case LiteSpeed_Cache_Config::CRWL_CATS:
151
- case LiteSpeed_Cache_Config::CRWL_TAGS:
152
- case LiteSpeed_Cache_Config::CRWL_CRON_ACTIVE:
153
- case LiteSpeed_Cache_Config::OPID_DEBUG_DISABLE_ALL:
154
- case LiteSpeed_Cache_Config::OPID_DEBUG_LEVEL:
155
- case LiteSpeed_Cache_Config::OPID_HEARTBEAT:
156
- case LiteSpeed_Cache_Config::OPID_DEBUG_COOKIE:
157
- case LiteSpeed_Cache_Config::OPID_COLLAPS_QS:
158
- case LiteSpeed_Cache_Config::OPID_LOG_FILTERS:
159
-
160
- case LiteSpeed_Cache_Config::OPID_CSS_MINIFY:
161
- case LiteSpeed_Cache_Config::OPID_CSS_COMBINE:
162
- case LiteSpeed_Cache_Config::OPID_JS_MINIFY:
163
- case LiteSpeed_Cache_Config::OPID_JS_COMBINE:
164
- case LiteSpeed_Cache_Config::OPID_HTML_MINIFY:
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:
174
- case LiteSpeed_Cache_Config::OPID_OPTM_GGFONTS_ASYNC:
175
- case LiteSpeed_Cache_Config::OPID_OPTM_RM_COMMENT:
176
-
177
- case LiteSpeed_Cache_Config::OPID_CDN:
178
- case LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE:
179
-
180
- case LiteSpeed_Cache_Config::OPID_ADV_INSTANT_CLICK:
181
-
182
- case LiteSpeed_Cache_Config::OPID_MEDIA_IMG_LAZY:
183
- case LiteSpeed_Cache_Config::OPID_MEDIA_IFRAME_LAZY:
184
- case LiteSpeed_Cache_Config::OPID_MEDIA_IMG_OPTM_CRON_OFF:
185
- case LiteSpeed_Cache_Config::OPID_MEDIA_IMG_WEBP:
186
- case LiteSpeed_Cache_Config::OPID_MEDIA_IMG_WEBP_REPLACE_SRCSET:
187
- case LiteSpeed_Cache_Config::OPID_MEDIA_IMG_WEBP_ONLY:
188
- case LiteSpeed_Cache_Config::OPID_MEDIA_IMG_EXIF:
189
- case LiteSpeed_Cache_Config::OPID_MEDIA_IMG_WEBP_LOSSLESS:
190
  //checkbox
191
  if ( $val === 'true' ) {
192
  $options[$key] = LiteSpeed_Cache_Config::VAL_ON ;
11
 
12
  public function __construct()
13
  {
14
+ // Build on/off options
15
+ self::$checkboxes = array() ;
16
+ foreach ( LiteSpeed_Cache_Config::get_instance()->get_default_options() as $k => $v ) {
17
+ if ( is_bool( $v ) ) {
18
+ self::$checkboxes[] = $k ;
19
+ }
20
+ }
21
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  self::$purges = array(
23
  'purge_' . LiteSpeed_Cache_Config::PURGE_ALL_PAGES => LiteSpeed_Cache_Config::PURGE_ALL_PAGES,
24
  'purge_' . LiteSpeed_Cache_Config::PURGE_FRONT_PAGE => LiteSpeed_Cache_Config::PURGE_FRONT_PAGE,
75
  $options[ LiteSpeed_Cache_Config::ID_MOBILEVIEW_LIST ] = 'Mobile|Android|Silk/|Kindle|BlackBerry|Opera\ Mini|Opera\ Mobi' ;
76
  }
77
  //fall through
78
+ case in_array( $key, self::$checkboxes ) :
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  //checkbox
80
  if ( $val === 'true' ) {
81
  $options[$key] = LiteSpeed_Cache_Config::VAL_ON ;
css/litespeed.css CHANGED
@@ -26,6 +26,10 @@
26
  display: inline-block;
27
  }
28
 
 
 
 
 
29
  .litespeed-success {
30
  color: #73b38d!important;
31
  }
@@ -76,6 +80,11 @@
76
  position: relative ;
77
  }
78
 
 
 
 
 
 
79
  .litespeed-h3{
80
  font-family: "Open Sans", Arial, sans-serif;
81
  line-height: 18px;
@@ -113,6 +122,52 @@ h3 .litespeed-learn-more {
113
  margin-left: 30px;
114
  }
115
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  /********************************* logo *******************************/
117
  @font-face {
118
  font-family: 'litespeedfont';
26
  display: inline-block;
27
  }
28
 
29
+ .litespeed-default {
30
+ color: #a7a7a7!important;
31
+ }
32
+
33
  .litespeed-success {
34
  color: #73b38d!important;
35
  }
80
  position: relative ;
81
  }
82
 
83
+ .litespeed-wrap .litespeed-right,
84
+ .litespeed-right {
85
+ float: right ;
86
+ }
87
+
88
  .litespeed-h3{
89
  font-family: "Open Sans", Arial, sans-serif;
90
  line-height: 18px;
122
  margin-left: 30px;
123
  }
124
 
125
+ /*show advanced options tab*/
126
+
127
+ .litespeed-header .litespeed-advanced-tab-show {
128
+ background: #00CC99;
129
+ color: #DDF8F1 !important;
130
+ font-weight: 600;
131
+ border-right: 1px solid #00A37A;
132
+ border-left: 1px solid #00A37A;
133
+ border-top: 1px solid #00A37A;
134
+ }
135
+
136
+ .litespeed-header .litespeed-advanced-tab-show:hover,
137
+ .litespeed-header .litespeed-advanced-tab-show:focus,
138
+ .litespeed-header .litespeed-advanced-tab-show:focus:active {
139
+ background: #00A37A;
140
+ color: #FFFFFF !important;
141
+ font-weight: 600;
142
+ border-right: 1px solid #00A37A;
143
+ border-left: 1px solid #00A37A;
144
+ border-top: 1px solid #00A37A;
145
+ border-bottom: 1px solid #00A37A;
146
+ }
147
+
148
+ /*hide advanced options tab*/
149
+
150
+ .litespeed-header .litespeed-advanced-tab-hide {
151
+ background: #99CCCC;
152
+ color: #FDFDFD !important;
153
+ font-weight: 600;
154
+ border-left: 1px solid #7AA3A3;
155
+ border-top: 1px solid #7AA3A3;
156
+ border-right: 1px solid #7AA3A3;
157
+ }
158
+
159
+ .litespeed-header .litespeed-advanced-tab-hide:hover,
160
+ .litespeed-header .litespeed-advanced-tab-hide:focus,
161
+ .litespeed-header .litespeed-advanced-tab-hide:focus:active {
162
+ background: #7AA3A3;
163
+ color: #FFFFFF !important;
164
+ font-weight: 600;
165
+ border-right: 1px solid #7AA3A3;
166
+ border-left: 1px solid #7AA3A3;
167
+ border-top: 1px solid #7AA3A3;
168
+ border-bottom: 1px solid #7AA3A3;
169
+ }
170
+
171
  /********************************* logo *******************************/
172
  @font-face {
173
  font-family: 'litespeedfont';
inc/config.class.php CHANGED
@@ -10,215 +10,10 @@
10
  * @subpackage LiteSpeed_Cache/inc
11
  * @author LiteSpeed Technologies <info@litespeedtech.com>
12
  */
13
- class LiteSpeed_Cache_Config
14
  {
15
  private static $_instance ;
16
 
17
- const OPTION_NAME = 'litespeed-cache-conf' ;
18
- const VARY_GROUP = 'litespeed-cache-vary-group' ;
19
- const EXCLUDE_OPTIMIZATION_ROLES = 'litespeed-cache-exclude-optimization-roles' ;
20
- const EXCLUDE_CACHE_ROLES = 'litespeed-cache-exclude-cache-roles' ;
21
- const ITEM_OPTM_CSS = 'litespeed-optm-css' ;// separate critical css that should be stored in option table
22
- const ITEM_OPTM_JS_DEFER_EXC = 'litespeed-optm-js-defer-excludes' ;
23
- const ITEM_MEDIA_LAZY_IMG_EXC = 'litespeed-media-lazy-img-excludes' ;
24
- const ITEM_IMG_OPTM_NEED_PULL = 'litespeed-media-need-pull' ;
25
- const ITEM_ENV_REF = 'litespeed-env-ref' ;
26
- const ITEM_CACHE_DROP_QS = 'litespeed-cache-drop_qs' ;
27
- const ITEM_CDN_MAPPING = 'litespeed-cache-cdn_mapping' ;
28
- const ITEM_DNS_PREFETCH = 'litespeed-cache-dns_prefetch' ;
29
- const ITEM_CLOUDFLARE_STATUS = 'litespeed-cache-cloudflare_status' ;
30
- const ITEM_LOG_IGNORE_FILTERS = 'litespeed-log_ignore_filters' ;
31
- const ITEM_LOG_IGNORE_PART_FILTERS = 'litespeed-log_ignore_part_filters' ;
32
- const ITEM_OBJECT_GLOBAL_GROUPS = 'litespeed-object_global_groups' ;
33
- const ITEM_OBJECT_NON_PERSISTENT_GROUPS = 'litespeed-object_non_persistent_groups' ;
34
- const ITEM_CRWL_AS_UIDS = 'litespeed-crawler-as-uids' ;
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' ;
45
- const ITEM_GUIDE = 'litespeed-guide' ; // Array of each guidance tag as key, step as val
46
-
47
- // Server variables
48
- const ENV_CRAWLER_USLEEP = 'CRAWLER_USLEEP' ;
49
- const ENV_CRAWLER_LOAD_LIMIT = 'CRAWLER_LOAD_LIMIT' ;
50
- const ENV_CRAWLER_LOAD_LIMIT_ENFORCE = 'CRAWLER_LOAD_LIMIT_ENFORCE' ;
51
-
52
- // const ITEM_FAVICON = 'litespeed-cache-favicon' ;
53
-
54
- const ITEM_CDN_MAPPING_URL = 'url' ;
55
- const ITEM_CDN_MAPPING_INC_IMG = 'inc_img' ;
56
- const ITEM_CDN_MAPPING_INC_CSS = 'inc_css' ;
57
- const ITEM_CDN_MAPPING_INC_JS = 'inc_js' ;
58
- const ITEM_CDN_MAPPING_FILETYPE = 'filetype' ;
59
-
60
- const VAL_OFF = 0 ;
61
- const VAL_ON = 1 ;
62
- const VAL_ON2 = 2 ;
63
-
64
- const LOG_LEVEL_NONE = 0 ;
65
- const LOG_LEVEL_ERROR = 1 ;
66
- const LOG_LEVEL_NOTICE = 2 ;
67
- const LOG_LEVEL_INFO = 3 ;
68
- const LOG_LEVEL_DEBUG = 4 ;
69
- const OPID_VERSION = 'version' ;
70
- const OPID_ENABLED_RADIO = 'radio_select' ;
71
-
72
- const OPID_CACHE_PRIV = 'cache_priv' ;
73
- const OPID_CACHE_COMMENTER = 'cache_commenter' ;
74
- const OPID_CACHE_REST = 'cache_rest' ;
75
- const OPID_CACHE_PAGE_LOGIN = 'cache_page_login' ;
76
- const OPID_CACHE_FAVICON = 'cache_favicon' ;
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' ;
83
- const OPID_CACHE_OBJECT_PORT = 'cache_object_port' ;
84
- const OPID_CACHE_OBJECT_LIFE = 'cache_object_life' ;
85
- const OPID_CACHE_OBJECT_PERSISTENT = 'cache_object_persistent' ;
86
- const OPID_CACHE_OBJECT_ADMIN = 'cache_object_admin' ;
87
- const OPID_CACHE_OBJECT_TRANSIENTS = 'cache_object_transients' ;
88
- const OPID_CACHE_OBJECT_DB_ID = 'cache_object_db_id' ;
89
- const OPID_CACHE_OBJECT_USER = 'cache_object_user' ;
90
- const OPID_CACHE_OBJECT_PSWD = 'cache_object_pswd' ;
91
- const OPID_CACHE_BROWSER = 'cache_browser' ;
92
- const OPID_CACHE_BROWSER_TTL = 'cache_browser_ttl' ;
93
-
94
- const OPID_PURGE_ON_UPGRADE = 'purge_upgrade' ;
95
- const OPID_TIMED_URLS = 'timed_urls' ;
96
- const OPID_TIMED_URLS_TIME = 'timed_urls_time' ;
97
-
98
- const OPID_LOGIN_COOKIE = 'login_cookie' ;
99
- const OPID_CHECK_ADVANCEDCACHE = 'check_advancedcache' ;
100
- const OPID_USE_HTTP_FOR_HTTPS_VARY = 'use_http_for_https_vary' ;
101
- // do NOT set default options for these three, it is used for admin.
102
- const ID_NOCACHE_COOKIES = 'nocache_cookies' ;
103
- const ID_NOCACHE_USERAGENTS = 'nocache_useragents' ;
104
- const OPID_DEBUG_DISABLE_ALL = 'debug_disable_all' ;
105
- const OPID_DEBUG = 'debug' ;
106
- const OPID_ADMIN_IPS = 'admin_ips' ;
107
- const OPID_DEBUG_LEVEL = 'debug_level' ;
108
- const OPID_LOG_FILE_SIZE = 'log_file_size' ;
109
- const OPID_HEARTBEAT = 'heartbeat' ;
110
- const OPID_DEBUG_COOKIE = 'debug_cookie' ;
111
- const OPID_COLLAPS_QS = 'collaps_qs' ;
112
- const OPID_LOG_FILTERS = 'log_filters' ;
113
-
114
- const OPID_PUBLIC_TTL = 'public_ttl' ;
115
- const OPID_PRIVATE_TTL = 'private_ttl' ;
116
- const OPID_FRONT_PAGE_TTL = 'front_page_ttl' ;
117
- const OPID_FEED_TTL = 'feed_ttl' ;
118
- const OPID_403_TTL = '403_ttl' ;
119
- const OPID_404_TTL = '404_ttl' ;
120
- const OPID_500_TTL = '500_ttl' ;
121
- const OPID_PURGE_BY_POST = 'purge_by_post' ;
122
- const OPID_ESI_ENABLE = 'esi_enabled' ;
123
- const OPID_ESI_CACHE_ADMBAR = 'esi_cached_admbar' ;
124
- const OPID_ESI_CACHE_COMMFORM = 'esi_cached_commform' ;
125
- const PURGE_ALL_PAGES = '-' ;
126
- const PURGE_FRONT_PAGE = 'F' ;
127
- const PURGE_HOME_PAGE = 'H' ;
128
- const PURGE_PAGES = 'PGS' ;
129
- const PURGE_PAGES_WITH_RECENT_POSTS = 'PGSRP' ;
130
- const PURGE_AUTHOR = 'A' ;
131
- const PURGE_YEAR = 'Y' ;
132
- const PURGE_MONTH = 'M' ;
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' ;
140
-
141
- // const OPID_ADV_FAVICON = 'adv_favicon' ;
142
- const OPID_ADV_INSTANT_CLICK = 'instant_click' ;
143
-
144
- const OPID_CSS_MINIFY = 'css_minify' ;
145
- const OPID_CSS_INLINE_MINIFY = 'css_inline_minify' ;
146
- const OPID_CSS_COMBINE = 'css_combine' ;
147
- const OPID_CSS_COMBINED_PRIORITY = 'css_combined_priority' ;
148
- const OPID_CSS_HTTP2 = 'css_http2' ;
149
- const OPID_CSS_EXCLUDES = 'css_exclude' ;
150
- const OPID_JS_MINIFY = 'js_minify' ;
151
- const OPID_JS_INLINE_MINIFY = 'js_inline_minify' ;
152
- const OPID_JS_COMBINE = 'js_combine' ;
153
- const OPID_JS_COMBINED_PRIORITY = 'js_combined_priority' ;
154
- const OPID_JS_HTTP2 = 'js_http2' ;
155
- const OPID_JS_EXCLUDES = 'js_exclude' ;
156
- const OPID_OPTIMIZE_TTL = 'optimize_ttl' ;
157
- const OPID_HTML_MINIFY = 'html_minify' ;
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' ;
169
- const OPID_OPTM_RM_COMMENT = 'optm_rm_comment' ;
170
-
171
- const OPID_CDN = 'cdn' ;
172
- const OPID_CDN_ORI = 'cdn_ori' ;
173
- const OPID_CDN_EXCLUDE = 'cdn_exclude' ;
174
- const OPID_CDN_REMOTE_JQUERY = 'cdn_remote_jquery' ;
175
- const OPID_CDN_QUIC = 'cdn_quic' ;
176
- const OPID_CDN_QUIC_EMAIL = 'cdn_quic_email' ;
177
- const OPID_CDN_QUIC_KEY = 'cdn_quic_key' ;
178
- const OPID_CDN_QUIC_SITE = 'cdn_quic_site' ;
179
- const OPID_CDN_CLOUDFLARE = 'cdn_cloudflare' ;
180
- const OPID_CDN_CLOUDFLARE_EMAIL = 'cdn_cloudflare_email' ;
181
- const OPID_CDN_CLOUDFLARE_KEY = 'cdn_cloudflare_key' ;
182
- const OPID_CDN_CLOUDFLARE_NAME = 'cdn_cloudflare_name' ;
183
- const OPID_CDN_CLOUDFLARE_ZONE = 'cdn_cloudflare_zone' ;
184
-
185
- const OPID_MEDIA_IMG_LAZY = 'media_img_lazy' ;
186
- const OPID_MEDIA_IMG_LAZY_PLACEHOLDER = 'media_img_lazy_placeholder' ;
187
- const OPID_MEDIA_IFRAME_LAZY = 'media_iframe_lazy' ;
188
- const OPID_MEDIA_IMG_OPTM_CRON_OFF = 'media_img_optm_cron_off' ;
189
- const OPID_MEDIA_IMG_WEBP = 'media_img_webp' ;
190
- const OPID_MEDIA_IMG_WEBP_REPLACE_SRCSET = 'media_img_webp_replace_srcset' ;
191
- const OPID_MEDIA_IMG_WEBP_ONLY = 'media_img_webp_only' ;
192
- const OPID_MEDIA_IMG_EXIF = 'media_img_exif' ;
193
- const OPID_MEDIA_IMG_WEBP_LOSSLESS = 'media_img_webp_lossless' ;
194
-
195
- const HASH = 'hash' ;
196
-
197
- const NETWORK_OPID_ENABLED = 'network_enabled' ;
198
- const NETWORK_OPID_USE_PRIMARY = 'use_primary_settings' ;
199
-
200
- const CRWL_POSTS = 'crawler_include_posts' ;
201
- const CRWL_PAGES = 'crawler_include_pages' ;
202
- const CRWL_CATS = 'crawler_include_cats' ;
203
- const CRWL_TAGS = 'crawler_include_tags' ;
204
- const CRWL_EXCLUDES_CPT = 'crawler_excludes_cpt' ;
205
- const CRWL_ORDER_LINKS = 'crawler_order_links' ;
206
- const CRWL_USLEEP = 'crawler_usleep' ;
207
- const CRWL_RUN_DURATION = 'crawler_run_duration' ;
208
- const CRWL_RUN_INTERVAL = 'crawler_run_interval' ;
209
- const CRWL_CRAWL_INTERVAL = 'crawler_crawl_interval' ;
210
- const CRWL_THREADS = 'crawler_threads' ;
211
- const CRWL_LOAD_LIMIT = 'crawler_load_limit' ;
212
- const CRWL_DOMAIN_IP = 'crawler_domain_ip' ;
213
- const CRWL_CUSTOM_SITEMAP = 'crawler_custom_sitemap' ;
214
-
215
- const CRWL_CRON_ACTIVE = 'crawler_cron_active' ;
216
-
217
- const CRWL_DATE_DESC = 'date_desc' ;
218
- const CRWL_DATE_ASC = 'date_asc' ;
219
- const CRWL_ALPHA_DESC = 'alpha_desc' ;
220
- const CRWL_ALPHA_ASC = 'alpha_asc' ;
221
-
222
  protected $options ;
223
  protected $vary_groups ;
224
  protected $exclude_optimization_roles ;
@@ -269,41 +64,6 @@ class LiteSpeed_Cache_Config
269
 
270
  }
271
 
272
- /**
273
- * Get the items in wp_options that need for backup
274
- *
275
- * @since 2.2.1
276
- * @access public
277
- */
278
- public function stored_items()
279
- {
280
- return array(
281
- self::OPTION_NAME,
282
- self::VARY_GROUP,
283
- self::EXCLUDE_OPTIMIZATION_ROLES,
284
- self::EXCLUDE_CACHE_ROLES,
285
- self::ITEM_OPTM_CSS,
286
- self::ITEM_OPTM_JS_DEFER_EXC,
287
- self::ITEM_MEDIA_LAZY_IMG_EXC,
288
- self::ITEM_IMG_OPTM_NEED_PULL,
289
- self::ITEM_ENV_REF,
290
- self::ITEM_CACHE_DROP_QS,
291
- self::ITEM_CDN_MAPPING,
292
- self::ITEM_DNS_PREFETCH,
293
- self::ITEM_CLOUDFLARE_STATUS,
294
- self::ITEM_LOG_IGNORE_FILTERS,
295
- self::ITEM_LOG_IGNORE_PART_FILTERS,
296
- self::ITEM_OBJECT_GLOBAL_GROUPS,
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
-
307
  /**
308
  * Define `LSCACHE_ADV_CACHE` based on options setting
309
  *
@@ -588,220 +348,6 @@ class LiteSpeed_Cache_Config
588
  return in_array( $flag, $this->purge_options ) ;
589
  }
590
 
591
- /**
592
- * Gets the default single site options
593
- *
594
- * @since 1.0.0
595
- * @access public
596
- * @param bool $include_thirdparty Whether to include the thirdparty options.
597
- * @return array An array of the default options.
598
- */
599
- public function get_default_options($include_thirdparty = true)
600
- {
601
- $default_purge_options = array(
602
- self::PURGE_FRONT_PAGE,
603
- self::PURGE_HOME_PAGE,
604
- self::PURGE_PAGES,
605
- self::PURGE_PAGES_WITH_RECENT_POSTS,
606
- self::PURGE_AUTHOR,
607
- self::PURGE_MONTH,
608
- self::PURGE_TERM,
609
- self::PURGE_POST_TYPE,
610
- ) ;
611
- sort($default_purge_options) ;
612
-
613
- //For multi site, default is 2 (Use Network Admin Settings). For single site, default is 1 (Enabled).
614
- if ( is_multisite() ) {
615
- $default_radio = 2 ;
616
- }
617
- else {
618
- $default_radio = 1 ;
619
- }
620
-
621
- $default_options = array(
622
- self::OPID_VERSION => LiteSpeed_Cache::PLUGIN_VERSION,
623
- self::OPID_ENABLED_RADIO => $default_radio,
624
- self::OPID_PURGE_ON_UPGRADE => true,
625
- self::OPID_CACHE_PRIV => true,
626
- self::OPID_CACHE_COMMENTER => true,
627
- self::OPID_CACHE_REST => true,
628
- self::OPID_CACHE_PAGE_LOGIN => true,
629
- self::OPID_TIMED_URLS => '',
630
- self::OPID_TIMED_URLS_TIME => '',
631
- self::OPID_CACHE_FAVICON => true,
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',
638
- self::OPID_CACHE_OBJECT_PORT => '11211',
639
- self::OPID_CACHE_OBJECT_LIFE => '360',
640
- self::OPID_CACHE_OBJECT_PERSISTENT => true,
641
- self::OPID_CACHE_OBJECT_ADMIN => true,
642
- self::OPID_CACHE_OBJECT_TRANSIENTS => true,
643
- self::OPID_CACHE_OBJECT_DB_ID => 0,
644
- self::OPID_CACHE_OBJECT_USER => '',
645
- self::OPID_CACHE_OBJECT_PSWD => '',
646
- self::OPID_CACHE_BROWSER => false,
647
- self::OPID_CACHE_BROWSER_TTL => 2592000,
648
-
649
- self::OPID_LOGIN_COOKIE => '',
650
- self::OPID_CHECK_ADVANCEDCACHE => true,
651
- self::OPID_USE_HTTP_FOR_HTTPS_VARY => false,
652
- self::OPID_DEBUG_DISABLE_ALL => false,
653
- self::OPID_DEBUG => self::LOG_LEVEL_NONE,
654
- self::OPID_ADMIN_IPS => '127.0.0.1',
655
- self::OPID_DEBUG_LEVEL => false,
656
- self::OPID_LOG_FILE_SIZE => 3,
657
- self::OPID_HEARTBEAT => true,
658
- self::OPID_DEBUG_COOKIE => false,
659
- self::OPID_COLLAPS_QS => false,
660
- self::OPID_LOG_FILTERS => false,
661
- self::OPID_PUBLIC_TTL => 604800,
662
- self::OPID_PRIVATE_TTL => 1800,
663
- self::OPID_FRONT_PAGE_TTL => 604800,
664
- self::OPID_FEED_TTL => 0,
665
- self::OPID_403_TTL => 3600,
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 => '',
672
-
673
- // self::OPID_ADV_FAVICON => false,
674
- self::OPID_ADV_INSTANT_CLICK => false,
675
-
676
- self::OPID_CSS_MINIFY => false,
677
- self::OPID_CSS_INLINE_MINIFY => false,
678
- self::OPID_CSS_COMBINE => false,
679
- self::OPID_CSS_COMBINED_PRIORITY => false,
680
- self::OPID_CSS_HTTP2 => false,
681
- self::OPID_CSS_EXCLUDES => '',
682
- self::OPID_JS_MINIFY => false,
683
- self::OPID_JS_INLINE_MINIFY => false,
684
- self::OPID_JS_COMBINE => false,
685
- self::OPID_JS_COMBINED_PRIORITY => false,
686
- self::OPID_JS_HTTP2 => false,
687
- self::OPID_JS_EXCLUDES => '',
688
- self::OPID_OPTIMIZE_TTL => 604800,
689
- self::OPID_HTML_MINIFY => false,
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,
701
- self::OPID_OPTM_RM_COMMENT => false,
702
-
703
- self::OPID_CDN => false,
704
- self::OPID_CDN_ORI => '',
705
- self::OPID_CDN_EXCLUDE => '',
706
- self::OPID_CDN_REMOTE_JQUERY => false,
707
- self::OPID_CDN_QUIC => false,
708
- self::OPID_CDN_QUIC_EMAIL => '',
709
- self::OPID_CDN_QUIC_KEY => '',
710
- self::OPID_CDN_QUIC_SITE => '',
711
- self::OPID_CDN_CLOUDFLARE => false,
712
- self::OPID_CDN_CLOUDFLARE_EMAIL => '',
713
- self::OPID_CDN_CLOUDFLARE_KEY => '',
714
- self::OPID_CDN_CLOUDFLARE_NAME => '',
715
- self::OPID_CDN_CLOUDFLARE_ZONE => '',
716
-
717
- self::OPID_MEDIA_IMG_LAZY => false,
718
- self::OPID_MEDIA_IMG_LAZY_PLACEHOLDER => '',
719
- self::OPID_MEDIA_IFRAME_LAZY => false,
720
- self::OPID_MEDIA_IMG_OPTM_CRON_OFF => false,
721
- self::OPID_MEDIA_IMG_WEBP => false,
722
- self::OPID_MEDIA_IMG_WEBP_REPLACE_SRCSET => false,
723
- self::OPID_MEDIA_IMG_WEBP_ONLY => false,
724
- self::OPID_MEDIA_IMG_EXIF => false,
725
- self::OPID_MEDIA_IMG_WEBP_LOSSLESS => false,
726
-
727
- self::HASH => '',
728
-
729
- self::ID_NOCACHE_COOKIES => '',
730
- self::ID_NOCACHE_USERAGENTS => '',
731
- self::CRWL_POSTS => true,
732
- self::CRWL_PAGES => true,
733
- self::CRWL_CATS => true,
734
- self::CRWL_TAGS => true,
735
- self::CRWL_EXCLUDES_CPT => '',
736
- self::CRWL_ORDER_LINKS => self::CRWL_DATE_DESC,
737
- self::CRWL_USLEEP => 500,
738
- self::CRWL_RUN_DURATION => 400,
739
- self::CRWL_RUN_INTERVAL => 600,
740
- self::CRWL_CRAWL_INTERVAL => 302400,
741
- self::CRWL_THREADS => 3,
742
- self::CRWL_LOAD_LIMIT => 1,
743
- self::CRWL_DOMAIN_IP => '',
744
- self::CRWL_CUSTOM_SITEMAP => '',
745
- self::CRWL_CRON_ACTIVE => false,
746
- ) ;
747
-
748
- if ( LSWCP_ESI_SUPPORT ) {
749
- $default_options[self::OPID_ESI_ENABLE] = false ;
750
- $default_options[self::OPID_ESI_CACHE_ADMBAR] = true ;
751
- $default_options[self::OPID_ESI_CACHE_COMMFORM] = true ;
752
- }
753
-
754
- if ( ! $include_thirdparty ) {
755
- return $default_options ;
756
- }
757
-
758
- $tp_options = $this->get_thirdparty_options($default_options) ;
759
- if ( ! isset($tp_options) || ! is_array($tp_options) ) {
760
- return $default_options ;
761
- }
762
- return array_merge($default_options, $tp_options) ;
763
- }
764
-
765
- /**
766
- * Gets the default network options
767
- *
768
- * @since 1.0.11
769
- * @access protected
770
- * @return array An array of the default options.
771
- */
772
- protected function get_default_site_options()
773
- {
774
- $default_site_options = array(
775
- self::OPID_VERSION => LiteSpeed_Cache::PLUGIN_VERSION,
776
- self::NETWORK_OPID_ENABLED => false,
777
- self::NETWORK_OPID_USE_PRIMARY => false,
778
- self::OPID_PURGE_ON_UPGRADE => true,
779
- self::OPID_CACHE_FAVICON => true,
780
- self::OPID_CACHE_RES => true,
781
- self::OPID_CACHE_MOBILE => 0, // todo: why not false
782
- self::ID_MOBILEVIEW_LIST => false,
783
- self::OPID_CACHE_OBJECT => false,
784
- self::OPID_CACHE_OBJECT_KIND => false,
785
- self::OPID_CACHE_OBJECT_HOST => 'localhost',
786
- self::OPID_CACHE_OBJECT_PORT => '11211',
787
- self::OPID_CACHE_OBJECT_LIFE => '360',
788
- self::OPID_CACHE_OBJECT_PERSISTENT => true,
789
- self::OPID_CACHE_OBJECT_ADMIN => true,
790
- self::OPID_CACHE_OBJECT_TRANSIENTS => true,
791
- self::OPID_CACHE_OBJECT_DB_ID => 0,
792
- self::OPID_CACHE_OBJECT_USER => '',
793
- self::OPID_CACHE_OBJECT_PSWD => '',
794
- self::OPID_CACHE_BROWSER => false,
795
- self::OPID_CACHE_BROWSER_TTL => 2592000,
796
- self::OPID_LOGIN_COOKIE => '',
797
- self::OPID_CHECK_ADVANCEDCACHE => true,
798
- self::ID_NOCACHE_COOKIES => '',
799
- self::ID_NOCACHE_USERAGENTS => '',
800
- self::OPID_MEDIA_IMG_WEBP => false,
801
- ) ;
802
- return $default_site_options ;
803
- }
804
-
805
  /**
806
  * Get item val
807
  *
@@ -822,41 +368,6 @@ class LiteSpeed_Cache_Config
822
  return $val ;
823
  }
824
 
825
- /**
826
- * Get default item val
827
- *
828
- * @since 1.8
829
- * @access public
830
- */
831
- public function default_item( $k )
832
- {
833
- switch ( $k ) {
834
- case self::ITEM_OBJECT_GLOBAL_GROUPS :
835
- return "users\nuserlogins\nusermeta\nuser_meta\nsite-transient\nsite-options\nsite-lookup\nblog-lookup\nblog-details\nrss\nglobal-posts\nblog-id-cache" ;
836
-
837
- case self::ITEM_OBJECT_NON_PERSISTENT_GROUPS :
838
- return "comment\ncounts\nplugins" ;
839
-
840
- case self::ITEM_ADV_PURGE_ALL_HOOKS :
841
- return "switch_theme\nwp_create_nav_menu\nwp_update_nav_menu\nwp_delete_nav_menu\ncreate_term\nedit_terms\ndelete_term\nadd_link\nedit_link\ndelete_link" ;
842
-
843
- case self::ITEM_CDN_ORI_DIR :
844
- return LSCWP_CONTENT_FOLDER . "\nwp-includes\n/min/" ;
845
-
846
- case self::ITEM_MEDIA_WEBP_ATTRIBUTE :
847
- return "img.src\n" .
848
- "div.data-thumb\n" .
849
- "img.data-src\n" .
850
- "div.data-large_image\n" .
851
- "img.retina_logo_url" ;
852
-
853
- default :
854
- break ;
855
- }
856
-
857
- return false ;
858
- }
859
-
860
  /**
861
  * Get the plugin's site wide options.
862
  *
@@ -883,26 +394,6 @@ class LiteSpeed_Cache_Config
883
  return $default_site_options ;
884
  }
885
 
886
- /**
887
- * Gets the third party options.
888
- * Will also strip the options that are actually normal options.
889
- *
890
- * @access public
891
- * @since 1.0.9
892
- * @param array $options Optional. The default options to compare against.
893
- * @return mixed boolean on failure, array of keys on success.
894
- */
895
- public function get_thirdparty_options($options = null)
896
- {
897
- $tp_options = apply_filters('litespeed_cache_get_options', array()) ;
898
- if ( empty($tp_options) ) {
899
- return false ;
900
- }
901
- if ( ! isset($options) ) {
902
- $options = $this->get_default_options(false) ;
903
- }
904
- return array_diff_key($tp_options, $options) ;
905
- }
906
 
907
  /**
908
  * Helper function to convert the options to replicate the input format.
10
  * @subpackage LiteSpeed_Cache/inc
11
  * @author LiteSpeed Technologies <info@litespeedtech.com>
12
  */
13
+ class LiteSpeed_Cache_Config extends LiteSpeed_Cache_Const
14
  {
15
  private static $_instance ;
16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  protected $options ;
18
  protected $vary_groups ;
19
  protected $exclude_optimization_roles ;
64
 
65
  }
66
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  /**
68
  * Define `LSCACHE_ADV_CACHE` based on options setting
69
  *
348
  return in_array( $flag, $this->purge_options ) ;
349
  }
350
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
351
  /**
352
  * Get item val
353
  *
368
  return $val ;
369
  }
370
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
371
  /**
372
  * Get the plugin's site wide options.
373
  *
394
  return $default_site_options ;
395
  }
396
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
397
 
398
  /**
399
  * Helper function to convert the options to replicate the input format.
inc/const.cls.php ADDED
@@ -0,0 +1,527 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The core consts for config
4
+ *
5
+ * @since 2.4
6
+ * @package LiteSpeed_Cache
7
+ * @subpackage LiteSpeed_Cache/inc
8
+ * @author LiteSpeed Technologies <info@litespeedtech.com>
9
+ */
10
+ class LiteSpeed_Cache_Const
11
+ {
12
+ const OPTION_NAME = 'litespeed-cache-conf' ;
13
+ const VARY_GROUP = 'litespeed-cache-vary-group' ;
14
+ const EXCLUDE_OPTIMIZATION_ROLES = 'litespeed-cache-exclude-optimization-roles' ;
15
+ const EXCLUDE_CACHE_ROLES = 'litespeed-cache-exclude-cache-roles' ;
16
+ const ITEM_OPTM_CSS = 'litespeed-optm-css' ;// separate critical css that should be stored in option table
17
+ const ITEM_OPTM_JS_DEFER_EXC = 'litespeed-optm-js-defer-excludes' ;
18
+ const ITEM_MEDIA_LAZY_IMG_EXC = 'litespeed-media-lazy-img-excludes' ;
19
+ const ITEM_IMG_OPTM_NEED_PULL = 'litespeed-media-need-pull' ;
20
+ const ITEM_ENV_REF = 'litespeed-env-ref' ;
21
+ const ITEM_CACHE_DROP_QS = 'litespeed-cache-drop_qs' ;
22
+ const ITEM_CDN_MAPPING = 'litespeed-cache-cdn_mapping' ;
23
+ const ITEM_DNS_PREFETCH = 'litespeed-cache-dns_prefetch' ;
24
+ const ITEM_CLOUDFLARE_STATUS = 'litespeed-cache-cloudflare_status' ;
25
+ const ITEM_LOG_IGNORE_FILTERS = 'litespeed-log_ignore_filters' ;
26
+ const ITEM_LOG_IGNORE_PART_FILTERS = 'litespeed-log_ignore_part_filters' ;
27
+ const ITEM_OBJECT_GLOBAL_GROUPS = 'litespeed-object_global_groups' ;
28
+ const ITEM_OBJECT_NON_PERSISTENT_GROUPS = 'litespeed-object_non_persistent_groups' ;
29
+ const ITEM_CRWL_AS_UIDS = 'litespeed-crawler-as-uids' ;
30
+ const ITEM_ADV_PURGE_ALL_HOOKS = 'litespeed-adv-purge_all_hooks' ;
31
+ const ITEM_CDN_ORI_DIR = 'litespeed-cdn-ori_dir' ;
32
+ const ITEM_MEDIA_WEBP_ATTRIBUTE = 'litespeed-media-webp_attribute' ;
33
+ const ITEM_FORCE_CACHE_URI = 'litespeed-forced_cache_uri' ;
34
+ const ITEM_CACHE_URI_PRIV = 'litespeed-cache_uri_priv' ;
35
+ const ITEM_OPTM_EXCLUDES = 'litespeed-optm_excludes' ;
36
+ const ITEM_EXCLUDES_URI = 'litespeed-excludes_uri' ;
37
+
38
+ const ITEM_SETTING_MODE = 'litespeed-setting-mode' ;
39
+ const ITEM_CRAWLER_HASH = 'litespeed-crawler-hash' ;
40
+ const ITEM_GUIDE = 'litespeed-guide' ; // Array of each guidance tag as key, step as val
41
+
42
+ // Server variables
43
+ const ENV_CRAWLER_USLEEP = 'CRAWLER_USLEEP' ;
44
+ const ENV_CRAWLER_LOAD_LIMIT = 'CRAWLER_LOAD_LIMIT' ;
45
+ const ENV_CRAWLER_LOAD_LIMIT_ENFORCE = 'CRAWLER_LOAD_LIMIT_ENFORCE' ;
46
+
47
+ // const ITEM_FAVICON = 'litespeed-cache-favicon' ;
48
+
49
+ const ITEM_CDN_MAPPING_URL = 'url' ;
50
+ const ITEM_CDN_MAPPING_INC_IMG = 'inc_img' ;
51
+ const ITEM_CDN_MAPPING_INC_CSS = 'inc_css' ;
52
+ const ITEM_CDN_MAPPING_INC_JS = 'inc_js' ;
53
+ const ITEM_CDN_MAPPING_FILETYPE = 'filetype' ;
54
+
55
+ const VAL_OFF = 0 ;
56
+ const VAL_ON = 1 ;
57
+ const VAL_ON2 = 2 ;
58
+
59
+ const LOG_LEVEL_NONE = 0 ;
60
+ const LOG_LEVEL_ERROR = 1 ;
61
+ const LOG_LEVEL_NOTICE = 2 ;
62
+ const LOG_LEVEL_INFO = 3 ;
63
+ const LOG_LEVEL_DEBUG = 4 ;
64
+ const OPID_VERSION = 'version' ;
65
+ const OPID_ENABLED_RADIO = 'radio_select' ;
66
+
67
+ const OPID_CACHE_PRIV = 'cache_priv' ;
68
+ const OPID_CACHE_COMMENTER = 'cache_commenter' ;
69
+ const OPID_CACHE_REST = 'cache_rest' ;
70
+ const OPID_CACHE_PAGE_LOGIN = 'cache_page_login' ;
71
+ const OPID_CACHE_FAVICON = 'cache_favicon' ;
72
+ const OPID_CACHE_RES = 'cache_resources' ;
73
+ const OPID_CACHE_MOBILE = 'mobileview_enabled' ;
74
+ const ID_MOBILEVIEW_LIST = 'mobileview_rules' ;
75
+ const OPID_CACHE_OBJECT = 'cache_object' ;
76
+ const OPID_CACHE_OBJECT_KIND = 'cache_object_kind' ;
77
+ const OPID_CACHE_OBJECT_HOST = 'cache_object_host' ;
78
+ const OPID_CACHE_OBJECT_PORT = 'cache_object_port' ;
79
+ const OPID_CACHE_OBJECT_LIFE = 'cache_object_life' ;
80
+ const OPID_CACHE_OBJECT_PERSISTENT = 'cache_object_persistent' ;
81
+ const OPID_CACHE_OBJECT_ADMIN = 'cache_object_admin' ;
82
+ const OPID_CACHE_OBJECT_TRANSIENTS = 'cache_object_transients' ;
83
+ const OPID_CACHE_OBJECT_DB_ID = 'cache_object_db_id' ;
84
+ const OPID_CACHE_OBJECT_USER = 'cache_object_user' ;
85
+ const OPID_CACHE_OBJECT_PSWD = 'cache_object_pswd' ;
86
+ const OPID_CACHE_BROWSER = 'cache_browser' ;
87
+ const OPID_CACHE_BROWSER_TTL = 'cache_browser_ttl' ;
88
+
89
+ const OPID_PURGE_ON_UPGRADE = 'purge_upgrade' ;
90
+ const OPID_TIMED_URLS = 'timed_urls' ;
91
+ const OPID_TIMED_URLS_TIME = 'timed_urls_time' ;
92
+
93
+ const OPID_LOGIN_COOKIE = 'login_cookie' ;
94
+ const OPID_CHECK_ADVANCEDCACHE = 'check_advancedcache' ;
95
+ const OPID_USE_HTTP_FOR_HTTPS_VARY = 'use_http_for_https_vary' ;
96
+ // do NOT set default options for these three, it is used for admin.
97
+ const ID_NOCACHE_COOKIES = 'nocache_cookies' ;
98
+ const ID_NOCACHE_USERAGENTS = 'nocache_useragents' ;
99
+ const OPID_DEBUG_DISABLE_ALL = 'debug_disable_all' ;
100
+ const OPID_DEBUG = 'debug' ;
101
+ const OPID_ADMIN_IPS = 'admin_ips' ;
102
+ const OPID_DEBUG_LEVEL = 'debug_level' ;
103
+ const OPID_LOG_FILE_SIZE = 'log_file_size' ;
104
+ const OPID_HEARTBEAT = 'heartbeat' ;
105
+ const OPID_DEBUG_COOKIE = 'debug_cookie' ;
106
+ const OPID_COLLAPS_QS = 'collaps_qs' ;
107
+ const OPID_LOG_FILTERS = 'log_filters' ;
108
+
109
+ const OPID_PUBLIC_TTL = 'public_ttl' ;
110
+ const OPID_PRIVATE_TTL = 'private_ttl' ;
111
+ const OPID_FRONT_PAGE_TTL = 'front_page_ttl' ;
112
+ const OPID_FEED_TTL = 'feed_ttl' ;
113
+ const OPID_403_TTL = '403_ttl' ;
114
+ const OPID_404_TTL = '404_ttl' ;
115
+ const OPID_500_TTL = '500_ttl' ;
116
+ const OPID_PURGE_BY_POST = 'purge_by_post' ;
117
+ const OPID_ESI_ENABLE = 'esi_enabled' ;
118
+ const OPID_ESI_CACHE_ADMBAR = 'esi_cached_admbar' ;
119
+ const OPID_ESI_CACHE_COMMFORM = 'esi_cached_commform' ;
120
+ const PURGE_ALL_PAGES = '-' ;
121
+ const PURGE_FRONT_PAGE = 'F' ;
122
+ const PURGE_HOME_PAGE = 'H' ;
123
+ const PURGE_PAGES = 'PGS' ;
124
+ const PURGE_PAGES_WITH_RECENT_POSTS = 'PGSRP' ;
125
+ const PURGE_AUTHOR = 'A' ;
126
+ const PURGE_YEAR = 'Y' ;
127
+ const PURGE_MONTH = 'M' ;
128
+ const PURGE_DATE = 'D' ;
129
+ const PURGE_TERM = 'T' ; // include category|tag|tax
130
+ const PURGE_POST_TYPE = 'PT' ;
131
+
132
+ const OPID_EXCLUDES_QS = 'excludes_qs' ;
133
+ const OPID_EXCLUDES_CAT = 'excludes_cat' ;
134
+ const OPID_EXCLUDES_TAG = 'excludes_tag' ;
135
+
136
+ // const OPID_ADV_FAVICON = 'adv_favicon' ;
137
+ const OPID_ADV_INSTANT_CLICK = 'instant_click' ;
138
+
139
+ const OPID_CSS_MINIFY = 'css_minify' ;
140
+ const OPID_CSS_INLINE_MINIFY = 'css_inline_minify' ;
141
+ const OPID_CSS_COMBINE = 'css_combine' ;
142
+ const OPID_CSS_COMBINED_PRIORITY = 'css_combined_priority' ;
143
+ const OPID_CSS_HTTP2 = 'css_http2' ;
144
+ const OPID_CSS_EXCLUDES = 'css_exclude' ;
145
+ const OPID_JS_MINIFY = 'js_minify' ;
146
+ const OPID_JS_INLINE_MINIFY = 'js_inline_minify' ;
147
+ const OPID_JS_COMBINE = 'js_combine' ;
148
+ const OPID_JS_COMBINED_PRIORITY = 'js_combined_priority' ;
149
+ const OPID_JS_HTTP2 = 'js_http2' ;
150
+ const OPID_JS_EXCLUDES = 'js_exclude' ;
151
+ const OPID_OPTIMIZE_TTL = 'optimize_ttl' ;
152
+ const OPID_HTML_MINIFY = 'html_minify' ;
153
+ const OPID_OPTM_QS_RM = 'optm_qs_rm' ;
154
+ const OPID_OPTM_GGFONTS_RM = 'optm_ggfonts_rm' ;
155
+ const OPID_OPTM_CSS_ASYNC = 'optm_css_async' ;
156
+ const OPT_OPTM_CCSS_GEN = 'optm_ccss_gen' ;
157
+ const OPT_OPTM_CCSS_ASYNC = 'optm_ccss_async' ;
158
+ const OPT_OPTM_CSS_ASYNC_INLINE = 'optm_css_async_inline' ;
159
+ const OPID_OPTM_JS_DEFER = 'optm_js_defer' ;
160
+ const OPID_OPTM_EMOJI_RM = 'optm_emoji_rm' ;
161
+ const OPID_OPTM_EXC_JQUERY = 'optm_exclude_jquery' ;
162
+ const OPID_OPTM_GGFONTS_ASYNC = 'optm_ggfonts_async' ;
163
+ const OPID_OPTM_MAX_SIZE = 'optm_max_size' ;
164
+ const OPID_OPTM_RM_COMMENT = 'optm_rm_comment' ;
165
+
166
+ const OPID_CDN = 'cdn' ;
167
+ const OPID_CDN_ORI = 'cdn_ori' ;
168
+ const OPID_CDN_EXCLUDE = 'cdn_exclude' ;
169
+ const OPID_CDN_REMOTE_JQUERY = 'cdn_remote_jquery' ;
170
+ const OPID_CDN_QUIC = 'cdn_quic' ;
171
+ const OPID_CDN_QUIC_EMAIL = 'cdn_quic_email' ;
172
+ const OPID_CDN_QUIC_KEY = 'cdn_quic_key' ;
173
+ const OPID_CDN_QUIC_SITE = 'cdn_quic_site' ;
174
+ const OPID_CDN_CLOUDFLARE = 'cdn_cloudflare' ;
175
+ const OPID_CDN_CLOUDFLARE_EMAIL = 'cdn_cloudflare_email' ;
176
+ const OPID_CDN_CLOUDFLARE_KEY = 'cdn_cloudflare_key' ;
177
+ const OPID_CDN_CLOUDFLARE_NAME = 'cdn_cloudflare_name' ;
178
+ const OPID_CDN_CLOUDFLARE_ZONE = 'cdn_cloudflare_zone' ;
179
+
180
+ const OPID_MEDIA_IMG_LAZY = 'media_img_lazy' ;
181
+ const OPID_MEDIA_IMG_LAZY_PLACEHOLDER = 'media_img_lazy_placeholder' ;
182
+ const OPID_MEDIA_IFRAME_LAZY = 'media_iframe_lazy' ;
183
+ const OPT_MEDIA_OPTM_AUTO = 'media_optm_auto' ;
184
+ const OPT_MEDIA_OPTM_CRON = 'media_optm_cron' ;
185
+ const OPT_MEDIA_OPTM_ORI = 'media_optm_ori' ;
186
+ const OPT_MEDIA_OPTM_WEBP = 'media_optm_webp' ;
187
+ const OPT_MEDIA_OPTM_LOSSLESS = 'media_optm_lossless' ;
188
+ const OPT_MEDIA_OPTM_EXIF = 'media_optm_exif' ;
189
+ const OPT_MEDIA_WEBP_REPLACE = 'media_webp_replace' ;
190
+ const OPT_MEDIA_WEBP_REPLACE_SRCSET = 'media_webp_replace_srcset' ;
191
+
192
+ const HASH = 'hash' ;
193
+
194
+ const NETWORK_OPID_ENABLED = 'network_enabled' ;
195
+ const NETWORK_OPID_USE_PRIMARY = 'use_primary_settings' ;
196
+
197
+ const CRWL_POSTS = 'crawler_include_posts' ;
198
+ const CRWL_PAGES = 'crawler_include_pages' ;
199
+ const CRWL_CATS = 'crawler_include_cats' ;
200
+ const CRWL_TAGS = 'crawler_include_tags' ;
201
+ const CRWL_EXCLUDES_CPT = 'crawler_excludes_cpt' ;
202
+ const CRWL_ORDER_LINKS = 'crawler_order_links' ;
203
+ const CRWL_USLEEP = 'crawler_usleep' ;
204
+ const CRWL_RUN_DURATION = 'crawler_run_duration' ;
205
+ const CRWL_RUN_INTERVAL = 'crawler_run_interval' ;
206
+ const CRWL_CRAWL_INTERVAL = 'crawler_crawl_interval' ;
207
+ const CRWL_THREADS = 'crawler_threads' ;
208
+ const CRWL_LOAD_LIMIT = 'crawler_load_limit' ;
209
+ const CRWL_DOMAIN_IP = 'crawler_domain_ip' ;
210
+ const CRWL_CUSTOM_SITEMAP = 'crawler_custom_sitemap' ;
211
+
212
+ const CRWL_CRON_ACTIVE = 'crawler_cron_active' ;
213
+
214
+ const CRWL_DATE_DESC = 'date_desc' ;
215
+ const CRWL_DATE_ASC = 'date_asc' ;
216
+ const CRWL_ALPHA_DESC = 'alpha_desc' ;
217
+ const CRWL_ALPHA_ASC = 'alpha_asc' ;
218
+
219
+ /**
220
+ * Get the items in wp_options that need for backup
221
+ *
222
+ * @since 2.2.1
223
+ * @access public
224
+ */
225
+ public function stored_items()
226
+ {
227
+ return array(
228
+ self::OPTION_NAME,
229
+ self::VARY_GROUP,
230
+ self::EXCLUDE_OPTIMIZATION_ROLES,
231
+ self::EXCLUDE_CACHE_ROLES,
232
+ self::ITEM_OPTM_CSS,
233
+ self::ITEM_OPTM_JS_DEFER_EXC,
234
+ self::ITEM_MEDIA_LAZY_IMG_EXC,
235
+ self::ITEM_IMG_OPTM_NEED_PULL,
236
+ self::ITEM_ENV_REF,
237
+ self::ITEM_CACHE_DROP_QS,
238
+ self::ITEM_CDN_MAPPING,
239
+ self::ITEM_DNS_PREFETCH,
240
+ self::ITEM_CLOUDFLARE_STATUS,
241
+ self::ITEM_LOG_IGNORE_FILTERS,
242
+ self::ITEM_LOG_IGNORE_PART_FILTERS,
243
+ self::ITEM_OBJECT_GLOBAL_GROUPS,
244
+ self::ITEM_OBJECT_NON_PERSISTENT_GROUPS,
245
+ self::ITEM_CRWL_AS_UIDS,
246
+ self::ITEM_ADV_PURGE_ALL_HOOKS,
247
+ self::ITEM_FORCE_CACHE_URI,
248
+ self::ITEM_CACHE_URI_PRIV,
249
+ self::ITEM_OPTM_EXCLUDES,
250
+ self::ITEM_EXCLUDES_URI,
251
+ ) ;
252
+ }
253
+
254
+ /**
255
+ * Get default item val
256
+ *
257
+ * @since 1.8
258
+ * @access public
259
+ */
260
+ public function default_item( $k )
261
+ {
262
+ switch ( $k ) {
263
+ case self::ITEM_OBJECT_GLOBAL_GROUPS :
264
+ return "users\nuserlogins\nusermeta\nuser_meta\nsite-transient\nsite-options\nsite-lookup\nblog-lookup\nblog-details\nrss\nglobal-posts\nblog-id-cache" ;
265
+
266
+ case self::ITEM_OBJECT_NON_PERSISTENT_GROUPS :
267
+ return "comment\ncounts\nplugins" ;
268
+
269
+ case self::ITEM_ADV_PURGE_ALL_HOOKS :
270
+ return "switch_theme\nwp_create_nav_menu\nwp_update_nav_menu\nwp_delete_nav_menu\ncreate_term\nedit_terms\ndelete_term\nadd_link\nedit_link\ndelete_link" ;
271
+
272
+ case self::ITEM_CDN_ORI_DIR :
273
+ return LSCWP_CONTENT_FOLDER . "\nwp-includes\n/min/" ;
274
+
275
+ case self::ITEM_MEDIA_WEBP_ATTRIBUTE :
276
+ return "img.src\n" .
277
+ "div.data-thumb\n" .
278
+ "img.data-src\n" .
279
+ "div.data-large_image\n" .
280
+ "img.retina_logo_url" ;
281
+
282
+ default :
283
+ break ;
284
+ }
285
+
286
+ return false ;
287
+ }
288
+
289
+ /**
290
+ * Gets the default network options
291
+ *
292
+ * @since 1.0.11
293
+ * @access protected
294
+ * @return array An array of the default options.
295
+ */
296
+ protected function get_default_site_options()
297
+ {
298
+ $default_site_options = array(
299
+ self::OPID_VERSION => LiteSpeed_Cache::PLUGIN_VERSION,
300
+ self::NETWORK_OPID_ENABLED => false,
301
+ self::NETWORK_OPID_USE_PRIMARY => false,
302
+ self::OPID_PURGE_ON_UPGRADE => true,
303
+ self::OPID_CACHE_FAVICON => true,
304
+ self::OPID_CACHE_RES => true,
305
+ self::OPID_CACHE_MOBILE => 0, // todo: why not false
306
+ self::ID_MOBILEVIEW_LIST => false,
307
+ self::OPID_CACHE_OBJECT => false,
308
+ self::OPID_CACHE_OBJECT_KIND => false,
309
+ self::OPID_CACHE_OBJECT_HOST => 'localhost',
310
+ self::OPID_CACHE_OBJECT_PORT => '11211',
311
+ self::OPID_CACHE_OBJECT_LIFE => '360',
312
+ self::OPID_CACHE_OBJECT_PERSISTENT => true,
313
+ self::OPID_CACHE_OBJECT_ADMIN => true,
314
+ self::OPID_CACHE_OBJECT_TRANSIENTS => true,
315
+ self::OPID_CACHE_OBJECT_DB_ID => 0,
316
+ self::OPID_CACHE_OBJECT_USER => '',
317
+ self::OPID_CACHE_OBJECT_PSWD => '',
318
+ self::OPID_CACHE_BROWSER => false,
319
+ self::OPID_CACHE_BROWSER_TTL => 2592000,
320
+ self::OPID_LOGIN_COOKIE => '',
321
+ self::OPID_CHECK_ADVANCEDCACHE => true,
322
+ self::ID_NOCACHE_COOKIES => '',
323
+ self::ID_NOCACHE_USERAGENTS => '',
324
+ self::OPT_MEDIA_WEBP_REPLACE => false,
325
+ ) ;
326
+ return $default_site_options ;
327
+ }
328
+
329
+ /**
330
+ * Gets the default single site options
331
+ *
332
+ * @since 1.0.0
333
+ * @access public
334
+ * @param bool $include_thirdparty Whether to include the thirdparty options.
335
+ * @return array An array of the default options.
336
+ */
337
+ public function get_default_options($include_thirdparty = true)
338
+ {
339
+ $default_purge_options = array(
340
+ self::PURGE_FRONT_PAGE,
341
+ self::PURGE_HOME_PAGE,
342
+ self::PURGE_PAGES,
343
+ self::PURGE_PAGES_WITH_RECENT_POSTS,
344
+ self::PURGE_AUTHOR,
345
+ self::PURGE_MONTH,
346
+ self::PURGE_TERM,
347
+ self::PURGE_POST_TYPE,
348
+ ) ;
349
+ sort($default_purge_options) ;
350
+
351
+ //For multi site, default is 2 (Use Network Admin Settings). For single site, default is 1 (Enabled).
352
+ if ( is_multisite() ) {
353
+ $default_radio = 2 ;
354
+ }
355
+ else {
356
+ $default_radio = 1 ;
357
+ }
358
+
359
+ $default_options = array(
360
+ self::OPID_VERSION => LiteSpeed_Cache::PLUGIN_VERSION,
361
+ self::OPID_ENABLED_RADIO => $default_radio,
362
+ self::OPID_PURGE_ON_UPGRADE => true,
363
+ self::OPID_CACHE_PRIV => true,
364
+ self::OPID_CACHE_COMMENTER => true,
365
+ self::OPID_CACHE_REST => true,
366
+ self::OPID_CACHE_PAGE_LOGIN => true,
367
+ self::OPID_TIMED_URLS => '',
368
+ self::OPID_TIMED_URLS_TIME => '',
369
+ self::OPID_CACHE_FAVICON => true,
370
+ self::OPID_CACHE_RES => true,
371
+ self::OPID_CACHE_MOBILE => false,
372
+ self::ID_MOBILEVIEW_LIST => false,
373
+ self::OPID_CACHE_OBJECT => false,
374
+ self::OPID_CACHE_OBJECT_KIND => false,
375
+ self::OPID_CACHE_OBJECT_HOST => 'localhost',
376
+ self::OPID_CACHE_OBJECT_PORT => '11211',
377
+ self::OPID_CACHE_OBJECT_LIFE => '360',
378
+ self::OPID_CACHE_OBJECT_PERSISTENT => true,
379
+ self::OPID_CACHE_OBJECT_ADMIN => true,
380
+ self::OPID_CACHE_OBJECT_TRANSIENTS => true,
381
+ self::OPID_CACHE_OBJECT_DB_ID => 0,
382
+ self::OPID_CACHE_OBJECT_USER => '',
383
+ self::OPID_CACHE_OBJECT_PSWD => '',
384
+ self::OPID_CACHE_BROWSER => false,
385
+ self::OPID_CACHE_BROWSER_TTL => 2592000,
386
+
387
+ self::OPID_LOGIN_COOKIE => '',
388
+ self::OPID_CHECK_ADVANCEDCACHE => true,
389
+ self::OPID_USE_HTTP_FOR_HTTPS_VARY => false,
390
+ self::OPID_DEBUG_DISABLE_ALL => false,
391
+ self::OPID_DEBUG => self::LOG_LEVEL_NONE,
392
+ self::OPID_ADMIN_IPS => '127.0.0.1',
393
+ self::OPID_DEBUG_LEVEL => false,
394
+ self::OPID_LOG_FILE_SIZE => 3,
395
+ self::OPID_HEARTBEAT => true,
396
+ self::OPID_DEBUG_COOKIE => false,
397
+ self::OPID_COLLAPS_QS => false,
398
+ self::OPID_LOG_FILTERS => false,
399
+ self::OPID_PUBLIC_TTL => 604800,
400
+ self::OPID_PRIVATE_TTL => 1800,
401
+ self::OPID_FRONT_PAGE_TTL => 604800,
402
+ self::OPID_FEED_TTL => 0,
403
+ self::OPID_403_TTL => 3600,
404
+ self::OPID_404_TTL => 3600,
405
+ self::OPID_500_TTL => 3600,
406
+ self::OPID_PURGE_BY_POST => implode('.', $default_purge_options),
407
+ self::OPID_EXCLUDES_QS => '',
408
+ self::OPID_EXCLUDES_CAT => '',
409
+ self::OPID_EXCLUDES_TAG => '',
410
+
411
+ // self::OPID_ADV_FAVICON => false,
412
+ self::OPID_ADV_INSTANT_CLICK => false,
413
+
414
+ self::OPID_CSS_MINIFY => false,
415
+ self::OPID_CSS_INLINE_MINIFY => false,
416
+ self::OPID_CSS_COMBINE => false,
417
+ self::OPID_CSS_COMBINED_PRIORITY => false,
418
+ self::OPID_CSS_HTTP2 => false,
419
+ self::OPID_CSS_EXCLUDES => '',
420
+ self::OPID_JS_MINIFY => false,
421
+ self::OPID_JS_INLINE_MINIFY => false,
422
+ self::OPID_JS_COMBINE => false,
423
+ self::OPID_JS_COMBINED_PRIORITY => false,
424
+ self::OPID_JS_HTTP2 => false,
425
+ self::OPID_JS_EXCLUDES => '',
426
+ self::OPID_OPTIMIZE_TTL => 604800,
427
+ self::OPID_HTML_MINIFY => false,
428
+ self::OPID_OPTM_QS_RM => false,
429
+ self::OPID_OPTM_GGFONTS_RM => false,
430
+ self::OPID_OPTM_CSS_ASYNC => false,
431
+ self::OPT_OPTM_CCSS_GEN => true,
432
+ self::OPT_OPTM_CCSS_ASYNC => true,
433
+ self::OPT_OPTM_CSS_ASYNC_INLINE => true,
434
+ self::OPID_OPTM_JS_DEFER => false,
435
+ self::OPID_OPTM_EMOJI_RM => false,
436
+ self::OPID_OPTM_EXC_JQUERY => true,
437
+ self::OPID_OPTM_GGFONTS_ASYNC => false,
438
+ self::OPID_OPTM_MAX_SIZE => 1.2,
439
+ self::OPID_OPTM_RM_COMMENT => false,
440
+
441
+ self::OPID_CDN => false,
442
+ self::OPID_CDN_ORI => '',
443
+ self::OPID_CDN_EXCLUDE => '',
444
+ self::OPID_CDN_REMOTE_JQUERY => false,
445
+ self::OPID_CDN_QUIC => false,
446
+ self::OPID_CDN_QUIC_EMAIL => '',
447
+ self::OPID_CDN_QUIC_KEY => '',
448
+ self::OPID_CDN_QUIC_SITE => '',
449
+ self::OPID_CDN_CLOUDFLARE => false,
450
+ self::OPID_CDN_CLOUDFLARE_EMAIL => '',
451
+ self::OPID_CDN_CLOUDFLARE_KEY => '',
452
+ self::OPID_CDN_CLOUDFLARE_NAME => '',
453
+ self::OPID_CDN_CLOUDFLARE_ZONE => '',
454
+
455
+ self::OPID_MEDIA_IMG_LAZY => false,
456
+ self::OPID_MEDIA_IMG_LAZY_PLACEHOLDER => '',
457
+ self::OPID_MEDIA_IFRAME_LAZY => false,
458
+ self::OPT_MEDIA_OPTM_AUTO => false,
459
+ self::OPT_MEDIA_OPTM_CRON => true,
460
+ self::OPT_MEDIA_OPTM_ORI => true,
461
+ self::OPT_MEDIA_OPTM_WEBP => false,
462
+ self::OPT_MEDIA_OPTM_LOSSLESS => false,
463
+ self::OPT_MEDIA_OPTM_EXIF => false,
464
+ self::OPT_MEDIA_WEBP_REPLACE => false,
465
+ self::OPT_MEDIA_WEBP_REPLACE_SRCSET => false,
466
+
467
+ self::HASH => '',
468
+
469
+ self::ID_NOCACHE_COOKIES => '',
470
+ self::ID_NOCACHE_USERAGENTS => '',
471
+ self::CRWL_POSTS => true,
472
+ self::CRWL_PAGES => true,
473
+ self::CRWL_CATS => true,
474
+ self::CRWL_TAGS => true,
475
+ self::CRWL_EXCLUDES_CPT => '',
476
+ self::CRWL_ORDER_LINKS => self::CRWL_DATE_DESC,
477
+ self::CRWL_USLEEP => 500,
478
+ self::CRWL_RUN_DURATION => 400,
479
+ self::CRWL_RUN_INTERVAL => 600,
480
+ self::CRWL_CRAWL_INTERVAL => 302400,
481
+ self::CRWL_THREADS => 3,
482
+ self::CRWL_LOAD_LIMIT => 1,
483
+ self::CRWL_DOMAIN_IP => '',
484
+ self::CRWL_CUSTOM_SITEMAP => '',
485
+ self::CRWL_CRON_ACTIVE => false,
486
+ ) ;
487
+
488
+ if ( LSWCP_ESI_SUPPORT ) {
489
+ $default_options[self::OPID_ESI_ENABLE] = false ;
490
+ $default_options[self::OPID_ESI_CACHE_ADMBAR] = true ;
491
+ $default_options[self::OPID_ESI_CACHE_COMMFORM] = true ;
492
+ }
493
+
494
+ if ( ! $include_thirdparty ) {
495
+ return $default_options ;
496
+ }
497
+
498
+ $tp_options = $this->get_thirdparty_options($default_options) ;
499
+ if ( ! isset($tp_options) || ! is_array($tp_options) ) {
500
+ return $default_options ;
501
+ }
502
+ return array_merge($default_options, $tp_options) ;
503
+ }
504
+
505
+
506
+ /**
507
+ * Gets the third party options.
508
+ * Will also strip the options that are actually normal options.
509
+ *
510
+ * @access public
511
+ * @since 1.0.9
512
+ * @param array $options Optional. The default options to compare against.
513
+ * @return mixed boolean on failure, array of keys on success.
514
+ */
515
+ public function get_thirdparty_options($options = null)
516
+ {
517
+ $tp_options = apply_filters('litespeed_cache_get_options', array()) ;
518
+ if ( empty($tp_options) ) {
519
+ return false ;
520
+ }
521
+ if ( ! isset($options) ) {
522
+ $options = $this->get_default_options(false) ;
523
+ }
524
+ return array_diff_key($tp_options, $options) ;
525
+ }
526
+
527
+ }
inc/crawler.class.php CHANGED
@@ -488,7 +488,7 @@ class LiteSpeed_Cache_Crawler
488
  $roles = $roles ? explode( "\n", $roles ) : array() ;
489
 
490
  // WebP on/off
491
- $webp = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_MEDIA_IMG_WEBP ) ;
492
 
493
  if ( $count_only ) {
494
  $count = count( $roles ) + 1 ;
488
  $roles = $roles ? explode( "\n", $roles ) : array() ;
489
 
490
  // WebP on/off
491
+ $webp = LiteSpeed_Cache_Media::webp_enabled() ;
492
 
493
  if ( $count_only ) {
494
  $count = count( $roles ) + 1 ;
inc/img_optm.class.php CHANGED
@@ -609,10 +609,11 @@ class LiteSpeed_Cache_Img_Optm
609
  private function _push_img_in_queue_to_iapi()
610
  {
611
  $data = array(
612
- 'list' => $this->_img_in_queue,
613
- 'webp_only' => LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_MEDIA_IMG_WEBP_ONLY ),
614
- 'keep_exif' => LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_MEDIA_IMG_EXIF ),
615
- 'webp_lossless' => LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_MEDIA_IMG_WEBP_LOSSLESS ),
 
616
  ) ;
617
 
618
  // Push to LiteSpeed IAPI server
@@ -747,7 +748,7 @@ class LiteSpeed_Cache_Img_Optm
747
  * @since 1.6
748
  * @access private
749
  */
750
- private function _pull_optimized_img()
751
  {
752
  if ( $this->cron_running() ) {
753
  LiteSpeed_Cache_Log::debug( '[Img_Optm] fetch cron is running' ) ;
@@ -762,10 +763,13 @@ class LiteSpeed_Cache_Img_Optm
762
  WHERE a.root_id = 0 AND a.optm_status = %s ORDER BY a.id LIMIT 1" ;
763
  $_q = $wpdb->prepare( $q, array( self::DB_IMG_OPTIMIZE_SIZE, self::DB_IMG_OPTIMIZE_STATUS_NOTIFIED ) ) ;
764
 
765
- $webp_only = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_MEDIA_IMG_WEBP_ONLY ) ;
 
766
 
767
- // pull 10 images each time
768
- for ( $i=0 ; $i < 10 ; $i++ ) {
 
 
769
  $row_img = $wpdb->get_row( $_q ) ;
770
  if ( ! $row_img ) {
771
  // No image
@@ -797,71 +801,25 @@ class LiteSpeed_Cache_Img_Optm
797
  'src_md5' => $row_img->src_md5,
798
  ) ;
799
  $json = LiteSpeed_Cache_Admin_API::post( LiteSpeed_Cache_Admin_API::IAPI_ACTION_PULL_IMG, $data, $server, true ) ;
800
- if ( empty( $json[ 'webp' ] ) ) {
 
 
801
  LiteSpeed_Cache_Log::debug( '[Img_Optm] Failed to pull optimized img: ', $json ) ;
802
  return ;
803
  }
804
 
805
  $local_file = $this->wp_upload_dir[ 'basedir' ] . '/' . $row_img->src ;
806
 
807
- /**
808
- * Use wp orignal get func to avoid allow_url_open off issue
809
- * @since 1.6.5
810
- */
811
- // Fetch webp image
812
- $response = wp_remote_get( $json[ 'webp' ], array( 'timeout' => 15 ) ) ;
813
- if ( is_wp_error( $response ) ) {
814
- $error_message = $response->get_error_message() ;
815
- LiteSpeed_Cache_Log::debug( 'IAPI failed to pull image: ' . $error_message ) ;
816
- return ;
817
- }
818
-
819
- file_put_contents( $local_file . '.webp', $response[ 'body' ] ) ;
820
-
821
- if ( ! file_exists( $local_file . '.webp' ) ) {
822
- return ;
823
- }
824
-
825
- // Unknown issue
826
- if ( md5_file( $local_file . '.webp' ) !== $json[ 'webp_md5' ] ) {
827
- LiteSpeed_Cache_Log::debug( '[Img_Optm] Failed to pull optimized img WebP: file md5 dismatch, server md5: ' . $json[ 'webp_md5' ] ) ;
828
-
829
- // update status to failed
830
- $q = "UPDATE $this->_table_img_optm SET optm_status = %s WHERE id = %d " ;
831
- $wpdb->query( $wpdb->prepare( $q, array( self::DB_IMG_OPTIMIZE_STATUS_FAILED, $row_img->id ) ) ) ;
832
- // Update child images
833
- $q = "UPDATE $this->_table_img_optm SET optm_status = %s WHERE root_id = %d " ;
834
- $wpdb->query( $wpdb->prepare( $q, array( self::DB_IMG_OPTIMIZE_STATUS_FAILED, $row_img->id ) ) ) ;
835
-
836
- // Notify server to update status
837
- LiteSpeed_Cache_Admin_API::post( LiteSpeed_Cache_Admin_API::IAPI_ACTION_PULL_IMG_FAILED, $data, $server, true ) ;
838
-
839
- return ;// exit from running pull process
840
- }
841
-
842
- $ori_size = $row_img->src_filesize ?: filesize( $local_file ) ;
843
-
844
- // log webp file saved size summary
845
- $webp_size = filesize( $local_file . '.webp' ) ;
846
- $webp_saved = $ori_size - $webp_size ;
847
- if ( $webp_saved > 0 ) {
848
- $optm_info[ 'webp_total' ] += $ori_size ;
849
- $optm_info[ 'webp_saved' ] += $webp_saved ;
850
- }
851
- else {
852
- $webp_saved = 0 ;
853
- }
854
-
855
- LiteSpeed_Cache_Log::debug( '[Img_Optm] Pulled optimized img WebP: ' . $local_file . '.webp' ) ;
856
-
857
- // Fetch optimized image itself
858
  $target_size = 0 ;
859
  $target_saved = 0 ;
860
- if ( ! $webp_only && ! empty( $json[ 'target_file' ] ) ) {
861
-
862
- // Fetch failed, unkown issue, return
863
- // NOTE: if this failed more than 5 times, next time fetching webp will touch err limit on server side, whole image will be failed
864
- $response = wp_remote_get( $json[ 'target_file' ], array( 'timeout' => 15 ) ) ;
 
 
865
  if ( is_wp_error( $response ) ) {
866
  $error_message = $response->get_error_message() ;
867
  LiteSpeed_Cache_Log::debug( 'IAPI failed to pull image: ' . $error_message ) ;
@@ -869,9 +827,9 @@ class LiteSpeed_Cache_Img_Optm
869
  }
870
 
871
  file_put_contents( $local_file . '.tmp', $response[ 'body' ] ) ;
872
- // Unknown issue
873
- if ( md5_file( $local_file . '.tmp' ) !== $json[ 'target_md5' ] ) {
874
- LiteSpeed_Cache_Log::debug( '[Img_Optm] Failed to pull optimized img iteself: file md5 dismatch, server md5: ' . $json[ 'target_md5' ] ) ;
875
 
876
  // update status to failed
877
  $q = "UPDATE $this->_table_img_optm SET optm_status = %s WHERE id = %d " ;
@@ -886,17 +844,6 @@ class LiteSpeed_Cache_Img_Optm
886
  return ; // exit from running pull process
887
  }
888
 
889
- // log webp file saved size summary
890
- $target_size = filesize( $local_file . '.tmp' ) ;
891
- $target_saved = $ori_size - $target_size ;
892
- if ( $target_saved > 0 ) {
893
- $optm_info[ 'ori_total' ] += $ori_size ;
894
- $optm_info[ 'ori_saved' ] += $target_saved ;
895
- }
896
- else {
897
- $target_saved = 0 ;
898
- }
899
-
900
  // Backup ori img
901
  $extension = pathinfo( $local_file, PATHINFO_EXTENSION ) ;
902
  $bk_file = substr( $local_file, 0, -strlen( $extension ) ) . 'bk.' . $extension ;
@@ -906,6 +853,49 @@ class LiteSpeed_Cache_Img_Optm
906
  rename( $local_file . '.tmp', $local_file ) ;
907
 
908
  LiteSpeed_Cache_Log::debug( '[Img_Optm] Pulled optimized img: ' . $local_file ) ;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
909
  }
910
 
911
  LiteSpeed_Cache_Log::debug2( '[Img_Optm] Update _table_img_optm record [id] ' . $row_img->id ) ;
@@ -914,7 +904,7 @@ class LiteSpeed_Cache_Img_Optm
914
  $q = "UPDATE $this->_table_img_optm SET optm_status = %s, target_filesize = %d, target_saved = %d, webp_filesize = %d, webp_saved = %d WHERE id = %d " ;
915
  $wpdb->query( $wpdb->prepare( $q, array( self::DB_IMG_OPTIMIZE_STATUS_PULLED, $target_size, $target_saved, $webp_size, $webp_saved, $row_img->id ) ) ) ;
916
 
917
- // Update child images
918
  $q = "UPDATE $this->_table_img_optm SET optm_status = %s, target_filesize = %d, target_saved = %d, webp_filesize = %d, webp_saved = %d WHERE root_id = %d " ;
919
  $child_count = $wpdb->query( $wpdb->prepare( $q, array( self::DB_IMG_OPTIMIZE_STATUS_PULLED, $target_size, $target_saved, $webp_size, $webp_saved, $row_img->id ) ) ) ;
920
 
@@ -975,6 +965,9 @@ class LiteSpeed_Cache_Img_Optm
975
  $wpdb->query( $wpdb->prepare( $q, $pids_data_to_insert ) ) ;
976
  }
977
  }
 
 
 
978
  }
979
 
980
  // Update guidance
@@ -1358,6 +1351,9 @@ class LiteSpeed_Cache_Img_Optm
1358
  private function _update_credit( $credit )
1359
  {
1360
  $summary = get_option( self::DB_IMG_OPTM_SUMMARY, array() ) ;
 
 
 
1361
  $summary[ 'credit' ] = $credit ;
1362
 
1363
  update_option( self::DB_IMG_OPTM_SUMMARY, $summary ) ;
@@ -1640,6 +1636,8 @@ class LiteSpeed_Cache_Img_Optm
1640
  }
1641
 
1642
  LiteSpeed_Cache_Log::debug( '[Img_Optm] batch switched images total: ' . $i ) ;
 
 
1643
 
1644
  }
1645
 
609
  private function _push_img_in_queue_to_iapi()
610
  {
611
  $data = array(
612
+ 'list' => $this->_img_in_queue,
613
+ 'optm_ori' => LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPT_MEDIA_OPTM_ORI ) ? 1 : 0,
614
+ 'optm_webp' => LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPT_MEDIA_OPTM_WEBP ) ? 1 : 0,
615
+ 'optm_lossless' => LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPT_MEDIA_OPTM_LOSSLESS ) ? 1 : 0,
616
+ 'keep_exif' => LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPT_MEDIA_OPTM_EXIF ) ? 1 : 0,
617
  ) ;
618
 
619
  // Push to LiteSpeed IAPI server
748
  * @since 1.6
749
  * @access private
750
  */
751
+ private function _pull_optimized_img( $manual = false )
752
  {
753
  if ( $this->cron_running() ) {
754
  LiteSpeed_Cache_Log::debug( '[Img_Optm] fetch cron is running' ) ;
763
  WHERE a.root_id = 0 AND a.optm_status = %s ORDER BY a.id LIMIT 1" ;
764
  $_q = $wpdb->prepare( $q, array( self::DB_IMG_OPTIMIZE_SIZE, self::DB_IMG_OPTIMIZE_STATUS_NOTIFIED ) ) ;
765
 
766
+ $optm_ori = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPT_MEDIA_OPTM_ORI ) ;
767
+ $optm_webp = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPT_MEDIA_OPTM_WEBP ) ;
768
 
769
+ // pull 1min images each time
770
+ $end_time = time() + ( $manual ? 120 : 60 ) ;
771
+
772
+ while ( time() < $end_time ) {
773
  $row_img = $wpdb->get_row( $_q ) ;
774
  if ( ! $row_img ) {
775
  // No image
801
  'src_md5' => $row_img->src_md5,
802
  ) ;
803
  $json = LiteSpeed_Cache_Admin_API::post( LiteSpeed_Cache_Admin_API::IAPI_ACTION_PULL_IMG, $data, $server, true ) ;
804
+
805
+ // Check if data interrupt or not
806
+ if ( empty( $json[ 'ok' ] ) ) {
807
  LiteSpeed_Cache_Log::debug( '[Img_Optm] Failed to pull optimized img: ', $json ) ;
808
  return ;
809
  }
810
 
811
  $local_file = $this->wp_upload_dir[ 'basedir' ] . '/' . $row_img->src ;
812
 
813
+ // Save ori optm image
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
814
  $target_size = 0 ;
815
  $target_saved = 0 ;
816
+ if ( ! empty( $json[ 'ori' ] ) ) {
817
+ /**
818
+ * Use wp orignal get func to avoid allow_url_open off issue
819
+ * @since 1.6.5
820
+ */
821
+ // Fetch
822
+ $response = wp_remote_get( $json[ 'ori' ], array( 'timeout' => 15 ) ) ;
823
  if ( is_wp_error( $response ) ) {
824
  $error_message = $response->get_error_message() ;
825
  LiteSpeed_Cache_Log::debug( 'IAPI failed to pull image: ' . $error_message ) ;
827
  }
828
 
829
  file_put_contents( $local_file . '.tmp', $response[ 'body' ] ) ;
830
+
831
+ if ( ! file_exists( $local_file . '.tmp' ) || md5_file( $local_file . '.tmp' ) !== $json[ 'ori_md5' ] ) {
832
+ LiteSpeed_Cache_Log::debug( '[Img_Optm] Failed to pull optimized img: file md5 dismatch, server md5: ' . $json[ 'ori_md5' ] ) ;
833
 
834
  // update status to failed
835
  $q = "UPDATE $this->_table_img_optm SET optm_status = %s WHERE id = %d " ;
844
  return ; // exit from running pull process
845
  }
846
 
 
 
 
 
 
 
 
 
 
 
 
847
  // Backup ori img
848
  $extension = pathinfo( $local_file, PATHINFO_EXTENSION ) ;
849
  $bk_file = substr( $local_file, 0, -strlen( $extension ) ) . 'bk.' . $extension ;
853
  rename( $local_file . '.tmp', $local_file ) ;
854
 
855
  LiteSpeed_Cache_Log::debug( '[Img_Optm] Pulled optimized img: ' . $local_file ) ;
856
+
857
+ $optm_info[ 'ori_total' ] += $json[ 'src_size' ] ;
858
+ $optm_info[ 'ori_saved' ] += $json[ 'ori_reduced' ] ;
859
+ $target_size = filesize( $local_file ) ;
860
+ $target_saved = $json[ 'ori_reduced' ] ;
861
+ }
862
+
863
+ // Save webp image
864
+ $webp_size = 0 ;
865
+ $webp_saved = 0 ;
866
+ if ( ! empty( $json[ 'webp' ] ) ) {
867
+ // Fetch
868
+ $response = wp_remote_get( $json[ 'webp' ], array( 'timeout' => 15 ) ) ;
869
+ if ( is_wp_error( $response ) ) {
870
+ $error_message = $response->get_error_message() ;
871
+ LiteSpeed_Cache_Log::debug( 'IAPI failed to pull webp image: ' . $error_message ) ;
872
+ return ;
873
+ }
874
+
875
+ file_put_contents( $local_file . '.webp', $response[ 'body' ] ) ;
876
+
877
+ if ( ! file_exists( $local_file . '.webp' ) || md5_file( $local_file . '.webp' ) !== $json[ 'webp_md5' ] ) {
878
+ LiteSpeed_Cache_Log::debug( '[Img_Optm] Failed to pull optimized webp img: file md5 dismatch, server md5: ' . $json[ 'webp_md5' ] ) ;
879
+
880
+ // update status to failed
881
+ $q = "UPDATE $this->_table_img_optm SET optm_status = %s WHERE id = %d " ;
882
+ $wpdb->query( $wpdb->prepare( $q, array( self::DB_IMG_OPTIMIZE_STATUS_FAILED, $row_img->id ) ) ) ;
883
+ // Update child images
884
+ $q = "UPDATE $this->_table_img_optm SET optm_status = %s WHERE root_id = %d " ;
885
+ $wpdb->query( $wpdb->prepare( $q, array( self::DB_IMG_OPTIMIZE_STATUS_FAILED, $row_img->id ) ) ) ;
886
+
887
+ // Notify server to update status
888
+ LiteSpeed_Cache_Admin_API::post( LiteSpeed_Cache_Admin_API::IAPI_ACTION_PULL_IMG_FAILED, $data, $server, true ) ;
889
+
890
+ return ; // exit from running pull process
891
+ }
892
+
893
+ LiteSpeed_Cache_Log::debug( '[Img_Optm] Pulled optimized img WebP: ' . $local_file . '.webp' ) ;
894
+
895
+ $optm_info[ 'webp_total' ] += $json[ 'src_size' ] ;
896
+ $optm_info[ 'webp_saved' ] += $json[ 'webp_reduced' ] ;
897
+ $webp_size = filesize( $local_file . '.webp' ) ;
898
+ $webp_saved = $json[ 'webp_reduced' ] ;
899
  }
900
 
901
  LiteSpeed_Cache_Log::debug2( '[Img_Optm] Update _table_img_optm record [id] ' . $row_img->id ) ;
904
  $q = "UPDATE $this->_table_img_optm SET optm_status = %s, target_filesize = %d, target_saved = %d, webp_filesize = %d, webp_saved = %d WHERE id = %d " ;
905
  $wpdb->query( $wpdb->prepare( $q, array( self::DB_IMG_OPTIMIZE_STATUS_PULLED, $target_size, $target_saved, $webp_size, $webp_saved, $row_img->id ) ) ) ;
906
 
907
+ // Update child images ( same md5 files )
908
  $q = "UPDATE $this->_table_img_optm SET optm_status = %s, target_filesize = %d, target_saved = %d, webp_filesize = %d, webp_saved = %d WHERE root_id = %d " ;
909
  $child_count = $wpdb->query( $wpdb->prepare( $q, array( self::DB_IMG_OPTIMIZE_STATUS_PULLED, $target_size, $target_saved, $webp_size, $webp_saved, $row_img->id ) ) ) ;
910
 
965
  $wpdb->query( $wpdb->prepare( $q, $pids_data_to_insert ) ) ;
966
  }
967
  }
968
+
969
+ // Recover credit
970
+ $this->_update_credit( '++' ) ;
971
  }
972
 
973
  // Update guidance
1351
  private function _update_credit( $credit )
1352
  {
1353
  $summary = get_option( self::DB_IMG_OPTM_SUMMARY, array() ) ;
1354
+ if ( $credit === '++' ) {
1355
+ $credit = $summary[ 'credit' ] + 1 ;
1356
+ }
1357
  $summary[ 'credit' ] = $credit ;
1358
 
1359
  update_option( self::DB_IMG_OPTM_SUMMARY, $summary ) ;
1636
  }
1637
 
1638
  LiteSpeed_Cache_Log::debug( '[Img_Optm] batch switched images total: ' . $i ) ;
1639
+ $msg = __( 'Switched images successfully.', 'litespeed-cache' ) ;
1640
+ LiteSpeed_Cache_Admin_Display::add_notice( LiteSpeed_Cache_Admin_Display::NOTICE_GREEN, $msg ) ;
1641
 
1642
  }
1643
 
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.3.1' ;
23
 
24
  const PAGE_EDIT_HTACCESS = 'lscache-edit-htaccess' ;
25
 
19
  private static $_instance ;
20
 
21
  const PLUGIN_NAME = 'litespeed-cache' ;
22
+ const PLUGIN_VERSION = '2.4' ;
23
 
24
  const PAGE_EDIT_HTACCESS = 'lscache-edit-htaccess' ;
25
 
inc/litespeed.autoload.php CHANGED
@@ -30,6 +30,7 @@ if ( !function_exists('_litespeed_autoload') ) {
30
  'LiteSpeed_Cache_CDN_Quiccloud' => 'inc/cdn/quiccloud.class.php',
31
  'LiteSpeed_Cache_Config' => 'inc/config.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',
30
  'LiteSpeed_Cache_CDN_Quiccloud' => 'inc/cdn/quiccloud.class.php',
31
  'LiteSpeed_Cache_Config' => 'inc/config.class.php',
32
  'LiteSpeed_Cache_Control' => 'inc/control.class.php',
33
+ 'LiteSpeed_Cache_Const' => 'inc/const.cls.php',
34
  'LiteSpeed_Cache_Crawler' => 'inc/crawler.class.php',
35
  'LiteSpeed_Cache_Crawler_Sitemap' => 'inc/crawler-sitemap.class.php',
36
  'LiteSpeed_Cache_CSS' => 'inc/css.cls.php',
inc/media.class.php CHANGED
@@ -36,7 +36,7 @@ class LiteSpeed_Cache_Media
36
  if ( $this->can_media() ) {
37
  $this->_static_request_check() ;
38
 
39
- $this->cfg_img_webp = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_MEDIA_IMG_WEBP ) ;
40
 
41
  // Due to ajax call doesn't send correct accept header, have to limit webp to HTML only
42
  if ( $this->cfg_img_webp ) {
@@ -78,6 +78,17 @@ class LiteSpeed_Cache_Media
78
  return true ;
79
  }
80
 
 
 
 
 
 
 
 
 
 
 
 
81
  /**
82
  * Register admin menu
83
  *
@@ -556,7 +567,7 @@ class LiteSpeed_Cache_Media
556
 
557
  // parse srcset
558
  // todo: should apply this to cdn too
559
- if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_MEDIA_IMG_WEBP_REPLACE_SRCSET ) ) {
560
  $this->content = LiteSpeed_Cache_Utility::srcset_replace( $this->content, array( $this, 'replace_webp' ) ) ;
561
  }
562
 
36
  if ( $this->can_media() ) {
37
  $this->_static_request_check() ;
38
 
39
+ $this->cfg_img_webp = self::webp_enabled() ;
40
 
41
  // Due to ajax call doesn't send correct accept header, have to limit webp to HTML only
42
  if ( $this->cfg_img_webp ) {
78
  return true ;
79
  }
80
 
81
+ /**
82
+ * Check if enabled webp or not
83
+ *
84
+ * @since 2.4
85
+ * @access public
86
+ */
87
+ public static function webp_enabled()
88
+ {
89
+ return LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPT_MEDIA_WEBP_REPLACE ) ;
90
+ }
91
+
92
  /**
93
  * Register admin menu
94
  *
567
 
568
  // parse srcset
569
  // todo: should apply this to cdn too
570
+ if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPT_MEDIA_WEBP_REPLACE_SRCSET ) ) {
571
  $this->content = LiteSpeed_Cache_Utility::srcset_replace( $this->content, array( $this, 'replace_webp' ) ) ;
572
  }
573
 
inc/task.class.php CHANGED
@@ -39,7 +39,7 @@ class LiteSpeed_Cache_Task
39
  }
40
 
41
  // Register img optimization fetch ( always fetch immediately )
42
- if ( ! LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_MEDIA_IMG_OPTM_CRON_OFF ) && LiteSpeed_Cache_Img_Optm::check_need_pull() ) {
43
  self::schedule_filter_imgoptm() ;
44
 
45
  add_action( self::CRON_ACTION_HOOK_IMGOPTM, 'LiteSpeed_Cache_Img_Optm::pull_optimized_img' ) ;
39
  }
40
 
41
  // Register img optimization fetch ( always fetch immediately )
42
+ if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPT_MEDIA_OPTM_CRON ) && LiteSpeed_Cache_Img_Optm::check_need_pull() ) {
43
  self::schedule_filter_imgoptm() ;
44
 
45
  add_action( self::CRON_ACTION_HOOK_IMGOPTM, 'LiteSpeed_Cache_Img_Optm::pull_optimized_img' ) ;
includes/litespeed-cache-config.class.php CHANGED
@@ -10,215 +10,10 @@
10
  * @subpackage LiteSpeed_Cache/inc
11
  * @author LiteSpeed Technologies <info@litespeedtech.com>
12
  */
13
- class LiteSpeed_Cache_Config
14
  {
15
  private static $_instance ;
16
 
17
- const OPTION_NAME = 'litespeed-cache-conf' ;
18
- const VARY_GROUP = 'litespeed-cache-vary-group' ;
19
- const EXCLUDE_OPTIMIZATION_ROLES = 'litespeed-cache-exclude-optimization-roles' ;
20
- const EXCLUDE_CACHE_ROLES = 'litespeed-cache-exclude-cache-roles' ;
21
- const ITEM_OPTM_CSS = 'litespeed-optm-css' ;// separate critical css that should be stored in option table
22
- const ITEM_OPTM_JS_DEFER_EXC = 'litespeed-optm-js-defer-excludes' ;
23
- const ITEM_MEDIA_LAZY_IMG_EXC = 'litespeed-media-lazy-img-excludes' ;
24
- const ITEM_IMG_OPTM_NEED_PULL = 'litespeed-media-need-pull' ;
25
- const ITEM_ENV_REF = 'litespeed-env-ref' ;
26
- const ITEM_CACHE_DROP_QS = 'litespeed-cache-drop_qs' ;
27
- const ITEM_CDN_MAPPING = 'litespeed-cache-cdn_mapping' ;
28
- const ITEM_DNS_PREFETCH = 'litespeed-cache-dns_prefetch' ;
29
- const ITEM_CLOUDFLARE_STATUS = 'litespeed-cache-cloudflare_status' ;
30
- const ITEM_LOG_IGNORE_FILTERS = 'litespeed-log_ignore_filters' ;
31
- const ITEM_LOG_IGNORE_PART_FILTERS = 'litespeed-log_ignore_part_filters' ;
32
- const ITEM_OBJECT_GLOBAL_GROUPS = 'litespeed-object_global_groups' ;
33
- const ITEM_OBJECT_NON_PERSISTENT_GROUPS = 'litespeed-object_non_persistent_groups' ;
34
- const ITEM_CRWL_AS_UIDS = 'litespeed-crawler-as-uids' ;
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' ;
45
- const ITEM_GUIDE = 'litespeed-guide' ; // Array of each guidance tag as key, step as val
46
-
47
- // Server variables
48
- const ENV_CRAWLER_USLEEP = 'CRAWLER_USLEEP' ;
49
- const ENV_CRAWLER_LOAD_LIMIT = 'CRAWLER_LOAD_LIMIT' ;
50
- const ENV_CRAWLER_LOAD_LIMIT_ENFORCE = 'CRAWLER_LOAD_LIMIT_ENFORCE' ;
51
-
52
- // const ITEM_FAVICON = 'litespeed-cache-favicon' ;
53
-
54
- const ITEM_CDN_MAPPING_URL = 'url' ;
55
- const ITEM_CDN_MAPPING_INC_IMG = 'inc_img' ;
56
- const ITEM_CDN_MAPPING_INC_CSS = 'inc_css' ;
57
- const ITEM_CDN_MAPPING_INC_JS = 'inc_js' ;
58
- const ITEM_CDN_MAPPING_FILETYPE = 'filetype' ;
59
-
60
- const VAL_OFF = 0 ;
61
- const VAL_ON = 1 ;
62
- const VAL_ON2 = 2 ;
63
-
64
- const LOG_LEVEL_NONE = 0 ;
65
- const LOG_LEVEL_ERROR = 1 ;
66
- const LOG_LEVEL_NOTICE = 2 ;
67
- const LOG_LEVEL_INFO = 3 ;
68
- const LOG_LEVEL_DEBUG = 4 ;
69
- const OPID_VERSION = 'version' ;
70
- const OPID_ENABLED_RADIO = 'radio_select' ;
71
-
72
- const OPID_CACHE_PRIV = 'cache_priv' ;
73
- const OPID_CACHE_COMMENTER = 'cache_commenter' ;
74
- const OPID_CACHE_REST = 'cache_rest' ;
75
- const OPID_CACHE_PAGE_LOGIN = 'cache_page_login' ;
76
- const OPID_CACHE_FAVICON = 'cache_favicon' ;
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' ;
83
- const OPID_CACHE_OBJECT_PORT = 'cache_object_port' ;
84
- const OPID_CACHE_OBJECT_LIFE = 'cache_object_life' ;
85
- const OPID_CACHE_OBJECT_PERSISTENT = 'cache_object_persistent' ;
86
- const OPID_CACHE_OBJECT_ADMIN = 'cache_object_admin' ;
87
- const OPID_CACHE_OBJECT_TRANSIENTS = 'cache_object_transients' ;
88
- const OPID_CACHE_OBJECT_DB_ID = 'cache_object_db_id' ;
89
- const OPID_CACHE_OBJECT_USER = 'cache_object_user' ;
90
- const OPID_CACHE_OBJECT_PSWD = 'cache_object_pswd' ;
91
- const OPID_CACHE_BROWSER = 'cache_browser' ;
92
- const OPID_CACHE_BROWSER_TTL = 'cache_browser_ttl' ;
93
-
94
- const OPID_PURGE_ON_UPGRADE = 'purge_upgrade' ;
95
- const OPID_TIMED_URLS = 'timed_urls' ;
96
- const OPID_TIMED_URLS_TIME = 'timed_urls_time' ;
97
-
98
- const OPID_LOGIN_COOKIE = 'login_cookie' ;
99
- const OPID_CHECK_ADVANCEDCACHE = 'check_advancedcache' ;
100
- const OPID_USE_HTTP_FOR_HTTPS_VARY = 'use_http_for_https_vary' ;
101
- // do NOT set default options for these three, it is used for admin.
102
- const ID_NOCACHE_COOKIES = 'nocache_cookies' ;
103
- const ID_NOCACHE_USERAGENTS = 'nocache_useragents' ;
104
- const OPID_DEBUG_DISABLE_ALL = 'debug_disable_all' ;
105
- const OPID_DEBUG = 'debug' ;
106
- const OPID_ADMIN_IPS = 'admin_ips' ;
107
- const OPID_DEBUG_LEVEL = 'debug_level' ;
108
- const OPID_LOG_FILE_SIZE = 'log_file_size' ;
109
- const OPID_HEARTBEAT = 'heartbeat' ;
110
- const OPID_DEBUG_COOKIE = 'debug_cookie' ;
111
- const OPID_COLLAPS_QS = 'collaps_qs' ;
112
- const OPID_LOG_FILTERS = 'log_filters' ;
113
-
114
- const OPID_PUBLIC_TTL = 'public_ttl' ;
115
- const OPID_PRIVATE_TTL = 'private_ttl' ;
116
- const OPID_FRONT_PAGE_TTL = 'front_page_ttl' ;
117
- const OPID_FEED_TTL = 'feed_ttl' ;
118
- const OPID_403_TTL = '403_ttl' ;
119
- const OPID_404_TTL = '404_ttl' ;
120
- const OPID_500_TTL = '500_ttl' ;
121
- const OPID_PURGE_BY_POST = 'purge_by_post' ;
122
- const OPID_ESI_ENABLE = 'esi_enabled' ;
123
- const OPID_ESI_CACHE_ADMBAR = 'esi_cached_admbar' ;
124
- const OPID_ESI_CACHE_COMMFORM = 'esi_cached_commform' ;
125
- const PURGE_ALL_PAGES = '-' ;
126
- const PURGE_FRONT_PAGE = 'F' ;
127
- const PURGE_HOME_PAGE = 'H' ;
128
- const PURGE_PAGES = 'PGS' ;
129
- const PURGE_PAGES_WITH_RECENT_POSTS = 'PGSRP' ;
130
- const PURGE_AUTHOR = 'A' ;
131
- const PURGE_YEAR = 'Y' ;
132
- const PURGE_MONTH = 'M' ;
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' ;
140
-
141
- // const OPID_ADV_FAVICON = 'adv_favicon' ;
142
- const OPID_ADV_INSTANT_CLICK = 'instant_click' ;
143
-
144
- const OPID_CSS_MINIFY = 'css_minify' ;
145
- const OPID_CSS_INLINE_MINIFY = 'css_inline_minify' ;
146
- const OPID_CSS_COMBINE = 'css_combine' ;
147
- const OPID_CSS_COMBINED_PRIORITY = 'css_combined_priority' ;
148
- const OPID_CSS_HTTP2 = 'css_http2' ;
149
- const OPID_CSS_EXCLUDES = 'css_exclude' ;
150
- const OPID_JS_MINIFY = 'js_minify' ;
151
- const OPID_JS_INLINE_MINIFY = 'js_inline_minify' ;
152
- const OPID_JS_COMBINE = 'js_combine' ;
153
- const OPID_JS_COMBINED_PRIORITY = 'js_combined_priority' ;
154
- const OPID_JS_HTTP2 = 'js_http2' ;
155
- const OPID_JS_EXCLUDES = 'js_exclude' ;
156
- const OPID_OPTIMIZE_TTL = 'optimize_ttl' ;
157
- const OPID_HTML_MINIFY = 'html_minify' ;
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' ;
169
- const OPID_OPTM_RM_COMMENT = 'optm_rm_comment' ;
170
-
171
- const OPID_CDN = 'cdn' ;
172
- const OPID_CDN_ORI = 'cdn_ori' ;
173
- const OPID_CDN_EXCLUDE = 'cdn_exclude' ;
174
- const OPID_CDN_REMOTE_JQUERY = 'cdn_remote_jquery' ;
175
- const OPID_CDN_QUIC = 'cdn_quic' ;
176
- const OPID_CDN_QUIC_EMAIL = 'cdn_quic_email' ;
177
- const OPID_CDN_QUIC_KEY = 'cdn_quic_key' ;
178
- const OPID_CDN_QUIC_SITE = 'cdn_quic_site' ;
179
- const OPID_CDN_CLOUDFLARE = 'cdn_cloudflare' ;
180
- const OPID_CDN_CLOUDFLARE_EMAIL = 'cdn_cloudflare_email' ;
181
- const OPID_CDN_CLOUDFLARE_KEY = 'cdn_cloudflare_key' ;
182
- const OPID_CDN_CLOUDFLARE_NAME = 'cdn_cloudflare_name' ;
183
- const OPID_CDN_CLOUDFLARE_ZONE = 'cdn_cloudflare_zone' ;
184
-
185
- const OPID_MEDIA_IMG_LAZY = 'media_img_lazy' ;
186
- const OPID_MEDIA_IMG_LAZY_PLACEHOLDER = 'media_img_lazy_placeholder' ;
187
- const OPID_MEDIA_IFRAME_LAZY = 'media_iframe_lazy' ;
188
- const OPID_MEDIA_IMG_OPTM_CRON_OFF = 'media_img_optm_cron_off' ;
189
- const OPID_MEDIA_IMG_WEBP = 'media_img_webp' ;
190
- const OPID_MEDIA_IMG_WEBP_REPLACE_SRCSET = 'media_img_webp_replace_srcset' ;
191
- const OPID_MEDIA_IMG_WEBP_ONLY = 'media_img_webp_only' ;
192
- const OPID_MEDIA_IMG_EXIF = 'media_img_exif' ;
193
- const OPID_MEDIA_IMG_WEBP_LOSSLESS = 'media_img_webp_lossless' ;
194
-
195
- const HASH = 'hash' ;
196
-
197
- const NETWORK_OPID_ENABLED = 'network_enabled' ;
198
- const NETWORK_OPID_USE_PRIMARY = 'use_primary_settings' ;
199
-
200
- const CRWL_POSTS = 'crawler_include_posts' ;
201
- const CRWL_PAGES = 'crawler_include_pages' ;
202
- const CRWL_CATS = 'crawler_include_cats' ;
203
- const CRWL_TAGS = 'crawler_include_tags' ;
204
- const CRWL_EXCLUDES_CPT = 'crawler_excludes_cpt' ;
205
- const CRWL_ORDER_LINKS = 'crawler_order_links' ;
206
- const CRWL_USLEEP = 'crawler_usleep' ;
207
- const CRWL_RUN_DURATION = 'crawler_run_duration' ;
208
- const CRWL_RUN_INTERVAL = 'crawler_run_interval' ;
209
- const CRWL_CRAWL_INTERVAL = 'crawler_crawl_interval' ;
210
- const CRWL_THREADS = 'crawler_threads' ;
211
- const CRWL_LOAD_LIMIT = 'crawler_load_limit' ;
212
- const CRWL_DOMAIN_IP = 'crawler_domain_ip' ;
213
- const CRWL_CUSTOM_SITEMAP = 'crawler_custom_sitemap' ;
214
-
215
- const CRWL_CRON_ACTIVE = 'crawler_cron_active' ;
216
-
217
- const CRWL_DATE_DESC = 'date_desc' ;
218
- const CRWL_DATE_ASC = 'date_asc' ;
219
- const CRWL_ALPHA_DESC = 'alpha_desc' ;
220
- const CRWL_ALPHA_ASC = 'alpha_asc' ;
221
-
222
  protected $options ;
223
  protected $vary_groups ;
224
  protected $exclude_optimization_roles ;
@@ -269,41 +64,6 @@ class LiteSpeed_Cache_Config
269
 
270
  }
271
 
272
- /**
273
- * Get the items in wp_options that need for backup
274
- *
275
- * @since 2.2.1
276
- * @access public
277
- */
278
- public function stored_items()
279
- {
280
- return array(
281
- self::OPTION_NAME,
282
- self::VARY_GROUP,
283
- self::EXCLUDE_OPTIMIZATION_ROLES,
284
- self::EXCLUDE_CACHE_ROLES,
285
- self::ITEM_OPTM_CSS,
286
- self::ITEM_OPTM_JS_DEFER_EXC,
287
- self::ITEM_MEDIA_LAZY_IMG_EXC,
288
- self::ITEM_IMG_OPTM_NEED_PULL,
289
- self::ITEM_ENV_REF,
290
- self::ITEM_CACHE_DROP_QS,
291
- self::ITEM_CDN_MAPPING,
292
- self::ITEM_DNS_PREFETCH,
293
- self::ITEM_CLOUDFLARE_STATUS,
294
- self::ITEM_LOG_IGNORE_FILTERS,
295
- self::ITEM_LOG_IGNORE_PART_FILTERS,
296
- self::ITEM_OBJECT_GLOBAL_GROUPS,
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
-
307
  /**
308
  * Define `LSCACHE_ADV_CACHE` based on options setting
309
  *
@@ -588,220 +348,6 @@ class LiteSpeed_Cache_Config
588
  return in_array( $flag, $this->purge_options ) ;
589
  }
590
 
591
- /**
592
- * Gets the default single site options
593
- *
594
- * @since 1.0.0
595
- * @access public
596
- * @param bool $include_thirdparty Whether to include the thirdparty options.
597
- * @return array An array of the default options.
598
- */
599
- public function get_default_options($include_thirdparty = true)
600
- {
601
- $default_purge_options = array(
602
- self::PURGE_FRONT_PAGE,
603
- self::PURGE_HOME_PAGE,
604
- self::PURGE_PAGES,
605
- self::PURGE_PAGES_WITH_RECENT_POSTS,
606
- self::PURGE_AUTHOR,
607
- self::PURGE_MONTH,
608
- self::PURGE_TERM,
609
- self::PURGE_POST_TYPE,
610
- ) ;
611
- sort($default_purge_options) ;
612
-
613
- //For multi site, default is 2 (Use Network Admin Settings). For single site, default is 1 (Enabled).
614
- if ( is_multisite() ) {
615
- $default_radio = 2 ;
616
- }
617
- else {
618
- $default_radio = 1 ;
619
- }
620
-
621
- $default_options = array(
622
- self::OPID_VERSION => LiteSpeed_Cache::PLUGIN_VERSION,
623
- self::OPID_ENABLED_RADIO => $default_radio,
624
- self::OPID_PURGE_ON_UPGRADE => true,
625
- self::OPID_CACHE_PRIV => true,
626
- self::OPID_CACHE_COMMENTER => true,
627
- self::OPID_CACHE_REST => true,
628
- self::OPID_CACHE_PAGE_LOGIN => true,
629
- self::OPID_TIMED_URLS => '',
630
- self::OPID_TIMED_URLS_TIME => '',
631
- self::OPID_CACHE_FAVICON => true,
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',
638
- self::OPID_CACHE_OBJECT_PORT => '11211',
639
- self::OPID_CACHE_OBJECT_LIFE => '360',
640
- self::OPID_CACHE_OBJECT_PERSISTENT => true,
641
- self::OPID_CACHE_OBJECT_ADMIN => true,
642
- self::OPID_CACHE_OBJECT_TRANSIENTS => true,
643
- self::OPID_CACHE_OBJECT_DB_ID => 0,
644
- self::OPID_CACHE_OBJECT_USER => '',
645
- self::OPID_CACHE_OBJECT_PSWD => '',
646
- self::OPID_CACHE_BROWSER => false,
647
- self::OPID_CACHE_BROWSER_TTL => 2592000,
648
-
649
- self::OPID_LOGIN_COOKIE => '',
650
- self::OPID_CHECK_ADVANCEDCACHE => true,
651
- self::OPID_USE_HTTP_FOR_HTTPS_VARY => false,
652
- self::OPID_DEBUG_DISABLE_ALL => false,
653
- self::OPID_DEBUG => self::LOG_LEVEL_NONE,
654
- self::OPID_ADMIN_IPS => '127.0.0.1',
655
- self::OPID_DEBUG_LEVEL => false,
656
- self::OPID_LOG_FILE_SIZE => 3,
657
- self::OPID_HEARTBEAT => true,
658
- self::OPID_DEBUG_COOKIE => false,
659
- self::OPID_COLLAPS_QS => false,
660
- self::OPID_LOG_FILTERS => false,
661
- self::OPID_PUBLIC_TTL => 604800,
662
- self::OPID_PRIVATE_TTL => 1800,
663
- self::OPID_FRONT_PAGE_TTL => 604800,
664
- self::OPID_FEED_TTL => 0,
665
- self::OPID_403_TTL => 3600,
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 => '',
672
-
673
- // self::OPID_ADV_FAVICON => false,
674
- self::OPID_ADV_INSTANT_CLICK => false,
675
-
676
- self::OPID_CSS_MINIFY => false,
677
- self::OPID_CSS_INLINE_MINIFY => false,
678
- self::OPID_CSS_COMBINE => false,
679
- self::OPID_CSS_COMBINED_PRIORITY => false,
680
- self::OPID_CSS_HTTP2 => false,
681
- self::OPID_CSS_EXCLUDES => '',
682
- self::OPID_JS_MINIFY => false,
683
- self::OPID_JS_INLINE_MINIFY => false,
684
- self::OPID_JS_COMBINE => false,
685
- self::OPID_JS_COMBINED_PRIORITY => false,
686
- self::OPID_JS_HTTP2 => false,
687
- self::OPID_JS_EXCLUDES => '',
688
- self::OPID_OPTIMIZE_TTL => 604800,
689
- self::OPID_HTML_MINIFY => false,
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,
701
- self::OPID_OPTM_RM_COMMENT => false,
702
-
703
- self::OPID_CDN => false,
704
- self::OPID_CDN_ORI => '',
705
- self::OPID_CDN_EXCLUDE => '',
706
- self::OPID_CDN_REMOTE_JQUERY => false,
707
- self::OPID_CDN_QUIC => false,
708
- self::OPID_CDN_QUIC_EMAIL => '',
709
- self::OPID_CDN_QUIC_KEY => '',
710
- self::OPID_CDN_QUIC_SITE => '',
711
- self::OPID_CDN_CLOUDFLARE => false,
712
- self::OPID_CDN_CLOUDFLARE_EMAIL => '',
713
- self::OPID_CDN_CLOUDFLARE_KEY => '',
714
- self::OPID_CDN_CLOUDFLARE_NAME => '',
715
- self::OPID_CDN_CLOUDFLARE_ZONE => '',
716
-
717
- self::OPID_MEDIA_IMG_LAZY => false,
718
- self::OPID_MEDIA_IMG_LAZY_PLACEHOLDER => '',
719
- self::OPID_MEDIA_IFRAME_LAZY => false,
720
- self::OPID_MEDIA_IMG_OPTM_CRON_OFF => false,
721
- self::OPID_MEDIA_IMG_WEBP => false,
722
- self::OPID_MEDIA_IMG_WEBP_REPLACE_SRCSET => false,
723
- self::OPID_MEDIA_IMG_WEBP_ONLY => false,
724
- self::OPID_MEDIA_IMG_EXIF => false,
725
- self::OPID_MEDIA_IMG_WEBP_LOSSLESS => false,
726
-
727
- self::HASH => '',
728
-
729
- self::ID_NOCACHE_COOKIES => '',
730
- self::ID_NOCACHE_USERAGENTS => '',
731
- self::CRWL_POSTS => true,
732
- self::CRWL_PAGES => true,
733
- self::CRWL_CATS => true,
734
- self::CRWL_TAGS => true,
735
- self::CRWL_EXCLUDES_CPT => '',
736
- self::CRWL_ORDER_LINKS => self::CRWL_DATE_DESC,
737
- self::CRWL_USLEEP => 500,
738
- self::CRWL_RUN_DURATION => 400,
739
- self::CRWL_RUN_INTERVAL => 600,
740
- self::CRWL_CRAWL_INTERVAL => 302400,
741
- self::CRWL_THREADS => 3,
742
- self::CRWL_LOAD_LIMIT => 1,
743
- self::CRWL_DOMAIN_IP => '',
744
- self::CRWL_CUSTOM_SITEMAP => '',
745
- self::CRWL_CRON_ACTIVE => false,
746
- ) ;
747
-
748
- if ( LSWCP_ESI_SUPPORT ) {
749
- $default_options[self::OPID_ESI_ENABLE] = false ;
750
- $default_options[self::OPID_ESI_CACHE_ADMBAR] = true ;
751
- $default_options[self::OPID_ESI_CACHE_COMMFORM] = true ;
752
- }
753
-
754
- if ( ! $include_thirdparty ) {
755
- return $default_options ;
756
- }
757
-
758
- $tp_options = $this->get_thirdparty_options($default_options) ;
759
- if ( ! isset($tp_options) || ! is_array($tp_options) ) {
760
- return $default_options ;
761
- }
762
- return array_merge($default_options, $tp_options) ;
763
- }
764
-
765
- /**
766
- * Gets the default network options
767
- *
768
- * @since 1.0.11
769
- * @access protected
770
- * @return array An array of the default options.
771
- */
772
- protected function get_default_site_options()
773
- {
774
- $default_site_options = array(
775
- self::OPID_VERSION => LiteSpeed_Cache::PLUGIN_VERSION,
776
- self::NETWORK_OPID_ENABLED => false,
777
- self::NETWORK_OPID_USE_PRIMARY => false,
778
- self::OPID_PURGE_ON_UPGRADE => true,
779
- self::OPID_CACHE_FAVICON => true,
780
- self::OPID_CACHE_RES => true,
781
- self::OPID_CACHE_MOBILE => 0, // todo: why not false
782
- self::ID_MOBILEVIEW_LIST => false,
783
- self::OPID_CACHE_OBJECT => false,
784
- self::OPID_CACHE_OBJECT_KIND => false,
785
- self::OPID_CACHE_OBJECT_HOST => 'localhost',
786
- self::OPID_CACHE_OBJECT_PORT => '11211',
787
- self::OPID_CACHE_OBJECT_LIFE => '360',
788
- self::OPID_CACHE_OBJECT_PERSISTENT => true,
789
- self::OPID_CACHE_OBJECT_ADMIN => true,
790
- self::OPID_CACHE_OBJECT_TRANSIENTS => true,
791
- self::OPID_CACHE_OBJECT_DB_ID => 0,
792
- self::OPID_CACHE_OBJECT_USER => '',
793
- self::OPID_CACHE_OBJECT_PSWD => '',
794
- self::OPID_CACHE_BROWSER => false,
795
- self::OPID_CACHE_BROWSER_TTL => 2592000,
796
- self::OPID_LOGIN_COOKIE => '',
797
- self::OPID_CHECK_ADVANCEDCACHE => true,
798
- self::ID_NOCACHE_COOKIES => '',
799
- self::ID_NOCACHE_USERAGENTS => '',
800
- self::OPID_MEDIA_IMG_WEBP => false,
801
- ) ;
802
- return $default_site_options ;
803
- }
804
-
805
  /**
806
  * Get item val
807
  *
@@ -822,41 +368,6 @@ class LiteSpeed_Cache_Config
822
  return $val ;
823
  }
824
 
825
- /**
826
- * Get default item val
827
- *
828
- * @since 1.8
829
- * @access public
830
- */
831
- public function default_item( $k )
832
- {
833
- switch ( $k ) {
834
- case self::ITEM_OBJECT_GLOBAL_GROUPS :
835
- return "users\nuserlogins\nusermeta\nuser_meta\nsite-transient\nsite-options\nsite-lookup\nblog-lookup\nblog-details\nrss\nglobal-posts\nblog-id-cache" ;
836
-
837
- case self::ITEM_OBJECT_NON_PERSISTENT_GROUPS :
838
- return "comment\ncounts\nplugins" ;
839
-
840
- case self::ITEM_ADV_PURGE_ALL_HOOKS :
841
- return "switch_theme\nwp_create_nav_menu\nwp_update_nav_menu\nwp_delete_nav_menu\ncreate_term\nedit_terms\ndelete_term\nadd_link\nedit_link\ndelete_link" ;
842
-
843
- case self::ITEM_CDN_ORI_DIR :
844
- return LSCWP_CONTENT_FOLDER . "\nwp-includes\n/min/" ;
845
-
846
- case self::ITEM_MEDIA_WEBP_ATTRIBUTE :
847
- return "img.src\n" .
848
- "div.data-thumb\n" .
849
- "img.data-src\n" .
850
- "div.data-large_image\n" .
851
- "img.retina_logo_url" ;
852
-
853
- default :
854
- break ;
855
- }
856
-
857
- return false ;
858
- }
859
-
860
  /**
861
  * Get the plugin's site wide options.
862
  *
@@ -883,26 +394,6 @@ class LiteSpeed_Cache_Config
883
  return $default_site_options ;
884
  }
885
 
886
- /**
887
- * Gets the third party options.
888
- * Will also strip the options that are actually normal options.
889
- *
890
- * @access public
891
- * @since 1.0.9
892
- * @param array $options Optional. The default options to compare against.
893
- * @return mixed boolean on failure, array of keys on success.
894
- */
895
- public function get_thirdparty_options($options = null)
896
- {
897
- $tp_options = apply_filters('litespeed_cache_get_options', array()) ;
898
- if ( empty($tp_options) ) {
899
- return false ;
900
- }
901
- if ( ! isset($options) ) {
902
- $options = $this->get_default_options(false) ;
903
- }
904
- return array_diff_key($tp_options, $options) ;
905
- }
906
 
907
  /**
908
  * Helper function to convert the options to replicate the input format.
10
  * @subpackage LiteSpeed_Cache/inc
11
  * @author LiteSpeed Technologies <info@litespeedtech.com>
12
  */
13
+ class LiteSpeed_Cache_Config extends LiteSpeed_Cache_Const
14
  {
15
  private static $_instance ;
16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  protected $options ;
18
  protected $vary_groups ;
19
  protected $exclude_optimization_roles ;
64
 
65
  }
66
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  /**
68
  * Define `LSCACHE_ADV_CACHE` based on options setting
69
  *
348
  return in_array( $flag, $this->purge_options ) ;
349
  }
350
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
351
  /**
352
  * Get item val
353
  *
368
  return $val ;
369
  }
370
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
371
  /**
372
  * Get the plugin's site wide options.
373
  *
394
  return $default_site_options ;
395
  }
396
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
397
 
398
  /**
399
  * Helper function to convert the options to replicate the input format.
includes/litespeed-cache-crawler.class.php CHANGED
@@ -488,7 +488,7 @@ class LiteSpeed_Cache_Crawler
488
  $roles = $roles ? explode( "\n", $roles ) : array() ;
489
 
490
  // WebP on/off
491
- $webp = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_MEDIA_IMG_WEBP ) ;
492
 
493
  if ( $count_only ) {
494
  $count = count( $roles ) + 1 ;
488
  $roles = $roles ? explode( "\n", $roles ) : array() ;
489
 
490
  // WebP on/off
491
+ $webp = LiteSpeed_Cache_Media::webp_enabled() ;
492
 
493
  if ( $count_only ) {
494
  $count = count( $roles ) + 1 ;
includes/litespeed-cache-task.class.php CHANGED
@@ -39,7 +39,7 @@ class LiteSpeed_Cache_Task
39
  }
40
 
41
  // Register img optimization fetch ( always fetch immediately )
42
- if ( ! LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_MEDIA_IMG_OPTM_CRON_OFF ) && LiteSpeed_Cache_Img_Optm::check_need_pull() ) {
43
  self::schedule_filter_imgoptm() ;
44
 
45
  add_action( self::CRON_ACTION_HOOK_IMGOPTM, 'LiteSpeed_Cache_Img_Optm::pull_optimized_img' ) ;
39
  }
40
 
41
  // Register img optimization fetch ( always fetch immediately )
42
+ if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPT_MEDIA_OPTM_CRON ) && LiteSpeed_Cache_Img_Optm::check_need_pull() ) {
43
  self::schedule_filter_imgoptm() ;
44
 
45
  add_action( self::CRON_ACTION_HOOK_IMGOPTM, 'LiteSpeed_Cache_Img_Optm::pull_optimized_img' ) ;
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.3.1' ;
23
 
24
  const PAGE_EDIT_HTACCESS = 'lscache-edit-htaccess' ;
25
 
19
  private static $_instance ;
20
 
21
  const PLUGIN_NAME = 'litespeed-cache' ;
22
+ const PLUGIN_VERSION = '2.4' ;
23
 
24
  const PAGE_EDIT_HTACCESS = 'lscache-edit-htaccess' ;
25
 
includes/litespeed.autoload.php CHANGED
@@ -30,6 +30,7 @@ if ( !function_exists('_litespeed_autoload') ) {
30
  'LiteSpeed_Cache_CDN_Quiccloud' => 'inc/cdn/quiccloud.class.php',
31
  'LiteSpeed_Cache_Config' => 'inc/config.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',
30
  'LiteSpeed_Cache_CDN_Quiccloud' => 'inc/cdn/quiccloud.class.php',
31
  'LiteSpeed_Cache_Config' => 'inc/config.class.php',
32
  'LiteSpeed_Cache_Control' => 'inc/control.class.php',
33
+ 'LiteSpeed_Cache_Const' => 'inc/const.cls.php',
34
  'LiteSpeed_Cache_Crawler' => 'inc/crawler.class.php',
35
  'LiteSpeed_Cache_Crawler_Sitemap' => 'inc/crawler-sitemap.class.php',
36
  'LiteSpeed_Cache_CSS' => 'inc/css.cls.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.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"
@@ -29,8 +29,8 @@ msgid "Message from LiteSpeed image server"
29
  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:358
34
  #: includes/litespeed-cache-gui.class.php:358
35
  msgid "Manage"
36
  msgstr ""
@@ -76,7 +76,6 @@ msgstr ""
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
@@ -88,7 +87,7 @@ 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
@@ -135,7 +134,7 @@ msgstr ""
135
  #: admin/tpl/setting/settings_inc.cache_object.php:75
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
@@ -431,7 +430,7 @@ msgid "Site options saved."
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,30 +446,30 @@ msgstr ""
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,7 +552,7 @@ 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
 
@@ -988,7 +987,7 @@ msgstr ""
988
 
989
  #: admin/tpl/image_optimization.php:290
990
  #: admin/tpl/setting/settings_advanced.php:65
991
- #: admin/tpl/setting/settings_cdn.php:97
992
  #: admin/tpl/setting/settings_crawler.php:22
993
  #: admin/tpl/setting/settings_crawler.php:95
994
  #: admin/tpl/setting/settings_crawler.php:100
@@ -1109,7 +1108,7 @@ msgstr ""
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
@@ -1596,9 +1595,9 @@ msgstr ""
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
1600
- #: admin/tpl/setting/settings_cdn.php:144
1601
- #: admin/tpl/setting/settings_cdn.php:156
1602
  #: admin/tpl/setting/settings_crawler.php:132
1603
  #: admin/tpl/setting/settings_excludes.php:25
1604
  #: admin/tpl/setting/settings_excludes.php:43
@@ -1609,7 +1608,7 @@ msgstr ""
1609
  #: admin/tpl/setting/settings_inc.cache_object.php:122
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
@@ -1664,8 +1663,8 @@ msgstr ""
1664
  msgid "DB Optimizer"
1665
  msgstr ""
1666
 
1667
- #: admin/tpl/manage.php:10 admin/tpl/setting/settings_cdn.php:217
1668
- #: admin/tpl/setting/settings_cdn.php:260 admin/tpl/settings.php:12
1669
  msgid "CDN"
1670
  msgstr ""
1671
 
@@ -1958,178 +1957,184 @@ msgstr ""
1958
  msgid "Enable Content Delivery Network use."
1959
  msgstr ""
1960
 
1961
- #: admin/tpl/setting/settings_cdn.php:40
 
 
 
 
 
 
1962
  msgid "CDN Mapping"
1963
  msgstr ""
1964
 
1965
- #: admin/tpl/setting/settings_cdn.php:46
1966
  msgid "CDN URL"
1967
  msgstr ""
1968
 
1969
- #: admin/tpl/setting/settings_cdn.php:55
1970
  msgid "CDN URL to be used. For example, %s"
1971
  msgstr ""
1972
 
1973
- #: admin/tpl/setting/settings_cdn.php:61 admin/tpl/setting/settings_cdn.php:102
1974
  msgid "Include Images"
1975
  msgstr ""
1976
 
1977
- #: admin/tpl/setting/settings_cdn.php:68 admin/tpl/setting/settings_cdn.php:106
1978
  msgid "Include CSS"
1979
  msgstr ""
1980
 
1981
- #: admin/tpl/setting/settings_cdn.php:75 admin/tpl/setting/settings_cdn.php:110
1982
  msgid "Include JS"
1983
  msgstr ""
1984
 
1985
- #: admin/tpl/setting/settings_cdn.php:85 admin/tpl/setting/settings_cdn.php:114
1986
  msgid "Include File Types"
1987
  msgstr ""
1988
 
1989
- #: admin/tpl/setting/settings_cdn.php:98
1990
  msgid ""
1991
  "To randomize CDN hostname, define multiple hostnames for the same resources."
1992
  msgstr ""
1993
 
1994
- #: admin/tpl/setting/settings_cdn.php:103
1995
  msgid ""
1996
  "Serve all image files through the CDN. This will affect all attachments, "
1997
  "HTML %s tags, and CSS %s attributes."
1998
  msgstr ""
1999
 
2000
- #: admin/tpl/setting/settings_cdn.php:107
2001
  msgid ""
2002
  "Serve all CSS files through the CDN. This will affect all enqueued WP CSS "
2003
  "files."
2004
  msgstr ""
2005
 
2006
- #: admin/tpl/setting/settings_cdn.php:111
2007
  msgid ""
2008
  "Serve all JavaScript files through the CDN. This will affect all enqueued WP "
2009
  "JavaScript files."
2010
  msgstr ""
2011
 
2012
- #: admin/tpl/setting/settings_cdn.php:115
2013
  msgid "Static file type links to be replaced by CDN links."
2014
  msgstr ""
2015
 
2016
- #: admin/tpl/setting/settings_cdn.php:117
2017
  msgid "This will affect all tags containing attributes: %s %s %s."
2018
  msgstr ""
2019
 
2020
- #: admin/tpl/setting/settings_cdn.php:118
2021
  msgid "Default value"
2022
  msgstr ""
2023
 
2024
- #: admin/tpl/setting/settings_cdn.php:125
2025
  msgid "Original URLs"
2026
  msgstr ""
2027
 
2028
- #: admin/tpl/setting/settings_cdn.php:129
2029
  msgid ""
2030
  "Site URL to be served through the CDN. Beginning with %1$s. For example, "
2031
  "%2$s."
2032
  msgstr ""
2033
 
2034
- #: admin/tpl/setting/settings_cdn.php:130
2035
  msgid ""
2036
  "Wildcard %1$s supported (match zero or more characters). For example, to "
2037
  "match %2$s and %3$s, use %4$s."
2038
  msgstr ""
2039
 
2040
- #: admin/tpl/setting/settings_cdn.php:131
2041
  msgid "Separate multiple original URLs with a %s."
2042
  msgstr ""
2043
 
2044
- #: admin/tpl/setting/settings_cdn.php:137
2045
  msgid "Included Directories"
2046
  msgstr ""
2047
 
2048
- #: admin/tpl/setting/settings_cdn.php:143
2049
  msgid "Only files within these directories will be pointed to the CDN."
2050
  msgstr ""
2051
 
2052
- #: admin/tpl/setting/settings_cdn.php:150
2053
  msgid "Exclude Path"
2054
  msgstr ""
2055
 
2056
- #: admin/tpl/setting/settings_cdn.php:155
2057
  msgid "Paths containing these strings will not be served from the CDN."
2058
  msgstr ""
2059
 
2060
- #: admin/tpl/setting/settings_cdn.php:162
2061
  msgid "Load JQuery Remotely"
2062
  msgstr ""
2063
 
2064
- #: admin/tpl/setting/settings_cdn.php:184
2065
  msgid ""
2066
  "Improve page load time by loading jQuery from a remote CDN service instead "
2067
  "of locally."
2068
  msgstr ""
2069
 
2070
- #: admin/tpl/setting/settings_cdn.php:190
2071
  msgid "Quic Cloud API"
2072
  msgstr ""
2073
 
2074
- #: admin/tpl/setting/settings_cdn.php:194
2075
- #: admin/tpl/setting/settings_cdn.php:259
2076
  msgid "Use %s API functionality."
2077
  msgstr ""
2078
 
2079
- #: admin/tpl/setting/settings_cdn.php:217
2080
- #: admin/tpl/setting/settings_cdn.php:260
2081
  msgid "This can be managed from <a %2$s>%1$s</a>."
2082
  msgstr ""
2083
 
2084
- #: admin/tpl/setting/settings_cdn.php:221
2085
- #: admin/tpl/setting/settings_cdn.php:264
2086
  msgid "Email Address"
2087
  msgstr ""
2088
 
2089
- #: admin/tpl/setting/settings_cdn.php:225
2090
- #: admin/tpl/setting/settings_cdn.php:268
2091
  msgid "Your Email address on %s."
2092
  msgstr ""
2093
 
2094
- #: admin/tpl/setting/settings_cdn.php:230
2095
  msgid "User API Key"
2096
  msgstr ""
2097
 
2098
- #: admin/tpl/setting/settings_cdn.php:234
2099
- #: admin/tpl/setting/settings_cdn.php:277
2100
  msgid "Your API key is used to access %s APIs."
2101
  msgstr ""
2102
 
2103
- #: admin/tpl/setting/settings_cdn.php:235
2104
- #: admin/tpl/setting/settings_cdn.php:278
2105
  msgid "Get it from <a %1$s>%2$s</a>."
2106
  msgstr ""
2107
 
2108
- #: admin/tpl/setting/settings_cdn.php:240
2109
  msgid "Site Domain"
2110
  msgstr ""
2111
 
2112
- #: admin/tpl/setting/settings_cdn.php:246
2113
- #: admin/tpl/setting/settings_cdn.php:291
2114
  msgid "You can just type part of the domain."
2115
  msgstr ""
2116
 
2117
- #: admin/tpl/setting/settings_cdn.php:247
2118
- #: admin/tpl/setting/settings_cdn.php:292
2119
  msgid ""
2120
  "Once saved, it will be matched with the current list and completed "
2121
  "automatically."
2122
  msgstr ""
2123
 
2124
- #: admin/tpl/setting/settings_cdn.php:255
2125
  msgid "Cloudflare API"
2126
  msgstr ""
2127
 
2128
- #: admin/tpl/setting/settings_cdn.php:273
2129
  msgid "Global API Key"
2130
  msgstr ""
2131
 
2132
- #: admin/tpl/setting/settings_cdn.php:283
2133
  msgid "Domain"
2134
  msgstr ""
2135
 
@@ -3171,74 +3176,90 @@ msgid "Load iframes only when they enter the viewport."
3171
  msgstr ""
3172
 
3173
  #: admin/tpl/setting/settings_media.php:69
3174
- msgid "Disable Optimization Pull"
3175
  msgstr ""
3176
 
3177
  #: admin/tpl/setting/settings_media.php:73
3178
- msgid ""
3179
- "Set this option to %s to disable the cron job responsible for fetching "
3180
- "optimized images from LiteSpeed's Image Server."
3181
  msgstr ""
3182
 
3183
- #: admin/tpl/setting/settings_media.php:87
3184
- msgid "WebP Attribute To Replace"
3185
  msgstr ""
3186
 
3187
- #: admin/tpl/setting/settings_media.php:93
3188
- msgid "Specify which element attributes will be replaced with WebP."
 
 
3189
  msgstr ""
3190
 
3191
- #: admin/tpl/setting/settings_media.php:94
3192
- msgid "Only attributes listed here will be replaced."
3193
  msgstr ""
3194
 
3195
- #: admin/tpl/setting/settings_media.php:95
3196
- msgid "Use the format %1$s or %2$s (element is optional)."
3197
  msgstr ""
3198
 
3199
- #: admin/tpl/setting/settings_media.php:102
3200
- msgid "WebP For Extra srcset"
3201
  msgstr ""
3202
 
3203
- #: admin/tpl/setting/settings_media.php:106
3204
- msgid ""
3205
- "Enable replacement of WebP in %s elements that were generated outside of "
3206
- "WordPress logic."
 
 
3207
  msgstr ""
3208
 
3209
  #: admin/tpl/setting/settings_media.php:113
3210
- msgid "Only Request WebP"
3211
  msgstr ""
3212
 
3213
- #: admin/tpl/setting/settings_media.php:117
3214
  msgid ""
3215
- "Prevent images from being replaced with optimized versions when optimizing. "
3216
- "WebP versions will still be generated."
3217
  msgstr ""
3218
 
3219
- #: admin/tpl/setting/settings_media.php:123
3220
  msgid "Preserve EXIF data"
3221
  msgstr ""
3222
 
3223
- #: admin/tpl/setting/settings_media.php:127
3224
  msgid ""
3225
  "Preserve EXIF data (copyright, GPS, comments, keywords, etc) when optimizing."
3226
  msgstr ""
3227
 
3228
- #: admin/tpl/setting/settings_media.php:128
3229
  msgid "This will increase the size of optimized files."
3230
  msgstr ""
3231
 
3232
- #: admin/tpl/setting/settings_media.php:134
3233
- msgid "WebP Lossless Compression"
 
 
 
 
3234
  msgstr ""
3235
 
3236
- #: admin/tpl/setting/settings_media.php:138
3237
- msgid "Generate WebP images using lossless compression."
3238
  msgstr ""
3239
 
3240
- #: admin/tpl/setting/settings_media.php:139
3241
- msgid "This can improve quality at the cost of larger images."
 
 
 
 
 
 
 
 
 
 
3242
  msgstr ""
3243
 
3244
  #: admin/tpl/setting/settings_optimize.php:9
@@ -3749,29 +3770,29 @@ msgstr ""
3749
  msgid "Compatibilities"
3750
  msgstr ""
3751
 
3752
- #: admin/tpl/settings.php:127
3753
  msgid "LiteSpeed Cache Settings"
3754
  msgstr ""
3755
 
3756
- #: admin/tpl/settings.php:133
3757
- msgid "Basic View"
3758
  msgstr ""
3759
 
3760
- #: admin/tpl/settings.php:134
3761
- msgid "Advanced View"
3762
  msgstr ""
3763
 
3764
- #: admin/tpl/settings.php:165
3765
  msgid "The network admin selected use primary site configs for all subsites."
3766
  msgstr ""
3767
 
3768
- #: admin/tpl/settings.php:166
3769
  msgid ""
3770
  "The following options are selected, but are not editable in this settings "
3771
  "page."
3772
  msgstr ""
3773
 
3774
- #: admin/tpl/settings.php:188 admin/tpl/settings.php:191
3775
  msgid "Save Changes"
3776
  msgstr ""
3777
 
@@ -3901,8 +3922,8 @@ msgstr ""
3901
  msgid "Communicated with LiteSpeed Image Optimization Server successfully."
3902
  msgstr ""
3903
 
3904
- #: inc/img_optm.class.php:142 inc/img_optm.class.php:1239
3905
- #: inc/img_optm.class.php:1304
3906
  msgid "No image found."
3907
  msgstr ""
3908
 
@@ -3922,41 +3943,45 @@ msgstr ""
3922
  msgid "Pushed %1$s to LiteSpeed optimization server, accepted %2$s."
3923
  msgstr ""
3924
 
3925
- #: inc/img_optm.class.php:627
3926
  msgid "Failed to push to LiteSpeed IAPI server: %s"
3927
  msgstr ""
3928
 
3929
- #: inc/img_optm.class.php:635
3930
  msgid "Failed to parse data from LiteSpeed IAPI server: %s"
3931
  msgstr ""
3932
 
3933
- #: inc/img_optm.class.php:1129
3934
  msgid "Destroy unfinished data successfully."
3935
  msgstr ""
3936
 
3937
- #: inc/img_optm.class.php:1342
3938
  msgid ""
3939
  "Pushed %1$s groups with %2$s images to LiteSpeed optimization server, "
3940
  "accepted %3$s groups with %4$s images."
3941
  msgstr ""
3942
 
3943
- #: inc/img_optm.class.php:1449
3944
  msgid "Removed %1$s images and saved %2$s successfully."
3945
  msgstr ""
3946
 
3947
- #: inc/img_optm.class.php:1672
 
 
 
 
3948
  msgid "Disabled WebP file successfully."
3949
  msgstr ""
3950
 
3951
- #: inc/img_optm.class.php:1678
3952
  msgid "Enabled WebP file successfully."
3953
  msgstr ""
3954
 
3955
- #: inc/img_optm.class.php:1694
3956
  msgid "Restored original file successfully."
3957
  msgstr ""
3958
 
3959
- #: inc/img_optm.class.php:1701
3960
  msgid "Switched to optimized file successfully."
3961
  msgstr ""
3962
 
@@ -3980,31 +4005,31 @@ msgstr ""
3980
  msgid "Notified LiteSpeed Web Server to purge the list."
3981
  msgstr ""
3982
 
3983
- #: inc/media.class.php:103
3984
  msgid "LiteSpeed Optimization"
3985
  msgstr ""
3986
 
3987
- #: inc/media.class.php:127
3988
  msgid "Disable WebP"
3989
  msgstr ""
3990
 
3991
- #: inc/media.class.php:132
3992
  msgid "Enable WebP"
3993
  msgstr ""
3994
 
3995
- #: inc/media.class.php:150
3996
  msgid "Restore Original File"
3997
  msgstr ""
3998
 
3999
- #: inc/media.class.php:155
4000
  msgid "Switch To Optimized File"
4001
  msgstr ""
4002
 
4003
- #: inc/media.class.php:169
4004
  msgid "WebP saved %s"
4005
  msgstr ""
4006
 
4007
- #: inc/media.class.php:178
4008
  msgid "Original saved %s"
4009
  msgstr ""
4010
 
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.4\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/litespeed-cache\n"
7
+ "POT-Creation-Date: 2018-06-30 21:54:37+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
29
  msgstr ""
30
 
31
  #: admin/litespeed-cache-admin-display.class.php:151
32
+ #: admin/tpl/setting/settings_cdn.php:218
33
+ #: admin/tpl/setting/settings_cdn.php:261 inc/gui.class.php:358
34
  #: includes/litespeed-cache-gui.class.php:358
35
  msgid "Manage"
36
  msgstr ""
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_optimize.php:138
80
  #: admin/tpl/setting/settings_optimize.php:152
81
  #: admin/tpl/setting/settings_optimize.php:153
87
 
88
  #: admin/litespeed-cache-admin-display.class.php:799
89
  #: admin/litespeed-cache-admin-display.class.php:887
90
+ #: admin/tpl/setting/settings_cdn.php:35 admin/tpl/setting/settings_cdn.php:169
91
  #: admin/tpl/setting/settings_debug.php:29
92
  #: admin/tpl/setting/settings_inc.cache_object.php:149
93
  #: admin/tpl/setting/settings_optimize.php:152
134
  #: admin/tpl/setting/settings_inc.cache_object.php:75
135
  #: admin/tpl/setting/settings_inc.cache_object.php:150
136
  #: admin/tpl/setting/settings_media.php:8
137
+ #: admin/tpl/setting/settings_media.php:159
138
  #: admin/tpl/setting/settings_optimize.php:10
139
  #: admin/tpl/setting/settings_optimize.php:165
140
  #: admin/tpl/setting/settings_optimize.php:237
430
  msgstr ""
431
 
432
  #: admin/litespeed-cache-admin-settings.class.php:342
433
+ #: admin/litespeed-cache-admin-settings.class.php:1026
434
  msgid "Default Public Cache"
435
  msgstr ""
436
 
446
  msgid "Feed"
447
  msgstr ""
448
 
449
+ #: admin/litespeed-cache-admin-settings.class.php:867
450
  #: admin/tpl/setting/settings_debug.php:88
451
  msgid "Log File Size Limit"
452
  msgstr ""
453
 
454
+ #: admin/litespeed-cache-admin-settings.class.php:949
455
  #: admin/tpl/setting/settings_crawler.php:13
456
  msgid "Delay"
457
  msgstr ""
458
 
459
+ #: admin/litespeed-cache-admin-settings.class.php:950
460
  #: admin/tpl/setting/settings_crawler.php:37
461
  msgid "Run Duration"
462
  msgstr ""
463
 
464
+ #: admin/litespeed-cache-admin-settings.class.php:951
465
  msgid "Cron Interval"
466
  msgstr ""
467
 
468
+ #: admin/litespeed-cache-admin-settings.class.php:952
469
  msgid "Whole Interval"
470
  msgstr ""
471
 
472
+ #: admin/litespeed-cache-admin-settings.class.php:953
473
  #: admin/tpl/setting/settings_crawler.php:73
474
  msgid "Threads"
475
  msgstr ""
552
  #: admin/tpl/inc/check_cache_disabled.php:31 admin/tpl/manage/manage_cdn.php:15
553
  #: admin/tpl/setting/settings_debug.php:105
554
  #: admin/tpl/setting/settings_debug.php:138
555
+ #: admin/tpl/setting/settings_optimize.php:15 admin/tpl/settings.php:161
556
  msgid "WARNING"
557
  msgstr ""
558
 
987
 
988
  #: admin/tpl/image_optimization.php:290
989
  #: admin/tpl/setting/settings_advanced.php:65
990
+ #: admin/tpl/setting/settings_cdn.php:98
991
  #: admin/tpl/setting/settings_crawler.php:22
992
  #: admin/tpl/setting/settings_crawler.php:95
993
  #: admin/tpl/setting/settings_crawler.php:100
1108
  msgid "Rate %s on %s"
1109
  msgstr ""
1110
 
1111
+ #. #-#-#-#-# litespeed-cache.pot (LiteSpeed Cache 2.4) #-#-#-#-#
1112
  #. Plugin Name of the plugin/theme
1113
  #: admin/tpl/inc/admin_footer.php:6 inc/gui.class.php:350
1114
  #: includes/litespeed-cache-gui.class.php:350
1595
  #: admin/tpl/manage/manage_purge.php:143
1596
  #: admin/tpl/setting/settings_cache.php:73
1597
  #: admin/tpl/setting/settings_cache.php:90
1598
+ #: admin/tpl/setting/settings_cdn.php:117
1599
+ #: admin/tpl/setting/settings_cdn.php:145
1600
+ #: admin/tpl/setting/settings_cdn.php:157
1601
  #: admin/tpl/setting/settings_crawler.php:132
1602
  #: admin/tpl/setting/settings_excludes.php:25
1603
  #: admin/tpl/setting/settings_excludes.php:43
1608
  #: admin/tpl/setting/settings_inc.cache_object.php:122
1609
  #: admin/tpl/setting/settings_inc.exclude_cookies.php:19
1610
  #: admin/tpl/setting/settings_media.php:34
1611
+ #: admin/tpl/setting/settings_media.php:148
1612
  #: admin/tpl/setting/settings_optimize.php:236
1613
  #: admin/tpl/setting/settings_purge.php:85
1614
  #: admin/tpl/setting/settings_tuning.php:38
1663
  msgid "DB Optimizer"
1664
  msgstr ""
1665
 
1666
+ #: admin/tpl/manage.php:10 admin/tpl/setting/settings_cdn.php:218
1667
+ #: admin/tpl/setting/settings_cdn.php:261 admin/tpl/settings.php:12
1668
  msgid "CDN"
1669
  msgstr ""
1670
 
1957
  msgid "Enable Content Delivery Network use."
1958
  msgstr ""
1959
 
1960
+ #: admin/tpl/setting/settings_cdn.php:35
1961
+ msgid ""
1962
+ "If using Cloudflare, leave this setting %s and use Cloudflare API setting "
1963
+ "below."
1964
+ msgstr ""
1965
+
1966
+ #: admin/tpl/setting/settings_cdn.php:41
1967
  msgid "CDN Mapping"
1968
  msgstr ""
1969
 
1970
+ #: admin/tpl/setting/settings_cdn.php:47
1971
  msgid "CDN URL"
1972
  msgstr ""
1973
 
1974
+ #: admin/tpl/setting/settings_cdn.php:56
1975
  msgid "CDN URL to be used. For example, %s"
1976
  msgstr ""
1977
 
1978
+ #: admin/tpl/setting/settings_cdn.php:62 admin/tpl/setting/settings_cdn.php:103
1979
  msgid "Include Images"
1980
  msgstr ""
1981
 
1982
+ #: admin/tpl/setting/settings_cdn.php:69 admin/tpl/setting/settings_cdn.php:107
1983
  msgid "Include CSS"
1984
  msgstr ""
1985
 
1986
+ #: admin/tpl/setting/settings_cdn.php:76 admin/tpl/setting/settings_cdn.php:111
1987
  msgid "Include JS"
1988
  msgstr ""
1989
 
1990
+ #: admin/tpl/setting/settings_cdn.php:86 admin/tpl/setting/settings_cdn.php:115
1991
  msgid "Include File Types"
1992
  msgstr ""
1993
 
1994
+ #: admin/tpl/setting/settings_cdn.php:99
1995
  msgid ""
1996
  "To randomize CDN hostname, define multiple hostnames for the same resources."
1997
  msgstr ""
1998
 
1999
+ #: admin/tpl/setting/settings_cdn.php:104
2000
  msgid ""
2001
  "Serve all image files through the CDN. This will affect all attachments, "
2002
  "HTML %s tags, and CSS %s attributes."
2003
  msgstr ""
2004
 
2005
+ #: admin/tpl/setting/settings_cdn.php:108
2006
  msgid ""
2007
  "Serve all CSS files through the CDN. This will affect all enqueued WP CSS "
2008
  "files."
2009
  msgstr ""
2010
 
2011
+ #: admin/tpl/setting/settings_cdn.php:112
2012
  msgid ""
2013
  "Serve all JavaScript files through the CDN. This will affect all enqueued WP "
2014
  "JavaScript files."
2015
  msgstr ""
2016
 
2017
+ #: admin/tpl/setting/settings_cdn.php:116
2018
  msgid "Static file type links to be replaced by CDN links."
2019
  msgstr ""
2020
 
2021
+ #: admin/tpl/setting/settings_cdn.php:118
2022
  msgid "This will affect all tags containing attributes: %s %s %s."
2023
  msgstr ""
2024
 
2025
+ #: admin/tpl/setting/settings_cdn.php:119
2026
  msgid "Default value"
2027
  msgstr ""
2028
 
2029
+ #: admin/tpl/setting/settings_cdn.php:126
2030
  msgid "Original URLs"
2031
  msgstr ""
2032
 
2033
+ #: admin/tpl/setting/settings_cdn.php:130
2034
  msgid ""
2035
  "Site URL to be served through the CDN. Beginning with %1$s. For example, "
2036
  "%2$s."
2037
  msgstr ""
2038
 
2039
+ #: admin/tpl/setting/settings_cdn.php:131
2040
  msgid ""
2041
  "Wildcard %1$s supported (match zero or more characters). For example, to "
2042
  "match %2$s and %3$s, use %4$s."
2043
  msgstr ""
2044
 
2045
+ #: admin/tpl/setting/settings_cdn.php:132
2046
  msgid "Separate multiple original URLs with a %s."
2047
  msgstr ""
2048
 
2049
+ #: admin/tpl/setting/settings_cdn.php:138
2050
  msgid "Included Directories"
2051
  msgstr ""
2052
 
2053
+ #: admin/tpl/setting/settings_cdn.php:144
2054
  msgid "Only files within these directories will be pointed to the CDN."
2055
  msgstr ""
2056
 
2057
+ #: admin/tpl/setting/settings_cdn.php:151
2058
  msgid "Exclude Path"
2059
  msgstr ""
2060
 
2061
+ #: admin/tpl/setting/settings_cdn.php:156
2062
  msgid "Paths containing these strings will not be served from the CDN."
2063
  msgstr ""
2064
 
2065
+ #: admin/tpl/setting/settings_cdn.php:163
2066
  msgid "Load JQuery Remotely"
2067
  msgstr ""
2068
 
2069
+ #: admin/tpl/setting/settings_cdn.php:185
2070
  msgid ""
2071
  "Improve page load time by loading jQuery from a remote CDN service instead "
2072
  "of locally."
2073
  msgstr ""
2074
 
2075
+ #: admin/tpl/setting/settings_cdn.php:191
2076
  msgid "Quic Cloud API"
2077
  msgstr ""
2078
 
2079
+ #: admin/tpl/setting/settings_cdn.php:195
2080
+ #: admin/tpl/setting/settings_cdn.php:260
2081
  msgid "Use %s API functionality."
2082
  msgstr ""
2083
 
2084
+ #: admin/tpl/setting/settings_cdn.php:218
2085
+ #: admin/tpl/setting/settings_cdn.php:261
2086
  msgid "This can be managed from <a %2$s>%1$s</a>."
2087
  msgstr ""
2088
 
2089
+ #: admin/tpl/setting/settings_cdn.php:222
2090
+ #: admin/tpl/setting/settings_cdn.php:265
2091
  msgid "Email Address"
2092
  msgstr ""
2093
 
2094
+ #: admin/tpl/setting/settings_cdn.php:226
2095
+ #: admin/tpl/setting/settings_cdn.php:269
2096
  msgid "Your Email address on %s."
2097
  msgstr ""
2098
 
2099
+ #: admin/tpl/setting/settings_cdn.php:231
2100
  msgid "User API Key"
2101
  msgstr ""
2102
 
2103
+ #: admin/tpl/setting/settings_cdn.php:235
2104
+ #: admin/tpl/setting/settings_cdn.php:278
2105
  msgid "Your API key is used to access %s APIs."
2106
  msgstr ""
2107
 
2108
+ #: admin/tpl/setting/settings_cdn.php:236
2109
+ #: admin/tpl/setting/settings_cdn.php:279
2110
  msgid "Get it from <a %1$s>%2$s</a>."
2111
  msgstr ""
2112
 
2113
+ #: admin/tpl/setting/settings_cdn.php:241
2114
  msgid "Site Domain"
2115
  msgstr ""
2116
 
2117
+ #: admin/tpl/setting/settings_cdn.php:247
2118
+ #: admin/tpl/setting/settings_cdn.php:292
2119
  msgid "You can just type part of the domain."
2120
  msgstr ""
2121
 
2122
+ #: admin/tpl/setting/settings_cdn.php:248
2123
+ #: admin/tpl/setting/settings_cdn.php:293
2124
  msgid ""
2125
  "Once saved, it will be matched with the current list and completed "
2126
  "automatically."
2127
  msgstr ""
2128
 
2129
+ #: admin/tpl/setting/settings_cdn.php:256
2130
  msgid "Cloudflare API"
2131
  msgstr ""
2132
 
2133
+ #: admin/tpl/setting/settings_cdn.php:274
2134
  msgid "Global API Key"
2135
  msgstr ""
2136
 
2137
+ #: admin/tpl/setting/settings_cdn.php:284
2138
  msgid "Domain"
2139
  msgstr ""
2140
 
3176
  msgstr ""
3177
 
3178
  #: admin/tpl/setting/settings_media.php:69
3179
+ msgid "Optimize New Images"
3180
  msgstr ""
3181
 
3182
  #: admin/tpl/setting/settings_media.php:73
3183
+ msgid "Automatically request optimization for newly-uploaded images."
 
 
3184
  msgstr ""
3185
 
3186
+ #: admin/tpl/setting/settings_media.php:79
3187
+ msgid "Optimization Cron"
3188
  msgstr ""
3189
 
3190
+ #: admin/tpl/setting/settings_media.php:83
3191
+ msgid ""
3192
+ "Disabling this will stop the cron job responsible for fetching optimized "
3193
+ "images from LiteSpeed's Image Server."
3194
  msgstr ""
3195
 
3196
+ #: admin/tpl/setting/settings_media.php:89
3197
+ msgid "Optimize Original Images"
3198
  msgstr ""
3199
 
3200
+ #: admin/tpl/setting/settings_media.php:93
3201
+ msgid "Optimize images and save backups of the originals in the same folder."
3202
  msgstr ""
3203
 
3204
+ #: admin/tpl/setting/settings_media.php:99
3205
+ msgid "Optimize WebP Versions"
3206
  msgstr ""
3207
 
3208
+ #: admin/tpl/setting/settings_media.php:103
3209
+ msgid "Request WebP versions of original images when doing optimization."
3210
+ msgstr ""
3211
+
3212
+ #: admin/tpl/setting/settings_media.php:109
3213
+ msgid "Optimize Losslessly"
3214
  msgstr ""
3215
 
3216
  #: admin/tpl/setting/settings_media.php:113
3217
+ msgid "Optimize images using lossless compression."
3218
  msgstr ""
3219
 
3220
+ #: admin/tpl/setting/settings_media.php:114
3221
  msgid ""
3222
+ "This can improve quality but may result in larger images than lossy "
3223
+ "compression will."
3224
  msgstr ""
3225
 
3226
+ #: admin/tpl/setting/settings_media.php:120
3227
  msgid "Preserve EXIF data"
3228
  msgstr ""
3229
 
3230
+ #: admin/tpl/setting/settings_media.php:124
3231
  msgid ""
3232
  "Preserve EXIF data (copyright, GPS, comments, keywords, etc) when optimizing."
3233
  msgstr ""
3234
 
3235
+ #: admin/tpl/setting/settings_media.php:125
3236
  msgid "This will increase the size of optimized files."
3237
  msgstr ""
3238
 
3239
+ #: admin/tpl/setting/settings_media.php:139
3240
+ msgid "WebP Attribute To Replace"
3241
+ msgstr ""
3242
+
3243
+ #: admin/tpl/setting/settings_media.php:145
3244
+ msgid "Specify which element attributes will be replaced with WebP."
3245
  msgstr ""
3246
 
3247
+ #: admin/tpl/setting/settings_media.php:146
3248
+ msgid "Only attributes listed here will be replaced."
3249
  msgstr ""
3250
 
3251
+ #: admin/tpl/setting/settings_media.php:147
3252
+ msgid "Use the format %1$s or %2$s (element is optional)."
3253
+ msgstr ""
3254
+
3255
+ #: admin/tpl/setting/settings_media.php:154
3256
+ msgid "WebP For Extra srcset"
3257
+ msgstr ""
3258
+
3259
+ #: admin/tpl/setting/settings_media.php:158
3260
+ msgid ""
3261
+ "Enable replacement of WebP in %s elements that were generated outside of "
3262
+ "WordPress logic."
3263
  msgstr ""
3264
 
3265
  #: admin/tpl/setting/settings_optimize.php:9
3770
  msgid "Compatibilities"
3771
  msgstr ""
3772
 
3773
+ #: admin/tpl/settings.php:124
3774
  msgid "LiteSpeed Cache Settings"
3775
  msgstr ""
3776
 
3777
+ #: admin/tpl/settings.php:150
3778
+ msgid "Hide Advanced Options"
3779
  msgstr ""
3780
 
3781
+ #: admin/tpl/settings.php:152
3782
+ msgid "Show Advanced Options"
3783
  msgstr ""
3784
 
3785
+ #: admin/tpl/settings.php:163
3786
  msgid "The network admin selected use primary site configs for all subsites."
3787
  msgstr ""
3788
 
3789
+ #: admin/tpl/settings.php:164
3790
  msgid ""
3791
  "The following options are selected, but are not editable in this settings "
3792
  "page."
3793
  msgstr ""
3794
 
3795
+ #: admin/tpl/settings.php:186 admin/tpl/settings.php:189
3796
  msgid "Save Changes"
3797
  msgstr ""
3798
 
3922
  msgid "Communicated with LiteSpeed Image Optimization Server successfully."
3923
  msgstr ""
3924
 
3925
+ #: inc/img_optm.class.php:142 inc/img_optm.class.php:1232
3926
+ #: inc/img_optm.class.php:1297
3927
  msgid "No image found."
3928
  msgstr ""
3929
 
3943
  msgid "Pushed %1$s to LiteSpeed optimization server, accepted %2$s."
3944
  msgstr ""
3945
 
3946
+ #: inc/img_optm.class.php:628
3947
  msgid "Failed to push to LiteSpeed IAPI server: %s"
3948
  msgstr ""
3949
 
3950
+ #: inc/img_optm.class.php:636
3951
  msgid "Failed to parse data from LiteSpeed IAPI server: %s"
3952
  msgstr ""
3953
 
3954
+ #: inc/img_optm.class.php:1122
3955
  msgid "Destroy unfinished data successfully."
3956
  msgstr ""
3957
 
3958
+ #: inc/img_optm.class.php:1335
3959
  msgid ""
3960
  "Pushed %1$s groups with %2$s images to LiteSpeed optimization server, "
3961
  "accepted %3$s groups with %4$s images."
3962
  msgstr ""
3963
 
3964
+ #: inc/img_optm.class.php:1445
3965
  msgid "Removed %1$s images and saved %2$s successfully."
3966
  msgstr ""
3967
 
3968
+ #: inc/img_optm.class.php:1639
3969
+ msgid "Switched images successfully."
3970
+ msgstr ""
3971
+
3972
+ #: inc/img_optm.class.php:1670
3973
  msgid "Disabled WebP file successfully."
3974
  msgstr ""
3975
 
3976
+ #: inc/img_optm.class.php:1676
3977
  msgid "Enabled WebP file successfully."
3978
  msgstr ""
3979
 
3980
+ #: inc/img_optm.class.php:1692
3981
  msgid "Restored original file successfully."
3982
  msgstr ""
3983
 
3984
+ #: inc/img_optm.class.php:1699
3985
  msgid "Switched to optimized file successfully."
3986
  msgstr ""
3987
 
4005
  msgid "Notified LiteSpeed Web Server to purge the list."
4006
  msgstr ""
4007
 
4008
+ #: inc/media.class.php:114
4009
  msgid "LiteSpeed Optimization"
4010
  msgstr ""
4011
 
4012
+ #: inc/media.class.php:138
4013
  msgid "Disable WebP"
4014
  msgstr ""
4015
 
4016
+ #: inc/media.class.php:143
4017
  msgid "Enable WebP"
4018
  msgstr ""
4019
 
4020
+ #: inc/media.class.php:161
4021
  msgid "Restore Original File"
4022
  msgstr ""
4023
 
4024
+ #: inc/media.class.php:166
4025
  msgid "Switch To Optimized File"
4026
  msgstr ""
4027
 
4028
+ #: inc/media.class.php:180
4029
  msgid "WebP saved %s"
4030
  msgstr ""
4031
 
4032
+ #: inc/media.class.php:189
4033
  msgid "Original saved %s"
4034
  msgstr ""
4035
 
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.3.1
19
  * Author: LiteSpeed Technologies
20
  * Author URI: https://www.litespeedtech.com
21
  * License: GPLv3
15
  * Plugin Name: LiteSpeed Cache
16
  * Plugin URI: https://www.litespeedtech.com/products/cache-plugins/wordpress-acceleration
17
  * Description: WordPress plugin to connect to LSCache on LiteSpeed Web Server.
18
+ * Version: 2.4
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.3.1
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl.html
9
 
@@ -25,7 +25,7 @@ LSCWP supports WordPress Multisite and is compatible with most popular plugins,
25
  = General Features =
26
 
27
  * Object Cache (Memcached/LSMCD/Redis)
28
- * Image Optimization
29
  * Minify CSS, JavaScript, and HTML
30
  * Minify inline CSS/JS
31
  * Combine CSS/JS
@@ -267,6 +267,24 @@ Click on the `Advanced View` link at the top of the page, and several more tabs
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)
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.4
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl.html
9
 
25
  = General Features =
26
 
27
  * Object Cache (Memcached/LSMCD/Redis)
28
+ * Image Optimization (Lossless/Lossy)
29
  * Minify CSS, JavaScript, and HTML
30
  * Minify inline CSS/JS
31
  * Combine CSS/JS
267
 
268
  == Changelog ==
269
 
270
+ = 2.4 - Jul 2 2018 =
271
+ * [NEW FEATURE] <strong>Image Optimization</strong> Added lossless optimization.
272
+ * [NEW FEATURE] <strong>Image Optimization</strong> Added Request Orignal Images ON/OFF.
273
+ * [NEW FEATURE] <strong>Image Optimization</strong> Added Request WebP ON/OFF. (@JMCA2)
274
+ * [IMPROVEMENT] <strong>Image Optimization</strong> Improved optimization tools to archive maximum compression and score.
275
+ * [IMPROVEMENT] <strong>Image Optimization</strong> Improved speed of image pull.
276
+ * [IMPROVEMENT] <strong>Image Optimization</strong> Automatically recover credit after pulled.
277
+ * [REFACTOR] <strong>Config</strong> Separated configure const class.
278
+ * [BUGFIX] <strong>Report</strong> Report can be sent successfully with emoji now. (@music47ell)
279
+ * [IAPI] New Europe Image Optimization server (EU3/EU4).
280
+ * [IAPI] New America Image Optimization server (US3/US4/US5/US6).
281
+ * [IAPI] New Asian Image Optimization server (AS3).
282
+ * [IAPI] Refactored optimization process.
283
+ * [IAPI] Increased credit limit.
284
+ * [IAPI] Removed request interval limit.
285
+ * [IAPI] IAPI v2.4.
286
+ * <strong>We strongly recommended that you re-optimize your image library to get a better compression result</strong>.
287
+
288
  = 2.3.1 - Jun 18 2018 =
289
  * [Improvement] New setting to disable Generate Critical CSS. (@cybmeta)
290
  * [Improvement] Added filter to can_cdn/can_optm check. (@Jacob)