LiteSpeed Cache - Version 1.7.2

Version Description

  • January 5 2018 =
  • [NEW FEATURE] Cloudflare API support.
  • [IMPROVEMENT] IAPI key can now be reset to avoid issues when domain is changed.
  • [BUGFIX] Fixed JS optimizer breaking certain plugins JS.
  • [UPDATE] Added cdn settings to environment report.
  • [GUI] Added more shortcuts to backend adminbar.
  • [INTEGRATION] WooCommerce visitors are now served from public cache when cart is empty.
Download this release

Release Info

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

Code changes from version 1.6.7 to 1.7.2

Files changed (78) hide show
  1. admin/admin-api.class.php +39 -0
  2. admin/litespeed-cache-admin-display.class.php +113 -90
  3. admin/litespeed-cache-admin-report.class.php +7 -0
  4. admin/litespeed-cache-admin-rules.class.php +12 -0
  5. admin/litespeed-cache-admin-settings.class.php +141 -8
  6. admin/tpl/crawler.php +3 -0
  7. admin/tpl/esi_widget_edit.php +1 -4
  8. admin/tpl/image_optimization.php +10 -0
  9. admin/tpl/inc/api_key.php +0 -0
  10. admin/tpl/manage.php +4 -0
  11. admin/tpl/manage/manage_cdn.php +73 -0
  12. admin/tpl/setting/network_settings_media.php +0 -0
  13. admin/tpl/setting/settings_advanced.php +141 -69
  14. admin/tpl/setting/settings_cache.php +17 -0
  15. admin/tpl/setting/settings_cdn.php +132 -49
  16. admin/tpl/setting/settings_crawler.php +1 -1
  17. admin/tpl/setting/settings_debug.php +3 -3
  18. admin/tpl/setting/settings_excludes.php +2 -2
  19. admin/tpl/setting/settings_inc.cache_favicon.php +1 -2
  20. admin/tpl/setting/settings_inc.cache_mobile.php +2 -3
  21. admin/tpl/setting/settings_inc.cache_resources.php +1 -2
  22. admin/tpl/setting/settings_inc.exclude_cookies.php +1 -1
  23. admin/tpl/setting/settings_inc.media_webp.php +0 -0
  24. admin/tpl/setting/settings_media.php +4 -0
  25. admin/tpl/setting/settings_optimize.php +24 -0
  26. admin/tpl/setting/settings_purge.php +2 -2
  27. admin/tpl/setting/settings_tuning.php +13 -0
  28. cli/litespeed-cache-cli-admin.class.php +4 -6
  29. css/litespeed.css +236 -70
  30. img/icons/img_optm.svg +0 -0
  31. img/icons/img_optm_disabled.svg +0 -0
  32. img/icons/img_webp.svg +0 -0
  33. img/icons/img_webp_disabled.svg +0 -0
  34. inc/api.class.php +13 -3
  35. inc/cdn.class.php +353 -56
  36. inc/config.class.php +51 -14
  37. inc/control.class.php +33 -2
  38. inc/gui.class.php +96 -5
  39. inc/litespeed-cache.class.php +11 -1
  40. inc/media.class.php +5 -4
  41. inc/optimize.class.php +155 -27
  42. inc/router.class.php +3 -1
  43. inc/utility.class.php +35 -6
  44. inc/vary.class.php +8 -2
  45. includes/litespeed-cache-api.class.php +13 -3
  46. includes/litespeed-cache-cdn.class.php +353 -56
  47. includes/litespeed-cache-config.class.php +51 -14
  48. includes/litespeed-cache-control.class.php +33 -2
  49. includes/litespeed-cache-gui.class.php +96 -5
  50. includes/litespeed-cache-optimize.class.php +155 -27
  51. includes/litespeed-cache-router.class.php +3 -1
  52. includes/litespeed-cache-utility.class.php +35 -6
  53. includes/litespeed-cache-vary.class.php +8 -2
  54. includes/litespeed-cache.class.php +11 -1
  55. js/css_async.min.js +1 -0
  56. js/lazyload.min.js +1 -2
  57. js/litespeed-cache-admin.js +52 -23
  58. languages/litespeed-cache.pot +553 -316
  59. lib/vendor/bin/cssmin +0 -37
  60. lib/vendor/pimple/pimple/ext/pimple/config.m4 +0 -63
  61. lib/vendor/pimple/pimple/ext/pimple/config.w32 +0 -13
  62. lib/vendor/pimple/pimple/ext/pimple/php_pimple.h +0 -137
  63. lib/vendor/pimple/pimple/ext/pimple/pimple.c +0 -1114
  64. lib/vendor/pimple/pimple/ext/pimple/pimple_compat.h +0 -81
  65. lib/vendor/pimple/pimple/src/Pimple/Tests/Fixtures/Invokable.php +0 -38
  66. lib/vendor/pimple/pimple/src/Pimple/Tests/Fixtures/NonInvokable.php +0 -34
  67. lib/vendor/pimple/pimple/src/Pimple/Tests/Fixtures/PimpleServiceProvider.php +0 -54
  68. lib/vendor/pimple/pimple/src/Pimple/Tests/Fixtures/Service.php +0 -35
  69. lib/vendor/pimple/pimple/src/Pimple/Tests/PimpleServiceProviderInterfaceTest.php +0 -76
  70. lib/vendor/pimple/pimple/src/Pimple/Tests/PimpleTest.php +0 -589
  71. lib/vendor/pimple/pimple/src/Pimple/Tests/Psr11/ContainerTest.php +0 -77
  72. lib/vendor/pimple/pimple/src/Pimple/Tests/Psr11/ServiceLocatorTest.php +0 -134
  73. lib/vendor/pimple/pimple/src/Pimple/Tests/ServiceIteratorTest.php +0 -52
  74. litespeed-cache.php +1 -1
  75. readme.txt +40 -2
  76. thirdparty/lscwp-3rd-contact-form-7.cls.php +0 -0
  77. thirdparty/lscwp-3rd-login-with-ajax.cls.php +0 -0
  78. thirdparty/lscwp-3rd-woocommerce.cls.php +67 -4
