LiteSpeed Cache - Version 2.4.4

Version Description

  • Aug 31 2018 =
  • [NEW] CLI CLI can now support image optimization. (@Shon)
  • [IMPROVEMENT] GUI Cron/CLI will not create admin message anymore.
  • [UPDATE] Media Fixed a PHP notice that appeared when pulling optimized images.
  • [UPDATE] Fixed a PHP notice when detecting origin of ajax call. (@iosoft)
  • [DEBUG] Debug log can now log referer URL.
  • [DEBUG] Changes to options will now be logged.
Download this release

Release Info

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

Code changes from version 2.4 to 2.4.4

Files changed (81) hide show
  1. admin/admin-api.class.php +49 -4
  2. admin/litespeed-cache-admin-display.class.php +21 -5
  3. admin/litespeed-cache-admin-error.class.php +5 -3
  4. admin/litespeed-cache-admin-optimize.class.php +5 -0
  5. admin/litespeed-cache-admin-report.class.php +7 -20
  6. admin/litespeed-cache-admin-rules.class.php +7 -1
  7. admin/litespeed-cache-admin-settings.class.php +26 -7
  8. admin/litespeed-cache-admin.class.php +13 -6
  9. admin/tpl/api/quic.login.php +37 -0
  10. admin/tpl/api/quic.register.php +41 -0
  11. admin/tpl/api/quic.user_welcome.php +21 -0
  12. admin/tpl/image_optimization.php +6 -316
  13. admin/tpl/inc/api_key.php +5 -6
  14. admin/tpl/inc/check_cache_disabled.php +7 -7
  15. admin/tpl/inc/img_optm.communicate_notify.php +10 -0
  16. admin/tpl/inc/img_optm.initialize.php +38 -0
  17. admin/tpl/inc/img_optm.level_info.php +46 -0
  18. admin/tpl/inc/img_optm.percentage_summary.php +33 -0
  19. admin/tpl/inc/img_optm.summary.php +313 -0
  20. admin/tpl/inc/modal.footer.php +3 -0
  21. admin/tpl/inc/modal.header.php +17 -0
  22. admin/tpl/setting/settings_cdn.php +18 -39
  23. admin/tpl/setting/settings_inc.cache_browser.php +1 -1
  24. admin/tpl/setting/settings_inc.check_adv_file.php +4 -3
  25. admin/tpl/setting/settings_inc.media_webp.php +1 -2
  26. admin/tpl/setting/settings_media.php +40 -11
  27. admin/tpl/setting/settings_optimize.php +4 -4
  28. cli/litespeed-cache-cli-admin.class.php +15 -21
  29. cli/litespeed-cache-cli-iapi.class.php +183 -0
  30. css/litespeed.css +425 -4
  31. inc/activation.class.php +5 -0
  32. inc/api.class.php +7 -7
  33. inc/cdn.class.php +9 -1
  34. inc/cdn/quic.class.php +257 -0
  35. inc/config.class.php +15 -6
  36. inc/const.cls.php +50 -10
  37. inc/control.class.php +7 -1
  38. inc/crawler-sitemap.class.php +4 -0
  39. inc/crawler.class.php +5 -1
  40. inc/css.cls.php +12 -1
  41. inc/data.class.php +62 -32
  42. inc/data_structure/img_optm.sql +1 -1
  43. inc/doc.cls.php +16 -1
  44. inc/esi.class.php +5 -1
  45. inc/gui.class.php +75 -5
  46. inc/img_optm.class.php +520 -214
  47. inc/import.class.php +68 -21
  48. inc/litespeed-cache.class.php +10 -4
  49. inc/litespeed.autoload.php +2 -1
  50. inc/log.class.php +11 -0
  51. inc/media.class.php +122 -54
  52. inc/object.class.php +4 -1
  53. inc/optimize.class.php +10 -2
  54. inc/optimizer.class.php +4 -1
  55. inc/purge.class.php +7 -3
  56. inc/router.class.php +27 -7
  57. inc/tag.class.php +5 -3
  58. inc/task.class.php +31 -8
  59. inc/utility.class.php +12 -6
  60. inc/vary.class.php +5 -3
  61. includes/litespeed-cache-activation.class.php +5 -0
  62. includes/litespeed-cache-api.class.php +7 -7
  63. includes/litespeed-cache-cdn.class.php +9 -1
  64. includes/litespeed-cache-config.class.php +15 -6
  65. includes/litespeed-cache-control.class.php +7 -1
  66. includes/litespeed-cache-crawler.class.php +5 -1
  67. includes/litespeed-cache-esi.class.php +5 -1
  68. includes/litespeed-cache-gui.class.php +75 -5
  69. includes/litespeed-cache-log.class.php +11 -0
  70. includes/litespeed-cache-optimize.class.php +10 -2
  71. includes/litespeed-cache-purge.class.php +7 -3
  72. includes/litespeed-cache-router.class.php +27 -7
  73. includes/litespeed-cache-tag.class.php +5 -3
  74. includes/litespeed-cache-task.class.php +31 -8
  75. includes/litespeed-cache-utility.class.php +12 -6
  76. includes/litespeed-cache-vary.class.php +5 -3
  77. includes/litespeed-cache.class.php +10 -4
  78. includes/litespeed.autoload.php +2 -1
  79. languages/litespeed-cache.pot +673 -560
  80. litespeed-cache.php +3 -2
  81. readme.txt +65 -13
admin/admin-api.class.php CHANGED
@@ -7,6 +7,11 @@
7
* @subpackage LiteSpeed_Cache/admin
8
* @author LiteSpeed Technologies <info@litespeedtech.com>
9
*/
10
class LiteSpeed_Cache_Admin_API
11
{
12
private static $_instance ;
@@ -26,7 +31,8 @@ class LiteSpeed_Cache_Admin_API
26
const IAPI_ACTION_REQUEST_KEY = 'request_key' ;
27
const IAPI_ACTION_MEDIA_SYNC_DATA = 'media_sync_data' ;
28
const IAPI_ACTION_REQUEST_OPTIMIZE = 'request_optimize' ;
29
- const IAPI_ACTION_PULL_IMG = 'client_pull' ;
30
const IAPI_ACTION_PULL_IMG_FAILED = 'client_pull_failed' ;
31
const IAPI_ACTION_REQUEST_DESTROY = 'imgoptm_destroy' ;
32
const IAPI_ACTION_REQUEST_DESTROY_UNFINISHED = 'imgoptm_destroy_unfinished' ;
@@ -236,8 +242,11 @@ class LiteSpeed_Cache_Admin_API
236
// Check if get key&server correctly
237
if ( empty( $json[ 'auth_key' ] ) ) {
238
LiteSpeed_Cache_Log::debug( '[IAPI] request key failed: ', $json ) ;
239
- $msg = sprintf( __( 'IAPI Error %s', 'litespeed-cache' ), $json ) ;
240
- LiteSpeed_Cache_Admin_Display::error( $msg ) ;
241
return ;
242
}
243
@@ -269,6 +278,7 @@ class LiteSpeed_Cache_Admin_API
269
* @since 1.6
270
* @access private
271
* @param array $data
272
*/
273
private function _post( $action, $data = false, $server = false, $no_hash = false )
274
{
@@ -310,6 +320,10 @@ class LiteSpeed_Cache_Admin_API
310
311
if ( ! is_array( $json ) ) {
312
LiteSpeed_Cache_Log::debug( '[IAPI] failed to decode post json: ' . $response[ 'body' ] ) ;
313
return $response[ 'body' ] ;
314
}
315
@@ -318,7 +332,17 @@ class LiteSpeed_Cache_Admin_API
318
$msg = __( 'Failed to communicate with LiteSpeed image server', 'litespeed-cache' ) . ': ' . $json[ '_err' ] ;
319
$msg .= $this->_parse_link( $json ) ;
320
LiteSpeed_Cache_Admin_Display::error( $msg ) ;
321
- return null ;
322
}
323
324
if ( ! empty( $json[ '_info' ] ) ) {
@@ -337,6 +361,27 @@ class LiteSpeed_Cache_Admin_API
337
unset( $json[ '_note' ] ) ;
338
}
339
340
return $json ;
341
}
342
7
* @subpackage LiteSpeed_Cache/admin
8
* @author LiteSpeed Technologies <info@litespeedtech.com>
9
*/
10
+
11
+ if ( ! defined( 'WPINC' ) ) {
12
+ die ;
13
+ }
14
+
15
class LiteSpeed_Cache_Admin_API
16
{
17
private static $_instance ;
31
const IAPI_ACTION_REQUEST_KEY = 'request_key' ;
32
const IAPI_ACTION_MEDIA_SYNC_DATA = 'media_sync_data' ;
33
const IAPI_ACTION_REQUEST_OPTIMIZE = 'request_optimize' ;
34
+ const IAPI_ACTION_PULL_IMG = 'client_pull' ; // Deprecated
35
+ const IAPI_ACTION_IMG_TAKEN = 'client_img_taken' ;
36
const IAPI_ACTION_PULL_IMG_FAILED = 'client_pull_failed' ;
37
const IAPI_ACTION_REQUEST_DESTROY = 'imgoptm_destroy' ;
38
const IAPI_ACTION_REQUEST_DESTROY_UNFINISHED = 'imgoptm_destroy_unfinished' ;
242
// Check if get key&server correctly
243
if ( empty( $json[ 'auth_key' ] ) ) {
244
LiteSpeed_Cache_Log::debug( '[IAPI] request key failed: ', $json ) ;
245
+
246
+ if ( $json ) {
247
+ $msg = sprintf( __( 'IAPI Error %s', 'litespeed-cache' ), $json ) ;
248
+ LiteSpeed_Cache_Admin_Display::error( $msg ) ;
249
+ }
250
return ;
251
}
252
278
* @since 1.6
279
* @access private
280
* @param array $data
281
+ * @return string | array Must return an error msg string or json array
282
*/
283
private function _post( $action, $data = false, $server = false, $no_hash = false )
284
{
320
321
if ( ! is_array( $json ) ) {
322
LiteSpeed_Cache_Log::debug( '[IAPI] failed to decode post json: ' . $response[ 'body' ] ) ;
323
+
324
+ $msg = __( 'Failed to post via WordPress', 'litespeed-cache' ) . ': ' . $response[ 'body' ] ;
325
+ LiteSpeed_Cache_Admin_Display::error( $msg ) ;
326
+
327
return $response[ 'body' ] ;
328
}
329
332
$msg = __( 'Failed to communicate with LiteSpeed image server', 'litespeed-cache' ) . ': ' . $json[ '_err' ] ;
333
$msg .= $this->_parse_link( $json ) ;
334
LiteSpeed_Cache_Admin_Display::error( $msg ) ;
335
+ return $json[ '_err' ] ;
336
+ }
337
+
338
+ if ( ! empty( $json[ '_503' ] ) ) {
339
+ LiteSpeed_Cache_Log::debug( '[IAPI] service 503 unavailable temporarily. ' . $json[ '_503' ] ) ;
340
+
341
+ $msg = __( 'We are working hard to improve your Image Optimization experience. The service will be unavailable while we work. We apologize for any inconvenience.', 'litespeed-cache' ) ;
342
+ $msg .= ' ' . $json[ '_503' ] ;
343
+ LiteSpeed_Cache_Admin_Display::error( $msg ) ;
344
+
345
+ return $json[ '_503' ] ;
346
}
347
348
if ( ! empty( $json[ '_info' ] ) ) {
361
unset( $json[ '_note' ] ) ;
362
}
363
364
+ if ( ! empty( $json[ '_success' ] ) ) {
365
+ LiteSpeed_Cache_Log::debug( '[IAPI] _success: ' . $json[ '_success' ] ) ;
366
+ $msg = __( 'Good news from LiteSpeed image server', 'litespeed-cache' ) . ': ' . $json[ '_success' ] ;
367
+ $msg .= $this->_parse_link( $json ) ;
368
+ LiteSpeed_Cache_Admin_Display::succeed( $msg ) ;
369
+ unset( $json[ '_success' ] ) ;
370
+ }
371
+
372
+ // Upgrade is required
373
+ if ( ! empty( $json[ '_err_req_v' ] ) ) {
374
+ LiteSpeed_Cache_Log::debug( '[IAPI] _err_req_v: ' . $json[ '_err_req_v' ] ) ;
375
+ $msg = sprintf( __( '%s plugin version %s required for this action.', 'litespeed-cache' ), LiteSpeed_Cache::NAME, 'v' . $json[ '_err_req_v' ] . '+' ) ;
376
+
377
+ // Append upgrade link
378
+ $msg2 = ' ' . LiteSpeed_Cache_GUI::plugin_upgrade_link( LiteSpeed_Cache::NAME, LiteSpeed_Cache::PLUGIN_NAME, $json[ '_err_req_v' ] ) ;
379
+
380
+ $msg2 .= $this->_parse_link( $json ) ;
381
+ LiteSpeed_Cache_Admin_Display::error( $msg . $msg2 ) ;
382
+ return $msg ;
383
+ }
384
+
385
return $json ;
386
}
387
admin/litespeed-cache-admin-display.class.php CHANGED
@@ -1,5 +1,4 @@
1
<?php
2
-
3
/**
4
* The admin-panel specific functionality of the plugin.
5
*
@@ -9,6 +8,11 @@
9
* @subpackage LiteSpeed_Cache/admin
10
* @author LiteSpeed Technologies <info@litespeedtech.com>
11
*/
12
class LiteSpeed_Cache_Admin_Display
13
{
14
private static $_instance ;
@@ -145,13 +149,13 @@ class LiteSpeed_Cache_Admin_Display
145
$capability = is_network_admin() ? 'manage_network_options' : 'manage_options' ;
146
if ( current_user_can($capability) ) {
147
// root menu
148
- add_menu_page('LiteSpeed Cache', 'LiteSpeed Cache', 'manage_options', 'lscache-dash') ;
149
150
// sub menus
151
- $this->add_submenu(__('Manage', 'litespeed-cache'), 'lscache-dash', 'show_menu_manage') ;
152
-
153
$this->add_submenu(__('Settings', 'litespeed-cache'), 'lscache-settings', 'show_menu_settings') ;
154
155
if ( ! is_multisite() || is_network_admin() ) {
156
$this->add_submenu(__('Edit .htaccess', 'litespeed-cache'), LiteSpeed_Cache::PAGE_EDIT_HTACCESS, 'show_menu_edit_htaccess') ;
157
}
@@ -181,7 +185,7 @@ class LiteSpeed_Cache_Admin_Display
181
*/
182
private function add_submenu($menu_title, $menu_slug, $callback)
183
{
184
- add_submenu_page('lscache-dash', $menu_title, $menu_title, 'manage_options', $menu_slug, array($this, $callback)) ;
185
}
186
187
/**
@@ -463,6 +467,11 @@ class LiteSpeed_Cache_Admin_Display
463
*/
464
public static function add_notice($color, $msg)
465
{
466
$messages = (array)get_transient(self::TRANSIENT_LITESPEED_MESSAGE) ;
467
if( ! $messages ) {
468
$messages = array() ;
@@ -489,7 +498,14 @@ class LiteSpeed_Cache_Admin_Display
489
$messages = get_transient(self::TRANSIENT_LITESPEED_MESSAGE) ;
490
if( is_array($messages) ) {
491
$messages = array_unique($messages) ;
492
foreach ($messages as $msg) {
493
echo $msg ;
494
}
495
}
1
<?php
2
/**
3
* The admin-panel specific functionality of the plugin.
4
*
8
* @subpackage LiteSpeed_Cache/admin
9
* @author LiteSpeed Technologies <info@litespeedtech.com>
10
*/
11
+
12
+ if ( ! defined( 'WPINC' ) ) {
13
+ die ;
14
+ }
15
+
16
class LiteSpeed_Cache_Admin_Display
17
{
18
private static $_instance ;
149
$capability = is_network_admin() ? 'manage_network_options' : 'manage_options' ;
150
if ( current_user_can($capability) ) {
151
// root menu
152
+ add_menu_page('LiteSpeed Cache', 'LiteSpeed Cache', 'manage_options', 'lscache-settings') ;
153
154
// sub menus
155
$this->add_submenu(__('Settings', 'litespeed-cache'), 'lscache-settings', 'show_menu_settings') ;
156
157
+ $this->add_submenu(__('Manage', 'litespeed-cache'), 'lscache-dash', 'show_menu_manage') ;
158
+
159
if ( ! is_multisite() || is_network_admin() ) {
160
$this->add_submenu(__('Edit .htaccess', 'litespeed-cache'), LiteSpeed_Cache::PAGE_EDIT_HTACCESS, 'show_menu_edit_htaccess') ;
161
}
185
*/
186
private function add_submenu($menu_title, $menu_slug, $callback)
187
{
188
+ add_submenu_page('lscache-settings', $menu_title, $menu_title, 'manage_options', $menu_slug, array($this, $callback)) ;
189
}
190
191
/**
467
*/
468
public static function add_notice($color, $msg)
469
{
470
+ // Bypass adding for CLI or cron
471
+ if ( defined( 'LITESPEED_CLI' ) || defined( 'DOING_CRON' ) ) {
472
+ return ;
473
+ }
474
+
475
$messages = (array)get_transient(self::TRANSIENT_LITESPEED_MESSAGE) ;
476
if( ! $messages ) {
477
$messages = array() ;
498
$messages = get_transient(self::TRANSIENT_LITESPEED_MESSAGE) ;
499
if( is_array($messages) ) {
500
$messages = array_unique($messages) ;
501
+
502
+ $added_thickbox = false ;
503
foreach ($messages as $msg) {
504
+ // Added for popup links
505
+ if ( strpos( $msg, 'TB_iframe' ) && ! $added_thickbox ) {
506
+ add_thickbox();
507
+ $added_thickbox = true ;
508
+ }
509
echo $msg ;
510
}
511
}
admin/litespeed-cache-admin-error.class.php CHANGED
@@ -1,7 +1,4 @@
1
<?php
2
-
3
-
4
-
5
/**
6
* The admin errors
7
*
@@ -11,6 +8,11 @@
11
* @subpackage LiteSpeed_Cache/admin
12
* @author LiteSpeed Technologies <info@litespeedtech.com>
13
*/
14
class LiteSpeed_Cache_Admin_Error
15
{
16
private static $_instance ;
1
<?php
2
/**
3
* The admin errors
4
*
8
* @subpackage LiteSpeed_Cache/admin
9
* @author LiteSpeed Technologies <info@litespeedtech.com>
10
*/
11
+
12
+ if ( ! defined( 'WPINC' ) ) {
13
+ die ;
14
+ }
15
+
16
class LiteSpeed_Cache_Admin_Error
17
{
18
private static $_instance ;
admin/litespeed-cache-admin-optimize.class.php CHANGED
@@ -8,6 +8,11 @@
8
* @subpackage LiteSpeed_Cache/admin
9
* @author LiteSpeed Technologies <info@litespeedtech.com>
10
*/
11
class LiteSpeed_Cache_Admin_Optimize
12
{
13
private static $_types = array( 'revision', 'auto_draft', 'trash_post', 'spam_comment', 'trash_comment', 'trackback-pingback', 'expired_transient', 'all_transients' ) ;
8
* @subpackage LiteSpeed_Cache/admin
9
* @author LiteSpeed Technologies <info@litespeedtech.com>
10
*/
11
+
12
+ if ( ! defined( 'WPINC' ) ) {
13
+ die ;
14
+ }
15
+
16
class LiteSpeed_Cache_Admin_Optimize
17
{
18
private static $_types = array( 'revision', 'auto_draft', 'trash_post', 'spam_comment', 'trash_comment', 'trackback-pingback', 'expired_transient', 'all_transients' ) ;
admin/litespeed-cache-admin-report.class.php CHANGED
@@ -1,5 +1,4 @@
1
<?php
2
-
3
/**
4
* The report class
5
*
@@ -9,6 +8,11 @@
9
* @subpackage LiteSpeed_Cache/admin
10
* @author LiteSpeed Technologies <info@litespeedtech.com>
11
*/
12
class LiteSpeed_Cache_Admin_Report
13
{
14
private static $_instance ;
@@ -161,7 +165,7 @@ class LiteSpeed_Cache_Admin_Report
161
162
// Security: Remove cf key in report
163
$secure_fields = array(
164
- LiteSpeed_Cache_Config::OPID_CDN_QUIC_KEY,
165
LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE_KEY,
166
LiteSpeed_Cache_Config::OPID_CACHE_OBJECT_PSWD,
167
) ;
@@ -206,24 +210,7 @@ class LiteSpeed_Cache_Admin_Report
206
$server_vars = array_intersect_key($server, $server_keys) ;
207
$server_vars[] = "LSWCP_TAG_PREFIX = " . LSWCP_TAG_PREFIX ;
208
209
- $consts = array(
210
- 'WP_SITEURL',
211
- 'WP_HOME',
212
- 'WP_CONTENT_DIR',
213
- 'SHORTINIT',
214
- 'LSCWP_CONTENT_DIR',
215
- 'LSCWP_DIR',
216
- 'LITESPEED_TIME_OFFSET',
217
- 'LITESPEED_SERVER_TYPE',
218
- 'LITESPEED_CLI',
219
- 'LITESPEED_ALLOWED',
220
- 'LITESPEED_ON',
221
- 'LITESPEED_ON_IN_SETTING',
222
- 'LSCACHE_ADV_CACHE',
223
- ) ;
224
- foreach ( $consts as $v ) {
225
- $server_vars[ $v ] = defined( $v ) ? constant( $v ) : NULL ;
226
- }
227
228
$buf = $this->format_report_section('Server Variables', $server_vars) ;
229
1
<?php
2
/**
3
* The report class
4
*
8
* @subpackage LiteSpeed_Cache/admin
9
* @author LiteSpeed Technologies <info@litespeedtech.com>
10
*/
11
+
12
+ if ( ! defined( 'WPINC' ) ) {
13
+ die ;
14
+ }
15
+
16
class LiteSpeed_Cache_Admin_Report
17
{
18
private static $_instance ;
165
166
// Security: Remove cf key in report
167
$secure_fields = array(
168
+ LiteSpeed_Cache_Config::OPT_CDN_QUIC_KEY,
169
LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE_KEY,
170
LiteSpeed_Cache_Config::OPID_CACHE_OBJECT_PSWD,
171
) ;
210
$server_vars = array_intersect_key($server, $server_keys) ;
211
$server_vars[] = "LSWCP_TAG_PREFIX = " . LSWCP_TAG_PREFIX ;
212
213
+ $server_vars = array_merge( $server_vars, LiteSpeed_Cache_Config::get_instance()->server_vars() ) ;
214
215
$buf = $this->format_report_section('Server Variables', $server_vars) ;
216
admin/litespeed-cache-admin-rules.class.php CHANGED
@@ -8,6 +8,11 @@
8
* @subpackage LiteSpeed_Cache/admin
9
* @author LiteSpeed Technologies <info@litespeedtech.com>
10
*/
11
class LiteSpeed_Cache_Admin_Rules
12
{
13
private static $_instance ;
@@ -666,7 +671,8 @@ class LiteSpeed_Cache_Admin_Rules
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"' ;
670
$new_rules[] = 'RewriteRule .* - [E=Cache-Control:vary=%{ENV:LSCACHE_VARY_VALUE}+webp]' ;
671
$new_rules[] = self::MARKER_WEBP . self::MARKER_END ;
672
$new_rules[] = '' ;
8
* @subpackage LiteSpeed_Cache/admin
9
* @author LiteSpeed Technologies <info@litespeedtech.com>
10
*/
11
+
12
+ if ( ! defined( 'WPINC' ) ) {
13
+ die ;
14
+ }
15
+
16
class LiteSpeed_Cache_Admin_Rules
17
{
18
private static $_instance ;
671
$id = LiteSpeed_Cache_Config::OPT_MEDIA_WEBP_REPLACE ;
672
if ( ! empty( $cfg[ $id ] ) ) {
673
$new_rules[] = self::MARKER_WEBP . self::MARKER_START ;
674
+ $new_rules[] = 'RewriteCond %{HTTP_ACCEPT} "image/webp" [or]' ;
675
+ $new_rules[] = 'RewriteCond %{HTTP_USER_AGENT} "Page Speed"' ;
676
$new_rules[] = 'RewriteRule .* - [E=Cache-Control:vary=%{ENV:LSCACHE_VARY_VALUE}+webp]' ;
677
$new_rules[] = self::MARKER_WEBP . self::MARKER_END ;
678
$new_rules[] = '' ;
admin/litespeed-cache-admin-settings.class.php CHANGED
@@ -8,13 +8,18 @@
8
* @subpackage LiteSpeed_Cache/admin
9
* @author LiteSpeed Technologies <info@litespeedtech.com>
10
*/
11
class LiteSpeed_Cache_Admin_Settings
12
{
13
private static $_instance ;
14
15
private $_input ;
16
private $_options ;
17
- private $_err ;
18
19
private $_max_int = 2147483647 ;
20
@@ -120,7 +125,17 @@ class LiteSpeed_Cache_Admin_Settings
120
}
121
}
122
123
- $this->_validate_thirdparty( ) ;
124
125
return $this->_options ;
126
}
@@ -533,7 +548,7 @@ class LiteSpeed_Cache_Admin_Settings
533
$cdn_cloudflare_changed = false ;
534
$ids = array(
535
LiteSpeed_Cache_Config::OPID_CDN,
536
- LiteSpeed_Cache_Config::OPID_CDN_QUIC,
537
LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE,
538
) ;
539
foreach ( $ids as $id ) {
@@ -613,12 +628,11 @@ class LiteSpeed_Cache_Admin_Settings
613
614
/**
615
* Quic API
616
- * @since 1.9.1
617
*/
618
$ids = array(
619
- LiteSpeed_Cache_Config::OPID_CDN_QUIC_EMAIL,
620
- LiteSpeed_Cache_Config::OPID_CDN_QUIC_KEY,
621
- LiteSpeed_Cache_Config::OPID_CDN_QUIC_SITE,
622
) ;
623
foreach ( $ids as $id ) {
624
if ( $this->_options[ $id ] === $this->_input[ $id ] ) {
@@ -671,9 +685,11 @@ 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::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,
@@ -884,6 +900,9 @@ class LiteSpeed_Cache_Admin_Settings
884
885
// Remove Object Cache
886
if ( $this->_options[ LiteSpeed_Cache_Config::OPID_DEBUG_DISABLE_ALL ] ) {
887
LiteSpeed_Cache_Log::debug( '[Settings] Remove .object_cache.ini due to debug_disable_all' ) ;
888
LiteSpeed_Cache_Object::get_instance()->del_file() ;
889
8
* @subpackage LiteSpeed_Cache/admin
9
* @author LiteSpeed Technologies <info@litespeedtech.com>
10
*/
11
+
12
+ if ( ! defined( 'WPINC' ) ) {
13
+ die ;
14
+ }
15
+
16
class LiteSpeed_Cache_Admin_Settings
17
{
18
private static $_instance ;
19
20
private $_input ;
21
private $_options ;
22
+ private $_err = array() ;
23
24
private $_max_int = 2147483647 ;
25
125
}
126
}
127
128
+ $this->_validate_thirdparty() ;
129
+
130
+ /**
131
+ * Check if need to send cfg to CDN or not
132
+ * @since 2.3
133
+ */
134
+ $id = LiteSpeed_Cache_Config::OPT_CDN_QUIC ;
135
+ if ( $this->_options[ $id ] ) {
136
+ // Send to Quic CDN
137
+ LiteSpeed_Cache_CDN_Quic::sync_config( $this->_options ) ;
138
+ }
139
140
return $this->_options ;
141
}
548
$cdn_cloudflare_changed = false ;
549
$ids = array(
550
LiteSpeed_Cache_Config::OPID_CDN,
551
+ LiteSpeed_Cache_Config::OPT_CDN_QUIC,
552
LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE,
553
) ;
554
foreach ( $ids as $id ) {
628
629
/**
630
* Quic API
631
+ * @since 2.4.1
632
*/
633
$ids = array(
634
+ LiteSpeed_Cache_Config::OPT_CDN_QUIC_EMAIL,
635
+ LiteSpeed_Cache_Config::OPT_CDN_QUIC_KEY,
636
) ;
637
foreach ( $ids as $id ) {
638
if ( $this->_options[ $id ] === $this->_input[ $id ] ) {
685
$ids = array(
686
LiteSpeed_Cache_Config::OPID_MEDIA_IMG_LAZY,
687
LiteSpeed_Cache_Config::OPID_MEDIA_IFRAME_LAZY,
688
+ LiteSpeed_Cache_Config::OPID_MEDIA_IMG_LAZYJS_INLINE,
689
LiteSpeed_Cache_Config::OPT_MEDIA_OPTM_AUTO,
690
LiteSpeed_Cache_Config::OPT_MEDIA_OPTM_CRON,
691
LiteSpeed_Cache_Config::OPT_MEDIA_OPTM_ORI,
692
+ LiteSpeed_Cache_Config::OPT_MEDIA_RM_ORI_BKUP,
693
LiteSpeed_Cache_Config::OPT_MEDIA_OPTM_WEBP,
694
LiteSpeed_Cache_Config::OPT_MEDIA_OPTM_LOSSLESS,
695
LiteSpeed_Cache_Config::OPT_MEDIA_OPTM_EXIF,
900
901
// Remove Object Cache
902
if ( $this->_options[ LiteSpeed_Cache_Config::OPID_DEBUG_DISABLE_ALL ] ) {
903
+ // Do a purge all (This is before oc file removal, can purge oc too)
904
+ LiteSpeed_Cache_Purge::purge_all( '[Settings] Debug Disabled ALL' ) ;
905
+
906
LiteSpeed_Cache_Log::debug( '[Settings] Remove .object_cache.ini due to debug_disable_all' ) ;
907
LiteSpeed_Cache_Object::get_instance()->del_file() ;
908
admin/litespeed-cache-admin.class.php CHANGED
@@ -8,12 +8,16 @@
8
* @subpackage LiteSpeed_Cache/admin
9
* @author LiteSpeed Technologies <info@litespeedtech.com>
10
*/
11
class LiteSpeed_Cache_Admin
12
{
13
private static $_instance ;
14
private $config ;
15
private $display ;
16
- private $main ;
17
18
/**
19
* Initialize the class and set its properties.
@@ -214,13 +218,16 @@ class LiteSpeed_Cache_Admin
214
}
215
216
if ( is_multisite() && ( ! is_network_admin() || ! current_user_can('manage_network_options')) ) {
217
- $third = __('For this scenario only, the network admin may uncheck "Check Advanced Cache" in LiteSpeed Cache settings.', 'litespeed-cache') ;
218
}else {
219
- $third = __('For this scenario only, please uncheck "Check Advanced Cache" in LiteSpeed Cache settings.', 'litespeed-cache') ;
220
}
221
- $msg = __('Please disable/deactivate any other Full Page Cache solutions that are currently being used.', 'litespeed-cache') . ' '
222
- . __('LiteSpeed Cache does work with other cache solutions, but only their non-page caching offerings—such as minifying css/js files.', 'litespeed-cache') . ' '
223
- . $third ;
224
225
$this->display->add_notice(LiteSpeed_Cache_Admin_Display::NOTICE_YELLOW, $msg) ;
226
}
8
* @subpackage LiteSpeed_Cache/admin
9
* @author LiteSpeed Technologies <info@litespeedtech.com>
10
*/
11
+
12
+ if ( ! defined( 'WPINC' ) ) {
13
+ die ;
14
+ }
15
+
16
class LiteSpeed_Cache_Admin
17
{
18
private static $_instance ;
19
private $config ;
20
private $display ;
21
22
/**
23
* Initialize the class and set its properties.
218
}
219
220
if ( is_multisite() && ( ! is_network_admin() || ! current_user_can('manage_network_options')) ) {
221
+ $third = __('If this is the case, the network admin may uncheck "Check Advanced Cache" in LiteSpeed Cache Advanced settings.', 'litespeed-cache') ;
222
}else {
223
+ $third = __('If this is the case, please uncheck "Check Advanced Cache" in LiteSpeed Cache Advanced settings.', 'litespeed-cache') ;
224
}
225
+ $msg = __('LiteSpeed has detected another plugin using the "Advanced Cache" file.', 'litespeed-cache') . ' '
226
+ . __('LiteSpeed Cache does work with other optimization plugins, but only if functionality is not duplicated. Only one full-page cache may be activated.', 'litespeed-cache') . ' '
227
+ . $third
228
+ . ' <a href="https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp:customizations:multi-cache-plugins" target="_blank">'
229
+ . __( 'Learn More', 'litespeed-cache' )
230
+ . '</a>' ;
231
232
$this->display->add_notice(LiteSpeed_Cache_Admin_Display::NOTICE_YELLOW, $msg) ;
233
}
admin/tpl/api/quic.login.php ADDED
@@ -0,0 +1,37 @@
1
+ <?php
2
+ if ( ! defined( 'WPINC' ) ) {
3
+ die ;
4
+ }
5
+ ?>
6
+
7
+ <h1 class="litespeed-title"><?php echo __('Quic Cloud User Panel', 'litespeed-cache') ; ?></h1>
8
+
9
+ <form method="post" action="admin.php" id="litespeed_form_quic" class="litespeed-relative">
10
+ <input type="hidden" name="<?php echo LiteSpeed_Cache::ACTION_KEY ; ?>" value="<?php echo LiteSpeed_Cache::ACTION_CDN_QUIC ; ?>" />
11
+ <input type="hidden" name="step" value="login" />
12
+ <input type="hidden" name="email" value="<?php echo $data[ 'email' ] ; ?>" />
13
+ <?php wp_nonce_field( LiteSpeed_Cache::ACTION_CDN_QUIC, LiteSpeed_Cache::NONCE_NAME ) ; ?>
14
+
15
+ <?php if ( ! empty( $data[ '_err' ] ) ) : ?>
16
+ <div class="litespeed-callout-danger">
17
+ <h4><?php echo __( 'ERROR', 'litespeed-cache' ) ; ?>:</h4>
18
+ <ol>
19
+ <li><?php echo $data[ '_err' ] ; ?></li>
20
+ </ol>
21
+ </div>
22
+ <?php endif ; ?>
23
+
24
+ <div class="litespeed-row">
25
+ <h4><?php echo __( 'Email', 'litespeed-cache' ) ; ?>:</h4>
26
+ <?php echo $data[ 'email' ] ; ?>
27
+ </div>
28
+
29
+ <div class="litespeed-row">
30
+ <h4><?php echo __( 'Password', 'litespeed-cache' ) ; ?> <?php echo __( 'Or', 'litespeed-cache' ) ; ?> <?php echo __( 'User API Key', 'litespeed-cache' ) ; ?> :</h4>
31
+ <input type="password" name="pswd_or_key" class="litespeed-regular-text" value="<?php echo LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPT_CDN_QUIC_KEY ) ; ?>" />
32
+ </div>
33
+
34
+ <input type="submit" class="button litespeed-btn-success" value="<?php echo __( 'Login', 'litespeed-cache' ) ; ?>" />
35
+
36
+ <a href="javascript:;" onclick="window.history.back();" class="button litespeed-btn-primary litespeed-right"><?php echo __( 'Back', 'litespeed-cache' ) ; ?></a>
37
+ </form>
admin/tpl/api/quic.register.php ADDED
@@ -0,0 +1,41 @@
1
+ <?php
2
+ if ( ! defined( 'WPINC' ) ) {
3
+ die ;
4
+ }
5
+ ?>
6
+
7
+ <h1 class="litespeed-title"><?php echo __('Quic Cloud User Panel', 'litespeed-cache') ; ?></h1>
8
+
9
+ <form method="post" action="admin.php" id="litespeed_form_quic" class="litespeed-relative">
10
+ <input type="hidden" name="<?php echo LiteSpeed_Cache::ACTION_KEY ; ?>" value="<?php echo LiteSpeed_Cache::ACTION_CDN_QUIC ; ?>" />
11
+ <input type="hidden" name="step" value="register" />
12
+ <input type="hidden" name="email" value="<?php echo $data[ 'email' ] ; ?>" />
13
+ <?php wp_nonce_field( LiteSpeed_Cache::ACTION_CDN_QUIC, LiteSpeed_Cache::NONCE_NAME ) ; ?>
14
+
15
+ <?php if ( ! empty( $data[ '_err' ] ) ) : ?>
16
+ <div class="litespeed-callout-danger">
17
+ <h4><?php echo __( 'ERROR', 'litespeed-cache' ) ; ?>:</h4>
18
+ <ol>
19
+ <li><?php echo $data[ '_err' ] ; ?></li>
20
+ </ol>
21
+ </div>
22
+ <?php endif ; ?>
23
+
24
+ <div class="litespeed-row">
25
+ <h4><?php echo __( 'Email', 'litespeed-cache' ) ; ?>:</h4>
26
+ <?php echo $data[ 'email' ] ; ?>
27
+ </div>
28
+
29
+ <div class="litespeed-row">
30
+ <h4><?php echo __( 'Password', 'litespeed-cache' ) ; ?>:</h4>
31
+ <input type="password" name="pswd" class="litespeed-regular-text" required />
32
+ </div>
33
+
34
+ <input type="checkbox" class="form-check-input" id="exampleCheck1" required />
35
+ <label class="form-check-label" for="exampleCheck1">I agree to <a href="https://quic.cloud/agreement" target="_blank">QuicCloud's terms and conditions</a></label><br />
36
+
37
+ <input type="submit" class="button litespeed-btn-success" value="<?php echo __( 'Register', 'litespeed-cache' ) ; ?>" />
38
+
39
+ <a href="javascript:;" onclick="window.history.back();" class="button litespeed-btn-primary litespeed-right"><?php echo __( 'Back', 'litespeed-cache' ) ; ?></a>
40
+
41
+ </form>
admin/tpl/api/quic.user_welcome.php ADDED
@@ -0,0 +1,21 @@
1
+ <?php
2
+ if ( ! defined( 'WPINC' ) ) {
3
+ die ;
4
+ }
5
+ ?>
6
+
7
+ <h1 class="litespeed-title"><?php echo __('Quic Cloud User Panel', 'litespeed-cache') ; ?></h1>
8
+
9
+ <form method="post" action="admin.php" id="litespeed_form_quic" class="litespeed-relative">
10
+ <input type="hidden" name="<?php echo LiteSpeed_Cache::ACTION_KEY ; ?>" value="<?php echo LiteSpeed_Cache::ACTION_CDN_QUIC ; ?>" />
11
+ <input type="hidden" name="step" value="check_email" />
12
+ <?php wp_nonce_field( LiteSpeed_Cache::ACTION_CDN_QUIC, LiteSpeed_Cache::NONCE_NAME ) ; ?>
13
+
14
+ <div class="litespeed-row">
15
+ <h4><?php echo __( 'Email', 'litespeed-cache' ) ; ?>:</h4>
16
+ <input type="text" name="email" value="<?php echo LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPT_CDN_QUIC_EMAIL ) ; ?>" class="litespeed-regular-text litespeed-input-large" required placeholder="<?php echo __( 'Email', 'litespeed-cache' ) ; ?>" />
17
+ </div>
18
+
19
+ <input type="submit" class="button litespeed-btn-success" value="<?php echo __( 'Next', 'litespeed-cache' ) ; ?>" />
20
+
21
+ </form>
admin/tpl/image_optimization.php CHANGED
@@ -12,50 +12,6 @@ list( $storage_data, $rm_log ) = $img_optm->storage_data() ;
12
13
list( $last_run, $is_running ) = $img_optm->cron_running( false ) ;
14
15
- $_optm_summary_list = array(
16
- 'level' => array(
17
- 'title' => __( 'Level', 'litespeed-cache' ),
18
- 'must' => true,
19
- ),
20
- 'credit' => array(
21
- 'title' => __( 'Credit', 'litespeed-cache' ),
22
- 'desc' => __( 'Credit recovers with each successful pull.', 'litespeed-cache' ),
23
- 'must' => true,
24
- ),
25
- 'reduced' => array(
26
- 'title' => __( 'Total Reduction', 'litespeed-cache' ),
27
- 'type' => 'file_size',
28
- ),
29
- 'img_taken' => array(
30
- 'title' => __( 'Images pulled', 'litespeed-cache' ),
31
- ),
32
- 'fetch_failed' => array(
33
- 'title' => __( 'Images failed to fetch', 'litespeed-cache' ),
34
- ),
35
- 'notify_failed' => array(
36
- 'title' => __( 'Images failed to notify', 'litespeed-cache' ),
37
- ),
38
- 'pull_failed' => array(
39
- 'title' => __( 'Images failed to pull', 'litespeed-cache' ),
40
- ),
41
- 'last_requested' => array(
42
- 'title' => __( 'Last Request', 'litespeed-cache' ),
43
- 'type' => 'date',
44
- ),
45
- ) ;
46
-
47
- // Guidance check
48
- $current_step = false ;
49
- if ( empty( $optm_summary[ 'level' ] ) || $optm_summary[ 'level' ] < 2 ) {
50
- $current_step = $img_optm->get_guidance_pos() ;
51
- }
52
- $guidance_steps = array(
53
- sprintf( __( 'Click the %s button.', 'litespeed-cache' ), '<font class="litespeed-success">' . __( 'Update Status', 'litespeed-cache' ) . '</font>' ),
54
- sprintf( __( 'Click the %s button.', 'litespeed-cache' ), '<font class="litespeed-success">' . __( 'Send Optimization Request', 'litespeed-cache' ) . '</font>' ),
55
- sprintf( __( 'Click the %s button or wait for the cron job to finish the pull action.', 'litespeed-cache' ), '<font class="litespeed-success">' . __( 'Pull Images', 'litespeed-cache' ) . '</font>' ),
56
- __( 'Repeat the above steps until you have leveled up.', 'litespeed-cache' )
57
- ) ;
58
-
59
if ( ! empty( $img_count[ 'total_img' ] ) ) {
60
$finished_percentage = 100 - floor( $img_count[ 'total_not_requested' ] * 100 / $img_count[ 'total_img' ] ) ;
61
}
@@ -78,279 +34,13 @@ LiteSpeed_Cache_GUI::show_promo() ;
78
79
<div class="litespeed-wrap">
80
<div class="litespeed-body">
81
- <?php if ( $current_step ) : ?>
82
- <?php echo LiteSpeed_Cache_Admin_Display::guidance( __( 'How to Level Up', 'litespeed-cache' ), $guidance_steps, $current_step ) ; ?>
83
- <?php endif ; ?>
84
-
85
- <h3 class="litespeed-title"><?php echo __('Optimization Summary', 'litespeed-cache') ; ?></h3>
86
-
87
- <?php foreach ( $_optm_summary_list as $k => $v ) : ?>
88
- <?php if ( isset( $optm_summary[ $k ] ) && ( $optm_summary[ $k ] || ! empty( $v[ 'must' ] ) ) ) : ?>
89
- <p>
90
- <?php echo $v[ 'title' ] ; ?>:
91
- <b>
92
- <?php
93
- if ( ! empty( $v[ 'type' ] ) ) {
94
- if ( $v[ 'type' ] == 'file_size' ) {
95
- echo LiteSpeed_Cache_Utility::real_size( $optm_summary[ $k ] ) ;
96
- }
97
- if ( $v[ 'type' ] == 'date' ) {
98
- echo LiteSpeed_Cache_Utility::readable_time( $optm_summary[ $k ] ) ;
99
- }
100
- }
101
- else {
102
- echo $optm_summary[ $k ] ;
103
- }
104
-
105
- if ( ! empty( $v[ 'desc' ] ) ) {
106
- echo '<span class="litespeed-desc">' . $v[ 'desc' ] . '</span>' ;
107
- }
108
- ?>
109
- </b>
110
- </p>
111
- <?php endif ; ?>
112
- <?php endforeach ; ?>
113
-
114
- <a href="<?php echo LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_IMG_OPTM, LiteSpeed_Cache_Img_Optm::TYPE_SYNC_DATA ) ; ?>" class="litespeed-btn-success">
115
- <?php echo __( 'Update Status', 'litespeed-cache' ) ; ?>
116
- </a>
117
- <span class="litespeed-desc">
118
- <?php echo __( 'This will communicate with LiteSpeed\'s Image Optimization Server and retrieve the most recent status.', 'litespeed-cache' ) ; ?>
119
- </span>
120
-
121
- <?php include_once LSCWP_DIR . "admin/tpl/inc/api_key.php" ; ?>
122
-
123
- <h3 class="litespeed-title"><?php echo __('Image Information', 'litespeed-cache') ; ?></h3>
124
-
125
- <div class="litespeed-block-tiny">
126
- <div class="litespeed-col-auto">
127
- <?php echo LiteSpeed_Cache_GUI::pie( $finished_percentage, 100, true ) ; ?>
128
- </div>
129
-
130
- <div class="litespeed-col-auto">
131
- <p>
132
- <?php echo __( 'Images total', 'litespeed-cache') ; ?>:
133
- <b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'total_img' ] ) ; ?></b>
134
- <a href="https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp:image-optimization:image-groups" target="_blank" class="litespeed-desc litespeed-left20"><?php echo __( 'What is a group?', 'litespeed-cache') ; ?></a>
135
- </p>
136
- <p>
137
- <?php echo __('Images not yet requested', 'litespeed-cache') ; ?>:
138
- <b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'total_not_requested' ] ) ; ?></b>
139
- </p>
140
- </div>
141
- </div>
142
-
143
- <?php if ( $img_count[ 'total_not_requested' ] ) : ?>
144
- <?php if ( empty( $optm_summary[ 'level' ] ) ) : ?>
145
- <a href="#" class="litespeed-btn-default disabled">
146
- <?php echo __( 'Send Optimization Request', 'litespeed-cache' ) ; ?>
147
- </a>
148
- <span class="litespeed-desc">
149
- <?php echo sprintf( __( 'Please press the %s button before sending a new request.', 'litespeed-cache' ), __( 'Update Status', 'litespeed-cache' ) ) ; ?>
150
- </span>
151
- <a href="https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp:image-optimization#image_optimization_in_litespeed_cache_for_wordpress" target="_blank"><?php echo __('Learn More', 'litespeed-cache') ; ?></a>
152
- <?php else : ?>
153
- <a href="<?php echo LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_IMG_OPTM, LiteSpeed_Cache_Img_Optm::TYPE_IMG_OPTIMIZE ) ; ?>" class="litespeed-btn-success">
154
- <?php echo __( 'Send Optimization Request', 'litespeed-cache' ) ; ?>
155
- </a>
156
- <span class="litespeed-desc">
157
- <?php echo __( 'This will send the optimization request and the images to LiteSpeed\'s Image Optimization Server.', 'litespeed-cache' ) ; ?>
158
- <?php echo sprintf( __( 'You can send at most %s images at once.', 'litespeed-cache' ), '<code>' . $optm_summary[ 'credit' ] . '</code>' ) ; ?>
159
- </span>
160
- <?php endif ; ?>
161
- <?php endif ; ?>
162
-
163
- <hr />
164
-
165
- <p>
166
- <?php echo __('Images requested', 'litespeed-cache') ; ?>:
167
- <b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'group.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_REQUESTED ] ) ; ?></b>
168
- (<b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'img.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_REQUESTED ], 'image' ) ; ?></b>)
169
- </p>
170
- <p class="litespeed-desc">
171
- <?php echo __( 'After LiteSpeed\'s Image Optimization Server finishes optimization, it will notify your site to pull the optimized images.', 'litespeed-cache' ) ; ?>
172
- <?php echo __( 'This process is automatic.', 'litespeed-cache' ) ; ?>
173
- </p>
174
- <p>
175
- <?php echo __('Images notified to pull', 'litespeed-cache') ; ?>:
176
- <b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'group.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_NOTIFIED ] ) ; ?></b>
177
- (<b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'img.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_NOTIFIED ], 'image' ) ; ?></b>)
178
-
179
- <?php if ( $img_count[ 'img.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_NOTIFIED ] && ! $is_running ) : ?>
180
- <a href="<?php echo LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_IMG_OPTM, LiteSpeed_Cache_Img_Optm::TYPE_IMG_PULL ) ; ?>" class="litespeed-btn-success">
181
- <?php echo __( 'Pull Images', 'litespeed-cache' ) ; ?>
182
- </a>
183
- <span class="litespeed-desc">
184
- <?php echo __( 'Only press the button if the pull cron job is disabled.', 'litespeed-cache' ) ; ?>
185
- <?php echo __( 'Images will be pulled automatically if the cron job is running.', 'litespeed-cache' ) ; ?>
186
- </span>
187
- <?php elseif ( $last_run ) : ?>
188
- <span class="litespeed-desc">
189
- <?php echo sprintf( __( 'Last pull initiated by cron at %s.', 'litespeed-cache' ), '<code>' . LiteSpeed_Cache_Utility::readable_time( $last_run ) . '</code>' ) ; ?>
190
- </span>
191
- <?php endif ; ?>
192
- </p>
193
- <p>
194
- <?php echo __('Images optimized and pulled', 'litespeed-cache') ; ?>:
195
- <b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'group.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_PULLED ] ) ; ?></b>
196
- (<b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'img.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_PULLED ], 'image' ) ; ?></b>)
197
- </p>
198
-
199
- <div class="litespeed-desc litespeed-left20">
200
- <p>
201
- <?php echo __('Images failed to fetch', 'litespeed-cache') ; ?>:
202
- <b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'group.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_ERR_FETCH ] ) ; ?></b>
203
- (<b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'img.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_ERR_FETCH ], 'image' ) ; ?></b>)
204
- </p>
205
- <p>
206
- <?php echo __('Images failed to optimize', 'litespeed-cache') ; ?>:
207
- <b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'group.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_ERR_OPTM ] ) ; ?></b>
208
- (<b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'img.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_ERR_OPTM ], 'image' ) ; ?></b>)
209
- </p>
210
- <p>
211
- <?php echo __('Images failed with other errors', 'litespeed-cache') ; ?>:
212
- <b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'group.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_ERR ] ) ; ?></b>
213
- (<b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'img.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_ERR ], 'image' ) ; ?></b>)
214
- </p>
215
- <p>
216
- <?php echo __('Image files missing', 'litespeed-cache') ; ?>:
217
- <b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'group.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_MISS ] ) ; ?></b>
218
- (<b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'img.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_MISS ], 'image' ) ; ?></b>)
219
- </p>
220
- <p>
221
- <?php echo __('Images with wrong meta', 'litespeed-cache') ; ?>:
222
- <b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'img.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_XMETA ] ) ; ?></b>
223
- </p>
224
- </div>
225
-
226
- <p><a href="https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp:image-optimization#image_optimization_in_litespeed_cache_for_wordpress" target="_blank"><?php echo __('Learn More', 'litespeed-cache') ; ?></a></p>
227
-
228
- <hr />
229
-
230
- <?php if ( ! empty( $optm_summary[ 'level' ] ) ) : ?>
231
- <h3 class="litespeed-title"><?php echo __('Revert Optimization', 'litespeed-cache') ; ?></h3>
232
-
233
- <span class="litespeed-desc">
234
- <?php echo __( 'Switch all images in the media library back to their original unoptimized versions.', 'litespeed-cache' ) ; ?>
235
- </span>
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">
243
- <?php echo __( 'Revert all optimized images back to their original versions.', 'litespeed-cache' ) ; ?>
244
- </span>
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">
252
- <?php echo __( 'Switch back to using optimized images.', 'litespeed-cache' ) ; ?>
253
- </span>
254
-
255
- <br />
256
- <p>
257
- <?php echo sprintf( __( 'Results can be checked in <a %s>Media Library</a>.', 'litespeed-cache' ), 'href="upload.php?mode=list"' ) ; ?>
258
- </p>
259
-
260
- <a href="<?php echo LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_IMG_OPTM, LiteSpeed_Cache_Img_Optm::TYPE_IMG_OPTIMIZE_RESCAN ) ; ?>" class="litespeed-btn-success litespeed-hide">
261
- <?php echo __( 'Send New Thumbnail Requests', 'litespeed-cache' ) ; ?>
262
- </a>
263
- <span class="litespeed-desc litespeed-hide">
264
- <?php echo __( 'Scan for any new unoptimized image thumbnail sizes and resend necessary image optimization requests.', 'litespeed-cache' ) ; ?>
265
- </span>
266
-
267
- <br />
268
- <a href="<?php echo LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_IAPI, LiteSpeed_Cache_Admin_API::TYPE_RESET_KEY ) ; ?>" class="litespeed-btn-warning">
269
- <?php echo __( 'Reset IAPI Key', 'litespeed-cache' ) ; ?>
270
- </a>
271
- <span class="litespeed-desc">
272
- <?php echo __( 'The current IAPI key must be reset after changing home URL or domain before making any further optimization requests.', 'litespeed-cache' ) ; ?>
273
- </span>
274
-
275
- <br />
276
- <a href="<?php echo LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_IMG_OPTM, LiteSpeed_Cache_Img_Optm::TYPE_IMG_OPTM_DESTROY_UNFINISHED ) ; ?>" class="litespeed-btn-warning">
277
- <?php echo __( 'Clean Up Unfinished Data', 'litespeed-cache' ) ; ?>
278
- </a>
279
- <span class="litespeed-desc">
280
- <?php echo __( 'Remove all previous unfinished image optimization requests.', 'litespeed-cache' ) ; ?>
281
- </span>
282
-
283
- <br />
284
- <a href="<?php echo LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_IMG_OPTM, LiteSpeed_Cache_Img_Optm::TYPE_IMG_OPTM_DESTROY ) ; ?>" class="litespeed-btn-danger">
285
- <?php echo __( 'Destroy All Optimization Data!', 'litespeed-cache' ) ; ?>
286
- </a>
287
- <span class="litespeed-desc">
288
- <?php echo __( 'Remove all previous image optimization requests/results, revert completed optimizations, and delete all optimization files.', 'litespeed-cache' ) ; ?>
289
- <font class="litespeed-warning">
290
- <?php echo __('NOTE', 'litespeed-cache'); ?>:
291
- <?php echo __( 'This will also reset the credit level.', 'litespeed-cache' ) ; ?>
292
- </font>
293
- </span>
294
-
295
- <hr />
296
-
297
- <h3 class="litespeed-title"><?php echo __('Storage Optimization', 'litespeed-cache') ; ?></h3>
298
-
299
- <a href="<?php echo LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_IMG_OPTM, LiteSpeed_Cache_Img_Optm::TYPE_CALC_BKUP ) ; ?>" class="litespeed-btn-success">
300
- <?php echo __( 'Calculate Original Image Storage', 'litespeed-cache' ) ; ?>
301
- </a>
302
- <span class="litespeed-desc">
303
- <?php echo __( 'A backup of each image is saved before it is optimized. This button will calculate the total amount of disk space used by these backups.', 'litespeed-cache' ) ; ?>
304
- </span>
305
- <?php if ( $storage_data ) : ?>
306
- <div class="litespeed-desc litespeed-left20">
307
- <p>
308
- <?php echo __( 'Last calculated', 'litespeed-cache' ) . ': <code>' . LiteSpeed_Cache_Utility::readable_time( $storage_data[ 'date' ] ) . '</code>' ; ?>
309
- </p>
310
- <?php if ( $storage_data[ 'count' ] ) : ?>
311
- <p>
312
- <?php echo __( 'Files', 'litespeed-cache' ) . ': <code>' . $storage_data[ 'count' ] . '</code>' ; ?>
313
- </p>
314
- <p>
315
- <?php echo __( 'Total', 'litespeed-cache' ) . ': <code>' . LiteSpeed_Cache_Utility::real_size( $storage_data[ 'sum' ] ) . '</code>' ; ?>
316
- </p>
317
<?php else : ?>
318
- <p>
319
- <?php echo LiteSpeed_Cache_GUI::pie( 100, 30, true ) ; ?>
320
- </p>
321
<?php endif ; ?>
322
- </div>
323
- <?php endif ; ?>
324
-
325
- <br />
326
- <a href="<?php echo LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_IMG_OPTM, LiteSpeed_Cache_Img_Optm::TYPE_RM_BKUP ) ; ?>" data-litespeed-cfm="<?php echo __( 'Are you sure to remove all image backups?', 'litespeed-cache' ) ; ?>" class="litespeed-btn-danger">
327
- <?php echo __( 'Remove Original Image Backups', 'litespeed-cache' ) ; ?>
328
- </a>
329
- <span class="litespeed-desc">
330
- <?php echo __( 'This will delete all of the backups of the original images.', 'litespeed-cache' ) ; ?>
331
- <font class="litespeed-danger">
332
- <?php echo __('WARNING', 'litespeed-cache'); ?>:
333
- <?php echo __( 'This is irreversible.', 'litespeed-cache' ) ; ?>
334
- <?php echo __( 'You will be unable to Revert Optimization once the backups are deleted!', 'litespeed-cache' ) ; ?>
335
- </font>
336
- </span>
337
- <?php if ( $rm_log ) : ?>
338
- <div class="litespeed-desc litespeed-left20">
339
- <p>
340
- <?php echo __( 'Last ran', 'litespeed-cache' ) . ': <code>' . LiteSpeed_Cache_Utility::readable_time( $rm_log[ 'date' ] ) . '</code>' ; ?>
341
- </p>
342
- <p>
343
- <?php echo __( 'Files', 'litespeed-cache' ) . ': <code>' . $rm_log[ 'count' ] . '</code>' ; ?>
344
- </p>
345
- <p>
346
- <?php echo __( 'Saved', 'litespeed-cache' ) . ': <code>' . LiteSpeed_Cache_Utility::real_size( $rm_log[ 'sum' ] ) . '</code>' ; ?>
347
- </p>
348
- </div>
349
- <?php endif ; ?>
350
-
351
-
352
- <?php endif ; ?>
353
-
354
-
355
</div>
356
</div>
12
13
list( $last_run, $is_running ) = $img_optm->cron_running( false ) ;
14
15
if ( ! empty( $img_count[ 'total_img' ] ) ) {
16
$finished_percentage = 100 - floor( $img_count[ 'total_not_requested' ] * 100 / $img_count[ 'total_img' ] ) ;
17
}
34
35
<div class="litespeed-wrap">
36
<div class="litespeed-body">
37
+ <div class="litespeed-flex-container">
38
+ <?php if ( ! $optm_summary ) : ?>
39
+ <?php include_once LSCWP_DIR . "admin/tpl/inc/img_optm.initialize.php" ; ?>
40
<?php else : ?>
41
+ <?php include_once LSCWP_DIR . "admin/tpl/inc/img_optm.summary.php" ; ?>
42
<?php endif ; ?>
43
+ </div>
44
</div>
45
+
46
</div>
admin/tpl/inc/api_key.php CHANGED
@@ -5,10 +5,9 @@ $api_key = get_option( LiteSpeed_Cache_Admin_API::DB_API_KEY ) ;
5
6
?>
7
8
-
9
- <?php if ( ! $api_key ) : ?>
10
- <p class="litespeed-desc">
11
- <?php echo __( 'This will also generate an API key from LiteSpeed\'s Server.', 'litespeed-cache' ) ; ?>
12
- </p>
13
- <?php endif ; ?>
14
5
6
?>
7
8
+ <?php if ( ! $api_key ) : ?>
9
+ <p class="litespeed-desc">
10
+ <?php echo __( 'This will also generate an API key from LiteSpeed\'s Server.', 'litespeed-cache' ) ; ?>
11
+ </p>
12
+ <?php endif ; ?>
13
admin/tpl/inc/check_cache_disabled.php CHANGED
@@ -1,26 +1,26 @@
1
- <?php
2
if ( ! defined( 'WPINC' ) ) die ;
3
4
$reasons = array() ;
5
6
if ( ! defined( 'LITESPEED_ALLOWED' ) ) {
7
$reasons[] = array(
8
- 'title' => __( 'LSCache Module is disabled.', 'litespeed-cache' ),
9
'link' => 'https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp:installation',
10
) ;
11
}
12
13
if ( ! defined( 'LITESPEED_ON_IN_SETTING' ) ) {
14
$reasons[] = array(
15
- 'title' => __( 'LiteSpeed cache is disabled in setting.', 'litespeed-cache' ) ,
16
'link' => 'https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp:configuration:general#enable_litespeed_cache',
17
) ;
18
}
19
20
if ( ! $reasons && ! defined( 'LITESPEED_ON' ) ) {
21
$reasons[] = array(
22
- 'title' => __( 'LiteSpeed cache is disabled.', 'litespeed-cache' ) ,
23
- 'link' => 'https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp:configuration:general#enable_litespeed_cache',
24
) ;
25
}
26
@@ -31,7 +31,7 @@ if ( $reasons ) :
31
<h4><?php echo __( 'WARNING', 'litespeed-cache' ) ; ?></h4>
32
33
<p>
34
- <?php echo __( 'The functionalities here can not work due to:', 'litespeed-cache' ) ; ?>
35
</p>
36
37
<ul class="litespeed-list">
@@ -39,7 +39,7 @@ if ( $reasons ) :
39
<li>
40
<?php echo $v[ 'title' ] ; ?>
41
42
- <a href="<?php echo $v[ 'link' ] ; ?>" target="_blank" class="litespeed-learn-more"><?php echo __( 'How to fix it?', 'litespeed-cache' ) ; ?></a>
43
</li>
44
<?php endforeach ; ?>
45
</ul>
1
+ <?php
2
if ( ! defined( 'WPINC' ) ) die ;
3
4
$reasons = array() ;
5
6
if ( ! defined( 'LITESPEED_ALLOWED' ) ) {
7
$reasons[] = array(
8
+ 'title' => __( 'The LSCache Module is disabled at the server level.', 'litespeed-cache' ),
9
'link' => 'https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp:installation',
10
) ;
11
}
12
13
if ( ! defined( 'LITESPEED_ON_IN_SETTING' ) ) {
14
$reasons[] = array(
15
+ 'title' => __( 'LiteSpeed Cache is disabled in the plugin settings.', 'litespeed-cache' ) ,
16
'link' => 'https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp:configuration:general#enable_litespeed_cache',
17
) ;
18
}
19
20
if ( ! $reasons && ! defined( 'LITESPEED_ON' ) ) {
21
$reasons[] = array(
22
+ 'title' => __( 'LiteSpeed Cache is disabled.', 'litespeed-cache' ) ,
23
+ 'link' => 'https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp:troubleshooting:lscache-is-disabled',
24
) ;
25
}
26
31
<h4><?php echo __( 'WARNING', 'litespeed-cache' ) ; ?></h4>
32
33
<p>
34
+ <?php echo __( 'Caching functions on this page are currently unavailable!', 'litespeed-cache' ) ; ?>
35
</p>
36
37
<ul class="litespeed-list">
39
<li>
40
<?php echo $v[ 'title' ] ; ?>
41
42
+ <a href="<?php echo $v[ 'link' ] ; ?>" target="_blank" class="litespeed-learn-more"><?php echo __( 'Learn How to Fix It', 'litespeed-cache' ) ; ?></a>
43
</li>
44
<?php endforeach ; ?>
45
</ul>
admin/tpl/inc/img_optm.communicate_notify.php ADDED
@@ -0,0 +1,10 @@
1
+ <?php
2
+ if ( ! defined( 'WPINC' ) ) {
3
+ die ;
4
+ }
5
+
6
+ ?>
7
+
8
+ <span class="litespeed-desc">
9
+ <?php echo __( 'This will communicate with LiteSpeed\'s Image Optimization Server and retrieve the most recent status.', 'litespeed-cache' ) ; ?>
10
+ </span>
admin/tpl/inc/img_optm.initialize.php ADDED
@@ -0,0 +1,38 @@
1
+ <?php
2
+ if ( ! defined( 'WPINC' ) ) {
3
+ die ;
4
+ }
5
+
6
+ ?>
7
+
8
+ <div class="litespeed-width-7-10">
9
+ <div class="litespeed-empty-space-large"></div>
10
+ <div class="litespeed-text-center">
11
+ <div>
12
+ <a href="<?php echo LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_IMG_OPTM, LiteSpeed_Cache_Img_Optm::TYPE_SYNC_DATA ) ; ?>" class="litespeed-text-malibu litespeed-btn-success litespeed-btn-large">
13
+ <span class="dashicons dashicons-performance">
14
+ </span>&nbsp;
15
+ <?php echo __( 'Initialize Optimization', 'litespeed-cache' ) ; ?>
16
+ </a>
17
+ </div>
18
+ </div>
19
+ <div class="litespeed-empty-space-medium"></div>
20
+ <div>
21
+ <h2 Class="litespeed-title">
22
+ <?php echo __( 'Notes', 'litespeed-cache' ) ; ?>:
23
+ </h2>
24
+
25
+ <?php include_once LSCWP_DIR . "admin/tpl/inc/img_optm.communicate_notify.php" ; ?>
26
+
27
+ <?php include_once LSCWP_DIR . "admin/tpl/inc/api_key.php" ; ?>
28
+
29
+ <a href="https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp:image-optimization#image_optimization_in_litespeed_cache_for_wordpress" target="_blank"><?php echo __('Learn More', 'litespeed-cache') ; ?></a>
30
+
31
+ <hr class="litespeed-hr-dotted">
32
+
33
+ </div>
34
+ </div>
35
+
36
+ <div class="litespeed-width-3-10 litespeed-column-java">
37
+ <?php include_once LSCWP_DIR . "admin/tpl/inc/img_optm.percentage_summary.php" ; ?>
38
+ </div>
admin/tpl/inc/img_optm.level_info.php ADDED
@@ -0,0 +1,46 @@
1
+ <?php
2
+ if ( ! defined( 'WPINC' ) ) {
3
+ die ;
4
+ }
5
+
6
+ if ( empty( $optm_summary[ 'level' ] ) ) {
7
+ return ;
8
+ }
9
+ ?>
10
+
11
+
12
+
13
+
14
+
15
+ <?php
16
+ if ( $optm_summary[ 'level' ] >= 5 || empty( $optm_summary[ '_level_data' ] ) ) {
17
+ return ;
18
+ }
19
+
20
+ $next_level = $optm_summary[ 'level' ] + 1 ;
21
+ $next_level_data = $optm_summary[ '_level_data' ][ $next_level ] ;
22
+
23
+ $_progress = floor( $optm_summary[ 'credit_recovered' ] * 100 / $next_level_data[ 0 ] ) ;
24
+ ?>
25
+
26
+ <div class="litespeed-progress">
27
+ <div class="litespeed-progress-bar litespeed-progress-bar-blue" role="progressbar" style="width: <?php echo $_progress ; ?>%" aria-valuenow="<?php echo $_progress ; ?>" aria-valuemin="0" aria-valuemax="100"></div>
28
+ </div>
29
+ <div class="litespeed-flex-container" style="margin-top:none;">
30
+ <div class="litespeed-width-1-2">
31
+ <span class="litespeed-text-malibu" style="font-weight: 600;">
32
+ <?php echo __( 'Level', 'litespeed-cache' ) ; ?>: <font><?php echo $optm_summary[ 'level' ] ; ?></font>
33
+ <span class="litespeed-left20"></span>
34
+ <?php echo __( 'Credit', 'litespeed-cache' ) ; ?>: <font><?php echo $optm_summary[ 'credit' ] ; ?></font>
35
+ <span class="litespeed-left20"></span>
36
+ </span>
37
+ <span class="litespeed-desc"><?php echo __( 'Credit recovers with each successful pull.', 'litespeed-cache' ) ; ?></span>
38
+ </div>
39
+ <div class="litespeed-width-1-2">
40
+ <span class="litespeed-silence">
41
+ <?php echo __( 'Next Level', 'litespeed-cache' ) ; ?>: <?php echo $next_level ; ?>
42
+ <span class="litespeed-left20 litespeed-empty-space-small"></span>
43
+ <?php echo __( 'Next Level Credit', 'litespeed-cache' ) ; ?>: <?php echo $next_level_data[ 1 ] ; ?>
44
+ </span>
45
+ </div>
46
+ </div>
admin/tpl/inc/img_optm.percentage_summary.php ADDED
@@ -0,0 +1,33 @@
1
+ <?php
2
+ if ( ! defined( 'WPINC' ) ) {
3
+ die ;
4
+ }
5
+
6
+ ?>
7
+
8
+ <h3 class="litespeed-title">
9
+ <?php echo __( 'Image Information', 'litespeed-cache' ) ; ?>
10
+ </h3>
11
+
12
+ <div class="litespeed-flex-container">
13
+ <div class="litespeed-icon-vertical-middle">
14
+ <?php echo LiteSpeed_Cache_GUI::pie( $finished_percentage, 100, true ) ; ?>
15
+ </div>
16
+ <div>
17
+ <p>
18
+ <?php echo __( 'Images total', 'litespeed-cache') ; ?>:
19
+
20
+ <code><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'total_img' ] ) ; ?></code>
21
+
22
+ <a href="https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp:image-optimization:image-groups" target="_blank" class="litespeed-desc litespeed-left20" title="<?php echo __( 'What is a group?', 'litespeed-cache') ; ?>">?</a>
23
+ </p>
24
+ <p>
25
+ <?php if ( ! empty( $img_count[ 'total_not_requested' ] ) ) : ?>
26
+ <?php echo __('Images not yet requested', 'litespeed-cache') ; ?>:
27
+ <code><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'total_not_requested' ] ) ; ?></code>
28
+ <?php else : ?>
29
+ <font class="litespeed-congratulate"><?php echo __('Congratulations, all done!', 'litespeed-cache') ; ?></font>
30
+ <?php endif ; ?>
31
+ </p>
32
+ </div>
33
+ </div>
admin/tpl/inc/img_optm.summary.php ADDED
@@ -0,0 +1,313 @@
1
+ <?php
2
+ if ( ! defined( 'WPINC' ) ) {
3
+ die ;
4
+ }
5
+
6
+ ?>
7
+
8
+ <div class="litespeed-width-7-10">
9
+ <div class="litespeed-empty-space-small"></div>
10
+
11
+ <?php if ( $img_count[ 'total_not_requested' ] ) : ?>
12
+ <div class="litespeed-text-center">
13
+ <a href="<?php echo LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_IMG_OPTM, LiteSpeed_Cache_Img_Optm::TYPE_IMG_OPTIMIZE ) ; ?>" class="litespeed-btn-success litespeed-btn-large">
14
+ <span class="dashicons dashicons-images-alt2"></span>&nbsp;<?php echo __( 'Send Optimization Request', 'litespeed-cache' ) ; ?>
15
+ </a>
16
+
17
+ </div>
18
+
19
+ <div class="litespeed-empty-space-small"></div>
20
+
21
+ <div class="litespeed-desc">
22
+ <?php echo __( 'This will send the optimization request and the images to LiteSpeed\'s Image Optimization Server.', 'litespeed-cache' ) ; ?>
23
+ <?php echo sprintf( __( 'You can send at most %s images at once.', 'litespeed-cache' ), '<code>' . $optm_summary[ 'credit' ] . '</code>' ) ; ?>
24
+ </div>
25
+ <?php endif ; ?>
26
+
27
+ <?php if ( $img_count[ 'img.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_NOTIFIED ] && ! $is_running ) : ?>
28
+ <div>
29
+ <a href="<?php echo LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_IMG_OPTM, LiteSpeed_Cache_Img_Optm::TYPE_IMG_PULL ) ; ?>" class="litespeed-btn-success" title="<?php echo __( 'Only press the button if the pull cron job is disabled.', 'litespeed-cache' ) ; ?> <?php echo __( 'Images will be pulled automatically if the cron job is running.', 'litespeed-cache' ) ; ?>">
30
+ <?php echo __( 'Pull Images', 'litespeed-cache' ) ; ?>
31
+ </a>
32
+ </div>
33
+ <?php endif ; ?>
34
+
35
+ <div class="litespeed-empty-space-medium"></div>
36
+
37
+ <div>
38
+ <h2 Class="litespeed-title">
39
+ <?php echo __( 'Current Stage Status', 'litespeed-cache' ) ; ?>
40
+ </h2>
41
+ <div class="litespeed-empty-space-medium"></div>
42
+ <?php include_once LSCWP_DIR . "admin/tpl/inc/img_optm.level_info.php" ; ?>
43
+
44
+ <hr class="litespeed-hr-dotted">
45
+
46
+ <div class="litespeed-empty-space-small"></div>
47
+
48
+ <div class="litespeed-light-code">
49
+
50
+ <?php if ( ! empty( $img_count[ 'group.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_REQUESTED ] ) ) : ?>
51
+ <p class="litespeed-success">
52
+ <?php echo __('Images requested', 'litespeed-cache') ; ?>:
53
+ <code>
54
+ <?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'group.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_REQUESTED ] ) ; ?>
55
+ (<?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'img.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_REQUESTED ], 'image' ) ; ?>)
56
+ </code>
57
+ </p>
58
+ <p class="litespeed-desc">
59
+ <?php echo __( 'After LiteSpeed\'s Image Optimization Server finishes optimization, it will notify your site to pull the optimized images.', 'litespeed-cache' ) ; ?>
60
+ <?php echo __( 'This process is automatic.', 'litespeed-cache' ) ; ?>
61
+ </p>
62
+ <?php endif ; ?>
63
+
64
+ <?php if ( ! empty( $img_count[ 'group.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_NOTIFIED ] ) ) : ?>
65
+ <p class="litespeed-success">
66
+ <?php echo __('Images notified to pull', 'litespeed-cache') ; ?>:
67
+ <code>
68
+ <?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'group.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_NOTIFIED ] ) ; ?>
69
+ (<?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'img.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_NOTIFIED ], 'image' ) ; ?>)
70
+ </code>
71
+
72
+ </p>
73
+ <?php if ( $last_run ) : ?>
74
+ <p class="litespeed-desc">
75
+ <?php echo sprintf( __( 'Last pull initiated by cron at %s.', 'litespeed-cache' ), '<code>' . LiteSpeed_Cache_Utility::readable_time( $last_run ) . '</code>' ) ; ?>
76
+ </p>
77
+ <?php endif ; ?>
78
+ <?php endif ; ?>
79
+
80
+ <div class="litespeed-empty-space-small"></div>
81
+
82
+ <div class="litespeed-flex-container">
83
+
84
+ <div class="litespeed-width-1-2">
85
+
86
+ <?php if ( ! empty( $img_count[ 'group.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_PULLED ] ) ) : ?>
87
+ <p class="litespeed-success">
88
+ <?php echo __('Images optimized and pulled', 'litespeed-cache') ; ?>:
89
+ <code>
90
+ <?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'group.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_PULLED ] ) ; ?>
91
+ (<?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'img.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_PULLED ], 'image' ) ; ?>)
92
+ </code>
93
+ </p>
94
+ <?php endif ; ?>
95
+
96
+ <div class="litespeed-silence">
97
+ <?php if ( ! empty( $img_count[ 'group.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_ERR_FETCH ] ) ) : ?>
98
+ <p>
99
+ <?php echo __('Images failed to fetch', 'litespeed-cache') ; ?>:
100
+ <code>
101
+ <?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'group.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_ERR_FETCH ] ) ; ?>
102
+ (<?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'img.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_ERR_FETCH ], 'image' ) ; ?>)
103
+ </code>
104
+ </p>
105
+ <?php endif ; ?>
106
+
107
+ <?php if ( ! empty( $img_count[ 'group.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_ERR_OPTM ] ) ) : ?>
108
+ <p>
109
+ <?php echo __('Images previously optimized', 'litespeed-cache') ; ?>:
110
+ <code>
111
+ <?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'group.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_ERR_OPTM ] ) ; ?>
112
+ (<?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'img.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_ERR_OPTM ], 'image' ) ; ?>)
113
+ </code>
114
+ </p>
115
+ <?php endif ; ?>
116
+
117
+ <?php if ( ! empty( $img_count[ 'group.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_ERR ] ) ) : ?>
118
+ <p>
119
+ <?php echo __('Images failed with other errors', 'litespeed-cache') ; ?>:
120
+ <code>
121
+ <?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'group.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_ERR ] ) ; ?>
122
+ (<?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'img.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_ERR ], 'image' ) ; ?>)
123
+ </code>
124
+ </p>
125
+ <?php endif ; ?>
126
+
127
+ <?php if ( ! empty( $img_count[ 'group.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_MISS ] ) ) : ?>
128
+ <p>
129
+ <?php echo __('Image files missing', 'litespeed-cache') ; ?>:
130
+ <code>
131
+ <?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'group.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_MISS ] ) ; ?>
132
+ (<?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'img.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_MISS ], 'image' ) ; ?>)
133
+ </code>
134
+ </p>
135
+ <?php endif ; ?>
136
+
137
+ <?php if ( ! empty( $img_count[ 'group.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_XMETA ] ) ) : ?>
138
+ <p>
139
+ <?php echo __('Images with wrong meta', 'litespeed-cache') ; ?>:
140
+ <code>
141
+ <?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'img.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_XMETA ] ) ; ?>
142
+ </code>
143
+ </p>
144
+ <?php endif ; ?>
145
+
146
+ <?php if ( ! empty( $optm_summary[ 'fetch_failed' ] ) ) : ?>
147
+ <p>
148
+ <?php echo __( 'Images failed to fetch', 'litespeed-cache' ) ; ?>: <code><?php echo $optm_summary[ 'fetch_failed' ] ; ?></code>
149
+ </p>
150
+ <?php endif ; ?>
151
+
152
+ <?php if ( ! empty( $optm_summary[ 'notify_failed' ] ) ) : ?>
153
+ <p>
154
+ <?php echo __( 'Images failed to notify', 'litespeed-cache' ) ; ?>: <code><?php echo $optm_summary[ 'notify_failed' ] ; ?></code>
155
+ </p>
156
+ <?php endif ; ?>
157
+
158
+ <?php if ( ! empty( $optm_summary[ 'pull_failed' ] ) ) : ?>
159
+ <p>
160
+ <?php echo __( 'Images failed to pull', 'litespeed-cache' ) ; ?>: <code><?php echo $optm_summary[ 'pull_failed' ] ; ?></code>
161
+ </p>
162
+ <?php endif ; ?>
163
+ </div>
164
+
165
+ <p><a href="https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp:image-optimization#image_optimization_in_litespeed_cache_for_wordpress" target="_blank"><?php echo __('Learn More', 'litespeed-cache') ; ?></a></p>
166
+
167
+ </div>
168
+
169
+ <div class="litespeed-width-1-2">
170
+ <?php echo LiteSpeed_Cache_GUI::img_optm_clean_up_unfinished() ; ?>
171
+ </div>
172
+
173
+ </div>
174
+
175
+ <hr />
176
+
177
+ <div class="litespeed-empty-space-small"></div>
178
+
179
+ <h3 class="litespeed-title">
180
+ <?php echo __( 'Storage Optimization', 'litespeed-cache' ) ; ?>
181
+
182
+ <a href="<?php echo LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_IMG_OPTM, LiteSpeed_Cache_Img_Optm::TYPE_CALC_BKUP ) ; ?>" class="dashicons dashicons-update litepseed-dash-icon-success" title="<?php echo __( 'Calculate Original Image Storage', 'litespeed-cache' ) ; ?>">
183
+ </a>
184
+
185
+ </h3>
186
+
187
+ <?php if ( $storage_data ) : ?>
188
+ <div class="">
189
+ <p>
190
+ <?php echo __( 'Last calculated', 'litespeed-cache' ) . ': <code>' . LiteSpeed_Cache_Utility::readable_time( $storage_data[ 'date' ] ) . '</code>' ; ?>
191
+ </p>
192
+ <?php if ( $storage_data[ 'count' ] ) : ?>
193
+ <p>
194
+ <?php echo __( 'Files', 'litespeed-cache' ) . ': <code>' . $storage_data[ 'count' ] . '</code>' ; ?>
195
+ </p>
196
+ <p>
197
+ <?php echo __( 'Total', 'litespeed-cache' ) . ': <code>' . LiteSpeed_Cache_Utility::real_size( $storage_data[ 'sum' ] ) . '</code>' ; ?>
198
+ </p>
199
+ <?php endif ; ?>
200
+ </div>
201
+ <?php endif ; ?>
202
+
203
+ <br />
204
+ <a href="<?php echo LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_IMG_OPTM, LiteSpeed_Cache_Img_Optm::TYPE_RM_BKUP ) ; ?>" data-litespeed-cfm="<?php echo __( 'Are you sure to remove all image backups?', 'litespeed-cache' ) ; ?>" class="litespeed-btn-danger">
205
+ <span class="dashicons dashicons-trash"></span>&nbsp;<?php echo __( 'Remove Original Image Backups', 'litespeed-cache' ) ; ?>
206
+ </a>
207
+ <div class="litespeed-desc">
208
+ <?php echo __( 'This will delete all of the backups of the original images.', 'litespeed-cache' ) ; ?>
209
+ <div class="litespeed-danger">
210
+ <?php echo __('WARNING', 'litespeed-cache'); ?>:
211
+ <?php echo __( 'This is irreversible.', 'litespeed-cache' ) ; ?>
212
+ <?php echo __( 'You will be unable to Revert Optimization once the backups are deleted!', 'litespeed-cache' ) ; ?>
213
+ </div>
214
+ </div>
215
+ <?php if ( $rm_log ) : ?>
216
+ <div class="">
217
+ <p>
218
+ <?php echo __( 'Last ran', 'litespeed-cache' ) . ': <code>' . LiteSpeed_Cache_Utility::readable_time( $rm_log[ 'date' ] ) . '</code>' ; ?>
219
+ </p>
220
+ <p>
221
+ <?php echo __( 'Files', 'litespeed-cache' ) . ': <code>' . $rm_log[ 'count' ] . '</code>' ; ?>
222
+ </p>
223
+ <p>
224
+ <?php echo __( 'Saved', 'litespeed-cache' ) . ': <code>' . LiteSpeed_Cache_Utility::real_size( $rm_log[ 'sum' ] ) . '</code>' ; ?>
225
+ </p>
226
+ </div>
227
+ <?php endif ; ?>
228
+
229
+ <div class="litespeed-desc">
230
+ <?php echo __( 'A backup of each image is saved before it is optimized.', 'litespeed-cache' ) ; ?>
231
+ <?php echo __( 'The refresh button will calculate the total amount of disk space used by these backups.', 'litespeed-cache' ) ; ?>
232
+ </div>
233
+
234
+
235
+ </div>
236
+ </div>
237
+ </div>
238
+
239
+ <div class="litespeed-width-3-10 litespeed-column-java litespeed-contrast" style="display: flex; flex-direction: column;">
240
+ <div class="litespeed-hr">
241
+ <?php include_once LSCWP_DIR . "admin/tpl/inc/img_optm.percentage_summary.php" ; ?>
242
+ </div>
243
+
244
+ <div class="litespeed-hr">
245
+ <h3 class="litespeed-title">
246
+ <?php echo __( 'Optimization Summary', 'litespeed-cache' ) ; ?>
247
+ <a href="<?php echo LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_IMG_OPTM, LiteSpeed_Cache_Img_Optm::TYPE_SYNC_DATA ) ; ?>" class="dashicons dashicons-update litepseed-dash-icon-success" title="<?php echo __( 'Update Status', 'litespeed-cache' ) ; ?>">
248
+ </a>
249
+ </h3>
250
+ <p>
251
+ <?php echo __( 'Total Reduction', 'litespeed-cache' ) ; ?>: <code><?php echo LiteSpeed_Cache_Utility::real_size( $optm_summary[ 'reduced' ] ) ; ?></code>
252
+ </p>
253
+ <p>
254
+ <?php echo __( 'Images Pulled', 'litespeed-cache' ) ; ?>: <code><?php echo $optm_summary[ 'img_taken' ] ; ?></code>
255
+ </p>
256
+ <p>
257
+ <?php echo __( 'Last Request', 'litespeed-cache' ) ; ?>: <code><?php echo LiteSpeed_Cache_Utility::readable_time( $optm_summary[ 'last_requested' ] ) ; ?></code>
258
+ </p>
259
+ </div>
260
+
261
+ <div class="litespeed-hr">
262
+ <h3 class="litespeed-title"><?php echo __('Revert Optimization', 'litespeed-cache') ; ?></h3>
263
+
264
+ <div class="litespeed-desc">
265
+ <?php echo __( 'Switch all images in the media library back to their original unoptimized versions.', 'litespeed-cache' ) ; ?>
266
+ </div>
267
+
268
+ <div>
269
+ <a href="<?php echo LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_IAPI, LiteSpeed_Cache_Admin_API::TYPE_RESET_KEY ) ; ?>" class="litespeed-btn-warning" title="<?php echo __( 'The current IAPI key must be reset after changing home URL or domain before making any further optimization requests.', 'litespeed-cache' ) ; ?>">
270
+ <span class="dashicons dashicons-image-rotate"></span>&nbsp;<?php echo __( 'Reset IAPI Key', 'litespeed-cache' ) ; ?>
271
+ </a>
272
+ <br />
273
+ <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-success" title="<?php echo __( 'Revert all optimized images back to their original versions.', 'litespeed-cache' ) ; ?>">
274
+ <span class="dashicons dashicons-undo"></span>&nbsp;<?php echo __( 'Undo Optimization', 'litespeed-cache' ) ; ?>
275
+ </a>
276
+
277
+ <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" title="<?php echo __( 'Switch back to using optimized images.', 'litespeed-cache' ) ; ?>">
278
+ <span class="dashicons dashicons-redo"></span>&nbsp;<?php echo __( 'Re-do Optimization', 'litespeed-cache' ) ; ?>
279
+ </a>
280
+
281
+ <a href="<?php echo LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_IMG_OPTM, LiteSpeed_Cache_Img_Optm::TYPE_IMG_OPTIMIZE_RESCAN ) ; ?>" class="litespeed-btn-success litespeed-hide" title="<?php echo __( 'Scan for any new unoptimized image thumbnail sizes and resend necessary image optimization requests.', 'litespeed-cache' ) ; ?>">
282
+ <?php echo __( 'Send New Thumbnail Requests', 'litespeed-cache' ) ; ?>
283
+ </a>
284
+
285
+ <p>
286
+ <?php echo sprintf( __( 'Results can be checked in <a %s>Media Library</a>.', 'litespeed-cache' ), 'href="upload.php?mode=list"' ) ; ?>
287
+ </p>
288
+
289
+ </div>
290
+
291
+ </div>
292
+
293
+ <div style="flex-grow: 1;"></div>
294
+
295
+ <!-- <div class="litespeed-empty-space-xlarge">
296
+ </div>-->
297
+ <div class="">
298
+
299
+ <a href="<?php echo LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_IMG_OPTM, LiteSpeed_Cache_Img_Optm::TYPE_IMG_OPTM_DESTROY ) ; ?>" class="litespeed-btn-danger">
300
+ <span class="dashicons dashicons-dismiss"></span>&nbsp;<?php echo __( 'Destroy All Optimization Data!', 'litespeed-cache' ) ; ?>
301
+ </a>
302
+
303
+ <div class="litespeed-desc">
304
+ <?php echo __( 'Remove all previous image optimization requests/results, revert completed optimizations, and delete all optimization files.', 'litespeed-cache' ) ; ?>
305
+ <div class="litespeed-warning">
306
+ <?php echo __('NOTE', 'litespeed-cache'); ?>:
307
+ <?php echo __( 'This will also reset the credit level.', 'litespeed-cache' ) ; ?>
308
+ </div>
309
+ </div>
310
+
311
+
312
+
313
+ </div>
admin/tpl/inc/modal.footer.php ADDED
@@ -0,0 +1,3 @@
1
+
2
+ </div>
3
+
admin/tpl/inc/modal.header.php ADDED
@@ -0,0 +1,17 @@
1
+ <?php
2
+ if ( ! defined( 'WPINC' ) ) {
3
+ die ;
4
+ }
5
+ ?>
6
+
7
+ <link rel="stylesheet" href="<?php echo LSWCP_PLUGIN_URL ; ?>css/litespeed.css" />
8
+
9
+ <div class="litespeed litespeed-modal">
10
+
11
+ <?php if ( $_progress ) : ?>
12
+ <div class="litespeed-progress">
13
+ <div class="litespeed-progress-bar" role="progressbar" style="width: <?php echo $_progress ; ?>%" aria-valuenow="<?php echo $_progress ; ?>" aria-valuemin="0" aria-valuemax="100"></div>
14
+ </div>
15
+ <?php endif ; ?>
16
+
17
+ <div class="litespeed-wrap">
admin/tpl/setting/settings_cdn.php CHANGED
@@ -38,7 +38,7 @@ if ( ! $cdn_mapping ) {
38
</tr>
39
40
<tr>
41
- <th><?php echo __( 'CDN Mapping', 'litespeed-cache' ) ; ?></th>
42
<td>
43
<?php foreach ( $cdn_mapping as $v ) : ?>
44
@@ -123,7 +123,7 @@ if ( ! $cdn_mapping ) {
123
</tr>
124
125
<tr>
126
- <th><?php echo __( 'Original URLs', 'litespeed-cache' ) ; ?></th>
127
<td>
128
<?php $this->build_input( LiteSpeed_Cache_Config::OPID_CDN_ORI, 'litespeed-input-long' ) ; ?>
129
<div class="litespeed-desc">
@@ -135,7 +135,7 @@ if ( ! $cdn_mapping ) {
135
</tr>
136
137
<tr>
138
- <th><?php echo __( 'Included Directories', 'litespeed-cache' ) ; ?></th>
139
<td>
140
<?php $id = LiteSpeed_Cache_Config::ITEM_CDN_ORI_DIR ; ?>
141
<?php $this->build_textarea2( $id, 40 ) ; ?>
@@ -148,7 +148,7 @@ if ( ! $cdn_mapping ) {
148
</tr>
149
150
<tr>
151
- <th><?php echo __( 'Exclude Path', 'litespeed-cache' ) ; ?></th>
152
<td>
153
<?php $id = LiteSpeed_Cache_Config::OPID_CDN_EXCLUDE ; ?>
154
<?php $this->build_textarea( $id ) ; ?>
@@ -187,41 +187,31 @@ if ( ! $cdn_mapping ) {
187
</td>
188
</tr>
189
190
- <tr class="litespeed-hide">
191
<th><?php echo __( 'Quic Cloud API', 'litespeed-cache' ) ; ?></th>
192
<td>
193
- <?php $this->build_switch( LiteSpeed_Cache_Config::OPID_CDN_QUIC ) ; ?>
194
<div class="litespeed-desc">
195
<?php echo sprintf( __( 'Use %s API functionality.', 'litespeed-cache' ), 'Quic Cloud' ) ; ?>
196
197
- <a id='litespeed_modal_href' href="<?php echo LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_CDN_QUICCLOUD ) ; ?>">
198
- <?php if ( ! empty( $_options[ LiteSpeed_Cache_Config::OPID_CDN_QUIC_EMAIL ] ) ) : ?>
199
- Login API
200
- <?php else : ?>
201
- Free Register!
202
- <?php endif ; ?>
203
- </a>
204
-
205
- <link rel="stylesheet" href="<?php echo LSWCP_PLUGIN_URL ; ?>css/iziModal.min.css">
206
- <script type="text/javascript" src="<?php echo LSWCP_PLUGIN_URL ; ?>js/iziModal.min.js"></script>
207
- <div id="litespeed_modal"></div>
208
<script type="text/javascript">
209
- var litespeed_modal = jQuery("#litespeed_modal").iziModal({iframe: true});
210
- jQuery("#litespeed_modal_href").click(function(event) {
211
- event.preventDefault();
212
- litespeed_modal.iziModal('open', event);
213
- });;
214
</script>
215
- <?php
216
-
217
- ?>
218
- <?php echo sprintf( __( 'This can be managed from <a %2$s>%1$s</a>.', 'litespeed-cache' ), '<b>' . __( 'Manage', 'litespeed-cache' ) . '</b> -&gt; <b>' . __( 'CDN', 'litespeed-cache' ) . '</b>', 'href="admin.php?page=lscache-dash#cdn"' ) ; ?>
219
</div>
220
<div class="litespeed-block">
221
<div class='litespeed-col'>
222
<h4><?php echo __( 'Email Address', 'litespeed-cache' ) ; ?></h4>
223
224
- <?php $this->build_input( LiteSpeed_Cache_Config::OPID_CDN_QUIC_EMAIL ) ; ?>
225
<div class="litespeed-desc">
226
<?php echo sprintf( __( 'Your Email address on %s.', 'litespeed-cache' ), 'Quic Cloud' ) ; ?>
227
</div>
@@ -230,24 +220,13 @@ if ( ! $cdn_mapping ) {
230
<div class='litespeed-col'>
231
<h4><?php echo __( 'User API Key', 'litespeed-cache' ) ; ?></h4>
232
233
- <?php $this->build_input( LiteSpeed_Cache_Config::OPID_CDN_QUIC_KEY ) ; ?>
234
<div class="litespeed-desc">
235
<?php echo sprintf( __( 'Your API key is used to access %s APIs.', 'litespeed-cache' ), 'Quic Cloud' ) ; ?>
236
<?php echo sprintf( __( 'Get it from <a %1$s>%2$s</a>.', 'litespeed-cache' ), 'href="https://quic.cloud/dashboard" target="_blank"', 'Quic Cloud' ) ; ?>
237
</div>
238
</div>
239
240
- <div class='litespeed-col'>
241
- <h4><?php echo __( 'Site Domain', 'litespeed-cache' ) ; ?></h4>
242
-
243
- <?php
244
- $this->build_input( LiteSpeed_Cache_Config::OPID_CDN_QUIC_SITE ) ;
245
- ?>
246
- <div class="litespeed-desc">
247
- <?php echo __( 'You can just type part of the domain.', 'litespeed-cache' ) ; ?>
248
- <?php echo __( 'Once saved, it will be matched with the current list and completed automatically.', 'litespeed-cache' ) ; ?>
249
- </div>
250
- </div>
251
</div>
252
</td>
253
</tr>
38
</tr>
39
40
<tr>
41
+ <th class="litespeed-padding-left"><?php echo __( 'CDN Mapping', 'litespeed-cache' ) ; ?></th>
42
<td>
43
<?php foreach ( $cdn_mapping as $v ) : ?>
44
123
</tr>
124
125
<tr>
126
+ <th class="litespeed-padding-left"><?php echo __( 'Original URLs', 'litespeed-cache' ) ; ?></th>
127
<td>
128
<?php $this->build_input( LiteSpeed_Cache_Config::OPID_CDN_ORI, 'litespeed-input-long' ) ; ?>
129
<div class="litespeed-desc">
135
</tr>
136
137
<tr>
138
+ <th class="litespeed-padding-left"><?php echo __( 'Included Directories', 'litespeed-cache' ) ; ?></th>
139
<td>
140
<?php $id = LiteSpeed_Cache_Config::ITEM_CDN_ORI_DIR ; ?>
141
<?php $this->build_textarea2( $id, 40 ) ; ?>
148
</tr>
149
150
<tr>
151
+ <th class="litespeed-padding-left"><?php echo __( 'Exclude Path', 'litespeed-cache' ) ; ?></th>
152
<td>
153
<?php $id = LiteSpeed_Cache_Config::OPID_CDN_EXCLUDE ; ?>
154
<?php $this->build_textarea( $id ) ; ?>
187
</td>
188
</tr>
189
190
+ <tr <?php if ( ! defined( 'LITESPEED_QUIC_CLOUD' ) ) echo 'class="litespeed-hide"' ; ?>>
191
<th><?php echo __( 'Quic Cloud API', 'litespeed-cache' ) ; ?></th>
192
<td>
193
+ <?php $this->build_switch( LiteSpeed_Cache_Config::OPT_CDN_QUIC ) ; ?>
194
<div class="litespeed-desc">
195
<?php echo sprintf( __( 'Use %s API functionality.', 'litespeed-cache' ), 'Quic Cloud' ) ; ?>
196
197
+ <a id='litespeed_modal_href' href="https://quic.cloud" target="_blank">Quic.cloud</a>
198
+
199
+ <!-- <link rel="stylesheet" href="<?php echo LSWCP_PLUGIN_URL ; ?>css/iziModal.min.css"> -->
200
+ <!-- <script type="text/javascript" src="<?php echo LSWCP_PLUGIN_URL ; ?>js/iziModal.min.js"></script> -->
201
+ <!-- <div id="litespeed_modal"></div> -->
202
<script type="text/javascript">
203
+ // var litespeed_modal = jQuery("#litespeed_modal").iziModal({iframe: true});
204
+ // jQuery("#litespeed_modal_href").click(function(event) {
205
+ // event.preventDefault();
206
+ // litespeed_modal.iziModal('open', event);
207
+ // });;
208
</script>
209
</div>
210
<div class="litespeed-block">
211
<div class='litespeed-col'>
212
<h4><?php echo __( 'Email Address', 'litespeed-cache' ) ; ?></h4>
213
214
+ <?php $this->build_input( LiteSpeed_Cache_Config::OPT_CDN_QUIC_EMAIL ) ; ?>
215
<div class="litespeed-desc">
216
<?php echo sprintf( __( 'Your Email address on %s.', 'litespeed-cache' ), 'Quic Cloud' ) ; ?>
217
</div>
220
<div class='litespeed-col'>
221
<h4><?php echo __( 'User API Key', 'litespeed-cache' ) ; ?></h4>
222
223
+ <?php $this->build_input( LiteSpeed_Cache_Config::OPT_CDN_QUIC_KEY ) ; ?>
224
<div class="litespeed-desc">
225
<?php echo sprintf( __( 'Your API key is used to access %s APIs.', 'litespeed-cache' ), 'Quic Cloud' ) ; ?>
226
<?php echo sprintf( __( 'Get it from <a %1$s>%2$s</a>.', 'litespeed-cache' ), 'href="https://quic.cloud/dashboard" target="_blank"', 'Quic Cloud' ) ; ?>
227
</div>
228
</div>
229
230
</div>
231
</td>
232
</tr>
admin/tpl/setting/settings_inc.cache_browser.php CHANGED
@@ -18,7 +18,7 @@ if ( ! defined( 'WPINC' ) ) die ;
18
</tr>
19
20
<tr <?php echo $_hide_in_basic_mode ; ?>>
21
- <th><?php echo __( 'Browser Cache TTL', 'litespeed-cache' ) ; ?></th>
22
<td>
23
<?php $id = LiteSpeed_Cache_Config::OPID_CACHE_BROWSER_TTL ; ?>
24
<?php $this->build_input( $id ) ; ?> <?php echo __( 'seconds', 'litespeed-cache' ) ; ?>
18
</tr>
19
20
<tr <?php echo $_hide_in_basic_mode ; ?>>
21
+ <th class="litespeed-padding-left"><?php echo __( 'Browser Cache TTL', 'litespeed-cache' ) ; ?></th>
22
<td>
23
<?php $id = LiteSpeed_Cache_Config::OPID_CACHE_BROWSER_TTL ; ?>
24
<?php $this->build_input( $id ) ; ?> <?php echo __( 'seconds', 'litespeed-cache' ) ; ?>
admin/tpl/setting/settings_inc.check_adv_file.php CHANGED
@@ -10,11 +10,12 @@ if ( ! defined( 'WPINC' ) ) die ;
10
$this->build_checkbox($id, __('Include advanced-cache.php', 'litespeed-cache'), $_options[$id]);
11
?>
12
<div class="litespeed-desc">
13
- <?php echo __('The advanced-cache.php file is used by many caching plugins to signal that a cache is active.', 'litespeed-cache'); ?>
14
- <?php echo __('When this option is checked and this file is detected as belonging to another plugin, LiteSpeed Cache will not cache.', 'litespeed-cache'); ?>
15
</div>
16
<p>
17
- <i><?php echo __('Uncheck this option only if the other plugin is used for non-caching purposes, such as minifying css/js files.', 'litespeed-cache'); ?></i>
18
</p>
19
20
</td>
10
$this->build_checkbox($id, __('Include advanced-cache.php', 'litespeed-cache'), $_options[$id]);
11
?>
12
<div class="litespeed-desc">
13
+ <?php echo __( 'The advanced-cache.php file is used by many caching plugins to signal that a cache is active.', 'litespeed-cache' ) ; ?>
14
+ <?php echo __( 'When this option is checked and this file is detected as belonging to another plugin, LiteSpeed\'s caching functionality will not work.', 'litespeed-cache' ) ; ?>
15
</div>
16
<p>
17
+ <i><?php echo __( 'You may need to uncheck this option if you are using multiple optimization plugins.', 'litespeed-cache' ) ; ?></i>
18
+ <a href="https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp:customizations:multi-cache-plugins" target="_blank"><?php echo __('Learn More', 'litespeed-cache') ; ?></a>
19
</p>
20
21
</td>
admin/tpl/setting/settings_inc.media_webp.php CHANGED
@@ -3,7 +3,7 @@ if ( ! defined( 'WPINC' ) ) die ;
3
4
?>
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">
@@ -15,4 +15,3 @@ if ( ! defined( 'WPINC' ) ) die ;
15
</div>
16
</td>
17
</tr>
18
-
3
4
?>
5
<tr>
6
+ <th class="litespeed-padding-left"><?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">
15
</div>
16
</td>
17
</tr>
admin/tpl/setting/settings_media.php CHANGED
@@ -65,18 +65,31 @@ if ( ! defined( 'WPINC' ) ) die ;
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">
@@ -86,7 +99,7 @@ if ( ! defined( 'WPINC' ) ) die ;
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">
@@ -96,7 +109,23 @@ if ( ! defined( 'WPINC' ) ) die ;
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">
@@ -106,7 +135,7 @@ if ( ! defined( 'WPINC' ) ) die ;
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">
@@ -117,7 +146,7 @@ if ( ! defined( 'WPINC' ) ) die ;
117
</tr>
118
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">
@@ -136,7 +165,7 @@ if ( ! defined( 'WPINC' ) ) die ;
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 ) ; ?>
@@ -151,7 +180,7 @@ if ( ! defined( 'WPINC' ) ) die ;
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">
@@ -162,4 +191,4 @@ if ( ! defined( 'WPINC' ) ) die ;
162
</tr>
163
164
165
- </tbody></table>
65
</td>
66
</tr>
67
68
+ <tr>
69
+ <th><?php echo __( 'Inline Lazy Load Images Library', 'litespeed-cache' ) ; ?></th>
70
+ <td>
71
+ <?php $this->build_switch( LiteSpeed_Cache_Config::OPID_MEDIA_IMG_LAZYJS_INLINE ) ; ?>
72
+ <div class="litespeed-desc">
73
+ <?php echo __( 'Include the lazy load image Javascript library inline.', 'litespeed-cache' ) ; ?>
74
+ <?php echo __( 'This can improve your speed score in services like Pingdom, GTmetrix and PageSpeed.', 'litespeed-cache' ) ; ?>
75
+ <a href="https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp:configuration:media#inline_lazy_load_images_library" target="_blank"><?php echo __('Learn More', 'litespeed-cache') ; ?></a>
76
+ </div>
77
+ </td>
78
+ </tr>
79
+
80
+ <tr>
81
+ <th><?php echo __( 'Optimize Automatically', 'litespeed-cache' ) ; ?></th>
82
<td>
83
<?php $this->build_switch( LiteSpeed_Cache_Config::OPT_MEDIA_OPTM_AUTO ) ; ?>
84
<div class="litespeed-desc">
85
+ <?php echo __( 'Automatically request optimization via cron job.', 'litespeed-cache' ) ; ?>
86
+ <?php echo sprintf( __( 'Requests can only be sent when recovered credits is %s or more.', 'litespeed-cache' ), '<code>' . LiteSpeed_Cache_Img_Optm::NUM_THRESHOLD_AUTO_REQUEST . '</code>' ) ; ?>
87
</div>
88
</td>
89
</tr>
90
91
<tr>
92
+ <th class="litespeed-padding-left"><?php echo __( 'Optimization Cron', 'litespeed-cache' ) ; ?></th>
93
<td>
94
<?php $this->build_switch( LiteSpeed_Cache_Config::OPT_MEDIA_OPTM_CRON ) ; ?>
95
<div class="litespeed-desc">
99
</tr>
100
101
<tr>
102
+ <th class="litespeed-padding-left"><?php echo __( 'Optimize Original Images', 'litespeed-cache' ) ; ?></th>
103
<td>
104
<?php $this->build_switch( LiteSpeed_Cache_Config::OPT_MEDIA_OPTM_ORI ) ; ?>
105
<div class="litespeed-desc">
109
</tr>
110
111
<tr>
112
+ <th class="litespeed-padding-left"><?php echo __( 'Remove Original Backups', 'litespeed-cache' ) ; ?></th>
113
+ <td>
114
+ <?php $this->build_switch( LiteSpeed_Cache_Config::OPT_MEDIA_RM_ORI_BKUP ) ; ?>
115
+ <div class="litespeed-desc">
116
+ <?php echo __( 'Automatically remove the original image backups after fetching optimized images.', 'litespeed-cache' ) ; ?>
117
+
118
+ <br /><font class="litespeed-danger">
119
+ <?php echo __('WARNING', 'litespeed-cache'); ?>:
120
+ <?php echo __( 'This is irreversible.', 'litespeed-cache' ) ; ?>
121
+ <?php echo __( 'You will be unable to Revert Optimization once the backups are deleted!', 'litespeed-cache' ) ; ?>
122
+ </font>
123
+ </div>
124
+ </td>
125
+ </tr>
126
+
127
+ <tr>
128
+ <th class="litespeed-padding-left"><?php echo __( 'Optimize WebP Versions', 'litespeed-cache' ) ; ?></th>
129
<td>
130
<?php $this->build_switch( LiteSpeed_Cache_Config::OPT_MEDIA_OPTM_WEBP ) ; ?>
131
<div class="litespeed-desc">
135
</tr>
136
137
<tr>
138
+ <th class="litespeed-padding-left"><?php echo __( 'Optimize Losslessly', 'litespeed-cache' ) ; ?></th>
139
<td>
140
<?php $this->build_switch( LiteSpeed_Cache_Config::OPT_MEDIA_OPTM_LOSSLESS ) ; ?>
141
<div class="litespeed-desc">
146
</tr>
147
148
<tr>
149
+ <th class="litespeed-padding-left"><?php echo __( 'Preserve EXIF data', 'litespeed-cache' ) ; ?></th>
150
<td>
151
<?php $this->build_switch( LiteSpeed_Cache_Config::OPT_MEDIA_OPTM_EXIF ) ; ?>
152
<div class="litespeed-desc">
165
?>
166
167
<tr>
168
+ <th class="litespeed-padding-left"><?php echo __( 'WebP Attribute To Replace', 'litespeed-cache' ) ; ?></th>
169
<td>
170
<?php $id = LiteSpeed_Cache_Config::ITEM_MEDIA_WEBP_ATTRIBUTE ; ?>
171
<?php $this->build_textarea2( $id, 40 ) ; ?>
180
</tr>
181
182
<tr>
183
+ <th class="litespeed-padding-left"><?php echo __( 'WebP For Extra srcset', 'litespeed-cache' ) ; ?></th>
184
<td>
185
<?php $this->build_switch( LiteSpeed_Cache_Config::OPT_MEDIA_WEBP_REPLACE_SRCSET ) ; ?>
186
<div class="litespeed-desc">
191
</tr>
192
193
194
+ </tbody></table>
admin/tpl/setting/settings_optimize.php CHANGED
@@ -145,7 +145,7 @@ $last_critical_css_generated = LiteSpeed_Cache_CSS::get_summary() ;
145
</tr>
146
147
<tr>
148
- <th><?php echo __( 'Generate Critical CSS', 'litespeed-cache' ) ; ?></th>
149
<td>
150
<?php $this->build_switch( LiteSpeed_Cache_Config::OPT_OPTM_CCSS_GEN ) ; ?>
151
<div class="litespeed-desc">
@@ -156,7 +156,7 @@ $last_critical_css_generated = LiteSpeed_Cache_CSS::get_summary() ;
156
</tr>
157
158
<tr>
159
- <th><?php echo __( 'Generate Critical CSS In Background', 'litespeed-cache' ) ; ?></th>
160
<td>
161
<?php $this->build_switch( LiteSpeed_Cache_Config::OPT_OPTM_CCSS_ASYNC ) ; ?>
162
<div class="litespeed-desc">
@@ -192,7 +192,7 @@ $last_critical_css_generated = LiteSpeed_Cache_CSS::get_summary() ;
192
</tr>
193
194
<tr>
195
- <th><?php echo __( 'Inline CSS Async Lib', 'litespeed-cache' ) ; ?></th>
196
<td>
197
<?php $this->build_switch( LiteSpeed_Cache_Config::OPT_OPTM_CSS_ASYNC_INLINE ) ; ?>
198
<div class="litespeed-desc">
@@ -220,7 +220,7 @@ $last_critical_css_generated = LiteSpeed_Cache_CSS::get_summary() ;
220
<?php echo sprintf( __( 'Improve compatibility with inline JS by preventing jQuery optimization. (Recommended Setting: %s)', 'litespeed-cache' ), __( 'ON', 'litespeed-cache' ) ) ; ?>
221
<br /><font class="litespeed-warning">
222
<?php echo __('NOTE', 'litespeed-cache'); ?>:
223
- <?php echo sprintf( __( 'If there is any JS error related to %1$s when enabled %2$s, please try this option.', 'litespeed-cache' ), 'jQuery', __( 'JS Combine', 'litespeed-cache' ) ) ; ?>
224
</font>
225
</div>
226
</td>
145
</tr>
146
147
<tr>
148
+ <th class="litespeed-padding-left"><?php echo __( 'Generate Critical CSS', 'litespeed-cache' ) ; ?></th>
149
<td>
150
<?php $this->build_switch( LiteSpeed_Cache_Config::OPT_OPTM_CCSS_GEN ) ; ?>
151
<div class="litespeed-desc">
156
</tr>
157
158
<tr>
159
+ <th class="litespeed-padding-left"><?php echo __( 'Generate Critical CSS In Background', 'litespeed-cache' ) ; ?></th>
160
<td>
161
<?php $this->build_switch( LiteSpeed_Cache_Config::OPT_OPTM_CCSS_ASYNC ) ; ?>
162
<div class="litespeed-desc">
192
</tr>
193
194
<tr>
195
+ <th class="litespeed-padding-left"><?php echo __( 'Inline CSS Async Lib', 'litespeed-cache' ) ; ?></th>
196
<td>
197
<?php $this->build_switch( LiteSpeed_Cache_Config::OPT_OPTM_CSS_ASYNC_INLINE ) ; ?>
198
<div class="litespeed-desc">
220
<?php echo sprintf( __( 'Improve compatibility with inline JS by preventing jQuery optimization. (Recommended Setting: %s)', 'litespeed-cache' ), __( 'ON', 'litespeed-cache' ) ) ; ?>
221
<br /><font class="litespeed-warning">
222
<?php echo __('NOTE', 'litespeed-cache'); ?>:
223
+ <?php echo sprintf( __( 'If there is any JS error related to %1$s when enabled %2$s, please turn on this option.', 'litespeed-cache' ), 'jQuery', __( 'JS Combine', 'litespeed-cache' ) ) ; ?>
224
</font>
225
</div>
226
</td>
cli/litespeed-cache-cli-admin.class.php CHANGED
@@ -55,6 +55,12 @@ class LiteSpeed_Cache_Cli_Admin
55
$val = $args[1] ;
56
57
$options = LiteSpeed_Cache_Config::get_instance()->get_options() ;
58
59
if ( ! isset($options) || ( ! isset($options[$key]) && ! isset(self::$purges[$key])) ) {
60
WP_CLI::error('The options array is empty or the key is not valid.') ;
@@ -191,13 +197,11 @@ class LiteSpeed_Cache_Cli_Admin
191
*/
192
public function export_options($args, $assoc_args)
193
{
194
- $options = LiteSpeed_Cache_Config::get_instance()->get_options() ;
195
- $output = '' ;
196
if ( isset($assoc_args['filename']) ) {
197
$file = $assoc_args['filename'] ;
198
}
199
else {
200
- $file = getcwd() . '/lscache_wp_options_' . date('d_m_Y-His') . '.txt' ;
201
}
202
203
if ( ! is_writable(dirname($file)) ) {
@@ -205,13 +209,10 @@ class LiteSpeed_Cache_Cli_Admin
205
return ;
206
}
207
208
- foreach ($options as $key => $val) {
209
- $output .= sprintf("%s=%s\n", $key, $val) ;
210
- }
211
- $output .= "\n" ;
212
213
- if ( file_put_contents($file, $output) === false ) {
214
- WP_CLI::error('Failed to create file.') ;
215
}
216
else {
217
WP_CLI::success('Created file ' . $file) ;
@@ -243,21 +244,14 @@ class LiteSpeed_Cache_Cli_Admin
243
if ( ! file_exists($file) || ! is_readable($file) ) {
244
WP_CLI::error('File does not exist or is not readable.') ;
245
}
246
- $content = file_get_contents($file) ;
247
- preg_match_all("/^[^;][^=]+=[^=\n\r]*#x2F;m", $content, $input) ;
248
- $options = array() ;
249
- $default = LiteSpeed_Cache_Config::get_instance()->get_options() ;
250
-
251
- foreach ($input[0] as $opt) {
252
- $kv = explode('=', $opt) ;
253
- $options[$kv[0]] = $kv[1] ;
254
- }
255
256
- $options = LiteSpeed_Cache_Config::option_diff($default, $options) ;
257
258
- $options = LiteSpeed_Cache_Config::convert_options_to_input($options) ;
259
260
- $this->_update_options($options) ;
261
}
262
263
/**
55
$val = $args[1] ;
56
57
$options = LiteSpeed_Cache_Config::get_instance()->get_options() ;
58
+ // Get items
59
+ $cfg_items = LiteSpeed_Cache_Config::get_instance()->stored_items() ;
60
+ foreach ( $cfg_items as $v ) {
61
+ $options[ $v ] = get_option( $v ) ;
62
+ }
63
+
64
65
if ( ! isset($options) || ( ! isset($options[$key]) && ! isset(self::$purges[$key])) ) {
66
WP_CLI::error('The options array is empty or the key is not valid.') ;
197
*/
198
public function export_options($args, $assoc_args)
199
{
200
if ( isset($assoc_args['filename']) ) {
201
$file = $assoc_args['filename'] ;
202
}
203
else {
204
+ $file = getcwd() . '/lscache_wp_options_' . date('d_m_Y-His') . '.data' ;
205
}
206
207
if ( ! is_writable(dirname($file)) ) {
209
return ;
210
}
211
212
+ $data = LiteSpeed_Cache_Import::get_instance()->export() ;
213
214
+ if ( file_put_contents( $file, $data ) === false ) {
215