admin/admin-api.class.php CHANGED
@@ -21,6 +21,7 @@ class LiteSpeed_Cache_Admin_API
21
const TYPE_NOTIFY_IMG = 'notify_img' ;
22
const TYPE_CHECK_IMG = 'check_img' ;
23
const TYPE_IMG_DESTROY_CALLBACK = 'imgoptm_destroy' ;
24
25
const IAPI_ACTION_REQUEST_KEY = 'request_key' ;
26
const IAPI_ACTION_MEDIA_SYNC_DATA = 'media_sync_data' ;
@@ -41,6 +42,30 @@ class LiteSpeed_Cache_Admin_API
41
$this->_iapi_key = get_option( self::DB_API_KEY ) ?: '' ;
42
}
43
44
/**
45
* Handle aggressive callback requests from LiteSpeed image server
46
*
@@ -220,7 +245,21 @@ class LiteSpeed_Cache_Admin_API
220
LiteSpeed_Cache_Log::debug( 'IAPI applied auth_key' ) ;
221
222
$this->_iapi_key = $json[ 'auth_key' ] ;
223
224
}
225
226
/**
21
const TYPE_NOTIFY_IMG = 'notify_img' ;
22
const TYPE_CHECK_IMG = 'check_img' ;
23
const TYPE_IMG_DESTROY_CALLBACK = 'imgoptm_destroy' ;
24
+ const TYPE_RESET_KEY = 'reset_key' ;
25
26
const IAPI_ACTION_REQUEST_KEY = 'request_key' ;
27
const IAPI_ACTION_MEDIA_SYNC_DATA = 'media_sync_data' ;
42
$this->_iapi_key = get_option( self::DB_API_KEY ) ?: '' ;
43
}
44
45
+ /**
46
+ * Handle all request actions from main cls
47
+ *
48
+ * @since 1.7.2
49
+ * @access public
50
+ */
51
+ public static function handler()
52
+ {
53
+ $instance = self::get_instance() ;
54
+
55
+ $type = LiteSpeed_Cache_Router::verify_type() ;
56
+
57
+ switch ( $type ) {
58
+ case self::TYPE_RESET_KEY :
59
+ $instance->_reset_key() ;
60
+ break ;
61
+
62
+ default:
63
+ break ;
64
+ }
65
+
66
+ LiteSpeed_Cache_Admin::redirect() ;
67
+ }
68
+
69
/**
70
* Handle aggressive callback requests from LiteSpeed image server
71
*
245
LiteSpeed_Cache_Log::debug( 'IAPI applied auth_key' ) ;
246
247
$this->_iapi_key = $json[ 'auth_key' ] ;
248
+ }
249
+
250
+ /**
251
+ * delete key
252
+ *
253
+ * @since 1.7.2
254
+ * @access private
255
+ */
256
+ private function _reset_key()
257
+ {
258
+ delete_option( self::DB_API_KEY ) ;
259
+ LiteSpeed_Cache_Log::debug( 'IAPI delete auth_key' ) ;
260
261
+ $msg = __( 'Reset IAPI key successfully.', 'litespeed-cache' ) ;
262
+ LiteSpeed_Cache_Admin_Display::succeed( $msg ) ;
263
}
264
265
/**
admin/litespeed-cache-admin-display.class.php CHANGED
@@ -66,7 +66,7 @@ class LiteSpeed_Cache_Admin_Display
66
}
67
if ( current_user_can($manage) ) {
68
if ( defined( 'LITESPEED_ON' ) ) {
69
- add_action('wp_before_admin_bar_render', array($this, 'add_quick_purge')) ;
70
}
71
add_action('admin_enqueue_scripts', array($this, 'check_messages')) ;// We can do this cos admin_notices hook is after admin_enqueue_scripts hook in wp-admin/admin-header.php
72
}
@@ -274,27 +274,6 @@ class LiteSpeed_Cache_Admin_Display
274
remove_filter('gettext', array($this, 'add_update_text')) ;
275
}
276
277
- /**
278
- * Hooked to wp_before_admin_bar_render.
279
- * Adds a link to the admin bar so users can quickly purge all.
280
- *
281
- * @access public
282
- * @global WP_Admin_Bar $wp_admin_bar
283
- * @global string $pagenow
284
- */
285
- public function add_quick_purge()
286
- {
287
- global $wp_admin_bar ;
288
- $url = LiteSpeed_Cache_Utility::build_url(LiteSpeed_Cache::ACTION_PURGE_ALL) ;
289
-
290
- $wp_admin_bar->add_node(array(
291
- 'id' => 'lscache-quick-purge',
292
- 'title' => '<span class="ab-icon"></span><span class="ab-label">' . __('LiteSpeed Cache Purge All', 'litespeed-cache') . '</span>',
293
- 'href' => $url,
294
- 'meta' => array('class' => 'litespeed-top-toolbar'),
295
- )) ;
296
- }
297
-
298
/**
299
* Change the admin footer text on LiteSpeed Cache admin pages.
300
*
@@ -668,72 +647,78 @@ class LiteSpeed_Cache_Admin_Display
668
* Build a textarea
669
*
670
* @since 1.1.0
671
* @access public
672
* @param string $id
673
* @param string $val Value of input
674
* @param boolean $disabled If this input is disabled or not
675
* @param int $cols The width of textarea
676
*/
677
- public function build_textarea( $id, $val = null, $disabled = false, $cols = false )
678
{
679
- if ( $val === null ) {
680
- global $_options ;
681
- $val = $_options[$id] ;
682
}
683
$disabled = $disabled ? ' disabled ' : '' ;
684
685
- if ( $cols === false ) {
686
$cols = 80 ;
687
}
688
689
- echo "<textarea name='" . LiteSpeed_Cache_Config::OPTION_NAME . "[$id]' rows='5' cols='$cols' $disabled>" . esc_textarea($val) . "</textarea>" ;
690
}
691
692
/**
693
* Build a textarea based on separate stored option data
694
*
695
* @since 1.5
696
* @access public
697
* @param string $id
698
- * @param string $val Value of input
699
- * @param boolean $disabled If this input is disabled or not
700
* @param int $cols The width of textarea
701
*/
702
- public function build_textarea2( $id, $val = null, $disabled = false, $cols = false, $default_val = null )
703
{
704
- if ( $val === null ) {
705
- $val = get_option( $id, $default_val ) ;
706
- }
707
- $disabled = $disabled ? ' disabled ' : '' ;
708
709
- if ( $cols === false ) {
710
- $cols = 80 ;
711
}
712
713
- echo "<textarea name='" . LiteSpeed_Cache_Config::OPTION_NAME . "[$id]' rows='5' cols='$cols' $disabled>" . esc_textarea( $val ) . "</textarea>" ;
714
}
715
716
/**
717
* Build a text input field
718
*
719
* @since 1.1.0
720
* @access public
721
* @param string $id
722
* @param string $style Appending styles
723
- * @param boolean $disabled Disable this field
724
* @param boolean $readonly If is readonly
725
* @param string $id_attr ID for this field
726
* @param string $val Field value
727
* @param string $attrs Additional attributes
728
* @param string $type Input type
729
*/
730
- public function build_input( $id, $style = false, $disabled = false, $readonly = false, $id_attr = null, $val = null, $attrs = '', $type = 'text' )
731
{
732
- if ( $val === null ) {
733
- global $_options ;
734
- $val = $_options[ $id ] ;
735
}
736
- $disabled = $disabled ? ' disabled ' : '' ;
737
$readonly = $readonly ? ' readonly ' : '' ;
738
if ( $id_attr !== null ) {
739
$id_attr = " id='$id_attr' " ;
@@ -743,35 +728,7 @@ class LiteSpeed_Cache_Admin_Display
743
$style = "litespeed-regular-text $style" ;
744
}
745
746
- echo "<input type='$type' class='$style' name='" . LiteSpeed_Cache_Config::OPTION_NAME . "[$id]' value='" . esc_textarea( $val ) ."' $disabled $readonly $id_attr $attrs /> " ;
747
- }
748
-
749
- /**
750
- * Build a switch div html snippet
751
- *
752
- * @since 1.1.0
753
- * @access public
754
- * @param string $id
755
- * @param boolean $disabled Disable this field
756
- * @param boolean $return Return the html or echo it
757
- * @param boolean $checked If the value is on
758
- * @param string $id_attr ID for this field, set to true if want to use a not specified unique value
759
- */
760
- public function build_switch($id, $disabled = false, $return = false, $checked = null, $id_attr = null)
761
- {
762
- $id_attr_on = $id_attr === null ? null : $id_attr . '_' . LiteSpeed_Cache_Config::VAL_ON ;
763
- $id_attr_off = $id_attr === null ? null : $id_attr . '_' . LiteSpeed_Cache_Config::VAL_OFF ;
764
- $html = '<div class="litespeed-switch">' ;
765
- $html .= $this->build_radio($id, LiteSpeed_Cache_Config::VAL_OFF, null, $checked === null ? null : !$checked, $disabled, $id_attr_off) ;
766
- $html .= $this->build_radio($id, LiteSpeed_Cache_Config::VAL_ON, null, $checked, $disabled, $id_attr_on) ;
767
- $html .= '</div>' ;
768
-
769
- if ( $return ) {
770
- return $html ;
771
- }
772
- else {
773
- echo $html ;
774
- }
775
}
776
777
/**
@@ -799,6 +756,76 @@ class LiteSpeed_Cache_Admin_Display
799
</div>" ;
800
}
801
802
/**
803
* Build a radio input html codes and output
804
*
@@ -810,20 +837,24 @@ class LiteSpeed_Cache_Admin_Display
810
* @param bool $checked If checked or not
811
* @param string $id_attr ID for this field, set to true if want to use a not specified unique value
812
*/
813
- public function build_radio($id, $val, $txt = null, $checked = null, $disabled = false, $id_attr = null)
814
{
815
- if ( $checked === null ) {
816
- global $_options ;
817
- $to_be_checked = null ;
818
- if ( isset( $_options[ $id ] ) ) {
819
- $to_be_checked = is_int( $val ) ? (int)$_options[ $id ] : $_options[ $id ] ;
820
}
821
822
- $checked = $to_be_checked === $val ? true : false ;
823
}
824
825
if ( $id_attr === null ) {
826
- $id_attr = is_int($val) ? "conf_{$id}_$val" : md5($val) ;
827
}
828
elseif ( $id_attr === true ) {
829
$id_attr = md5($val) ;
@@ -840,16 +871,8 @@ class LiteSpeed_Cache_Admin_Display
840
}
841
842
$checked = $checked ? ' checked ' : '' ;
843
- $disabled = $disabled ? ' disabled ' : '' ;
844
845
- return "<input type='radio' "
846
- . " name='". LiteSpeed_Cache_Config::OPTION_NAME . "[$id]' "
847
- . " id='$id_attr' "
848
- . " value='$val' "
849
- . " $checked "
850
- . " $disabled "
851
- . " />"
852
- . " <label for='$id_attr'>$txt</label>" ;
853
}
854
855
/**
66
}
67
if ( current_user_can($manage) ) {
68
if ( defined( 'LITESPEED_ON' ) ) {
69
+ add_action( 'wp_before_admin_bar_render', array( LiteSpeed_Cache_GUI::get_instance(), 'backend_shortcut' ) ) ;
70
}
71
add_action('admin_enqueue_scripts', array($this, 'check_messages')) ;// We can do this cos admin_notices hook is after admin_enqueue_scripts hook in wp-admin/admin-header.php
72
}
274
remove_filter('gettext', array($this, 'add_update_text')) ;
275
}
276
277
/**
278
* Change the admin footer text on LiteSpeed Cache admin pages.
279
*
647
* Build a textarea
648
*
649
* @since 1.1.0
650
+ * @since 1.7 Changed cols param order to be the 2nd from 4th
651
* @access public
652
* @param string $id
653
* @param string $val Value of input
654
* @param boolean $disabled If this input is disabled or not
655
* @param int $cols The width of textarea
656
*/
657
+ public function build_textarea( $id, $cols = false, $val = null, $disabled = false )
658
{
659
+ if ( strpos( $id, '[' ) === false ) {
660
+ if ( $val === null ) {
661
+ global $_options ;
662
+ $val = $_options[$id] ;
663
+ }
664
+
665
+ $id = "[$id]" ;
666
}
667
+
668
$disabled = $disabled ? ' disabled ' : '' ;
669
670
+ if ( ! $cols ) {
671
$cols = 80 ;
672
}
673
674
+ echo "<textarea name='" . LiteSpeed_Cache_Config::OPTION_NAME . "$id' rows='5' cols='$cols' $disabled>" . esc_textarea($val) . "</textarea>" ;
675
}
676
677
/**
678
* Build a textarea based on separate stored option data
679
*
680
* @since 1.5
681
+ * @since 1.7 Changed cols param order to be the 2nd from 4th
682
* @access public
683
* @param string $id
684
* @param int $cols The width of textarea
685
*/
686
+ public function build_textarea2( $id, $cols = false )
687
{
688
+ $val = get_option( $id, false ) ;
689
690
+ if ( is_array( $val ) ) {
691
+ $val = implode( "\n", $val ) ;
692
}
693
694
+ $this->build_textarea( $id, $cols, $val ) ;
695
}
696
697
/**
698
* Build a text input field
699
*
700
* @since 1.1.0
701
+ * @since 1.7 Added [] check and wrapper to $id, moved $readonly/$id_attr
702
* @access public
703
* @param string $id
704
* @param string $style Appending styles
705
* @param boolean $readonly If is readonly
706
* @param string $id_attr ID for this field
707
* @param string $val Field value
708
* @param string $attrs Additional attributes
709
* @param string $type Input type
710
*/
711
+ public function build_input( $id, $style = false, $val = null, $id_attr = null, $attrs = '', $type = 'text', $readonly = false )
712
{
713
+ if ( strpos( $id, '[' ) === false ) {
714
+ if ( $val === null ) {
715
+ global $_options ;
716
+ $val = $_options[ $id ] ;
717
+ }
718
+
719
+ $id = "[$id]" ;
720
}
721
+
722
$readonly = $readonly ? ' readonly ' : '' ;
723
if ( $id_attr !== null ) {
724
$id_attr = " id='$id_attr' " ;
728
$style = "litespeed-regular-text $style" ;
729
}
730
731
+ echo "<input type='$type' class='$style' name='" . LiteSpeed_Cache_Config::OPTION_NAME . "$id' value='" . esc_textarea( $val ) ."' $readonly $id_attr $attrs /> " ;
732
}
733
734
/**
756
</div>" ;
757
}
758
759
+ /**
760
+ * Build a toggle checkbox html snippet
761
+ *
762
+ * @since 1.7
763
+ */
764
+ public function build_toggle( $id, $checked = null, $title_on = null, $title_off = null )
765
+ {
766
+ if ( strpos( $id, '[' ) === false ) {
767
+ if ( $checked === null ) {
768
+ global $_options ;
769
+ $to_be_checked = null ;
770
+ if ( isset( $_options[ $id ] ) ) {
771
+ $to_be_checked = $_options[ $id ] ;
772
+ }
773
+ $checked = $to_be_checked ? true : false ;
774
+ }
775
+ $id = "[$id]" ;
776
+ }
777
+ $checked = $checked ? 1 : 0 ;
778
+
779
+ if ( $title_on === null ) {
780
+ $title_on = __( 'ON', 'litespeed-cache' ) ;
781
+ $title_off = __( 'OFF', 'litespeed-cache' ) ;
782
+ }
783
+
784
+ if ( $checked ) {
785
+ $cls = 'primary' ;
786
+ }
787
+ else {
788
+ $cls = 'default litespeed-toggleoff' ;
789
+ }
790
+
791
+ echo "<div class='litespeed-toggle litespeed-toggle-btn litespeed-toggle-btn-$cls' data-litespeed-toggle-on='primary' data-litespeed-toggle-off='default'>
792
+ <input name='" . LiteSpeed_Cache_Config::OPTION_NAME . "$id' type='hidden' value='$checked' />
793
+ <div class='litespeed-toggle-group'>
794
+ <label class='litespeed-toggle-btn litespeed-toggle-btn-primary litespeed-toggle-on'>$title_on</label>
795
+ <label class='litespeed-toggle-btn litespeed-toggle-btn-default litespeed-toggle-active litespeed-toggle-off'>$title_off</label>
796
+ <span class='litespeed-toggle-handle litespeed-toggle-btn litespeed-toggle-btn-default'></span>
797
+ </div>
798
+ </div>" ;
799
+ }
800
+
801
+ /**
802
+ * Build a switch div html snippet
803
+ *
804
+ * @since 1.1.0
805
+ * @since 1.7 removed param $disable
806
+ * @access public
807
+ * @param string $id
808
+ * @param boolean $return Return the html or echo it
809
+ * @param boolean $checked If the value is on
810
+ * @param string $id_attr ID for this field, set to true if want to use a not specified unique value
811
+ */
812
+ public function build_switch($id, $checked = null, $return = false, $id_attr = null)
813
+ {
814
+ $id_attr_on = $id_attr === null ? null : $id_attr . '_' . LiteSpeed_Cache_Config::VAL_ON ;
815
+ $id_attr_off = $id_attr === null ? null : $id_attr . '_' . LiteSpeed_Cache_Config::VAL_OFF ;
816
+ $html = '<div class="litespeed-switch">' ;
817
+ $html .= $this->build_radio($id, LiteSpeed_Cache_Config::VAL_OFF, null, $checked === null ? null : !$checked, $id_attr_off) ;
818
+ $html .= $this->build_radio($id, LiteSpeed_Cache_Config::VAL_ON, null, $checked, $id_attr_on) ;
819
+ $html .= '</div>' ;
820
+
821
+ if ( $return ) {
822
+ return $html ;
823
+ }
824
+ else {
825
+ echo $html ;
826
+ }
827
+ }
828
+
829
/**
830
* Build a radio input html codes and output
831
*
837
* @param bool $checked If checked or not
838
* @param string $id_attr ID for this field, set to true if want to use a not specified unique value
839
*/
840
+ public function build_radio($id, $val, $txt = null, $checked = null, $id_attr = null)
841
{
842
+ if ( strpos( $id, '[' ) === false ) {
843
+ if ( $checked === null ) {
844
+ global $_options ;
845
+ $to_be_checked = null ;
846
+ if ( isset( $_options[ $id ] ) ) {
847
+ $to_be_checked = is_int( $val ) ? (int)$_options[ $id ] : $_options[ $id ] ;
848
+ }
849
+
850
+ $checked = $to_be_checked === $val ? true : false ;
851
}
852
853
+ $id = "[$id]" ;
854
}
855
856
if ( $id_attr === null ) {
857
+ $id_attr = is_int($val) ? "conf_" . str_replace( array( '[', ']' ), '_', $id ) . "_$val" : md5($val) ;
858
}
859
elseif ( $id_attr === true ) {
860
$id_attr = md5($val) ;
871
}
872
873
$checked = $checked ? ' checked ' : '' ;
874
875
+ return "<input type='radio' name='". LiteSpeed_Cache_Config::OPTION_NAME . "$id' id='$id_attr' value='$val' $checked /> <label for='$id_attr'>$txt</label>" ;
876
}
877
878
/**
admin/litespeed-cache-admin-report.class.php CHANGED
@@ -157,6 +157,13 @@ class LiteSpeed_Cache_Admin_Report
157
}
158
}
159
160
$report = $this->build_environment_report($_SERVER, $options, $extras, $paths) ;
161
return $report ;
162
}
157
}
158
}
159
160
+ // Security: Remove cf key in report
161
+ if ( ! empty( $options[ LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE_KEY ] ) ) {
162
+ $options[ LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE_KEY ] = str_repeat( '*', strlen( $options[ LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE_KEY ] ) ) ;
163
+ }
164
+
165
+ $options[ LiteSpeed_Cache_Config::ITEM_CDN_MAPPING ] = get_option( LiteSpeed_Cache_Config::ITEM_CDN_MAPPING ) ;
166
+
167
$report = $this->build_environment_report($_SERVER, $options, $extras, $paths) ;
168
return $report ;
169
}
admin/litespeed-cache-admin-rules.class.php CHANGED
@@ -44,6 +44,7 @@ class LiteSpeed_Cache_Admin_Rules
44
const MARKER_MINIFY = '### marker MINIFY' ;
45
const MARKER_CORS = '### marker CORS' ;
46
const MARKER_WEBP = '### marker WEBP' ;
47
const MARKER_START = ' start ###' ;
48
const MARKER_END = ' end ###' ;
49
@@ -661,6 +662,17 @@ class LiteSpeed_Cache_Admin_Rules
661
$new_rules[] = '' ;
662
}
663
664
return array( $new_rules, $new_rules_backend ) ;
665
666
}
44
const MARKER_MINIFY = '### marker MINIFY' ;
45
const MARKER_CORS = '### marker CORS' ;
46
const MARKER_WEBP = '### marker WEBP' ;
47
+ const MARKER_DROPQS = '### marker DROPQS' ;
48
const MARKER_START = ' start ###' ;
49
const MARKER_END = ' end ###' ;
50
662
$new_rules[] = '' ;
663
}
664
665
+ // drop qs support
666
+ $id = LiteSpeed_Cache_Config::ITEM_CACHE_DROP_QS ;
667
+ if ( $cfg_info = get_option( $id ) ) {
668
+ $new_rules[] = self::MARKER_DROPQS . self::MARKER_START ;
669
+ foreach ( explode( "\n", $cfg_info ) as $v ) {
670
+ $new_rules[] = 'CacheKeyModify -qs:' . $v ;
671
+ }
672
+ $new_rules[] = self::MARKER_DROPQS . self::MARKER_END ;
673
+ $new_rules[] = '' ;
674
+ }
675
+
676
return array( $new_rules, $new_rules_backend ) ;
677
678
}
admin/litespeed-cache-admin-settings.class.php CHANGED
@@ -68,6 +68,8 @@ class LiteSpeed_Cache_Admin_Settings
68
69
$this->_validate_cdn() ;
70
71
$this->_validate_debug() ;
72
73
$this->_validate_crawler() ; // Network setup doesn't run validate_plugin_settings
@@ -307,6 +309,14 @@ class LiteSpeed_Cache_Admin_Settings
307
if ( isset( $this->_input[ $id ]) ) {
308
$this->_options[ $id ] = LiteSpeed_Cache_Utility::sanitize_lines( $this->_input[ $id ], 'relative' ) ;
309
}
310
}
311
312
/**
@@ -439,14 +449,24 @@ class LiteSpeed_Cache_Admin_Settings
439
*/
440
private function _validate_cdn()
441
{
442
$ids = array(
443
LiteSpeed_Cache_Config::OPID_CDN,
444
- LiteSpeed_Cache_Config::OPID_CDN_INC_IMG,
445
- LiteSpeed_Cache_Config::OPID_CDN_INC_CSS,
446
- LiteSpeed_Cache_Config::OPID_CDN_INC_JS,
447
) ;
448
foreach ( $ids as $id ) {
449
- $this->_options[ $id ] = self::parse_onoff( $this->_input, $id ) ;
450
}
451
452
$id = LiteSpeed_Cache_Config::OPID_CDN_ORI ;
@@ -458,17 +478,39 @@ class LiteSpeed_Cache_Admin_Settings
458
}
459
}
460
461
- $id = LiteSpeed_Cache_Config::OPID_CDN_URL ;
462
- $this->_options[ $id ] = $this->_input[ $id ] ;
463
-
464
$ids = array(
465
- LiteSpeed_Cache_Config::OPID_CDN_FILETYPE,
466
LiteSpeed_Cache_Config::OPID_CDN_EXCLUDE,
467
) ;
468
foreach ( $ids as $id ) {
469
$this->_options[ $id ] = LiteSpeed_Cache_Utility::sanitize_lines( $this->_input[ $id ] ) ;
470
}
471
472
/**
473
* Load jQuery from cdn
474
* @since 1.5
@@ -476,6 +518,37 @@ class LiteSpeed_Cache_Admin_Settings
476
$id = LiteSpeed_Cache_Config::OPID_CDN_REMOTE_JQUERY ;
477
$this->_options[ $id ] = self::is_checked_radio( $this->_input[ $id ] ) ;
478
479
}
480
481
/**
@@ -533,6 +606,7 @@ class LiteSpeed_Cache_Admin_Settings
533
LiteSpeed_Cache_Config::OPID_OPTM_EMOJI_RM,
534
LiteSpeed_Cache_Config::OPID_OPTM_EXC_JQUERY,
535
LiteSpeed_Cache_Config::OPID_OPTM_GGFONTS_ASYNC,
536
) ;
537
foreach ( $ids as $id ) {
538
$this->_options[ $id ] = self::parse_onoff( $this->_input, $id ) ;
@@ -569,6 +643,65 @@ class LiteSpeed_Cache_Admin_Settings
569
$id = LiteSpeed_Cache_Config::EXCLUDE_OPTIMIZATION_ROLES ;
570
update_option( $id, ! empty( $this->_input[ $id ] ) ? $this->_input[ $id ] : array() ) ;
571
572
}
573
574
/**
68
69
$this->_validate_cdn() ;
70
71
+ $this->_validate_adv() ;
72
+
73
$this->_validate_debug() ;
74
75
$this->_validate_crawler() ; // Network setup doesn't run validate_plugin_settings
309
if ( isset( $this->_input[ $id ]) ) {
310
$this->_options[ $id ] = LiteSpeed_Cache_Utility::sanitize_lines( $this->_input[ $id ], 'relative' ) ;
311
}
312
+
313
+ /**
314
+ * Update Drop Query String
315
+ * @since 1.7
316
+ */
317
+ $id = LiteSpeed_Cache_Config::ITEM_CACHE_DROP_QS ;
318
+ update_option( $id, ! empty( $this->_input[ $id ] ) ? LiteSpeed_Cache_Utility::sanitize_lines( $this->_input[ $id ] ) : '' ) ;
319
+
320
}
321
322
/**
449
*/
450
private function _validate_cdn()
451
{
452
+ $cdn_cloudflare_changed = false ;
453
$ids = array(
454
LiteSpeed_Cache_Config::OPID_CDN,
455
+ LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE,
456
) ;
457
foreach ( $ids as $id ) {
458
+ $v = self::parse_onoff( $this->_input, $id ) ;
459
+ if ( $this->_options[ $id ] === $v ) {
460
+ continue ;
461
+ }
462
+
463
+ $this->_options[ $id ] = $v ;
464
+
465
+ // Cloudflare setting is changed
466
+ if ( $id == LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE ) {
467
+ $cdn_cloudflare_changed = true ;
468
+ }
469
+
470
}
471
472
$id = LiteSpeed_Cache_Config::OPID_CDN_ORI ;
478
}
479
}
480
481
$ids = array(
482
LiteSpeed_Cache_Config::OPID_CDN_EXCLUDE,
483
) ;
484
foreach ( $ids as $id ) {
485
$this->_options[ $id ] = LiteSpeed_Cache_Utility::sanitize_lines( $this->_input[ $id ] ) ;
486
}
487
488
+ /**
489
+ * Handle multiple CDN setting
490
+ * @since 1.7
491
+ */
492
+ $cdn_mapping = array() ;
493
+ $mapping_fields = array(
494
+ LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_URL,
495
+ LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_INC_IMG,
496
+ LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_INC_CSS,
497
+ LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_INC_JS,
498
+ LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_FILETYPE
499
+ ) ;
500
+ $id = LiteSpeed_Cache_Config::ITEM_CDN_MAPPING ;
501
+ foreach ( $this->_input[ $id ][ LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_URL ] as $k => $v ) {
502
+ $this_mapping = array() ;
503
+ foreach ( $mapping_fields as $f ) {
504
+ $this_mapping[ $f ] = ! empty( $this->_input[ $id ][ $f ][ $k ] ) ? $this->_input[ $id ][ $f ][ $k ] : false ;
505
+ if ( $f === LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_FILETYPE ) {
506
+ $this_mapping[ $f ] = LiteSpeed_Cache_Utility::sanitize_lines( $this_mapping[ $f ] ) ;
507
+ }
508
+ }
509
+
510
+ $cdn_mapping[] = $this_mapping ;
511
+ }
512
+ update_option( LiteSpeed_Cache_Config::ITEM_CDN_MAPPING, $cdn_mapping ) ;
513
+
514
/**
515
* Load jQuery from cdn
516
* @since 1.5
518
$id = LiteSpeed_Cache_Config::OPID_CDN_REMOTE_JQUERY ;
519
$this->_options[ $id ] = self::is_checked_radio( $this->_input[ $id ] ) ;
520
521
+ /**
522
+ * CLoudflare API
523
+ * @since 1.7.2
524
+ */
525
+ $ids = array(
526
+ LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE_EMAIL,
527
+ LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE_KEY,
528
+ LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE_NAME,
529
+ ) ;
530
+ foreach ( $ids as $id ) {
531
+ if ( $this->_options[ $id ] === $this->_input[ $id ] ) {
532
+ continue ;
533
+ }
534
+ $cdn_cloudflare_changed = true ;
535
+ $this->_options[ $id ] = $this->_input[ $id ] ;
536
+ }
537
+
538
+ // If cloudflare API is on, refresh the zone
539
+ if ( $this->_options[ LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE ] && $cdn_cloudflare_changed ) {
540
+ $zone = LiteSpeed_Cache_CDN::get_instance()->cloudflare_fetch_zone( $this->_options ) ;
541
+ if ( $zone ) {
542
+ $this->_options[ LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE_NAME ] = $zone[ 'name' ] ;
543
+ $this->_options[ LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE_ZONE ] = $zone[ 'id' ] ;
544
+
545
+ LiteSpeed_Cache_Log::debug( "Settings: Get zone successfully \t\t[ID] $zone[id]" ) ;
546
+ }
547
+ else {
548
+ $this->_options[ LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE_ZONE ] = '' ;
549
+ LiteSpeed_Cache_Log::debug( 'Settings: Get zone failed, clean zone' ) ;
550
+ }
551
+ }
552
}
553
554
/**
606
LiteSpeed_Cache_Config::OPID_OPTM_EMOJI_RM,
607
LiteSpeed_Cache_Config::OPID_OPTM_EXC_JQUERY,
608
LiteSpeed_Cache_Config::OPID_OPTM_GGFONTS_ASYNC,
609
+ LiteSpeed_Cache_Config::OPID_OPTM_RM_COMMENT,
610
) ;
611
foreach ( $ids as $id ) {
612
$this->_options[ $id ] = self::parse_onoff( $this->_input, $id ) ;
643
$id = LiteSpeed_Cache_Config::EXCLUDE_OPTIMIZATION_ROLES ;
644
update_option( $id, ! empty( $this->_input[ $id ] ) ? $this->_input[ $id ] : array() ) ;
645
646
+ /**
647
+ * DNS prefetch
648
+ * @since 1.7.1
649
+ */
650
+ $id = LiteSpeed_Cache_Config::ITEM_DNS_PREFETCH ;
651
+ update_option( $id, LiteSpeed_Cache_Utility::sanitize_lines( $this->_input[ $id ], 'domain' ) ) ;
652
+
653
+ /**
654
+ * Combined file max size
655
+ * @since 1.7.1
656
+ */
657
+ $id = LiteSpeed_Cache_Config::OPID_OPTM_MAX_SIZE ;
658
+ $this->_options[ $id ] = $this->_input[ $id ] ;
659
+ }
660
+
661
+ /**
662
+ * Validate advanced setting
663
+ *
664
+ * @since 1.7.1
665
+ * @access private
666
+ */
667
+ private function _validate_adv()
668
+ {
669
+ $ids = array(
670
+ LiteSpeed_Cache_Config::OPID_USE_HTTP_FOR_HTTPS_VARY,
671
+ // LiteSpeed_Cache_Config::OPID_ADV_FAVICON,
672
+ ) ;
673
+ foreach ( $ids as $id ) {
674
+ $this->_options[ $id ] = self::parse_onoff( $this->_input, $id ) ;
675
+ }
676
+
677
+ /**
678
+ * Added Favicon
679
+ * @since 1.7.2
680
+ */
681
+ // $fav_file_arr = array( 'frontend', 'backend' ) ;
682
+ // $new_favicons = array() ;
683
+ // foreach ( $fav_file_arr as $v ) {
684
+ // if ( ! empty( $_FILES[ 'litespeed-file-favicon_' . $v ][ 'name' ] ) ) {
685
+ // $file = wp_handle_upload( $_FILES[ 'litespeed-file-favicon_' . $v ], array( 'action' => 'update' ) ) ;
686
+ // if ( ! empty( $file[ 'url' ] ) ) {
687
+ // LiteSpeed_Cache_Log::debug( 'Settings: Updated favicon [' . $v . '] ' . $file[ 'url' ] ) ;
688
+
689
+ // $new_favicons[ $v ] = $file[ 'url' ] ;
690
+
691
+ // }
692
+ // elseif ( isset( $file[ 'error' ] ) ) {
693
+ // LiteSpeed_Cache_Log::debug( 'Settings: Failed to update favicon: [' . $v . '] ' . $file[ 'error' ] ) ;
694
+ // }
695
+ // else {
696
+ // LiteSpeed_Cache_Log::debug( 'Settings: Failed to update favicon: Unkown err [' . $v . ']' ) ;
697
+ // }
698
+ // }
699
+ // }
700
+
701
+ // if ( $new_favicons ) {
702
+ // $cfg_favicon = get_option( LiteSpeed_Cache_Config::ITEM_FAVICON, array() ) ;
703
+ // update_option( LiteSpeed_Cache_Config::ITEM_FAVICON, array_merge( $cfg_favicon, $new_favicons ) ) ;
704
+ // }
705
}
706
707
/**
admin/tpl/crawler.php CHANGED
@@ -18,6 +18,9 @@ include_once LSWCP_DIR . "admin/tpl/inc/banner_promo.php" ;
18
</span>
19
</h2>
20
</div>
21
<div class="litespeed-wrap">
22
<div class="litespeed-body">
23
<h3 class="litespeed-title"><?php echo __('Crawler File', 'litespeed-cache') ; ?></h3>
18
</span>
19
</h2>
20
</div>
21
+
22
+ <?php include_once LSWCP_DIR . "admin/tpl/inc/check_cache_disabled.php" ; ?>
23
+
24
<div class="litespeed-wrap">
25
<div class="litespeed-body">
26
<h3 class="litespeed-title"><?php echo __('Crawler File', 'litespeed-cache') ; ?></h3>
admin/tpl/esi_widget_edit.php CHANGED
@@ -39,7 +39,6 @@ $display = LiteSpeed_Cache_Admin_Display::get_instance() ;
39
LiteSpeed_Cache_Config::VAL_ON,
40
__( 'Public', 'litespeed-cache' ),
41
$esi === LiteSpeed_Cache_Config::VAL_ON,
42
- false,
43
'litespeed-cfg-' . $widget->id . '_' . LiteSpeed_Cache_Config::VAL_ON
44
);
45
@@ -48,7 +47,6 @@ $display = LiteSpeed_Cache_Admin_Display::get_instance() ;
48
LiteSpeed_Cache_Config::VAL_ON2,
49
__( 'Private', 'litespeed-cache' ),
50
$esi === LiteSpeed_Cache_Config::VAL_ON2,
51
- false,
52
'litespeed-cfg-' . $widget->id . '_' . LiteSpeed_Cache_Config::VAL_ON2
53
);
54
@@ -57,7 +55,6 @@ $display = LiteSpeed_Cache_Admin_Display::get_instance() ;
57
LiteSpeed_Cache_Config::VAL_OFF,
58
__( 'Disable', 'litespeed-cache' ),
59
$esi === LiteSpeed_Cache_Config::VAL_OFF,
60
- false,
61
'litespeed-cfg-' . $widget->id . '_' . LiteSpeed_Cache_Config::VAL_OFF
62
);
63
?>
@@ -68,7 +65,7 @@ $display = LiteSpeed_Cache_Admin_Display::get_instance() ;
68
69
<b><?php echo __( 'Widget Cache TTL:', 'litespeed-cache' ) ; ?></b>
70
&nbsp;&nbsp;
71
- <?php $display->build_input( LiteSpeed_Cache_ESI::WIDGET_OPID_TTL, 'litespeed-reset', false, false, null, $ttl, 'size="7"' ) ; ?>
72
<?php echo __( 'seconds', 'litespeed-cache' ) ; ?>
73
74
<p class="install-help">
39
LiteSpeed_Cache_Config::VAL_ON,
40
__( 'Public', 'litespeed-cache' ),
41
$esi === LiteSpeed_Cache_Config::VAL_ON,
42
'litespeed-cfg-' . $widget->id . '_' . LiteSpeed_Cache_Config::VAL_ON
43
);
44
47
LiteSpeed_Cache_Config::VAL_ON2,
48
__( 'Private', 'litespeed-cache' ),
49
$esi === LiteSpeed_Cache_Config::VAL_ON2,
50
'litespeed-cfg-' . $widget->id . '_' . LiteSpeed_Cache_Config::VAL_ON2
51
);
52
55
LiteSpeed_Cache_Config::VAL_OFF,
56
__( 'Disable', 'litespeed-cache' ),
57
$esi === LiteSpeed_Cache_Config::VAL_OFF,
58
'litespeed-cfg-' . $widget->id . '_' . LiteSpeed_Cache_Config::VAL_OFF
59
);
60
?>
65
66
<b><?php echo __( 'Widget Cache TTL:', 'litespeed-cache' ) ; ?></b>
67
&nbsp;&nbsp;
68
+ <?php $display->build_input( LiteSpeed_Cache_ESI::WIDGET_OPID_TTL, 'litespeed-reset', $ttl, null, 'size="7"' ) ; ?>
69
<?php echo __( 'seconds', 'litespeed-cache' ) ; ?>
70
71
<p class="install-help">
admin/tpl/image_optimization.php CHANGED
@@ -53,6 +53,8 @@ include_once LSWCP_DIR . "admin/tpl/inc/banner_promo.php" ;
53
</h2>
54
</div>
55
56
<div class="litespeed-wrap">
57
<div class="litespeed-body">
58
<h3 class="litespeed-title"><?php echo __('Optimization Summary', 'litespeed-cache') ; ?></h3>
@@ -187,6 +189,14 @@ include_once LSWCP_DIR . "admin/tpl/inc/banner_promo.php" ;
187
<?php echo __( 'Scan for any new unoptimized image thumbnail sizes and resend necessary image optimization requests.', 'litespeed-cache' ) ; ?>
188
</span>
189
190
<br />
191
<a href="<?php echo LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_MEDIA, LiteSpeed_Cache_Media::TYPE_IMG_OPTIMIZE_DESTROY ) ; ?>" class="litespeed-btn-danger">
192
<?php echo __( 'Destroy All Optimization Data!', 'litespeed-cache' ) ; ?>
53
</h2>
54
</div>
55
56
+ <?php include_once LSWCP_DIR . "admin/tpl/inc/check_cache_disabled.php" ; ?>
57
+
58
<div class="litespeed-wrap">
59
<div class="litespeed-body">
60
<h3 class="litespeed-title"><?php echo __('Optimization Summary', 'litespeed-cache') ; ?></h3>
189
<?php echo __( 'Scan for any new unoptimized image thumbnail sizes and resend necessary image optimization requests.', 'litespeed-cache' ) ; ?>
190
</span>
191
192
+ <br />
193
+ <a href="<?php echo LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_IAPI, LiteSpeed_Cache_Admin_API::TYPE_RESET_KEY ) ; ?>" class="litespeed-btn-warning">
194
+ <?php echo __( 'Reset IAPI Key', 'litespeed-cache' ) ; ?>
195
+ </a>
196
+ <span class="litespeed-desc">
197
+ <?php echo __( 'The current IAPI key must be reset after changing home URL or domain before making any further optimization requests.', 'litespeed-cache' ) ; ?>
198
+ </span>
199
+
200
<br />
201
<a href="<?php echo LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_MEDIA, LiteSpeed_Cache_Media::TYPE_IMG_OPTIMIZE_DESTROY ) ; ?>" class="litespeed-btn-danger">
202
<?php echo __( 'Destroy All Optimization Data!', 'litespeed-cache' ) ; ?>
admin/tpl/inc/api_key.php CHANGED
File without changes
admin/tpl/manage.php CHANGED
@@ -8,6 +8,10 @@ $menu_list = array(
8
'db' => __('DB Optimizer', 'litespeed-cache'),
9
) ;
10
11
include_once LSWCP_DIR . "admin/tpl/inc/banner_promo.php" ;
12
?>
13
8
'db' => __('DB Optimizer', 'litespeed-cache'),
9
) ;
10
11
+ if ( ! is_network_admin() ) {
12
+ $menu_list[ 'cdn' ] = __( 'CDN', 'litespeed-cache' ) ;
13
+ }
14
+
15
include_once LSWCP_DIR . "admin/tpl/inc/banner_promo.php" ;
16
?>
17
admin/tpl/manage/manage_cdn.php ADDED
@@ -0,0 +1,73 @@
1
+ <?php
2
+ if ( ! defined( 'WPINC' ) ) die ;
3
+
4
+ $cf_on = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE ) ;
5
+ $cf_domain = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE_NAME ) ?: '-' ;
6
+ $cf_zone = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE_ZONE ) ?: '-' ;
7
+
8
+ $curr_status = get_option( LiteSpeed_Cache_Config::ITEM_CLOUDFLARE_STATUS, array() ) ;
9
+
10
+ ?>
11
+ <h3 class="litespeed-title"><?php echo __('Cloudflare', 'litespeed-cache'); ?></h3>
12
+
13
+ <?php if ( ! $cf_on ) : ?>
14
+ <div class="litespeed-callout-danger">
15
+ <h4><?php echo __( 'WARNING', 'litespeed-cache' ) ; ?></h4>
16
+ <p>
17
+ <?php echo __('Please go to Settings to turn Cloudflare API on before use the following functionalities.', 'litespeed-cache'); ?>
18
+ </p>
19
+ </div>
20
+ <?php endif ; ?>
21
+
22
+ <p><?php echo __('Cloudflare Domain', 'litespeed-cache'); ?>: <code><?php echo $cf_domain ; ?></code></p>
23
+ <p><?php echo __('Cloudflare Zone', 'litespeed-cache'); ?>: <code><?php echo $cf_zone ; ?></code></p>
24
+
25
+ <p>
26
+ <b><?php echo __( 'Development Mode', 'litespeed-cache' ) ; ?>:</b>
27
+ <a href="<?php echo LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_CDN, LiteSpeed_Cache_CDN::TYPE_CLOUDFLARE_SET_DEVMODE_ON ) ; ?>" class="litespeed-btn-warning">
28
+ <?php echo __( 'Turn ON', 'litespeed-cache' ) ; ?>
29
+ </a>
30
+ <a href="<?php echo LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_CDN, LiteSpeed_Cache_CDN::TYPE_CLOUDFLARE_SET_DEVMODE_OFF ) ; ?>" class="litespeed-btn-warning">
31
+ <?php echo __( 'Turn OFF', 'litespeed-cache' ) ; ?>
32
+ </a>
33
+ <a href="<?php echo LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_CDN, LiteSpeed_Cache_CDN::TYPE_CLOUDFLARE_GET_DEVMODE ) ; ?>" class="litespeed-btn-success">
34
+ <?php echo __( 'Check Status', 'litespeed-cache' ) ; ?>
35
+ </a>
36
+
37
+ <?php if ( $curr_status ) : ?>
38
+ <span class="litespeed-desc">
39
+ <?php
40
+ if ( time() >= $curr_status[ 'devmode_expired' ] ) {
41
+ $expired_at = date( 'm/d/Y H:i:s', $curr_status[ 'devmode_expired' ] + LITESPEED_TIME_OFFSET ) ;
42
+ $curr_status[ 'devmode' ] = 'OFF' ;
43
+ echo sprintf( __( 'Current status is %1$s since %2$s.', 'litespeed-cache' ), '<code>' . strtoupper( $curr_status[ 'devmode' ] ) . '</code>', '<code>' . $expired_at . '</code>' ) ;
44
+ }
45
+ else {
46
+ $expired_at = $curr_status[ 'devmode_expired' ] - time() ;
47
+ $expired_at = LiteSpeed_Cache_Utility::readable_time( $expired_at, 3600 * 3, false ) ;
48
+ ?>
49
+ <?php echo sprintf( __( 'Current status is %s.', 'litespeed-cache' ), '<code>' . strtoupper( $curr_status[ 'devmode' ] ) . '</code>' ) ; ?>
50
+ <?php echo sprintf( __( 'Development mode will be automatically turned off in %s.', 'litespeed-cache' ), '<code>' . $expired_at . '</code>' ) ; ?>
51
+ <?php
52
+ }
53
+ ?>
54
+ </span>
55
+ <?php endif ; ?>
56
+
57
+ <p class="litespeed-desc">
58
+ <?php echo __( 'Temporarily bypass Cloudflare cache. This allows changes to the origin server to be seen in realtime.', 'litespeed-cache' ) ; ?>
59
+ <?php echo __( 'Development Mode will be turned off automatically after three hours.', 'litespeed-cache' ) ; ?>
60
+ <a href="https://support.cloudflare.com/hc/en-us/articles/200168246" target="_blank"><?php echo __('Learn More', 'litespeed-cache') ; ?></a>
61
+ </p>
62
+ </p>
63
+
64
+ <p>
65
+ <b><?php echo __( 'Cloudflare Cache', 'litespeed-cache' ) ; ?>:</b>
66
+ <?php if ( ! $cf_on ) : ?>
67
+ <a href="#" class="litespeed-btn-default disabled">
68
+ <?php else : ?>
69
+ <a href="<?php echo LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_CDN, LiteSpeed_Cache_CDN::TYPE_CLOUDFLARE_PURGE_ALL ) ; ?>" class="litespeed-btn-danger">
70
+ <?php endif ; ?>
71
+ <?php echo __( 'Purge Everything', 'litespeed-cache' ) ; ?>
72
+ </a>
73
+ </p>
admin/tpl/setting/network_settings_media.php CHANGED
File without changes
admin/tpl/setting/settings_advanced.php CHANGED
@@ -1,80 +1,152 @@
1
<?php
2
if (!defined('WPINC')) die;
3
4
?>
5
<div class="litespeed-callout-danger">
6
<h4><?php echo __('NOTICE:', 'litespeed-cache'); ?></h4>
7
- <ol>
8
- <li><?php echo __('These settings are meant for ADVANCED USERS ONLY.', 'litespeed-cache'); ?></li>
9
- <li><?php echo __('Please take great care when changing any of these settings.', 'litespeed-cache'); ?></li>
10
- <li><?php echo __('If there are any questions, do not hesitate to submit a support thread.', 'litespeed-cache'); ?></li>
11
- </ol>
12
</div>
13
14
- <h3 class="litespeed-title"><?php echo __('Check Advanced Cache', 'litespeed-cache'); ?></h3>
15
- <?php
16
- $id = LiteSpeed_Cache_Config::OPID_CHECK_ADVANCEDCACHE;
17
- $this->build_checkbox($id, __('Include advanced-cache.php', 'litespeed-cache'), $_options[$id]);
18
- ?>
19
- <p>
20
- <?php echo __('The advanced-cache.php file is used by many caching plugins to signal that a cache is active.', 'litespeed-cache'); ?>
21
- <?php echo __('When this option is checked and this file is detected as belonging to another plugin, LiteSpeed Cache will not cache.', 'litespeed-cache'); ?>
22
- </p>
23
- <p>
24
- <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>
25
- </p>
26
-
27
- <h3 class="litespeed-title"><?php echo __('Login Cookie', 'litespeed-cache'); ?></h3>
28
- <?php
29
30
- echo '<p>' . __('SYNTAX: alphanumeric and "_".', 'litespeed-cache')
31
- . ' ' . __('No spaces and case sensitive.', 'litespeed-cache')
32
- . ' ' . __('MUST BE UNIQUE FROM OTHER WEB APPLICATIONS.', 'litespeed-cache')
33
- . '</p>'
34
- . '<p>'
35
- . sprintf(__('The default login cookie is %s.', 'litespeed-cache'), '_lscache_vary')
36
- . ' ' . __('The server will determine if the user is logged in based on the existance of this cookie.', 'litespeed-cache')
37
- . ' ' . __('This setting is useful for those that have multiple web applications for the same domain.', 'litespeed-cache')
38
- . ' ' . __('If every web application uses the same cookie, the server may confuse whether a user is logged in or not.', 'litespeed-cache')
39
- . ' ' . __('The cookie set here will be used for this WordPress installation.', 'litespeed-cache')
40
- . '</p>'
41
- . '<p>'
42
- . __('Example use case:', 'litespeed-cache')
43
- . '<br />'
44
- . sprintf(__('There is a WordPress installed for %s.', 'litespeed-cache'), '<u>www.example.com</u>')
45
- . '<br />'
46
- . sprintf(__('Then another WordPress is installed (NOT MULTISITE) at %s', 'litespeed-cache'), '<u>www.example.com/blog/</u>')
47
- . ' ' . __('The cache needs to distinguish who is logged into which WordPress site in order to cache correctly.', 'litespeed-cache')
48
- . '</p>';
49
-
50
- $cookie_rule = LiteSpeed_Cache_Admin_Rules::get_instance()->get_rewrite_rule_login_cookie();
51
- if ( $cookie_rule && substr($cookie_rule, 0, 11) !== 'Cache-Vary:' ){
52
- echo '<div class="litespeed-callout-danger">'
53
- . sprintf(__('Error: invalid login cookie. Please check the %s file', 'litespeed-cache'), '.htaccess')
54
- . '</div>';
55
- }
56
-
57
- $id = LiteSpeed_Cache_Config::OPID_LOGIN_COOKIE;
58
- if ( defined( 'LITESPEED_ON' ) && $_options[$id] ){
59
-
60
- if (!$cookie_rule){
61
- echo '<div class="litespeed-callout-danger">'
62
- . sprintf(__('Error getting current rules from %s: %s', 'litespeed-cache'), '.htaccess', LiteSpeed_Cache_Admin_Rules::MARKER_LOGIN_COOKIE)
63
- . '</div>';
64
- }
65
- else{
66
- $cookie_rule = substr($cookie_rule, 11);
67
- $cookie_arr = explode(',', $cookie_rule);
68
- if(!in_array($_options[$id], $cookie_arr)) {
69
- echo '<div class="litespeed-callout-warning">' .
70
- __( 'WARNING: The .htaccess login cookie and Database login cookie do not match.', 'litespeed-cache' ) .
71
- '</div>';
72
- }
73
- }
74
-
75
- }
76
-
77
- $file_writable = LiteSpeed_Cache_Admin_Rules::writable();
78
- $this->build_input($id, 'litespeed-input-long');// , !$file_writable
79
80
1
<?php
2
if (!defined('WPINC')) die;
3
4
+ // $current_favicon = get_option( LiteSpeed_Cache_Config::ITEM_FAVICON, array() ) ;
5
+
6
?>
7
+ <h3 class="litespeed-title"><?php echo __( 'Advanced', 'litespeed-cache' ) ; ?></h3>
8
+
9
<div class="litespeed-callout-danger">
10
<h4><?php echo __('NOTICE:', 'litespeed-cache'); ?></h4>
11
+ <?php echo __('These settings are meant for ADVANCED USERS ONLY.', 'litespeed-cache'); ?>
12
</div>
13
14
+ <table><tbody>
15
+ <tr>
16
+ <th><?php echo __( 'Check Advanced Cache', 'litespeed-cache' ) ; ?></th>
17
+ <td>
18
+ <?php
19
+ $id = LiteSpeed_Cache_Config::OPID_CHECK_ADVANCEDCACHE;
20
+ $this->build_checkbox($id, __('Include advanced-cache.php', 'litespeed-cache'), $_options[$id]);
21
+ ?>
22
+ <div class="litespeed-desc">
23
+ <?php echo __('The advanced-cache.php file is used by many caching plugins to signal that a cache is active.', 'litespeed-cache'); ?>
24
+ <?php echo __('When this option is checked and this file is detected as belonging to another plugin, LiteSpeed Cache will not cache.', 'litespeed-cache'); ?>
25
+ </div>
26
+ <p>
27
+ <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>
28
+ </p>
29
+
30
+ </td>
31
+ </tr>
32
+
33
+ <tr>
34
+ <th><?php echo __( 'Login Cookie', 'litespeed-cache' ) ; ?></th>
35
+ <td>
36
+ <?php
37
+ $id = LiteSpeed_Cache_Config::OPID_LOGIN_COOKIE;
38
+ $this->build_input( $id ) ;
39
+
40
+ echo '<p>' . __('SYNTAX: alphanumeric and "_".', 'litespeed-cache')
41
+ . ' ' . __('No spaces and case sensitive.', 'litespeed-cache')
42
+ . ' ' . __('MUST BE UNIQUE FROM OTHER WEB APPLICATIONS.', 'litespeed-cache')
43
+ . '</p>'
44
+ . '<p>'
45
+ . sprintf(__('The default login cookie is %s.', 'litespeed-cache'), '_lscache_vary')
46
+ . ' ' . __('The server will determine if the user is logged in based on the existance of this cookie.', 'litespeed-cache')
47
+ . ' ' . __('This setting is useful for those that have multiple web applications for the same domain.', 'litespeed-cache')
48
+ . ' ' . __('If every web application uses the same cookie, the server may confuse whether a user is logged in or not.', 'litespeed-cache')
49
+ . ' ' . __('The cookie set here will be used for this WordPress installation.', 'litespeed-cache')
50
+ . '</p>'
51
+ . '<p>'
52
+ . __('Example use case:', 'litespeed-cache')
53
+ . '<br />'
54
+ . sprintf(__('There is a WordPress installed for %s.', 'litespeed-cache'), '<u>www.example.com</u>')
55
+ . '<br />'
56
+ . sprintf(__('Then another WordPress is installed (NOT MULTISITE) at %s', 'litespeed-cache'), '<u>www.example.com/blog/</u>')
57
+ . ' ' . __('The cache needs to distinguish who is logged into which WordPress site in order to cache correctly.', 'litespeed-cache')
58
+ . '</p>';
59
+
60
+ $cookie_rule = LiteSpeed_Cache_Admin_Rules::get_instance()->get_rewrite_rule_login_cookie();
61
+ if ( $cookie_rule && substr($cookie_rule, 0, 11) !== 'Cache-Vary:' ){
62
+ echo '<div class="litespeed-callout-danger">'
63
+ . sprintf(__('Error: invalid login cookie. Please check the %s file', 'litespeed-cache'), '.htaccess')
64
+ . '</div>';
65
+ }
66
+
67
+ if ( defined( 'LITESPEED_ON' ) && $_options[$id] ){
68
+
69
+ if (!$cookie_rule){
70
+ echo '<div class="litespeed-callout-danger">'
71
+ . sprintf(__('Error getting current rules from %s: %s', 'litespeed-cache'), '.htaccess', LiteSpeed_Cache_Admin_Rules::MARKER_LOGIN_COOKIE)
72
+ . '</div>';
73
+ }
74
+ else{
75
+ $cookie_rule = substr($cookie_rule, 11);
76
+ $cookie_arr = explode(',', $cookie_rule);
77
+ if(!in_array($_options[$id], $cookie_arr)) {
78
+ echo '<div class="litespeed-callout-warning">' .
79
+ __( 'WARNING: The .htaccess login cookie and Database login cookie do not match.', 'litespeed-cache' ) .
80
+ '</div>';
81
+ }
82
+ }
83
+
84
+ }
85
+
86
+ ?>
87
+ </td>
88
+ </tr>
89
+
90
+ <tr>
91
+ <th><?php echo __( 'Improve HTTP/HTTPS Compatibility', 'litespeed-cache' ) ; ?></th>
92
+ <td>
93
+ <?php $this->build_switch( LiteSpeed_Cache_Config::OPID_USE_HTTP_FOR_HTTPS_VARY ) ; ?>
94
+ <div class="litespeed-desc">
95
+ <?php echo __( 'Enable this option if you are using both HTTP and HTTPS in the same domain and are noticing cache irregularities.', 'litespeed-cache' ) ; ?>
96
+ <a href="https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp:configuration:advanced#improve_http_https_compatibility" target="_blank"><?php echo __('Learn More', 'litespeed-cache') ; ?></a>
97
+
98
+ </div>
99
+ </td>
100
+ </tr>
101
+
102
+ <?php /*
103
+ <tr>
104
+ <th><?php echo __( 'Favicon', 'litespeed-cache' ) ; ?></th>
105
+ <td>
106
+ <?php $this->build_switch( LiteSpeed_Cache_Config::OPID_ADV_FAVICON ) ; ?>
107
+ <div class="litespeed-desc">
108
+ <?php echo __( 'Enable this option to use uploaded image as favicon.ico.', 'litespeed-cache' ) ; ?>
109
+ <a href="https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp:configuration:advanced#favicon" target="_blank"><?php echo __('Learn More', 'litespeed-cache') ; ?></a>
110
+
111
+ </div>
112
+ <div class="litespeed-cdn-mapping-block">
113
+ <div class='litespeed-cdn-mapping-col1'>
114
+ <h4><?php echo __( 'Frontend Favicon File', 'litespeed-cache' ) ; ?></h4>
115
+
116
+ <input type="file" name="litespeed-file-favicon_frontend" class="litespeed-input-long">
117
+ <div class="litespeed-desc">
118
+ <a href="https://favicon.io/converter?hello=litespeed" target="_blank"><?php echo __( 'A sample online favicon generator.', 'litespeed-cache' ) ; ?></a>
119
+ </div>
120
+ </div>
121
+
122
+ <div class='litespeed-cdn-mapping-col litespeed-abs-center'>
123
+ <?php
124
+ if ( ! empty( $current_favicon[ 'frontend' ] ) ) {
125
+ echo "
126
+ <img src='$current_favicon[frontend]' style='max-height:200px;max-width:200px;' />
127
+ ";
128
+ }
129
+ ?>
130
+ </div>
131
+ <div class='litespeed-cdn-mapping-col1'>
132
+ <h4><?php echo __( 'Backend Favicon File', 'litespeed-cache' ) ; ?></h4>
133
+
134
+ <input type="file" name="litespeed-file-favicon_backend" class="litespeed-input-long">
135
+ </div>
136
137
+ <div class='litespeed-cdn-mapping-col litespeed-abs-center'>
138
+ <?php
139
+ if ( ! empty( $current_favicon[ 'backend' ] ) ) {
140
+ echo "
141
+ <img src='$current_favicon[backend]' style='max-height:200px;max-width:200px;' />
142
+ ";
143
+ }
144
+ ?>
145
+ </div>
146
+ </div>
147
148
+ </td>
149
+ </tr>
150
+ */ ?>
151
152
+ </tbody></table>
admin/tpl/setting/settings_cache.php CHANGED
@@ -76,5 +76,22 @@ if ( ! defined( 'WPINC' ) ) die ;
76
endif ;
77
?>
78
79
</tbody></table>
80
76
endif ;
77
?>
78
79
+ <tr>
80
+ <th><?php echo __( 'Drop Query String', 'litespeed-cache' ) ; ?></th>
81
+ <td>
82
+ <?php $this->build_textarea2( LiteSpeed_Cache_Config::ITEM_CACHE_DROP_QS, 40 ) ; ?>
83
+ <div class="litespeed-desc">
84
+ <?php echo __('Ignore certain query strings when caching.', 'litespeed-cache'); ?>
85
+ <?php echo sprintf( __( 'For example, to drop parameters beginning with %s, %s can be used here.', 'litespeed-cache' ), '<code>utm</code>', '<code>utm*</code>' ) ; ?>
86
+ <a href="https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:drop_query_string" target="_blank"><?php echo __('Learn More', 'litespeed-cache') ; ?></a>
87
+
88
+ <br />
89
+ <i>
90
+ <?php echo __('One per line.', 'litespeed-cache'); ?>
91
+ </i>
92
+ </div>
93
+ </td>
94
+ </tr>
95
+
96
</tbody></table>
97
admin/tpl/setting/settings_cdn.php CHANGED
@@ -6,6 +6,18 @@ $parsed = parse_url( $home_url ) ;
6
$home_url = str_replace( $parsed[ 'scheme' ] . ':', '', $home_url ) ;
7
$cdn_url = 'https://cdn.' . substr( $home_url, 2 ) ;
8
9
?>
10
11
<h3 class="litespeed-title"><?php echo __( 'CDN Settings', 'litespeed-cache' ) ; ?></h3>
@@ -22,71 +34,97 @@ $cdn_url = 'https://cdn.' . substr( $home_url, 2 ) ;
22
</tr>
23
24
<tr>
25
- <th><?php echo __( 'CDN URL', 'litespeed-cache' ) ; ?></th>
26
<td>
27
- <?php $this->build_input( LiteSpeed_Cache_Config::OPID_CDN_URL, 'litespeed-input-long' ) ; ?>
28
- <div class="litespeed-desc">
29
- <?php echo sprintf( __( 'CDN URL to be used. For example, %s', 'litespeed-cache' ), '<code>' . $cdn_url . '</code>' ) ; ?>
30
</div>
31
- </td>
32
- </tr>
33
34
- <tr>
35
- <th><?php echo __( 'Original URL', 'litespeed-cache' ) ; ?></th>
36
- <td>
37
- <?php $this->build_input( LiteSpeed_Cache_Config::OPID_CDN_ORI, 'litespeed-input-long' ) ; ?>
38
- <div class="litespeed-desc">
39
- <?php echo sprintf( __( 'Site URL to be served through the CDN. Beginning with %1$s. For example, %2$s.', 'litespeed-cache' ), '<code>//</code>', '<code>' . $home_url . '</code>' ) ; ?>
40
- <br /><?php echo sprintf( __( 'Wildcard %1$s supported (match zero or more characters). For example, to match %2$s and %3$s, use %4$s.', 'litespeed-cache' ), '<code>*</code>', '<code>//www.aa.com</code>', '<code>//aa.com</code>', '<code>//*aa.com</code>' ) ; ?>
41
</div>
42
- </td>
43
- </tr>
44
45
- <tr>
46
- <th><?php echo __( 'Include Images', 'litespeed-cache' ) ; ?></th>
47
- <td>
48
- <?php $this->build_switch( LiteSpeed_Cache_Config::OPID_CDN_INC_IMG ) ; ?>
49
<div class="litespeed-desc">
50
<?php echo sprintf( __( 'Serve all image files through the CDN. This will affect all attachments, HTML %s tags, and CSS %s attributes.', 'litespeed-cache' ), '<code>&lt;img</code>', '<code>url()</code>' ) ; ?>
51
- </div>
52
- </td>
53
- </tr>
54
55
- <tr>
56
- <th><?php echo __( 'Include CSS', 'litespeed-cache' ) ; ?></th>
57
- <td>
58
- <?php $this->build_switch( LiteSpeed_Cache_Config::OPID_CDN_INC_CSS ) ; ?>
59
- <div class="litespeed-desc">
60
<?php echo __( 'Serve all CSS files through the CDN. This will affect all enqueued WP CSS files.', 'litespeed-cache' ) ; ?>
61
- </div>
62
- </td>
63
- </tr>
64
65
- <tr>
66
- <th><?php echo __( 'Include JS', 'litespeed-cache' ) ; ?></th>
67
- <td>
68
- <?php $this->build_switch( LiteSpeed_Cache_Config::OPID_CDN_INC_JS ) ; ?>
69
- <div class="litespeed-desc">
70
<?php echo __( 'Serve all JavaScript files through the CDN. This will affect all enqueued WP JavaScript files.', 'litespeed-cache' ) ; ?>
71
</div>
72
</td>
73
</tr>
74
75
<tr>
76
- <th><?php echo __( 'Include File Types', 'litespeed-cache' ) ; ?></th>
77
<td>
78
- <div style="float:left; margin-right: 125px;">
79
- <?php $id = LiteSpeed_Cache_Config::OPID_CDN_FILETYPE ; ?>
80
- <?php $this->build_textarea( $id, null, false, 30 ) ; ?>
81
- <div class="litespeed-desc">
82
- <?php echo __( 'Static file type links to be replaced by CDN links. One per line.', 'litespeed-cache' ) ; ?>
83
- <br /><?php echo sprintf( __( 'This will affect all tags containing attributes: %s %s %s.', 'litespeed-cache' ), '<code>src=""</code>', '<code>data-src=""</code>', '<code>href=""</code>' ) ; ?>
84
- </div>
85
- </div>
86
- <div style="float:left; display:flex;">
87
- <div style="display: flex; margin-right: 50px;">
88
- <?php $this->recommended($id) ; ?>
89
- </div>
90
</div>
91
</td>
92
</tr>
@@ -122,7 +160,7 @@ $cdn_url = 'https://cdn.' . substr( $home_url, 2 ) ;
122
<?php echo $this->build_radio(
123
LiteSpeed_Cache_Config::OPID_CDN_REMOTE_JQUERY,
124
LiteSpeed_Cache_Config::VAL_ON2,
125
- __( 'cdnjs', 'litespeed-cache' )
126
) ; ?>
127
</div>
128
<div class="litespeed-desc">
@@ -131,4 +169,49 @@ $cdn_url = 'https://cdn.' . substr( $home_url, 2 ) ;
131
</td>
132
</tr>
133
134
</tbody></table>
6
$home_url = str_replace( $parsed[ 'scheme' ] . ':', '', $home_url ) ;
7
$cdn_url = 'https://cdn.' . substr( $home_url, 2 ) ;
8
9
+ $cdn_mapping = get_option( LiteSpeed_Cache_Config::ITEM_CDN_MAPPING, array() ) ;
10
+ if ( ! $cdn_mapping ) {
11
+ // generate one by default
12
+ $cdn_mapping = array( array(
13
+ LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_URL => '',
14
+ LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_INC_IMG => false,
15
+ LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_INC_CSS => false,
16
+ LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_INC_JS => false,
17
+ LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_FILETYPE => ".aac\n.css\n.eot\n.gif\n.jpeg\n.js\n.jpg\n.less\n.mp3\n.mp4\n.ogg\n.otf\n.pdf\n.png\n.svg\n.ttf\n.woff",
18
+ ) ) ;
19
+ }
20
+
21
?>
22
23
<h3 class="litespeed-title"><?php echo __( 'CDN Settings', 'litespeed-cache' ) ; ?></h3>
34
</tr>
35
36
<tr>
37
+ <th><?php echo __( 'CDN Mapping', 'litespeed-cache' ) ; ?></th>
38
<td>
39
+ <?php foreach ( $cdn_mapping as $v ) : ?>
40
+
41
+ <div class="litespeed-cdn-mapping-block" data-litespeed-cdn-mapping="1">
42
+ <div class='litespeed-cdn-mapping-col1'>
43
+ <h4><?php echo __( 'CDN URL', 'litespeed-cache' ) ; ?>
44
+ <button type="button" class="litespeed-btn-danger" data-litespeed-cdn-mapping-del="1">X</button>
45
+ </h4>
46
+
47
+ <?php
48
+ $id = LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_URL ;
49
+ $this->build_input( "[" . LiteSpeed_Cache_Config::ITEM_CDN_MAPPING . "][$id][]", 'litespeed-input-long', $v[ $id ] ) ;
50
+ ?>
51
+ <div class="litespeed-desc">
52
+ <?php echo sprintf( __( 'CDN URL to be used. For example, %s', 'litespeed-cache' ), '<code>' . $cdn_url . '</code>' ) ; ?>
53
+ </div>
54
+ </div>
55
+
56
+ <div class='litespeed-cdn-mapping-col2'>
57
+ <div class="litespeed-row">
58
+ <div class="litespeed-cdn-mapping-inc"><?php echo __( 'Include Images', 'litespeed-cache' ) ; ?></div>
59
+ <?php
60
+ $id = LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_INC_IMG ;
61
+ $this->build_toggle( "[" . LiteSpeed_Cache_Config::ITEM_CDN_MAPPING . "][$id][]", ! empty( $v[ $id ] ) ? true : false ) ;
62
+ ?>
63
+ </div>
64
+ <div class="litespeed-row">
65
+ <div class="litespeed-cdn-mapping-inc"><?php echo __( 'Include CSS', 'litespeed-cache' ) ; ?></div>
66
+ <?php
67
+ $id = LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_INC_CSS ;
68
+ $this->build_toggle( "[" . LiteSpeed_Cache_Config::ITEM_CDN_MAPPING . "][$id][]", ! empty( $v[ $id ] ) ? true : false ) ;
69
+ ?>
70
+ </div>
71
+ <div class="litespeed-row">
72
+ <div class="litespeed-cdn-mapping-inc"><?php echo __( 'Include JS', 'litespeed-cache' ) ; ?></div>
73
+ <?php
74
+ $id = LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_INC_JS ;
75
+ $this->build_toggle( "[" . LiteSpeed_Cache_Config::ITEM_CDN_MAPPING . "][$id][]", ! empty( $v[ $id ] ) ? true : false ) ;
76
+ ?>
77
+ </div>
78
+ </div>
79
+
80
+ <div class='litespeed-cdn-mapping-col3'>
81
+ <div class="litespeed-row">
82
+ <div class="litespeed-cdn-mapping-col3-title"><?php echo __( 'Include File Types', 'litespeed-cache' ) ; ?></div>
83
+ <?php $id = LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_FILETYPE ; ?>
84
+ <?php $this->build_textarea( "[" . LiteSpeed_Cache_Config::ITEM_CDN_MAPPING . "][$id][]", 17, $v[ $id ] ) ; ?>
85
+ </div>
86
+ </div>
87
</div>
88
89
+ <?php endforeach ; ?>
90
+
91
+ <p><button type="button" class="litespeed-btn-success litespeed-btn-tiny" id="litespeed-cdn-mapping-add">+</button></p>
92
+
93
+ <div class="litespeed-warning">
94
+ <?php echo __('NOTE:', 'litespeed-cache'); ?>
95
+ <?php echo __( 'If multiple CDN paths are configured with the same settings, the last one will override the others.', 'litespeed-cache' ) ; ?>
96
</div>
97
98
<div class="litespeed-desc">
99
+ <b><?php echo __( 'Include Images', 'litespeed-cache' ) ; ?></b>:
100
<?php echo sprintf( __( 'Serve all image files through the CDN. This will affect all attachments, HTML %s tags, and CSS %s attributes.', 'litespeed-cache' ), '<code>&lt;img</code>', '<code>url()</code>' ) ; ?>
101
102
+ <br />
103
+ <b><?php echo __( 'Include CSS', 'litespeed-cache' ) ; ?></b>:
104
<?php echo __( 'Serve all CSS files through the CDN. This will affect all enqueued WP CSS files.', 'litespeed-cache' ) ; ?>
105
106
+ <br />
107
+ <b><?php echo __( 'Include JS', 'litespeed-cache' ) ; ?></b>:
108
<?php echo __( 'Serve all JavaScript files through the CDN. This will affect all enqueued WP JavaScript files.', 'litespeed-cache' ) ; ?>
109
+
110
+ <br />
111
+ <b><?php echo __( 'Include File Types', 'litespeed-cache' ) ; ?></b>:
112
+ <?php echo __( 'Static file type links to be replaced by CDN links.', 'litespeed-cache' ) ; ?>
113
+ <?php echo __('One per line.', 'litespeed-cache'); ?>
114
+ <?php echo sprintf( __( 'This will affect all tags containing attributes: %s %s %s.', 'litespeed-cache' ), '<code>src=""</code>', '<code>data-src=""</code>', '<code>href=""</code>' ) ; ?>
115
+ <a href="https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp:configuration:cdn#include_file_types" target="_blank"><?php echo __('Default value', 'litespeed-cache') ; ?></a>
116
</div>
117
+
118
</td>
119
</tr>
120
121
<tr>
122
+ <th><?php echo __( 'Original URL', 'litespeed-cache' ) ; ?></th>
123
<td>
124
+ <?php $this->build_input( LiteSpeed_Cache_Config::OPID_CDN_ORI, 'litespeed-input-long' ) ; ?>
125
+ <div class="litespeed-desc">
126
+ <?php echo sprintf( __( 'Site URL to be served through the CDN. Beginning with %1$s. For example, %2$s.', 'litespeed-cache' ), '<code>//</code>', '<code>' . $home_url . '</code>' ) ; ?>
127
+ <br /><?php echo sprintf( __( 'Wildcard %1$s supported (match zero or more characters). For example, to match %2$s and %3$s, use %4$s.', 'litespeed-cache' ), '<code>*</code>', '<code>//www.aa.com</code>', '<code>//aa.com</code>', '<code>//*aa.com</code>' ) ; ?>
128
</div>
129
</td>
130
</tr>
160
<?php echo $this->build_radio(
161
LiteSpeed_Cache_Config::OPID_CDN_REMOTE_JQUERY,
162
LiteSpeed_Cache_Config::VAL_ON2,
163
+ __( 'Cdnjs', 'litespeed-cache' )
164
) ; ?>
165
</div>
166
<div class="litespeed-desc">
169
</td>
170
</tr>
171
172
+ <tr>
173
+ <th><?php echo __( 'Cloudflare API', 'litespeed-cache' ) ; ?></th>
174
+ <td>
175
+ <?php $this->build_switch( LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE ) ; ?>
176
+ <div class="litespeed-desc">
177
+ <?php echo __( 'Use Cloudflare API functionality.', 'litespeed-cache' ) ; ?>
178
+ <?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"' ) ; ?>
179
+ </div>
180
+ <div class="litespeed-cdn-mapping-block">
181
+ <div class='litespeed-child-col'>
182
+ <h4><?php echo __( 'Email Address', 'litespeed-cache' ) ; ?></h4>
183
+
184
+ <?php $this->build_input( LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE_EMAIL ) ; ?>
185
+ <div class="litespeed-desc">
186
+ <?php echo __( 'Your Email address on Cloudflare.', 'litespeed-cache' ) ; ?>
187
+ </div>
188
+ </div>
189
+
190
+ <div class='litespeed-child-col'>
191
+ <h4><?php echo __( 'Global API Key', 'litespeed-cache' ) ; ?></h4>
192
+
193
+ <?php $this->build_input( LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE_KEY ) ; ?>
194
+ <div class="litespeed-desc">
195
+ <?php echo __( 'Your API key is used to access Cloudflare APIs.', 'litespeed-cache' ) ; ?>
196
+ <?php echo sprintf( __( 'Get it from <a %s>Cloudflare account</a>.', 'litespeed-cache' ), 'href="https://www.cloudflare.com/a/profile" target="_blank"' ) ; ?>
197
+ </div>
198
+ </div>
199
+
200
+ <div class='litespeed-child-col'>
201
+ <h4><?php echo __( 'Domain', 'litespeed-cache' ) ; ?></h4>
202
+
203
+ <?php
204
+ $cf_zone = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE_ZONE ) ;
205
+ $cls = $cf_zone ? ' litespeed-input-success' : ' litespeed-input-warning' ;
206
+ $this->build_input( LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE_NAME, $cls ) ;
207
+ ?>
208
+ <div class="litespeed-desc">
209
+ <?php echo __( 'You can just type part of the domain.', 'litespeed-cache' ) ; ?>
210
+ <?php echo __( 'Once saved, it will be matched with the current list and completed automatically.', 'litespeed-cache' ) ; ?>
211
+ </div>
212
+ </div>
213
+ </div>
214
+ </td>
215
+ </tr>
216
+
217
</tbody></table>
admin/tpl/setting/settings_crawler.php CHANGED
@@ -94,7 +94,7 @@ if ( !defined('WPINC') ) die;
94
<th><?php echo __('Custom Sitemap', 'litespeed-cache'); ?></th>
95
<td>
96
<?php $id = LiteSpeed_Cache_Config::CRWL_CUSTOM_SITEMAP ; ?>
97
- <?php $this->build_input($id, false, false, false, 'litespeed_custom_sitemap'); ?>
98
<div class="litespeed-desc">
99
<?php echo __('The crawler can use your Google XML Sitemap instead of its own. Enter the full URL to your sitemap here.', 'litespeed-cache'); ?>
100
</div>
94
<th><?php echo __('Custom Sitemap', 'litespeed-cache'); ?></th>
95
<td>
96
<?php $id = LiteSpeed_Cache_Config::CRWL_CUSTOM_SITEMAP ; ?>
97
+ <?php $this->build_input($id, false, null, 'litespeed_custom_sitemap'); ?>
98
<div class="litespeed-desc">
99
<?php echo __('The crawler can use your Google XML Sitemap instead of its own. Enter the full URL to your sitemap here.', 'litespeed-cache'); ?>
100
</div>
admin/tpl/setting/settings_debug.php CHANGED
@@ -40,7 +40,7 @@ if ( ! defined( 'WPINC' ) ) die ;
40
<tr>
41
<th><?php echo __( 'Admin IPs', 'litespeed-cache' ) ; ?></th>
42
<td>
43
- <?php $this->build_textarea( LiteSpeed_Cache_Config::OPID_ADMIN_IPS, null, false, 30 ) ; ?>
44
<div class="litespeed-desc">
45
<?php echo __( 'Allows listed IPs (one per line) to perform certain actions from their browsers.', 'litespeed-cache' ) ; ?><br />
46
<?php echo sprintf( __( 'More information about the available commands can be found <a %s>here</a>.', 'litespeed-cache' ),
@@ -126,7 +126,7 @@ if ( ! defined( 'WPINC' ) ) die ;
126
<tr>
127
<th><?php echo __( 'Exclude Filters', 'litespeed-cache' ) ; ?></th>
128
<td>
129
- <?php $this->build_textarea( LiteSpeed_Cache_Config::OPID_LOG_IGNORE_FILTERS, null, false, 30 ) ; ?>
130
<div class="litespeed-desc">
131
<?php echo __( 'Listed filters (one per line) will not be logged.', 'litespeed-cache' ) ; ?><br />
132
</div>
@@ -136,7 +136,7 @@ if ( ! defined( 'WPINC' ) ) die ;
136
<tr>
137
<th><?php echo __( 'Exclude Part Filters', 'litespeed-cache' ) ; ?></th>
138
<td>
139
- <?php $this->build_textarea( LiteSpeed_Cache_Config::OPID_LOG_IGNORE_PART_FILTERS, null, false, 30 ) ; ?>
140
<div class="litespeed-desc">
141
<?php echo __( 'Filters containing these strings (one per line) will not be logged.', 'litespeed-cache' ) ; ?><br />
142
</div>
40
<tr>
41
<th><?php echo __( 'Admin IPs', 'litespeed-cache' ) ; ?></th>
42
<td>
43
+ <?php $this->build_textarea( LiteSpeed_Cache_Config::OPID_ADMIN_IPS, 30 ) ; ?>
44
<div class="litespeed-desc">
45
<?php echo __( 'Allows listed IPs (one per line) to perform certain actions from their browsers.', 'litespeed-cache' ) ; ?><br />
46
<?php echo sprintf( __( 'More information about the available commands can be found <a %s>here</a>.', 'litespeed-cache' ),
126
<tr>
127
<th><?php echo __( 'Exclude Filters', 'litespeed-cache' ) ; ?></th>
128
<td>
129
+ <?php $this->build_textarea( LiteSpeed_Cache_Config::OPID_LOG_IGNORE_FILTERS, 30 ) ; ?>
130
<div class="litespeed-desc">
131
<?php echo __( 'Listed filters (one per line) will not be logged.', 'litespeed-cache' ) ; ?><br />
132
</div>
136
<tr>
137
<th><?php echo __( 'Exclude Part Filters', 'litespeed-cache' ) ; ?></th>
138
<td>
139
+ <?php $this->build_textarea( LiteSpeed_Cache_Config::OPID_LOG_IGNORE_PART_FILTERS, 30 ) ; ?>
140
<div class="litespeed-desc">
141
<?php echo __( 'Filters containing these strings (one per line) will not be logged.', 'litespeed-cache' ) ; ?><br />
142
</div>
admin/tpl/setting/settings_excludes.php CHANGED
@@ -47,7 +47,7 @@ if ( ! defined( 'WPINC' ) ) die ;
47
$id_list = explode(',', $cat_ids);
48
$excludes_buf = implode("\n", array_map('get_cat_name', $id_list));
49
}
50
- $this->build_textarea($id, $excludes_buf);
51
?>
52
<div class="litespeed-desc">
53
<b><?php echo __('All categories are cached by default.', 'litespeed-cache'); ?></b>
@@ -85,7 +85,7 @@ if ( ! defined( 'WPINC' ) ) die ;
85
$excludes_buf = implode("\n", $tag_names);
86
}
87
}
88
- $this->build_textarea($id, $excludes_buf);
89
?>
90
<div class="litespeed-desc">
91
<b><?php echo __('All tags are cached by default.', 'litespeed-cache'); ?></b>
47
$id_list = explode(',', $cat_ids);
48
$excludes_buf = implode("\n", array_map('get_cat_name', $id_list));
49
}
50
+ $this->build_textarea($id, false, $excludes_buf);
51
?>
52
<div class="litespeed-desc">
53
<b><?php echo __('All categories are cached by default.', 'litespeed-cache'); ?></b>
85
$excludes_buf = implode("\n", $tag_names);
86
}
87
}
88
+ $this->build_textarea($id, false, $excludes_buf);
89
?>
90
<div class="litespeed-desc">
91
<b><?php echo __('All tags are cached by default.', 'litespeed-cache'); ?></b>
admin/tpl/setting/settings_inc.cache_favicon.php CHANGED
@@ -1,12 +1,11 @@
1
<?php
2
if (!defined('WPINC')) die;
3
4
- $file_writable = LiteSpeed_Cache_Admin_Rules::writable();
5
?>
6
<tr>
7
<th><?php echo __('Cache favicon.ico', 'litespeed-cache'); ?></th>
8
<td>
9
- <?php $this->build_switch(LiteSpeed_Cache_Config::OPID_CACHE_FAVICON);/*, !$file_writable*/ ?>
10
<div class="litespeed-desc">
11
<?php echo __('favicon.ico is requested on most pages.', 'litespeed-cache'); ?>
12
<?php echo __('Caching this resource may improve server performance by avoiding unnecessary PHP calls.', 'litespeed-cache'); ?>
1
<?php
2
if (!defined('WPINC')) die;
3
4
?>
5
<tr>
6
<th><?php echo __('Cache favicon.ico', 'litespeed-cache'); ?></th>
7
<td>
8
+ <?php $this->build_switch(LiteSpeed_Cache_Config::OPID_CACHE_FAVICON); ?>
9
<div class="litespeed-desc">
10
<?php echo __('favicon.ico is requested on most pages.', 'litespeed-cache'); ?>
11
<?php echo __('Caching this resource may improve server performance by avoiding unnecessary PHP calls.', 'litespeed-cache'); ?>
admin/tpl/setting/settings_inc.cache_mobile.php CHANGED
@@ -8,8 +8,7 @@ if (!defined('WPINC')) die;
8
<th><?php echo __('Cache Mobile', 'litespeed-cache'); ?></th>
9
<td>
10
<?php
11
- $file_writable = LiteSpeed_Cache_Admin_Rules::writable();
12
- $this->build_switch(LiteSpeed_Cache_Config::OPID_CACHE_MOBILE); //, !$file_writable
13
?>
14
<div class="litespeed-desc">
15
<?php echo __('When enabled, mobile views will be cached separately.', 'litespeed-cache'); ?>
@@ -48,7 +47,7 @@ if (!defined('WPINC')) die;
48
}
49
}
50
51
- $this->build_input( $id, 'litespeed-input-long', false, ! $_options[ LiteSpeed_Cache_Config::OPID_CACHE_MOBILE ], 'litespeed-mobileview-rules' ) ;
52
?>
53
54
<input type="hidden" name="<?php echo LiteSpeed_Cache_Config::OPTION_NAME; ?>[<?php echo $id; ?>__default]"
8
<th><?php echo __('Cache Mobile', 'litespeed-cache'); ?></th>
9
<td>
10
<?php
11
+ $this->build_switch(LiteSpeed_Cache_Config::OPID_CACHE_MOBILE);
12
?>
13
<div class="litespeed-desc">
14
<?php echo __('When enabled, mobile views will be cached separately.', 'litespeed-cache'); ?>
47
}
48
}
49
50
+ $this->build_input( $id, 'litespeed-input-long', null, 'litespeed-mobileview-rules', '', 'text', ! $_options[ LiteSpeed_Cache_Config::OPID_CACHE_MOBILE ] ) ;
51
?>
52
53
<input type="hidden" name="<?php echo LiteSpeed_Cache_Config::OPTION_NAME; ?>[<?php echo $id; ?>__default]"
admin/tpl/setting/settings_inc.cache_resources.php CHANGED
@@ -1,13 +1,12 @@
1
<?php
2
if (!defined('WPINC')) die;
3
4
- $file_writable = LiteSpeed_Cache_Admin_Rules::writable();
5
?>
6
<!-- build_setting_cache_resources -->
7
<tr>
8
<th><?php echo __('Cache PHP Resources', 'litespeed-cache'); ?></th>
9
<td>
10
- <?php $this->build_switch(LiteSpeed_Cache_Config::OPID_CACHE_RES);/*, !$file_writable*/ ?>
11
<div class="litespeed-desc">
12
<?php echo __('Some themes and plugins add resources via a PHP request.', 'litespeed-cache'); ?>
13
<?php echo __('Caching these pages may improve server performance by avoiding unnecessary PHP calls.', 'litespeed-cache'); ?>
1
<?php
2
if (!defined('WPINC')) die;
3
4
?>
5
<!-- build_setting_cache_resources -->
6
<tr>
7
<th><?php echo __('Cache PHP Resources', 'litespeed-cache'); ?></th>
8
<td>
9
+ <?php $this->build_switch(LiteSpeed_Cache_Config::OPID_CACHE_RES); ?>
10
<div class="litespeed-desc">
11
<?php echo __('Some themes and plugins add resources via a PHP request.', 'litespeed-cache'); ?>
12
<?php echo __('Caching these pages may improve server performance by avoiding unnecessary PHP calls.', 'litespeed-cache'); ?>
admin/tpl/setting/settings_inc.exclude_cookies.php CHANGED
@@ -10,7 +10,7 @@ if ( ! defined( 'WPINC' ) ) die ;
10
11
$file_writable = LiteSpeed_Cache_Admin_Rules::writable();
12
13
- $this->build_textarea($id, str_replace('|', "\n", $_options[$id]));//, !$file_writable
14
?>
15
<div class="litespeed-desc">
16
<?php echo sprintf( __( 'To prevent %s from being cached, enter it here.', 'litespeed-cache' ), __( 'cookies', 'litespeed-cache') ) ; ?>
10
11
$file_writable = LiteSpeed_Cache_Admin_Rules::writable();
12
13
+ $this->build_textarea($id, false, str_replace('|', "\n", $_options[$id]));//, !$file_writable
14
?>
15
<div class="litespeed-desc">
16
<?php echo sprintf( __( 'To prevent %s from being cached, enter it here.', 'litespeed-cache' ), __( 'cookies', 'litespeed-cache') ) ; ?>
admin/tpl/setting/settings_inc.media_webp.php CHANGED
File without changes
admin/tpl/setting/settings_media.php CHANGED
@@ -13,6 +13,10 @@ if ( ! defined( 'WPINC' ) ) die ;
13
<div class="litespeed-desc">
14
<?php echo __( 'Load images only when they enter the viewport.', 'litespeed-cache' ) ; ?>
15
<?php echo __( 'This can improve page loading time by reducing initial HTTP requests.', 'litespeed-cache' ) ; ?>
16
</div>
17
</td>
18
</tr>
13
<div class="litespeed-desc">
14
<?php echo __( 'Load images only when they enter the viewport.', 'litespeed-cache' ) ; ?>
15
<?php echo __( 'This can improve page loading time by reducing initial HTTP requests.', 'litespeed-cache' ) ; ?>
16
+ <br /><font class="litespeed-success">
17
+ <?php echo __('Tip', 'litespeed-cache'); ?>:
18
+ <a href="https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp:configuration:media:lazy-load-style" target="_blank"><?php echo __('Adding Style to Your Lazy-Loaded Images', 'litespeed-cache') ; ?></a>
19
+ </font>
20
</div>
21
</td>
22
</tr>
admin/tpl/setting/settings_optimize.php CHANGED
@@ -141,4 +141,28 @@ if ( ! defined( 'WPINC' ) ) die ;
141
</td>
142
</tr>
143
144
</tbody></table>
141
</td>
142
</tr>
143
144
+ <tr>
145
+ <th><?php echo __( 'DNS Prefetch', 'litespeed-cache' ) ; ?></th>
146
+ <td>
147
+ <?php $this->build_textarea2( LiteSpeed_Cache_Config::ITEM_DNS_PREFETCH ) ; ?>
148
+ <div class="litespeed-desc">
149
+ <?php echo __( 'Prefetching DNS can reduce latency for visiters.', 'litespeed-cache' ) ; ?>
150
+ <?php echo __( 'For example', 'litespeed-cache' ) ; ?>: <code>//www.example.com</code>
151
+ <a href="https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp:configuration:optimize#dns_prefetch" target="_blank"><?php echo __( 'Learn More', 'litespeed-cache' ) ; ?></a>
152
+ <?php echo __( 'One per line.', 'litespeed-cache' ) ; ?>
153
+ </div>
154
+ </td>
155
+ </tr>
156
+
157
+ <tr>
158
+ <th><?php echo __( 'Remove Comments', 'litespeed-cache' ) ; ?></th>
159
+ <td>
160
+ <?php $this->build_switch( LiteSpeed_Cache_Config::OPID_OPTM_RM_COMMENT ) ; ?>
161
+ <div class="litespeed-desc">
162
+ <?php echo __( 'Remove the comments inside of JS/CSS files when minifying.', 'litespeed-cache' ) ; ?>
163
+ <?php echo __( 'This can improve your speed score in services like Pingdom, GTmetrix and PageSpeed.', 'litespeed-cache' ) ; ?>
164
+ </div>
165
+ </td>
166
+ </tr>
167
+
168
</tbody></table>
admin/tpl/setting/settings_purge.php CHANGED
@@ -72,7 +72,7 @@ $breakArr = array(
72
<tr>
73
<th><?php echo __( 'Scheduled Purge URLs', 'litespeed-cache' ) ; ?></th>
74
<td>
75
- <?php $this->build_textarea( LiteSpeed_Cache_Config::OPID_TIMED_URLS, null, false, 80 ) ; ?>
76
<div class="litespeed-desc">
77
<?php echo sprintf( __( 'The URLs here (one per line) will be purged automatically at the time set in the option "%s".', 'litespeed-cache' ), __( 'Scheduled Purge Time', 'litespeed-cache' ) ) ; ?><br />
78
<?php echo sprintf( __( 'Both %1$s and %2$s are acceptable.', 'litespeed-cache' ), '<code>http://www.example.com/path/url.php</code>', '<code>/path/url.php</code>' ) ; ?>
@@ -85,7 +85,7 @@ $breakArr = array(
85
<th><?php echo __( 'Scheduled Purge Time', 'litespeed-cache' ) ; ?></th>
86
<td>
87
<?php $id = LiteSpeed_Cache_Config::OPID_TIMED_URLS_TIME ; ?>
88
- <?php $this->build_input( $id, '', false, false, null, null, '', 'time' ) ; ?>
89
<div class="litespeed-desc">
90
<?php echo sprintf( __( 'Specify the time to purge the "%s" list.', 'litespeed-cache' ), __( 'Scheduled Purge URLs', 'litespeed-cache' ) ) ; ?>
91
<?php echo sprintf( __( 'Current server time is %s.', 'litespeed-cache' ), '<code>' . date( 'H:i:s' ) . '</code>' ) ; ?>
72
<tr>
73
<th><?php echo __( 'Scheduled Purge URLs', 'litespeed-cache' ) ; ?></th>
74
<td>
75
+ <?php $this->build_textarea( LiteSpeed_Cache_Config::OPID_TIMED_URLS, 80 ) ; ?>
76
<div class="litespeed-desc">
77
<?php echo sprintf( __( 'The URLs here (one per line) will be purged automatically at the time set in the option "%s".', 'litespeed-cache' ), __( 'Scheduled Purge Time', 'litespeed-cache' ) ) ; ?><br />
78
<?php echo sprintf( __( 'Both %1$s and %2$s are acceptable.', 'litespeed-cache' ), '<code>http://www.example.com/path/url.php</code>', '<code>/path/url.php</code>' ) ; ?>
85
<th><?php echo __( 'Scheduled Purge Time', 'litespeed-cache' ) ; ?></th>
86
<td>
87
<?php $id = LiteSpeed_Cache_Config::OPID_TIMED_URLS_TIME ; ?>
88
+ <?php $this->build_input( $id, false, null, null, '', 'time' ) ; ?>
89
<div class="litespeed-desc">
90
<?php echo sprintf( __( 'Specify the time to purge the "%s" list.', 'litespeed-cache' ), __( 'Scheduled Purge URLs', 'litespeed-cache' ) ) ; ?>
91
<?php echo sprintf( __( 'Current server time is %s.', 'litespeed-cache' ), '<code>' . date( 'H:i:s' ) . '</code>' ) ; ?>
admin/tpl/setting/settings_tuning.php CHANGED
@@ -79,6 +79,19 @@ if ( ! defined( 'WPINC' ) ) die ;
79
</td>
80
</tr>
81
82
<tr>
83
<th><?php echo __( 'Remove Query Strings', 'litespeed-cache' ) ; ?></th>
84
<td>
79
</td>
80
</tr>
81
82
+ <tr>
83
+ <th><?php echo __( 'Max Combined File Size', 'litespeed-cache' ) ; ?></th>
84
+ <td>
85
+ <?php $id = LiteSpeed_Cache_Config::OPID_OPTM_MAX_SIZE ; ?>
86
+ <?php $this->build_input( $id, 'litespeed-input-short' ) ; ?> <?php echo __( 'MB', 'litespeed-cache' ) ; ?>
87
+ <div class="litespeed-desc">
88
+ <?php echo __( 'Specify the maximum size in megabytes for combined files.', 'litespeed-cache' ) ; ?>
89
+ <?php echo __( 'Larger numbers will generate fewer files, which is better for achieving higher page scores, but can cause heavy memory usage.', 'litespeed-cache' ) ; ?>
90
+ <?php $this->recommended( $id ) ; ?>
91
+ </div>
92
+ </td>
93
+ </tr>
94
+
95
<tr>
96
<th><?php echo __( 'Remove Query Strings', 'litespeed-cache' ) ; ?></th>
97
<td>
cli/litespeed-cache-cli-admin.class.php CHANGED
@@ -51,11 +51,10 @@ class LiteSpeed_Cache_Cli_Admin
51
LiteSpeed_Cache_Config::OPID_OPTM_EMOJI_RM,
52
LiteSpeed_Cache_Config::OPID_OPTM_EXC_JQUERY,
53
LiteSpeed_Cache_Config::OPID_OPTM_GGFONTS_ASYNC,
54
55
LiteSpeed_Cache_Config::OPID_CDN,
56
- LiteSpeed_Cache_Config::OPID_CDN_INC_IMG,
57
- LiteSpeed_Cache_Config::OPID_CDN_INC_CSS,
58
- LiteSpeed_Cache_Config::OPID_CDN_INC_JS,
59
60
LiteSpeed_Cache_Config::OPID_MEDIA_IMG_LAZY,
61
LiteSpeed_Cache_Config::OPID_MEDIA_IFRAME_LAZY,
@@ -155,11 +154,10 @@ class LiteSpeed_Cache_Cli_Admin
155
case LiteSpeed_Cache_Config::OPID_OPTM_EMOJI_RM:
156
case LiteSpeed_Cache_Config::OPID_OPTM_EXC_JQUERY:
157
case LiteSpeed_Cache_Config::OPID_OPTM_GGFONTS_ASYNC:
158
159
case LiteSpeed_Cache_Config::OPID_CDN:
160
- case LiteSpeed_Cache_Config::OPID_CDN_INC_IMG:
161
- case LiteSpeed_Cache_Config::OPID_CDN_INC_CSS:
162
- case LiteSpeed_Cache_Config::OPID_CDN_INC_JS:
163
164
case LiteSpeed_Cache_Config::OPID_MEDIA_IMG_LAZY:
165
case LiteSpeed_Cache_Config::OPID_MEDIA_IFRAME_LAZY:
51
LiteSpeed_Cache_Config::OPID_OPTM_EMOJI_RM,
52
LiteSpeed_Cache_Config::OPID_OPTM_EXC_JQUERY,
53
LiteSpeed_Cache_Config::OPID_OPTM_GGFONTS_ASYNC,
54
+ LiteSpeed_Cache_Config::OPID_OPTM_RM_COMMENT,
55
56
LiteSpeed_Cache_Config::OPID_CDN,
57
+ LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE,
58
59
LiteSpeed_Cache_Config::OPID_MEDIA_IMG_LAZY,
60
LiteSpeed_Cache_Config::OPID_MEDIA_IFRAME_LAZY,
154
case LiteSpeed_Cache_Config::OPID_OPTM_EMOJI_RM:
155
case LiteSpeed_Cache_Config::OPID_OPTM_EXC_JQUERY:
156
case LiteSpeed_Cache_Config::OPID_OPTM_GGFONTS_ASYNC:
157
+ case LiteSpeed_Cache_Config::OPID_OPTM_RM_COMMENT:
158
159
case LiteSpeed_Cache_Config::OPID_CDN:
160
+ case LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE:
161
162
case LiteSpeed_Cache_Config::OPID_MEDIA_IMG_LAZY:
163
case LiteSpeed_Cache_Config::OPID_MEDIA_IFRAME_LAZY:
css/litespeed.css CHANGED
@@ -67,6 +67,13 @@
67
margin: 2px 0;
68
}
69
70
/********************************* logo *******************************/
71
@font-face {
72
font-family: 'litespeedfont';
@@ -446,6 +453,11 @@
446
background: #fff;
447
}
448
449
450
.litespeed-wrap .litespeed-btn-xs,
451
.litespeed-btn-xs {
@@ -1044,64 +1056,6 @@ ul.litespeed-shell-body {
1044
line-height: 16px;
1045
}
1046
1047
- /********************************* Q&A *******************************/
1048
- .litespeed-question:hover {
1049
- color: #6699cc;
1050
- cursor: pointer;
1051
- background: #fff;
1052
- border-left: 5px solid #6699cc;
1053
- }
1054
-
1055
- .litespeed-question {
1056
- background-color: #f9fafc;
1057
- border: 1px solid #f9fafc;
1058
- border-left: 5px solid #538ac6 !important;
1059
- border-radius: 3px;
1060
- padding: 20px;
1061
- margin: 0 20px 5px 5px;
1062
- font-family: "Open Sans", Arial, sans-serif;
1063
- font-weight: 600;
1064
- font-size: 14px;
1065
- line-height: 1.1;
1066
- color: #264d73;
1067
- }
1068
-
1069
- .litespeed-answer {
1070
- margin-left: 20px;
1071
- padding: 0 20px 20px 10px;
1072
- }
1073
-
1074
- .litespeed-up:after {
1075
- content: ' ';
1076
- border: solid #36b0b0;
1077
- border-width: 0 2px 2px 0;
1078
- display: inline-block;
1079
- padding: 3px;
1080
- margin-left: 15px;
1081
- transform: rotate(-135deg);
1082
- -webkit-transform: rotate(-135deg);
1083
- -webkit-transition: all .3s ease;
1084
- -moz-transition: all .3s ease;
1085
- -ms-transition: all .3s ease;
1086
- -o-transition: all .3s ease;
1087
- }
1088
-
1089
- .litespeed-down:after {
1090
- content: ' ';
1091
- border: solid #36b0b0;
1092
- border-width: 0 2px 2px 0;
1093
- display: inline-block;
1094
- padding: 3px;
1095
- margin-left: 15px;
1096
- transform: rotate(45deg);
1097
- -webkit-transform: rotate(45deg);
1098
- -webkit-transition: all .3s ease;
1099
- -moz-transition: all .3s ease;
1100
- -ms-transition: all .3s ease;
1101
- -o-transition: all .3s ease;
1102
- }
1103
-
1104
-
1105
/********************************* enterprise notice *******************************/
1106
.litespeed-ent-notice {
1107
position: absolute ;
@@ -1169,6 +1123,10 @@ ul.litespeed-shell-body {
1169
.litespeed-icon-media-optm { background-image: url("../img/icons/img_optm.svg") ; }
1170
.litespeed-icon-media-optm-disabled { background-image: url("../img/icons/img_optm_disabled.svg") ; }
1171
1172
p.litespeed-txt-webp {
1173
color: #83b04a ;
1174
}
@@ -1187,34 +1145,235 @@ p.litespeed-txt-disabled {
1187
width: 25px;
1188
height: auto;
1189
}
1190
- .litespeed-pie_info {
1191
}
1192
1193
circle.litespeed-pie_bg {
1194
- stroke: #cfe7f2;
1195
stroke-width: 2;
1196
fill: none;
1197
- cx: 17.5;
1198
- cy: 17.5;
1199
- r: 16.5;
1200
}
1201
1202
circle.litespeed-pie_circle {
1203
animation: litespeed-pie-fill 2s reverse; /* 1 */
1204
- stroke: #00afbf;
1205
stroke-width: 2;
1206
- stroke-dasharray: 30, 100;
1207
stroke-linecap: round;
1208
fill: none;
1209
- cx: 17;
1210
- cy: 17.5;
1211
- r: 16.5;
1212
}
1213
1214
1215
- /********************************* utility *******************************/
1216
- .litespeed-unicode-refresh{
1217
1218
}
1219
1220
@@ -1296,6 +1455,13 @@ circle.litespeed-pie_circle {
1296
padding: 1px 6px;
1297
}
1298
1299
/*text area */
1300
1301
.litespeed-body textarea {
67
margin: 2px 0;
68
}
69
70
+ .litespeed-abs-center{
71
+ justify-content: center ;
72
+ align-items: center ;
73
+ display: flex ;
74
+ flex-grow: 1 ;
75
+ }
76
+
77
/********************************* logo *******************************/
78
@font-face {
79
font-family: 'litespeedfont';
453
background: #fff;
454
}
455
456
+ .litespeed-btn-default.active{
457
+ color: #333;
458
+ background-color: #e6e6e6;
459
+ border-color: #adadad;
460
+ }
461
462
.litespeed-wrap .litespeed-btn-xs,
463
.litespeed-btn-xs {
1056
line-height: 16px;
1057
}
1058
1059
/********************************* enterprise notice *******************************/
1060
.litespeed-ent-notice {
1061
position: absolute ;
1123
.litespeed-icon-media-optm { background-image: url("../img/icons/img_optm.svg") ; }
1124
.litespeed-icon-media-optm-disabled { background-image: url("../img/icons/img_optm_disabled.svg") ; }
1125
1126
+ p.litespeed-media-p{
1127
+ margin-bottom: 1px !important;
1128
+ }
1129
+
1130
p.litespeed-txt-webp {
1131
color: #83b04a ;
1132
}
1145
width: 25px;
1146
height: auto;
1147
}
1148
+
1149
+ @keyframes litespeed-circle-chart-fill {
1150
+ to { stroke-dasharray: 0 100; }
1151
+ }
1152
+
1153
+ .litespeed-pie{
1154
+ vertical-align: middle;
1155
+ margin: 5px;
1156
}
1157
1158
circle.litespeed-pie_bg {
1159
+ stroke: #efefef;
1160
stroke-width: 2;
1161
fill: none;
1162
+ cx: 16.91549431;
1163
+ cy: 16.91549431;
1164
+ r: 15.91549431;
1165
}
1166
1167
circle.litespeed-pie_circle {
1168
+ animation: litespeed-circle-chart-fill 2s reverse;
1169
+ transform: rotate(-90deg);
1170
+ transform-origin: center;
1171
+
1172
animation: litespeed-pie-fill 2s reverse; /* 1 */
1173
+ stroke: #00acc1;
1174
stroke-width: 2;
1175
stroke-linecap: round;
1176
fill: none;
1177
+ cx: 16.91549431;
1178
+ cy: 16.91549431;
1179
+ r: 15.91549431;
1180
+ }
1181
+
1182
+ g.litespeed-pie_info text{
1183
+ alignment-baseline: central;
1184
+ text-anchor: middle;
1185
+ }
1186
+
1187
+ /********************************* multiple cdn mapping styling *******************************/
1188
+ [data-litespeed-cdn-mapping]:first-child [data-litespeed-cdn-mapping-del]{
1189
+ display: none;
1190
+ }
1191
+
1192
+ .litespeed-cdn-mapping-block {
1193
+ border: 1px dotted #6699cc;
1194
+ border-radius:5px;
1195
+ display: flex;
1196
+ padding: 10px;
1197
+ margin-bottom: 5px;
1198
+ }
1199
+
1200
+ .litespeed-cdn-mapping-col1 {
1201
+ flex: 0 0 35%;
1202
+ padding-left: 17px;
1203
+ }
1204
+
1205
+ .litespeed-cdn-mapping-col2 {
1206
+ flex: 0 0 22%;
1207
+ }
1208
+
1209
+ .litespeed-cdn-mapping-col3 {
1210
+ display: flex;
1211
+ }
1212
+
1213
+ .litespeed-cdn-mapping-col1 h4 {
1214
+ position:relative;
1215
+ margin-top: 10px;
1216
+ }
1217
+
1218
+ .litespeed-btn-danger[data-litespeed-cdn-mapping-del] {
1219
+ border-radius: 13px;
1220
+ margin: 0 10px 0 0;
1221
+ position: absolute;
1222
+ right:10px;
1223
+ top:0;
1224
+ background: #cc3d6a;
1225
+ color: #fff;
1226
+ padding: 1px 8px;
1227
+ font-size: 13px;
1228
+ line-height: 1.5;
1229
+ min-width: 14px;
1230
+ }
1231
+
1232
+ #litespeed-cdn-mapping-add {
1233
+ background: #36b0b0;
1234
+ color: #fff;
1235
+ }
1236
+
1237
+ .litespeed-cdn-mapping-inc {
1238
+ display: inline-block;
1239
+ margin-left: 36px ;
1240
+ min-width: 100px ;
1241
+ font-weight: bold;
1242
+ }
1243
+
1244
+ .litespeed-cdn-mapping-col3-title {
1245
+ display: inline-block;
1246
+ vertical-align: top ;
1247
+ font-weight: bold;
1248
+ margin-left: 36px ;
1249
+ margin-right: 10px;
1250
+ }
1251
+
1252
+ .litespeed-child-col{
1253
+ flex: 0 0 30%;
1254
+ padding-left: 17px;
1255
+ }
1256
+
1257
+
1258
+ /********************************* toggle *******************************/
1259
+
1260
+ .litespeed-toggle {
1261
+ position: relative;
1262
+ overflow: hidden;
1263
+ min-width: 58px ;
1264
+ height: 21px ;
1265
+ margin-left: 30px ;
1266
+ }
1267
+
1268
+ .litespeed-toggle-group {
1269
+ position: absolute;
1270
+ width: 200%;
1271
+ top: 0;
1272
+ bottom: 0;
1273
+ left: 0;
1274
+ transition: left 0.35s;
1275
+ -webkit-transition: left 0.35s;
1276
+ -moz-user-select: none;
1277
+ -webkit-user-select: none;
1278
}
1279
1280
+ .litespeed-toggle-on {
1281
+ position: absolute;
1282
+ top: 0;
1283
+ bottom: 0;
1284
+ left: 0;
1285
+ right: 50%;
1286
+ margin: 0;
1287
+ border: 0;
1288
+ border-radius: 0;
1289
+ }
1290
1291
+ .litespeed-toggle-on.litespeed-toggle-btn {
1292
+ padding-right: 24px;
1293
+ }
1294
1295
+ .litespeed-toggle-off.litespeed-toggle-btn {
1296
+ padding-left: 24px;
1297
+ }
1298
+
1299
+ .litespeed-toggle-handle {
1300
+ position: relative;
1301
+ margin: 0 auto;
1302
+ padding-top: 0px;
1303
+ padding-bottom: 0px;
1304
+ height: 100%;
1305
+ width: 0px;
1306
+ border-width: 0 1px;
1307
+