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
+ }
1308
+
1309
+ .litespeed-toggle-off {
1310
+ position: absolute;
1311
+ top: 0;
1312
+ bottom: 0;
1313
+ left: 50%;
1314
+ right: 0;
1315
+ margin: 0;
1316
+ border: 0;
1317
+ border-radius: 0;
1318
+ }
1319
+
1320
+ .litespeed-toggleoff .litespeed-toggle-group {
1321
+ left: -100%;
1322
+ }
1323
+
1324
+ .litespeed-toggle-btn {
1325
+ display: inline-block;
1326
+ padding: 6px 12px;
1327
+ margin-bottom: 0;
1328
+ font-size: 14px;
1329
+ font-weight: 400;
1330
+ line-height: 1.42857143;
1331
+ text-align: center;
1332
+ white-space: nowrap;
1333
+ vertical-align: middle;
1334
+ cursor: pointer;
1335
+ -webkit-user-select: none;
1336
+ -moz-user-select: none;
1337
+ -ms-user-select: none;
1338
+ user-select: none;
1339
+ background-image: none;
1340
+ border: 1px solid transparent;
1341
+ border-radius: 4px;
1342
+ }
1343
+
1344
+ .litespeed-toggle-btn-primary {
1345
+ color: #fff;
1346
+ background-color: #36b0b0;
1347
+ border-color: #6699cc;
1348
+ }
1349
+
1350
+ .litespeed-toggle-btn-default {
1351
+ color: #333;
1352
+ background-color: #fff;
1353
+ border-color: #ccc;
1354
+ }
1355
+
1356
+ .litespeed-toggle-btn-success:hover, .litespeed-toggle-btn-success:focus, .litespeed-toggle-btn-success:active, .litespeed-toggle-btn-success.litespeed-toggle-active {
1357
+ color: #fff;
1358
+ background-color: #00bfbf;
1359
+ border-color: #6699cc;
1360
+ }
1361
+
1362
+ .litespeed-toggle-btn-default:hover, .litespeed-toggle-btn-default:focus, .litespeed-toggle-btn-default:active, .litespeed-toggle-btn-default.litespeed-toggle-active {
1363
+ color: #333;
1364
+ background-color: #e6e6e6;
1365
+ border-color: #adadad;
1366
+ }
1367
+
1368
+ .litespeed-toggle-btn:active, .litespeed-toggle-btn.litespeed-toggle-active {
1369
+ background-image: none;
1370
+ outline: 0;
1371
+ -webkit-box-shadow: inset 0 3px 5px rgba(0,0,0,.125);
1372
+ box-shadow: inset 0 3px 5px rgba(0,0,0,.125);
1373
+ }
1374
+
1375
+ .litespeed-toggle-btn-default:active, .litespeed-toggle-btn-default.litespeed-toggle-active {
1376
+ background-image: none;
1377
  }
1378
 
1379
 
1455
  padding: 1px 6px;
1456
  }
1457
 
1458
+ input.litespeed-input-success {
1459
+ border-color: #28a745;
1460
+ }
1461
+
1462
+ input.litespeed-input-warning {
1463
+ border-color: #e59544;
1464
+ }
1465
  /*text area */
1466
 
1467
  .litespeed-body textarea {
img/icons/img_optm.svg CHANGED
File without changes
img/icons/img_optm_disabled.svg CHANGED
File without changes
img/icons/img_webp.svg CHANGED
File without changes
img/icons/img_webp_disabled.svg CHANGED
File without changes
inc/api.class.php CHANGED
@@ -253,12 +253,11 @@ class LiteSpeed_Cache_API
253
  * @since 1.1.3
254
  * @access public
255
  * @param string $id
256
- * @param boolean $disabled Disable this field
257
  * @param boolean $return Return the html or echo it
258
  */
259
- public static function build_switch($id, $disabled = false, $return = false)
260
  {
261
- return LiteSpeed_Cache_Admin_Display::get_instance()->build_switch($id, $disabled, $return) ;
262
  }
263
 
264
  /**
@@ -311,6 +310,17 @@ class LiteSpeed_Cache_API
311
  add_action('litespeed_cache_api_vary', $hook) ;
312
  }
313
 
 
 
 
 
 
 
 
 
 
 
 
314
  /**
315
  * Hook purge tags appending to purge
316
  *
253
  * @since 1.1.3
254
  * @access public
255
  * @param string $id
 
256
  * @param boolean $return Return the html or echo it
257
  */
258
+ public static function build_switch( $id, $checked = null, $return = false )
259
  {
260
+ return LiteSpeed_Cache_Admin_Display::get_instance()->build_switch( $id, $checked, $return ) ;
261
  }
262
 
263
  /**
310
  add_action('litespeed_cache_api_vary', $hook) ;
311
  }
312
 
313
+ /**
314
+ * Hook vary tags to vary finialization
315
+ *
316
+ * @since 1.7.2
317
+ * @access public
318
+ */
319
+ public static function hook_vary_finalize( $hook )
320
+ {
321
+ add_filter( 'litespeed_vary', $hook ) ;
322
+ }
323
+
324
  /**
325
  * Hook purge tags appending to purge
326
  *
inc/cdn.class.php CHANGED
@@ -16,18 +16,21 @@ class LiteSpeed_Cache_CDN
16
 
17
  const BYPASS = 'LITESPEED_BYPASS_CDN' ;
18
 
 
 
 
 
 
19
  private $content ;
20
 
21
  private $cfg_cdn ;
22
  private $cfg_url_ori ;
23
- private $cfg_cdn_url ;
24
- private $cfg_cdn_inc_img ;
25
- private $cfg_cdn_inc_css ;
26
- private $cfg_cdn_inc_js ;
27
- private $cfg_cdn_filetype ;
28
  private $cfg_cdn_exclude ;
29
  private $cfg_cdn_remote_jquery ;
30
 
 
 
31
  /**
32
  * Init
33
  *
@@ -64,8 +67,43 @@ class LiteSpeed_Cache_CDN
64
  }
65
 
66
  $this->cfg_url_ori = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN_ORI ) ;
67
- $this->cfg_cdn_url = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN_URL ) ;
68
- if ( ! $this->cfg_url_ori || ! $this->cfg_cdn_url ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  if ( ! defined( self::BYPASS ) ) {
70
  define( self::BYPASS, true ) ;
71
  }
@@ -80,40 +118,60 @@ class LiteSpeed_Cache_CDN
80
  LiteSpeed_Cache_Log::debug2( 'CDN: translated rule is ' . $this->cfg_url_ori ) ;
81
  }
82
 
83
- $this->cfg_cdn_inc_img = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN_INC_IMG ) ;
84
- $this->cfg_cdn_inc_css = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN_INC_CSS ) ;
85
- $this->cfg_cdn_inc_js = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN_INC_JS ) ;
86
- $this->cfg_cdn_filetype = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN_FILETYPE ) ;
87
- if ( ! $this->cfg_cdn_inc_img && ! $this->cfg_cdn_inc_css && ! $this->cfg_cdn_inc_js && ! $this->cfg_cdn_filetype ) {
88
- if ( ! defined( self::BYPASS ) ) {
89
- define( self::BYPASS, true ) ;
90
- }
91
- return ;
92
- }
93
-
94
- $this->cfg_cdn_filetype = explode( "\n", $this->cfg_cdn_filetype ) ;
95
-
96
  $this->cfg_cdn_exclude = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN_EXCLUDE ) ;
97
  $this->cfg_cdn_exclude = explode( "\n", $this->cfg_cdn_exclude ) ;
98
 
99
- if ( $this->cfg_cdn_inc_img ) {
100
  // Hook to srcset
101
  if ( function_exists( 'wp_calculate_image_srcset' ) ) {
102
- add_filter( 'wp_calculate_image_srcset', __CLASS__ . '::srcset', 999 ) ;
103
  }
104
  // Hook to mime icon
105
- add_filter( 'wp_get_attachment_image_src', __CLASS__ . '::attach_img_src', 999 ) ;
106
- add_filter( 'wp_get_attachment_url', __CLASS__ . '::url', 999 ) ;
107
  }
108
 
109
- if ( $this->cfg_cdn_inc_css ) {
110
- add_filter( 'style_loader_src', __CLASS__ . '::url', 999 ) ;
111
  }
112
 
113
- if ( $this->cfg_cdn_inc_js ) {
114
- add_filter( 'script_loader_src', __CLASS__ . '::url', 999 ) ;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
  }
116
 
 
117
  }
118
 
119
  /**
@@ -126,11 +184,11 @@ class LiteSpeed_Cache_CDN
126
  {
127
  $instance = self::get_instance() ;
128
 
129
- if ( $type == 'css' && $instance->cfg_cdn_inc_css ) {
130
  return true ;
131
  }
132
 
133
- if ( $type == 'js' && $instance->cfg_cdn_inc_js ) {
134
  return true ;
135
  }
136
 
@@ -149,12 +207,9 @@ class LiteSpeed_Cache_CDN
149
  return false ;
150
  }
151
 
152
- if ( ! defined( 'LITESPEED_CDN_HOST' ) ) {
153
- $instance = self::get_instance() ;
154
- define( 'LITESPEED_CDN_HOST', parse_url( $instance->cfg_cdn_url, PHP_URL_HOST ) ) ;
155
- }
156
 
157
- return $host === LITESPEED_CDN_HOST ;
158
  }
159
 
160
  /**
@@ -222,12 +277,12 @@ class LiteSpeed_Cache_CDN
222
  LiteSpeed_Cache_Log::debug( 'CDN _finalize' ) ;
223
 
224
  // Start replacing img src
225
- if ( $this->cfg_cdn_inc_img ) {
226
  $this->_replace_img() ;
227
  $this->_replace_inline_css() ;
228
  }
229
 
230
- if ( $this->cfg_cdn_filetype ) {
231
  $this->_replace_file_types() ;
232
  }
233
 
@@ -245,19 +300,21 @@ class LiteSpeed_Cache_CDN
245
  if ( empty( $matches[ 2 ] ) ) {
246
  return ;
247
  }
 
 
248
  foreach ( $matches[ 2 ] as $k => $url ) {
249
  $url_parsed = parse_url( $url ) ;
250
  if ( empty( $url_parsed[ 'path' ] ) ) {
251
  continue ;
252
  }
253
  $postfix = substr( $url_parsed[ 'path' ], strrpos( $url_parsed[ 'path' ], '.' ) ) ;
254
- if ( ! in_array( $postfix, $this->cfg_cdn_filetype ) ) {
255
  continue ;
256
  }
257
 
258
  LiteSpeed_Cache_Log::debug2( 'CDN matched file_type ' . $postfix . ' : ' . $url ) ;
259
 
260
- if( ! $url2 = $this->rewrite( $url ) ) {
261
  continue ;
262
  }
263
 
@@ -281,7 +338,7 @@ class LiteSpeed_Cache_CDN
281
  continue ;
282
  }
283
 
284
- if ( ! $url2 = $this->rewrite( $url ) ) {
285
  continue ;
286
  }
287
 
@@ -308,7 +365,7 @@ class LiteSpeed_Cache_CDN
308
  foreach ( $matches[ 1 ] as $k => $url ) {
309
  $url = str_replace( array( ' ', '\t', '\n', '\r', '\0', '\x0B', '"', "'", '&quot;', '&#039;' ), '', $url ) ;
310
 
311
- if ( ! $url2 = $this->rewrite( $url ) ) {
312
  continue ;
313
  }
314
  $attr = str_replace( $matches[ 1 ][ $k ], $url2, $matches[ 0 ][ $k ] ) ;
@@ -320,14 +377,14 @@ class LiteSpeed_Cache_CDN
320
  * Hook to wp_get_attachment_image_src
321
  *
322
  * @since 1.2.3
 
323
  * @access public
324
  * @param array $img The URL of the attachment image src, the width, the height
325
  * @return array
326
  */
327
- public static function attach_img_src( $img )
328
  {
329
- $instance = self::get_instance() ;
330
- if ( $img && $url = $instance->rewrite( $img[ 0 ] ) ) {
331
  $img[ 0 ] = $url ;
332
  }
333
  return $img ;
@@ -336,15 +393,40 @@ class LiteSpeed_Cache_CDN
336
  /**
337
  * Try to rewrite one URL with CDN
338
  *
339
- * @since 1.2.3
340
  * @access public
341
- * @param string $url
342
- * @return string
343
  */
344
- public static function url( $url )
345
  {
346
- $instance = self::get_instance() ;
347
- if ( $url && $url2 = $instance->rewrite( $url ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
348
  $url = $url2 ;
349
  }
350
  return $url ;
@@ -354,16 +436,16 @@ class LiteSpeed_Cache_CDN
354
  * Hook to replace WP responsive images
355
  *
356
  * @since 1.2.3
 
357
  * @access public
358
  * @param array $srcs
359
  * @return array
360
  */
361
- public static function srcset( $srcs )
362
  {
363
  if ( $srcs ) {
364
- $instance = self::get_instance() ;
365
  foreach ( $srcs as $w => $data ) {
366
- if( ! $url = $instance->rewrite( $data[ 'url' ] ) ) {
367
  continue ;
368
  }
369
  $srcs[ $w ][ 'url' ] = $url ;
@@ -380,7 +462,7 @@ class LiteSpeed_Cache_CDN
380
  * @param string $url
381
  * @return string Replaced URL
382
  */
383
- public function rewrite( $url )
384
  {
385
  LiteSpeed_Cache_Log::debug2( 'CDN: try rewriting ' . $url ) ;
386
  $url_parsed = parse_url( $url ) ;
@@ -421,12 +503,24 @@ class LiteSpeed_Cache_CDN
421
  LiteSpeed_Cache_Log::debug2( 'CDN: scheme from url: ' . $scheme ) ;
422
  }
423
 
 
 
 
 
 
 
 
 
 
 
 
 
424
  // Now lets replace CDN url
425
  if ( strpos( $this->cfg_url_ori, '*' ) !== false ) {
426
- $url = preg_replace( '#' . $scheme . $this->cfg_url_ori . '#iU', $this->cfg_cdn_url, $url ) ;
427
  }
428
  else {
429
- $url = str_replace( $scheme . $this->cfg_url_ori, $this->cfg_cdn_url, $url ) ;
430
  }
431
  LiteSpeed_Cache_Log::debug2( 'CDN: after rewritten: ' . $url ) ;
432
 
@@ -459,6 +553,209 @@ class LiteSpeed_Cache_CDN
459
  wp_register_script( 'jquery', $src, false, $v ) ;
460
  }
461
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
462
  /**
463
  * Get the current instance object.
464
  *
16
 
17
  const BYPASS = 'LITESPEED_BYPASS_CDN' ;
18
 
19
+ const TYPE_CLOUDFLARE_PURGE_ALL = 'cloudflare_purge_all' ;
20
+ const TYPE_CLOUDFLARE_GET_DEVMODE = 'cloudflare_get_devmode' ;
21
+ const TYPE_CLOUDFLARE_SET_DEVMODE_ON = 'cloudflare_set_devmode_on' ;
22
+ const TYPE_CLOUDFLARE_SET_DEVMODE_OFF = 'cloudflare_set_devmode_off' ;
23
+
24
  private $content ;
25
 
26
  private $cfg_cdn ;
27
  private $cfg_url_ori ;
28
+ private $cfg_cdn_mapping = array() ;
 
 
 
 
29
  private $cfg_cdn_exclude ;
30
  private $cfg_cdn_remote_jquery ;
31
 
32
+ private $cdn_mapping_hosts = array() ;
33
+
34
  /**
35
  * Init
36
  *
67
  }
68
 
69
  $this->cfg_url_ori = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN_ORI ) ;
70
+ $cfg_cdn_url = get_option( LiteSpeed_Cache_Config::ITEM_CDN_MAPPING, array() ) ;
71
+ // Parse cdn mapping data to array( 'filetype' => 'url' )
72
+ $mapping_to_check = array(
73
+ LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_INC_IMG,
74
+ LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_INC_CSS,
75
+ LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_INC_JS
76
+ ) ;
77
+ foreach ( $cfg_cdn_url as $v ) {
78
+ if ( ! $v[ LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_URL ] ) {
79
+ continue ;
80
+ }
81
+ $this_url = $v[ LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_URL ] ;
82
+ $this_host = parse_url( $this_url, PHP_URL_HOST ) ;
83
+ foreach ( $mapping_to_check as $to_check ) {
84
+ if ( $v[ $to_check ] ) {
85
+ LiteSpeed_Cache_Log::debug2( 'CDN: mapping ' . $to_check . ' -> ' . $this_url ) ;
86
+ $this->cfg_cdn_mapping[ $to_check ] = $this_url ;
87
+ if ( ! in_array( $this_host, $this->cdn_mapping_hosts ) ) {
88
+ $this->cdn_mapping_hosts[] = $this_host ;
89
+ }
90
+ }
91
+ }
92
+ if ( $v[ LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_FILETYPE ] ) {
93
+ $filetypes = array_map( 'trim', explode( "\n", $v[ LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_FILETYPE ] ) ) ;
94
+ foreach ( $filetypes as $v2 ) {
95
+ if ( $v2 ) {
96
+ $this->cfg_cdn_mapping[ LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_FILETYPE ] = true ;
97
+ $this->cfg_cdn_mapping[ $v2 ] = $this_url ;
98
+ if ( ! in_array( $this_host, $this->cdn_mapping_hosts ) ) {
99
+ $this->cdn_mapping_hosts[] = $this_host ;
100
+ }
101
+ }
102
+ }
103
+ LiteSpeed_Cache_Log::debug2( 'CDN: mapping ' . implode( ',', $filetypes ) . ' -> ' . $this_url ) ;
104
+ }
105
+ }
106
+ if ( ! $this->cfg_url_ori || ! $this->cfg_cdn_mapping ) {
107
  if ( ! defined( self::BYPASS ) ) {
108
  define( self::BYPASS, true ) ;
109
  }
118
  LiteSpeed_Cache_Log::debug2( 'CDN: translated rule is ' . $this->cfg_url_ori ) ;
119
  }
120
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  $this->cfg_cdn_exclude = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN_EXCLUDE ) ;
122
  $this->cfg_cdn_exclude = explode( "\n", $this->cfg_cdn_exclude ) ;
123
 
124
+ if ( ! empty( $this->cfg_cdn_mapping[ LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_INC_IMG ] ) ) {
125
  // Hook to srcset
126
  if ( function_exists( 'wp_calculate_image_srcset' ) ) {
127
+ add_filter( 'wp_calculate_image_srcset', array( $this, 'srcset' ), 999 ) ;
128
  }
129
  // Hook to mime icon
130
+ add_filter( 'wp_get_attachment_image_src', array( $this, 'attach_img_src' ), 999 ) ;
131
+ add_filter( 'wp_get_attachment_url', array( $this, 'url_img' ), 999 ) ;
132
  }
133
 
134
+ if ( ! empty( $this->cfg_cdn_mapping[ LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_INC_CSS ] ) ) {
135
+ add_filter( 'style_loader_src', array( $this, 'url_css' ), 999 ) ;
136
  }
137
 
138
+ if ( ! empty( $this->cfg_cdn_mapping[ LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_INC_JS ] ) ) {
139
+ add_filter( 'script_loader_src', array( $this, 'url_js' ), 999 ) ;
140
+ }
141
+
142
+ }
143
+
144
+ /**
145
+ * Handle all request actions from main cls
146
+ *
147
+ * @since 1.7.2
148
+ * @access public
149
+ */
150
+ public static function handler()
151
+ {
152
+ $instance = self::get_instance() ;
153
+
154
+ $type = LiteSpeed_Cache_Router::verify_type() ;
155
+
156
+ switch ( $type ) {
157
+ case self::TYPE_CLOUDFLARE_PURGE_ALL :
158
+ $instance->_cloudflare_purge_all() ;
159
+ break ;
160
+
161
+ case self::TYPE_CLOUDFLARE_GET_DEVMODE :
162
+ $instance->_cloudflare_get_devmode() ;
163
+ break ;
164
+
165
+ case self::TYPE_CLOUDFLARE_SET_DEVMODE_ON :
166
+ case self::TYPE_CLOUDFLARE_SET_DEVMODE_OFF :
167
+ $instance->_cloudflare_set_devmode( $type ) ;
168
+ break ;
169
+
170
+ default:
171
+ break ;
172
  }
173
 
174
+ LiteSpeed_Cache_Admin::redirect() ;
175
  }
176
 
177
  /**
184
  {
185
  $instance = self::get_instance() ;
186
 
187
+ if ( $type == 'css' && ! empty( $instance->cfg_cdn_mapping[ LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_INC_CSS ] ) ) {
188
  return true ;
189
  }
190
 
191
+ if ( $type == 'js' && ! empty( $instance->cfg_cdn_mapping[ LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_INC_JS ] ) ) {
192
  return true ;
193
  }
194
 
207
  return false ;
208
  }
209
 
210
+ $instance = self::get_instance() ;
 
 
 
211
 
212
+ return in_array( $host, $instance->cdn_mapping_hosts ) ;
213
  }
214
 
215
  /**
277
  LiteSpeed_Cache_Log::debug( 'CDN _finalize' ) ;
278
 
279
  // Start replacing img src
280
+ if ( ! empty( $this->cfg_cdn_mapping[ LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_INC_IMG ] ) ) {
281
  $this->_replace_img() ;
282
  $this->_replace_inline_css() ;
283
  }
284
 
285
+ if ( ! empty( $this->cfg_cdn_mapping[ LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_FILETYPE ] ) ) {
286
  $this->_replace_file_types() ;
287
  }
288
 
300
  if ( empty( $matches[ 2 ] ) ) {
301
  return ;
302
  }
303
+
304
+ $filetypes = array_keys( $this->cfg_cdn_mapping ) ;
305
  foreach ( $matches[ 2 ] as $k => $url ) {
306
  $url_parsed = parse_url( $url ) ;
307
  if ( empty( $url_parsed[ 'path' ] ) ) {
308
  continue ;
309
  }
310
  $postfix = substr( $url_parsed[ 'path' ], strrpos( $url_parsed[ 'path' ], '.' ) ) ;
311
+ if ( ! in_array( $postfix, $filetypes ) ) {
312
  continue ;
313
  }
314
 
315
  LiteSpeed_Cache_Log::debug2( 'CDN matched file_type ' . $postfix . ' : ' . $url ) ;
316
 
317
+ if( ! $url2 = $this->rewrite( $url, LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_FILETYPE, $postfix ) ) {
318
  continue ;
319
  }
320
 
338
  continue ;
339
  }
340
 
341
+ if ( ! $url2 = $this->rewrite( $url, LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_INC_IMG ) ) {
342
  continue ;
343
  }
344
 
365
  foreach ( $matches[ 1 ] as $k => $url ) {
366
  $url = str_replace( array( ' ', '\t', '\n', '\r', '\0', '\x0B', '"', "'", '&quot;', '&#039;' ), '', $url ) ;
367
 
368
+ if ( ! $url2 = $this->rewrite( $url, LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_INC_IMG ) ) {
369
  continue ;
370
  }
371
  $attr = str_replace( $matches[ 1 ][ $k ], $url2, $matches[ 0 ][ $k ] ) ;
377
  * Hook to wp_get_attachment_image_src
378
  *
379
  * @since 1.2.3
380
+ * @since 1.7 Removed static from function
381
  * @access public
382
  * @param array $img The URL of the attachment image src, the width, the height
383
  * @return array
384
  */
385
+ public function attach_img_src( $img )
386
  {
387
+ if ( $img && $url = $this->rewrite( $img[ 0 ], LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_INC_IMG ) ) {
 
388
  $img[ 0 ] = $url ;
389
  }
390
  return $img ;
393
  /**
394
  * Try to rewrite one URL with CDN
395
  *
396
+ * @since 1.7
397
  * @access public
 
 
398
  */
399
+ public function url_img( $url )
400
  {
401
+ if ( $url && $url2 = $this->rewrite( $url, LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_INC_IMG ) ) {
402
+ $url = $url2 ;
403
+ }
404
+ return $url ;
405
+ }
406
+
407
+ /**
408
+ * Try to rewrite one URL with CDN
409
+ *
410
+ * @since 1.7
411
+ * @access public
412
+ */
413
+ public function url_css( $url )
414
+ {
415
+ if ( $url && $url2 = $this->rewrite( $url, LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_INC_CSS ) ) {
416
+ $url = $url2 ;
417
+ }
418
+ return $url ;
419
+ }
420
+
421
+ /**
422
+ * Try to rewrite one URL with CDN
423
+ *
424
+ * @since 1.7
425
+ * @access public
426
+ */
427
+ public function url_js( $url )
428
+ {
429
+ if ( $url && $url2 = $this->rewrite( $url, LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_INC_JS ) ) {
430
  $url = $url2 ;
431
  }
432
  return $url ;
436
  * Hook to replace WP responsive images
437
  *
438
  * @since 1.2.3
439
+ * @since 1.7 Removed static from function
440
  * @access public
441
  * @param array $srcs
442
  * @return array
443
  */
444
+ public function srcset( $srcs )
445
  {
446
  if ( $srcs ) {
 
447
  foreach ( $srcs as $w => $data ) {
448
+ if( ! $url = $this->rewrite( $data[ 'url' ], LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_INC_IMG ) ) {
449
  continue ;
450
  }
451
  $srcs[ $w ][ 'url' ] = $url ;
462
  * @param string $url
463
  * @return string Replaced URL
464
  */
465
+ public function rewrite( $url, $mapping_kind, $postfix = false )
466
  {
467
  LiteSpeed_Cache_Log::debug2( 'CDN: try rewriting ' . $url ) ;
468
  $url_parsed = parse_url( $url ) ;
503
  LiteSpeed_Cache_Log::debug2( 'CDN: scheme from url: ' . $scheme ) ;
504
  }
505
 
506
+ // Find the mapping url to be replaced to
507
+ if ( empty( $this->cfg_cdn_mapping[ $mapping_kind ] ) ) {
508
+ return false ;
509
+ }
510
+ if ( $mapping_kind !== LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_FILETYPE ) {
511
+ $final_url = $this->cfg_cdn_mapping[ $mapping_kind ] ;
512
+ }
513
+ else {
514
+ // select from file type
515
+ $final_url = $this->cfg_cdn_mapping[ $postfix ] ;
516
+ }
517
+
518
  // Now lets replace CDN url
519
  if ( strpos( $this->cfg_url_ori, '*' ) !== false ) {
520
+ $url = preg_replace( '#' . $scheme . $this->cfg_url_ori . '#iU', $final_url, $url ) ;
521
  }
522
  else {
523
+ $url = str_replace( $scheme . $this->cfg_url_ori, $final_url, $url ) ;
524
  }
525
  LiteSpeed_Cache_Log::debug2( 'CDN: after rewritten: ' . $url ) ;
526
 
553
  wp_register_script( 'jquery', $src, false, $v ) ;
554
  }
555
 
556
+ /**
557
+ * Get Cloudflare development mode
558
+ *
559
+ * @since 1.7.2
560
+ * @access private
561
+ */
562
+ private function _cloudflare_get_devmode( $show_msg = true )
563
+ {
564
+ LiteSpeed_Cache_Log::debug( 'CDN: _cloudflare_get_devmode' ) ;
565
+
566
+ $zone = $this->_cloudflare_zone() ;
567
+ if ( ! $zone ) {
568
+ return ;
569
+ }
570
+
571
+ $url = 'https://api.cloudflare.com/client/v4/zones/' . $zone . '/settings/development_mode' ;
572
+ $res = $this->_cloudflare_call( $url, 'GET', false, false, $show_msg ) ;
573
+
574
+ if ( ! $res ) {
575
+ return ;
576
+ }
577
+ LiteSpeed_Cache_Log::debug( 'CDN: _cloudflare_get_devmode result ', $res ) ;
578
+
579
+ $curr_status = get_option( LiteSpeed_Cache_Config::ITEM_CLOUDFLARE_STATUS, array() ) ;
580
+ $curr_status[ 'devmode' ] = $res[ 'value' ] ;
581
+ $curr_status[ 'devmode_expired' ] = $res[ 'time_remaining' ] + time() ;
582
+
583
+ // update status
584
+ update_option( LiteSpeed_Cache_Config::ITEM_CLOUDFLARE_STATUS, $curr_status ) ;
585
+
586
+ }
587
+
588
+ /**
589
+ * Set Cloudflare development mode
590
+ *
591
+ * @since 1.7.2
592
+ * @access private
593
+ */
594
+ private function _cloudflare_set_devmode( $type )
595
+ {
596
+ LiteSpeed_Cache_Log::debug( 'CDN: _cloudflare_set_devmode' ) ;
597
+
598
+ $zone = $this->_cloudflare_zone() ;
599
+ if ( ! $zone ) {
600
+ return ;
601
+ }
602
+
603
+ $url = 'https://api.cloudflare.com/client/v4/zones/' . $zone . '/settings/development_mode' ;
604
+ $new_val = $type == self::TYPE_CLOUDFLARE_SET_DEVMODE_ON ? 'on' : 'off' ;
605
+ $data = array( 'value' => $new_val ) ;
606
+ $res = $this->_cloudflare_call( $url, 'PATCH', $data ) ;
607
+
608
+ if ( ! $res ) {
609
+ return ;
610
+ }
611
+
612
+ $res = $this->_cloudflare_get_devmode( false ) ;
613
+
614
+ if ( $res ) {
615
+ $msg = sprintf( __( 'Notified Cloudflare to set development mode to %s successfully.', 'litespeed-cache' ), strtoupper( $new_val ) ) ;
616
+ LiteSpeed_Cache_Admin_Display::succeed( $msg ) ;
617
+ }
618
+
619
+ }
620
+
621
+ /**
622
+ * Purge Cloudflare cache
623
+ *
624
+ * @since 1.7.2
625
+ * @access private
626
+ */
627
+ private function _cloudflare_purge_all()
628
+ {
629
+ LiteSpeed_Cache_Log::debug( 'CDN: _cloudflare_purge_all' ) ;
630
+
631
+ $cf_on = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE ) ;
632
+ if ( ! $cf_on ) {
633
+ $msg = __( 'Cloudflare API is set to off.', 'litespeed-cache' ) ;
634
+ LiteSpeed_Cache_Admin_Display::error( $msg ) ;
635
+ return ;
636
+ }
637
+
638
+ $zone = $this->_cloudflare_zone() ;
639
+ if ( ! $zone ) {
640
+ return ;
641
+ }
642
+
643
+ $url = 'https://api.cloudflare.com/client/v4/zones/' . $zone . '/purge_cache' ;
644
+ $data = array( 'purge_everything' => true ) ;
645
+
646
+ $res = $this->_cloudflare_call( $url, 'DELETE', $data ) ;
647
+
648
+ if ( $res ) {
649
+ $msg = __( 'Notified Cloudflare to purge all successfully.', 'litespeed-cache' ) ;
650
+ LiteSpeed_Cache_Admin_Display::succeed( $msg ) ;
651
+ }
652
+ }
653
+
654
+ /**
655
+ * Get current Cloudflare zone from cfg
656
+ *
657
+ * @since 1.7.2
658
+ * @access private
659
+ */
660
+ private function _cloudflare_zone()
661
+ {
662
+ $zone = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE_ZONE ) ;
663
+ if ( ! $zone ) {
664
+ $msg = __( 'No available Cloudflare zone', 'litespeed-cache' ) ;
665
+ LiteSpeed_Cache_Admin_Display::error( $msg ) ;
666
+ return false ;
667
+ }
668
+
669
+ return $zone ;
670
+ }
671
+
672
+ /**
673
+ * Get Cloudflare zone settings
674
+ *
675
+ * @since 1.7.2
676
+ * @access public
677
+ */
678
+ public function cloudflare_fetch_zone( $options )
679
+ {
680
+ $url = 'https://api.cloudflare.com/client/v4/zones?status=active&match=all' ;
681
+
682
+ $zones = $this->_cloudflare_call( $url, 'GET', false, $options, false ) ;
683
+
684
+ if ( ! $zones ) {
685
+ return false ;
686
+ }
687
+
688
+ $kw = $options[ LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE_NAME ] ;
689
+ if ( ! $kw ) {
690
+ return $zones[ 0 ] ;
691
+ }
692
+
693
+ foreach ( $zones as $v ) {
694
+ if ( strpos( $v[ 'name' ], $kw ) !== false ) {
695
+ return $v ;
696
+ }
697
+ }
698
+
699
+ return $zones[ 0 ] ;
700
+ }
701
+
702
+ /**
703
+ * Cloudflare API
704
+ *
705
+ * @since 1.7.2
706
+ * @access private
707
+ */
708
+ private function _cloudflare_call( $url, $method = 'GET', $data = false, $token = false, $show_msg = true )
709
+ {
710
+ LiteSpeed_Cache_Log::debug( "CDN: _cloudflare_call \t\t[URL] $url" ) ;
711
+
712
+ $header = array(
713
+ 'Content-Type: application/json',
714
+ ) ;
715
+ if ( $token ) {
716
+ LiteSpeed_Cache_Log::debug2( 'CDN: _cloudflare_call use param token' ) ;
717
+ $header[] = 'X-Auth-Email: ' . $token[ LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE_EMAIL ] ;
718
+ $header[] = 'X-Auth-Key: ' . $token[ LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE_KEY ] ;
719
+ }
720
+ else {
721
+ $header[] = 'X-Auth-Email: ' . LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE_EMAIL ) ;
722
+ $header[] = 'X-Auth-Key: ' . LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE_KEY ) ;
723
+ }
724
+
725
+ $ch = curl_init() ;
726
+ curl_setopt( $ch, CURLOPT_URL, $url ) ;
727
+ curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, $method ) ;
728
+ curl_setopt( $ch, CURLOPT_HTTPHEADER, $header ) ;
729
+ curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ) ;
730
+ if ( $data ) {
731
+ if ( is_array( $data ) ) {
732
+ $data = json_encode( $data ) ;
733
+ }
734
+ curl_setopt( $ch, CURLOPT_POSTFIELDS, $data ) ;
735
+ }
736
+ $result = curl_exec( $ch ) ;
737
+
738
+ $json = json_decode( $result, true ) ;
739
+
740
+ if ( $json && $json[ 'success' ] && $json[ 'result' ] ) {
741
+ LiteSpeed_Cache_Log::debug( "CDN: _cloudflare_call called successfully" ) ;
742
+ if ( $show_msg ) {
743
+ $msg = __( 'Communicated with Cloudflare successfully.', 'litespeed-cache' ) ;
744
+ LiteSpeed_Cache_Admin_Display::succeed( $msg ) ;
745
+ }
746
+
747
+ return $json[ 'result' ] ;
748
+ }
749
+
750
+ LiteSpeed_Cache_Log::debug( "CDN: _cloudflare_call called failed: $result" ) ;
751
+ if ( $show_msg ) {
752
+ $msg = __( 'Failed to communicate with Cloudflare', 'litespeed-cache' ) ;
753
+ LiteSpeed_Cache_Admin_Display::error( $msg ) ;
754
+ }
755
+
756
+ return false ;
757
+ }
758
+
759
  /**
760
  * Get the current instance object.
761
  *
inc/config.class.php CHANGED
@@ -23,6 +23,17 @@ class LiteSpeed_Cache_Config
23
  const ITEM_MEDIA_LAZY_IMG_EXC = 'litespeed-media-lazy-img-excludes' ;
24
  const ITEM_MEDIA_NEED_PULL = 'litespeed-media-need-pull' ;
25
  const ITEM_ENV_REF = 'litespeed-env-ref' ;
 
 
 
 
 
 
 
 
 
 
 
26
 
27
  const VAL_OFF = 0 ;
28
  const VAL_ON = 1 ;
@@ -54,6 +65,7 @@ class LiteSpeed_Cache_Config
54
 
55
  const OPID_LOGIN_COOKIE = 'login_cookie' ;
56
  const OPID_CHECK_ADVANCEDCACHE = 'check_advancedcache' ;
 
57
  // do NOT set default options for these three, it is used for admin.
58
  const ID_NOCACHE_COOKIES = 'nocache_cookies' ;
59
  const ID_NOCACHE_USERAGENTS = 'nocache_useragents' ;
@@ -95,6 +107,8 @@ class LiteSpeed_Cache_Config
95
  const OPID_EXCLUDES_CAT = 'excludes_cat' ;
96
  const OPID_EXCLUDES_TAG = 'excludes_tag' ;
97
 
 
 
98
  const OPID_CSS_MINIFY = 'css_minify' ;
99
  const OPID_CSS_COMBINE = 'css_combine' ;
100
  const OPID_CSS_COMBINED_PRIORITY = 'css_combined_priority' ;
@@ -115,16 +129,18 @@ class LiteSpeed_Cache_Config
115
  const OPID_OPTM_EXCLUDES = 'optm_excludes' ;
116
  const OPID_OPTM_EXC_JQUERY = 'optm_exclude_jquery' ;
117
  const OPID_OPTM_GGFONTS_ASYNC = 'optm_ggfonts_async' ;
 
 
118
 
119
  const OPID_CDN = 'cdn' ;
120
  const OPID_CDN_ORI = 'cdn_ori' ;
121
- const OPID_CDN_URL = 'cdn_url' ;
122
- const OPID_CDN_INC_IMG = 'cdn_inc_img' ;
123
- const OPID_CDN_INC_CSS = 'cdn_inc_css' ;
124
- const OPID_CDN_INC_JS = 'cdn_inc_js' ;
125
- const OPID_CDN_FILETYPE = 'cdn_filetype' ;
126
  const OPID_CDN_EXCLUDE = 'cdn_exclude' ;
127
  const OPID_CDN_REMOTE_JQUERY = 'cdn_remote_jquery' ;
 
 
 
 
 
128
 
129
  const OPID_MEDIA_IMG_LAZY = 'media_img_lazy' ;
130
  const OPID_MEDIA_IMG_LAZY_PLACEHOLDER = 'media_img_lazy_placeholder' ;
@@ -199,13 +215,13 @@ class LiteSpeed_Cache_Config
199
  }
200
 
201
  // Vary group settings
202
- $this->vary_groups = (array) get_option( self::VARY_GROUP ) ;
203
 
204
  // Exclude optimization role setting
205
- $this->exclude_optimization_roles = (array) get_option( self::EXCLUDE_OPTIMIZATION_ROLES ) ;
206
 
207
  // Exclude cache role setting
208
- $this->exclude_cache_roles = (array) get_option( self::EXCLUDE_CACHE_ROLES ) ;
209
 
210
  // Set security key if not initialized yet
211
  if ( isset( $this->options[ self::HASH ] ) && empty( $this->options[ self::HASH ] ) ) {
@@ -512,6 +528,7 @@ class LiteSpeed_Cache_Config
512
 
513
  self::OPID_LOGIN_COOKIE => '',
514
  self::OPID_CHECK_ADVANCEDCACHE => true,
 
515
  self::OPID_DEBUG => self::LOG_LEVEL_NONE,
516
  self::OPID_ADMIN_IPS => '127.0.0.1',
517
  self::OPID_DEBUG_LEVEL => false,
@@ -535,6 +552,8 @@ class LiteSpeed_Cache_Config
535
  self::OPID_EXCLUDES_CAT => '',
536
  self::OPID_EXCLUDES_TAG => '',
537
 
 
 
538
  self::OPID_CSS_MINIFY => false,
539
  self::OPID_CSS_COMBINE => false,
540
  self::OPID_CSS_COMBINED_PRIORITY => false,
@@ -555,16 +574,18 @@ class LiteSpeed_Cache_Config
555
  self::OPID_OPTM_EXCLUDES => '',
556
  self::OPID_OPTM_EXC_JQUERY => true,
557
  self::OPID_OPTM_GGFONTS_ASYNC => false,
 
 
558
 
559
  self::OPID_CDN => false,
560
  self::OPID_CDN_ORI => '',
561
- self::OPID_CDN_URL => '',
562
- self::OPID_CDN_INC_IMG => false,
563
- self::OPID_CDN_INC_CSS => false,
564
- self::OPID_CDN_INC_JS => false,
565
- self::OPID_CDN_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",
566
  self::OPID_CDN_EXCLUDE => '',
567
  self::OPID_CDN_REMOTE_JQUERY => false,
 
 
 
 
 
568
 
569
  self::OPID_MEDIA_IMG_LAZY => false,
570
  self::OPID_MEDIA_IMG_LAZY_PLACEHOLDER => '',
@@ -769,12 +790,28 @@ class LiteSpeed_Cache_Config
769
  return ;
770
  }
771
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
772
  $this->options = self::option_diff( $default_options, $this->options ) ;
773
 
774
  $res = $this->update_options() ;
775
  define( 'LSWCP_EMPTYCACHE', true ) ;// clear all sites caches
776
  LiteSpeed_Cache_Purge::purge_all() ;
777
- LiteSpeed_Cache_Log::debug( "plugin_upgrade option changed = $res\n" ) ;
778
  }
779
 
780
  /**
23
  const ITEM_MEDIA_LAZY_IMG_EXC = 'litespeed-media-lazy-img-excludes' ;
24
  const ITEM_MEDIA_NEED_PULL = 'litespeed-media-need-pull' ;
25
  const ITEM_ENV_REF = 'litespeed-env-ref' ;
26
+ const ITEM_CACHE_DROP_QS = 'litespeed-cache-drop_qs' ;
27
+ const ITEM_CDN_MAPPING = 'litespeed-cache-cdn_mapping' ;
28
+ const ITEM_DNS_PREFETCH = 'litespeed-cache-dns_prefetch' ;
29
+ const ITEM_CLOUDFLARE_STATUS = 'litespeed-cache-cloudflare_status' ;
30
+ // const ITEM_FAVICON = 'litespeed-cache-favicon' ;
31
+
32
+ const ITEM_CDN_MAPPING_URL = 'url' ;
33
+ const ITEM_CDN_MAPPING_INC_IMG = 'inc_img' ;
34
+ const ITEM_CDN_MAPPING_INC_CSS = 'inc_css' ;
35
+ const ITEM_CDN_MAPPING_INC_JS = 'inc_js' ;
36
+ const ITEM_CDN_MAPPING_FILETYPE = 'filetype' ;
37
 
38
  const VAL_OFF = 0 ;
39
  const VAL_ON = 1 ;
65
 
66
  const OPID_LOGIN_COOKIE = 'login_cookie' ;
67
  const OPID_CHECK_ADVANCEDCACHE = 'check_advancedcache' ;
68
+ const OPID_USE_HTTP_FOR_HTTPS_VARY = 'use_http_for_https_vary' ;
69
  // do NOT set default options for these three, it is used for admin.
70
  const ID_NOCACHE_COOKIES = 'nocache_cookies' ;
71
  const ID_NOCACHE_USERAGENTS = 'nocache_useragents' ;
107
  const OPID_EXCLUDES_CAT = 'excludes_cat' ;
108
  const OPID_EXCLUDES_TAG = 'excludes_tag' ;
109
 
110
+ // const OPID_ADV_FAVICON = 'adv_favicon' ;
111
+
112
  const OPID_CSS_MINIFY = 'css_minify' ;
113
  const OPID_CSS_COMBINE = 'css_combine' ;
114
  const OPID_CSS_COMBINED_PRIORITY = 'css_combined_priority' ;
129
  const OPID_OPTM_EXCLUDES = 'optm_excludes' ;
130
  const OPID_OPTM_EXC_JQUERY = 'optm_exclude_jquery' ;
131
  const OPID_OPTM_GGFONTS_ASYNC = 'optm_ggfonts_async' ;
132
+ const OPID_OPTM_MAX_SIZE = 'optm_max_size' ;
133
+ const OPID_OPTM_RM_COMMENT = 'optm_rm_comment' ;
134
 
135
  const OPID_CDN = 'cdn' ;
136
  const OPID_CDN_ORI = 'cdn_ori' ;
 
 
 
 
 
137
  const OPID_CDN_EXCLUDE = 'cdn_exclude' ;
138
  const OPID_CDN_REMOTE_JQUERY = 'cdn_remote_jquery' ;
139
+ const OPID_CDN_CLOUDFLARE = 'cdn_cloudflare' ;
140
+ const OPID_CDN_CLOUDFLARE_EMAIL = 'cdn_cloudflare_email' ;
141
+ const OPID_CDN_CLOUDFLARE_KEY = 'cdn_cloudflare_key' ;
142
+ const OPID_CDN_CLOUDFLARE_NAME = 'cdn_cloudflare_name' ;
143
+ const OPID_CDN_CLOUDFLARE_ZONE = 'cdn_cloudflare_zone' ;
144
 
145
  const OPID_MEDIA_IMG_LAZY = 'media_img_lazy' ;
146
  const OPID_MEDIA_IMG_LAZY_PLACEHOLDER = 'media_img_lazy_placeholder' ;
215
  }
216
 
217
  // Vary group settings
218
+ $this->vary_groups = get_option( self::VARY_GROUP, array() ) ;
219
 
220
  // Exclude optimization role setting
221
+ $this->exclude_optimization_roles = get_option( self::EXCLUDE_OPTIMIZATION_ROLES, array() ) ;
222
 
223
  // Exclude cache role setting
224
+ $this->exclude_cache_roles = get_option( self::EXCLUDE_CACHE_ROLES, array() ) ;
225
 
226
  // Set security key if not initialized yet
227
  if ( isset( $this->options[ self::HASH ] ) && empty( $this->options[ self::HASH ] ) ) {
528
 
529
  self::OPID_LOGIN_COOKIE => '',
530
  self::OPID_CHECK_ADVANCEDCACHE => true,
531
+ self::OPID_USE_HTTP_FOR_HTTPS_VARY => false,
532
  self::OPID_DEBUG => self::LOG_LEVEL_NONE,
533
  self::OPID_ADMIN_IPS => '127.0.0.1',
534
  self::OPID_DEBUG_LEVEL => false,
552
  self::OPID_EXCLUDES_CAT => '',
553
  self::OPID_EXCLUDES_TAG => '',
554
 
555
+ // self::OPID_ADV_FAVICON => false,
556
+
557
  self::OPID_CSS_MINIFY => false,
558
  self::OPID_CSS_COMBINE => false,
559
  self::OPID_CSS_COMBINED_PRIORITY => false,
574
  self::OPID_OPTM_EXCLUDES => '',
575
  self::OPID_OPTM_EXC_JQUERY => true,
576
  self::OPID_OPTM_GGFONTS_ASYNC => false,
577
+ self::OPID_OPTM_MAX_SIZE => 1.2,
578
+ self::OPID_OPTM_RM_COMMENT => false,
579
 
580
  self::OPID_CDN => false,
581
  self::OPID_CDN_ORI => '',
 
 
 
 
 
582
  self::OPID_CDN_EXCLUDE => '',
583
  self::OPID_CDN_REMOTE_JQUERY => false,
584
+ self::OPID_CDN_CLOUDFLARE => false,
585
+ self::OPID_CDN_CLOUDFLARE_EMAIL => '',
586
+ self::OPID_CDN_CLOUDFLARE_KEY => '',
587
+ self::OPID_CDN_CLOUDFLARE_NAME => '',
588
+ self::OPID_CDN_CLOUDFLARE_ZONE => '',
589
 
590
  self::OPID_MEDIA_IMG_LAZY => false,
591
  self::OPID_MEDIA_IMG_LAZY_PLACEHOLDER => '',
790
  return ;
791
  }
792
 
793
+ /**
794
+ * Resave cdn cfg from lscfg to separate cfg when upgrade to v1.7
795
+ * @since 1.7
796
+ */
797
+ if ( isset( $this->options[ 'cdn_url' ] ) ) {
798
+ $cdn_mapping = array(
799
+ self::ITEM_CDN_MAPPING_URL => $this->options[ 'cdn_url' ],
800
+ self::ITEM_CDN_MAPPING_INC_IMG => $this->options[ 'cdn_inc_img' ],
801
+ self::ITEM_CDN_MAPPING_INC_CSS => $this->options[ 'cdn_inc_css' ],
802
+ self::ITEM_CDN_MAPPING_INC_JS => $this->options[ 'cdn_inc_js' ],
803
+ self::ITEM_CDN_MAPPING_FILETYPE => $this->options[ 'cdn_filetype' ],
804
+ ) ;
805
+ update_option( LiteSpeed_Cache_Config::ITEM_CDN_MAPPING, array( $cdn_mapping ) ) ;
806
+ LiteSpeed_Cache_Log::debug( "Config: plugin_upgrade option adding CDN map" ) ;
807
+ }
808
+
809
  $this->options = self::option_diff( $default_options, $this->options ) ;
810
 
811
  $res = $this->update_options() ;
812
  define( 'LSWCP_EMPTYCACHE', true ) ;// clear all sites caches
813
  LiteSpeed_Cache_Purge::purge_all() ;
814
+ LiteSpeed_Cache_Log::debug( "Config: plugin_upgrade option changed = $res" ) ;
815
  }
816
 
817
  /**
inc/control.class.php CHANGED
@@ -16,6 +16,7 @@ class LiteSpeed_Cache_Control
16
  const BM_PRIVATE = 2 ;
17
  const BM_SHARED = 4 ;
18
  const BM_NO_VARY = 8 ;
 
19
  const BM_STALE = 128 ;
20
  const BM_NOTCACHEABLE = 256 ;
21
 
@@ -171,6 +172,36 @@ class LiteSpeed_Cache_Control
171
  return (self::$_control & self::BM_SHARED) && self::is_private() ;
172
  }
173
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
174
  /**
175
  * Set cache control to private
176
  *
@@ -187,7 +218,7 @@ class LiteSpeed_Cache_Control
187
  if ( $reason ) {
188
  $reason = "( $reason )" ;
189
  }
190
- LiteSpeed_Cache_Log::debug( 'X Cache_control -> private ' . $reason) ;
191
  }
192
 
193
  /**
@@ -198,7 +229,7 @@ class LiteSpeed_Cache_Control
198
  */
199
  public static function is_private()
200
  {
201
- return self::$_control & self::BM_PRIVATE ;
202
  }
203
 
204
  /**
16
  const BM_PRIVATE = 2 ;
17
  const BM_SHARED = 4 ;
18
  const BM_NO_VARY = 8 ;
19
+ const BM_PUBLIC_FORCED = 64 ;
20
  const BM_STALE = 128 ;
21
  const BM_NOTCACHEABLE = 256 ;
22
 
172
  return (self::$_control & self::BM_SHARED) && self::is_private() ;
173
  }
174
 
175
+ /**
176
+ * Set cache control to forced public
177
+ *
178
+ * @access public
179
+ * @since 1.7.1
180
+ * @param string $reason The reason to no cache
181
+ */
182
+ public static function set_public_forced( $reason = false )
183
+ {
184
+ if ( self::is_public_forced() ) {
185
+ return ;
186
+ }
187
+ self::$_control |= self::BM_PUBLIC_FORCED ;
188
+ if ( $reason ) {
189
+ $reason = "( $reason )" ;
190
+ }
191
+ LiteSpeed_Cache_Log::debug( 'X Cache_control -> public forced ' . $reason ) ;
192
+ }
193
+
194
+ /**
195
+ * Check if is public forced
196
+ *
197
+ * @access public
198
+ * @since 1.7.1
199
+ */
200
+ public static function is_public_forced()
201
+ {
202
+ return self::$_control & self::BM_PUBLIC_FORCED ;
203
+ }
204
+
205
  /**
206
  * Set cache control to private
207
  *
218
  if ( $reason ) {
219
  $reason = "( $reason )" ;
220
  }
221
+ LiteSpeed_Cache_Log::debug( 'X Cache_control -> private ' . $reason ) ;
222
  }
223
 
224
  /**
229
  */
230
  public static function is_private()
231
  {
232
+ return self::$_control & self::BM_PRIVATE && ! self::is_public_forced() ;
233
  }
234
 
235
  /**
inc/gui.class.php CHANGED
@@ -33,16 +33,50 @@ class LiteSpeed_Cache_GUI
33
  add_action( 'wp_enqueue_scripts', array( $this, 'frontend_enqueue_style' ) ) ;
34
  add_action( 'admin_bar_menu', array( $this, 'frontend_shortcut' ), 95 ) ;
35
  }
 
 
 
 
 
 
 
 
 
36
  }
37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  public static function pie( $percent, $width = 50 )
39
  {
40
  return "
41
- <svg class='litespeed-media-svg' width='$width' viewBox='0 0 33.83098862 33.83098862' xmlns='http://www.w3.org/2000/svg'>
42
- <circle class='litespeed-pie_bg' cx='17.5' cy='17.5' r='16.5'></circle>
43
- <circle class='litespeed-pie_circle' cx='17' cy='17.5' r='16.5'></circle>
44
  <g class='litespeed-pie_info'>
45
- <text x='16.91549431' y='15.5' alignment-baseline='central' text-anchor='middle'>$percent%</text>
46
  </g>
47
  </svg>
48
  ";
@@ -138,8 +172,8 @@ class LiteSpeed_Cache_GUI
138
  */
139
  public function frontend_shortcut()
140
  {
141
-
142
  global $wp_admin_bar ;
 
143
  $wp_admin_bar->add_menu( array(
144
  'id' => 'litespeed-menu',
145
  'title' => '<span class="ab-icon"></span>',
@@ -191,6 +225,63 @@ class LiteSpeed_Cache_GUI
191
  ) );
192
  }
193
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
194
  /**
195
  * Finalize buffer by GUI class
196
  *
33
  add_action( 'wp_enqueue_scripts', array( $this, 'frontend_enqueue_style' ) ) ;
34
  add_action( 'admin_bar_menu', array( $this, 'frontend_shortcut' ), 95 ) ;
35
  }
36
+
37
+ // if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_ADV_FAVICON ) ) {
38
+ // if ( is_admin() ) {
39
+ // add_action( 'admin_head', array( $this, 'favicon' ) ) ;
40
+ // }
41
+ // else {
42
+ // add_action( 'wp_head', array( $this, 'favicon' ) ) ;
43
+ // }
44
+ // }
45
  }
46
 
47
+ /**
48
+ * Display the favicon
49
+ *
50
+ * @since 1.7.2
51
+ */
52
+ // public function favicon()
53
+ // {
54
+ // $current_favicon = get_option( LiteSpeed_Cache_Config::ITEM_FAVICON, array() ) ;
55
+ // if ( is_admin() ) {
56
+ // if ( ! empty( $current_favicon[ 'backend' ] ) ) {
57
+ // echo "<link rel='icon' href='$current_favicon[backend]' />" ;
58
+ // }
59
+ // }
60
+ // else {
61
+ // if ( ! empty( $current_favicon[ 'frontend' ] ) ) {
62
+ // echo "<link rel='icon' href='$current_favicon[frontend]' />" ;
63
+ // }
64
+ // }
65
+ // }
66
+
67
+ /**
68
+ * Display a pie
69
+ *
70
+ * @since 1.6.6
71
+ */
72
  public static function pie( $percent, $width = 50 )
73
  {
74
  return "
75
+ <svg class='litespeed-pie' viewbox='0 0 33.83098862 33.83098862' width='$width' height='$width' xmlns='http://www.w3.org/2000/svg'>
76
+ <circle class='litespeed-pie_bg' />
77
+ <circle class='litespeed-pie_circle' stroke-dasharray='$percent,100' />
78
  <g class='litespeed-pie_info'>
79
+ <text x='16.91549431' y='15.5'>$percent%</text>
80
  </g>
81
  </svg>
82
  ";
172
  */
173
  public function frontend_shortcut()
174
  {
 
175
  global $wp_admin_bar ;
176
+
177
  $wp_admin_bar->add_menu( array(
178
  'id' => 'litespeed-menu',
179
  'title' => '<span class="ab-icon"></span>',
225
  ) );
226
  }
227
 
228
+ /**
229
+ * Hooked to wp_before_admin_bar_render.
230
+ * Adds a link to the admin bar so users can quickly purge all.
231
+ *
232
+ * @access public
233
+ * @global WP_Admin_Bar $wp_admin_bar
234
+ * @since 1.7.2 Moved from admin_display.cls to gui.cls; Renamed from `add_quick_purge` to `backend_shortcut`
235
+ */
236
+ public function backend_shortcut()
237
+ {
238
+ global $wp_admin_bar ;
239
+
240
+ $wp_admin_bar->add_menu( array(
241
+ 'id' => 'litespeed-menu',
242
+ 'title' => '<span class="ab-icon"></span><span class="ab-label">' . __( 'LiteSpeed Cache Purge All', 'litespeed-cache' ) . '</span>',
243
+ 'href' => LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_PURGE_ALL ),
244
+ 'meta' => array( 'tabindex' => 0, 'class' => 'litespeed-top-toolbar' ),
245
+ ) ) ;
246
+
247
+ $wp_admin_bar->add_menu( array(
248
+ 'parent' => 'litespeed-menu',
249
+ 'id' => 'litespeed-bar-manage',
250
+ 'title' => __( 'Manage', 'litespeed-cache' ),
251
+ 'href' => 'admin.php?page=lscache-dash',
252
+ 'meta' => array( 'tabindex' => '0' ),
253
+ ) );
254
+
255
+ $wp_admin_bar->add_menu( array(
256
+ 'parent' => 'litespeed-menu',
257
+ 'id' => 'litespeed-bar-setting',
258
+ 'title' => __( 'Settings', 'litespeed-cache' ),
259
+ 'href' => 'admin.php?page=lscache-settings',
260
+ 'meta' => array( 'tabindex' => '0' ),
261
+ ) );
262
+
263
+ if ( ! is_network_admin() ) {
264
+ $wp_admin_bar->add_menu( array(
265
+ 'parent' => 'litespeed-menu',
266
+ 'id' => 'litespeed-bar-imgoptm',
267
+ 'title' => __( 'Image Optimization', 'litespeed-cache' ),
268
+ 'href' => 'admin.php?page=lscache-optimization',
269
+ 'meta' => array( 'tabindex' => '0' ),
270
+ ) );
271
+ }
272
+
273
+ if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE ) ) {
274
+ $wp_admin_bar->add_menu( array(
275
+ 'parent' => 'litespeed-menu',
276
+ 'id' => 'litespeed-purge-cloudflare',
277
+ 'title' => __( 'Cloudflare Purge All', 'litespeed-cache' ),
278
+ 'href' => LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_CDN, LiteSpeed_Cache_CDN::TYPE_CLOUDFLARE_PURGE_ALL ),
279
+ 'meta' => array( 'tabindex' => '0' ),
280
+ ) );
281
+ }
282
+
283
+ }
284
+
285
  /**
286
  * Finalize buffer by GUI class
287
  *
inc/litespeed-cache.class.php CHANGED
@@ -19,7 +19,7 @@ class LiteSpeed_Cache
19
  private static $_instance ;
20
 
21
  const PLUGIN_NAME = 'litespeed-cache' ;
22
- const PLUGIN_VERSION = '1.6.7' ;
23
 
24
  const PAGE_EDIT_HTACCESS = 'lscache-edit-htaccess' ;
25
 
@@ -55,6 +55,8 @@ class LiteSpeed_Cache
55
  const ACTION_LOG = 'log' ;
56
 
57
  const ACTION_MEDIA = 'media' ;
 
 
58
  const ACTION_REPORT = 'report' ;
59
  const ACTION_SAPI_PASSIVE_CALLBACK = 'sapi_passive_callback' ;
60
  const ACTION_SAPI_AGGRESSIVE_CALLBACK = 'sapi_aggressive_callback' ;
@@ -307,6 +309,14 @@ class LiteSpeed_Cache
307
  $msg = LiteSpeed_Cache_Media::handler() ;
308
  break ;
309
 
 
 
 
 
 
 
 
 
310
  case LiteSpeed_Cache::ACTION_LOG:
311
  $msg = LiteSpeed_Cache_Log::handler() ;
312
  break ;
19
  private static $_instance ;
20
 
21
  const PLUGIN_NAME = 'litespeed-cache' ;
22
+ const PLUGIN_VERSION = '1.7.2' ;
23
 
24
  const PAGE_EDIT_HTACCESS = 'lscache-edit-htaccess' ;
25
 
55
  const ACTION_LOG = 'log' ;
56
 
57
  const ACTION_MEDIA = 'media' ;
58
+ const ACTION_IAPI = 'iapi' ;
59
+ const ACTION_CDN = 'cdn' ;
60
  const ACTION_REPORT = 'report' ;
61
  const ACTION_SAPI_PASSIVE_CALLBACK = 'sapi_passive_callback' ;
62
  const ACTION_SAPI_AGGRESSIVE_CALLBACK = 'sapi_aggressive_callback' ;
309
  $msg = LiteSpeed_Cache_Media::handler() ;
310
  break ;
311
 
312
+ case LiteSpeed_Cache::ACTION_IAPI:
313
+ $msg = LiteSpeed_Cache_Admin_API::handler() ;
314
+ break ;
315
+
316
+ case LiteSpeed_Cache::ACTION_CDN:
317
+ $msg = LiteSpeed_Cache_CDN::handler() ;
318
+ break ;
319
+
320
  case LiteSpeed_Cache::ACTION_LOG:
321
  $msg = LiteSpeed_Cache_Log::handler() ;
322
  break ;
inc/media.class.php CHANGED
@@ -205,7 +205,7 @@ class LiteSpeed_Cache_Media
205
  $info_ori = sprintf( '%s %s', $pie_ori, $txt_ori ) ;
206
  }
207
 
208
- echo "<p class='$cls_webp'>$info_webp $link_webp</p><p class='$cls_ori'>$info_ori $link_ori</p>" ;
209
  }
210
 
211
  /**
@@ -405,6 +405,7 @@ class LiteSpeed_Cache_Media
405
  LiteSpeed_Cache_Log::debug( 'Media run lazyload lib' ) ;
406
 
407
  LiteSpeed_Cache_Control::set_cacheable() ;
 
408
  LiteSpeed_Cache_Control::set_no_vary() ;
409
  LiteSpeed_Cache_Control::set_custom_ttl( 8640000 ) ;
410
  LiteSpeed_Cache_Tag::add( LiteSpeed_Cache_Tag::TYPE_MIN . '_LAZY' ) ;
@@ -1122,7 +1123,7 @@ class LiteSpeed_Cache_Media
1122
  $list = $wpdb->get_results( $wpdb->prepare( $q, array( self::DB_IMG_OPTIMIZE_STATUS, self::DB_IMG_OPTIMIZE_DATA, $limit_rows ) ) ) ;
1123
  if ( ! $list ) {
1124
  LiteSpeed_Cache_Log::debug( 'Media: resend request bypassed: no image found' ) ;
1125
- $msg = __( 'No image found', 'litespeed-cache' ) ;
1126
  LiteSpeed_Cache_Admin_Display::error( $msg ) ;
1127
  return ;
1128
  }
@@ -1440,7 +1441,7 @@ class LiteSpeed_Cache_Media
1440
  */
1441
  private function _update_credit( $credit )
1442
  {
1443
- $summary = (array) get_option( self::DB_IMG_OPTM_SUMMARY ) ;
1444
  $summary[ 'credit' ] = $credit ;
1445
 
1446
  update_option( self::DB_IMG_OPTM_SUMMARY, $summary ) ;
@@ -1454,7 +1455,7 @@ class LiteSpeed_Cache_Media
1454
  */
1455
  public function summary_info( $field = false )
1456
  {
1457
- $optm_summary = (array) get_option( self::DB_IMG_OPTM_SUMMARY ) ;
1458
 
1459
  if ( ! $field ) {
1460
  return $optm_summary ;
205
  $info_ori = sprintf( '%s %s', $pie_ori, $txt_ori ) ;
206
  }
207
 
208
+ echo "<p class='litespeed-media-p $cls_webp'>$info_webp $link_webp</p><p class='litespeed-media-p $cls_ori'>$info_ori $link_ori</p>" ;
209
  }
210
 
211
  /**
405
  LiteSpeed_Cache_Log::debug( 'Media run lazyload lib' ) ;
406
 
407
  LiteSpeed_Cache_Control::set_cacheable() ;
408
+ LiteSpeed_Cache_Control::set_public_forced( 'OPTM: lazyload js' ) ;
409
  LiteSpeed_Cache_Control::set_no_vary() ;
410
  LiteSpeed_Cache_Control::set_custom_ttl( 8640000 ) ;
411
  LiteSpeed_Cache_Tag::add( LiteSpeed_Cache_Tag::TYPE_MIN . '_LAZY' ) ;
1123
  $list = $wpdb->get_results( $wpdb->prepare( $q, array( self::DB_IMG_OPTIMIZE_STATUS, self::DB_IMG_OPTIMIZE_DATA, $limit_rows ) ) ) ;
1124
  if ( ! $list ) {
1125
  LiteSpeed_Cache_Log::debug( 'Media: resend request bypassed: no image found' ) ;
1126
+ $msg = __( 'No image found.', 'litespeed-cache' ) ;
1127
  LiteSpeed_Cache_Admin_Display::error( $msg ) ;
1128
  return ;
1129
  }
1441
  */
1442
  private function _update_credit( $credit )
1443
  {
1444
+ $summary = get_option( self::DB_IMG_OPTM_SUMMARY, array() ) ;
1445
  $summary[ 'credit' ] = $credit ;
1446
 
1447
  update_option( self::DB_IMG_OPTM_SUMMARY, $summary ) ;
1455
  */
1456
  public function summary_info( $field = false )
1457
  {
1458
+ $optm_summary = get_option( self::DB_IMG_OPTM_SUMMARY, array() ) ;
1459
 
1460
  if ( ! $field ) {
1461
  return $optm_summary ;
inc/optimize.class.php CHANGED
@@ -33,7 +33,9 @@ class LiteSpeed_Cache_Optimize
33
  private $cfg_qs_rm ;
34
  private $cfg_exc_jquery ;
35
  private $cfg_ggfonts_async ;
 
36
 
 
37
 
38
  private $html_foot = '' ; // The html info append to <body>
39
  private $html_head = '' ; // The html info prepend to <body>
@@ -66,6 +68,7 @@ class LiteSpeed_Cache_Optimize
66
  $this->cfg_qs_rm = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTM_QS_RM ) ;
67
  $this->cfg_exc_jquery = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTM_EXC_JQUERY ) ;
68
  $this->cfg_ggfonts_async = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTM_GGFONTS_ASYNC ) ;
 
69
 
70
  $this->_static_request_check() ;
71
 
@@ -105,6 +108,12 @@ class LiteSpeed_Cache_Optimize
105
  */
106
  add_filter( 'litespeed_vary', array( $this, 'vary_add_role_exclude' ) ) ;
107
 
 
 
 
 
 
 
108
  }
109
 
110
  /**
@@ -175,11 +184,12 @@ class LiteSpeed_Cache_Optimize
175
  LiteSpeed_Cache_Log::debug( 'Optimizer start serving static file' ) ;
176
 
177
  LiteSpeed_Cache_Control::set_cacheable() ;
 
178
  LiteSpeed_Cache_Control::set_no_vary() ;
179
  LiteSpeed_Cache_Control::set_custom_ttl( 8640000 ) ;
180
  LiteSpeed_Cache_Tag::add( LiteSpeed_Cache_Tag::TYPE_MIN . '_CSS_ASYNC' ) ;
181
 
182
- $file = LSWCP_DIR . 'js/css_async.js' ;
183
 
184
  header( 'Content-Length: ' . filesize( $file ) ) ;
185
  header( 'Content-Type: application/x-javascript; charset=utf-8' ) ;
@@ -221,6 +231,7 @@ class LiteSpeed_Cache_Optimize
221
  }
222
 
223
  LiteSpeed_Cache_Control::set_cacheable() ;
 
224
  LiteSpeed_Cache_Control::set_no_vary() ;
225
  LiteSpeed_Cache_Control::set_custom_ttl( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTIMIZE_TTL ) ) ;
226
  LiteSpeed_Cache_Tag::add( LiteSpeed_Cache_Tag::TYPE_MIN ) ;
@@ -388,7 +399,7 @@ class LiteSpeed_Cache_Optimize
388
  }
389
 
390
  // Move all css to top
391
- $this->content = str_replace( $html_list, '', $this->content ) ;
392
 
393
  // Add to HTTP2
394
  foreach ( $urls as $url ) {
@@ -614,6 +625,63 @@ class LiteSpeed_Cache_Optimize
614
 
615
  }
616
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
617
  /**
618
  * Limit combined filesize when build hash url
619
  *
@@ -633,7 +701,7 @@ class LiteSpeed_Cache_Optimize
633
 
634
  $total += $file_size_list[ $k ] ;
635
 
636
- if ( $total > 1000000 ) { // If larger than 1M, separate them
637
  $total = 0;
638
  $i ++ ;
639
  }
@@ -695,15 +763,15 @@ class LiteSpeed_Cache_Optimize
695
  */
696
  private function _analyse_links( $src_list, $html_list, $file_type = 'css' )
697
  {
698
- if ( $file_type == 'css' ) {
699
- $excludes = apply_filters( 'litespeed_cache_optimize_css_excludes', LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CSS_EXCLUDES ) ) ;
700
- }
701
- else {
702
- $excludes = apply_filters( 'litespeed_cache_optimize_js_excludes', LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_JS_EXCLUDES ) ) ;
703
- }
704
- if ( $excludes ) {
705
- $excludes = explode( "\n", $excludes ) ;
706
- }
707
 
708
  $ignored_html = array() ;
709
  $src_queue_list = array() ;
@@ -713,15 +781,15 @@ class LiteSpeed_Cache_Optimize
713
  foreach ( $src_list as $key => $src ) {
714
  LiteSpeed_Cache_Log::debug2( 'Optm: ' . $src ) ;
715
 
716
- if ( $excludes ) {
717
- foreach ( $excludes as $exclude ) {
718
- if ( stripos( $src, $exclude ) !== false ) {
719
- $ignored_html[] = $html_list[ $key ] ;
720
- LiteSpeed_Cache_Log::debug2( 'Optm: Abort excludes: ' . $exclude ) ;
721
- continue 2 ;
722
- }
723
- }
724
- }
725
 
726
  // Check if has no-optimize attr
727
  if ( strpos( $html_list[ $key ], 'data-no-optimize' ) !== false ) {
@@ -856,6 +924,11 @@ class LiteSpeed_Cache_Optimize
856
  */
857
  private function _parse_js()
858
  {
 
 
 
 
 
859
  $src_list = array() ;
860
  $html_list = array() ;
861
  $head_src_list = array() ;
@@ -884,6 +957,11 @@ class LiteSpeed_Cache_Optimize
884
  if ( in_array( $match[ 0 ], $html_list ) ) {
885
  continue ;
886
  }
 
 
 
 
 
887
 
888
  $src_list[] = $attrs[ 'src' ] ;
889
  $html_list[] = $match[ 0 ] ;
@@ -905,6 +983,11 @@ class LiteSpeed_Cache_Optimize
905
  */
906
  private function _handle_css()
907
  {
 
 
 
 
 
908
  $this->css_to_be_removed = apply_filters( 'litespeed_optm_css_to_be_removed', $this->css_to_be_removed ) ;
909
 
910
  $src_list = array() ;
@@ -935,6 +1018,11 @@ class LiteSpeed_Cache_Optimize
935
  continue ;
936
  }
937
 
 
 
 
 
 
938
  // Check if need to remove this css
939
  if ( $this->css_to_be_removed && LiteSpeed_Cache_Utility::str_hit_array( $attrs[ 'href' ], $this->css_to_be_removed ) ) {
940
  LiteSpeed_Cache_Log::debug( 'Optm: rm css snippet ' . $attrs[ 'href' ] ) ;
@@ -1036,12 +1124,9 @@ class LiteSpeed_Cache_Optimize
1036
  * Exclude js from setting
1037
  * @since 1.5
1038
  */
1039
- if ( $this->cfg_js_defer_exc ) {
1040
-
1041
- if ( LiteSpeed_Cache_Utility::str_hit_array( $src, $this->cfg_js_defer_exc ) ) {
1042
- LiteSpeed_Cache_Log::debug( 'Optm: js defer exclude ' . $src ) ;
1043
- continue ;
1044
- }
1045
  }
1046
 
1047
  /**
@@ -1142,6 +1227,14 @@ class LiteSpeed_Cache_Optimize
1142
 
1143
  $this->minify_options[ 'files' ] = $files ;
1144
 
 
 
 
 
 
 
 
 
1145
  $content = $this->minify_minify->serve( $this->minify_controller, $this->minify_options ) ;
1146
 
1147
  } catch ( ErrorException $e ) {
@@ -1154,6 +1247,41 @@ class LiteSpeed_Cache_Optimize
1154
  return $content ;
1155
  }
1156
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1157
  /**
1158
  * Get the current instance object.
1159
  *
33
  private $cfg_qs_rm ;
34
  private $cfg_exc_jquery ;
35
  private $cfg_ggfonts_async ;
36
+ private $cfg_optm_max_size ;
37
 
38
+ private $dns_prefetch ;
39
 
40
  private $html_foot = '' ; // The html info append to <body>
41
  private $html_head = '' ; // The html info prepend to <body>
68
  $this->cfg_qs_rm = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTM_QS_RM ) ;
69
  $this->cfg_exc_jquery = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTM_EXC_JQUERY ) ;
70
  $this->cfg_ggfonts_async = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTM_GGFONTS_ASYNC ) ;
71
+ $this->cfg_optm_max_size = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTM_MAX_SIZE ) * 1000000 ;
72
 
73
  $this->_static_request_check() ;
74
 
108
  */
109
  add_filter( 'litespeed_vary', array( $this, 'vary_add_role_exclude' ) ) ;
110
 
111
+ /**
112
+ * Prefetch DNS
113
+ * @since 1.7.1
114
+ */
115
+ $this->_dns_prefetch_init() ;
116
+
117
  }
118
 
119
  /**
184
  LiteSpeed_Cache_Log::debug( 'Optimizer start serving static file' ) ;
185
 
186
  LiteSpeed_Cache_Control::set_cacheable() ;
187
+ LiteSpeed_Cache_Control::set_public_forced( 'OPTM: css async js' ) ;
188
  LiteSpeed_Cache_Control::set_no_vary() ;
189
  LiteSpeed_Cache_Control::set_custom_ttl( 8640000 ) ;
190
  LiteSpeed_Cache_Tag::add( LiteSpeed_Cache_Tag::TYPE_MIN . '_CSS_ASYNC' ) ;
191
 
192
+ $file = LSWCP_DIR . 'js/css_async.min.js' ;
193
 
194
  header( 'Content-Length: ' . filesize( $file ) ) ;
195
  header( 'Content-Type: application/x-javascript; charset=utf-8' ) ;
231
  }
232
 
233
  LiteSpeed_Cache_Control::set_cacheable() ;
234
+ LiteSpeed_Cache_Control::set_public_forced( 'OPTM: min file ' . $match[ 1 ] ) ;
235
  LiteSpeed_Cache_Control::set_no_vary() ;
236
  LiteSpeed_Cache_Control::set_custom_ttl( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTIMIZE_TTL ) ) ;
237
  LiteSpeed_Cache_Tag::add( LiteSpeed_Cache_Tag::TYPE_MIN ) ;
399
  }
400
 
401
  // Move all css to top
402
+ $this->content = str_replace( $html_list, '', $this->content ) ;// todo: need to keep position for certain files
403
 
404
  // Add to HTTP2
405
  foreach ( $urls as $url ) {
625
 
626
  }
627
 
628
+ /**
629
+ * Prefetch DNS
630
+ *
631
+ * @since 1.7.1
632
+ * @access private
633
+ */
634
+ private function _dns_prefetch_init()
635
+ {
636
+ $this->dns_prefetch = get_option( LiteSpeed_Cache_Config::ITEM_DNS_PREFETCH ) ;
637
+ if ( ! $this->dns_prefetch ) {
638
+ return ;
639
+ }
640
+
641
+ if ( function_exists( 'wp_resource_hints' ) ) {
642
+ add_filter( 'wp_resource_hints', array( $this, 'dns_prefetch_filter' ), 10, 2 ) ;
643
+ }
644
+ else {
645
+ add_action( 'litespeed_optm', array( $this, 'dns_prefetch_output' ) ) ;
646
+ }
647
+ }
648
+
649
+ /**
650
+ * Prefetch DNS hook for WP
651
+ *
652
+ * @since 1.7.1
653
+ * @access public
654
+ */
655
+ public function dns_prefetch_filter( $urls, $relation_type )
656
+ {
657
+ if ( $relation_type !== 'dns-prefetch' ) {
658
+ return $urls ;
659
+ }
660
+
661
+ foreach ( explode( "\n", $this->dns_prefetch ) as $v ) {
662
+ if ( $v ) {
663
+ $urls[] = $v ;
664
+ }
665
+ }
666
+
667
+ return $urls ;
668
+ }
669
+
670
+ /**
671
+ * Prefetch DNS
672
+ *
673
+ * @since 1.7.1
674
+ * @access public
675
+ */
676
+ public function dns_prefetch_output()
677
+ {
678
+ foreach ( explode( "\n", $this->dns_prefetch ) as $v ) {
679
+ if ( $v ) {
680
+ $this->html_head .= "<link rel='dns-prefetch' href='$v' />" ;
681
+ }
682
+ }
683
+ }
684
+
685
  /**
686
  * Limit combined filesize when build hash url
687
  *
701
 
702
  $total += $file_size_list[ $k ] ;
703
 
704
+ if ( $total > $this->cfg_optm_max_size ) { // If larger than 1M, separate them
705
  $total = 0;
706
  $i ++ ;
707
  }
763
  */
764
  private function _analyse_links( $src_list, $html_list, $file_type = 'css' )
765
  {
766
+ // if ( $file_type == 'css' ) {
767
+ // $excludes = apply_filters( 'litespeed_cache_optimize_css_excludes', LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CSS_EXCLUDES ) ) ;
768
+ // }
769
+ // else {
770
+ // $excludes = apply_filters( 'litespeed_cache_optimize_js_excludes', LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_JS_EXCLUDES ) ) ;
771
+ // }
772
+ // if ( $excludes ) {
773
+ // $excludes = explode( "\n", $excludes ) ;
774
+ // }
775
 
776
  $ignored_html = array() ;
777
  $src_queue_list = array() ;
781
  foreach ( $src_list as $key => $src ) {
782
  LiteSpeed_Cache_Log::debug2( 'Optm: ' . $src ) ;
783
 
784
+ /**
785
+ * Excluded links won't be done any optm
786
+ * @since 1.7
787
+ */
788
+ // if ( $excludes && $exclude = LiteSpeed_Cache_Utility::str_hit_array( $src, $excludes ) ) {
789
+ // $ignored_html[] = $html_list[ $key ] ;
790
+ // LiteSpeed_Cache_Log::debug2( 'Optm: Abort excludes: ' . $exclude ) ;
791
+ // continue ;
792
+ // }
793
 
794
  // Check if has no-optimize attr
795
  if ( strpos( $html_list[ $key ], 'data-no-optimize' ) !== false ) {
924
  */
925
  private function _parse_js()
926
  {
927
+ $excludes = apply_filters( 'litespeed_cache_optimize_js_excludes', LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_JS_EXCLUDES ) ) ;
928
+ if ( $excludes ) {
929
+ $excludes = explode( "\n", $excludes ) ;
930
+ }
931
+
932
  $src_list = array() ;
933
  $html_list = array() ;
934
  $head_src_list = array() ;
957
  if ( in_array( $match[ 0 ], $html_list ) ) {
958
  continue ;
959
  }
960
+ // todo @v2.0: allow defer even exclude from optm
961
+ if ( $excludes && $exclude = LiteSpeed_Cache_Utility::str_hit_array( $attrs[ 'src' ], $excludes ) ) {
962
+ LiteSpeed_Cache_Log::debug2( 'Optm: _parse_js bypassed exclude ' . $exclude ) ;
963
+ continue ;
964
+ }
965
 
966
  $src_list[] = $attrs[ 'src' ] ;
967
  $html_list[] = $match[ 0 ] ;
983
  */
984
  private function _handle_css()
985
  {
986
+ $excludes = apply_filters( 'litespeed_cache_optimize_css_excludes', LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CSS_EXCLUDES ) ) ;
987
+ if ( $excludes ) {
988
+ $excludes = explode( "\n", $excludes ) ;
989
+ }
990
+
991
  $this->css_to_be_removed = apply_filters( 'litespeed_optm_css_to_be_removed', $this->css_to_be_removed ) ;
992
 
993
  $src_list = array() ;
1018
  continue ;
1019
  }
1020
 
1021
+ if ( $excludes && $exclude = LiteSpeed_Cache_Utility::str_hit_array( $attrs[ 'href' ], $excludes ) ) {
1022
+ LiteSpeed_Cache_Log::debug2( 'Optm: _handle_css bypassed exclude ' . $exclude ) ;
1023
+ continue ;
1024
+ }
1025
+
1026
  // Check if need to remove this css
1027
  if ( $this->css_to_be_removed && LiteSpeed_Cache_Utility::str_hit_array( $attrs[ 'href' ], $this->css_to_be_removed ) ) {
1028
  LiteSpeed_Cache_Log::debug( 'Optm: rm css snippet ' . $attrs[ 'href' ] ) ;
1124
  * Exclude js from setting
1125
  * @since 1.5
1126
  */
1127
+ if ( $this->cfg_js_defer_exc && LiteSpeed_Cache_Utility::str_hit_array( $src, $this->cfg_js_defer_exc ) ) {
1128
+ LiteSpeed_Cache_Log::debug( 'Optm: js defer exclude ' . $src ) ;
1129
+ continue ;
 
 
 
1130
  }
1131
 
1132
  /**
1227
 
1228
  $this->minify_options[ 'files' ] = $files ;
1229
 
1230
+ /**
1231
+ * Clean comment when minify
1232
+ * @since 1.7.1
1233
+ */
1234
+ if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTM_RM_COMMENT ) ) {
1235
+ $this->minify_options[ 'postprocessor' ] = __CLASS__ . '::remove_comment' ;
1236
+ }
1237
+
1238
  $content = $this->minify_minify->serve( $this->minify_controller, $this->minify_options ) ;
1239
 
1240
  } catch ( ErrorException $e ) {
1247
  return $content ;
1248
  }
1249
 
1250
+ /**
1251
+ * Remove comment when minify
1252
+ *
1253
+ * @since 1.7.1
1254
+ * @access public
1255
+ */
1256
+ public static function remove_comment( $content, $type )
1257
+ {
1258
+ $_from = array(
1259
+ '|\/\*.*\*\/|U',
1260
+ '|\/\*.*\*\/|sU',
1261
+ "|\n+|",
1262
+ // "|;+\n*;+|",
1263
+ // "|\n+;|",
1264
+ // "|;\n+|"
1265
+ ) ;
1266
+
1267
+ $_to = array(
1268
+ '',
1269
+ "\n",
1270
+ "\n",
1271
+ // ';',
1272
+ // ';',
1273
+ // ';',
1274
+ ) ;
1275
+
1276
+ $content = preg_replace( $_from, $_to, $content ) ;
1277
+ if ( $type == 'text/css' ) {
1278
+ $content = preg_replace( "|: *|", ':', $content ) ;
1279
+ $content = preg_replace( "| */ *|", '/', $content ) ;
1280
+ }
1281
+ $content = trim( $content ) ;
1282
+ return $content ;
1283
+ }
1284
+
1285
  /**
1286
  * Get the current instance object.
1287
  *
inc/router.class.php CHANGED
@@ -62,7 +62,7 @@ class LiteSpeed_Cache_Router
62
  $role = false ;
63
  if ( $uid ) {
64
  $user = get_userdata( $uid ) ;
65
- if ( is_array( $user->roles ) ) {
66
  $tmp = array_values( $user->roles ) ;
67
  $role = array_shift( $tmp ) ;
68
  }
@@ -343,6 +343,8 @@ class LiteSpeed_Cache_Router
343
  case LiteSpeed_Cache::ACTION_DO_CRAWL:
344
  case LiteSpeed_Cache::ACTION_BLACKLIST_SAVE:
345
  case LiteSpeed_Cache::ACTION_MEDIA:
 
 
346
  if ( defined( 'LITESPEED_ON' ) && $_can_option && ! $_is_network_admin ) {
347
  self::$_action = $action ;
348
  }
62
  $role = false ;
63
  if ( $uid ) {
64
  $user = get_userdata( $uid ) ;
65
+ if ( isset( $user->roles ) && is_array( $user->roles ) ) {
66
  $tmp = array_values( $user->roles ) ;
67
  $role = array_shift( $tmp ) ;
68
  }
343
  case LiteSpeed_Cache::ACTION_DO_CRAWL:
344
  case LiteSpeed_Cache::ACTION_BLACKLIST_SAVE:
345
  case LiteSpeed_Cache::ACTION_MEDIA:
346
+ case LiteSpeed_Cache::ACTION_IAPI:
347
+ case LiteSpeed_Cache::ACTION_CDN:
348
  if ( defined( 'LITESPEED_ON' ) && $_can_option && ! $_is_network_admin ) {
349
  self::$_action = $action ;
350
  }
inc/utility.class.php CHANGED
@@ -18,7 +18,7 @@ class LiteSpeed_Cache_Utility
18
  * @since 1.6.5
19
  * @access public
20
  */
21
- public static function readable_time( $seconds_or_timestamp, $timeout = 3600 )
22
  {
23
 
24
  if ( strlen( $seconds_or_timestamp ) == 10 ) {
@@ -34,7 +34,7 @@ class LiteSpeed_Cache_Utility
34
  $res = '';
35
  if ( $seconds > 86400 ) {
36
  $num = floor( $seconds / 86400 ) ;
37
- $res .= $num . 'd ' ;
38
  $seconds %= 86400 ;
39
  }
40
 
@@ -43,7 +43,7 @@ class LiteSpeed_Cache_Utility
43
  $res .= ', ' ;
44
  }
45
  $num = floor( $seconds / 3600 ) ;
46
- $res .= $num . 'h ' ;
47
  $seconds %= 3600 ;
48
  }
49
 
@@ -52,15 +52,18 @@ class LiteSpeed_Cache_Utility
52
  $res .= ', ' ;
53
  }
54
  $num = floor( $seconds / 60 ) ;
55
- $res .= $num . 'm ' ;
56
  $seconds %= 60 ;
57
  }
58
 
59
  if ( $seconds > 0 ) {
60
- $res .= $seconds . 's ' ;
 
 
 
61
  }
62
 
63
- $res = sprintf( __( ' %s ago ', 'litespeed-cache' ), $res ) ;
64
 
65
  return $res ;
66
  }
@@ -258,6 +261,25 @@ class LiteSpeed_Cache_Utility
258
  return trim( $url ) ;
259
  }
260
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
261
  /**
262
  * Generate domain const
263
  *
@@ -298,15 +320,22 @@ class LiteSpeed_Cache_Utility
298
  }
299
 
300
  $arr = explode( "\n", $content ) ;
 
301
  if ( $type === 'uri' ) {
302
  $arr = array_map( 'LiteSpeed_Cache_Utility::url2uri', $arr ) ;
303
  }
304
  if ( $type === 'relative' ) {
305
  $arr = array_map( 'LiteSpeed_Cache_Utility::make_relative', $arr ) ;// Remove domain
306
  }
 
 
 
307
  $arr = array_map( 'trim', $arr ) ;
308
  $arr = array_unique( $arr ) ;
309
  $arr = array_filter( $arr ) ;
 
 
 
310
  return implode( "\n", $arr ) ;
311
  }
312
 
18
  * @since 1.6.5
19
  * @access public
20
  */
21
+ public static function readable_time( $seconds_or_timestamp, $timeout = 3600, $backward = true )
22
  {
23
 
24
  if ( strlen( $seconds_or_timestamp ) == 10 ) {
34
  $res = '';
35
  if ( $seconds > 86400 ) {
36
  $num = floor( $seconds / 86400 ) ;
37
+ $res .= $num . 'd' ;
38
  $seconds %= 86400 ;
39
  }
40
 
43
  $res .= ', ' ;
44
  }
45
  $num = floor( $seconds / 3600 ) ;
46
+ $res .= $num . 'h' ;
47
  $seconds %= 3600 ;
48
  }
49
 
52
  $res .= ', ' ;
53
  }
54
  $num = floor( $seconds / 60 ) ;
55
+ $res .= $num . 'm' ;
56
  $seconds %= 60 ;
57
  }
58
 
59
  if ( $seconds > 0 ) {
60
+ if ( $res ) {
61
+ $res .= ' ' ;
62
+ }
63
+ $res .= $seconds . 's' ;
64
  }
65
 
66
+ $res = $backward ? sprintf( __( ' %s ago', 'litespeed-cache' ), $res ) : $res ;
67
 
68
  return $res ;
69
  }
261
  return trim( $url ) ;
262
  }
263
 
264
+ /**
265
+ * Convert URL to domain only
266
+ *
267
+ * @since 1.7.1
268
+ */
269
+ public static function parse_domain( $url )
270
+ {
271
+ $url = @parse_url( $url ) ;
272
+ if ( empty( $url[ 'host' ] ) ) {
273
+ return '' ;
274
+ }
275
+
276
+ if ( ! empty( $url[ 'scheme' ] ) ) {
277
+ return $url[ 'scheme' ] . '://' . $url[ 'host' ] ;
278
+ }
279
+
280
+ return '//' . $url[ 'host' ] ;
281
+ }
282
+
283
  /**
284
  * Generate domain const
285
  *
320
  }
321
 
322
  $arr = explode( "\n", $content ) ;
323
+ $arr = array_map( 'trim', $arr ) ;
324
  if ( $type === 'uri' ) {
325
  $arr = array_map( 'LiteSpeed_Cache_Utility::url2uri', $arr ) ;
326
  }
327
  if ( $type === 'relative' ) {
328
  $arr = array_map( 'LiteSpeed_Cache_Utility::make_relative', $arr ) ;// Remove domain
329
  }
330
+ if ( $type === 'domain' ) {
331
+ $arr = array_map( 'LiteSpeed_Cache_Utility::parse_domain', $arr ) ;// Only keep domain
332
+ }
333
  $arr = array_map( 'trim', $arr ) ;
334
  $arr = array_unique( $arr ) ;
335
  $arr = array_filter( $arr ) ;
336
+ if ( $type === 'array' ) {
337
+ return $arr ;
338
+ }
339
  return implode( "\n", $arr ) ;
340
  }
341
 
inc/vary.class.php CHANGED
@@ -498,7 +498,7 @@ class LiteSpeed_Cache_Vary
498
  }
499
 
500
  if ( empty($tp_cookies) ) {
501
- LiteSpeed_Cache_Log::debug( 'Vary: finalize bypassed due to no vary ' ) ;
502
  return ;
503
  }
504
 
@@ -539,7 +539,13 @@ class LiteSpeed_Cache_Vary
539
  $expire = 1 ;
540
  }
541
 
542
- setcookie(self::$_vary_name, $val, $expire, $path?: COOKIEPATH, COOKIE_DOMAIN, is_ssl(), true) ;
 
 
 
 
 
 
543
  }
544
 
545
  /**
498
  }
499
 
500
  if ( empty($tp_cookies) ) {
501
+ LiteSpeed_Cache_Log::debug2( 'Vary: no custimzed vary ' ) ;
502
  return ;
503
  }
504
 
539
  $expire = 1 ;
540
  }
541
 
542
+ /**
543
+ * Add HTTPS bypass in case clients use both HTTP and HTTPS version of site
544
+ * @since 1.7
545
+ */
546
+ $is_ssl = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_USE_HTTP_FOR_HTTPS_VARY ) ? false : is_ssl() ;
547
+
548
+ setcookie(self::$_vary_name, $val, $expire, $path?: COOKIEPATH, COOKIE_DOMAIN, $is_ssl, true) ;
549
  }
550
 
551
  /**
includes/litespeed-cache-api.class.php CHANGED
@@ -253,12 +253,11 @@ class LiteSpeed_Cache_API
253
  * @since 1.1.3
254
  * @access public
255
  * @param string $id
256
- * @param boolean $disabled Disable this field
257
  * @param boolean $return Return the html or echo it
258
  */
259
- public static function build_switch($id, $disabled = false, $return = false)
260
  {
261
- return LiteSpeed_Cache_Admin_Display::get_instance()->build_switch($id, $disabled, $return) ;
262
  }
263
 
264
  /**
@@ -311,6 +310,17 @@ class LiteSpeed_Cache_API
311
  add_action('litespeed_cache_api_vary', $hook) ;
312
  }
313
 
 
 
 
 
 
 
 
 
 
 
 
314
  /**
315
  * Hook purge tags appending to purge
316
  *
253
  * @since 1.1.3
254
  * @access public
255
  * @param string $id
 
256
  * @param boolean $return Return the html or echo it
257
  */
258
+ public static function build_switch( $id, $checked = null, $return = false )
259
  {
260
+ return LiteSpeed_Cache_Admin_Display::get_instance()->build_switch( $id, $checked, $return ) ;
261
  }
262
 
263
  /**
310
  add_action('litespeed_cache_api_vary', $hook) ;
311
  }
312
 
313
+ /**
314
+ * Hook vary tags to vary finialization
315
+ *
316
+ * @since 1.7.2
317
+ * @access public
318
+ */
319
+ public static function hook_vary_finalize( $hook )
320
+ {
321
+ add_filter( 'litespeed_vary', $hook ) ;
322
+ }
323
+
324
  /**
325
  * Hook purge tags appending to purge
326
  *
includes/litespeed-cache-cdn.class.php CHANGED
@@ -16,18 +16,21 @@ class LiteSpeed_Cache_CDN
16
 
17
  const BYPASS = 'LITESPEED_BYPASS_CDN' ;
18
 
 
 
 
 
 
19
  private $content ;
20
 
21
  private $cfg_cdn ;
22
  private $cfg_url_ori ;
23
- private $cfg_cdn_url ;
24
- private $cfg_cdn_inc_img ;
25
- private $cfg_cdn_inc_css ;
26
- private $cfg_cdn_inc_js ;
27
- private $cfg_cdn_filetype ;
28
  private $cfg_cdn_exclude ;
29
  private $cfg_cdn_remote_jquery ;
30
 
 
 
31
  /**
32
  * Init
33
  *
@@ -64,8 +67,43 @@ class LiteSpeed_Cache_CDN
64
  }
65
 
66
  $this->cfg_url_ori = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN_ORI ) ;
67
- $this->cfg_cdn_url = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN_URL ) ;
68
- if ( ! $this->cfg_url_ori || ! $this->cfg_cdn_url ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  if ( ! defined( self::BYPASS ) ) {
70
  define( self::BYPASS, true ) ;
71
  }
@@ -80,40 +118,60 @@ class LiteSpeed_Cache_CDN
80
  LiteSpeed_Cache_Log::debug2( 'CDN: translated rule is ' . $this->cfg_url_ori ) ;
81
  }
82
 
83
- $this->cfg_cdn_inc_img = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN_INC_IMG ) ;
84
- $this->cfg_cdn_inc_css = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN_INC_CSS ) ;
85
- $this->cfg_cdn_inc_js = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN_INC_JS ) ;
86
- $this->cfg_cdn_filetype = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN_FILETYPE ) ;
87
- if ( ! $this->cfg_cdn_inc_img && ! $this->cfg_cdn_inc_css && ! $this->cfg_cdn_inc_js && ! $this->cfg_cdn_filetype ) {
88
- if ( ! defined( self::BYPASS ) ) {
89
- define( self::BYPASS, true ) ;
90
- }
91
- return ;
92
- }
93
-
94
- $this->cfg_cdn_filetype = explode( "\n", $this->cfg_cdn_filetype ) ;
95
-
96
  $this->cfg_cdn_exclude = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN_EXCLUDE ) ;
97
  $this->cfg_cdn_exclude = explode( "\n", $this->cfg_cdn_exclude ) ;
98
 
99
- if ( $this->cfg_cdn_inc_img ) {
100
  // Hook to srcset
101
  if ( function_exists( 'wp_calculate_image_srcset' ) ) {
102
- add_filter( 'wp_calculate_image_srcset', __CLASS__ . '::srcset', 999 ) ;
103
  }
104
  // Hook to mime icon
105
- add_filter( 'wp_get_attachment_image_src', __CLASS__ . '::attach_img_src', 999 ) ;
106
- add_filter( 'wp_get_attachment_url', __CLASS__ . '::url', 999 ) ;
107
  }
108
 
109
- if ( $this->cfg_cdn_inc_css ) {
110
- add_filter( 'style_loader_src', __CLASS__ . '::url', 999 ) ;
111
  }
112
 
113
- if ( $this->cfg_cdn_inc_js ) {
114
- add_filter( 'script_loader_src', __CLASS__ . '::url', 999 ) ;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
  }
116
 
 
117
  }
118
 
119
  /**
@@ -126,11 +184,11 @@ class LiteSpeed_Cache_CDN
126
  {
127
  $instance = self::get_instance() ;
128
 
129
- if ( $type == 'css' && $instance->cfg_cdn_inc_css ) {
130
  return true ;
131
  }
132
 
133
- if ( $type == 'js' && $instance->cfg_cdn_inc_js ) {
134
  return true ;
135
  }
136
 
@@ -149,12 +207,9 @@ class LiteSpeed_Cache_CDN
149
  return false ;
150
  }
151
 
152
- if ( ! defined( 'LITESPEED_CDN_HOST' ) ) {
153
- $instance = self::get_instance() ;
154
- define( 'LITESPEED_CDN_HOST', parse_url( $instance->cfg_cdn_url, PHP_URL_HOST ) ) ;
155
- }
156
 
157
- return $host === LITESPEED_CDN_HOST ;
158
  }
159
 
160
  /**
@@ -222,12 +277,12 @@ class LiteSpeed_Cache_CDN
222
  LiteSpeed_Cache_Log::debug( 'CDN _finalize' ) ;
223
 
224
  // Start replacing img src
225
- if ( $this->cfg_cdn_inc_img ) {
226
  $this->_replace_img() ;
227
  $this->_replace_inline_css() ;
228
  }
229
 
230
- if ( $this->cfg_cdn_filetype ) {
231
  $this->_replace_file_types() ;
232
  }
233
 
@@ -245,19 +300,21 @@ class LiteSpeed_Cache_CDN
245
  if ( empty( $matches[ 2 ] ) ) {
246
  return ;
247
  }
 
 
248
  foreach ( $matches[ 2 ] as $k => $url ) {
249
  $url_parsed = parse_url( $url ) ;
250
  if ( empty( $url_parsed[ 'path' ] ) ) {
251
  continue ;
252
  }
253
  $postfix = substr( $url_parsed[ 'path' ], strrpos( $url_parsed[ 'path' ], '.' ) ) ;
254
- if ( ! in_array( $postfix, $this->cfg_cdn_filetype ) ) {
255
  continue ;
256
  }
257
 
258
  LiteSpeed_Cache_Log::debug2( 'CDN matched file_type ' . $postfix . ' : ' . $url ) ;
259
 
260
- if( ! $url2 = $this->rewrite( $url ) ) {
261
  continue ;
262
  }
263
 
@@ -281,7 +338,7 @@ class LiteSpeed_Cache_CDN
281
  continue ;
282
  }
283
 
284
- if ( ! $url2 = $this->rewrite( $url ) ) {
285
  continue ;
286
  }
287
 
@@ -308,7 +365,7 @@ class LiteSpeed_Cache_CDN
308
  foreach ( $matches[ 1 ] as $k => $url ) {
309
  $url = str_replace( array( ' ', '\t', '\n', '\r', '\0', '\x0B', '"', "'", '&quot;', '&#039;' ), '', $url ) ;
310
 
311
- if ( ! $url2 = $this->rewrite( $url ) ) {
312
  continue ;
313
  }
314
  $attr = str_replace( $matches[ 1 ][ $k ], $url2, $matches[ 0 ][ $k ] ) ;
@@ -320,14 +377,14 @@ class LiteSpeed_Cache_CDN
320
  * Hook to wp_get_attachment_image_src
321
  *
322
  * @since 1.2.3
 
323
  * @access public
324
  * @param array $img The URL of the attachment image src, the width, the height
325
  * @return array
326
  */
327
- public static function attach_img_src( $img )
328
  {
329
- $instance = self::get_instance() ;
330
- if ( $img && $url = $instance->rewrite( $img[ 0 ] ) ) {
331
  $img[ 0 ] = $url ;
332
  }
333
  return $img ;
@@ -336,15 +393,40 @@ class LiteSpeed_Cache_CDN
336
  /**
337
  * Try to rewrite one URL with CDN
338
  *
339
- * @since 1.2.3
340
  * @access public
341
- * @param string $url
342
- * @return string
343
  */
344
- public static function url( $url )
345
  {
346
- $instance = self::get_instance() ;
347
- if ( $url && $url2 = $instance->rewrite( $url ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
348
  $url = $url2 ;
349
  }
350
  return $url ;
@@ -354,16 +436,16 @@ class LiteSpeed_Cache_CDN
354
  * Hook to replace WP responsive images
355
  *
356
  * @since 1.2.3
 
357
  * @access public
358
  * @param array $srcs
359
  * @return array
360
  */
361
- public static function srcset( $srcs )
362
  {
363
  if ( $srcs ) {
364
- $instance = self::get_instance() ;
365
  foreach ( $srcs as $w => $data ) {
366
- if( ! $url = $instance->rewrite( $data[ 'url' ] ) ) {
367
  continue ;
368
  }
369
  $srcs[ $w ][ 'url' ] = $url ;
@@ -380,7 +462,7 @@ class LiteSpeed_Cache_CDN
380
  * @param string $url
381
  * @return string Replaced URL
382
  */
383
- public function rewrite( $url )
384
  {
385
  LiteSpeed_Cache_Log::debug2( 'CDN: try rewriting ' . $url ) ;
386
  $url_parsed = parse_url( $url ) ;
@@ -421,12 +503,24 @@ class LiteSpeed_Cache_CDN
421
  LiteSpeed_Cache_Log::debug2( 'CDN: scheme from url: ' . $scheme ) ;
422
  }
423
 
 
 
 
 
 
 
 
 
 
 
 
 
424
  // Now lets replace CDN url
425
  if ( strpos( $this->cfg_url_ori, '*' ) !== false ) {
426
- $url = preg_replace( '#' . $scheme . $this->cfg_url_ori . '#iU', $this->cfg_cdn_url, $url ) ;
427
  }
428
  else {
429
- $url = str_replace( $scheme . $this->cfg_url_ori, $this->cfg_cdn_url, $url ) ;
430
  }
431
  LiteSpeed_Cache_Log::debug2( 'CDN: after rewritten: ' . $url ) ;
432
 
@@ -459,6 +553,209 @@ class LiteSpeed_Cache_CDN
459
  wp_register_script( 'jquery', $src, false, $v ) ;
460
  }
461
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
462
  /**
463
  * Get the current instance object.
464
  *
16
 
17
  const BYPASS = 'LITESPEED_BYPASS_CDN' ;
18
 
19
+ const TYPE_CLOUDFLARE_PURGE_ALL = 'cloudflare_purge_all' ;
20
+ const TYPE_CLOUDFLARE_GET_DEVMODE = 'cloudflare_get_devmode' ;
21
+ const TYPE_CLOUDFLARE_SET_DEVMODE_ON = 'cloudflare_set_devmode_on' ;
22
+ const TYPE_CLOUDFLARE_SET_DEVMODE_OFF = 'cloudflare_set_devmode_off' ;
23
+
24
  private $content ;
25
 
26
  private $cfg_cdn ;
27
  private $cfg_url_ori ;
28
+ private $cfg_cdn_mapping = array() ;
 
 
 
 
29
  private $cfg_cdn_exclude ;
30
  private $cfg_cdn_remote_jquery ;
31
 
32
+ private $cdn_mapping_hosts = array() ;
33
+
34
  /**
35
  * Init
36
  *
67
  }
68
 
69
  $this->cfg_url_ori = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN_ORI ) ;
70
+ $cfg_cdn_url = get_option( LiteSpeed_Cache_Config::ITEM_CDN_MAPPING, array() ) ;
71
+ // Parse cdn mapping data to array( 'filetype' => 'url' )
72
+ $mapping_to_check = array(
73
+ LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_INC_IMG,
74
+ LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_INC_CSS,
75
+ LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_INC_JS
76
+ ) ;
77
+ foreach ( $cfg_cdn_url as $v ) {
78
+ if ( ! $v[ LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_URL ] ) {
79
+ continue ;
80
+ }
81
+ $this_url = $v[ LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_URL ] ;
82
+ $this_host = parse_url( $this_url, PHP_URL_HOST ) ;
83
+ foreach ( $mapping_to_check as $to_check ) {
84
+ if ( $v[ $to_check ] ) {
85
+ LiteSpeed_Cache_Log::debug2( 'CDN: mapping ' . $to_check . ' -> ' . $this_url ) ;
86
+ $this->cfg_cdn_mapping[ $to_check ] = $this_url ;
87
+ if ( ! in_array( $this_host, $this->cdn_mapping_hosts ) ) {
88
+ $this->cdn_mapping_hosts[] = $this_host ;
89
+ }
90
+ }
91
+ }
92
+ if ( $v[ LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_FILETYPE ] ) {
93
+ $filetypes = array_map( 'trim', explode( "\n", $v[ LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_FILETYPE ] ) ) ;
94
+ foreach ( $filetypes as $v2 ) {
95
+ if ( $v2 ) {
96
+ $this->cfg_cdn_mapping[ LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_FILETYPE ] = true ;
97
+ $this->cfg_cdn_mapping[ $v2 ] = $this_url ;
98
+ if ( ! in_array( $this_host, $this->cdn_mapping_hosts ) ) {
99
+ $this->cdn_mapping_hosts[] = $this_host ;
100
+ }
101
+ }
102
+ }
103
+ LiteSpeed_Cache_Log::debug2( 'CDN: mapping ' . implode( ',', $filetypes ) . ' -> ' . $this_url ) ;
104
+ }
105
+ }
106
+ if ( ! $this->cfg_url_ori || ! $this->cfg_cdn_mapping ) {
107
  if ( ! defined( self::BYPASS ) ) {
108
  define( self::BYPASS, true ) ;
109
  }
118
  LiteSpeed_Cache_Log::debug2( 'CDN: translated rule is ' . $this->cfg_url_ori ) ;
119
  }
120
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  $this->cfg_cdn_exclude = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN_EXCLUDE ) ;
122
  $this->cfg_cdn_exclude = explode( "\n", $this->cfg_cdn_exclude ) ;
123
 
124
+ if ( ! empty( $this->cfg_cdn_mapping[ LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_INC_IMG ] ) ) {
125
  // Hook to srcset
126
  if ( function_exists( 'wp_calculate_image_srcset' ) ) {
127
+ add_filter( 'wp_calculate_image_srcset', array( $this, 'srcset' ), 999 ) ;
128
  }
129
  // Hook to mime icon
130
+ add_filter( 'wp_get_attachment_image_src', array( $this, 'attach_img_src' ), 999 ) ;
131
+ add_filter( 'wp_get_attachment_url', array( $this, 'url_img' ), 999 ) ;
132
  }
133
 
134
+ if ( ! empty( $this->cfg_cdn_mapping[ LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_INC_CSS ] ) ) {
135
+ add_filter( 'style_loader_src', array( $this, 'url_css' ), 999 ) ;
136
  }
137
 
138
+ if ( ! empty( $this->cfg_cdn_mapping[ LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_INC_JS ] ) ) {
139
+ add_filter( 'script_loader_src', array( $this, 'url_js' ), 999 ) ;
140
+ }
141
+
142
+ }
143
+
144
+ /**
145
+ * Handle all request actions from main cls
146
+ *
147
+ * @since 1.7.2
148
+ * @access public
149
+ */
150
+ public static function handler()
151
+ {
152
+ $instance = self::get_instance() ;
153
+
154
+ $type = LiteSpeed_Cache_Router::verify_type() ;
155
+
156
+ switch ( $type ) {
157
+ case self::TYPE_CLOUDFLARE_PURGE_ALL :
158
+ $instance->_cloudflare_purge_all() ;
159
+ break ;
160
+
161
+ case self::TYPE_CLOUDFLARE_GET_DEVMODE :
162
+ $instance->_cloudflare_get_devmode() ;
163
+ break ;
164
+
165
+ case self::TYPE_CLOUDFLARE_SET_DEVMODE_ON :
166
+ case self::TYPE_CLOUDFLARE_SET_DEVMODE_OFF :
167
+ $instance->_cloudflare_set_devmode( $type ) ;
168
+ break ;
169
+
170
+ default:
171
+ break ;
172
  }
173
 
174
+ LiteSpeed_Cache_Admin::redirect() ;
175
  }
176
 
177
  /**
184
  {
185
  $instance = self::get_instance() ;
186
 
187
+ if ( $type == 'css' && ! empty( $instance->cfg_cdn_mapping[ LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_INC_CSS ] ) ) {
188
  return true ;
189
  }
190
 
191
+ if ( $type == 'js' && ! empty( $instance->cfg_cdn_mapping[ LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_INC_JS ] ) ) {
192
  return true ;
193
  }
194
 
207
  return false ;
208
  }
209
 
210
+ $instance = self::get_instance() ;
 
 
 
211
 
212
+ return in_array( $host, $instance->cdn_mapping_hosts ) ;
213
  }
214
 
215
  /**
277
  LiteSpeed_Cache_Log::debug( 'CDN _finalize' ) ;
278
 
279
  // Start replacing img src
280
+ if ( ! empty( $this->cfg_cdn_mapping[ LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_INC_IMG ] ) ) {
281
  $this->_replace_img() ;
282
  $this->_replace_inline_css() ;
283
  }
284
 
285
+ if ( ! empty( $this->cfg_cdn_mapping[ LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_FILETYPE ] ) ) {
286
  $this->_replace_file_types() ;
287
  }
288
 
300
  if ( empty( $matches[ 2 ] ) ) {
301
  return ;
302
  }
303
+
304
+ $filetypes = array_keys( $this->cfg_cdn_mapping ) ;
305
  foreach ( $matches[ 2 ] as $k => $url ) {
306
  $url_parsed = parse_url( $url ) ;
307
  if ( empty( $url_parsed[ 'path' ] ) ) {
308
  continue ;
309
  }
310
  $postfix = substr( $url_parsed[ 'path' ], strrpos( $url_parsed[ 'path' ], '.' ) ) ;
311
+ if ( ! in_array( $postfix, $filetypes ) ) {
312
  continue ;
313
  }
314
 
315
  LiteSpeed_Cache_Log::debug2( 'CDN matched file_type ' . $postfix . ' : ' . $url ) ;
316
 
317
+ if( ! $url2 = $this->rewrite( $url, LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_FILETYPE, $postfix ) ) {
318
  continue ;
319
  }
320
 
338
  continue ;
339
  }
340
 
341
+ if ( ! $url2 = $this->rewrite( $url, LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_INC_IMG ) ) {
342
  continue ;
343
  }
344
 
365
  foreach ( $matches[ 1 ] as $k => $url ) {
366
  $url = str_replace( array( ' ', '\t', '\n', '\r', '\0', '\x0B', '"', "'", '&quot;', '&#039;' ), '', $url ) ;
367
 
368
+ if ( ! $url2 = $this->rewrite( $url, LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_INC_IMG ) ) {
369
  continue ;
370
  }
371
  $attr = str_replace( $matches[ 1 ][ $k ], $url2, $matches[ 0 ][ $k ] ) ;
377
  * Hook to wp_get_attachment_image_src
378
  *
379
  * @since 1.2.3
380
+ * @since 1.7 Removed static from function
381
  * @access public
382
  * @param array $img The URL of the attachment image src, the width, the height
383
  * @return array
384
  */
385
+ public function attach_img_src( $img )
386
  {
387
+ if ( $img && $url = $this->rewrite( $img[ 0 ], LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_INC_IMG ) ) {
 
388
  $img[ 0 ] = $url ;
389
  }
390
  return $img ;
393
  /**
394
  * Try to rewrite one URL with CDN
395
  *
396
+ * @since 1.7
397
  * @access public
 
 
398
  */
399
+ public function url_img( $url )
400
  {
401
+ if ( $url && $url2 = $this->rewrite( $url, LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_INC_IMG ) ) {
402
+ $url = $url2 ;
403
+ }
404
+ return $url ;
405
+ }
406
+
407
+ /**
408
+ * Try to rewrite one URL with CDN
409
+ *
410
+ * @since 1.7
411
+ * @access public
412
+ */
413
+ public function url_css( $url )
414
+ {
415
+ if ( $url && $url2 = $this->rewrite( $url, LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_INC_CSS ) ) {
416
+ $url = $url2 ;
417
+ }
418
+ return $url ;
419
+ }
420
+
421
+ /**
422
+ * Try to rewrite one URL with CDN
423
+ *
424
+ * @since 1.7
425
+ * @access public
426
+ */
427
+ public function url_js( $url )
428
+ {
429
+ if ( $url && $url2 = $this->rewrite( $url, LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_INC_JS ) ) {
430
  $url = $url2 ;
431
  }
432
  return $url ;
436
  * Hook to replace WP responsive images
437
  *
438
  * @since 1.2.3
439
+ * @since 1.7 Removed static from function
440
  * @access public
441
  * @param array $srcs
442
  * @return array
443
  */
444
+ public function srcset( $srcs )
445
  {
446
  if ( $srcs ) {
 
447
  foreach ( $srcs as $w => $data ) {
448
+ if( ! $url = $this->rewrite( $data[ 'url' ], LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_INC_IMG ) ) {
449
  continue ;
450
  }
451
  $srcs[ $w ][ 'url' ] = $url ;
462
  * @param string $url
463
  * @return string Replaced URL
464
  */
465
+ public function rewrite( $url, $mapping_kind, $postfix = false )
466
  {
467
  LiteSpeed_Cache_Log::debug2( 'CDN: try rewriting ' . $url ) ;
468
  $url_parsed = parse_url( $url ) ;
503
  LiteSpeed_Cache_Log::debug2( 'CDN: scheme from url: ' . $scheme ) ;
504
  }
505
 
506
+ // Find the mapping url to be replaced to
507
+ if ( empty( $this->cfg_cdn_mapping[ $mapping_kind ] ) ) {
508
+ return false ;
509
+ }
510
+ if ( $mapping_kind !== LiteSpeed_Cache_Config::ITEM_CDN_MAPPING_FILETYPE ) {
511
+ $final_url = $this->cfg_cdn_mapping[ $mapping_kind ] ;
512
+ }
513
+ else {
514
+ // select from file type
515
+ $final_url = $this->cfg_cdn_mapping[ $postfix ] ;
516
+ }
517
+
518
  // Now lets replace CDN url
519
  if ( strpos( $this->cfg_url_ori, '*' ) !== false ) {
520
+ $url = preg_replace( '#' . $scheme . $this->cfg_url_ori . '#iU', $final_url, $url ) ;
521
  }
522
  else {
523
+ $url = str_replace( $scheme . $this->cfg_url_ori, $final_url, $url ) ;
524
  }
525
  LiteSpeed_Cache_Log::debug2( 'CDN: after rewritten: ' . $url ) ;
526
 
553
  wp_register_script( 'jquery', $src, false, $v ) ;
554
  }
555
 
556
+ /**
557
+ * Get Cloudflare development mode
558
+ *
559
+ * @since 1.7.2
560
+ * @access private
561
+ */
562
+ private function _cloudflare_get_devmode( $show_msg = true )
563
+ {
564
+ LiteSpeed_Cache_Log::debug( 'CDN: _cloudflare_get_devmode' ) ;
565
+
566
+ $zone = $this->_cloudflare_zone() ;
567
+ if ( ! $zone ) {
568
+ return ;
569
+ }
570
+
571
+ $url = 'https://api.cloudflare.com/client/v4/zones/' . $zone . '/settings/development_mode' ;
572
+ $res = $this->_cloudflare_call( $url, 'GET', false, false, $show_msg ) ;
573
+
574
+ if ( ! $res ) {
575
+ return ;
576
+ }
577
+ LiteSpeed_Cache_Log::debug( 'CDN: _cloudflare_get_devmode result ', $res ) ;
578
+
579
+ $curr_status = get_option( LiteSpeed_Cache_Config::ITEM_CLOUDFLARE_STATUS, array() ) ;
580
+ $curr_status[ 'devmode' ] = $res[ 'value' ] ;
581
+ $curr_status[ 'devmode_expired' ] = $res[ 'time_remaining' ] + time() ;
582
+
583
+ // update status
584
+ update_option( LiteSpeed_Cache_Config::ITEM_CLOUDFLARE_STATUS, $curr_status ) ;
585
+
586
+ }
587
+
588
+ /**
589
+ * Set Cloudflare development mode
590
+ *
591
+ * @since 1.7.2
592
+ * @access private
593
+ */
594
+ private function _cloudflare_set_devmode( $type )
595
+ {
596
+ LiteSpeed_Cache_Log::debug( 'CDN: _cloudflare_set_devmode' ) ;
597
+
598
+ $zone = $this->_cloudflare_zone() ;
599
+ if ( ! $zone ) {
600
+ return ;
601
+ }
602
+
603
+ $url = 'https://api.cloudflare.com/client/v4/zones/' . $zone . '/settings/development_mode' ;
604
+ $new_val = $type == self::TYPE_CLOUDFLARE_SET_DEVMODE_ON ? 'on' : 'off' ;
605
+ $data = array( 'value' => $new_val ) ;
606
+ $res = $this->_cloudflare_call( $url, 'PATCH', $data ) ;
607
+
608
+ if ( ! $res ) {
609
+ return ;
610
+ }
611
+
612
+ $res = $this->_cloudflare_get_devmode( false ) ;
613
+
614
+ if ( $res ) {
615
+ $msg = sprintf( __( 'Notified Cloudflare to set development mode to %s successfully.', 'litespeed-cache' ), strtoupper( $new_val ) ) ;
616
+ LiteSpeed_Cache_Admin_Display::succeed( $msg ) ;
617
+ }
618
+
619
+ }
620
+
621
+ /**
622
+ * Purge Cloudflare cache
623
+ *
624
+ * @since 1.7.2
625
+ * @access private
626
+ */
627
+ private function _cloudflare_purge_all()
628
+ {
629
+ LiteSpeed_Cache_Log::debug( 'CDN: _cloudflare_purge_all' ) ;
630
+
631
+ $cf_on = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE ) ;
632
+ if ( ! $cf_on ) {
633
+ $msg = __( 'Cloudflare API is set to off.', 'litespeed-cache' ) ;
634
+ LiteSpeed_Cache_Admin_Display::error( $msg ) ;
635
+ return ;
636
+ }
637
+
638
+ $zone = $this->_cloudflare_zone() ;
639
+ if ( ! $zone ) {
640
+ return ;
641
+ }
642
+
643
+ $url = 'https://api.cloudflare.com/client/v4/zones/' . $zone . '/purge_cache' ;
644
+ $data = array( 'purge_everything' => true ) ;
645
+
646
+ $res = $this->_cloudflare_call( $url, 'DELETE', $data ) ;
647
+
648
+ if ( $res ) {
649
+ $msg = __( 'Notified Cloudflare to purge all successfully.', 'litespeed-cache' ) ;
650
+ LiteSpeed_Cache_Admin_Display::succeed( $msg ) ;
651
+ }
652
+ }
653
+
654
+ /**
655
+ * Get current Cloudflare zone from cfg
656
+ *
657
+ * @since 1.7.2
658
+ * @access private
659
+ */
660
+ private function _cloudflare_zone()
661
+ {
662
+ $zone = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE_ZONE ) ;
663
+ if ( ! $zone ) {
664
+ $msg = __( 'No available Cloudflare zone', 'litespeed-cache' ) ;
665
+ LiteSpeed_Cache_Admin_Display::error( $msg ) ;
666
+ return false ;
667
+ }
668
+
669
+ return $zone ;
670
+ }
671
+
672
+ /**
673
+ * Get Cloudflare zone settings
674
+ *
675
+ * @since 1.7.2
676
+ * @access public
677
+ */
678
+ public function cloudflare_fetch_zone( $options )
679
+ {
680
+ $url = 'https://api.cloudflare.com/client/v4/zones?status=active&match=all' ;
681
+
682
+ $zones = $this->_cloudflare_call( $url, 'GET', false, $options, false ) ;
683
+
684
+ if ( ! $zones ) {
685
+ return false ;
686
+ }
687
+
688
+ $kw = $options[ LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE_NAME ] ;
689
+ if ( ! $kw ) {
690
+ return $zones[ 0 ] ;
691
+ }
692
+
693
+ foreach ( $zones as $v ) {
694
+ if ( strpos( $v[ 'name' ], $kw ) !== false ) {
695
+ return $v ;
696
+ }
697
+ }
698
+
699
+ return $zones[ 0 ] ;
700
+ }
701
+
702
+ /**
703
+ * Cloudflare API
704
+ *
705
+ * @since 1.7.2
706
+ * @access private
707
+ */
708
+ private function _cloudflare_call( $url, $method = 'GET', $data = false, $token = false, $show_msg = true )
709
+ {
710
+ LiteSpeed_Cache_Log::debug( "CDN: _cloudflare_call \t\t[URL] $url" ) ;
711
+
712
+ $header = array(
713
+ 'Content-Type: application/json',
714
+ ) ;
715
+ if ( $token ) {
716
+ LiteSpeed_Cache_Log::debug2( 'CDN: _cloudflare_call use param token' ) ;
717
+ $header[] = 'X-Auth-Email: ' . $token[ LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE_EMAIL ] ;
718
+ $header[] = 'X-Auth-Key: ' . $token[ LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE_KEY ] ;
719
+ }
720
+ else {
721
+ $header[] = 'X-Auth-Email: ' . LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE_EMAIL ) ;
722
+ $header[] = 'X-Auth-Key: ' . LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE_KEY ) ;
723
+ }
724
+
725
+ $ch = curl_init() ;
726
+ curl_setopt( $ch, CURLOPT_URL, $url ) ;
727
+ curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, $method ) ;
728
+ curl_setopt( $ch, CURLOPT_HTTPHEADER, $header ) ;
729
+ curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ) ;
730
+ if ( $data ) {
731
+ if ( is_array( $data ) ) {
732
+ $data = json_encode( $data ) ;
733
+ }
734
+ curl_setopt( $ch, CURLOPT_POSTFIELDS, $data ) ;
735
+ }
736
+ $result = curl_exec( $ch ) ;
737
+
738
+ $json = json_decode( $result, true ) ;
739
+
740
+ if ( $json && $json[ 'success' ] && $json[ 'result' ] ) {
741
+ LiteSpeed_Cache_Log::debug( "CDN: _cloudflare_call called successfully" ) ;
742
+ if ( $show_msg ) {
743
+ $msg = __( 'Communicated with Cloudflare successfully.', 'litespeed-cache' ) ;
744
+ LiteSpeed_Cache_Admin_Display::succeed( $msg ) ;
745
+ }
746
+
747
+ return $json[ 'result' ] ;
748
+ }
749
+
750
+ LiteSpeed_Cache_Log::debug( "CDN: _cloudflare_call called failed: $result" ) ;
751
+ if ( $show_msg ) {
752
+ $msg = __( 'Failed to communicate with Cloudflare', 'litespeed-cache' ) ;
753
+ LiteSpeed_Cache_Admin_Display::error( $msg ) ;
754
+ }
755
+
756
+ return false ;
757
+ }
758
+
759
  /**
760
  * Get the current instance object.
761
  *
includes/litespeed-cache-config.class.php CHANGED
@@ -23,6 +23,17 @@ class LiteSpeed_Cache_Config
23
  const ITEM_MEDIA_LAZY_IMG_EXC = 'litespeed-media-lazy-img-excludes' ;
24
  const ITEM_MEDIA_NEED_PULL = 'litespeed-media-need-pull' ;
25
  const ITEM_ENV_REF = 'litespeed-env-ref' ;
 
 
 
 
 
 
 
 
 
 
 
26
 
27
  const VAL_OFF = 0 ;
28
  const VAL_ON = 1 ;
@@ -54,6 +65,7 @@ class LiteSpeed_Cache_Config
54
 
55
  const OPID_LOGIN_COOKIE = 'login_cookie' ;
56
  const OPID_CHECK_ADVANCEDCACHE = 'check_advancedcache' ;
 
57
  // do NOT set default options for these three, it is used for admin.
58
  const ID_NOCACHE_COOKIES = 'nocache_cookies' ;
59
  const ID_NOCACHE_USERAGENTS = 'nocache_useragents' ;
@@ -95,6 +107,8 @@ class LiteSpeed_Cache_Config
95
  const OPID_EXCLUDES_CAT = 'excludes_cat' ;
96
  const OPID_EXCLUDES_TAG = 'excludes_tag' ;
97
 
 
 
98
  const OPID_CSS_MINIFY = 'css_minify' ;
99
  const OPID_CSS_COMBINE = 'css_combine' ;
100
  const OPID_CSS_COMBINED_PRIORITY = 'css_combined_priority' ;
@@ -115,16 +129,18 @@ class LiteSpeed_Cache_Config
115
  const OPID_OPTM_EXCLUDES = 'optm_excludes' ;
116
  const OPID_OPTM_EXC_JQUERY = 'optm_exclude_jquery' ;
117
  const OPID_OPTM_GGFONTS_ASYNC = 'optm_ggfonts_async' ;
 
 
118
 
119
  const OPID_CDN = 'cdn' ;
120
  const OPID_CDN_ORI = 'cdn_ori' ;
121
- const OPID_CDN_URL = 'cdn_url' ;
122
- const OPID_CDN_INC_IMG = 'cdn_inc_img' ;
123
- const OPID_CDN_INC_CSS = 'cdn_inc_css' ;
124
- const OPID_CDN_INC_JS = 'cdn_inc_js' ;
125
- const OPID_CDN_FILETYPE = 'cdn_filetype' ;
126
  const OPID_CDN_EXCLUDE = 'cdn_exclude' ;
127
  const OPID_CDN_REMOTE_JQUERY = 'cdn_remote_jquery' ;
 
 
 
 
 
128
 
129
  const OPID_MEDIA_IMG_LAZY = 'media_img_lazy' ;
130
  const OPID_MEDIA_IMG_LAZY_PLACEHOLDER = 'media_img_lazy_placeholder' ;
@@ -199,13 +215,13 @@ class LiteSpeed_Cache_Config
199
  }
200
 
201
  // Vary group settings
202
- $this->vary_groups = (array) get_option( self::VARY_GROUP ) ;
203
 
204
  // Exclude optimization role setting
205
- $this->exclude_optimization_roles = (array) get_option( self::EXCLUDE_OPTIMIZATION_ROLES ) ;
206
 
207
  // Exclude cache role setting
208
- $this->exclude_cache_roles = (array) get_option( self::EXCLUDE_CACHE_ROLES ) ;
209
 
210
  // Set security key if not initialized yet
211
  if ( isset( $this->options[ self::HASH ] ) && empty( $this->options[ self::HASH ] ) ) {
@@ -512,6 +528,7 @@ class LiteSpeed_Cache_Config
512
 
513
  self::OPID_LOGIN_COOKIE => '',
514
  self::OPID_CHECK_ADVANCEDCACHE => true,
 
515
  self::OPID_DEBUG => self::LOG_LEVEL_NONE,
516
  self::OPID_ADMIN_IPS => '127.0.0.1',
517
  self::OPID_DEBUG_LEVEL => false,
@@ -535,6 +552,8 @@ class LiteSpeed_Cache_Config
535
  self::OPID_EXCLUDES_CAT => '',
536
  self::OPID_EXCLUDES_TAG => '',
537
 
 
 
538
  self::OPID_CSS_MINIFY => false,
539
  self::OPID_CSS_COMBINE => false,
540
  self::OPID_CSS_COMBINED_PRIORITY => false,
@@ -555,16 +574,18 @@ class LiteSpeed_Cache_Config
555
  self::OPID_OPTM_EXCLUDES => '',
556
  self::OPID_OPTM_EXC_JQUERY => true,
557
  self::OPID_OPTM_GGFONTS_ASYNC => false,
 
 
558
 
559
  self::OPID_CDN => false,
560
  self::OPID_CDN_ORI => '',
561
- self::OPID_CDN_URL => '',
562
- self::OPID_CDN_INC_IMG => false,
563
- self::OPID_CDN_INC_CSS => false,
564
- self::OPID_CDN_INC_JS => false,
565
- self::OPID_CDN_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",
566
  self::OPID_CDN_EXCLUDE => '',
567
  self::OPID_CDN_REMOTE_JQUERY => false,
 
 
 
 
 
568
 
569
  self::OPID_MEDIA_IMG_LAZY => false,
570
  self::OPID_MEDIA_IMG_LAZY_PLACEHOLDER => '',
@@ -769,12 +790,28 @@ class LiteSpeed_Cache_Config
769
  return ;
770
  }
771
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
772
  $this->options = self::option_diff( $default_options, $this->options ) ;
773
 
774
  $res = $this->update_options() ;
775
  define( 'LSWCP_EMPTYCACHE', true ) ;// clear all sites caches
776
  LiteSpeed_Cache_Purge::purge_all() ;
777
- LiteSpeed_Cache_Log::debug( "plugin_upgrade option changed = $res\n" ) ;
778
  }
779
 
780
  /**
23
  const ITEM_MEDIA_LAZY_IMG_EXC = 'litespeed-media-lazy-img-excludes' ;
24
  const ITEM_MEDIA_NEED_PULL = 'litespeed-media-need-pull' ;
25
  const ITEM_ENV_REF = 'litespeed-env-ref' ;
26
+ const ITEM_CACHE_DROP_QS = 'litespeed-cache-drop_qs' ;
27
+ const ITEM_CDN_MAPPING = 'litespeed-cache-cdn_mapping' ;
28
+ const ITEM_DNS_PREFETCH = 'litespeed-cache-dns_prefetch' ;
29
+ const ITEM_CLOUDFLARE_STATUS = 'litespeed-cache-cloudflare_status' ;
30
+ // const ITEM_FAVICON = 'litespeed-cache-favicon' ;
31
+
32
+ const ITEM_CDN_MAPPING_URL = 'url' ;
33
+ const ITEM_CDN_MAPPING_INC_IMG = 'inc_img' ;
34
+ const ITEM_CDN_MAPPING_INC_CSS = 'inc_css' ;
35
+ const ITEM_CDN_MAPPING_INC_JS = 'inc_js' ;
36
+ const ITEM_CDN_MAPPING_FILETYPE = 'filetype' ;
37
 
38
  const VAL_OFF = 0 ;
39
  const VAL_ON = 1 ;
65
 
66
  const OPID_LOGIN_COOKIE = 'login_cookie' ;
67
  const OPID_CHECK_ADVANCEDCACHE = 'check_advancedcache' ;
68
+ const OPID_USE_HTTP_FOR_HTTPS_VARY = 'use_http_for_https_vary' ;
69
  // do NOT set default options for these three, it is used for admin.
70
  const ID_NOCACHE_COOKIES = 'nocache_cookies' ;
71
  const ID_NOCACHE_USERAGENTS = 'nocache_useragents' ;
107
  const OPID_EXCLUDES_CAT = 'excludes_cat' ;
108
  const OPID_EXCLUDES_TAG = 'excludes_tag' ;
109
 
110
+ // const OPID_ADV_FAVICON = 'adv_favicon' ;
111
+
112
  const OPID_CSS_MINIFY = 'css_minify' ;
113
  const OPID_CSS_COMBINE = 'css_combine' ;
114
  const OPID_CSS_COMBINED_PRIORITY = 'css_combined_priority' ;
129
  const OPID_OPTM_EXCLUDES = 'optm_excludes' ;
130
  const OPID_OPTM_EXC_JQUERY = 'optm_exclude_jquery' ;
131
  const OPID_OPTM_GGFONTS_ASYNC = 'optm_ggfonts_async' ;
132
+ const OPID_OPTM_MAX_SIZE = 'optm_max_size' ;
133
+ const OPID_OPTM_RM_COMMENT = 'optm_rm_comment' ;
134
 
135
  const OPID_CDN = 'cdn' ;
136
  const OPID_CDN_ORI = 'cdn_ori' ;
 
 
 
 
 
137
  const OPID_CDN_EXCLUDE = 'cdn_exclude' ;
138
  const OPID_CDN_REMOTE_JQUERY = 'cdn_remote_jquery' ;
139
+ const OPID_CDN_CLOUDFLARE = 'cdn_cloudflare' ;
140
+ const OPID_CDN_CLOUDFLARE_EMAIL = 'cdn_cloudflare_email' ;
141
+ const OPID_CDN_CLOUDFLARE_KEY = 'cdn_cloudflare_key' ;
142
+ const OPID_CDN_CLOUDFLARE_NAME = 'cdn_cloudflare_name' ;
143
+ const OPID_CDN_CLOUDFLARE_ZONE = 'cdn_cloudflare_zone' ;
144
 
145
  const OPID_MEDIA_IMG_LAZY = 'media_img_lazy' ;
146
  const OPID_MEDIA_IMG_LAZY_PLACEHOLDER = 'media_img_lazy_placeholder' ;
215
  }
216
 
217
  // Vary group settings
218
+ $this->vary_groups = get_option( self::VARY_GROUP, array() ) ;
219
 
220
  // Exclude optimization role setting
221
+ $this->exclude_optimization_roles = get_option( self::EXCLUDE_OPTIMIZATION_ROLES, array() ) ;
222
 
223
  // Exclude cache role setting
224
+ $this->exclude_cache_roles = get_option( self::EXCLUDE_CACHE_ROLES, array() ) ;
225
 
226
  // Set security key if not initialized yet
227
  if ( isset( $this->options[ self::HASH ] ) && empty( $this->options[ self::HASH ] ) ) {
528
 
529
  self::OPID_LOGIN_COOKIE => '',
530
  self::OPID_CHECK_ADVANCEDCACHE => true,
531
+ self::OPID_USE_HTTP_FOR_HTTPS_VARY => false,
532
  self::OPID_DEBUG => self::LOG_LEVEL_NONE,
533
  self::OPID_ADMIN_IPS => '127.0.0.1',
534
  self::OPID_DEBUG_LEVEL => false,
552
  self::OPID_EXCLUDES_CAT => '',
553
  self::OPID_EXCLUDES_TAG => '',
554
 
555
+ // self::OPID_ADV_FAVICON => false,
556
+
557
  self::OPID_CSS_MINIFY => false,
558
  self::OPID_CSS_COMBINE => false,
559
  self::OPID_CSS_COMBINED_PRIORITY => false,
574
  self::OPID_OPTM_EXCLUDES => '',
575
  self::OPID_OPTM_EXC_JQUERY => true,
576
  self::OPID_OPTM_GGFONTS_ASYNC => false,
577
+ self::OPID_OPTM_MAX_SIZE => 1.2,
578
+ self::OPID_OPTM_RM_COMMENT => false,
579
 
580
  self::OPID_CDN => false,
581
  self::OPID_CDN_ORI => '',
 
 
 
 
 
582
  self::OPID_CDN_EXCLUDE => '',
583
  self::OPID_CDN_REMOTE_JQUERY => false,
584
+ self::OPID_CDN_CLOUDFLARE => false,
585
+ self::OPID_CDN_CLOUDFLARE_EMAIL => '',
586
+ self::OPID_CDN_CLOUDFLARE_KEY => '',
587
+ self::OPID_CDN_CLOUDFLARE_NAME => '',
588
+ self::OPID_CDN_CLOUDFLARE_ZONE => '',
589
 
590
  self::OPID_MEDIA_IMG_LAZY => false,
591
  self::OPID_MEDIA_IMG_LAZY_PLACEHOLDER => '',
790
  return ;
791
  }
792
 
793
+ /**
794
+ * Resave cdn cfg from lscfg to separate cfg when upgrade to v1.7
795
+ * @since 1.7
796
+ */
797
+ if ( isset( $this->options[ 'cdn_url' ] ) ) {
798
+ $cdn_mapping = array(
799
+ self::ITEM_CDN_MAPPING_URL => $this->options[ 'cdn_url' ],
800
+ self::ITEM_CDN_MAPPING_INC_IMG => $this->options[ 'cdn_inc_img' ],
801
+ self::ITEM_CDN_MAPPING_INC_CSS => $this->options[ 'cdn_inc_css' ],
802
+ self::ITEM_CDN_MAPPING_INC_JS => $this->options[ 'cdn_inc_js' ],
803
+ self::ITEM_CDN_MAPPING_FILETYPE => $this->options[ 'cdn_filetype' ],
804
+ ) ;
805
+ update_option( LiteSpeed_Cache_Config::ITEM_CDN_MAPPING, array( $cdn_mapping ) ) ;
806
+ LiteSpeed_Cache_Log::debug( "Config: plugin_upgrade option adding CDN map" ) ;
807
+ }
808
+
809
  $this->options = self::option_diff( $default_options, $this->options ) ;
810
 
811
  $res = $this->update_options() ;
812
  define( 'LSWCP_EMPTYCACHE', true ) ;// clear all sites caches
813
  LiteSpeed_Cache_Purge::purge_all() ;
814
+ LiteSpeed_Cache_Log::debug( "Config: plugin_upgrade option changed = $res" ) ;
815
  }
816
 
817
  /**
includes/litespeed-cache-control.class.php CHANGED
@@ -16,6 +16,7 @@ class LiteSpeed_Cache_Control
16
  const BM_PRIVATE = 2 ;
17
  const BM_SHARED = 4 ;
18
  const BM_NO_VARY = 8 ;
 
19
  const BM_STALE = 128 ;
20
  const BM_NOTCACHEABLE = 256 ;
21
 
@@ -171,6 +172,36 @@ class LiteSpeed_Cache_Control
171
  return (self::$_control & self::BM_SHARED) && self::is_private() ;
172
  }
173
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
174
  /**
175
  * Set cache control to private
176
  *
@@ -187,7 +218,7 @@ class LiteSpeed_Cache_Control
187
  if ( $reason ) {
188
  $reason = "( $reason )" ;
189
  }
190
- LiteSpeed_Cache_Log::debug( 'X Cache_control -> private ' . $reason) ;
191
  }
192
 
193
  /**
@@ -198,7 +229,7 @@ class LiteSpeed_Cache_Control
198
  */
199
  public static function is_private()
200
  {
201
- return self::$_control & self::BM_PRIVATE ;
202
  }
203
 
204
  /**
16
  const BM_PRIVATE = 2 ;
17
  const BM_SHARED = 4 ;
18
  const BM_NO_VARY = 8 ;
19
+ const BM_PUBLIC_FORCED = 64 ;
20
  const BM_STALE = 128 ;
21
  const BM_NOTCACHEABLE = 256 ;
22
 
172
  return (self::$_control & self::BM_SHARED) && self::is_private() ;
173
  }
174
 
175
+ /**
176
+ * Set cache control to forced public
177
+ *
178
+ * @access public
179
+ * @since 1.7.1
180
+ * @param string $reason The reason to no cache
181
+ */
182
+ public static function set_public_forced( $reason = false )
183
+ {
184
+ if ( self::is_public_forced() ) {
185
+ return ;
186
+ }
187
+ self::$_control |= self::BM_PUBLIC_FORCED ;
188
+ if ( $reason ) {
189
+ $reason = "( $reason )" ;
190
+ }
191
+ LiteSpeed_Cache_Log::debug( 'X Cache_control -> public forced ' . $reason ) ;
192
+ }
193
+
194
+ /**
195
+ * Check if is public forced
196
+ *
197
+ * @access public
198
+ * @since 1.7.1
199
+ */
200
+ public static function is_public_forced()
201
+ {
202
+ return self::$_control & self::BM_PUBLIC_FORCED ;
203
+ }
204
+
205
  /**
206
  * Set cache control to private
207
  *
218
  if ( $reason ) {
219
  $reason = "( $reason )" ;
220
  }
221
+ LiteSpeed_Cache_Log::debug( 'X Cache_control -> private ' . $reason ) ;
222
  }
223
 
224
  /**
229
  */
230
  public static function is_private()
231
  {
232
+ return self::$_control & self::BM_PRIVATE && ! self::is_public_forced() ;
233
  }
234
 
235
  /**
includes/litespeed-cache-gui.class.php CHANGED
@@ -33,16 +33,50 @@ class LiteSpeed_Cache_GUI
33
  add_action( 'wp_enqueue_scripts', array( $this, 'frontend_enqueue_style' ) ) ;
34
  add_action( 'admin_bar_menu', array( $this, 'frontend_shortcut' ), 95 ) ;
35
  }
 
 
 
 
 
 
 
 
 
36
  }
37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  public static function pie( $percent, $width = 50 )
39
  {
40
  return "
41
- <svg class='litespeed-media-svg' width='$width' viewBox='0 0 33.83098862 33.83098862' xmlns='http://www.w3.org/2000/svg'>
42
- <circle class='litespeed-pie_bg' cx='17.5' cy='17.5' r='16.5'></circle>
43
- <circle class='litespeed-pie_circle' cx='17' cy='17.5' r='16.5'></circle>
44
  <g class='litespeed-pie_info'>
45
- <text x='16.91549431' y='15.5' alignment-baseline='central' text-anchor='middle'>$percent%</text>
46
  </g>
47
  </svg>
48
  ";
@@ -138,8 +172,8 @@ class LiteSpeed_Cache_GUI
138
  */
139
  public function frontend_shortcut()
140
  {
141
-
142
  global $wp_admin_bar ;
 
143
  $wp_admin_bar->add_menu( array(
144
  'id' => 'litespeed-menu',
145
  'title' => '<span class="ab-icon"></span>',
@@ -191,6 +225,63 @@ class LiteSpeed_Cache_GUI
191
  ) );
192
  }
193
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
194
  /**
195
  * Finalize buffer by GUI class
196
  *
33
  add_action( 'wp_enqueue_scripts', array( $this, 'frontend_enqueue_style' ) ) ;
34
  add_action( 'admin_bar_menu', array( $this, 'frontend_shortcut' ), 95 ) ;
35
  }
36
+
37
+ // if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_ADV_FAVICON ) ) {
38
+ // if ( is_admin() ) {
39
+ // add_action( 'admin_head', array( $this, 'favicon' ) ) ;
40
+ // }
41
+ // else {
42
+ // add_action( 'wp_head', array( $this, 'favicon' ) ) ;
43
+ // }
44
+ // }
45
  }
46
 
47
+ /**
48
+ * Display the favicon
49
+ *
50
+ * @since 1.7.2
51
+ */
52
+ // public function favicon()
53
+ // {
54
+ // $current_favicon = get_option( LiteSpeed_Cache_Config::ITEM_FAVICON, array() ) ;
55
+ // if ( is_admin() ) {
56
+ // if ( ! empty( $current_favicon[ 'backend' ] ) ) {
57
+ // echo "<link rel='icon' href='$current_favicon[backend]' />" ;
58
+ // }
59
+ // }
60
+ // else {
61
+ // if ( ! empty( $current_favicon[ 'frontend' ] ) ) {
62
+ // echo "<link rel='icon' href='$current_favicon[frontend]' />" ;
63
+ // }
64
+ // }
65
+ // }
66
+
67
+ /**
68
+ * Display a pie
69
+ *
70
+ * @since 1.6.6
71
+ */
72
  public static function pie( $percent, $width = 50 )
73
  {
74
  return "
75
+ <svg class='litespeed-pie' viewbox='0 0 33.83098862 33.83098862' width='$width' height='$width' xmlns='http://www.w3.org/2000/svg'>
76
+ <circle class='litespeed-pie_bg' />
77
+ <circle class='litespeed-pie_circle' stroke-dasharray='$percent,100' />
78
  <g class='litespeed-pie_info'>
79
+ <text x='16.91549431' y='15.5'>$percent%</text>
80
  </g>
81
  </svg>
82
  ";
172
  */
173
  public function frontend_shortcut()
174
  {
 
175
  global $wp_admin_bar ;
176
+
177
  $wp_admin_bar->add_menu( array(
178
  'id' => 'litespeed-menu',
179
  'title' => '<span class="ab-icon"></span>',
225
  ) );
226
  }
227
 
228
+ /**
229
+ * Hooked to wp_before_admin_bar_render.
230
+ * Adds a link to the admin bar so users can quickly purge all.
231
+ *
232
+ * @access public
233
+ * @global WP_Admin_Bar $wp_admin_bar
234
+ * @since 1.7.2 Moved from admin_display.cls to gui.cls; Renamed from `add_quick_purge` to `backend_shortcut`
235
+ */
236
+ public function backend_shortcut()
237
+ {
238
+ global $wp_admin_bar ;
239
+
240
+ $wp_admin_bar->add_menu( array(
241
+ 'id' => 'litespeed-menu',
242
+ 'title' => '<span class="ab-icon"></span><span class="ab-label">' . __( 'LiteSpeed Cache Purge All', 'litespeed-cache' ) . '</span>',
243
+ 'href' => LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_PURGE_ALL ),
244
+ 'meta' => array( 'tabindex' => 0, 'class' => 'litespeed-top-toolbar' ),
245
+ ) ) ;
246
+
247
+ $wp_admin_bar->add_menu( array(
248
+ 'parent' => 'litespeed-menu',
249
+ 'id' => 'litespeed-bar-manage',
250
+ 'title' => __( 'Manage', 'litespeed-cache' ),
251
+ 'href' => 'admin.php?page=lscache-dash',
252
+ 'meta' => array( 'tabindex' => '0' ),
253
+ ) );
254
+
255
+ $wp_admin_bar->add_menu( array(
256
+ 'parent' => 'litespeed-menu',
257
+ 'id' => 'litespeed-bar-setting',
258
+ 'title' => __( 'Settings', 'litespeed-cache' ),
259
+ 'href' => 'admin.php?page=lscache-settings',
260
+ 'meta' => array( 'tabindex' => '0' ),
261
+ ) );
262
+
263
+ if ( ! is_network_admin() ) {
264
+ $wp_admin_bar->add_menu( array(
265
+ 'parent' => 'litespeed-menu',
266
+ 'id' => 'litespeed-bar-imgoptm',
267
+ 'title' => __( 'Image Optimization', 'litespeed-cache' ),
268
+ 'href' => 'admin.php?page=lscache-optimization',
269
+ 'meta' => array( 'tabindex' => '0' ),
270
+ ) );
271
+ }
272
+
273
+ if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE ) ) {
274
+ $wp_admin_bar->add_menu( array(
275
+ 'parent' => 'litespeed-menu',
276
+ 'id' => 'litespeed-purge-cloudflare',
277
+ 'title' => __( 'Cloudflare Purge All', 'litespeed-cache' ),
278
+ 'href' => LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_CDN, LiteSpeed_Cache_CDN::TYPE_CLOUDFLARE_PURGE_ALL ),
279
+ 'meta' => array( 'tabindex' => '0' ),
280
+ ) );
281
+ }
282
+
283
+ }
284
+
285
  /**
286
  * Finalize buffer by GUI class
287
  *
includes/litespeed-cache-optimize.class.php CHANGED
@@ -33,7 +33,9 @@ class LiteSpeed_Cache_Optimize
33
  private $cfg_qs_rm ;
34
  private $cfg_exc_jquery ;
35
  private $cfg_ggfonts_async ;
 
36
 
 
37
 
38
  private $html_foot = '' ; // The html info append to <body>
39
  private $html_head = '' ; // The html info prepend to <body>
@@ -66,6 +68,7 @@ class LiteSpeed_Cache_Optimize
66
  $this->cfg_qs_rm = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTM_QS_RM ) ;
67
  $this->cfg_exc_jquery = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTM_EXC_JQUERY ) ;
68
  $this->cfg_ggfonts_async = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTM_GGFONTS_ASYNC ) ;
 
69
 
70
  $this->_static_request_check() ;
71
 
@@ -105,6 +108,12 @@ class LiteSpeed_Cache_Optimize
105
  */
106
  add_filter( 'litespeed_vary', array( $this, 'vary_add_role_exclude' ) ) ;
107
 
 
 
 
 
 
 
108
  }
109
 
110
  /**
@@ -175,11 +184,12 @@ class LiteSpeed_Cache_Optimize
175
  LiteSpeed_Cache_Log::debug( 'Optimizer start serving static file' ) ;
176
 
177
  LiteSpeed_Cache_Control::set_cacheable() ;
 
178
  LiteSpeed_Cache_Control::set_no_vary() ;
179
  LiteSpeed_Cache_Control::set_custom_ttl( 8640000 ) ;
180
  LiteSpeed_Cache_Tag::add( LiteSpeed_Cache_Tag::TYPE_MIN . '_CSS_ASYNC' ) ;
181
 
182
- $file = LSWCP_DIR . 'js/css_async.js' ;
183
 
184
  header( 'Content-Length: ' . filesize( $file ) ) ;
185
  header( 'Content-Type: application/x-javascript; charset=utf-8' ) ;
@@ -221,6 +231,7 @@ class LiteSpeed_Cache_Optimize
221
  }
222
 
223
  LiteSpeed_Cache_Control::set_cacheable() ;
 
224
  LiteSpeed_Cache_Control::set_no_vary() ;
225
  LiteSpeed_Cache_Control::set_custom_ttl( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTIMIZE_TTL ) ) ;
226
  LiteSpeed_Cache_Tag::add( LiteSpeed_Cache_Tag::TYPE_MIN ) ;
@@ -388,7 +399,7 @@ class LiteSpeed_Cache_Optimize
388
  }
389
 
390
  // Move all css to top
391
- $this->content = str_replace( $html_list, '', $this->content ) ;
392
 
393
  // Add to HTTP2
394
  foreach ( $urls as $url ) {
@@ -614,6 +625,63 @@ class LiteSpeed_Cache_Optimize
614
 
615
  }
616
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
617
  /**
618
  * Limit combined filesize when build hash url
619
  *
@@ -633,7 +701,7 @@ class LiteSpeed_Cache_Optimize
633
 
634
  $total += $file_size_list[ $k ] ;
635
 
636
- if ( $total > 1000000 ) { // If larger than 1M, separate them
637
  $total = 0;
638
  $i ++ ;
639
  }
@@ -695,15 +763,15 @@ class LiteSpeed_Cache_Optimize
695
  */
696
  private function _analyse_links( $src_list, $html_list, $file_type = 'css' )
697
  {
698
- if ( $file_type == 'css' ) {
699
- $excludes = apply_filters( 'litespeed_cache_optimize_css_excludes', LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CSS_EXCLUDES ) ) ;
700
- }
701
- else {
702
- $excludes = apply_filters( 'litespeed_cache_optimize_js_excludes', LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_JS_EXCLUDES ) ) ;
703
- }
704
- if ( $excludes ) {
705
- $excludes = explode( "\n", $excludes ) ;
706
- }
707
 
708
  $ignored_html = array() ;
709
  $src_queue_list = array() ;
@@ -713,15 +781,15 @@ class LiteSpeed_Cache_Optimize
713
  foreach ( $src_list as $key => $src ) {
714
  LiteSpeed_Cache_Log::debug2( 'Optm: ' . $src ) ;
715
 
716
- if ( $excludes ) {
717
- foreach ( $excludes as $exclude ) {
718
- if ( stripos( $src, $exclude ) !== false ) {
719
- $ignored_html[] = $html_list[ $key ] ;
720
- LiteSpeed_Cache_Log::debug2( 'Optm: Abort excludes: ' . $exclude ) ;
721
- continue 2 ;
722
- }
723
- }
724
- }
725
 
726
  // Check if has no-optimize attr
727
  if ( strpos( $html_list[ $key ], 'data-no-optimize' ) !== false ) {
@@ -856,6 +924,11 @@ class LiteSpeed_Cache_Optimize
856
  */
857
  private function _parse_js()
858
  {
 
 
 
 
 
859
  $src_list = array() ;
860
  $html_list = array() ;
861
  $head_src_list = array() ;
@@ -884,6 +957,11 @@ class LiteSpeed_Cache_Optimize
884
  if ( in_array( $match[ 0 ], $html_list ) ) {
885
  continue ;
886
  }
 
 
 
 
 
887
 
888
  $src_list[] = $attrs[ 'src' ] ;
889
  $html_list[] = $match[ 0 ] ;
@@ -905,6 +983,11 @@ class LiteSpeed_Cache_Optimize
905
  */
906
  private function _handle_css()
907
  {
 
 
 
 
 
908
  $this->css_to_be_removed = apply_filters( 'litespeed_optm_css_to_be_removed', $this->css_to_be_removed ) ;
909
 
910
  $src_list = array() ;
@@ -935,6 +1018,11 @@ class LiteSpeed_Cache_Optimize
935
  continue ;
936
  }
937
 
 
 
 
 
 
938
  // Check if need to remove this css
939
  if ( $this->css_to_be_removed && LiteSpeed_Cache_Utility::str_hit_array( $attrs[ 'href' ], $this->css_to_be_removed ) ) {
940
  LiteSpeed_Cache_Log::debug( 'Optm: rm css snippet ' . $attrs[ 'href' ] ) ;
@@ -1036,12 +1124,9 @@ class LiteSpeed_Cache_Optimize
1036
  * Exclude js from setting
1037
  * @since 1.5
1038
  */
1039
- if ( $this->cfg_js_defer_exc ) {
1040
-
1041
- if ( LiteSpeed_Cache_Utility::str_hit_array( $src, $this->cfg_js_defer_exc ) ) {
1042
- LiteSpeed_Cache_Log::debug( 'Optm: js defer exclude ' . $src ) ;
1043
- continue ;
1044
- }
1045
  }
1046
 
1047
  /**
@@ -1142,6 +1227,14 @@ class LiteSpeed_Cache_Optimize
1142
 
1143
  $this->minify_options[ 'files' ] = $files ;
1144
 
 
 
 
 
 
 
 
 
1145
  $content = $this->minify_minify->serve( $this->minify_controller, $this->minify_options ) ;
1146
 
1147
  } catch ( ErrorException $e ) {
@@ -1154,6 +1247,41 @@ class LiteSpeed_Cache_Optimize
1154
  return $content ;
1155
  }
1156
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1157
  /**
1158
  * Get the current instance object.
1159
  *
33
  private $cfg_qs_rm ;
34
  private $cfg_exc_jquery ;
35
  private $cfg_ggfonts_async ;
36
+ private $cfg_optm_max_size ;
37
 
38
+ private $dns_prefetch ;
39
 
40
  private $html_foot = '' ; // The html info append to <body>
41
  private $html_head = '' ; // The html info prepend to <body>
68
  $this->cfg_qs_rm = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTM_QS_RM ) ;
69
  $this->cfg_exc_jquery = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTM_EXC_JQUERY ) ;
70
  $this->cfg_ggfonts_async = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTM_GGFONTS_ASYNC ) ;
71
+ $this->cfg_optm_max_size = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTM_MAX_SIZE ) * 1000000 ;
72
 
73
  $this->_static_request_check() ;
74
 
108
  */
109
  add_filter( 'litespeed_vary', array( $this, 'vary_add_role_exclude' ) ) ;
110
 
111
+ /**
112
+ * Prefetch DNS
113
+ * @since 1.7.1
114
+ */
115
+ $this->_dns_prefetch_init() ;
116
+
117
  }
118
 
119
  /**
184
  LiteSpeed_Cache_Log::debug( 'Optimizer start serving static file' ) ;
185
 
186
  LiteSpeed_Cache_Control::set_cacheable() ;
187
+ LiteSpeed_Cache_Control::set_public_forced( 'OPTM: css async js' ) ;
188
  LiteSpeed_Cache_Control::set_no_vary() ;
189
  LiteSpeed_Cache_Control::set_custom_ttl( 8640000 ) ;
190
  LiteSpeed_Cache_Tag::add( LiteSpeed_Cache_Tag::TYPE_MIN . '_CSS_ASYNC' ) ;
191
 
192
+ $file = LSWCP_DIR . 'js/css_async.min.js' ;
193
 
194
  header( 'Content-Length: ' . filesize( $file ) ) ;
195
  header( 'Content-Type: application/x-javascript; charset=utf-8' ) ;
231
  }
232
 
233
  LiteSpeed_Cache_Control::set_cacheable() ;
234
+ LiteSpeed_Cache_Control::set_public_forced( 'OPTM: min file ' . $match[ 1 ] ) ;
235
  LiteSpeed_Cache_Control::set_no_vary() ;
236
  LiteSpeed_Cache_Control::set_custom_ttl( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTIMIZE_TTL ) ) ;
237
  LiteSpeed_Cache_Tag::add( LiteSpeed_Cache_Tag::TYPE_MIN ) ;
399
  }
400
 
401
  // Move all css to top
402
+ $this->content = str_replace( $html_list, '', $this->content ) ;// todo: need to keep position for certain files
403
 
404
  // Add to HTTP2
405
  foreach ( $urls as $url ) {
625
 
626
  }
627
 
628
+ /**
629
+ * Prefetch DNS
630
+ *
631
+ * @since 1.7.1
632
+ * @access private
633
+ */
634
+ private function _dns_prefetch_init()
635
+ {
636
+ $this->dns_prefetch = get_option( LiteSpeed_Cache_Config::ITEM_DNS_PREFETCH ) ;
637
+ if ( ! $this->dns_prefetch ) {
638
+ return ;
639
+ }
640
+
641
+ if ( function_exists( 'wp_resource_hints' ) ) {
642
+ add_filter( 'wp_resource_hints', array( $this, 'dns_prefetch_filter' ), 10, 2 ) ;
643
+ }
644
+ else {
645
+ add_action( 'litespeed_optm', array( $this, 'dns_prefetch_output' ) ) ;
646
+ }
647
+ }
648
+
649
+ /**
650
+ * Prefetch DNS hook for WP
651
+ *
652
+ * @since 1.7.1
653
+ * @access public
654
+ */
655
+ public function dns_prefetch_filter( $urls, $relation_type )
656
+ {
657
+ if ( $relation_type !== 'dns-prefetch' ) {
658
+ return $urls ;
659
+ }
660
+
661
+ foreach ( explode( "\n", $this->dns_prefetch ) as $v ) {
662
+ if ( $v ) {
663
+ $urls[] = $v ;
664
+ }
665
+ }
666
+
667
+ return $urls ;
668
+ }
669
+
670
+ /**
671
+ * Prefetch DNS
672
+ *
673
+ * @since 1.7.1
674
+ * @access public
675
+ */
676
+ public function dns_prefetch_output()
677
+ {
678
+ foreach ( explode( "\n", $this->dns_prefetch ) as $v ) {
679
+ if ( $v ) {
680
+ $this->html_head .= "<link rel='dns-prefetch' href='$v' />" ;
681
+ }
682
+ }
683
+ }
684
+
685
  /**
686
  * Limit combined filesize when build hash url
687
  *
701
 
702
  $total += $file_size_list[ $k ] ;
703
 
704
+ if ( $total > $this->cfg_optm_max_size ) { // If larger than 1M, separate them
705
  $total = 0;
706
  $i ++ ;
707
  }
763
  */
764
  private function _analyse_links( $src_list, $html_list, $file_type = 'css' )
765
  {
766
+ // if ( $file_type == 'css' ) {
767
+ // $excludes = apply_filters( 'litespeed_cache_optimize_css_excludes', LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CSS_EXCLUDES ) ) ;
768
+ // }
769
+ // else {
770
+ // $excludes = apply_filters( 'litespeed_cache_optimize_js_excludes', LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_JS_EXCLUDES ) ) ;
771
+ // }
772
+ // if ( $excludes ) {
773
+ // $excludes = explode( "\n", $excludes ) ;
774
+ // }
775
 
776
  $ignored_html = array() ;
777
  $src_queue_list = array() ;
781
  foreach ( $src_list as $key => $src ) {
782
  LiteSpeed_Cache_Log::debug2( 'Optm: ' . $src ) ;
783
 
784
+ /**
785
+ * Excluded links won't be done any optm
786
+ * @since 1.7
787
+ */
788
+ // if ( $excludes && $exclude = LiteSpeed_Cache_Utility::str_hit_array( $src, $excludes ) ) {
789
+ // $ignored_html[] = $html_list[ $key ] ;
790
+ // LiteSpeed_Cache_Log::debug2( 'Optm: Abort excludes: ' . $exclude ) ;
791
+ // continue ;
792
+ // }
793
 
794
  // Check if has no-optimize attr
795
  if ( strpos( $html_list[ $key ], 'data-no-optimize' ) !== false ) {
924
  */
925
  private function _parse_js()
926
  {
927
+ $excludes = apply_filters( 'litespeed_cache_optimize_js_excludes', LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_JS_EXCLUDES ) ) ;
928
+ if ( $excludes ) {
929
+ $excludes = explode( "\n", $excludes ) ;
930
+ }
931
+
932
  $src_list = array() ;
933
  $html_list = array() ;
934
  $head_src_list = array() ;
957
  if ( in_array( $match[ 0 ], $html_list ) ) {
958
  continue ;
959
  }
960
+ // todo @v2.0: allow defer even exclude from optm
961
+ if ( $excludes && $exclude = LiteSpeed_Cache_Utility::str_hit_array( $attrs[ 'src' ], $excludes ) ) {
962
+ LiteSpeed_Cache_Log::debug2( 'Optm: _parse_js bypassed exclude ' . $exclude ) ;
963
+ continue ;
964
+ }
965
 
966
  $src_list[] = $attrs[ 'src' ] ;
967
  $html_list[] = $match[ 0 ] ;
983
  */
984
  private function _handle_css()
985
  {
986
+ $excludes = apply_filters( 'litespeed_cache_optimize_css_excludes', LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CSS_EXCLUDES ) ) ;
987
+ if ( $excludes ) {
988
+ $excludes = explode( "\n", $excludes ) ;
989
+ }
990
+
991
  $this->css_to_be_removed = apply_filters( 'litespeed_optm_css_to_be_removed', $this->css_to_be_removed ) ;
992
 
993
  $src_list = array() ;
1018
  continue ;
1019
  }
1020
 
1021
+ if ( $excludes && $exclude = LiteSpeed_Cache_Utility::str_hit_array( $attrs[ 'href' ], $excludes ) ) {
1022
+ LiteSpeed_Cache_Log::debug2( 'Optm: _handle_css bypassed exclude ' . $exclude ) ;
1023
+ continue ;
1024
+ }
1025
+
1026
  // Check if need to remove this css
1027
  if ( $this->css_to_be_removed && LiteSpeed_Cache_Utility::str_hit_array( $attrs[ 'href' ], $this->css_to_be_removed ) ) {
1028
  LiteSpeed_Cache_Log::debug( 'Optm: rm css snippet ' . $attrs[ 'href' ] ) ;
1124
  * Exclude js from setting
1125
  * @since 1.5
1126
  */
1127
+ if ( $this->cfg_js_defer_exc && LiteSpeed_Cache_Utility::str_hit_array( $src, $this->cfg_js_defer_exc ) ) {
1128
+ LiteSpeed_Cache_Log::debug( 'Optm: js defer exclude ' . $src ) ;
1129
+ continue ;
 
 
 
1130
  }
1131
 
1132
  /**
1227
 
1228
  $this->minify_options[ 'files' ] = $files ;
1229
 
1230
+ /**
1231
+ * Clean comment when minify
1232
+ * @since 1.7.1
1233
+ */
1234
+ if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTM_RM_COMMENT ) ) {
1235
+ $this->minify_options[ 'postprocessor' ] = __CLASS__ . '::remove_comment' ;
1236
+ }
1237
+
1238
  $content = $this->minify_minify->serve( $this->minify_controller, $this->minify_options ) ;
1239
 
1240
  } catch ( ErrorException $e ) {
1247
  return $content ;
1248
  }
1249
 
1250
+ /**
1251
+ * Remove comment when minify
1252
+ *
1253
+ * @since 1.7.1
1254
+ * @access public
1255
+ */
1256
+ public static function remove_comment( $content, $type )
1257
+ {
1258
+ $_from = array(
1259
+ '|\/\*.*\*\/|U',
1260
+ '|\/\*.*\*\/|sU',
1261
+ "|\n+|",
1262
+ // "|;+\n*;+|",
1263
+ // "|\n+;|",
1264
+ // "|;\n+|"
1265
+ ) ;
1266
+
1267
+ $_to = array(
1268
+ '',
1269
+ "\n",
1270
+ "\n",
1271
+ // ';',
1272
+ // ';',
1273
+ // ';',
1274
+ ) ;
1275
+
1276
+ $content = preg_replace( $_from, $_to, $content ) ;
1277
+ if ( $type == 'text/css' ) {
1278
+ $content = preg_replace( "|: *|", ':', $content ) ;
1279
+ $content = preg_replace( "| */ *|", '/', $content ) ;
1280
+ }
1281
+ $content = trim( $content ) ;
1282
+ return $content ;
1283
+ }
1284
+
1285
  /**
1286
  * Get the current instance object.
1287
  *
includes/litespeed-cache-router.class.php CHANGED
@@ -62,7 +62,7 @@ class LiteSpeed_Cache_Router
62
  $role = false ;
63
  if ( $uid ) {
64
  $user = get_userdata( $uid ) ;
65
- if ( is_array( $user->roles ) ) {
66
  $tmp = array_values( $user->roles ) ;
67
  $role = array_shift( $tmp ) ;
68
  }
@@ -343,6 +343,8 @@ class LiteSpeed_Cache_Router
343
  case LiteSpeed_Cache::ACTION_DO_CRAWL:
344
  case LiteSpeed_Cache::ACTION_BLACKLIST_SAVE:
345
  case LiteSpeed_Cache::ACTION_MEDIA:
 
 
346
  if ( defined( 'LITESPEED_ON' ) && $_can_option && ! $_is_network_admin ) {
347
  self::$_action = $action ;
348
  }
62
  $role = false ;
63
  if ( $uid ) {
64
  $user = get_userdata( $uid ) ;
65
+ if ( isset( $user->roles ) && is_array( $user->roles ) ) {
66
  $tmp = array_values( $user->roles ) ;
67
  $role = array_shift( $tmp ) ;
68
  }
343
  case LiteSpeed_Cache::ACTION_DO_CRAWL:
344
  case LiteSpeed_Cache::ACTION_BLACKLIST_SAVE:
345
  case LiteSpeed_Cache::ACTION_MEDIA:
346
+ case LiteSpeed_Cache::ACTION_IAPI:
347
+ case LiteSpeed_Cache::ACTION_CDN:
348
  if ( defined( 'LITESPEED_ON' ) && $_can_option && ! $_is_network_admin ) {
349
  self::$_action = $action ;
350
  }
includes/litespeed-cache-utility.class.php CHANGED
@@ -18,7 +18,7 @@ class LiteSpeed_Cache_Utility
18
  * @since 1.6.5
19
  * @access public
20
  */
21
- public static function readable_time( $seconds_or_timestamp, $timeout = 3600 )
22
  {
23
 
24
  if ( strlen( $seconds_or_timestamp ) == 10 ) {
@@ -34,7 +34,7 @@ class LiteSpeed_Cache_Utility
34
  $res = '';
35
  if ( $seconds > 86400 ) {
36
  $num = floor( $seconds / 86400 ) ;
37
- $res .= $num . 'd ' ;
38
  $seconds %= 86400 ;
39
  }
40
 
@@ -43,7 +43,7 @@ class LiteSpeed_Cache_Utility
43
  $res .= ', ' ;
44
  }
45
  $num = floor( $seconds / 3600 ) ;
46
- $res .= $num . 'h ' ;
47
  $seconds %= 3600 ;
48
  }
49
 
@@ -52,15 +52,18 @@ class LiteSpeed_Cache_Utility
52
  $res .= ', ' ;
53
  }
54
  $num = floor( $seconds / 60 ) ;
55
- $res .= $num . 'm ' ;
56
  $seconds %= 60 ;
57
  }
58
 
59
  if ( $seconds > 0 ) {
60
- $res .= $seconds . 's ' ;
 
 
 
61
  }
62
 
63
- $res = sprintf( __( ' %s ago ', 'litespeed-cache' ), $res ) ;
64
 
65
  return $res ;
66
  }
@@ -258,6 +261,25 @@ class LiteSpeed_Cache_Utility
258
  return trim( $url ) ;
259
  }
260
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
261
  /**
262
  * Generate domain const
263
  *
@@ -298,15 +320,22 @@ class LiteSpeed_Cache_Utility
298
  }
299
 
300
  $arr = explode( "\n", $content ) ;
 
301
  if ( $type === 'uri' ) {
302
  $arr = array_map( 'LiteSpeed_Cache_Utility::url2uri', $arr ) ;
303
  }
304
  if ( $type === 'relative' ) {
305
  $arr = array_map( 'LiteSpeed_Cache_Utility::make_relative', $arr ) ;// Remove domain
306
  }
 
 
 
307
  $arr = array_map( 'trim', $arr ) ;
308
  $arr = array_unique( $arr ) ;
309
  $arr = array_filter( $arr ) ;
 
 
 
310
  return implode( "\n", $arr ) ;
311
  }
312
 
18
  * @since 1.6.5
19
  * @access public
20
  */
21
+ public static function readable_time( $seconds_or_timestamp, $timeout = 3600, $backward = true )
22
  {
23
 
24
  if ( strlen( $seconds_or_timestamp ) == 10 ) {
34
  $res = '';
35
  if ( $seconds > 86400 ) {
36
  $num = floor( $seconds / 86400 ) ;
37
+ $res .= $num . 'd' ;
38
  $seconds %= 86400 ;
39
  }
40
 
43
  $res .= ', ' ;
44
  }
45
  $num = floor( $seconds / 3600 ) ;
46
+ $res .= $num . 'h' ;
47
  $seconds %= 3600 ;
48
  }
49
 
52
  $res .= ', ' ;
53
  }
54
  $num = floor( $seconds / 60 ) ;
55
+ $res .= $num . 'm' ;
56
  $seconds %= 60 ;
57
  }
58
 
59
  if ( $seconds > 0 ) {
60
+ if ( $res ) {
61
+ $res .= ' ' ;
62
+ }
63
+ $res .= $seconds . 's' ;
64
  }
65
 
66
+ $res = $backward ? sprintf( __( ' %s ago', 'litespeed-cache' ), $res ) : $res ;
67
 
68
  return $res ;
69
  }
261
  return trim( $url ) ;
262
  }
263
 
264
+ /**
265
+ * Convert URL to domain only
266
+ *
267
+ * @since 1.7.1
268
+ */
269
+ public static function parse_domain( $url )
270
+ {
271
+ $url = @parse_url( $url ) ;
272
+ if ( empty( $url[ 'host' ] ) ) {
273
+ return '' ;
274
+ }
275
+
276
+ if ( ! empty( $url[ 'scheme' ] ) ) {
277
+ return $url[ 'scheme' ] . '://' . $url[ 'host' ] ;
278
+ }
279
+
280
+ return '//' . $url[ 'host' ] ;
281
+ }
282
+
283
  /**
284
  * Generate domain const
285
  *
320
  }
321
 
322
  $arr = explode( "\n", $content ) ;
323
+ $arr = array_map( 'trim', $arr ) ;
324
  if ( $type === 'uri' ) {
325
  $arr = array_map( 'LiteSpeed_Cache_Utility::url2uri', $arr ) ;
326
  }
327
  if ( $type === 'relative' ) {
328
  $arr = array_map( 'LiteSpeed_Cache_Utility::make_relative', $arr ) ;// Remove domain
329
  }
330
+ if ( $type === 'domain' ) {
331
+ $arr = array_map( 'LiteSpeed_Cache_Utility::parse_domain', $arr ) ;// Only keep domain
332
+ }
333
  $arr = array_map( 'trim', $arr ) ;
334
  $arr = array_unique( $arr ) ;
335
  $arr = array_filter( $arr ) ;
336
+ if ( $type === 'array' ) {
337
+ return $arr ;
338
+ }
339
  return implode( "\n", $arr ) ;
340
  }
341
 
includes/litespeed-cache-vary.class.php CHANGED
@@ -498,7 +498,7 @@ class LiteSpeed_Cache_Vary
498
  }
499
 
500
  if ( empty($tp_cookies) ) {
501
- LiteSpeed_Cache_Log::debug( 'Vary: finalize bypassed due to no vary ' ) ;
502
  return ;
503
  }
504
 
@@ -539,7 +539,13 @@ class LiteSpeed_Cache_Vary
539
  $expire = 1 ;
540
  }
541
 
542
- setcookie(self::$_vary_name, $val, $expire, $path?: COOKIEPATH, COOKIE_DOMAIN, is_ssl(), true) ;
 
 
 
 
 
 
543
  }
544
 
545
  /**
498
  }
499
 
500
  if ( empty($tp_cookies) ) {
501
+ LiteSpeed_Cache_Log::debug2( 'Vary: no custimzed vary ' ) ;
502
  return ;
503
  }
504
 
539
  $expire = 1 ;
540
  }
541
 
542
+ /**
543
+ * Add HTTPS bypass in case clients use both HTTP and HTTPS version of site
544
+ * @since 1.7
545
+ */
546
+ $is_ssl = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_USE_HTTP_FOR_HTTPS_VARY ) ? false : is_ssl() ;
547
+
548
+ setcookie(self::$_vary_name, $val, $expire, $path?: COOKIEPATH, COOKIE_DOMAIN, $is_ssl, true) ;
549
  }
550
 
551
  /**
includes/litespeed-cache.class.php CHANGED
@@ -19,7 +19,7 @@ class LiteSpeed_Cache
19
  private static $_instance ;
20
 
21
  const PLUGIN_NAME = 'litespeed-cache' ;
22
- const PLUGIN_VERSION = '1.6.7' ;
23
 
24
  const PAGE_EDIT_HTACCESS = 'lscache-edit-htaccess' ;
25
 
@@ -55,6 +55,8 @@ class LiteSpeed_Cache
55
  const ACTION_LOG = 'log' ;
56
 
57
  const ACTION_MEDIA = 'media' ;
 
 
58
  const ACTION_REPORT = 'report' ;
59
  const ACTION_SAPI_PASSIVE_CALLBACK = 'sapi_passive_callback' ;
60
  const ACTION_SAPI_AGGRESSIVE_CALLBACK = 'sapi_aggressive_callback' ;
@@ -307,6 +309,14 @@ class LiteSpeed_Cache
307
  $msg = LiteSpeed_Cache_Media::handler() ;
308
  break ;
309
 
 
 
 
 
 
 
 
 
310
  case LiteSpeed_Cache::ACTION_LOG:
311
  $msg = LiteSpeed_Cache_Log::handler() ;
312
  break ;
19
  private static $_instance ;
20
 
21
  const PLUGIN_NAME = 'litespeed-cache' ;
22
+ const PLUGIN_VERSION = '1.7.2' ;
23
 
24
  const PAGE_EDIT_HTACCESS = 'lscache-edit-htaccess' ;
25
 
55
  const ACTION_LOG = 'log' ;
56
 
57
  const ACTION_MEDIA = 'media' ;
58
+ const ACTION_IAPI = 'iapi' ;
59
+ const ACTION_CDN = 'cdn' ;
60
  const ACTION_REPORT = 'report' ;
61
  const ACTION_SAPI_PASSIVE_CALLBACK = 'sapi_passive_callback' ;
62
  const ACTION_SAPI_AGGRESSIVE_CALLBACK = 'sapi_aggressive_callback' ;
309
  $msg = LiteSpeed_Cache_Media::handler() ;
310
  break ;
311
 
312
+ case LiteSpeed_Cache::ACTION_IAPI:
313
+ $msg = LiteSpeed_Cache_Admin_API::handler() ;
314
+ break ;
315
+
316
+ case LiteSpeed_Cache::ACTION_CDN:
317
+ $msg = LiteSpeed_Cache_CDN::handler() ;
318
+ break ;
319
+
320
  case LiteSpeed_Cache::ACTION_LOG:
321
  $msg = LiteSpeed_Cache_Log::handler() ;
322
  break ;
js/css_async.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(a){"use strict";var b=function(b,c,d){function e(a){return h.body?a():void setTimeout(function(){e(a)})}function f(){i.addEventListener&&i.removeEventListener("load",f),i.media=d||"all"}var g,h=a.document,i=h.createElement("link");if(c)g=c;else{var j=(h.body||h.getElementsByTagName("head")[0]).childNodes;g=j[j.length-1]}var k=h.styleSheets;i.rel="stylesheet",i.href=b,i.media="only x",e(function(){g.parentNode.insertBefore(i,c?g:g.nextSibling)});var l=function(a){for(var b=i.href,c=k.length;c--;)if(k[c].href===b)return a();setTimeout(function(){l(a)})};return i.addEventListener&&i.addEventListener("load",f),i.onloadcssdefined=l,l(f),i};"undefined"!=typeof exports?exports.loadCSS=b:a.loadCSS=b}("undefined"!=typeof global?global:this);!function(a){if(a.loadCSS){var b=loadCSS.relpreload={};if(b.support=function(){try{return a.document.createElement("link").relList.supports("preload")}catch(b){return!1}},b.poly=function(){for(var b=a.document.getElementsByTagName("link"),c=0;c<b.length;c++){var d=b[c];"preload"===d.rel&&"style"===d.getAttribute("as")&&(a.loadCSS(d.href,d,d.getAttribute("media")),d.rel=null)}},!b.support()){b.poly();var c=a.setInterval(b.poly,300);a.addEventListener&&a.addEventListener("load",function(){b.poly(),a.clearInterval(c)}),a.attachEvent&&a.attachEvent("onload",function(){a.clearInterval(c)})}}}(this);
js/lazyload.min.js CHANGED
@@ -1,2 +1 @@
1
- var _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(e,t){"object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.LazyLoad=t()}(this,function(){"use strict";var e={elements_selector:"img",container:document,threshold:300,data_src:"src",data_srcset:"srcset",data_sizes:"sizes",class_loading:"loading",class_loaded:"loaded",class_error:"error",callback_load:null,callback_error:null,callback_set:null},t=function(e,t){return e.getAttribute("data-"+t)},n=function(e,t,n){return e.setAttribute("data-"+t,n)},s=function(e){return e.filter(function(e){return!t(e,"was-processed")})},r=function(e,t){var n=new e(t),s=new CustomEvent("LazyLoad::Initialized",{detail:{instance:n}});window.dispatchEvent(s)},o=function(e,n){var s=n.data_srcset,r=n.data_sizes,o=e.parentElement;if("PICTURE"===o.tagName)for(var a,i=0;a=o.children[i];i+=1)if("SOURCE"===a.tagName){var c=t(a,s);c&&a.setAttribute("srcset",c);var l=t(a,r);l&&a.setAttribute("sizes",l)}},a=function(e,n){var s=n.data_src,r=n.data_srcset,a=n.data_sizes,i=e.tagName,c=t(e,s);if("IMG"===i){o(e,n);var l=t(e,r);l&&e.setAttribute("srcset",l);var u=t(e,a);return u&&e.setAttribute("sizes",u),void(c&&e.setAttribute("src",c))}"IFRAME"!==i?c&&(e.style.backgroundImage='url("'+c+'")'):c&&e.setAttribute("src",c)},i="classList"in document.createElement("p"),c=function(e,t){i?e.classList.add(t):e.className+=(e.className?" ":"")+t},l=function(e,t){i?e.classList.remove(t):e.className=e.className.replace(new RegExp("(^|\\s+)"+t+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},u=function(e,t){e&&e(t)},d=function(e,t,n){e.removeEventListener("load",t),e.removeEventListener("error",n)},f=function(e,t){var n=function n(r){_(r,!0,t),d(e,n,s)},s=function s(r){_(r,!1,t),d(e,n,s)};e.addEventListener("load",n),e.addEventListener("error",s)},_=function(e,t,n){var s=e.target;l(s,n.class_loading),c(s,t?n.class_loaded:n.class_error),u(t?n.callback_load:n.callback_error,s)},v=function(e,t){["IMG","IFRAME"].indexOf(e.tagName)>-1&&(f(e,t),c(e,t.class_loading)),a(e,t),n(e,"was-processed",!0),u(t.callback_set,e)},m=function(t,n){this._settings=_extends({},e,t),this._setObserver(),this.update(n)};m.prototype={_setObserver:function(){var e=this;if("IntersectionObserver"in window){var t=this._settings;this._observer=new IntersectionObserver(function(n){n.forEach(function(n){if(n.intersectionRatio>0){var s=n.target;v(s,t),e._observer.unobserve(s)}}),e._elements=s(e._elements)},{root:t.container===document?null:t.container,rootMargin:t.threshold+"px"})}},update:function(e){var t=this,n=this._settings,r=e||n.container.querySelectorAll(n.elements_selector);this._elements=s(Array.prototype.slice.call(r)),this._observer?this._elements.forEach(function(e){t._observer.observe(e)}):(this._elements.forEach(function(e){v(e,n)}),this._elements=s(this._elements))},destroy:function(){var e=this;this._observer&&(s(this._elements).forEach(function(t){e._observer.unobserve(t)}),this._observer=null),this._elements=null,this._settings=null}};var b=window.lazyLoadOptions;return b&&function(e,t){if(t.length)for(var n,s=0;n=t[s];s+=1)r(e,n);else r(e,t)}(m,b),m});
2
- !function(e,t){"use strict";var n,a,d=function(){n=new LazyLoad({elements_selector:"[data-lazyloaded]"}),a=function(){n.update()},e.MutationObserver&&new MutationObserver(a).observe(t.documentElement,{childList:!0,subtree:!0,attributes:!0})};e.addEventListener?e.addEventListener("load",d,!1):e.attachEvent("onload",d)}(window,document);
1
+ var _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(e,t){"object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.LazyLoad=t()}(this,function(){"use strict";var e={elements_selector:"img",container:document,threshold:300,data_src:"src",data_srcset:"srcset",data_sizes:"sizes",class_loading:"loading",class_loaded:"loaded",class_error:"error",callback_load:null,callback_error:null,callback_set:null},t=function(e,t){return e.getAttribute("data-"+t)},n=function(e,t,n){return e.setAttribute("data-"+t,n)},s=function(e){return e.filter(function(e){return!t(e,"was-processed")})},r=function(e,t){var n=new e(t),s=new CustomEvent("LazyLoad::Initialized",{detail:{instance:n}});window.dispatchEvent(s)},o=function(e,n){var s=n.data_srcset,r=n.data_sizes,o=e.parentElement;if("PICTURE"===o.tagName)for(var a,i=0;a=o.children[i];i+=1)if("SOURCE"===a.tagName){var c=t(a,s);c&&a.setAttribute("srcset",c);var l=t(a,r);l&&a.setAttribute("sizes",l)}},a=function(e,n){var s=n.data_src,r=n.data_srcset,a=n.data_sizes,i=e.tagName,c=t(e,s);if("IMG"===i){o(e,n);var l=t(e,r);l&&e.setAttribute("srcset",l);var u=t(e,a);return u&&e.setAttribute("sizes",u),void(c&&e.setAttribute("src",c))}"IFRAME"!==i?c&&(e.style.backgroundImage='url("'+c+'")'):c&&e.setAttribute("src",c)},i="classList"in document.createElement("p"),c=function(e,t){i?e.classList.add(t):e.className+=(e.className?" ":"")+t},l=function(e,t){i?e.classList.remove(t):e.className=e.className.replace(new RegExp("(^|\\s+)"+t+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},u=function(e,t){e&&e(t)},d=function(e,t,n){e.removeEventListener("load",t),e.removeEventListener("error",n)},f=function(e,t){var n=function n(r){_(r,!0,t),d(e,n,s)},s=function s(r){_(r,!1,t),d(e,n,s)};e.addEventListener("load",n),e.addEventListener("error",s)},_=function(e,t,n){var s=e.target;l(s,n.class_loading),c(s,t?n.class_loaded:n.class_error),u(t?n.callback_load:n.callback_error,s)},v=function(e,t){["IMG","IFRAME"].indexOf(e.tagName)>-1&&(f(e,t),c(e,t.class_loading)),a(e,t),n(e,"was-processed",!0),u(t.callback_set,e)},m=function(t,n){this._settings=_extends({},e,t),this._setObserver(),this.update(n)};m.prototype={_setObserver:function(){var e=this;if("IntersectionObserver"in window){var t=this._settings;this._observer=new IntersectionObserver(function(n){n.forEach(function(n){if(n.intersectionRatio>0){var s=n.target;v(s,t),e._observer.unobserve(s)}}),e._elements=s(e._elements)},{root:t.container===document?null:t.container,rootMargin:t.threshold+"px"})}},update:function(e){var t=this,n=this._settings,r=e||n.container.querySelectorAll(n.elements_selector);this._elements=s(Array.prototype.slice.call(r)),this._observer?this._elements.forEach(function(e){t._observer.observe(e)}):(this._elements.forEach(function(e){v(e,n)}),this._elements=s(this._elements))},destroy:function(){var e=this;this._observer&&(s(this._elements).forEach(function(t){e._observer.unobserve(t)}),this._observer=null),this._elements=null,this._settings=null}};var b=window.lazyLoadOptions;return b&&function(e,t){if(t.length)for(var n,s=0;n=t[s];s+=1)r(e,n);else r(e,t)}(m,b),m});!function(e,t){"use strict";var n,a,d=function(){n=new LazyLoad({elements_selector:"[data-lazyloaded]"}),a=function(){n.update()},e.MutationObserver&&new MutationObserver(a).observe(t.documentElement,{childList:!0,subtree:!0,attributes:!0})};e.addEventListener?e.addEventListener("load",d,!1):e.attachEvent("onload",d)}(window,document);
 
js/litespeed-cache-admin.js CHANGED
@@ -39,11 +39,6 @@ var _litespeed_dots ;
39
 
40
  jQuery(document).ready(function () {
41
  /************** Common LiteSpeed JS **************/
42
- // Arrow transform
43
- $('.litespeed-down, .litespeed-up').click(function(event) {
44
- $(this).toggleClass('litespeed-up litespeed-down') ;
45
- }) ;
46
-
47
  // Link confirm
48
  $('[data-litespeed-cfm]').click(function(event) {
49
  if(confirm($.trim($(this).data('litespeed-cfm')).replace(/\\n/g,"\n"))) {
@@ -55,24 +50,6 @@ var _litespeed_dots ;
55
  }) ;
56
 
57
  /************** LSWCP JS ****************/
58
- // FAQ show and hide
59
- $('.litespeed-answer').hide() ;
60
- $('.litespeed-question').click(function(event) {
61
- $(this).next('.litespeed-answer').slideToggle('fast') ;
62
- }) ;
63
- $('[data-litespeed-expend-all]').click(function(event) {
64
- var range = $(this).data('litespeed-expend-all') ;
65
- if($(this).html() == '+'){
66
- $(this).html('-') ;
67
- $('[data-litespeed-layout="'+range+'"] .litespeed-answer').slideDown('fast') ;
68
- $('[data-litespeed-layout="'+range+'"] .litespeed-question').addClass('litespeed-up').removeClass('litespeed-down') ;
69
- }else{
70
- $(this).html('+') ;
71
- $('[data-litespeed-layout="'+range+'"] .litespeed-answer').slideUp('fast') ;
72
- $('[data-litespeed-layout="'+range+'"] .litespeed-question').addClass('litespeed-down').removeClass('litespeed-up') ;
73
- }
74
- }) ;
75
-
76
  // page tab switch functionality
77
  if($('[data-litespeed-tab]').length > 0){
78
  // display default tab
@@ -184,6 +161,58 @@ var _litespeed_dots ;
184
  $.get( litespeed_data.ajax_url_promo + '&later=1' ) ;
185
  } ) ;
186
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
187
  }) ;
188
  })(jQuery) ;
189
 
39
 
40
  jQuery(document).ready(function () {
41
  /************** Common LiteSpeed JS **************/
 
 
 
 
 
42
  // Link confirm
43
  $('[data-litespeed-cfm]').click(function(event) {
44
  if(confirm($.trim($(this).data('litespeed-cfm')).replace(/\\n/g,"\n"))) {
50
  }) ;
51
 
52
  /************** LSWCP JS ****************/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  // page tab switch functionality
54
  if($('[data-litespeed-tab]').length > 0){
55
  // display default tab
161
  $.get( litespeed_data.ajax_url_promo + '&later=1' ) ;
162
  } ) ;
163
 
164
+ /** CDN mapping **/
165
+ $( '#litespeed-cdn-mapping-add' ).click(function(event) {
166
+ var cloned_item = $( '[data-litespeed-cdn-mapping]:last' ).clone() ;
167
+ cloned_item.find( 'input[type=text]' ).val( '' ) ;
168
+ cloned_item.find( 'textarea' ).val( '' ) ;
169
+ cloned_item.find( 'input[type="hidden"]' ).val( 0 ) ;
170
+
171
+ var toggle_items = cloned_item.find( '[data-litespeed-toggle-on]' ) ;
172
+
173
+ var cls_off = 'litespeed-toggle-btn-' + toggle_items.data( 'litespeed-toggle-off' ) + ' litespeed-toggleoff' ;
174
+ var cls_on = 'litespeed-toggle-btn-' + toggle_items.data( 'litespeed-toggle-on' ) ;
175
+
176
+ toggle_items.removeClass( cls_on ).addClass( cls_off ) ;
177
+
178
+ cloned_item.insertAfter( '[data-litespeed-cdn-mapping]:last' ).hide().fadeIn() ;
179
+
180
+ litespeed_toggle() ;
181
+ litespeed_cdn_mapping_del_init() ;
182
+ });
183
+
184
+ /** toggle switch **/
185
+ litespeed_toggle() ;
186
+ litespeed_cdn_mapping_del_init() ;
187
+
188
+ function litespeed_cdn_mapping_del_init() {
189
+ $( '[data-litespeed-cdn-mapping-del]' ).off().click(function(event) {
190
+ if ( ! confirm( 'Are you sure?' ) ) {
191
+ return false;
192
+ }
193
+ $( this ).closest( '[data-litespeed-cdn-mapping]' ).fadeOut( 400, function(){
194
+ $( this ).remove() ;
195
+ } ) ;
196
+ });
197
+
198
+ }
199
+
200
+ function litespeed_toggle() {
201
+ $( '[data-litespeed-toggle-on]' ).off().click(function(event) {
202
+ var cls_off = 'litespeed-toggle-btn-' + $( this ).data( 'litespeed-toggle-off' ) + ' litespeed-toggleoff' ;
203
+ var cls_on = 'litespeed-toggle-btn-' + $( this ).data( 'litespeed-toggle-on' ) ;
204
+ if ( $( this ).children( 'input' ).val() * 1 ) {
205
+ $( this ).addClass( cls_off ).removeClass( cls_on ) ;
206
+ $( this ).children( 'input' ).val( 0 ) ;
207
+ }
208
+ else {
209
+ $( this ).removeClass( cls_off ).addClass( cls_on ) ;
210
+ $( this ).children( 'input' ).val( 1 ) ;
211
+ }
212
+ });
213
+ }
214
+
215
+
216
  }) ;
217
  })(jQuery) ;
218
 
languages/litespeed-cache.pot CHANGED
@@ -1,35 +1,42 @@
1
- # Copyright (C) 2017 LiteSpeed Cache
2
  # This file is distributed under the same license as the LiteSpeed Cache package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: LiteSpeed Cache 1.6.7\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/litespeed-cache\n"
7
- "POT-Creation-Date: 2017-12-15 17:17:00+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
- "PO-Revision-Date: 2017-MO-DA HO:MI+ZONE\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
15
- #: admin/admin-api.class.php:213
16
  msgid "IAPI Error %s"
17
  msgstr ""
18
 
19
- #: admin/admin-api.class.php:275
 
 
 
 
20
  msgid "Failed to communicate with LiteSpeed image server"
21
  msgstr ""
22
 
23
- #: admin/admin-api.class.php:283 admin/admin-api.class.php:291
24
  msgid "Message from LiteSpeed image server"
25
  msgstr ""
26
 
27
  #: admin/litespeed-cache-admin-display.class.php:140
 
 
28
  msgid "Manage"
29
  msgstr ""
30
 
31
  #: admin/litespeed-cache-admin-display.class.php:142
32
- #: admin/litespeed-cache-admin-display.class.php:232
 
33
  msgid "Settings"
34
  msgstr ""
35
 
@@ -37,7 +44,8 @@ msgstr ""
37
  msgid "Edit .htaccess"
38
  msgstr ""
39
 
40
- #: admin/litespeed-cache-admin-display.class.php:149
 
41
  msgid "Image Optimization"
42
  msgstr ""
43
 
@@ -59,25 +67,23 @@ msgid ""
59
  "It is recommended that LiteSpeed Cache be purged after updating a plugin."
60
  msgstr ""
61
 
62
- #: admin/litespeed-cache-admin-display.class.php:292
63
- msgid "LiteSpeed Cache Purge All"
64
- msgstr ""
65
-
66
- #: admin/litespeed-cache-admin-display.class.php:834
67
- #: admin/tpl/setting/settings_media.php:66
68
  #: admin/tpl/setting/settings_optimize.php:135
69
  #: admin/tpl/setting/settings_tuning.php:19
70
  #: admin/tpl/setting/settings_tuning.php:55
71
  msgid "ON"
72
  msgstr ""
73
 
74
- #: admin/litespeed-cache-admin-display.class.php:838
 
75
  #: admin/tpl/setting/settings_tuning.php:16
76
  #: admin/tpl/setting/settings_tuning.php:52
77
  msgid "OFF"
78
  msgstr ""
79
 
80
- #: admin/litespeed-cache-admin-display.class.php:871
81
  msgid "Recommended value: %s"
82
  msgstr ""
83
 
@@ -345,13 +351,13 @@ msgstr ""
345
  msgid "Failed to push to LiteSpeed server: %s"
346
  msgstr ""
347
 
348
- #: admin/litespeed-cache-admin-rules.class.php:678
349
  msgid ""
350
  "<p>Please add/replace the following codes into the beginning of %1$s:</p> "
351
  "%2$s"
352
  msgstr ""
353
 
354
- #: admin/litespeed-cache-admin-rules.class.php:876
355
  msgid "File Saved."
356
  msgstr ""
357
 
@@ -359,63 +365,63 @@ msgstr ""
359
  msgid "'Use primary site settings' set by Network Administrator."
360
  msgstr ""
361
 
362
- #: admin/litespeed-cache-admin-settings.class.php:219
363
  msgid "Site options saved."
364
  msgstr ""
365
 
366
- #: admin/litespeed-cache-admin-settings.class.php:258
367
- #: admin/litespeed-cache-admin-settings.class.php:749
368
  msgid "Default Public Cache"
369
  msgstr ""
370
 
371
- #: admin/litespeed-cache-admin-settings.class.php:259
372
  msgid "Default Private Cache"
373
  msgstr ""
374
 
375
- #: admin/litespeed-cache-admin-settings.class.php:260
376
  msgid "Default Front Page"
377
  msgstr ""
378
 
379
- #: admin/litespeed-cache-admin-settings.class.php:261
380
  msgid "Feed"
381
  msgstr ""
382
 
383
- #: admin/litespeed-cache-admin-settings.class.php:262
384
  msgid "404"
385
  msgstr ""
386
 
387
- #: admin/litespeed-cache-admin-settings.class.php:263
388
  msgid "403"
389
  msgstr ""
390
 
391
- #: admin/litespeed-cache-admin-settings.class.php:264
392
  msgid "500"
393
  msgstr ""
394
 
395
- #: admin/litespeed-cache-admin-settings.class.php:610
396
  #: admin/tpl/setting/settings_debug.php:75
397
  msgid "Log File Size Limit"
398
  msgstr ""
399
 
400
- #: admin/litespeed-cache-admin-settings.class.php:676
401
  #: admin/tpl/setting/settings_crawler.php:10
402
  msgid "Delay"
403
  msgstr ""
404
 
405
- #: admin/litespeed-cache-admin-settings.class.php:677
406
  #: admin/tpl/setting/settings_crawler.php:22
407
  msgid "Run Duration"
408
  msgstr ""
409
 
410
- #: admin/litespeed-cache-admin-settings.class.php:678
411
  msgid "Cron Interval"
412
  msgstr ""
413
 
414
- #: admin/litespeed-cache-admin-settings.class.php:679
415
  msgid "Whole Interval"
416
  msgstr ""
417
 
418
- #: admin/litespeed-cache-admin-settings.class.php:680
419
  #: admin/tpl/setting/settings_crawler.php:58
420
  msgid "Threads"
421
  msgstr ""
@@ -444,173 +450,173 @@ msgid ""
444
  "page caching offerings—such as minifying css/js files."
445
  msgstr ""
446
 
447
- #: admin/tpl/crawler.php:15 admin/tpl/crawler.php:81
448
  msgid "LiteSpeed Cache Crawler"
449
  msgstr ""
450
 
451
- #: admin/tpl/crawler.php:23
452
  msgid "Crawler File"
453
  msgstr ""
454
 
455
- #: admin/tpl/crawler.php:25
456
  msgid "Generate Crawler File"
457
  msgstr ""
458
 
459
- #: admin/tpl/crawler.php:30
460
  msgid "Generated at %s"
461
  msgstr ""
462
 
463
- #: admin/tpl/crawler.php:34
464
  msgid ""
465
  "On click, this will create a crawler sitemap file in plugin directory %s."
466
  msgstr ""
467
 
468
- #: admin/tpl/crawler.php:44
469
  msgid "%d hours"
470
  msgstr ""
471
 
472
- #: admin/tpl/crawler.php:47
473
  msgid "%d hour"
474
  msgstr ""
475
 
476
- #: admin/tpl/crawler.php:54
477
  msgid "%d minutes"
478
  msgstr ""
479
 
480
- #: admin/tpl/crawler.php:57
481
  msgid "%d minute"
482
  msgstr ""
483
 
484
- #: admin/tpl/crawler.php:61
485
  msgid "Crawler Cron"
486
  msgstr ""
487
 
488
- #: admin/tpl/crawler.php:64 admin/tpl/setting/settings_optimize.php:10
489
- #: admin/tpl/settings.php:130
490
  msgid "WARNING"
491
  msgstr ""
492
 
493
- #: admin/tpl/crawler.php:65
494
  msgid ""
495
  "The crawler feature is not enabled on the LiteSpeed server. Please consult "
496
  "your server admin."
497
  msgstr ""
498
 
499
- #: admin/tpl/crawler.php:66
500
  msgid ""
501
  "See <a %s>Introduction for Enabling the Crawler</a> for detailed infomation."
502
  msgstr ""
503
 
504
- #: admin/tpl/crawler.php:71
505
  msgid "Cron Name"
506
  msgstr ""
507
 
508
- #: admin/tpl/crawler.php:72
509
  msgid "Run Frequency"
510
  msgstr ""
511
 
512
- #: admin/tpl/crawler.php:73
513
  msgid "Last Status"
514
  msgstr ""
515
 
516
- #: admin/tpl/crawler.php:74
517
  msgid "Activation"
518
  msgstr ""
519
 
520
- #: admin/tpl/crawler.php:75
521
  msgid "Actions"
522
  msgstr ""
523
 
524
- #: admin/tpl/crawler.php:88
525
  msgid "The current sitemap crawl started at %s"
526
  msgstr ""
527
 
528
- #: admin/tpl/crawler.php:91
529
  msgid "The next complete sitemap crawl will start at %s"
530
  msgstr ""
531
 
532
- #: admin/tpl/crawler.php:105
533
  msgid "The last complete run cost %s seconds"
534
  msgstr ""
535
 
536
- #: admin/tpl/crawler.php:115
537
  msgid "Is running"
538
  msgstr ""
539
 
540
- #: admin/tpl/crawler.php:131 admin/tpl/setting/settings_general.php:30
541
  msgid "Enable"
542
  msgstr ""
543
 
544
- #: admin/tpl/crawler.php:131 admin/tpl/esi_widget_edit.php:58
545
  #: admin/tpl/setting/settings_general.php:24
546
  msgid "Disable"
547
  msgstr ""
548
 
549
- #: admin/tpl/crawler.php:138
550
  msgid "Reset position"
551
  msgstr ""
552
 
553
- #: admin/tpl/crawler.php:141
554
  msgid "Manually run"
555
  msgstr ""
556
 
557
- #: admin/tpl/crawler.php:145
558
  msgid "<b>Last interval:</b> %s"
559
  msgstr ""
560
 
561
- #: admin/tpl/crawler.php:151
562
  msgid "<b>Ended reason:</b> %s"
563
  msgstr ""
564
 
565
- #: admin/tpl/crawler.php:157
566
  msgid "<b>Last crawled:</b> %s item(s)"
567
  msgstr ""
568
 
569
- #: admin/tpl/crawler.php:165
570
  msgid "Run frequency is set by the Interval Between Runs setting."
571
  msgstr ""
572
 
573
- #: admin/tpl/crawler.php:166
574
  msgid "Only one crawler can run concurrently."
575
  msgstr ""
576
 
577
- #: admin/tpl/crawler.php:167
578
  msgid ""
579
  "If both the cron and manual run start at a similar time, the first one to "
580
  "start will run."
581
  msgstr ""
582
 
583
- #: admin/tpl/crawler.php:168
584
  msgid ""
585
  "Please follow <a %s>Hooking WP-Cron Into the System Task Scheduler</a> to "
586
  "create the system cron task."
587
  msgstr ""
588
 
589
- #: admin/tpl/crawler.php:173
590
  msgid "Watch Crawler Status"
591
  msgstr ""
592
 
593
- #: admin/tpl/crawler.php:180
594
  msgid "Show crawler status"
595
  msgstr ""
596
 
597
- #: admin/tpl/crawler.php:198
598
  msgid "No crawler meta file generated yet"
599
  msgstr ""
600
 
601
- #: admin/tpl/crawler.php:203
602
  msgid "Sitemap Generation Blacklist"
603
  msgstr ""
604
 
605
- #: admin/tpl/crawler.php:212 admin/tpl/edit_htaccess.php:68
606
  msgid "Save"
607
  msgstr ""
608
 
609
- #: admin/tpl/crawler.php:216
610
  msgid "Current blacklist has %s item(s)."
611
  msgstr ""
612
 
613
- #: admin/tpl/crawler.php:217
614
  msgid ""
615
  "All Urls which returned no-cache tags will be added here, after the initial "
616
  "crawling."
@@ -666,15 +672,15 @@ msgstr ""
666
  msgid "Public"
667
  msgstr ""
668
 
669
- #: admin/tpl/esi_widget_edit.php:49
670
  msgid "Private"
671
  msgstr ""
672
 
673
- #: admin/tpl/esi_widget_edit.php:69
674
  msgid "Widget Cache TTL:"
675
  msgstr ""
676
 
677
- #: admin/tpl/esi_widget_edit.php:72 admin/tpl/setting/settings_crawler.php:25
678
  #: admin/tpl/setting/settings_crawler.php:37
679
  #: admin/tpl/setting/settings_crawler.php:49
680
  #: admin/tpl/setting/settings_general.php:59
@@ -689,11 +695,11 @@ msgstr ""
689
  msgid "seconds"
690
  msgstr ""
691
 
692
- #: admin/tpl/esi_widget_edit.php:75
693
  msgid "Recommended value: 28800 seconds (8 hours)."
694
  msgstr ""
695
 
696
- #: admin/tpl/esi_widget_edit.php:76
697
  msgid "A TTL of 0 indicates do not cache."
698
  msgstr ""
699
 
@@ -737,157 +743,171 @@ msgstr ""
737
  msgid "LiteSpeed Cache Image Optimization"
738
  msgstr ""
739
 
740
- #: admin/tpl/image_optimization.php:58
741
  msgid "Optimization Summary"
742
  msgstr ""
743
 
744
- #: admin/tpl/image_optimization.php:88 admin/tpl/image_optimization.php:108
745
  msgid "Update Reduction Status"
746
  msgstr ""
747
 
748
- #: admin/tpl/image_optimization.php:91
749
  msgid ""
750
  "This will communicate with LiteSpeed's Image Optimization Server and "
751
  "retrieve the most recent status."
752
  msgstr ""
753
 
754
- #: admin/tpl/image_optimization.php:96
755
  msgid "Image Information"
756
  msgstr ""
757
 
758
- #: admin/tpl/image_optimization.php:97
759
  msgid "Beta Version"
760
  msgstr ""
761
 
762
- #: admin/tpl/image_optimization.php:100
763
  msgid "<a %s>Image groups</a> total"
764
  msgstr ""
765
 
766
- #: admin/tpl/image_optimization.php:101
767
  msgid "Image groups not yet requested"
768
  msgstr ""
769
 
770
- #: admin/tpl/image_optimization.php:105 admin/tpl/image_optimization.php:113
771
  msgid "Send Optimization Request"
772
  msgstr ""
773
 
774
- #: admin/tpl/image_optimization.php:108
775
  msgid "Please press the %s button before sending a new request."
776
  msgstr ""
777
 
778
- #: admin/tpl/image_optimization.php:110 admin/tpl/image_optimization.php:149
 
 
 
 
779
  msgid "Learn More"
780
  msgstr ""
781
 
782
- #: admin/tpl/image_optimization.php:116
783
  msgid ""
784
  "This will send the optimization request and the images to LiteSpeed's Image "
785
  "Optimization Server."
786
  msgstr ""
787
 
788
- #: admin/tpl/image_optimization.php:117
789
  msgid "You can send at most %s images at once."
790
  msgstr ""
791
 
792
- #: admin/tpl/image_optimization.php:125
793
  msgid "Image groups requested"
794
  msgstr ""
795
 
796
- #: admin/tpl/image_optimization.php:127
797
  msgid "Image groups failed to optimize"
798
  msgstr ""
799
 
800
- #: admin/tpl/image_optimization.php:129
801
  msgid ""
802
  "After LiteSpeed's Image Optimization Server finishes optimization, it will "
803
  "notify your site to pull the optimized images."
804
  msgstr ""
805
 
806
- #: admin/tpl/image_optimization.php:130
807
  msgid "This process is automatic."
808
  msgstr ""
809
 
810
- #: admin/tpl/image_optimization.php:133
811
  msgid "Image groups notified to pull"
812
  msgstr ""
813
 
814
- #: admin/tpl/image_optimization.php:136
815
  msgid "Pull Images"
816
  msgstr ""
817
 
818
- #: admin/tpl/image_optimization.php:139
819
  msgid "Only press the button if the pull cron job is disabled."
820
  msgstr ""
821
 
822
- #: admin/tpl/image_optimization.php:140
823
  msgid "Images will be pulled automatically if the cron job is running."
824
  msgstr ""
825
 
826
- #: admin/tpl/image_optimization.php:144
827
  msgid "Last pull initiated by cron at %s."
828
  msgstr ""
829
 
830
- #: admin/tpl/image_optimization.php:148
831
  msgid "Image groups optimized and pulled"
832
  msgstr ""
833
 
834
- #: admin/tpl/image_optimization.php:154
835
  msgid "Revert Optimization"
836
  msgstr ""
837
 
838
- #: admin/tpl/image_optimization.php:157
839
  msgid ""
840
  "Switch all images in the media library back to their original unoptimized "
841
  "versions."
842
  msgstr ""
843
 
844
- #: admin/tpl/image_optimization.php:163
845
  msgid "Undo Optimization"
846
  msgstr ""
847
 
848
- #: admin/tpl/image_optimization.php:166
849
  msgid "Revert all optimized images back to their original versions."
850
  msgstr ""
851
 
852
- #: admin/tpl/image_optimization.php:172
853
  msgid "Re-do Optimization"
854
  msgstr ""
855
 
856
- #: admin/tpl/image_optimization.php:175
857
  msgid "Switch back to using optimized images."
858
  msgstr ""
859
 
860
- #: admin/tpl/image_optimization.php:180
861
  msgid "Results can be checked in <a %s>Media Library</a>."
862
  msgstr ""
863
 
864
- #: admin/tpl/image_optimization.php:184
865
  msgid "Send New Thumbnail Requests"
866
  msgstr ""
867
 
868
- #: admin/tpl/image_optimization.php:187
869
  msgid ""
870
  "Scan for any new unoptimized image thumbnail sizes and resend necessary "
871
  "image optimization requests."
872
  msgstr ""
873
 
874
- #: admin/tpl/image_optimization.php:192
 
 
 
 
 
 
 
 
 
 
875
  msgid "Destroy All Optimization Data!"
876
  msgstr ""
877
 
878
- #: admin/tpl/image_optimization.php:195
879
  msgid ""
880
  "Remove all previous image optimization requests/results, revert completed "
881
  "optimizations, and delete all optimization files."
882
  msgstr ""
883
 
884
- #: admin/tpl/image_optimization.php:197
885
  #: admin/tpl/setting/settings_excludes.php:60
886
  #: admin/tpl/setting/settings_excludes.php:98
887
  #: admin/tpl/setting/settings_inc.cache_browser.php:12
888
- #: admin/tpl/setting/settings_inc.cache_favicon.php:14
889
- #: admin/tpl/setting/settings_inc.cache_mobile.php:18
890
- #: admin/tpl/setting/settings_inc.cache_resources.php:15
891
  #: admin/tpl/setting/settings_inc.exclude_cookies.php:22
892
  #: admin/tpl/setting/settings_inc.exclude_useragent.php:21
893
  #: admin/tpl/setting/settings_inc.media_webp.php:12
@@ -897,13 +917,13 @@ msgstr ""
897
  msgid "NOTE:"
898
  msgstr ""
899
 
900
- #: admin/tpl/image_optimization.php:198
901
  msgid ""
902
  "If there are unfinished requests in progress, the requests' credits will NOT "
903
  "be recovered."
904
  msgstr ""
905
 
906
- #: admin/tpl/image_optimization.php:198
907
  #: admin/tpl/setting/settings_optimize.php:63
908
  #: admin/tpl/setting/settings_optimize.php:138
909
  msgid "JS Combine"
@@ -1069,6 +1089,70 @@ msgid ""
1069
  "dismissed. (<a %3$s>Learn More</a>)"
1070
  msgstr ""
1071
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1072
  #: admin/tpl/manage/manage_db.php:6
1073
  msgid "Clean All"
1074
  msgstr ""
@@ -1262,18 +1346,21 @@ msgstr ""
1262
 
1263
  #: admin/tpl/manage/manage_purge.php:105
1264
  #: admin/tpl/setting/settings_cache.php:67
1265
- #: admin/tpl/setting/settings_cdn.php:101
 
 
1266
  #: admin/tpl/setting/settings_excludes.php:19
1267
  #: admin/tpl/setting/settings_excludes.php:33
1268
  #: admin/tpl/setting/settings_excludes.php:56
1269
  #: admin/tpl/setting/settings_excludes.php:94
1270
  #: admin/tpl/setting/settings_inc.exclude_cookies.php:19
1271
- #: admin/tpl/setting/settings_media.php:27
 
1272
  #: admin/tpl/setting/settings_purge.php:79
1273
  #: admin/tpl/setting/settings_tuning.php:36
1274
  #: admin/tpl/setting/settings_tuning.php:72
1275
- #: admin/tpl/setting/settings_tuning.php:131
1276
- #: admin/tpl/setting/settings_tuning.php:160
1277
  msgid "One per line."
1278
  msgstr ""
1279
 
@@ -1322,11 +1409,16 @@ msgstr ""
1322
  msgid "DB Optimizer"
1323
  msgstr ""
1324
 
1325
- #: admin/tpl/manage.php:18
 
 
 
 
 
1326
  msgid "LiteSpeed Cache Network Management"
1327
  msgstr ""
1328
 
1329
- #: admin/tpl/manage.php:21
1330
  msgid "LiteSpeed Cache Management"
1331
  msgstr ""
1332
 
@@ -1343,8 +1435,8 @@ msgstr ""
1343
  msgid "Excludes"
1344
  msgstr ""
1345
 
1346
- #: admin/tpl/network_settings.php:9 admin/tpl/setting/settings_debug.php:65
1347
- #: admin/tpl/settings.php:20
1348
  msgid "Advanced"
1349
  msgstr ""
1350
 
@@ -1466,121 +1558,123 @@ msgstr ""
1466
  msgid "Purge Network Settings"
1467
  msgstr ""
1468
 
1469
- #: admin/tpl/setting/settings_advanced.php:6
1470
  msgid "NOTICE:"
1471
  msgstr ""
1472
 
1473
- #: admin/tpl/setting/settings_advanced.php:8
1474
  msgid "These settings are meant for ADVANCED USERS ONLY."
1475
  msgstr ""
1476
 
1477
- #: admin/tpl/setting/settings_advanced.php:9
1478
- msgid "Please take great care when changing any of these settings."
1479
- msgstr ""
1480
-
1481
- #: admin/tpl/setting/settings_advanced.php:10
1482
- msgid "If there are any questions, do not hesitate to submit a support thread."
1483
- msgstr ""
1484
-
1485
- #: admin/tpl/setting/settings_advanced.php:14
1486
  msgid "Check Advanced Cache"
1487
  msgstr ""
1488
 
1489
- #: admin/tpl/setting/settings_advanced.php:17
1490
  msgid "Include advanced-cache.php"
1491
  msgstr ""
1492
 
1493
- #: admin/tpl/setting/settings_advanced.php:20
1494
  msgid ""
1495
  "The advanced-cache.php file is used by many caching plugins to signal that a "
1496
  "cache is active."
1497
  msgstr ""
1498
 
1499
- #: admin/tpl/setting/settings_advanced.php:21
1500
  msgid ""
1501
  "When this option is checked and this file is detected as belonging to "
1502
  "another plugin, LiteSpeed Cache will not cache."
1503
  msgstr ""
1504
 
1505
- #: admin/tpl/setting/settings_advanced.php:24
1506
  msgid ""
1507
  "Uncheck this option only if the other plugin is used for non-caching "
1508
  "purposes, such as minifying css/js files."
1509
  msgstr ""
1510
 
1511
- #: admin/tpl/setting/settings_advanced.php:27
1512
  msgid "Login Cookie"
1513
  msgstr ""
1514
 
1515
- #: admin/tpl/setting/settings_advanced.php:30
1516
  msgid "SYNTAX: alphanumeric and \"_\"."
1517
  msgstr ""
1518
 
1519
- #: admin/tpl/setting/settings_advanced.php:31
1520
  msgid "No spaces and case sensitive."
1521
  msgstr ""
1522
 
1523
- #: admin/tpl/setting/settings_advanced.php:32
1524
  msgid "MUST BE UNIQUE FROM OTHER WEB APPLICATIONS."
1525
  msgstr ""
1526
 
1527
- #: admin/tpl/setting/settings_advanced.php:35
1528
  msgid "The default login cookie is %s."
1529
  msgstr ""
1530
 
1531
- #: admin/tpl/setting/settings_advanced.php:36
1532
  msgid ""
1533
  "The server will determine if the user is logged in based on the existance of "
1534
  "this cookie."
1535
  msgstr ""
1536
 
1537
- #: admin/tpl/setting/settings_advanced.php:37
1538
  msgid ""
1539
  "This setting is useful for those that have multiple web applications for the "
1540
  "same domain."
1541
  msgstr ""
1542
 
1543
- #: admin/tpl/setting/settings_advanced.php:38
1544
  msgid ""
1545
  "If every web application uses the same cookie, the server may confuse "
1546
  "whether a user is logged in or not."
1547
  msgstr ""
1548
 
1549
- #: admin/tpl/setting/settings_advanced.php:39
1550
  msgid "The cookie set here will be used for this WordPress installation."
1551
  msgstr ""
1552
 
1553
- #: admin/tpl/setting/settings_advanced.php:42
1554
  msgid "Example use case:"
1555
  msgstr ""
1556
 
1557
- #: admin/tpl/setting/settings_advanced.php:44
1558
  msgid "There is a WordPress installed for %s."
1559
  msgstr ""
1560
 
1561
- #: admin/tpl/setting/settings_advanced.php:46
1562
  msgid "Then another WordPress is installed (NOT MULTISITE) at %s"
1563
  msgstr ""
1564
 
1565
- #: admin/tpl/setting/settings_advanced.php:47
1566
  msgid ""
1567
  "The cache needs to distinguish who is logged into which WordPress site in "
1568
  "order to cache correctly."
1569
  msgstr ""
1570
 
1571
- #: admin/tpl/setting/settings_advanced.php:53
1572
  msgid "Error: invalid login cookie. Please check the %s file"
1573
  msgstr ""
1574
 
1575
- #: admin/tpl/setting/settings_advanced.php:62
1576
  msgid "Error getting current rules from %s: %s"
1577
  msgstr ""
1578
 
1579
- #: admin/tpl/setting/settings_advanced.php:70
1580
  msgid ""
1581
  "WARNING: The .htaccess login cookie and Database login cookie do not match."
1582
  msgstr ""
1583
 
 
 
 
 
 
 
 
 
 
 
1584
  #: admin/tpl/setting/settings_cache.php:4
1585
  msgid "Cache Control Settings"
1586
  msgstr ""
@@ -1634,7 +1728,7 @@ msgstr ""
1634
 
1635
  #: admin/tpl/setting/settings_cache.php:62
1636
  #: admin/tpl/setting/settings_excludes.php:14
1637
- #: admin/tpl/setting/settings_tuning.php:159
1638
  msgid "For example, for %s, %s can be used here."
1639
  msgstr ""
1640
 
@@ -1648,115 +1742,190 @@ msgstr ""
1648
  msgid "To do an exact match, add %s to the end of the URL."
1649
  msgstr ""
1650
 
1651
- #: admin/tpl/setting/settings_cdn.php:11
 
 
 
 
 
 
 
 
 
 
 
 
1652
  msgid "CDN Settings"
1653
  msgstr ""
1654
 
1655
- #: admin/tpl/setting/settings_cdn.php:15
1656
  msgid "Enable CDN"
1657
  msgstr ""
1658
 
1659
- #: admin/tpl/setting/settings_cdn.php:19
1660
  msgid "Enable Content Delivery Network use."
1661
  msgstr ""
1662
 
1663
- #: admin/tpl/setting/settings_cdn.php:25
 
 
 
 
1664
  msgid "CDN URL"
1665
  msgstr ""
1666
 
1667
- #: admin/tpl/setting/settings_cdn.php:29
1668
  msgid "CDN URL to be used. For example, %s"
1669
  msgstr ""
1670
 
1671
- #: admin/tpl/setting/settings_cdn.php:35
1672
- msgid "Original URL"
1673
  msgstr ""
1674
 
1675
- #: admin/tpl/setting/settings_cdn.php:39
1676
- msgid ""
1677
- "Site URL to be served through the CDN. Beginning with %1$s. For example, "
1678
- "%2$s."
1679
  msgstr ""
1680
 
1681
- #: admin/tpl/setting/settings_cdn.php:40
1682
- msgid ""
1683
- "Wildcard %1$s supported (match zero or more characters). For example, to "
1684
- "match %2$s and %3$s, use %4$s."
1685
  msgstr ""
1686
 
1687
- #: admin/tpl/setting/settings_cdn.php:46
1688
- msgid "Include Images"
 
1689
  msgstr ""
1690
 
1691
- #: admin/tpl/setting/settings_cdn.php:50
1692
  msgid ""
1693
- "Serve all image files through the CDN. This will affect all attachments, "
1694
- "HTML %s tags, and CSS %s attributes."
1695
  msgstr ""
1696
 
1697
- #: admin/tpl/setting/settings_cdn.php:56
1698
- msgid "Include CSS"
 
 
1699
  msgstr ""
1700
 
1701
- #: admin/tpl/setting/settings_cdn.php:60
1702
  msgid ""
1703
  "Serve all CSS files through the CDN. This will affect all enqueued WP CSS "
1704
  "files."
1705
  msgstr ""
1706
 
1707
- #: admin/tpl/setting/settings_cdn.php:66
1708
- msgid "Include JS"
1709
- msgstr ""
1710
-
1711
- #: admin/tpl/setting/settings_cdn.php:70
1712
  msgid ""
1713
  "Serve all JavaScript files through the CDN. This will affect all enqueued WP "
1714
  "JavaScript files."
1715
  msgstr ""
1716
 
1717
- #: admin/tpl/setting/settings_cdn.php:76
1718
- msgid "Include File Types"
1719
  msgstr ""
1720
 
1721
- #: admin/tpl/setting/settings_cdn.php:82
1722
- msgid "Static file type links to be replaced by CDN links. One per line."
1723
  msgstr ""
1724
 
1725
- #: admin/tpl/setting/settings_cdn.php:83
1726
- msgid "This will affect all tags containing attributes: %s %s %s."
1727
  msgstr ""
1728
 
1729
- #: admin/tpl/setting/settings_cdn.php:95
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1730
  msgid "Exclude Path"
1731
  msgstr ""
1732
 
1733
- #: admin/tpl/setting/settings_cdn.php:100
1734
  msgid "Paths containing these strings will not be served from the CDN."
1735
  msgstr ""
1736
 
1737
- #: admin/tpl/setting/settings_cdn.php:107
1738
  msgid "Load JQuery Remotely"
1739
  msgstr ""
1740
 
1741
- #: admin/tpl/setting/settings_cdn.php:113
1742
  #: admin/tpl/setting/settings_debug.php:16
1743
  msgid "Off"
1744
  msgstr ""
1745
 
1746
- #: admin/tpl/setting/settings_cdn.php:119
1747
  msgid "Google"
1748
  msgstr ""
1749
 
1750
- #: admin/tpl/setting/settings_cdn.php:125
1751
- msgid "cdnjs"
1752
  msgstr ""
1753
 
1754
- #: admin/tpl/setting/settings_cdn.php:129
1755
  msgid ""
1756
  "Improve page load time by loading jQuery from a remote CDN service instead "
1757
  "of locally."
1758
  msgstr ""
1759
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1760
  #: admin/tpl/setting/settings_compatibilities.php:7
1761
  msgid "Compatibility with WP-PostViews"
1762
  msgstr ""
@@ -1995,6 +2164,7 @@ msgid "Advanced level will log more details."
1995
  msgstr ""
1996
 
1997
  #: admin/tpl/setting/settings_debug.php:78
 
1998
  msgid "MB"
1999
  msgstr ""
2000
 
@@ -2312,9 +2482,9 @@ msgid ""
2312
  msgstr ""
2313
 
2314
  #: admin/tpl/setting/settings_inc.cache_browser.php:13
2315
- #: admin/tpl/setting/settings_inc.cache_favicon.php:15
2316
- #: admin/tpl/setting/settings_inc.cache_mobile.php:19
2317
- #: admin/tpl/setting/settings_inc.cache_resources.php:16
2318
  #: admin/tpl/setting/settings_inc.exclude_cookies.php:23
2319
  #: admin/tpl/setting/settings_inc.exclude_useragent.php:22
2320
  #: admin/tpl/setting/settings_inc.media_webp.php:13
@@ -2337,15 +2507,15 @@ msgid ""
2337
  "before expiring. Minimum is %s seconds."
2338
  msgstr ""
2339
 
2340
- #: admin/tpl/setting/settings_inc.cache_favicon.php:7
2341
  msgid "Cache favicon.ico"
2342
  msgstr ""
2343
 
2344
- #: admin/tpl/setting/settings_inc.cache_favicon.php:11
2345
  msgid "favicon.ico is requested on most pages."
2346
  msgstr ""
2347
 
2348
- #: admin/tpl/setting/settings_inc.cache_favicon.php:12
2349
  msgid ""
2350
  "Caching this resource may improve server performance by avoiding unnecessary "
2351
  "PHP calls."
@@ -2355,51 +2525,51 @@ msgstr ""
2355
  msgid "Cache Mobile"
2356
  msgstr ""
2357
 
2358
- #: admin/tpl/setting/settings_inc.cache_mobile.php:15
2359
  msgid "When enabled, mobile views will be cached separately."
2360
  msgstr ""
2361
 
2362
- #: admin/tpl/setting/settings_inc.cache_mobile.php:16
2363
  msgid "A site built with responsive design does not need to check this."
2364
  msgstr ""
2365
 
2366
- #: admin/tpl/setting/settings_inc.cache_mobile.php:26
2367
  msgid "List of Mobile User Agents"
2368
  msgstr ""
2369
 
2370
- #: admin/tpl/setting/settings_inc.cache_mobile.php:43
2371
  msgid "Htaccess did not match configuration option."
2372
  msgstr ""
2373
 
2374
- #: admin/tpl/setting/settings_inc.cache_mobile.php:44
2375
  msgid "Please re-enter the mobile view setting."
2376
  msgstr ""
2377
 
2378
- #: admin/tpl/setting/settings_inc.cache_mobile.php:45
2379
  msgid "List in WordPress database is: %s"
2380
  msgstr ""
2381
 
2382
- #: admin/tpl/setting/settings_inc.cache_mobile.php:61
2383
  msgid "SYNTAX: Each entry should be separated with a bar, %s."
2384
  msgstr ""
2385
 
2386
- #: admin/tpl/setting/settings_inc.cache_mobile.php:62
2387
  msgid "Any spaces should be escaped with a backslash before the space, %s."
2388
  msgstr ""
2389
 
2390
- #: admin/tpl/setting/settings_inc.cache_mobile.php:65
2391
  msgid "The default list WordPress uses is %s"
2392
  msgstr ""
2393
 
2394
- #: admin/tpl/setting/settings_inc.cache_resources.php:8
2395
  msgid "Cache PHP Resources"
2396
  msgstr ""
2397
 
2398
- #: admin/tpl/setting/settings_inc.cache_resources.php:12
2399
  msgid "Some themes and plugins add resources via a PHP request."
2400
  msgstr ""
2401
 
2402
- #: admin/tpl/setting/settings_inc.cache_resources.php:13
2403
  msgid ""
2404
  "Caching these pages may improve server performance by avoiding unnecessary "
2405
  "PHP calls."
@@ -2463,125 +2633,133 @@ msgid "Load images only when they enter the viewport."
2463
  msgstr ""
2464
 
2465
  #: admin/tpl/setting/settings_media.php:15
2466
- #: admin/tpl/setting/settings_media.php:56
2467
  msgid "This can improve page loading time by reducing initial HTTP requests."
2468
  msgstr ""
2469
 
2470
- #: admin/tpl/setting/settings_media.php:21
2471
- msgid "Lazy Load Image Excludes"
 
 
 
 
2472
  msgstr ""
2473
 
2474
  #: admin/tpl/setting/settings_media.php:25
 
 
 
 
2475
  msgid "Listed images will not be lazy loaded."
2476
  msgstr ""
2477
 
2478
- #: admin/tpl/setting/settings_media.php:26
2479
  #: admin/tpl/setting/settings_tuning.php:35
2480
  #: admin/tpl/setting/settings_tuning.php:71
2481
- #: admin/tpl/setting/settings_tuning.php:130
2482
- #: admin/tpl/setting/settings_tuning.php:158
2483
  msgid "Both full URLs and partial strings can be used."
2484
  msgstr ""
2485
 
2486
- #: admin/tpl/setting/settings_media.php:29
2487
  #: admin/tpl/setting/settings_optimize.php:112
2488
  #: admin/tpl/setting/settings_tuning.php:22
2489
  #: admin/tpl/setting/settings_tuning.php:38
2490
  #: admin/tpl/setting/settings_tuning.php:58
2491
  #: admin/tpl/setting/settings_tuning.php:74
2492
- #: admin/tpl/setting/settings_tuning.php:133
2493
  msgid "API:"
2494
  msgstr ""
2495
 
2496
- #: admin/tpl/setting/settings_media.php:30
2497
  #: admin/tpl/setting/settings_tuning.php:39
2498
  #: admin/tpl/setting/settings_tuning.php:75
2499
- #: admin/tpl/setting/settings_tuning.php:134
2500
  msgid "Filter %s is supported."
2501
  msgstr ""
2502
 
2503
- #: admin/tpl/setting/settings_media.php:31
2504
  #: admin/tpl/setting/settings_optimize.php:113
2505
  #: admin/tpl/setting/settings_tuning.php:40
2506
  #: admin/tpl/setting/settings_tuning.php:76
2507
- #: admin/tpl/setting/settings_tuning.php:135
2508
  msgid "Elements with attribute %s in html code will be excluded."
2509
  msgstr ""
2510
 
2511
- #: admin/tpl/setting/settings_media.php:38
2512
  msgid "Lazy Load Image Placeholder"
2513
  msgstr ""
2514
 
2515
- #: admin/tpl/setting/settings_media.php:42
2516
  msgid ""
2517
  "Specify a base64 image to be used as a placeholder while other images finish "
2518
  "loading."
2519
  msgstr ""
2520
 
2521
- #: admin/tpl/setting/settings_media.php:43
2522
  msgid ""
2523
  "This can be predefined in %2$s as well using constant %1$s, with this "
2524
  "setting taking priority."
2525
  msgstr ""
2526
 
2527
- #: admin/tpl/setting/settings_media.php:44
2528
  msgid "By default a gray image placeholder %s will be used."
2529
  msgstr ""
2530
 
2531
- #: admin/tpl/setting/settings_media.php:45
2532
  msgid "For example, %s can be used for a transparent placeholder."
2533
  msgstr ""
2534
 
2535
- #: admin/tpl/setting/settings_media.php:51
2536
  msgid "Lazy Load Iframes"
2537
  msgstr ""
2538
 
2539
- #: admin/tpl/setting/settings_media.php:55
2540
  msgid "Load iframes only when they enter the viewport."
2541
  msgstr ""
2542
 
2543
- #: admin/tpl/setting/settings_media.php:62
2544
  msgid "Disable Optimization Pull"
2545
  msgstr ""
2546
 
2547
- #: admin/tpl/setting/settings_media.php:66
2548
  msgid ""
2549
  "Set this option to %s to disable the cron job responsible for fetching "
2550
  "optimized images from LiteSpeed's Image Server."
2551
  msgstr ""
2552
 
2553
- #: admin/tpl/setting/settings_media.php:80
2554
  msgid "Only Request WebP"
2555
  msgstr ""
2556
 
2557
- #: admin/tpl/setting/settings_media.php:84
2558
  msgid ""
2559
  "Prevent images from being replaced with optimized versions when optimizing. "
2560
  "WebP versions will still be generated."
2561
  msgstr ""
2562
 
2563
- #: admin/tpl/setting/settings_media.php:90
2564
  msgid "Preserve EXIF data"
2565
  msgstr ""
2566
 
2567
- #: admin/tpl/setting/settings_media.php:94
2568
  msgid ""
2569
  "Preserve EXIF data (copyright, GPS, comments, keywords, etc) when optimizing."
2570
  msgstr ""
2571
 
2572
- #: admin/tpl/setting/settings_media.php:95
2573
  msgid "This will increase the size of optimized files."
2574
  msgstr ""
2575
 
2576
- #: admin/tpl/setting/settings_media.php:101
2577
  msgid "WebP Lossless Compression"
2578
  msgstr ""
2579
 
2580
- #: admin/tpl/setting/settings_media.php:105
2581
  msgid "Generate WebP images using lossless compression."
2582
  msgstr ""
2583
 
2584
- #: admin/tpl/setting/settings_media.php:106
2585
  msgid "This can improve quality at the cost of larger images."
2586
  msgstr ""
2587
 
@@ -2668,7 +2846,7 @@ msgid "Minify HTML content."
2668
  msgstr ""
2669
 
2670
  #: admin/tpl/setting/settings_optimize.php:105
2671
- #: admin/tpl/setting/settings_tuning.php:119
2672
  msgid "Load CSS Asynchronously"
2673
  msgstr ""
2674
 
@@ -2678,8 +2856,9 @@ msgstr ""
2678
 
2679
  #: admin/tpl/setting/settings_optimize.php:110
2680
  #: admin/tpl/setting/settings_optimize.php:125
2681
- #: admin/tpl/setting/settings_tuning.php:88
2682
- #: admin/tpl/setting/settings_tuning.php:147
 
2683
  msgid ""
2684
  "This can improve your speed score in services like Pingdom, GTmetrix and "
2685
  "PageSpeed."
@@ -2709,6 +2888,26 @@ msgid ""
2709
  "option."
2710
  msgstr ""
2711
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2712
  #: admin/tpl/setting/settings_purge.php:5
2713
  msgid "Purge Settings"
2714
  msgstr ""
@@ -2762,7 +2961,7 @@ msgid "Auto Purge Rules For Publish/Update"
2762
  msgstr ""
2763
 
2764
  #: admin/tpl/setting/settings_purge.php:47
2765
- #: thirdparty/lscwp-3rd-woocommerce.cls.php:795
2766
  msgid "Note:"
2767
  msgstr ""
2768
 
@@ -2881,76 +3080,90 @@ msgid "Listed JS files will not be minified/combined."
2881
  msgstr ""
2882
 
2883
  #: admin/tpl/setting/settings_tuning.php:83
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2884
  msgid "Remove Query Strings"
2885
  msgstr ""
2886
 
2887
- #: admin/tpl/setting/settings_tuning.php:87
2888
  msgid "Remove query strings from static resources."
2889
  msgstr ""
2890
 
2891
- #: admin/tpl/setting/settings_tuning.php:94
2892
  msgid "Load Google Fonts Asynchronously"
2893
  msgstr ""
2894
 
2895
- #: admin/tpl/setting/settings_tuning.php:98
2896
  msgid ""
2897
  "This is useful if you only want to load Google Fonts asynchronously while "
2898
  "leave other CSS intact."
2899
  msgstr ""
2900
 
2901
- #: admin/tpl/setting/settings_tuning.php:99
2902
  msgid ""
2903
  "This will also add a preconnect to Google for faster Google Fonts "
2904
  "downloading."
2905
  msgstr ""
2906
 
2907
- #: admin/tpl/setting/settings_tuning.php:105
2908
  msgid "Remove Google Fonts"
2909
  msgstr ""
2910
 
2911
- #: admin/tpl/setting/settings_tuning.php:109
2912
  msgid "Prevent google fonts from loading on all your pages."
2913
  msgstr ""
2914
 
2915
- #: admin/tpl/setting/settings_tuning.php:115
2916
  msgid "Critical CSS Rules"
2917
  msgstr ""
2918
 
2919
- #: admin/tpl/setting/settings_tuning.php:119
2920
  msgid "Specify critical CSS rules for above-the-fold content when enabling %s."
2921
  msgstr ""
2922
 
2923
- #: admin/tpl/setting/settings_tuning.php:125
2924
  msgid "JS Deferred Excludes"
2925
  msgstr ""
2926
 
2927
- #: admin/tpl/setting/settings_tuning.php:129
2928
  msgid "Listed JS files will not be deferred."
2929
  msgstr ""
2930
 
2931
- #: admin/tpl/setting/settings_tuning.php:142
2932
  msgid "Remove WordPress Emoji"
2933
  msgstr ""
2934
 
2935
- #: admin/tpl/setting/settings_tuning.php:146
2936
  msgid ""
2937
  "Stop loading wordpress.org emoji. Browser default emoji will be displayed "
2938
  "instead."
2939
  msgstr ""
2940
 
2941
- #: admin/tpl/setting/settings_tuning.php:153
2942
  msgid "URI Excludes"
2943
  msgstr ""
2944
 
2945
- #: admin/tpl/setting/settings_tuning.php:157
2946
  msgid "Prevent any optimization of listed pages."
2947
  msgstr ""
2948
 
2949
- #: admin/tpl/setting/settings_tuning.php:166
2950
  msgid "Role Excludes"
2951
  msgstr ""
2952
 
2953
- #: admin/tpl/setting/settings_tuning.php:172
2954
  msgid "Selected roles will be excluded from all optimizations."
2955
  msgstr ""
2956
 
@@ -2962,10 +3175,6 @@ msgstr ""
2962
  msgid "Tuning"
2963
  msgstr ""
2964
 
2965
- #: admin/tpl/settings.php:14
2966
- msgid "CDN"
2967
- msgstr ""
2968
-
2969
  #: admin/tpl/settings.php:17
2970
  msgid "ESI"
2971
  msgstr ""
@@ -3020,6 +3229,30 @@ msgstr ""
3020
  msgid "Purged the tags!"
3021
  msgstr ""
3022
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3023
  #: inc/crawler.class.php:109 includes/litespeed-cache-crawler.class.php:109
3024
  msgid "Can not find any form data for blacklist"
3025
  msgstr ""
@@ -3045,59 +3278,67 @@ msgstr ""
3045
  msgid "Reached end of sitemap file. Crawling completed."
3046
  msgstr ""
3047
 
3048
- #: inc/gui.class.php:153 includes/litespeed-cache-gui.class.php:153
3049
  msgid "Purge this page"
3050
  msgstr ""
3051
 
3052
- #: inc/gui.class.php:161 includes/litespeed-cache-gui.class.php:161
3053
  msgid "Mark this page as "
3054
  msgstr ""
3055
 
3056
- #: inc/gui.class.php:168 includes/litespeed-cache-gui.class.php:168
3057
  msgid "Non cacheable"
3058
  msgstr ""
3059
 
3060
- #: inc/gui.class.php:175 includes/litespeed-cache-gui.class.php:175
3061
  msgid "Private cache"
3062
  msgstr ""
3063
 
3064
- #: inc/gui.class.php:182 includes/litespeed-cache-gui.class.php:182
3065
  msgid "No optimization"
3066
  msgstr ""
3067
 
3068
- #: inc/gui.class.php:189 includes/litespeed-cache-gui.class.php:189
3069
  msgid "More settings"
3070
  msgstr ""
3071
 
3072
- #: inc/litespeed-cache.class.php:239 includes/litespeed-cache.class.php:239
 
 
 
 
 
 
 
 
3073
  msgid "Crawler blacklist is saved."
3074
  msgstr ""
3075
 
3076
- #: inc/litespeed-cache.class.php:244 includes/litespeed-cache.class.php:244
3077
  msgid "Notified LiteSpeed Web Server to purge the front page."
3078
  msgstr ""
3079
 
3080
- #: inc/litespeed-cache.class.php:249 includes/litespeed-cache.class.php:249
3081
  msgid "Notified LiteSpeed Web Server to purge pages."
3082
  msgstr ""
3083
 
3084
- #: inc/litespeed-cache.class.php:254 includes/litespeed-cache.class.php:254
3085
  msgid "Notified LiteSpeed Web Server to purge CSS/JS entries."
3086
  msgstr ""
3087
 
3088
- #: inc/litespeed-cache.class.php:259 includes/litespeed-cache.class.php:259
3089
  msgid "Notified LiteSpeed Web Server to purge error pages."
3090
  msgstr ""
3091
 
3092
- #: inc/litespeed-cache.class.php:265 includes/litespeed-cache.class.php:265
3093
  msgid "Notified LiteSpeed Web Server to purge all caches."
3094
  msgstr ""
3095
 
3096
- #: inc/litespeed-cache.class.php:272 includes/litespeed-cache.class.php:272
3097
  msgid "Notified LiteSpeed Web Server to purge everything."
3098
  msgstr ""
3099
 
3100
- #: inc/litespeed-cache.class.php:287 includes/litespeed-cache.class.php:287
3101
  msgid "Notified LiteSpeed Web Server to purge the list."
3102
  msgstr ""
3103
 
@@ -3145,41 +3386,37 @@ msgstr ""
3145
  msgid "Switched to optimized file successfully."
3146
  msgstr ""
3147
 
3148
- #: inc/media.class.php:434
3149
  msgid "Failed to communicate with LiteSpeed IAPI server"
3150
  msgstr ""
3151
 
3152
- #: inc/media.class.php:443
3153
  msgid "Communicated with LiteSpeed Image Optimization Server successfully."
3154
  msgstr ""
3155
 
3156
- #: inc/media.class.php:999
3157
  msgid "Failed to push to LiteSpeed IAPI server: %s"
3158
  msgstr ""
3159
 
3160
- #: inc/media.class.php:1007
3161
  msgid "Failed to parse data from LiteSpeed IAPI server: %s"
3162
  msgstr ""
3163
 
3164
- #: inc/media.class.php:1125
3165
- msgid "No image found"
3166
- msgstr ""
3167
-
3168
- #: inc/media.class.php:1190 inc/media.class.php:1323
3169
  msgid "No image found."
3170
  msgstr ""
3171
 
3172
- #: inc/media.class.php:1230 inc/media.class.php:1384
3173
  msgid ""
3174
  "Pushed %1$s groups with %2$s images to LiteSpeed optimization server, "
3175
  "accepted %3$s groups with %4$s images."
3176
  msgstr ""
3177
 
3178
- #: inc/media.class.php:1296
3179
  msgid "Number of images in one image group (%s) exceeds the credit (%s)"
3180
  msgstr ""
3181
 
3182
- #: inc/media.class.php:1352
3183
  msgid "Post data is empty."
3184
  msgstr ""
3185
 
@@ -3207,8 +3444,8 @@ msgstr ""
3207
  msgid "LiteSpeed Cache Custom Cron Crawler"
3208
  msgstr ""
3209
 
3210
- #: inc/utility.class.php:63 includes/litespeed-cache-utility.class.php:63
3211
- msgid " %s ago "
3212
  msgstr ""
3213
 
3214
  #: lib/litespeed/litespeed-crawler.class.php:174
@@ -3264,75 +3501,75 @@ msgstr ""
3264
  msgid "Failed to write to %s."
3265
  msgstr ""
3266
 
3267
- #: thirdparty/lscwp-3rd-woocommerce.cls.php:730
3268
  msgid "WooCommerce"
3269
  msgstr ""
3270
 
3271
- #: thirdparty/lscwp-3rd-woocommerce.cls.php:733
3272
  msgid "Purge product on changes to the quantity or stock status."
3273
  msgstr ""
3274
 
3275
- #: thirdparty/lscwp-3rd-woocommerce.cls.php:734
3276
  msgid "Purge categories only when stock status changes."
3277
  msgstr ""
3278
 
3279
- #: thirdparty/lscwp-3rd-woocommerce.cls.php:735
3280
  msgid "Purge product and categories only when the stock status changes."
3281
  msgstr ""
3282
 
3283
- #: thirdparty/lscwp-3rd-woocommerce.cls.php:736
3284
  msgid "Purge product only when the stock status changes."
3285
  msgstr ""
3286
 
3287
- #: thirdparty/lscwp-3rd-woocommerce.cls.php:737
3288
  msgid "Do not purge categories on changes to the quantity or stock status."
3289
  msgstr ""
3290
 
3291
- #: thirdparty/lscwp-3rd-woocommerce.cls.php:738
3292
  msgid ""
3293
  "Always purge both product and categories on changes to the quantity or stock "
3294
  "status."
3295
  msgstr ""
3296
 
3297
- #: thirdparty/lscwp-3rd-woocommerce.cls.php:741
3298
  msgid ""
3299
  "Determines how changes in product quantity and product stock status affect "
3300
  "product pages and their associated category pages."
3301
  msgstr ""
3302
 
3303
- #: thirdparty/lscwp-3rd-woocommerce.cls.php:742
3304
  msgid ""
3305
  "Checking this option will force the shop page to use the front page TTL "
3306
  "setting."
3307
  msgstr ""
3308
 
3309
- #: thirdparty/lscwp-3rd-woocommerce.cls.php:743
3310
  msgid ""
3311
  "For example, if the homepage for the site is located at %1$s, the shop page "
3312
  "may be located at %2$s."
3313
  msgstr ""
3314
 
3315
- #: thirdparty/lscwp-3rd-woocommerce.cls.php:771
3316
  msgid "Product Update Interval"
3317
  msgstr ""
3318
 
3319
- #: thirdparty/lscwp-3rd-woocommerce.cls.php:778
3320
  msgid "Use Front Page TTL for the Shop Page"
3321
  msgstr ""
3322
 
3323
- #: thirdparty/lscwp-3rd-woocommerce.cls.php:785
3324
  msgid "Privately Cache Cart"
3325
  msgstr ""
3326
 
3327
- #: thirdparty/lscwp-3rd-woocommerce.cls.php:789
3328
  msgid "Privately cache cart when not empty."
3329
  msgstr ""
3330
 
3331
- #: thirdparty/lscwp-3rd-woocommerce.cls.php:797
3332
  msgid "After verifying that the cache works in general, please test the cart."
3333
  msgstr ""
3334
 
3335
- #: thirdparty/lscwp-3rd-woocommerce.cls.php:798
3336
  msgid "To test the cart, visit the <a %s>FAQ</a>."
3337
  msgstr ""
3338
 
1
+ # Copyright (C) 2018 LiteSpeed Cache
2
  # This file is distributed under the same license as the LiteSpeed Cache package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: LiteSpeed Cache 1.7.2\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/litespeed-cache\n"
7
+ "POT-Creation-Date: 2018-01-05 15:45:16+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2018-MO-DA HO:MI+ZONE\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
15
+ #: admin/admin-api.class.php:238
16
  msgid "IAPI Error %s"
17
  msgstr ""
18
 
19
+ #: admin/admin-api.class.php:261
20
+ msgid "Reset IAPI key successfully."
21
+ msgstr ""
22
+
23
+ #: admin/admin-api.class.php:314
24
  msgid "Failed to communicate with LiteSpeed image server"
25
  msgstr ""
26
 
27
+ #: admin/admin-api.class.php:322 admin/admin-api.class.php:330
28
  msgid "Message from LiteSpeed image server"
29
  msgstr ""
30
 
31
  #: admin/litespeed-cache-admin-display.class.php:140
32
+ #: admin/tpl/setting/settings_cdn.php:178 inc/gui.class.php:250
33
+ #: includes/litespeed-cache-gui.class.php:250
34
  msgid "Manage"
35
  msgstr ""
36
 
37
  #: admin/litespeed-cache-admin-display.class.php:142
38
+ #: admin/litespeed-cache-admin-display.class.php:232 inc/gui.class.php:258
39
+ #: includes/litespeed-cache-gui.class.php:258
40
  msgid "Settings"
41
  msgstr ""
42
 
44
  msgid "Edit .htaccess"
45
  msgstr ""
46
 
47
+ #: admin/litespeed-cache-admin-display.class.php:149 inc/gui.class.php:267
48
+ #: includes/litespeed-cache-gui.class.php:267
49
  msgid "Image Optimization"
50
  msgstr ""
51
 
67
  "It is recommended that LiteSpeed Cache be purged after updating a plugin."
68
  msgstr ""
69
 
70
+ #: admin/litespeed-cache-admin-display.class.php:780
71
+ #: admin/litespeed-cache-admin-display.class.php:865
72
+ #: admin/tpl/setting/settings_media.php:70
 
 
 
73
  #: admin/tpl/setting/settings_optimize.php:135
74
  #: admin/tpl/setting/settings_tuning.php:19
75
  #: admin/tpl/setting/settings_tuning.php:55
76
  msgid "ON"
77
  msgstr ""
78
 
79
+ #: admin/litespeed-cache-admin-display.class.php:781
80
+ #: admin/litespeed-cache-admin-display.class.php:869
81
  #: admin/tpl/setting/settings_tuning.php:16
82
  #: admin/tpl/setting/settings_tuning.php:52
83
  msgid "OFF"
84
  msgstr ""
85
 
86
+ #: admin/litespeed-cache-admin-display.class.php:894
87
  msgid "Recommended value: %s"
88
  msgstr ""
89
 
351
  msgid "Failed to push to LiteSpeed server: %s"
352
  msgstr ""
353
 
354
+ #: admin/litespeed-cache-admin-rules.class.php:690
355
  msgid ""
356
  "<p>Please add/replace the following codes into the beginning of %1$s:</p> "
357
  "%2$s"
358
  msgstr ""
359
 
360
+ #: admin/litespeed-cache-admin-rules.class.php:888
361
  msgid "File Saved."
362
  msgstr ""
363
 
365
  msgid "'Use primary site settings' set by Network Administrator."
366
  msgstr ""
367
 
368
+ #: admin/litespeed-cache-admin-settings.class.php:221
369
  msgid "Site options saved."
370
  msgstr ""
371
 
372
+ #: admin/litespeed-cache-admin-settings.class.php:260
373
+ #: admin/litespeed-cache-admin-settings.class.php:882
374
  msgid "Default Public Cache"
375
  msgstr ""
376
 
377
+ #: admin/litespeed-cache-admin-settings.class.php:261
378
  msgid "Default Private Cache"
379
  msgstr ""
380
 
381
+ #: admin/litespeed-cache-admin-settings.class.php:262
382
  msgid "Default Front Page"
383
  msgstr ""
384
 
385
+ #: admin/litespeed-cache-admin-settings.class.php:263
386
  msgid "Feed"
387
  msgstr ""
388
 
389
+ #: admin/litespeed-cache-admin-settings.class.php:264
390
  msgid "404"
391
  msgstr ""
392
 
393
+ #: admin/litespeed-cache-admin-settings.class.php:265
394
  msgid "403"
395
  msgstr ""
396
 
397
+ #: admin/litespeed-cache-admin-settings.class.php:266
398
  msgid "500"
399
  msgstr ""
400
 
401
+ #: admin/litespeed-cache-admin-settings.class.php:743
402
  #: admin/tpl/setting/settings_debug.php:75
403
  msgid "Log File Size Limit"
404
  msgstr ""
405
 
406
+ #: admin/litespeed-cache-admin-settings.class.php:809
407
  #: admin/tpl/setting/settings_crawler.php:10
408
  msgid "Delay"
409
  msgstr ""
410
 
411
+ #: admin/litespeed-cache-admin-settings.class.php:810
412
  #: admin/tpl/setting/settings_crawler.php:22
413
  msgid "Run Duration"
414
  msgstr ""
415
 
416
+ #: admin/litespeed-cache-admin-settings.class.php:811
417
  msgid "Cron Interval"
418
  msgstr ""
419
 
420
+ #: admin/litespeed-cache-admin-settings.class.php:812
421
  msgid "Whole Interval"
422
  msgstr ""
423
 
424
+ #: admin/litespeed-cache-admin-settings.class.php:813
425
  #: admin/tpl/setting/settings_crawler.php:58
426
  msgid "Threads"
427
  msgstr ""
450
  "page caching offerings—such as minifying css/js files."
451
  msgstr ""
452
 
453
+ #: admin/tpl/crawler.php:15 admin/tpl/crawler.php:84
454
  msgid "LiteSpeed Cache Crawler"
455
  msgstr ""
456
 
457
+ #: admin/tpl/crawler.php:26
458
  msgid "Crawler File"
459
  msgstr ""
460
 
461
+ #: admin/tpl/crawler.php:28
462
  msgid "Generate Crawler File"
463
  msgstr ""
464
 
465
+ #: admin/tpl/crawler.php:33
466
  msgid "Generated at %s"
467
  msgstr ""
468
 
469
+ #: admin/tpl/crawler.php:37
470
  msgid ""
471
  "On click, this will create a crawler sitemap file in plugin directory %s."
472
  msgstr ""
473
 
474
+ #: admin/tpl/crawler.php:47
475
  msgid "%d hours"
476
  msgstr ""
477
 
478
+ #: admin/tpl/crawler.php:50
479
  msgid "%d hour"
480
  msgstr ""
481
 
482
+ #: admin/tpl/crawler.php:57
483
  msgid "%d minutes"
484
  msgstr ""
485
 
486
+ #: admin/tpl/crawler.php:60
487
  msgid "%d minute"
488
  msgstr ""
489
 
490
+ #: admin/tpl/crawler.php:64
491
  msgid "Crawler Cron"
492
  msgstr ""
493
 
494
+ #: admin/tpl/crawler.php:67 admin/tpl/manage/manage_cdn.php:15
495
+ #: admin/tpl/setting/settings_optimize.php:10 admin/tpl/settings.php:130
496
  msgid "WARNING"
497
  msgstr ""
498
 
499
+ #: admin/tpl/crawler.php:68
500
  msgid ""
501
  "The crawler feature is not enabled on the LiteSpeed server. Please consult "
502
  "your server admin."
503
  msgstr ""
504
 
505
+ #: admin/tpl/crawler.php:69
506
  msgid ""
507
  "See <a %s>Introduction for Enabling the Crawler</a> for detailed infomation."
508
  msgstr ""
509
 
510
+ #: admin/tpl/crawler.php:74
511
  msgid "Cron Name"
512
  msgstr ""
513
 
514
+ #: admin/tpl/crawler.php:75
515
  msgid "Run Frequency"
516
  msgstr ""
517
 
518
+ #: admin/tpl/crawler.php:76
519
  msgid "Last Status"
520
  msgstr ""
521
 
522
+ #: admin/tpl/crawler.php:77
523
  msgid "Activation"
524
  msgstr ""
525
 
526
+ #: admin/tpl/crawler.php:78
527
  msgid "Actions"
528
  msgstr ""
529
 
530
+ #: admin/tpl/crawler.php:91
531
  msgid "The current sitemap crawl started at %s"
532
  msgstr ""
533
 
534
+ #: admin/tpl/crawler.php:94
535
  msgid "The next complete sitemap crawl will start at %s"
536
  msgstr ""
537
 
538
+ #: admin/tpl/crawler.php:108
539
  msgid "The last complete run cost %s seconds"
540
  msgstr ""
541
 
542
+ #: admin/tpl/crawler.php:118
543
  msgid "Is running"
544
  msgstr ""
545
 
546
+ #: admin/tpl/crawler.php:134 admin/tpl/setting/settings_general.php:30
547
  msgid "Enable"
548
  msgstr ""
549
 
550
+ #: admin/tpl/crawler.php:134 admin/tpl/esi_widget_edit.php:56
551
  #: admin/tpl/setting/settings_general.php:24
552
  msgid "Disable"
553
  msgstr ""
554
 
555
+ #: admin/tpl/crawler.php:141
556
  msgid "Reset position"
557
  msgstr ""
558
 
559
+ #: admin/tpl/crawler.php:144
560
  msgid "Manually run"
561
  msgstr ""
562
 
563
+ #: admin/tpl/crawler.php:148
564
  msgid "<b>Last interval:</b> %s"
565
  msgstr ""
566
 
567
+ #: admin/tpl/crawler.php:154
568
  msgid "<b>Ended reason:</b> %s"
569
  msgstr ""
570
 
571
+ #: admin/tpl/crawler.php:160
572
  msgid "<b>Last crawled:</b> %s item(s)"
573
  msgstr ""
574
 
575
+ #: admin/tpl/crawler.php:168
576
  msgid "Run frequency is set by the Interval Between Runs setting."
577
  msgstr ""
578
 
579
+ #: admin/tpl/crawler.php:169
580
  msgid "Only one crawler can run concurrently."
581
  msgstr ""
582
 
583
+ #: admin/tpl/crawler.php:170
584
  msgid ""
585
  "If both the cron and manual run start at a similar time, the first one to "
586
  "start will run."
587
  msgstr ""
588
 
589
+ #: admin/tpl/crawler.php:171
590
  msgid ""
591
  "Please follow <a %s>Hooking WP-Cron Into the System Task Scheduler</a> to "
592
  "create the system cron task."
593
  msgstr ""
594
 
595
+ #: admin/tpl/crawler.php:176
596
  msgid "Watch Crawler Status"
597
  msgstr ""
598
 
599
+ #: admin/tpl/crawler.php:183
600
  msgid "Show crawler status"
601
  msgstr ""
602
 
603
+ #: admin/tpl/crawler.php:201
604
  msgid "No crawler meta file generated yet"
605
  msgstr ""
606
 
607
+ #: admin/tpl/crawler.php:206
608
  msgid "Sitemap Generation Blacklist"
609
  msgstr ""
610
 
611
+ #: admin/tpl/crawler.php:215 admin/tpl/edit_htaccess.php:68
612
  msgid "Save"
613
  msgstr ""
614
 
615
+ #: admin/tpl/crawler.php:219
616
  msgid "Current blacklist has %s item(s)."
617
  msgstr ""
618
 
619
+ #: admin/tpl/crawler.php:220
620
  msgid ""
621
  "All Urls which returned no-cache tags will be added here, after the initial "
622
  "crawling."
672
  msgid "Public"
673
  msgstr ""
674
 
675
+ #: admin/tpl/esi_widget_edit.php:48
676
  msgid "Private"
677
  msgstr ""
678
 
679
+ #: admin/tpl/esi_widget_edit.php:66
680
  msgid "Widget Cache TTL:"
681
  msgstr ""
682
 
683
+ #: admin/tpl/esi_widget_edit.php:69 admin/tpl/setting/settings_crawler.php:25
684
  #: admin/tpl/setting/settings_crawler.php:37
685
  #: admin/tpl/setting/settings_crawler.php:49
686
  #: admin/tpl/setting/settings_general.php:59
695
  msgid "seconds"
696
  msgstr ""
697
 
698
+ #: admin/tpl/esi_widget_edit.php:72
699
  msgid "Recommended value: 28800 seconds (8 hours)."
700
  msgstr ""
701
 
702
+ #: admin/tpl/esi_widget_edit.php:73
703
  msgid "A TTL of 0 indicates do not cache."
704
  msgstr ""
705
 
743
  msgid "LiteSpeed Cache Image Optimization"
744
  msgstr ""
745
 
746
+ #: admin/tpl/image_optimization.php:60
747
  msgid "Optimization Summary"
748
  msgstr ""
749
 
750
+ #: admin/tpl/image_optimization.php:90 admin/tpl/image_optimization.php:110
751
  msgid "Update Reduction Status"
752
  msgstr ""
753
 
754
+ #: admin/tpl/image_optimization.php:93
755
  msgid ""
756
  "This will communicate with LiteSpeed's Image Optimization Server and "
757
  "retrieve the most recent status."
758
  msgstr ""
759
 
760
+ #: admin/tpl/image_optimization.php:98
761
  msgid "Image Information"
762
  msgstr ""
763
 
764
+ #: admin/tpl/image_optimization.php:99
765
  msgid "Beta Version"
766
  msgstr ""
767
 
768
+ #: admin/tpl/image_optimization.php:102
769
  msgid "<a %s>Image groups</a> total"
770
  msgstr ""
771
 
772
+ #: admin/tpl/image_optimization.php:103
773
  msgid "Image groups not yet requested"
774
  msgstr ""
775
 
776
+ #: admin/tpl/image_optimization.php:107 admin/tpl/image_optimization.php:115
777
  msgid "Send Optimization Request"
778
  msgstr ""
779
 
780
+ #: admin/tpl/image_optimization.php:110
781
  msgid "Please press the %s button before sending a new request."
782
  msgstr ""
783
 
784
+ #: admin/tpl/image_optimization.php:112 admin/tpl/image_optimization.php:151
785
+ #: admin/tpl/manage/manage_cdn.php:60
786
+ #: admin/tpl/setting/settings_advanced.php:96
787
+ #: admin/tpl/setting/settings_cache.php:86
788
+ #: admin/tpl/setting/settings_optimize.php:151
789
  msgid "Learn More"
790
  msgstr ""
791
 
792
+ #: admin/tpl/image_optimization.php:118
793
  msgid ""
794
  "This will send the optimization request and the images to LiteSpeed's Image "
795
  "Optimization Server."
796
  msgstr ""
797
 
798
+ #: admin/tpl/image_optimization.php:119
799
  msgid "You can send at most %s images at once."
800
  msgstr ""
801
 
802
+ #: admin/tpl/image_optimization.php:127
803
  msgid "Image groups requested"
804
  msgstr ""
805
 
806
+ #: admin/tpl/image_optimization.php:129
807
  msgid "Image groups failed to optimize"
808
  msgstr ""
809
 
810
+ #: admin/tpl/image_optimization.php:131
811
  msgid ""
812
  "After LiteSpeed's Image Optimization Server finishes optimization, it will "
813
  "notify your site to pull the optimized images."
814
  msgstr ""
815
 
816
+ #: admin/tpl/image_optimization.php:132
817
  msgid "This process is automatic."
818
  msgstr ""
819
 
820
+ #: admin/tpl/image_optimization.php:135
821
  msgid "Image groups notified to pull"
822
  msgstr ""
823
 
824
+ #: admin/tpl/image_optimization.php:138
825
  msgid "Pull Images"
826
  msgstr ""
827
 
828
+ #: admin/tpl/image_optimization.php:141
829
  msgid "Only press the button if the pull cron job is disabled."
830
  msgstr ""
831
 
832
+ #: admin/tpl/image_optimization.php:142
833
  msgid "Images will be pulled automatically if the cron job is running."
834
  msgstr ""
835
 
836
+ #: admin/tpl/image_optimization.php:146
837
  msgid "Last pull initiated by cron at %s."
838
  msgstr ""
839
 
840
+ #: admin/tpl/image_optimization.php:150
841
  msgid "Image groups optimized and pulled"
842
  msgstr ""
843
 
844
+ #: admin/tpl/image_optimization.php:156
845
  msgid "Revert Optimization"
846
  msgstr ""
847
 
848
+ #: admin/tpl/image_optimization.php:159
849
  msgid ""
850
  "Switch all images in the media library back to their original unoptimized "
851
  "versions."
852
  msgstr ""
853
 
854
+ #: admin/tpl/image_optimization.php:165
855
  msgid "Undo Optimization"
856
  msgstr ""
857
 
858
+ #: admin/tpl/image_optimization.php:168
859
  msgid "Revert all optimized images back to their original versions."
860
  msgstr ""
861
 
862
+ #: admin/tpl/image_optimization.php:174
863
  msgid "Re-do Optimization"
864
  msgstr ""
865
 
866
+ #: admin/tpl/image_optimization.php:177
867
  msgid "Switch back to using optimized images."
868
  msgstr ""
869
 
870
+ #: admin/tpl/image_optimization.php:182
871
  msgid "Results can be checked in <a %s>Media Library</a>."
872
  msgstr ""
873
 
874
+ #: admin/tpl/image_optimization.php:186
875
  msgid "Send New Thumbnail Requests"
876
  msgstr ""
877
 
878
+ #: admin/tpl/image_optimization.php:189
879
  msgid ""
880
  "Scan for any new unoptimized image thumbnail sizes and resend necessary "
881
  "image optimization requests."
882
  msgstr ""
883
 
884
+ #: admin/tpl/image_optimization.php:194
885
+ msgid "Reset IAPI Key"
886
+ msgstr ""
887
+
888
+ #: admin/tpl/image_optimization.php:197
889
+ msgid ""
890
+ "The current IAPI key must be reset after changing home URL or domain before "
891
+ "making any further optimization requests."
892
+ msgstr ""
893
+
894
+ #: admin/tpl/image_optimization.php:202
895
  msgid "Destroy All Optimization Data!"
896
  msgstr ""
897
 
898
+ #: admin/tpl/image_optimization.php:205
899
  msgid ""
900
  "Remove all previous image optimization requests/results, revert completed "
901
  "optimizations, and delete all optimization files."
902
  msgstr ""
903
 
904
+ #: admin/tpl/image_optimization.php:207 admin/tpl/setting/settings_cdn.php:94
905
  #: admin/tpl/setting/settings_excludes.php:60
906
  #: admin/tpl/setting/settings_excludes.php:98
907
  #: admin/tpl/setting/settings_inc.cache_browser.php:12
908
+ #: admin/tpl/setting/settings_inc.cache_favicon.php:13
909
+ #: admin/tpl/setting/settings_inc.cache_mobile.php:17
910
+ #: admin/tpl/setting/settings_inc.cache_resources.php:14
911
  #: admin/tpl/setting/settings_inc.exclude_cookies.php:22
912
  #: admin/tpl/setting/settings_inc.exclude_useragent.php:21
913
  #: admin/tpl/setting/settings_inc.media_webp.php:12
917
  msgid "NOTE:"
918
  msgstr ""
919
 
920
+ #: admin/tpl/image_optimization.php:208
921
  msgid ""
922
  "If there are unfinished requests in progress, the requests' credits will NOT "
923
  "be recovered."
924
  msgstr ""
925
 
926
+ #: admin/tpl/image_optimization.php:208
927
  #: admin/tpl/setting/settings_optimize.php:63
928
  #: admin/tpl/setting/settings_optimize.php:138
929
  msgid "JS Combine"
1089
  "dismissed. (<a %3$s>Learn More</a>)"
1090
  msgstr ""
1091
 
1092
+ #: admin/tpl/manage/manage_cdn.php:11
1093
+ msgid "Cloudflare"
1094
+ msgstr ""
1095
+
1096
+ #: admin/tpl/manage/manage_cdn.php:17
1097
+ msgid ""
1098
+ "Please go to Settings to turn Cloudflare API on before use the following "
1099
+ "functionalities."
1100
+ msgstr ""
1101
+
1102
+ #: admin/tpl/manage/manage_cdn.php:22
1103
+ msgid "Cloudflare Domain"
1104
+ msgstr ""
1105
+
1106
+ #: admin/tpl/manage/manage_cdn.php:23
1107
+ msgid "Cloudflare Zone"
1108
+ msgstr ""
1109
+
1110
+ #: admin/tpl/manage/manage_cdn.php:26
1111
+ msgid "Development Mode"
1112
+ msgstr ""
1113
+
1114
+ #: admin/tpl/manage/manage_cdn.php:28
1115
+ msgid "Turn ON"
1116
+ msgstr ""
1117
+
1118
+ #: admin/tpl/manage/manage_cdn.php:31
1119
+ msgid "Turn OFF"
1120
+ msgstr ""
1121
+
1122
+ #: admin/tpl/manage/manage_cdn.php:34
1123
+ msgid "Check Status"
1124
+ msgstr ""
1125
+
1126
+ #: admin/tpl/manage/manage_cdn.php:43
1127
+ msgid "Current status is %1$s since %2$s."
1128
+ msgstr ""
1129
+
1130
+ #: admin/tpl/manage/manage_cdn.php:49
1131
+ msgid "Current status is %s."
1132
+ msgstr ""
1133
+
1134
+ #: admin/tpl/manage/manage_cdn.php:50
1135
+ msgid "Development mode will be automatically turned off in %s."
1136
+ msgstr ""
1137
+
1138
+ #: admin/tpl/manage/manage_cdn.php:58
1139
+ msgid ""
1140
+ "Temporarily bypass Cloudflare cache. This allows changes to the origin "
1141
+ "server to be seen in realtime."
1142
+ msgstr ""
1143
+
1144
+ #: admin/tpl/manage/manage_cdn.php:59
1145
+ msgid "Development Mode will be turned off automatically after three hours."
1146
+ msgstr ""
1147
+
1148
+ #: admin/tpl/manage/manage_cdn.php:65
1149
+ msgid "Cloudflare Cache"
1150
+ msgstr ""
1151
+
1152
+ #: admin/tpl/manage/manage_cdn.php:71
1153
+ msgid "Purge Everything"
1154
+ msgstr ""
1155
+
1156
  #: admin/tpl/manage/manage_db.php:6
1157
  msgid "Clean All"
1158
  msgstr ""
1346
 
1347
  #: admin/tpl/manage/manage_purge.php:105
1348
  #: admin/tpl/setting/settings_cache.php:67
1349
+ #: admin/tpl/setting/settings_cache.php:90
1350
+ #: admin/tpl/setting/settings_cdn.php:113
1351
+ #: admin/tpl/setting/settings_cdn.php:139
1352
  #: admin/tpl/setting/settings_excludes.php:19
1353
  #: admin/tpl/setting/settings_excludes.php:33
1354
  #: admin/tpl/setting/settings_excludes.php:56
1355
  #: admin/tpl/setting/settings_excludes.php:94
1356
  #: admin/tpl/setting/settings_inc.exclude_cookies.php:19
1357
+ #: admin/tpl/setting/settings_media.php:31
1358
+ #: admin/tpl/setting/settings_optimize.php:152
1359
  #: admin/tpl/setting/settings_purge.php:79
1360
  #: admin/tpl/setting/settings_tuning.php:36
1361
  #: admin/tpl/setting/settings_tuning.php:72
1362
+ #: admin/tpl/setting/settings_tuning.php:144
1363
+ #: admin/tpl/setting/settings_tuning.php:173
1364
  msgid "One per line."
1365
  msgstr ""
1366
 
1409
  msgid "DB Optimizer"
1410
  msgstr ""
1411
 
1412
+ #: admin/tpl/manage.php:12 admin/tpl/setting/settings_cdn.php:178
1413
+ #: admin/tpl/settings.php:14
1414
+ msgid "CDN"
1415
+ msgstr ""
1416
+
1417
+ #: admin/tpl/manage.php:22
1418
  msgid "LiteSpeed Cache Network Management"
1419
  msgstr ""
1420
 
1421
+ #: admin/tpl/manage.php:25
1422
  msgid "LiteSpeed Cache Management"
1423
  msgstr ""
1424
 
1435
  msgid "Excludes"
1436
  msgstr ""
1437
 
1438
+ #: admin/tpl/network_settings.php:9 admin/tpl/setting/settings_advanced.php:7
1439
+ #: admin/tpl/setting/settings_debug.php:65 admin/tpl/settings.php:20
1440
  msgid "Advanced"
1441
  msgstr ""
1442
 
1558
  msgid "Purge Network Settings"
1559
  msgstr ""
1560
 
1561
+ #: admin/tpl/setting/settings_advanced.php:10
1562
  msgid "NOTICE:"
1563
  msgstr ""
1564
 
1565
+ #: admin/tpl/setting/settings_advanced.php:11
1566
  msgid "These settings are meant for ADVANCED USERS ONLY."
1567
  msgstr ""
1568
 
1569
+ #: admin/tpl/setting/settings_advanced.php:16
 
 
 
 
 
 
 
 
1570
  msgid "Check Advanced Cache"
1571
  msgstr ""
1572
 
1573
+ #: admin/tpl/setting/settings_advanced.php:20
1574
  msgid "Include advanced-cache.php"
1575
  msgstr ""
1576
 
1577
+ #: admin/tpl/setting/settings_advanced.php:23
1578
  msgid ""
1579
  "The advanced-cache.php file is used by many caching plugins to signal that a "
1580
  "cache is active."
1581
  msgstr ""
1582
 
1583
+ #: admin/tpl/setting/settings_advanced.php:24
1584
  msgid ""
1585
  "When this option is checked and this file is detected as belonging to "
1586
  "another plugin, LiteSpeed Cache will not cache."
1587
  msgstr ""
1588
 
1589
+ #: admin/tpl/setting/settings_advanced.php:27
1590
  msgid ""
1591
  "Uncheck this option only if the other plugin is used for non-caching "
1592
  "purposes, such as minifying css/js files."
1593
  msgstr ""
1594
 
1595
+ #: admin/tpl/setting/settings_advanced.php:34
1596
  msgid "Login Cookie"
1597
  msgstr ""
1598
 
1599
+ #: admin/tpl/setting/settings_advanced.php:40
1600
  msgid "SYNTAX: alphanumeric and \"_\"."
1601
  msgstr ""
1602
 
1603
+ #: admin/tpl/setting/settings_advanced.php:41
1604
  msgid "No spaces and case sensitive."
1605
  msgstr ""
1606
 
1607
+ #: admin/tpl/setting/settings_advanced.php:42
1608
  msgid "MUST BE UNIQUE FROM OTHER WEB APPLICATIONS."
1609
  msgstr ""
1610
 
1611
+ #: admin/tpl/setting/settings_advanced.php:45
1612
  msgid "The default login cookie is %s."
1613
  msgstr ""
1614
 
1615
+ #: admin/tpl/setting/settings_advanced.php:46
1616
  msgid ""
1617
  "The server will determine if the user is logged in based on the existance of "
1618
  "this cookie."
1619
  msgstr ""
1620
 
1621
+ #: admin/tpl/setting/settings_advanced.php:47
1622
  msgid ""
1623
  "This setting is useful for those that have multiple web applications for the "
1624
  "same domain."
1625
  msgstr ""
1626
 
1627
+ #: admin/tpl/setting/settings_advanced.php:48
1628
  msgid ""
1629
  "If every web application uses the same cookie, the server may confuse "
1630
  "whether a user is logged in or not."
1631
  msgstr ""
1632
 
1633
+ #: admin/tpl/setting/settings_advanced.php:49
1634
  msgid "The cookie set here will be used for this WordPress installation."
1635
  msgstr ""
1636
 
1637
+ #: admin/tpl/setting/settings_advanced.php:52
1638
  msgid "Example use case:"
1639
  msgstr ""
1640
 
1641
+ #: admin/tpl/setting/settings_advanced.php:54
1642
  msgid "There is a WordPress installed for %s."
1643
  msgstr ""
1644
 
1645
+ #: admin/tpl/setting/settings_advanced.php:56
1646
  msgid "Then another WordPress is installed (NOT MULTISITE) at %s"
1647
  msgstr ""
1648
 
1649
+ #: admin/tpl/setting/settings_advanced.php:57
1650
  msgid ""
1651
  "The cache needs to distinguish who is logged into which WordPress site in "
1652
  "order to cache correctly."
1653
  msgstr ""
1654
 
1655
+ #: admin/tpl/setting/settings_advanced.php:63
1656
  msgid "Error: invalid login cookie. Please check the %s file"
1657
  msgstr ""
1658
 
1659
+ #: admin/tpl/setting/settings_advanced.php:71
1660
  msgid "Error getting current rules from %s: %s"
1661
  msgstr ""
1662
 
1663
+ #: admin/tpl/setting/settings_advanced.php:79
1664
  msgid ""
1665
  "WARNING: The .htaccess login cookie and Database login cookie do not match."
1666
  msgstr ""
1667
 
1668
+ #: admin/tpl/setting/settings_advanced.php:91
1669
+ msgid "Improve HTTP/HTTPS Compatibility"
1670
+ msgstr ""
1671
+
1672
+ #: admin/tpl/setting/settings_advanced.php:95
1673
+ msgid ""
1674
+ "Enable this option if you are using both HTTP and HTTPS in the same domain "
1675
+ "and are noticing cache irregularities."
1676
+ msgstr ""
1677
+
1678
  #: admin/tpl/setting/settings_cache.php:4
1679
  msgid "Cache Control Settings"
1680
  msgstr ""
1728
 
1729
  #: admin/tpl/setting/settings_cache.php:62
1730
  #: admin/tpl/setting/settings_excludes.php:14
1731
+ #: admin/tpl/setting/settings_tuning.php:172
1732
  msgid "For example, for %s, %s can be used here."
1733
  msgstr ""
1734
 
1742
  msgid "To do an exact match, add %s to the end of the URL."
1743
  msgstr ""
1744
 
1745
+ #: admin/tpl/setting/settings_cache.php:80
1746
+ msgid "Drop Query String"
1747
+ msgstr ""
1748
+
1749
+ #: admin/tpl/setting/settings_cache.php:84
1750
+ msgid "Ignore certain query strings when caching."
1751
+ msgstr ""
1752
+
1753
+ #: admin/tpl/setting/settings_cache.php:85
1754
+ msgid "For example, to drop parameters beginning with %s, %s can be used here."
1755
+ msgstr ""
1756
+
1757
+ #: admin/tpl/setting/settings_cdn.php:23
1758
  msgid "CDN Settings"
1759
  msgstr ""
1760
 
1761
+ #: admin/tpl/setting/settings_cdn.php:27
1762
  msgid "Enable CDN"
1763
  msgstr ""
1764
 
1765
+ #: admin/tpl/setting/settings_cdn.php:31
1766
  msgid "Enable Content Delivery Network use."
1767
  msgstr ""
1768
 
1769
+ #: admin/tpl/setting/settings_cdn.php:37
1770
+ msgid "CDN Mapping"
1771
+ msgstr ""
1772
+
1773
+ #: admin/tpl/setting/settings_cdn.php:43
1774
  msgid "CDN URL"
1775
  msgstr ""
1776
 
1777
+ #: admin/tpl/setting/settings_cdn.php:52
1778
  msgid "CDN URL to be used. For example, %s"
1779
  msgstr ""
1780
 
1781
+ #: admin/tpl/setting/settings_cdn.php:58 admin/tpl/setting/settings_cdn.php:99
1782
+ msgid "Include Images"
1783
  msgstr ""
1784
 
1785
+ #: admin/tpl/setting/settings_cdn.php:65
1786
+ #: admin/tpl/setting/settings_cdn.php:103
1787
+ msgid "Include CSS"
 
1788
  msgstr ""
1789
 
1790
+ #: admin/tpl/setting/settings_cdn.php:72
1791
+ #: admin/tpl/setting/settings_cdn.php:107
1792
+ msgid "Include JS"
 
1793
  msgstr ""
1794
 
1795
+ #: admin/tpl/setting/settings_cdn.php:82
1796
+ #: admin/tpl/setting/settings_cdn.php:111
1797
+ msgid "Include File Types"
1798
  msgstr ""
1799
 
1800
+ #: admin/tpl/setting/settings_cdn.php:95
1801
  msgid ""
1802
+ "If multiple CDN paths are configured with the same settings, the last one "
1803
+ "will override the others."
1804
  msgstr ""
1805
 
1806
+ #: admin/tpl/setting/settings_cdn.php:100
1807
+ msgid ""
1808
+ "Serve all image files through the CDN. This will affect all attachments, "
1809
+ "HTML %s tags, and CSS %s attributes."
1810
  msgstr ""
1811
 
1812
+ #: admin/tpl/setting/settings_cdn.php:104
1813
  msgid ""
1814
  "Serve all CSS files through the CDN. This will affect all enqueued WP CSS "
1815
  "files."
1816
  msgstr ""
1817
 
1818
+ #: admin/tpl/setting/settings_cdn.php:108
 
 
 
 
1819
  msgid ""
1820
  "Serve all JavaScript files through the CDN. This will affect all enqueued WP "
1821
  "JavaScript files."
1822
  msgstr ""
1823
 
1824
+ #: admin/tpl/setting/settings_cdn.php:112
1825
+ msgid "Static file type links to be replaced by CDN links."
1826
  msgstr ""
1827
 
1828
+ #: admin/tpl/setting/settings_cdn.php:114
1829
+ msgid "This will affect all tags containing attributes: %s %s %s."
1830
  msgstr ""
1831
 
1832
+ #: admin/tpl/setting/settings_cdn.php:115
1833
+ msgid "Default value"
1834
  msgstr ""
1835
 
1836
+ #: admin/tpl/setting/settings_cdn.php:122
1837
+ msgid "Original URL"
1838
+ msgstr ""
1839
+
1840
+ #: admin/tpl/setting/settings_cdn.php:126
1841
+ msgid ""
1842
+ "Site URL to be served through the CDN. Beginning with %1$s. For example, "
1843
+ "%2$s."
1844
+ msgstr ""
1845
+
1846
+ #: admin/tpl/setting/settings_cdn.php:127
1847
+ msgid ""
1848
+ "Wildcard %1$s supported (match zero or more characters). For example, to "
1849
+ "match %2$s and %3$s, use %4$s."
1850
+ msgstr ""
1851
+
1852
+ #: admin/tpl/setting/settings_cdn.php:133
1853
  msgid "Exclude Path"
1854
  msgstr ""
1855
 
1856
+ #: admin/tpl/setting/settings_cdn.php:138
1857
  msgid "Paths containing these strings will not be served from the CDN."
1858
  msgstr ""
1859
 
1860
+ #: admin/tpl/setting/settings_cdn.php:145
1861
  msgid "Load JQuery Remotely"
1862
  msgstr ""
1863
 
1864
+ #: admin/tpl/setting/settings_cdn.php:151
1865
  #: admin/tpl/setting/settings_debug.php:16
1866
  msgid "Off"
1867
  msgstr ""
1868
 
1869
+ #: admin/tpl/setting/settings_cdn.php:157
1870
  msgid "Google"
1871
  msgstr ""
1872
 
1873
+ #: admin/tpl/setting/settings_cdn.php:163
1874
+ msgid "Cdnjs"
1875
  msgstr ""
1876
 
1877
+ #: admin/tpl/setting/settings_cdn.php:167
1878
  msgid ""
1879
  "Improve page load time by loading jQuery from a remote CDN service instead "
1880
  "of locally."
1881
  msgstr ""
1882
 
1883
+ #: admin/tpl/setting/settings_cdn.php:173
1884
+ msgid "Cloudflare API"
1885
+ msgstr ""
1886
+
1887
+ #: admin/tpl/setting/settings_cdn.php:177
1888
+ msgid "Use Cloudflare API functionality."
1889
+ msgstr ""
1890
+
1891
+ #: admin/tpl/setting/settings_cdn.php:178
1892
+ msgid "This can be managed from <a %2$s>%1$s</a>."
1893
+ msgstr ""
1894
+
1895
+ #: admin/tpl/setting/settings_cdn.php:182
1896
+ msgid "Email Address"
1897
+ msgstr ""
1898
+
1899
+ #: admin/tpl/setting/settings_cdn.php:186
1900
+ msgid "Your Email address on Cloudflare."
1901
+ msgstr ""
1902
+
1903
+ #: admin/tpl/setting/settings_cdn.php:191
1904
+ msgid "Global API Key"
1905
+ msgstr ""
1906
+
1907
+ #: admin/tpl/setting/settings_cdn.php:195
1908
+ msgid "Your API key is used to access Cloudflare APIs."
1909
+ msgstr ""
1910
+
1911
+ #: admin/tpl/setting/settings_cdn.php:196
1912
+ msgid "Get it from <a %s>Cloudflare account</a>."
1913
+ msgstr ""
1914
+
1915
+ #: admin/tpl/setting/settings_cdn.php:201
1916
+ msgid "Domain"
1917
+ msgstr ""
1918
+
1919
+ #: admin/tpl/setting/settings_cdn.php:209
1920
+ msgid "You can just type part of the domain."
1921
+ msgstr ""
1922
+
1923
+ #: admin/tpl/setting/settings_cdn.php:210
1924
+ msgid ""
1925
+ "Once saved, it will be matched with the current list and completed "
1926
+ "automatically."
1927
+ msgstr ""
1928
+
1929
  #: admin/tpl/setting/settings_compatibilities.php:7
1930
  msgid "Compatibility with WP-PostViews"
1931
  msgstr ""
2164
  msgstr ""
2165
 
2166
  #: admin/tpl/setting/settings_debug.php:78
2167
+ #: admin/tpl/setting/settings_tuning.php:86
2168
  msgid "MB"
2169
  msgstr ""
2170
 
2482
  msgstr ""
2483
 
2484
  #: admin/tpl/setting/settings_inc.cache_browser.php:13
2485
+ #: admin/tpl/setting/settings_inc.cache_favicon.php:14
2486
+ #: admin/tpl/setting/settings_inc.cache_mobile.php:18
2487
+ #: admin/tpl/setting/settings_inc.cache_resources.php:15
2488
  #: admin/tpl/setting/settings_inc.exclude_cookies.php:23
2489
  #: admin/tpl/setting/settings_inc.exclude_useragent.php:22
2490
  #: admin/tpl/setting/settings_inc.media_webp.php:13
2507
  "before expiring. Minimum is %s seconds."
2508
  msgstr ""
2509
 
2510
+ #: admin/tpl/setting/settings_inc.cache_favicon.php:6
2511
  msgid "Cache favicon.ico"
2512
  msgstr ""
2513
 
2514
+ #: admin/tpl/setting/settings_inc.cache_favicon.php:10
2515
  msgid "favicon.ico is requested on most pages."
2516
  msgstr ""
2517
 
2518
+ #: admin/tpl/setting/settings_inc.cache_favicon.php:11
2519
  msgid ""
2520
  "Caching this resource may improve server performance by avoiding unnecessary "
2521
  "PHP calls."
2525
  msgid "Cache Mobile"
2526
  msgstr ""
2527
 
2528
+ #: admin/tpl/setting/settings_inc.cache_mobile.php:14
2529
  msgid "When enabled, mobile views will be cached separately."
2530
  msgstr ""
2531
 
2532
+ #: admin/tpl/setting/settings_inc.cache_mobile.php:15
2533
  msgid "A site built with responsive design does not need to check this."
2534
  msgstr ""
2535
 
2536
+ #: admin/tpl/setting/settings_inc.cache_mobile.php:25
2537
  msgid "List of Mobile User Agents"
2538
  msgstr ""
2539
 
2540
+ #: admin/tpl/setting/settings_inc.cache_mobile.php:42
2541
  msgid "Htaccess did not match configuration option."
2542
  msgstr ""
2543
 
2544
+ #: admin/tpl/setting/settings_inc.cache_mobile.php:43
2545
  msgid "Please re-enter the mobile view setting."
2546
  msgstr ""
2547
 
2548
+ #: admin/tpl/setting/settings_inc.cache_mobile.php:44
2549
  msgid "List in WordPress database is: %s"
2550
  msgstr ""
2551
 
2552
+ #: admin/tpl/setting/settings_inc.cache_mobile.php:60
2553
  msgid "SYNTAX: Each entry should be separated with a bar, %s."
2554
  msgstr ""
2555
 
2556
+ #: admin/tpl/setting/settings_inc.cache_mobile.php:61
2557
  msgid "Any spaces should be escaped with a backslash before the space, %s."
2558
  msgstr ""
2559
 
2560
+ #: admin/tpl/setting/settings_inc.cache_mobile.php:64
2561
  msgid "The default list WordPress uses is %s"
2562
  msgstr ""
2563
 
2564
+ #: admin/tpl/setting/settings_inc.cache_resources.php:7
2565
  msgid "Cache PHP Resources"
2566
  msgstr ""
2567
 
2568
+ #: admin/tpl/setting/settings_inc.cache_resources.php:11
2569
  msgid "Some themes and plugins add resources via a PHP request."
2570
  msgstr ""
2571
 
2572
+ #: admin/tpl/setting/settings_inc.cache_resources.php:12
2573
  msgid ""
2574
  "Caching these pages may improve server performance by avoiding unnecessary "
2575
  "PHP calls."
2633
  msgstr ""
2634
 
2635
  #: admin/tpl/setting/settings_media.php:15
2636
+ #: admin/tpl/setting/settings_media.php:60
2637
  msgid "This can improve page loading time by reducing initial HTTP requests."
2638
  msgstr ""
2639
 
2640
+ #: admin/tpl/setting/settings_media.php:17
2641
+ msgid "Tip"
2642
+ msgstr ""
2643
+
2644
+ #: admin/tpl/setting/settings_media.php:18
2645
+ msgid "Adding Style to Your Lazy-Loaded Images"
2646
  msgstr ""
2647
 
2648
  #: admin/tpl/setting/settings_media.php:25
2649
+ msgid "Lazy Load Image Excludes"
2650
+ msgstr ""
2651
+
2652
+ #: admin/tpl/setting/settings_media.php:29
2653
  msgid "Listed images will not be lazy loaded."
2654
  msgstr ""
2655
 
2656
+ #: admin/tpl/setting/settings_media.php:30
2657
  #: admin/tpl/setting/settings_tuning.php:35
2658
  #: admin/tpl/setting/settings_tuning.php:71
2659
+ #: admin/tpl/setting/settings_tuning.php:143
2660
+ #: admin/tpl/setting/settings_tuning.php:171
2661
  msgid "Both full URLs and partial strings can be used."
2662
  msgstr ""
2663
 
2664
+ #: admin/tpl/setting/settings_media.php:33
2665
  #: admin/tpl/setting/settings_optimize.php:112
2666
  #: admin/tpl/setting/settings_tuning.php:22
2667
  #: admin/tpl/setting/settings_tuning.php:38
2668
  #: admin/tpl/setting/settings_tuning.php:58
2669
  #: admin/tpl/setting/settings_tuning.php:74
2670
+ #: admin/tpl/setting/settings_tuning.php:146
2671
  msgid "API:"
2672
  msgstr ""
2673
 
2674
+ #: admin/tpl/setting/settings_media.php:34
2675
  #: admin/tpl/setting/settings_tuning.php:39
2676
  #: admin/tpl/setting/settings_tuning.php:75
2677
+ #: admin/tpl/setting/settings_tuning.php:147
2678
  msgid "Filter %s is supported."
2679
  msgstr ""
2680
 
2681
+ #: admin/tpl/setting/settings_media.php:35
2682
  #: admin/tpl/setting/settings_optimize.php:113
2683
  #: admin/tpl/setting/settings_tuning.php:40
2684
  #: admin/tpl/setting/settings_tuning.php:76
2685
+ #: admin/tpl/setting/settings_tuning.php:148
2686
  msgid "Elements with attribute %s in html code will be excluded."
2687
  msgstr ""
2688
 
2689
+ #: admin/tpl/setting/settings_media.php:42
2690
  msgid "Lazy Load Image Placeholder"
2691
  msgstr ""
2692
 
2693
+ #: admin/tpl/setting/settings_media.php:46
2694
  msgid ""
2695
  "Specify a base64 image to be used as a placeholder while other images finish "
2696
  "loading."
2697
  msgstr ""
2698
 
2699
+ #: admin/tpl/setting/settings_media.php:47
2700
  msgid ""
2701
  "This can be predefined in %2$s as well using constant %1$s, with this "
2702
  "setting taking priority."
2703
  msgstr ""
2704
 
2705
+ #: admin/tpl/setting/settings_media.php:48
2706
  msgid "By default a gray image placeholder %s will be used."
2707
  msgstr ""
2708
 
2709
+ #: admin/tpl/setting/settings_media.php:49
2710
  msgid "For example, %s can be used for a transparent placeholder."
2711
  msgstr ""
2712
 
2713
+ #: admin/tpl/setting/settings_media.php:55
2714
  msgid "Lazy Load Iframes"
2715
  msgstr ""
2716
 
2717
+ #: admin/tpl/setting/settings_media.php:59
2718
  msgid "Load iframes only when they enter the viewport."
2719
  msgstr ""
2720
 
2721
+ #: admin/tpl/setting/settings_media.php:66
2722
  msgid "Disable Optimization Pull"
2723
  msgstr ""
2724
 
2725
+ #: admin/tpl/setting/settings_media.php:70
2726
  msgid ""
2727
  "Set this option to %s to disable the cron job responsible for fetching "
2728
  "optimized images from LiteSpeed's Image Server."
2729
  msgstr ""
2730
 
2731
+ #: admin/tpl/setting/settings_media.php:84
2732
  msgid "Only Request WebP"
2733
  msgstr ""
2734
 
2735
+ #: admin/tpl/setting/settings_media.php:88
2736
  msgid ""
2737
  "Prevent images from being replaced with optimized versions when optimizing. "
2738
  "WebP versions will still be generated."
2739
  msgstr ""
2740
 
2741
+ #: admin/tpl/setting/settings_media.php:94
2742
  msgid "Preserve EXIF data"
2743
  msgstr ""
2744
 
2745
+ #: admin/tpl/setting/settings_media.php:98
2746
  msgid ""
2747
  "Preserve EXIF data (copyright, GPS, comments, keywords, etc) when optimizing."
2748
  msgstr ""
2749
 
2750
+ #: admin/tpl/setting/settings_media.php:99
2751
  msgid "This will increase the size of optimized files."
2752
  msgstr ""
2753
 
2754
+ #: admin/tpl/setting/settings_media.php:105
2755
  msgid "WebP Lossless Compression"
2756
  msgstr ""
2757
 
2758
+ #: admin/tpl/setting/settings_media.php:109
2759
  msgid "Generate WebP images using lossless compression."
2760
  msgstr ""
2761
 
2762
+ #: admin/tpl/setting/settings_media.php:110
2763
  msgid "This can improve quality at the cost of larger images."
2764
  msgstr ""
2765
 
2846
  msgstr ""
2847
 
2848
  #: admin/tpl/setting/settings_optimize.php:105
2849
+ #: admin/tpl/setting/settings_tuning.php:132
2850
  msgid "Load CSS Asynchronously"
2851
  msgstr ""
2852
 
2856
 
2857
  #: admin/tpl/setting/settings_optimize.php:110
2858
  #: admin/tpl/setting/settings_optimize.php:125
2859
+ #: admin/tpl/setting/settings_optimize.php:163
2860
+ #: admin/tpl/setting/settings_tuning.php:101
2861
+ #: admin/tpl/setting/settings_tuning.php:160
2862
  msgid ""
2863
  "This can improve your speed score in services like Pingdom, GTmetrix and "
2864
  "PageSpeed."
2888
  "option."
2889
  msgstr ""
2890
 
2891
+ #: admin/tpl/setting/settings_optimize.php:145
2892
+ msgid "DNS Prefetch"
2893
+ msgstr ""
2894
+
2895
+ #: admin/tpl/setting/settings_optimize.php:149
2896
+ msgid "Prefetching DNS can reduce latency for visiters."
2897
+ msgstr ""
2898
+
2899
+ #: admin/tpl/setting/settings_optimize.php:150
2900
+ msgid "For example"
2901
+ msgstr ""
2902
+
2903
+ #: admin/tpl/setting/settings_optimize.php:158
2904
+ msgid "Remove Comments"
2905
+ msgstr ""
2906
+
2907
+ #: admin/tpl/setting/settings_optimize.php:162
2908
+ msgid "Remove the comments inside of JS/CSS files when minifying."
2909
+ msgstr ""
2910
+
2911
  #: admin/tpl/setting/settings_purge.php:5
2912
  msgid "Purge Settings"
2913
  msgstr ""
2961
  msgstr ""
2962
 
2963
  #: admin/tpl/setting/settings_purge.php:47
2964
+ #: thirdparty/lscwp-3rd-woocommerce.cls.php:858
2965
  msgid "Note:"
2966
  msgstr ""
2967
 
3080
  msgstr ""
3081
 
3082
  #: admin/tpl/setting/settings_tuning.php:83
3083
+ msgid "Max Combined File Size"
3084
+ msgstr ""
3085
+
3086
+ #: admin/tpl/setting/settings_tuning.php:88
3087
+ msgid "Specify the maximum size in megabytes for combined files."
3088
+ msgstr ""
3089
+
3090
+ #: admin/tpl/setting/settings_tuning.php:89
3091
+ msgid ""
3092
+ "Larger numbers will generate fewer files, which is better for achieving "
3093
+ "higher page scores, but can cause heavy memory usage."
3094
+ msgstr ""
3095
+
3096
+ #: admin/tpl/setting/settings_tuning.php:96
3097
  msgid "Remove Query Strings"
3098
  msgstr ""
3099
 
3100
+ #: admin/tpl/setting/settings_tuning.php:100
3101
  msgid "Remove query strings from static resources."
3102
  msgstr ""
3103
 
3104
+ #: admin/tpl/setting/settings_tuning.php:107
3105
  msgid "Load Google Fonts Asynchronously"
3106
  msgstr ""
3107
 
3108
+ #: admin/tpl/setting/settings_tuning.php:111
3109
  msgid ""
3110
  "This is useful if you only want to load Google Fonts asynchronously while "
3111
  "leave other CSS intact."
3112
  msgstr ""
3113
 
3114
+ #: admin/tpl/setting/settings_tuning.php:112
3115
  msgid ""
3116
  "This will also add a preconnect to Google for faster Google Fonts "
3117
  "downloading."
3118
  msgstr ""
3119
 
3120
+ #: admin/tpl/setting/settings_tuning.php:118
3121
  msgid "Remove Google Fonts"
3122
  msgstr ""
3123
 
3124
+ #: admin/tpl/setting/settings_tuning.php:122
3125
  msgid "Prevent google fonts from loading on all your pages."
3126
  msgstr ""
3127
 
3128
+ #: admin/tpl/setting/settings_tuning.php:128
3129
  msgid "Critical CSS Rules"
3130
  msgstr ""
3131
 
3132
+ #: admin/tpl/setting/settings_tuning.php:132
3133
  msgid "Specify critical CSS rules for above-the-fold content when enabling %s."
3134
  msgstr ""
3135
 
3136
+ #: admin/tpl/setting/settings_tuning.php:138
3137
  msgid "JS Deferred Excludes"
3138
  msgstr ""
3139
 
3140
+ #: admin/tpl/setting/settings_tuning.php:142
3141
  msgid "Listed JS files will not be deferred."
3142
  msgstr ""
3143
 
3144
+ #: admin/tpl/setting/settings_tuning.php:155
3145
  msgid "Remove WordPress Emoji"
3146
  msgstr ""
3147
 
3148
+ #: admin/tpl/setting/settings_tuning.php:159
3149
  msgid ""
3150
  "Stop loading wordpress.org emoji. Browser default emoji will be displayed "
3151
  "instead."
3152
  msgstr ""
3153
 
3154
+ #: admin/tpl/setting/settings_tuning.php:166
3155
  msgid "URI Excludes"
3156
  msgstr ""
3157
 
3158
+ #: admin/tpl/setting/settings_tuning.php:170
3159
  msgid "Prevent any optimization of listed pages."
3160
  msgstr ""
3161
 
3162
+ #: admin/tpl/setting/settings_tuning.php:179
3163
  msgid "Role Excludes"
3164
  msgstr ""
3165
 
3166
+ #: admin/tpl/setting/settings_tuning.php:185
3167
  msgid "Selected roles will be excluded from all optimizations."
3168
  msgstr ""
3169
 
3175
  msgid "Tuning"
3176
  msgstr ""
3177
 
 
 
 
 
3178
  #: admin/tpl/settings.php:17
3179
  msgid "ESI"
3180
  msgstr ""
3229
  msgid "Purged the tags!"
3230
  msgstr ""
3231
 
3232
+ #: inc/cdn.class.php:615 includes/litespeed-cache-cdn.class.php:615
3233
+ msgid "Notified Cloudflare to set development mode to %s successfully."
3234
+ msgstr ""
3235
+
3236
+ #: inc/cdn.class.php:633 includes/litespeed-cache-cdn.class.php:633
3237
+ msgid "Cloudflare API is set to off."
3238
+ msgstr ""
3239
+
3240
+ #: inc/cdn.class.php:649 includes/litespeed-cache-cdn.class.php:649
3241
+ msgid "Notified Cloudflare to purge all successfully."
3242
+ msgstr ""
3243
+
3244
+ #: inc/cdn.class.php:664 includes/litespeed-cache-cdn.class.php:664
3245
+ msgid "No available Cloudflare zone"
3246
+ msgstr ""
3247
+
3248
+ #: inc/cdn.class.php:743 includes/litespeed-cache-cdn.class.php:743
3249
+ msgid "Communicated with Cloudflare successfully."
3250
+ msgstr ""
3251
+
3252
+ #: inc/cdn.class.php:752 includes/litespeed-cache-cdn.class.php:752
3253
+ msgid "Failed to communicate with Cloudflare"
3254
+ msgstr ""
3255
+
3256
  #: inc/crawler.class.php:109 includes/litespeed-cache-crawler.class.php:109
3257
  msgid "Can not find any form data for blacklist"
3258
  msgstr ""
3278
  msgid "Reached end of sitemap file. Crawling completed."
3279
  msgstr ""
3280
 
3281
+ #: inc/gui.class.php:187 includes/litespeed-cache-gui.class.php:187
3282
  msgid "Purge this page"
3283
  msgstr ""
3284
 
3285
+ #: inc/gui.class.php:195 includes/litespeed-cache-gui.class.php:195
3286
  msgid "Mark this page as "
3287
  msgstr ""
3288
 
3289
+ #: inc/gui.class.php:202 includes/litespeed-cache-gui.class.php:202
3290
  msgid "Non cacheable"
3291
  msgstr ""
3292
 
3293
+ #: inc/gui.class.php:209 includes/litespeed-cache-gui.class.php:209
3294
  msgid "Private cache"
3295
  msgstr ""
3296
 
3297
+ #: inc/gui.class.php:216 includes/litespeed-cache-gui.class.php:216
3298
  msgid "No optimization"
3299
  msgstr ""
3300
 
3301
+ #: inc/gui.class.php:223 includes/litespeed-cache-gui.class.php:223
3302
  msgid "More settings"
3303
  msgstr ""
3304
 
3305
+ #: inc/gui.class.php:242 includes/litespeed-cache-gui.class.php:242
3306
+ msgid "LiteSpeed Cache Purge All"
3307
+ msgstr ""
3308
+
3309
+ #: inc/gui.class.php:277 includes/litespeed-cache-gui.class.php:277
3310
+ msgid "Cloudflare Purge All"
3311
+ msgstr ""
3312
+
3313
+ #: inc/litespeed-cache.class.php:241 includes/litespeed-cache.class.php:241
3314
  msgid "Crawler blacklist is saved."
3315
  msgstr ""
3316
 
3317
+ #: inc/litespeed-cache.class.php:246 includes/litespeed-cache.class.php:246
3318
  msgid "Notified LiteSpeed Web Server to purge the front page."
3319
  msgstr ""
3320
 
3321
+ #: inc/litespeed-cache.class.php:251 includes/litespeed-cache.class.php:251
3322
  msgid "Notified LiteSpeed Web Server to purge pages."
3323
  msgstr ""
3324
 
3325
+ #: inc/litespeed-cache.class.php:256 includes/litespeed-cache.class.php:256
3326
  msgid "Notified LiteSpeed Web Server to purge CSS/JS entries."
3327
  msgstr ""
3328
 
3329
+ #: inc/litespeed-cache.class.php:261 includes/litespeed-cache.class.php:261
3330
  msgid "Notified LiteSpeed Web Server to purge error pages."
3331
  msgstr ""
3332
 
3333
+ #: inc/litespeed-cache.class.php:267 includes/litespeed-cache.class.php:267
3334
  msgid "Notified LiteSpeed Web Server to purge all caches."
3335
  msgstr ""
3336
 
3337
+ #: inc/litespeed-cache.class.php:274 includes/litespeed-cache.class.php:274
3338
  msgid "Notified LiteSpeed Web Server to purge everything."
3339
  msgstr ""
3340
 
3341
+ #: inc/litespeed-cache.class.php:289 includes/litespeed-cache.class.php:289
3342
  msgid "Notified LiteSpeed Web Server to purge the list."
3343
  msgstr ""
3344
 
3386
  msgid "Switched to optimized file successfully."
3387
  msgstr ""
3388
 
3389
+ #: inc/media.class.php:435
3390
  msgid "Failed to communicate with LiteSpeed IAPI server"
3391
  msgstr ""
3392
 
3393
+ #: inc/media.class.php:444
3394
  msgid "Communicated with LiteSpeed Image Optimization Server successfully."
3395
  msgstr ""
3396
 
3397
+ #: inc/media.class.php:1000
3398
  msgid "Failed to push to LiteSpeed IAPI server: %s"
3399
  msgstr ""
3400
 
3401
+ #: inc/media.class.php:1008
3402
  msgid "Failed to parse data from LiteSpeed IAPI server: %s"
3403
  msgstr ""
3404
 
3405
+ #: inc/media.class.php:1126 inc/media.class.php:1191 inc/media.class.php:1324
 
 
 
 
3406
  msgid "No image found."
3407
  msgstr ""
3408
 
3409
+ #: inc/media.class.php:1231 inc/media.class.php:1385
3410
  msgid ""
3411
  "Pushed %1$s groups with %2$s images to LiteSpeed optimization server, "
3412
  "accepted %3$s groups with %4$s images."
3413
  msgstr ""
3414
 
3415
+ #: inc/media.class.php:1297
3416
  msgid "Number of images in one image group (%s) exceeds the credit (%s)"
3417
  msgstr ""
3418
 
3419
+ #: inc/media.class.php:1353
3420
  msgid "Post data is empty."
3421
  msgstr ""
3422
 
3444
  msgid "LiteSpeed Cache Custom Cron Crawler"
3445
  msgstr ""
3446
 
3447
+ #: inc/utility.class.php:66 includes/litespeed-cache-utility.class.php:66
3448
+ msgid " %s ago"
3449
  msgstr ""
3450
 
3451
  #: lib/litespeed/litespeed-crawler.class.php:174
3501
  msgid "Failed to write to %s."
3502
  msgstr ""
3503
 
3504
+ #: thirdparty/lscwp-3rd-woocommerce.cls.php:793
3505
  msgid "WooCommerce"
3506
  msgstr ""
3507
 
3508
+ #: thirdparty/lscwp-3rd-woocommerce.cls.php:796
3509
  msgid "Purge product on changes to the quantity or stock status."
3510
  msgstr ""
3511
 
3512
+ #: thirdparty/lscwp-3rd-woocommerce.cls.php:797
3513
  msgid "Purge categories only when stock status changes."
3514
  msgstr ""
3515
 
3516
+ #: thirdparty/lscwp-3rd-woocommerce.cls.php:798
3517
  msgid "Purge product and categories only when the stock status changes."
3518
  msgstr ""
3519
 
3520
+ #: thirdparty/lscwp-3rd-woocommerce.cls.php:799
3521
  msgid "Purge product only when the stock status changes."
3522
  msgstr ""
3523
 
3524
+ #: thirdparty/lscwp-3rd-woocommerce.cls.php:800
3525
  msgid "Do not purge categories on changes to the quantity or stock status."
3526
  msgstr ""
3527
 
3528
+ #: thirdparty/lscwp-3rd-woocommerce.cls.php:801
3529
  msgid ""
3530
  "Always purge both product and categories on changes to the quantity or stock "
3531
  "status."
3532
  msgstr ""
3533
 
3534
+ #: thirdparty/lscwp-3rd-woocommerce.cls.php:804
3535
  msgid ""
3536
  "Determines how changes in product quantity and product stock status affect "
3537
  "product pages and their associated category pages."
3538
  msgstr ""
3539
 
3540
+ #: thirdparty/lscwp-3rd-woocommerce.cls.php:805
3541
  msgid ""
3542
  "Checking this option will force the shop page to use the front page TTL "
3543
  "setting."
3544
  msgstr ""
3545
 
3546
+ #: thirdparty/lscwp-3rd-woocommerce.cls.php:806
3547
  msgid ""
3548
  "For example, if the homepage for the site is located at %1$s, the shop page "
3549
  "may be located at %2$s."
3550
  msgstr ""
3551
 
3552
+ #: thirdparty/lscwp-3rd-woocommerce.cls.php:834
3553
  msgid "Product Update Interval"
3554
  msgstr ""
3555
 
3556
+ #: thirdparty/lscwp-3rd-woocommerce.cls.php:841
3557
  msgid "Use Front Page TTL for the Shop Page"
3558
  msgstr ""
3559
 
3560
+ #: thirdparty/lscwp-3rd-woocommerce.cls.php:848
3561
  msgid "Privately Cache Cart"
3562
  msgstr ""
3563
 
3564
+ #: thirdparty/lscwp-3rd-woocommerce.cls.php:852
3565
  msgid "Privately cache cart when not empty."
3566
  msgstr ""
3567
 
3568
+ #: thirdparty/lscwp-3rd-woocommerce.cls.php:860
3569
  msgid "After verifying that the cache works in general, please test the cart."
3570
  msgstr ""
3571
 
3572
+ #: thirdparty/lscwp-3rd-woocommerce.cls.php:861
3573
  msgid "To test the cart, visit the <a %s>FAQ</a>."
3574
  msgstr ""
3575
 
lib/vendor/bin/cssmin DELETED
@@ -1,37 +0,0 @@
1
- #!/usr/bin/env php
2
- <?php
3
-
4
- use tubalmartin\CssMin\Command;
5
-
6
- $autoloadPath = null;
7
- $autoloadPaths = array(
8
- __DIR__ . '/../../autoload.php',
9
- __DIR__ . '/../vendor/autoload.php',
10
- __DIR__ . '/vendor/autoload.php'
11
- );
12
-
13
- foreach ($autoloadPaths as $file) {
14
- if (file_exists($file)) {
15
- $autoloadPath = $file;
16
- break;
17
- }
18
- }
19
-
20
- unset($file);
21
- unset($autoloadPaths);
22
-
23
- if (is_null($autoloadPath)) {
24
- fwrite(
25
- STDERR,
26
- 'You need to set up the project dependencies using Composer:' . PHP_EOL . PHP_EOL .
27
- ' composer install' . PHP_EOL . PHP_EOL .
28
- 'You can learn all about Composer on https://getcomposer.org/.' . PHP_EOL
29
- );
30
- die(1);
31
- }
32
-
33
- require $autoloadPath;
34
-
35
- unset($autoloadPath);
36
-
37
- Command::main();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/vendor/pimple/pimple/ext/pimple/config.m4 DELETED
@@ -1,63 +0,0 @@
1
- dnl $Id$
2
- dnl config.m4 for extension pimple
3
-
4
- dnl Comments in this file start with the string 'dnl'.
5
- dnl Remove where necessary. This file will not work
6
- dnl without editing.
7
-
8
- dnl If your extension references something external, use with:
9
-
10
- dnl PHP_ARG_WITH(pimple, for pimple support,
11
- dnl Make sure that the comment is aligned:
12
- dnl [ --with-pimple Include pimple support])
13
-
14
- dnl Otherwise use enable:
15
-
16
- PHP_ARG_ENABLE(pimple, whether to enable pimple support,
17
- dnl Make sure that the comment is aligned:
18
- [ --enable-pimple Enable pimple support])
19
-
20
- if test "$PHP_PIMPLE" != "no"; then
21
- dnl Write more examples of tests here...
22
-
23
- dnl # --with-pimple -> check with-path
24
- dnl SEARCH_PATH="/usr/local /usr" # you might want to change this
25
- dnl SEARCH_FOR="/include/pimple.h" # you most likely want to change this
26
- dnl if test -r $PHP_PIMPLE/$SEARCH_FOR; then # path given as parameter
27
- dnl PIMPLE_DIR=$PHP_PIMPLE
28
- dnl else # search default path list
29
- dnl AC_MSG_CHECKING([for pimple files in default path])
30
- dnl for i in $SEARCH_PATH ; do
31
- dnl if test -r $i/$SEARCH_FOR; then
32
- dnl PIMPLE_DIR=$i
33
- dnl AC_MSG_RESULT(found in $i)
34
- dnl fi
35
- dnl done
36
- dnl fi
37
- dnl
38
- dnl if test -z "$PIMPLE_DIR"; then
39
- dnl AC_MSG_RESULT([not found])
40
- dnl AC_MSG_ERROR([Please reinstall the pimple distribution])
41
- dnl fi
42
-
43
- dnl # --with-pimple -> add include path
44
- dnl PHP_ADD_INCLUDE($PIMPLE_DIR/include)
45
-
46
- dnl # --with-pimple -> check for lib and symbol presence
47
- dnl LIBNAME=pimple # you may want to change this
48
- dnl LIBSYMBOL=pimple # you most likely want to change this
49
-
50
- dnl PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL,
51
- dnl [
52
- dnl PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $PIMPLE_DIR/lib, PIMPLE_SHARED_LIBADD)
53
- dnl AC_DEFINE(HAVE_PIMPLELIB,1,[ ])
54
- dnl ],[
55
- dnl AC_MSG_ERROR([wrong pimple lib version or lib not found])
56
- dnl ],[
57
- dnl -L$PIMPLE_DIR/lib -lm
58
- dnl ])
59
- dnl
60
- dnl PHP_SUBST(PIMPLE_SHARED_LIBADD)
61
-
62
- PHP_NEW_EXTENSION(pimple, pimple.c, $ext_shared)
63
- fi
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/vendor/pimple/pimple/ext/pimple/config.w32 DELETED
@@ -1,13 +0,0 @@
1
- // $Id$
2
- // vim:ft=javascript
3
-
4
- // If your extension references something external, use ARG_WITH
5
- // ARG_WITH("pimple", "for pimple support", "no");
6
-
7
- // Otherwise, use ARG_ENABLE
8
- // ARG_ENABLE("pimple", "enable pimple support", "no");
9
-
10
- if (PHP_PIMPLE != "no") {
11
- EXTENSION("pimple", "pimple.c");
12
- }
13
-
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/vendor/pimple/pimple/ext/pimple/php_pimple.h DELETED
@@ -1,137 +0,0 @@
1
-
2
- /*
3
- * This file is part of Pimple.
4
- *
5
- * Copyright (c) 2014 Fabien Potencier
6
- *
7
- * Permission is hereby granted, free of charge, to any person obtaining a copy
8
- * of this software and associated documentation files (the "Software"), to deal
9
- * in the Software without restriction, including without limitation the rights
10
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- * copies of the Software, and to permit persons to whom the Software is furnished
12
- * to do so, subject to the following conditions:
13
- *
14
- * The above copyright notice and this permission notice shall be included in all
15
- * copies or substantial portions of the Software.
16
- *
17
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
- * THE SOFTWARE.
24
- */
25
-
26
- #ifndef PHP_PIMPLE_H
27
- #define PHP_PIMPLE_H
28
-
29
- extern zend_module_entry pimple_module_entry;
30
- #define phpext_pimple_ptr &pimple_module_entry
31
-
32
- #ifdef PHP_WIN32
33
- # define PHP_PIMPLE_API __declspec(dllexport)
34
- #elif defined(__GNUC__) && __GNUC__ >= 4
35
- # define PHP_PIMPLE_API __attribute__ ((visibility("default")))
36
- #else
37
- # define PHP_PIMPLE_API
38
- #endif
39
-
40
- #ifdef ZTS
41
- #include "TSRM.h"
42
- #endif
43
-
44
- #define PIMPLE_VERSION "3.2.2-DEV"
45
-
46
- #define PIMPLE_NS "Pimple"
47
- #define PSR_CONTAINER_NS "Psr\\Container"
48
- #define PIMPLE_EXCEPTION_NS "Pimple\\Exception"
49
-
50
- #define PIMPLE_DEFAULT_ZVAL_CACHE_NUM 5
51
- #define PIMPLE_DEFAULT_ZVAL_VALUES_NUM 10
52
-
53
- #define PIMPLE_DEPRECATE do { \
54
- int er = EG(error_reporting); \
55
- EG(error_reporting) = 0;\
56
- php_error(E_DEPRECATED, "The Pimple C extension is deprecated since version 3.1 and will be removed in 4.0."); \
57
- EG(error_reporting) = er; \
58
- } while (0);
59
-
60
- zend_module_entry *get_module(void);
61
-
62
- PHP_MINIT_FUNCTION(pimple);
63
- PHP_MINFO_FUNCTION(pimple);
64
-
65
- PHP_METHOD(FrozenServiceException, __construct);
66
- PHP_METHOD(InvalidServiceIdentifierException, __construct);
67
- PHP_METHOD(UnknownIdentifierException, __construct);
68
-
69
- PHP_METHOD(Pimple, __construct);
70
- PHP_METHOD(Pimple, factory);
71
- PHP_METHOD(Pimple, protect);
72
- PHP_METHOD(Pimple, raw);
73
- PHP_METHOD(Pimple, extend);
74
- PHP_METHOD(Pimple, keys);
75
- PHP_METHOD(Pimple, register);
76
- PHP_METHOD(Pimple, offsetSet);
77
- PHP_METHOD(Pimple, offsetUnset);
78
- PHP_METHOD(Pimple, offsetGet);
79
- PHP_METHOD(Pimple, offsetExists);
80
-
81
- PHP_METHOD(PimpleClosure, invoker);
82
-
83
- typedef struct _pimple_bucket_value {
84
- zval *value; /* Must be the first element */
85
- zval *raw;
86
- zend_object_handle handle_num;
87
- enum {
88
- PIMPLE_IS_PARAM = 0,
89
- PIMPLE_IS_SERVICE = 2
90
- } type;
91
- zend_bool initialized;
92
- zend_fcall_info_cache fcc;
93
- } pimple_bucket_value;
94
-
95
- typedef struct _pimple_object {
96
- zend_object zobj;
97
- HashTable values;
98
- HashTable factories;
99
- HashTable protected;
100
- } pimple_object;
101
-
102
- typedef struct _pimple_closure_object {
103
- zend_object zobj;
104
- zval *callable;
105
- zval *factory;
106
- } pimple_closure_object;
107
-
108
- static const char sensiolabs_logo[] = "<img src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHYAAAAUCAMAAABvRTlyAAAAz1BMVEUAAAAAAAAAAAAsThWB5j4AAACD6T8AAACC6D+C6D6C6D+C6D4AAAAAAACC6D4AAAAAAACC6D8AAAAAAAAAAAAAAAAAAAAAAACC6D4AAAAAAAAAAACC6D4AAAAAAAAAAAAAAAAAAAAAAACC6D8AAACC6D4AAAAAAAAAAAAAAAAAAACC6D8AAACC6D6C6D+B6D+C6D+C6D+C6D8AAACC6D6C6D4AAACC6D/K/2KC6D+B6D6C6D6C6D+C6D8sTxUyWRhEeiEAAACC6D+C5z6B6D7drnEVAAAAQXRSTlMAE3oCNSUuDHFHzxaF9UFsu+irX+zlKzYimaJXktyOSFD6BolxqT7QGMMdarMIpuO28r9EolXKgR16OphfXYd4V14GtB4AAAMpSURBVEjHvVSJctowEF1jjME2RziMwUCoMfd9heZqG4n//6buLpJjkmYm03byZmxJa2nf6u2uQcG2bfhqRN4LoTKBzyGDm68M7mAwcOEdjo4zhA/Rf9Go/CVtTgiRhXfIC3EDH8F/eUX1/9KexRo+QgOdtHDsEe/sM7QT32/+K61Z1LFXcXJxN4pTbu1aTQUzuy2PIA0rDo0/0Aa5XFaJvKaVTrubywXvaa1Wq4Vu/Snr3Y7Aojh4VccwykW2N2oQ8wmjyut6+Q1t5ywIG5Npj1sh5E0B7YOzFDjfuRfaOh3O+MbbVNfTWS9COZk3Obd2su5d0a6IU9KLREbw8gEehWSr1r2sPWciXLG38r5NdW0xu9eioU87omjC9yNaMi5GNf6WppVSOqXCFkmCvMB3p9SROLoYQn5pDgQOujA1xjYvqH+plUdkwnmII8VxR/PKYkrfLLomhVlE3b/LhNbNr7hp0H2JaOc4v8dFB58HSsFTSafaqtY1sT3GO8wsy5rhokYPlRJdjPMajyYqTt1EHF/2uqSWQWmAjCUSmQ1MS3g8Btf1XOsy7YIC0CB1b5Xw1Vhba0zbxiCAQLH9TNPmHJXQUtJAN0KcDsoqLxsNvJrJExa7mKIdp2lRE2WexiS4pqWk/0jROlw6K6bV9YOBDGAuqMJ0bnuUKGB0L27bxgRhGEbzihbhxxXaQC88Vkwq8ldCi86RApWUb0Q+4VDosBCc+1s81lUdnBavH4Zp2mm3O44USwOfvSo9oBiwpFg71lMS1VKJLKljS3j9p+fOTvXXlsSNuEv6YPaZda9uRope0VJfKdo7fPiYfSmvFjXQbkhY0d9hCbBWIktRgEDieDhf1N3wbbkmNNgRy8hyl620yGQat/grV3HMpc2HDKTVmOPFz6ylPCKt/nXcAyV260jaAowwIW0YuBzrOgb/KrddZS9OmJaLgpWK4JX2DDuklcLZSDGcn8Vmx9YDNvT6UsjyBApRyFQVX7Vxm9TGxE16nmfRd8/zQoDmggQOTRh5Hv8pMt9Q/L2JmSwkMCE7dA4BuDjHJwfu0Om4QAhOjrN5XkIatglfiN/bUPdCQFjTYgAAAABJRU5ErkJggg==\">";
109
-
110
- static void pimple_exception_call_parent_constructor(zval *this_ptr, const char *format, const char *arg1 TSRMLS_DC);
111
-
112
- static int pimple_zval_to_pimpleval(zval *_zval, pimple_bucket_value *_pimple_bucket_value TSRMLS_DC);
113
- static int pimple_zval_is_valid_callback(zval *_zval, pimple_bucket_value *_pimple_bucket_value TSRMLS_DC);
114
-
115
- static void pimple_bucket_dtor(pimple_bucket_value *bucket);
116
- static void pimple_free_bucket(pimple_bucket_value *bucket);
117
-
118
- static zval *pimple_object_read_dimension(zval *object, zval *offset, int type TSRMLS_DC);
119
- static void pimple_object_write_dimension(zval *object, zval *offset, zval *value TSRMLS_DC);
120
- static int pimple_object_has_dimension(zval *object, zval *offset, int check_empty TSRMLS_DC);
121
- static void pimple_object_unset_dimension(zval *object, zval *offset TSRMLS_DC);
122
- static zend_object_value pimple_object_create(zend_class_entry *ce TSRMLS_DC);
123
- static void pimple_free_object_storage(pimple_object *obj TSRMLS_DC);
124
-
125
- static void pimple_closure_free_object_storage(pimple_closure_object *obj TSRMLS_DC);
126
- static zend_object_value pimple_closure_object_create(zend_class_entry *ce TSRMLS_DC);
127
- static zend_function *pimple_closure_get_constructor(zval * TSRMLS_DC);
128
- static int pimple_closure_get_closure(zval *obj, zend_class_entry **ce_ptr, union _zend_function **fptr_ptr, zval **zobj_ptr TSRMLS_DC);
129
-
130
- #ifdef ZTS
131
- #define PIMPLE_G(v) TSRMG(pimple_globals_id, zend_pimple_globals *, v)
132
- #else
133
- #define PIMPLE_G(v) (pimple_globals.v)
134
- #endif
135
-
136
- #endif /* PHP_PIMPLE_H */
137
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/vendor/pimple/pimple/ext/pimple/pimple.c DELETED
@@ -1,1114 +0,0 @@
1
-
2
- /*
3
- * This file is part of Pimple.
4
- *
5
- * Copyright (c) 2014 Fabien Potencier
6
- *
7
- * Permission is hereby granted, free of charge, to any person obtaining a copy
8
- * of this software and associated documentation files (the "Software"), to deal
9
- * in the Software without restriction, including without limitation the rights
10
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- * copies of the Software, and to permit persons to whom the Software is furnished
12
- * to do so, subject to the following conditions:
13
- *
14
- * The above copyright notice and this permission notice shall be included in all
15
- * copies or substantial portions of the Software.
16
- *
17
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
- * THE SOFTWARE.
24
- */
25
-
26
- #ifdef HAVE_CONFIG_H
27
- #include "config.h"
28
- #endif
29
-
30
- #include "php.h"
31
- #include "php_ini.h"
32
- #include "ext/standard/info.h"
33
- #include "php_pimple.h"
34
- #include "pimple_compat.h"
35
- #include "zend_interfaces.h"
36
- #include "zend.h"
37
- #include "Zend/zend_closures.h"
38
- #include "ext/spl/spl_exceptions.h"
39
- #include "Zend/zend_exceptions.h"
40
- #include "main/php_output.h"
41
- #include "SAPI.h"
42
-
43
- static zend_class_entry *pimple_ce_PsrContainerInterface;
44
- static zend_class_entry *pimple_ce_PsrContainerExceptionInterface;
45
- static zend_class_entry *pimple_ce_PsrNotFoundExceptionInterface;
46
-
47
- static zend_class_entry *pimple_ce_ExpectedInvokableException;
48
- static zend_class_entry *pimple_ce_FrozenServiceException;
49
- static zend_class_entry *pimple_ce_InvalidServiceIdentifierException;
50
- static zend_class_entry *pimple_ce_UnknownIdentifierException;
51
-
52
- static zend_class_entry *pimple_ce;
53
- static zend_object_handlers pimple_object_handlers;
54
- static zend_class_entry *pimple_closure_ce;
55
- static zend_class_entry *pimple_serviceprovider_ce;
56
- static zend_object_handlers pimple_closure_object_handlers;
57
- static zend_internal_function pimple_closure_invoker_function;
58
-
59
- #define FETCH_DIM_HANDLERS_VARS pimple_object *pimple_obj = NULL; \
60
- ulong index; \
61
- pimple_obj = (pimple_object *)zend_object_store_get_object(object TSRMLS_CC); \
62
-
63
- #define PIMPLE_OBJECT_HANDLE_INHERITANCE_OBJECT_HANDLERS do { \
64
- if (ce != pimple_ce) { \
65
- zend_hash_find(&ce->function_table, ZEND_STRS("offsetget"), (void **)&function); \
66
- if (function->common.scope != ce) { /* if the function is not defined in this actual class */ \
67
- pimple_object_handlers.read_dimension = pimple_object_read_dimension; /* then overwrite the handler to use custom one */ \
68
- } \
69
- zend_hash_find(&ce->function_table, ZEND_STRS("offsetset"), (void **)&function); \
70
- if (function->common.scope != ce) { \
71
- pimple_object_handlers.write_dimension = pimple_object_write_dimension; \
72
- } \
73
- zend_hash_find(&ce->function_table, ZEND_STRS("offsetexists"), (void **)&function); \
74
- if (function->common.scope != ce) { \
75
- pimple_object_handlers.has_dimension = pimple_object_has_dimension; \
76
- } \
77
- zend_hash_find(&ce->function_table, ZEND_STRS("offsetunset"), (void **)&function); \
78
- if (function->common.scope != ce) { \
79
- pimple_object_handlers.unset_dimension = pimple_object_unset_dimension; \
80
- } \
81
- } else { \
82
- pimple_object_handlers.read_dimension = pimple_object_read_dimension; \
83
- pimple_object_handlers.write_dimension = pimple_object_write_dimension; \
84
- pimple_object_handlers.has_dimension = pimple_object_has_dimension; \
85
- pimple_object_handlers.unset_dimension = pimple_object_unset_dimension; \
86
- }\
87
- } while(0);
88
-
89
- #define PIMPLE_CALL_CB do { \
90
- zend_fcall_info_argn(&fci TSRMLS_CC, 1, &object); \
91
- fci.size = sizeof(fci); \
92
- fci.object_ptr = retval->fcc.object_ptr; \
93
- fci.function_name = retval->value; \
94
- fci.no_separation = 1; \
95
- fci.retval_ptr_ptr = &retval_ptr_ptr; \
96
- \
97
- zend_call_function(&fci, &retval->fcc TSRMLS_CC); \
98
- efree(fci.params); \
99
- if (EG(exception)) { \
100
- return EG(uninitialized_zval_ptr); \
101
- } \
102
- } while(0);
103
-
104
-
105
- /* Psr\Container\ContainerInterface */
106
- ZEND_BEGIN_ARG_INFO_EX(arginfo_pimple_PsrContainerInterface_get, 0, 0, 1)
107
- ZEND_ARG_INFO(0, id)
108
- ZEND_END_ARG_INFO()
109
-
110
- ZEND_BEGIN_ARG_INFO_EX(arginfo_pimple_PsrContainerInterface_has, 0, 0, 1)
111
- ZEND_ARG_INFO(0, id)
112
- ZEND_END_ARG_INFO()
113
-
114
- static const zend_function_entry pimple_ce_PsrContainerInterface_functions[] = {
115
- PHP_ABSTRACT_ME(ContainerInterface, get, arginfo_pimple_PsrContainerInterface_get)
116
- PHP_ABSTRACT_ME(ContainerInterface, has, arginfo_pimple_PsrContainerInterface_has)
117
- PHP_FE_END
118
- };
119
-
120
- /* Psr\Container\ContainerExceptionInterface */
121
- static const zend_function_entry pimple_ce_PsrContainerExceptionInterface_functions[] = {
122
- PHP_FE_END
123
- };
124
-
125
- /* Psr\Container\NotFoundExceptionInterface */
126
- static const zend_function_entry pimple_ce_PsrNotFoundExceptionInterface_functions[] = {
127
- PHP_FE_END
128
- };
129
-
130
- /* Pimple\Exception\FrozenServiceException */
131
- ZEND_BEGIN_ARG_INFO_EX(arginfo_FrozenServiceException___construct, 0, 0, 1)
132
- ZEND_ARG_INFO(0, id)
133
- ZEND_END_ARG_INFO()
134
-
135
- static const zend_function_entry pimple_ce_FrozenServiceException_functions[] = {
136
- PHP_ME(FrozenServiceException, __construct, arginfo_FrozenServiceException___construct, ZEND_ACC_PUBLIC)
137
- PHP_FE_END
138
- };
139
-
140
- /* Pimple\Exception\InvalidServiceIdentifierException */
141
- ZEND_BEGIN_ARG_INFO_EX(arginfo_InvalidServiceIdentifierException___construct, 0, 0, 1)
142
- ZEND_ARG_INFO(0, id)
143
- ZEND_END_ARG_INFO()
144
-
145
- static const zend_function_entry pimple_ce_InvalidServiceIdentifierException_functions[] = {
146
- PHP_ME(InvalidServiceIdentifierException, __construct, arginfo_InvalidServiceIdentifierException___construct, ZEND_ACC_PUBLIC)
147
- PHP_FE_END
148
- };
149
-
150
- /* Pimple\Exception\UnknownIdentifierException */
151
- ZEND_BEGIN_ARG_INFO_EX(arginfo_UnknownIdentifierException___construct, 0, 0, 1)
152
- ZEND_ARG_INFO(0, id)
153
- ZEND_END_ARG_INFO()
154
-
155
- static const zend_function_entry pimple_ce_UnknownIdentifierException_functions[] = {
156
- PHP_ME(UnknownIdentifierException, __construct, arginfo_UnknownIdentifierException___construct, ZEND_ACC_PUBLIC)
157
- PHP_FE_END
158
- };
159
-
160
- /* Pimple\Container */
161
- ZEND_BEGIN_ARG_INFO_EX(arginfo___construct, 0, 0, 0)
162
- ZEND_ARG_ARRAY_INFO(0, value, 0)
163
- ZEND_END_ARG_INFO()
164
-
165
- ZEND_BEGIN_ARG_INFO_EX(arginfo_offsetset, 0, 0, 2)
166
- ZEND_ARG_INFO(0, offset)
167
- ZEND_ARG_INFO(0, value)
168
- ZEND_END_ARG_INFO()
169
-
170
- ZEND_BEGIN_ARG_INFO_EX(arginfo_offsetget, 0, 0, 1)
171
- ZEND_ARG_INFO(0, offset)
172
- ZEND_END_ARG_INFO()
173
-
174
- ZEND_BEGIN_ARG_INFO_EX(arginfo_offsetexists, 0, 0, 1)
175
- ZEND_ARG_INFO(0, offset)
176
- ZEND_END_ARG_INFO()
177
-
178
- ZEND_BEGIN_ARG_INFO_EX(arginfo_offsetunset, 0, 0, 1)
179
- ZEND_ARG_INFO(0, offset)
180
- ZEND_END_ARG_INFO()
181
-
182
- ZEND_BEGIN_ARG_INFO_EX(arginfo_factory, 0, 0, 1)
183
- ZEND_ARG_INFO(0, callable)
184
- ZEND_END_ARG_INFO()
185
-
186
- ZEND_BEGIN_ARG_INFO_EX(arginfo_protect, 0, 0, 1)
187
- ZEND_ARG_INFO(0, callable)
188
- ZEND_END_ARG_INFO()
189
-
190
- ZEND_BEGIN_ARG_INFO_EX(arginfo_raw, 0, 0, 1)
191
- ZEND_ARG_INFO(0, id)
192
- ZEND_END_ARG_INFO()
193
-
194
- ZEND_BEGIN_ARG_INFO_EX(arginfo_extend, 0, 0, 2)
195
- ZEND_ARG_INFO(0, id)
196
- ZEND_ARG_INFO(0, callable)
197
- ZEND_END_ARG_INFO()
198
-
199
- ZEND_BEGIN_ARG_INFO_EX(arginfo_keys, 0, 0, 0)
200
- ZEND_END_ARG_INFO()
201
-
202
- ZEND_BEGIN_ARG_INFO_EX(arginfo_register, 0, 0, 1)
203
- ZEND_ARG_OBJ_INFO(0, provider, Pimple\\ServiceProviderInterface, 0)
204
- ZEND_ARG_ARRAY_INFO(0, values, 1)
205
- ZEND_END_ARG_INFO()
206
-
207
- static const zend_function_entry pimple_ce_functions[] = {
208
- PHP_ME(Pimple, __construct, arginfo___construct, ZEND_ACC_PUBLIC)
209
- PHP_ME(Pimple, factory, arginfo_factory, ZEND_ACC_PUBLIC)
210
- PHP_ME(Pimple, protect, arginfo_protect, ZEND_ACC_PUBLIC)
211
- PHP_ME(Pimple, raw, arginfo_raw, ZEND_ACC_PUBLIC)
212
- PHP_ME(Pimple, extend, arginfo_extend, ZEND_ACC_PUBLIC)
213
- PHP_ME(Pimple, keys, arginfo_keys, ZEND_ACC_PUBLIC)
214
- PHP_ME(Pimple, register, arginfo_register, ZEND_ACC_PUBLIC)
215
-
216
- PHP_ME(Pimple, offsetSet, arginfo_offsetset, ZEND_ACC_PUBLIC)
217
- PHP_ME(Pimple, offsetGet, arginfo_offsetget, ZEND_ACC_PUBLIC)
218
- PHP_ME(Pimple, offsetExists, arginfo_offsetexists, ZEND_ACC_PUBLIC)
219
- PHP_ME(Pimple, offsetUnset, arginfo_offsetunset, ZEND_ACC_PUBLIC)
220
- PHP_FE_END
221
- };
222
-
223
- /* Pimple\ServiceProviderInterface */
224
- ZEND_BEGIN_ARG_INFO_EX(arginfo_serviceprovider_register, 0, 0, 1)
225
- ZEND_ARG_OBJ_INFO(0, pimple, Pimple\\Container, 0)
226
- ZEND_END_ARG_INFO()
227
-
228
- static const zend_function_entry pimple_serviceprovider_iface_ce_functions[] = {
229
- PHP_ABSTRACT_ME(ServiceProviderInterface, register, arginfo_serviceprovider_register)
230
- PHP_FE_END
231
- };
232
-
233
- /* parent::__construct(sprintf("Something with %s", $arg1)) */
234
- static void pimple_exception_call_parent_constructor(zval *this_ptr, const char *format, const char *arg1 TSRMLS_DC)
235
- {
236
- zend_class_entry *ce = Z_OBJCE_P(this_ptr);
237
- char *message = NULL;
238
- int message_len;
239
- zval *constructor_arg;
240
-
241
- message_len = spprintf(&message, 0, format, arg1);
242
- ALLOC_INIT_ZVAL(constructor_arg);
243
- ZVAL_STRINGL(constructor_arg, message, message_len, 1);
244
-
245
- zend_call_method_with_1_params(&this_ptr, ce, &ce->parent->constructor, "__construct", NULL, constructor_arg);
246
-
247
- efree(message);
248
- zval_ptr_dtor(&constructor_arg);
249
- }
250
-
251
- /**
252
- * Pass a single string parameter to exception constructor and throw
253
- */
254
- static void pimple_throw_exception_string(zend_class_entry *ce, const char *message, zend_uint message_len TSRMLS_DC)
255
- {
256
- zval *exception, *param;
257
-
258
- ALLOC_INIT_ZVAL(exception);
259
- object_init_ex(exception, ce);
260
-
261
- ALLOC_INIT_ZVAL(param);
262
- ZVAL_STRINGL(param, message, message_len, 1);
263
-
264
- zend_call_method_with_1_params(&exception, ce, &ce->constructor, "__construct", NULL, param);
265
-
266
- zend_throw_exception_object(exception TSRMLS_CC);
267
-
268
- zval_ptr_dtor(&param);
269
- }
270
-
271
- static void pimple_closure_free_object_storage(pimple_closure_object *obj TSRMLS_DC)
272
- {
273
- zend_object_std_dtor(&obj->zobj TSRMLS_CC);
274
- if (obj->factory) {
275
- zval_ptr_dtor(&obj->factory);
276
- }
277
- if (obj->callable) {
278
- zval_ptr_dtor(&obj->callable);
279
- }
280
- efree(obj);
281
- }
282
-
283
- static void pimple_free_object_storage(pimple_object *obj TSRMLS_DC)
284
- {
285
- zend_hash_destroy(&obj->factories);
286
- zend_hash_destroy(&obj->protected);
287
- zend_hash_destroy(&obj->values);
288
- zend_object_std_dtor(&obj->zobj TSRMLS_CC);
289
- efree(obj);
290
- }
291
-
292
- static void pimple_free_bucket(pimple_bucket_value *bucket)
293
- {
294
- if (bucket->raw) {
295
- zval_ptr_dtor(&bucket->raw);
296
- }
297
- }
298
-
299
- static zend_object_value pimple_closure_object_create(zend_class_entry *ce TSRMLS_DC)
300
- {
301
- zend_object_value retval;
302
- pimple_closure_object *pimple_closure_obj = NULL;
303
-
304
- pimple_closure_obj = ecalloc(1, sizeof(pimple_closure_object));
305
- ZEND_OBJ_INIT(&pimple_closure_obj->zobj, ce);
306
-
307
- pimple_closure_object_handlers.get_constructor = pimple_closure_get_constructor;
308
- retval.handlers = &pimple_closure_object_handlers;
309
- retval.handle = zend_objects_store_put(pimple_closure_obj, (zend_objects_store_dtor_t) zend_objects_destroy_object, (zend_objects_free_object_storage_t) pimple_closure_free_object_storage, NULL TSRMLS_CC);
310
-
311
- return retval;
312
- }
313
-
314
- static zend_function *pimple_closure_get_constructor(zval *obj TSRMLS_DC)
315
- {
316
- zend_error(E_ERROR, "Pimple\\ContainerClosure is an internal class and cannot be instantiated");
317
-
318
- return NULL;
319
- }
320
-
321
- static int pimple_closure_get_closure(zval *obj, zend_class_entry **ce_ptr, union _zend_function **fptr_ptr, zval **zobj_ptr TSRMLS_DC)
322
- {
323
- *zobj_ptr = obj;
324
- *ce_ptr = Z_OBJCE_P(obj);
325
- *fptr_ptr = (zend_function *)&pimple_closure_invoker_function;
326
-
327
- return SUCCESS;
328
- }
329
-
330
- static zend_object_value pimple_object_create(zend_class_entry *ce TSRMLS_DC)
331
- {
332
- zend_object_value retval;
333
- pimple_object *pimple_obj = NULL;
334
- zend_function *function = NULL;
335
-
336
- pimple_obj = emalloc(sizeof(pimple_object));
337
- ZEND_OBJ_INIT(&pimple_obj->zobj, ce);
338
-
339
- PIMPLE_OBJECT_HANDLE_INHERITANCE_OBJECT_HANDLERS
340
-
341
- retval.handlers = &pimple_object_handlers;
342
- retval.handle = zend_objects_store_put(pimple_obj, (zend_objects_store_dtor_t) zend_objects_destroy_object, (zend_objects_free_object_storage_t) pimple_free_object_storage, NULL TSRMLS_CC);
343
-
344
- zend_hash_init(&pimple_obj->factories, PIMPLE_DEFAULT_ZVAL_CACHE_NUM, NULL, (dtor_func_t)pimple_bucket_dtor, 0);
345
- zend_hash_init(&pimple_obj->protected, PIMPLE_DEFAULT_ZVAL_CACHE_NUM, NULL, (dtor_func_t)pimple_bucket_dtor, 0);
346
- zend_hash_init(&pimple_obj->values, PIMPLE_DEFAULT_ZVAL_VALUES_NUM, NULL, (dtor_func_t)pimple_bucket_dtor, 0);
347
-
348
- return retval;
349
- }
350
-
351
- static void pimple_object_write_dimension(zval *object, zval *offset, zval *value TSRMLS_DC)
352
- {
353
- FETCH_DIM_HANDLERS_VARS
354
-
355
- pimple_bucket_value pimple_value = {0}, *found_value = NULL;
356
- ulong hash;
357
-
358
- pimple_zval_to_pimpleval(value, &pimple_value TSRMLS_CC);
359
-
360
- if (!offset) {/* $p[] = 'foo' when not overloaded */
361
- zend_hash_next_index_insert(&pimple_obj->values, (void *)&pimple_value, sizeof(pimple_bucket_value), NULL);
362
- Z_ADDREF_P(value);
363
- return;
364
- }
365
-
366
- switch (Z_TYPE_P(offset)) {
367
- case IS_STRING:
368
- hash = zend_hash_func(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1);
369
- zend_hash_quick_find(&pimple_obj->values, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hash, (void **)&found_value);
370
- if (found_value && found_value->type == PIMPLE_IS_SERVICE && found_value->initialized == 1) {
371
- pimple_free_bucket(&pimple_value);
372
- pimple_throw_exception_string(pimple_ce_FrozenServiceException, Z_STRVAL_P(offset), Z_STRLEN_P(offset) TSRMLS_CC);
373
- return;
374
- }
375
- if (zend_hash_quick_update(&pimple_obj->values, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hash, (void *)&pimple_value, sizeof(pimple_bucket_value), NULL) == FAILURE) {
376
- pimple_free_bucket(&pimple_value);
377
- return;
378
- }
379
- Z_ADDREF_P(value);
380
- break;
381
- case IS_DOUBLE:
382
- case IS_BOOL:
383
- case IS_LONG:
384
- if (Z_TYPE_P(offset) == IS_DOUBLE) {
385
- index = (ulong)Z_DVAL_P(offset);
386
- } else {
387
- index = Z_LVAL_P(offset);
388
- }
389
- zend_hash_index_find(&pimple_obj->values, index, (void **)&found_value);
390
- if (found_value && found_value->type == PIMPLE_IS_SERVICE && found_value->initialized == 1) {
391
- pimple_free_bucket(&pimple_value);
392
- convert_to_string(offset);
393
- pimple_throw_exception_string(pimple_ce_FrozenServiceException, Z_STRVAL_P(offset), Z_STRLEN_P(offset) TSRMLS_CC);
394
- return;
395
- }
396
- if (zend_hash_index_update(&pimple_obj->values, index, (void *)&pimple_value, sizeof(pimple_bucket_value), NULL) == FAILURE) {
397
- pimple_free_bucket(&pimple_value);
398
- return;
399
- }
400
- Z_ADDREF_P(value);
401
- break;
402
- case IS_NULL: /* $p[] = 'foo' when overloaded */
403
- zend_hash_next_index_insert(&pimple_obj->values, (void *)&pimple_value, sizeof(pimple_bucket_value), NULL);
404
- Z_ADDREF_P(value);
405
- break;
406
- default:
407
- pimple_free_bucket(&pimple_value);
408
- zend_error(E_WARNING, "Unsupported offset type");
409
- }
410
- }
411
-
412
- static void pimple_object_unset_dimension(zval *object, zval *offset TSRMLS_DC)
413
- {
414
- FETCH_DIM_HANDLERS_VARS
415
-
416
- switch (Z_TYPE_P(offset)) {
417
- case IS_STRING:
418
- zend_symtable_del(&pimple_obj->values, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1);
419
- zend_symtable_del(&pimple_obj->factories, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1);
420
- zend_symtable_del(&pimple_obj->protected, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1);
421
- break;
422
- case IS_DOUBLE:
423
- case IS_BOOL:
424
- case IS_LONG:
425
- if (Z_TYPE_P(offset) == IS_DOUBLE) {
426
- index = (ulong)Z_DVAL_P(offset);
427
- } else {
428
- index = Z_LVAL_P(offset);
429
- }
430
- zend_hash_index_del(&pimple_obj->values, index);
431
- zend_hash_index_del(&pimple_obj->factories, index);
432
- zend_hash_index_del(&pimple_obj->protected, index);
433
- break;
434
- default:
435
- zend_error(E_WARNING, "Unsupported offset type");
436
- }
437
- }
438
-
439
- static int pimple_object_has_dimension(zval *object, zval *offset, int check_empty TSRMLS_DC)
440
- {
441
- FETCH_DIM_HANDLERS_VARS
442
-
443
- pimple_bucket_value *retval = NULL;
444
-
445
- switch (Z_TYPE_P(offset)) {
446
- case IS_STRING:
447
- if (zend_symtable_find(&pimple_obj->values, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void **)&retval) == SUCCESS) {
448
- switch (check_empty) {
449
- case 0: /* isset */
450
- return 1; /* Differs from PHP behavior (Z_TYPE_P(retval->value) != IS_NULL;) */
451
- case 1: /* empty */
452
- default:
453
- return zend_is_true(retval->value);
454
- }
455
- }
456
- return 0;
457
- break;
458
- case IS_DOUBLE:
459
- case IS_BOOL:
460
- case IS_LONG:
461
- if (Z_TYPE_P(offset) == IS_DOUBLE) {
462
- index = (ulong)Z_DVAL_P(offset);
463
- } else {
464
- index = Z_LVAL_P(offset);
465
- }
466
- if (zend_hash_index_find(&pimple_obj->values, index, (void **)&retval) == SUCCESS) {
467
- switch (check_empty) {
468
- case 0: /* isset */
469
- return 1; /* Differs from PHP behavior (Z_TYPE_P(retval->value) != IS_NULL;)*/
470
- case 1: /* empty */
471
- default:
472
- return zend_is_true(retval->value);
473
- }
474
- }
475
- return 0;
476
- break;
477
- default:
478
- zend_error(E_WARNING, "Unsupported offset type");
479
- return 0;
480
- }
481
- }
482
-
483
- static zval *pimple_object_read_dimension(zval *object, zval *offset, int type TSRMLS_DC)
484
- {
485
- FETCH_DIM_HANDLERS_VARS
486
-
487
- pimple_bucket_value *retval = NULL;
488
- zend_fcall_info fci = {0};
489
- zval *retval_ptr_ptr = NULL;
490
-
491
- switch (Z_TYPE_P(offset)) {
492
- case IS_STRING:
493
- if (zend_symtable_find(&pimple_obj->values, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void **)&retval) == FAILURE) {
494
- pimple_throw_exception_string(pimple_ce_UnknownIdentifierException, Z_STRVAL_P(offset), Z_STRLEN_P(offset) TSRMLS_CC);
495
-
496
- return EG(uninitialized_zval_ptr);
497
- }
498
- break;
499
- case IS_DOUBLE:
500
- case IS_BOOL:
501
- case IS_LONG:
502
- if (Z_TYPE_P(offset) == IS_DOUBLE) {
503
- index = (ulong)Z_DVAL_P(offset);
504
- } else {
505
- index = Z_LVAL_P(offset);
506
- }
507
- if (zend_hash_index_find(&pimple_obj->values, index, (void **)&retval) == FAILURE) {
508
- return EG(uninitialized_zval_ptr);
509
- }
510
- break;
511
- case IS_NULL: /* $p[][3] = 'foo' first dim access */
512
- return EG(uninitialized_zval_ptr);
513
- break;
514
- default:
515
- zend_error(E_WARNING, "Unsupported offset type");
516
- return EG(uninitialized_zval_ptr);
517
- }
518
-
519
- if(retval->type == PIMPLE_IS_PARAM) {
520
- return retval->value;
521
- }
522
-
523
- if (zend_hash_index_exists(&pimple_obj->protected, retval->handle_num)) {
524
- /* Service is protected, return the value every time */
525
- return retval->value;
526
- }
527
-
528
- if (zend_hash_index_exists(&pimple_obj->factories, retval->handle_num)) {
529
- /* Service is a factory, call it every time and never cache its result */
530
- PIMPLE_CALL_CB
531
- Z_DELREF_P(retval_ptr_ptr); /* fetch dim addr will increment refcount */
532
- return retval_ptr_ptr;
533
- }
534
-
535
- if (retval->initialized == 1) {
536
- /* Service has already been called, return its cached value */
537
- return retval->value;
538
- }
539
-
540
- ALLOC_INIT_ZVAL(retval->raw);
541
- MAKE_COPY_ZVAL(&retval->value, retval->raw);
542
-
543
- PIMPLE_CALL_CB
544
-
545
- retval->initialized = 1;
546
- zval_ptr_dtor(&retval->value);
547
- retval->value = retval_ptr_ptr;
548
-
549
- return retval->value;
550
- }
551
-
552
- static int pimple_zval_is_valid_callback(zval *_zval, pimple_bucket_value *_pimple_bucket_value TSRMLS_DC)
553
- {
554
- if (Z_TYPE_P(_zval) != IS_OBJECT) {
555
- return FAILURE;
556
- }
557
-
558
- if (_pimple_bucket_value->fcc.called_scope) {
559
- return SUCCESS;
560
- }
561
-
562
- if (Z_OBJ_HANDLER_P(_zval, get_closure) && Z_OBJ_HANDLER_P(_zval, get_closure)(_zval, &_pimple_bucket_value->fcc.calling_scope, &_pimple_bucket_value->fcc.function_handler, &_pimple_bucket_value->fcc.object_ptr TSRMLS_CC) == SUCCESS) {
563
- _pimple_bucket_value->fcc.called_scope = _pimple_bucket_value->fcc.calling_scope;
564
- return SUCCESS;
565
- } else {
566
- return FAILURE;
567
- }
568
- }
569
-
570
- static int pimple_zval_to_pimpleval(zval *_zval, pimple_bucket_value *_pimple_bucket_value TSRMLS_DC)
571
- {
572
- _pimple_bucket_value->value = _zval;
573
-
574
- if (Z_TYPE_P(_zval) != IS_OBJECT) {
575
- return PIMPLE_IS_PARAM;
576
- }
577
-
578
- if (pimple_zval_is_valid_callback(_zval, _pimple_bucket_value TSRMLS_CC) == SUCCESS) {
579
- _pimple_bucket_value->type = PIMPLE_IS_SERVICE;
580
- _pimple_bucket_value->handle_num = Z_OBJ_HANDLE_P(_zval);
581
- }
582
-
583
- return PIMPLE_IS_SERVICE;
584
- }
585
-
586
- static void pimple_bucket_dtor(pimple_bucket_value *bucket)
587
- {
588
- zval_ptr_dtor(&bucket->value);
589
- pimple_free_bucket(bucket);
590
- }
591
-
592
- PHP_METHOD(FrozenServiceException, __construct)
593
- {
594
- char *id = NULL;
595
- int id_len;
596
-
597
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &id, &id_len) == FAILURE) {
598
- return;
599
- }
600
- pimple_exception_call_parent_constructor(getThis(), "Cannot override frozen service \"%s\".", id TSRMLS_CC);
601
- }
602
-
603
- PHP_METHOD(InvalidServiceIdentifierException, __construct)
604
- {
605
- char *id = NULL;
606
- int id_len;
607
-
608
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &id, &id_len) == FAILURE) {
609
- return;
610
- }
611
- pimple_exception_call_parent_constructor(getThis(), "Identifier \"%s\" does not contain an object definition.", id TSRMLS_CC);
612
- }
613
-
614
- PHP_METHOD(UnknownIdentifierException, __construct)
615
- {
616
- char *id = NULL;
617
- int id_len;
618
-
619
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &id, &id_len) == FAILURE) {
620
- return;
621
- }
622
- pimple_exception_call_parent_constructor(getThis(), "Identifier \"%s\" is not defined.", id TSRMLS_CC);
623
- }
624
-
625
- PHP_METHOD(Pimple, protect)
626
- {
627
- zval *protected = NULL;
628
- pimple_object *pobj = NULL;
629
- pimple_bucket_value bucket = {0};
630
-
631
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &protected) == FAILURE) {
632
- return;
633
- }
634
-
635
- if (pimple_zval_is_valid_callback(protected, &bucket TSRMLS_CC) == FAILURE) {
636
- pimple_free_bucket(&bucket);
637
- zend_throw_exception(pimple_ce_ExpectedInvokableException, "Callable is not a Closure or invokable object.", 0 TSRMLS_CC);
638
- return;
639
- }
640
-
641
- pimple_zval_to_pimpleval(protected, &bucket TSRMLS_CC);
642
- pobj = (pimple_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
643
-
644
- if (zend_hash_index_update(&pobj->protected, bucket.handle_num, (void *)&bucket, sizeof(pimple_bucket_value), NULL) == SUCCESS) {
645
- Z_ADDREF_P(protected);
646
- RETURN_ZVAL(protected, 1 , 0);
647
- } else {
648
- pimple_free_bucket(&bucket);
649
- }
650
- RETURN_FALSE;
651
- }
652
-
653
- PHP_METHOD(Pimple, raw)
654
- {
655
- zval *offset = NULL;
656
- pimple_object *pobj = NULL;
657
- pimple_bucket_value *value = NULL;
658
- ulong index;
659
-
660
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &offset) == FAILURE) {
661
- return;
662
- }
663
-
664
- pobj = zend_object_store_get_object(getThis() TSRMLS_CC);
665
-
666
- switch (Z_TYPE_P(offset)) {
667
- case IS_STRING:
668
- if (zend_symtable_find(&pobj->values, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void *)&value) == FAILURE) {
669
- pimple_throw_exception_string(pimple_ce_UnknownIdentifierException, Z_STRVAL_P(offset), Z_STRLEN_P(offset) TSRMLS_CC);
670
- RETURN_NULL();
671
- }
672
- break;
673
- case IS_DOUBLE:
674
- case IS_BOOL:
675
- case IS_LONG:
676
- if (Z_TYPE_P(offset) == IS_DOUBLE) {
677
- index = (ulong)Z_DVAL_P(offset);
678
- } else {
679
- index = Z_LVAL_P(offset);
680
- }
681
- if (zend_hash_index_find(&pobj->values, index, (void *)&value) == FAILURE) {
682
- RETURN_NULL();
683
- }
684
- break;
685
- case IS_NULL:
686
- default:
687
- zend_error(E_WARNING, "Unsupported offset type");
688
- }
689
-
690
- if (value->raw) {
691
- RETVAL_ZVAL(value->raw, 1, 0);
692
- } else {
693
- RETVAL_ZVAL(value->value, 1, 0);
694
- }
695
- }
696
-
697
- PHP_METHOD(Pimple, extend)
698
- {
699
- zval *offset = NULL, *callable = NULL, *pimple_closure_obj = NULL;
700
- pimple_bucket_value bucket = {0}, *value = NULL;
701
- pimple_object *pobj = NULL;
702
- pimple_closure_object *pcobj = NULL;
703
- ulong index;
704
-
705
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &offset, &callable) == FAILURE) {
706
- return;
707
- }
708
-
709
- pobj = zend_object_store_get_object(getThis() TSRMLS_CC);
710
-
711
- switch (Z_TYPE_P(offset)) {
712
- case IS_STRING:
713
- if (zend_symtable_find(&pobj->values, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void *)&value) == FAILURE) {
714
- pimple_throw_exception_string(pimple_ce_UnknownIdentifierException, Z_STRVAL_P(offset), Z_STRLEN_P(offset) TSRMLS_CC);
715
- RETURN_NULL();
716
- }
717
-
718
- if (value->type != PIMPLE_IS_SERVICE) {
719
- pimple_throw_exception_string(pimple_ce_InvalidServiceIdentifierException, Z_STRVAL_P(offset), Z_STRLEN_P(offset) TSRMLS_CC);
720
- RETURN_NULL();
721
- }
722
- if (zend_hash_index_exists(&pobj->protected, value->handle_num)) {
723
- int er = EG(error_reporting);
724
- EG(error_reporting) = 0;
725
- php_error(E_DEPRECATED, "How Pimple behaves when extending protected closures will be fixed in Pimple 4. Are you sure \"%s\" should be protected?", Z_STRVAL_P(offset));
726
- EG(error_reporting) = er;
727
- }
728
- break;
729
- case IS_DOUBLE:
730
- case IS_BOOL:
731
- case IS_LONG:
732
- if (Z_TYPE_P(offset) == IS_DOUBLE) {
733
- index = (ulong)Z_DVAL_P(offset);
734
- } else {
735
- index = Z_LVAL_P(offset);
736
- }
737
- if (zend_hash_index_find(&pobj->values, index, (void *)&value) == FAILURE) {
738
- convert_to_string(offset);
739
- pimple_throw_exception_string(pimple_ce_UnknownIdentifierException, Z_STRVAL_P(offset), Z_STRLEN_P(offset) TSRMLS_CC);
740
- RETURN_NULL();
741
- }
742
- if (value->type != PIMPLE_IS_SERVICE) {
743
- convert_to_string(offset);
744
- pimple_throw_exception_string(pimple_ce_InvalidServiceIdentifierException, Z_STRVAL_P(offset), Z_STRLEN_P(offset) TSRMLS_CC);
745
- RETURN_NULL();
746
- }
747
- if (zend_hash_index_exists(&pobj->protected, value->handle_num)) {
748
- int er = EG(error_reporting);
749
- EG(error_reporting) = 0;
750
- php_error(E_DEPRECATED, "How Pimple behaves when extending protected closures will be fixed in Pimple 4. Are you sure \"%ld\" should be protected?", index);
751
- EG(error_reporting) = er;
752
- }
753
- break;
754
- case IS_NULL:
755
- default:
756
- zend_error(E_WARNING, "Unsupported offset type");
757
- }
758
-
759
- if (pimple_zval_is_valid_callback(callable, &bucket TSRMLS_CC) == FAILURE) {
760
- pimple_free_bucket(&bucket);
761
- zend_throw_exception(pimple_ce_ExpectedInvokableException, "Extension service definition is not a Closure or invokable object.", 0 TSRMLS_CC);
762
- RETURN_NULL();
763
- }
764
- pimple_free_bucket(&bucket);
765
-
766
- ALLOC_INIT_ZVAL(pimple_closure_obj);
767
- object_init_ex(pimple_closure_obj, pimple_closure_ce);
768
-
769
- pcobj = zend_object_store_get_object(pimple_closure_obj TSRMLS_CC);
770
- pcobj->callable = callable;
771
- pcobj->factory = value->value;
772
- Z_ADDREF_P(callable);
773
- Z_ADDREF_P(value->value);
774
-
775
- if (zend_hash_index_exists(&pobj->factories, value->handle_num)) {
776
- pimple_zval_to_pimpleval(pimple_closure_obj, &bucket TSRMLS_CC);
777
- zend_hash_index_del(&pobj->factories, value->handle_num);
778
- zend_hash_index_update(&pobj->factories, bucket.handle_num, (void *)&bucket, sizeof(pimple_bucket_value), NULL);
779
- Z_ADDREF_P(pimple_closure_obj);
780
- }
781
-
782
- pimple_object_write_dimension(getThis(), offset, pimple_closure_obj TSRMLS_CC);
783
-
784
- RETVAL_ZVAL(pimple_closure_obj, 1, 1);
785
- }
786
-
787
- PHP_METHOD(Pimple, keys)
788
- {
789
- HashPosition pos;
790
- pimple_object *pobj = NULL;
791
- zval **value = NULL;
792
- zval *endval = NULL;
793
- char *str_index = NULL;
794
- int str_len;
795
- ulong num_index;
796
-
797
- if (zend_parse_parameters_none() == FAILURE) {
798
- return;
799
- }
800
-
801
- pobj = zend_object_store_get_object(getThis() TSRMLS_CC);
802
- array_init_size(return_value, zend_hash_num_elements(&pobj->values));
803
-
804
- zend_hash_internal_pointer_reset_ex(&pobj->values, &pos);
805
-
806
- while(zend_hash_get_current_data_ex(&pobj->values, (void **)&value, &pos) == SUCCESS) {
807
- MAKE_STD_ZVAL(endval);
808
- switch (zend_hash_get_current_key_ex(&pobj->values, &str_index, (uint *)&str_len, &num_index, 0, &pos)) {
809
- case HASH_KEY_IS_STRING:
810
- ZVAL_STRINGL(endval, str_index, str_len - 1, 1);
811
- zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &endval, sizeof(zval *), NULL);
812
- break;
813
- case HASH_KEY_IS_LONG:
814
- ZVAL_LONG(endval, num_index);
815
- zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &endval, sizeof(zval *), NULL);
816
- break;
817
- }
818
- zend_hash_move_forward_ex(&pobj->values, &pos);
819
- }
820
- }
821
-
822
- PHP_METHOD(Pimple, factory)
823
- {
824
- zval *factory = NULL;
825
- pimple_object *pobj = NULL;
826
- pimple_bucket_value bucket = {0};
827
-
828
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &factory) == FAILURE) {
829
- return;
830
- }
831
-
832
- if (pimple_zval_is_valid_callback(factory, &bucket TSRMLS_CC) == FAILURE) {
833
- pimple_free_bucket(&bucket);
834
- zend_throw_exception(pimple_ce_ExpectedInvokableException, "Service definition is not a Closure or invokable object.", 0 TSRMLS_CC);
835
- return;
836
- }
837
-
838
- pimple_zval_to_pimpleval(factory, &bucket TSRMLS_CC);
839
- pobj = (pimple_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
840
-
841
- if (zend_hash_index_update(&pobj->factories, bucket.handle_num, (void *)&bucket, sizeof(pimple_bucket_value), NULL) == SUCCESS) {
842
- Z_ADDREF_P(factory);
843
- RETURN_ZVAL(factory, 1 , 0);
844
- } else {
845
- pimple_free_bucket(&bucket);
846
- }
847
-
848
- RETURN_FALSE;
849
- }
850
-
851
- PHP_METHOD(Pimple, offsetSet)
852
- {
853
- zval *offset = NULL, *value = NULL;
854
-
855
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &offset, &value) == FAILURE) {
856
- return;
857
- }
858
-
859
- pimple_object_write_dimension(getThis(), offset, value TSRMLS_CC);
860
- }
861
-
862
- PHP_METHOD(Pimple, offsetGet)
863
- {
864
- zval *offset = NULL, *retval = NULL;
865
-
866
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &offset) == FAILURE) {
867
- return;
868
- }
869
-
870
- retval = pimple_object_read_dimension(getThis(), offset, 0 TSRMLS_CC);
871
-
872
- RETVAL_ZVAL(retval, 1, 0);
873
- }
874
-
875
- PHP_METHOD(Pimple, offsetUnset)
876
- {
877
- zval *offset = NULL;
878
-
879
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &offset) == FAILURE) {
880
- return;
881
- }
882
-
883
- pimple_object_unset_dimension(getThis(), offset TSRMLS_CC);
884
- }
885
-
886
- PHP_METHOD(Pimple, offsetExists)
887
- {
888
- zval *offset = NULL;
889
-
890
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &offset) == FAILURE) {
891
- return;
892
- }
893
-
894
- RETVAL_BOOL(pimple_object_has_dimension(getThis(), offset, 1 TSRMLS_CC));
895
- }
896
-
897
- PHP_METHOD(Pimple, register)
898
- {
899
- zval *provider;
900
- zval **data;
901
- zval *retval = NULL;
902
- zval key;
903
-
904
- HashTable *array = NULL;
905
- HashPosition pos;
906
-
907
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|h", &provider, pimple_serviceprovider_ce, &array) == FAILURE) {
908
- return;
909
- }
910
-
911
- RETVAL_ZVAL(getThis(), 1, 0);
912
-
913
- zend_call_method_with_1_params(&provider, Z_OBJCE_P(provider), NULL, "register", &retval, getThis());
914
-
915
- if (retval) {
916
- zval_ptr_dtor(&retval);
917
- }
918
-
919
- if (!array) {
920
- return;
921
- }
922
-
923
- zend_hash_internal_pointer_reset_ex(array, &pos);
924
-
925
- while(zend_hash_get_current_data_ex(array, (void **)&data, &pos) == SUCCESS) {
926
- zend_hash_get_current_key_zval_ex(array, &key, &pos);
927
- pimple_object_write_dimension(getThis(), &key, *data TSRMLS_CC);
928
- zend_hash_move_forward_ex(array, &pos);
929
- }
930
- }
931
-
932
- PHP_METHOD(Pimple, __construct)
933
- {
934
- zval *values = NULL, **pData = NULL, offset;
935
- HashPosition pos;
936
- char *str_index = NULL;
937
- zend_uint str_length;
938
- ulong num_index;
939
-
940
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|a!", &values) == FAILURE) {
941
- return;
942
- }
943
-
944
- PIMPLE_DEPRECATE
945
-
946
- if (!values) {
947
- return;
948
- }
949
-
950
- zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(values), &pos);
951
- while (zend_hash_has_more_elements_ex(Z_ARRVAL_P(values), &pos) == SUCCESS) {
952
- zend_hash_get_current_data_ex(Z_ARRVAL_P(values), (void **)&pData, &pos);
953
- zend_hash_get_current_key_ex(Z_ARRVAL_P(values), &str_index, &str_length, &num_index, 0, &pos);
954
- INIT_ZVAL(offset);
955
- if (zend_hash_get_current_key_type_ex(Z_ARRVAL_P(values), &pos) == HASH_KEY_IS_LONG) {
956
- ZVAL_LONG(&offset, num_index);
957
- } else {
958
- ZVAL_STRINGL(&offset, str_index, (str_length - 1), 0);
959
- }
960
- pimple_object_write_dimension(getThis(), &offset, *pData TSRMLS_CC);
961
- zend_hash_move_forward_ex(Z_ARRVAL_P(values), &pos);
962
- }
963
- }
964
-
965
- /*
966
- * This is PHP code snippet handling extend()s calls :
967
-
968
- $extended = function ($c) use ($callable, $factory) {
969
- return $callable($factory($c), $c);
970
- };
971
-
972
- */
973
- PHP_METHOD(PimpleClosure, invoker)
974
- {
975
- pimple_closure_object *pcobj = NULL;
976
- zval *arg = NULL, *retval = NULL, *newretval = NULL;
977
- zend_fcall_info fci = {0};
978
- zval **args[2];
979
-
980
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &arg) == FAILURE) {
981
- return;
982
- }
983
-
984
- pcobj = zend_object_store_get_object(getThis() TSRMLS_CC);
985
-
986
- fci.function_name = pcobj->factory;
987
- args[0] = &arg;
988
- zend_fcall_info_argp(&fci TSRMLS_CC, 1, args);
989
- fci.retval_ptr_ptr = &retval;
990
- fci.size = sizeof(fci);
991
-
992
- if (zend_call_function(&fci, NULL TSRMLS_CC) == FAILURE || EG(exception)) {
993
- efree(fci.params);
994
- return; /* Should here return default zval */
995
- }
996
-
997
- efree(fci.params);
998
- memset(&fci, 0, sizeof(fci));
999
- fci.size = sizeof(fci);
1000
-
1001
- fci.function_name = pcobj->callable;
1002
- args[0] = &retval;
1003
- args[1] = &arg;
1004
- zend_fcall_info_argp(&fci TSRMLS_CC, 2, args);
1005
- fci.retval_ptr_ptr = &newretval;
1006
-
1007
- if (zend_call_function(&fci, NULL TSRMLS_CC) == FAILURE || EG(exception)) {
1008
- efree(fci.params);
1009
- zval_ptr_dtor(&retval);
1010
- return;
1011
- }
1012
-
1013
- efree(fci.params);
1014
- zval_ptr_dtor(&retval);
1015
-
1016
- RETVAL_ZVAL(newretval, 1 ,1);
1017
- }
1018
-
1019
- PHP_MINIT_FUNCTION(pimple)
1020
- {
1021
- zend_class_entry tmp_ce_PsrContainerInterface, tmp_ce_PsrContainerExceptionInterface, tmp_ce_PsrNotFoundExceptionInterface;
1022
- zend_class_entry tmp_ce_ExpectedInvokableException, tmp_ce_FrozenServiceException, tmp_ce_InvalidServiceIdentifierException, tmp_ce_UnknownIdentifierException;
1023
- zend_class_entry tmp_pimple_ce, tmp_pimple_closure_ce, tmp_pimple_serviceprovider_iface_ce;
1024
-
1025
- /* Psr\Container namespace */
1026
- INIT_NS_CLASS_ENTRY(tmp_ce_PsrContainerInterface, PSR_CONTAINER_NS, "ContainerInterface", pimple_ce_PsrContainerInterface_functions);
1027
- INIT_NS_CLASS_ENTRY(tmp_ce_PsrContainerExceptionInterface, PSR_CONTAINER_NS, "ContainerExceptionInterface", pimple_ce_PsrContainerExceptionInterface_functions);
1028
- INIT_NS_CLASS_ENTRY(tmp_ce_PsrNotFoundExceptionInterface, PSR_CONTAINER_NS, "NotFoundExceptionInterface", pimple_ce_PsrNotFoundExceptionInterface_functions);
1029
-
1030
- pimple_ce_PsrContainerInterface = zend_register_internal_interface(&tmp_ce_PsrContainerInterface TSRMLS_CC);
1031
- pimple_ce_PsrContainerExceptionInterface = zend_register_internal_interface(&tmp_ce_PsrContainerExceptionInterface TSRMLS_CC);
1032
- pimple_ce_PsrNotFoundExceptionInterface = zend_register_internal_interface(&tmp_ce_PsrNotFoundExceptionInterface TSRMLS_CC);
1033
-
1034
- zend_class_implements(pimple_ce_PsrNotFoundExceptionInterface TSRMLS_CC, 1, pimple_ce_PsrContainerExceptionInterface);
1035
-
1036
- /* Pimple\Exception namespace */
1037
- INIT_NS_CLASS_ENTRY(tmp_ce_ExpectedInvokableException, PIMPLE_EXCEPTION_NS, "ExpectedInvokableException", NULL);
1038
- INIT_NS_CLASS_ENTRY(tmp_ce_FrozenServiceException, PIMPLE_EXCEPTION_NS, "FrozenServiceException", pimple_ce_FrozenServiceException_functions);
1039
- INIT_NS_CLASS_ENTRY(tmp_ce_InvalidServiceIdentifierException, PIMPLE_EXCEPTION_NS, "InvalidServiceIdentifierException", pimple_ce_InvalidServiceIdentifierException_functions);
1040
- INIT_NS_CLASS_ENTRY(tmp_ce_UnknownIdentifierException, PIMPLE_EXCEPTION_NS, "UnknownIdentifierException", pimple_ce_UnknownIdentifierException_functions);
1041
-
1042
- pimple_ce_ExpectedInvokableException = zend_register_internal_class_ex(&tmp_ce_ExpectedInvokableException, spl_ce_InvalidArgumentException, NULL TSRMLS_CC);
1043
- pimple_ce_FrozenServiceException = zend_register_internal_class_ex(&tmp_ce_FrozenServiceException, spl_ce_RuntimeException, NULL TSRMLS_CC);
1044
- pimple_ce_InvalidServiceIdentifierException = zend_register_internal_class_ex(&tmp_ce_InvalidServiceIdentifierException, spl_ce_InvalidArgumentException, NULL TSRMLS_CC);
1045
- pimple_ce_UnknownIdentifierException = zend_register_internal_class_ex(&tmp_ce_UnknownIdentifierException, spl_ce_InvalidArgumentException, NULL TSRMLS_CC);
1046
-
1047
- zend_class_implements(pimple_ce_ExpectedInvokableException TSRMLS_CC, 1, pimple_ce_PsrContainerExceptionInterface);
1048
- zend_class_implements(pimple_ce_FrozenServiceException TSRMLS_CC, 1, pimple_ce_PsrContainerExceptionInterface);
1049
- zend_class_implements(pimple_ce_InvalidServiceIdentifierException TSRMLS_CC, 1, pimple_ce_PsrContainerExceptionInterface);
1050
- zend_class_implements(pimple_ce_UnknownIdentifierException TSRMLS_CC, 1, pimple_ce_PsrNotFoundExceptionInterface);
1051
-
1052
- /* Pimple namespace */
1053
- INIT_NS_CLASS_ENTRY(tmp_pimple_ce, PIMPLE_NS, "Container", pimple_ce_functions);
1054
- INIT_NS_CLASS_ENTRY(tmp_pimple_closure_ce, PIMPLE_NS, "ContainerClosure", NULL);
1055
- INIT_NS_CLASS_ENTRY(tmp_pimple_serviceprovider_iface_ce, PIMPLE_NS, "ServiceProviderInterface", pimple_serviceprovider_iface_ce_functions);
1056
-
1057
- tmp_pimple_ce.create_object = pimple_object_create;
1058
- tmp_pimple_closure_ce.create_object = pimple_closure_object_create;
1059
-
1060
- pimple_ce = zend_register_internal_class(&tmp_pimple_ce TSRMLS_CC);
1061
- zend_class_implements(pimple_ce TSRMLS_CC, 1, zend_ce_arrayaccess);
1062
-
1063
- pimple_closure_ce = zend_register_internal_class(&tmp_pimple_closure_ce TSRMLS_CC);
1064
- pimple_closure_ce->ce_flags |= ZEND_ACC_FINAL_CLASS;
1065
-
1066
- pimple_serviceprovider_ce = zend_register_internal_interface(&tmp_pimple_serviceprovider_iface_ce TSRMLS_CC);
1067
-
1068
- memcpy(&pimple_closure_object_handlers, zend_get_std_object_handlers(), sizeof(*zend_get_std_object_handlers()));
1069
- pimple_object_handlers = std_object_handlers;
1070
- pimple_closure_object_handlers.get_closure = pimple_closure_get_closure;
1071
-
1072
- pimple_closure_invoker_function.function_name = "Pimple closure internal invoker";
1073
- pimple_closure_invoker_function.fn_flags |= ZEND_ACC_CLOSURE;
1074
- pimple_closure_invoker_function.handler = ZEND_MN(PimpleClosure_invoker);
1075
- pimple_closure_invoker_function.num_args = 1;
1076
- pimple_closure_invoker_function.required_num_args = 1;
1077
- pimple_closure_invoker_function.scope = pimple_closure_ce;
1078
- pimple_closure_invoker_function.type = ZEND_INTERNAL_FUNCTION;
1079
- pimple_closure_invoker_function.module = &pimple_module_entry;
1080
-
1081
- return SUCCESS;
1082
- }
1083
-
1084
- PHP_MINFO_FUNCTION(pimple)
1085
- {
1086
- php_info_print_table_start();
1087
- php_info_print_table_header(2, "SensioLabs Pimple C support", "enabled");
1088
- php_info_print_table_row(2, "Pimple supported version", PIMPLE_VERSION);
1089
- php_info_print_table_end();
1090
-
1091
- php_info_print_box_start(0);
1092
- php_write((void *)ZEND_STRL("SensioLabs Pimple C support developed by Julien Pauli") TSRMLS_CC);
1093
- if (!sapi_module.phpinfo_as_text) {
1094
- php_write((void *)ZEND_STRL(sensiolabs_logo) TSRMLS_CC);
1095
- }
1096
- php_info_print_box_end();
1097
- }
1098
-
1099
- zend_module_entry pimple_module_entry = {
1100
- STANDARD_MODULE_HEADER,
1101
- "pimple",
1102
- NULL,
1103
- PHP_MINIT(pimple),
1104
- NULL,
1105
- NULL,
1106
- NULL,
1107
- PHP_MINFO(pimple),
1108
- PIMPLE_VERSION,
1109
- STANDARD_MODULE_PROPERTIES
1110
- };
1111
-
1112
- #ifdef COMPILE_DL_PIMPLE
1113
- ZEND_GET_MODULE(pimple)
1114
- #endif
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/vendor/pimple/pimple/ext/pimple/pimple_compat.h DELETED
@@ -1,81 +0,0 @@
1
-
2
- /*
3
- * This file is part of Pimple.
4
- *
5
- * Copyright (c) 2014 Fabien Potencier
6
- *
7
- * Permission is hereby granted, free of charge, to any person obtaining a copy
8
- * of this software and associated documentation files (the "Software"), to deal
9
- * in the Software without restriction, including without limitation the rights
10
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- * copies of the Software, and to permit persons to whom the Software is furnished
12
- * to do so, subject to the following conditions:
13
- *
14
- * The above copyright notice and this permission notice shall be included in all
15
- * copies or substantial portions of the Software.
16
- *
17
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
- * THE SOFTWARE.
24
- */
25
-
26
- #ifndef PIMPLE_COMPAT_H_
27
- #define PIMPLE_COMPAT_H_
28
-
29
- #include "Zend/zend_extensions.h" /* for ZEND_EXTENSION_API_NO */
30
-
31
- #define PHP_5_0_X_API_NO 220040412
32
- #define PHP_5_1_X_API_NO 220051025
33
- #define PHP_5_2_X_API_NO 220060519
34
- #define PHP_5_3_X_API_NO 220090626
35
- #define PHP_5_4_X_API_NO 220100525
36
- #define PHP_5_5_X_API_NO 220121212
37
- #define PHP_5_6_X_API_NO 220131226
38
-
39
- #define IS_PHP_56 ZEND_EXTENSION_API_NO == PHP_5_6_X_API_NO
40
- #define IS_AT_LEAST_PHP_56 ZEND_EXTENSION_API_NO >= PHP_5_6_X_API_NO
41
-
42
- #define IS_PHP_55 ZEND_EXTENSION_API_NO == PHP_5_5_X_API_NO
43
- #define IS_AT_LEAST_PHP_55 ZEND_EXTENSION_API_NO >= PHP_5_5_X_API_NO
44
-
45
- #define IS_PHP_54 ZEND_EXTENSION_API_NO == PHP_5_4_X_API_NO
46
- #define IS_AT_LEAST_PHP_54 ZEND_EXTENSION_API_NO >= PHP_5_4_X_API_NO
47
-
48
- #define IS_PHP_53 ZEND_EXTENSION_API_NO == PHP_5_3_X_API_NO
49
- #define IS_AT_LEAST_PHP_53 ZEND_EXTENSION_API_NO >= PHP_5_3_X_API_NO
50
-
51
- #if IS_PHP_53
52
- #define object_properties_init(obj, ce) do { \
53
- zend_hash_copy(obj->properties, &ce->default_properties, zval_copy_property_ctor(ce), NULL, sizeof(zval *)); \
54
- } while (0);
55
- #endif
56
-
57
- #define ZEND_OBJ_INIT(obj, ce) do { \
58
- zend_object_std_init(obj, ce TSRMLS_CC); \
59
- object_properties_init((obj), (ce)); \
60
- } while(0);
61
-
62
- #if IS_PHP_53 || IS_PHP_54
63
- static void zend_hash_get_current_key_zval_ex(const HashTable *ht, zval *key, HashPosition *pos) {
64
- Bucket *p;
65
-
66
- p = pos ? (*pos) : ht->pInternalPointer;
67
-
68
- if (!p) {
69
- Z_TYPE_P(key) = IS_NULL;
70
- } else if (p->nKeyLength) {
71
- Z_TYPE_P(key) = IS_STRING;
72
- Z_STRVAL_P(key) = estrndup(p->arKey, p->nKeyLength - 1);
73
- Z_STRLEN_P(key) = p->nKeyLength - 1;
74
- } else {
75
- Z_TYPE_P(key) = IS_LONG;
76
- Z_LVAL_P(key) = p->h;
77
- }
78
- }
79
- #endif
80
-
81
- #endif /* PIMPLE_COMPAT_H_ */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/vendor/pimple/pimple/src/Pimple/Tests/Fixtures/Invokable.php DELETED
@@ -1,38 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Pimple.
5
- *
6
- * Copyright (c) 2009 Fabien Potencier
7
- *
8
- * Permission is hereby granted, free of charge, to any person obtaining a copy
9
- * of this software and associated documentation files (the "Software"), to deal
10
- * in the Software without restriction, including without limitation the rights
11
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- * copies of the Software, and to permit persons to whom the Software is furnished
13
- * to do so, subject to the following conditions:
14
- *
15
- * The above copyright notice and this permission notice shall be included in all
16
- * copies or substantial portions of the Software.
17
- *
18
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- * THE SOFTWARE.
25
- */
26
-
27
- namespace Pimple\Tests\Fixtures;
28
-
29
- class Invokable
30
- {
31
- public function __invoke($value = null)
32
- {
33
- $service = new Service();
34
- $service->value = $value;
35
-
36
- return $service;
37
- }
38
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/vendor/pimple/pimple/src/Pimple/Tests/Fixtures/NonInvokable.php DELETED
@@ -1,34 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Pimple.
5
- *
6
- * Copyright (c) 2009 Fabien Potencier
7
- *
8
- * Permission is hereby granted, free of charge, to any person obtaining a copy
9
- * of this software and associated documentation files (the "Software"), to deal
10
- * in the Software without restriction, including without limitation the rights
11
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- * copies of the Software, and to permit persons to whom the Software is furnished
13
- * to do so, subject to the following conditions:
14
- *
15
- * The above copyright notice and this permission notice shall be included in all
16
- * copies or substantial portions of the Software.
17
- *
18
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- * THE SOFTWARE.
25
- */
26
-
27
- namespace Pimple\Tests\Fixtures;
28
-
29
- class NonInvokable
30
- {
31
- public function __call($a, $b)
32
- {
33
- }
34
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/vendor/pimple/pimple/src/Pimple/Tests/Fixtures/PimpleServiceProvider.php DELETED
@@ -1,54 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Pimple.
5
- *
6
- * Copyright (c) 2009 Fabien Potencier
7
- *
8
- * Permission is hereby granted, free of charge, to any person obtaining a copy
9
- * of this software and associated documentation files (the "Software"), to deal
10
- * in the Software without restriction, including without limitation the rights
11
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- * copies of the Software, and to permit persons to whom the Software is furnished
13
- * to do so, subject to the following conditions:
14
- *
15
- * The above copyright notice and this permission notice shall be included in all
16
- * copies or substantial portions of the Software.
17
- *
18
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- * THE SOFTWARE.
25
- */
26
-
27
- namespace Pimple\Tests\Fixtures;
28
-
29
- use Pimple\Container;
30
- use Pimple\ServiceProviderInterface;
31
-
32
- class PimpleServiceProvider implements ServiceProviderInterface
33
- {
34
- /**
35
- * Registers services on the given container.
36
- *
37
- * This method should only be used to configure services and parameters.
38
- * It should not get services.
39
- *
40
- * @param Container $pimple An Container instance
41
- */
42
- public function register(Container $pimple)
43
- {
44
- $pimple['param'] = 'value';
45
-
46
- $pimple['service'] = function () {
47
- return new Service();
48
- };
49
-
50
- $pimple['factory'] = $pimple->factory(function () {
51
- return new Service();
52
- });
53
- }
54
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/vendor/pimple/pimple/src/Pimple/Tests/Fixtures/Service.php DELETED
@@ -1,35 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Pimple.
5
- *
6
- * Copyright (c) 2009 Fabien Potencier
7
- *
8
- * Permission is hereby granted, free of charge, to any person obtaining a copy
9
- * of this software and associated documentation files (the "Software"), to deal
10
- * in the Software without restriction, including without limitation the rights
11
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- * copies of the Software, and to permit persons to whom the Software is furnished
13
- * to do so, subject to the following conditions:
14
- *
15
- * The above copyright notice and this permission notice shall be included in all
16
- * copies or substantial portions of the Software.
17
- *
18
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- * THE SOFTWARE.
25
- */
26
-
27
- namespace Pimple\Tests\Fixtures;
28
-
29
- /**
30
- * @author Igor Wiedler <igor@wiedler.ch>
31
- */
32
- class Service
33
- {
34
- public $value;
35
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/vendor/pimple/pimple/src/Pimple/Tests/PimpleServiceProviderInterfaceTest.php DELETED
@@ -1,76 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Pimple.
5
- *
6
- * Copyright (c) 2009 Fabien Potencier
7
- *
8
- * Permission is hereby granted, free of charge, to any person obtaining a copy
9
- * of this software and associated documentation files (the "Software"), to deal
10
- * in the Software without restriction, including without limitation the rights
11
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- * copies of the Software, and to permit persons to whom the Software is furnished
13
- * to do so, subject to the following conditions:
14
- *
15
- * The above copyright notice and this permission notice shall be included in all
16
- * copies or substantial portions of the Software.
17
- *
18
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- * THE SOFTWARE.
25
- */
26
-
27
- namespace Pimple\Tests;
28
-
29
- use Pimple\Container;
30
-
31
- /**
32
- * @author Dominik Zogg <dominik.zogg@gmail.com>
33
- */
34
- class PimpleServiceProviderInterfaceTest extends \PHPUnit_Framework_TestCase
35
- {
36
- public function testProvider()
37
- {
38
- $pimple = new Container();
39
-
40
- $pimpleServiceProvider = new Fixtures\PimpleServiceProvider();
41
- $pimpleServiceProvider->register($pimple);
42
-
43
- $this->assertEquals('value', $pimple['param']);
44
- $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $pimple['service']);
45
-
46
- $serviceOne = $pimple['factory'];
47
- $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceOne);
48
-
49
- $serviceTwo = $pimple['factory'];
50
- $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceTwo);
51
-
52
- $this->assertNotSame($serviceOne, $serviceTwo);
53
- }
54
-
55
- public function testProviderWithRegisterMethod()
56
- {
57
- $pimple = new Container();
58
-
59
- $pimple->register(new Fixtures\PimpleServiceProvider(), array(
60
- 'anotherParameter' => 'anotherValue',
61
- ));
62
-
63
- $this->assertEquals('value', $pimple['param']);
64
- $this->assertEquals('anotherValue', $pimple['anotherParameter']);
65
-
66
- $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $pimple['service']);
67
-
68
- $serviceOne = $pimple['factory'];
69
- $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceOne);
70
-
71
- $serviceTwo = $pimple['factory'];
72
- $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceTwo);
73
-
74
- $this->assertNotSame($serviceOne, $serviceTwo);
75
- }
76
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/vendor/pimple/pimple/src/Pimple/Tests/PimpleTest.php DELETED
@@ -1,589 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Pimple.
5
- *
6
- * Copyright (c) 2009 Fabien Potencier
7
- *
8
- * Permission is hereby granted, free of charge, to any person obtaining a copy
9
- * of this software and associated documentation files (the "Software"), to deal
10
- * in the Software without restriction, including without limitation the rights
11
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- * copies of the Software, and to permit persons to whom the Software is furnished
13
- * to do so, subject to the following conditions:
14
- *
15
- * The above copyright notice and this permission notice shall be included in all
16
- * copies or substantial portions of the Software.
17
- *
18
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- * THE SOFTWARE.
25
- */
26
-
27
- namespace Pimple\Tests;
28
-
29
- use Pimple\Container;
30
-
31
- /**
32
- * @author Igor Wiedler <igor@wiedler.ch>
33
- */
34
- class PimpleTest extends \PHPUnit_Framework_TestCase
35
- {
36
- public function testWithString()
37
- {
38
- $pimple = new Container();
39
- $pimple['param'] = 'value';
40
-
41
- $this->assertEquals('value', $pimple['param']);
42
- }
43
-
44
- public function testWithClosure()
45
- {
46
- $pimple = new Container();
47
- $pimple['service'] = function () {
48
- return new Fixtures\Service();
49
- };
50
-
51
- $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $pimple['service']);
52
- }
53
-
54
- public function testServicesShouldBeDifferent()
55
- {
56
- $pimple = new Container();
57
- $pimple['service'] = $pimple->factory(function () {
58
- return new Fixtures\Service();
59
- });
60
-
61
- $serviceOne = $pimple['service'];
62
- $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceOne);
63
-
64
- $serviceTwo = $pimple['service'];
65
- $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceTwo);
66
-
67
- $this->assertNotSame($serviceOne, $serviceTwo);
68
- }
69
-
70
- public function testShouldPassContainerAsParameter()
71
- {
72
- $pimple = new Container();
73
- $pimple['service'] = function () {
74
- return new Fixtures\Service();
75
- };
76
- $pimple['container'] = function ($container) {
77
- return $container;
78
- };
79
-
80
- $this->assertNotSame($pimple, $pimple['service']);
81
- $this->assertSame($pimple, $pimple['container']);
82
- }
83
-
84
- public function testIsset()
85
- {
86
- $pimple = new Container();
87
- $pimple['param'] = 'value';
88
- $pimple['service'] = function () {
89
- return new Fixtures\Service();
90
- };
91
-
92
- $pimple['null'] = null;
93
-
94
- $this->assertTrue(isset($pimple['param']));
95
- $this->assertTrue(isset($pimple['service']));
96
- $this->assertTrue(isset($pimple['null']));
97
- $this->assertFalse(isset($pimple['non_existent']));
98
- }
99
-
100
- public function testConstructorInjection()
101
- {
102
- $params = array('param' => 'value');
103
- $pimple = new Container($params);
104
-
105
- $this->assertSame($params['param'], $pimple['param']);
106
- }
107
-
108
- /**
109
- * @expectedException \Pimple\Exception\UnknownIdentifierException
110
- * @expectedExceptionMessage Identifier "foo" is not defined.
111
- */
112
- public function testOffsetGetValidatesKeyIsPresent()
113
- {
114
- $pimple = new Container();
115
- echo $pimple['foo'];
116
- }
117
-
118
- /**
119
- * @group legacy
120
- * @expectedException \InvalidArgumentException
121
- * @expectedExceptionMessage Identifier "foo" is not defined.
122
- */
123
- public function testLegacyOffsetGetValidatesKeyIsPresent()
124
- {
125
- $pimple = new Container();
126
- echo $pimple['foo'];
127
- }
128
-
129
- public function testOffsetGetHonorsNullValues()
130
- {
131
- $pimple = new Container();
132
- $pimple['foo'] = null;
133
- $this->assertNull($pimple['foo']);
134
- }
135
-
136
- public function testUnset()
137
- {
138
- $pimple = new Container();
139
- $pimple['param'] = 'value';
140
- $pimple['service'] = function () {
141
- return new Fixtures\Service();
142
- };
143
-
144
- unset($pimple['param'], $pimple['service']);
145
- $this->assertFalse(isset($pimple['param']));
146
- $this->assertFalse(isset($pimple['service']));
147
- }
148
-
149
- /**
150
- * @dataProvider serviceDefinitionProvider
151
- */
152
- public function testShare($service)
153
- {
154
- $pimple = new Container();
155
- $pimple['shared_service'] = $service;
156
-
157
- $serviceOne = $pimple['shared_service'];
158
- $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceOne);
159
-
160
- $serviceTwo = $pimple['shared_service'];
161
- $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceTwo);
162
-
163
- $this->assertSame($serviceOne, $serviceTwo);
164
- }
165
-
166
- /**
167
- * @dataProvider serviceDefinitionProvider
168
- */
169
- public function testProtect($service)
170
- {
171
- $pimple = new Container();
172
- $pimple['protected'] = $pimple->protect($service);
173
-
174
- $this->assertSame($service, $pimple['protected']);
175
- }
176
-
177
- public function testGlobalFunctionNameAsParameterValue()
178
- {
179
- $pimple = new Container();
180
- $pimple['global_function'] = 'strlen';
181
- $this->assertSame('strlen', $pimple['global_function']);
182
- }
183
-
184
- public function testRaw()
185
- {
186
- $pimple = new Container();
187
- $pimple['service'] = $definition = $pimple->factory(function () { return 'foo'; });
188
- $this->assertSame($definition, $pimple->raw('service'));
189
- }
190
-
191
- public function testRawHonorsNullValues()
192
- {
193
- $pimple = new Container();
194
- $pimple['foo'] = null;
195
- $this->assertNull($pimple->raw('foo'));
196
- }
197
-
198
- public function testFluentRegister()
199
- {
200
- $pimple = new Container();
201
- $this->assertSame($pimple, $pimple->register($this->getMockBuilder('Pimple\ServiceProviderInterface')->getMock()));
202
- }
203
-
204
- /**
205
- * @expectedException \Pimple\Exception\UnknownIdentifierException
206
- * @expectedExceptionMessage Identifier "foo" is not defined.
207
- */
208
- public function testRawValidatesKeyIsPresent()
209
- {
210
- $pimple = new Container();
211
- $pimple->raw('foo');
212
- }
213
-
214
- /**
215
- * @group legacy
216
- * @expectedException \InvalidArgumentException
217
- * @expectedExceptionMessage Identifier "foo" is not defined.
218
- */
219
- public function testLegacyRawValidatesKeyIsPresent()
220
- {
221
- $pimple = new Container();
222
- $pimple->raw('foo');
223
- }
224
-
225
- /**
226
- * @dataProvider serviceDefinitionProvider
227
- */
228
- public function testExtend($service)
229
- {
230
- $pimple = new Container();
231
- $pimple['shared_service'] = function () {
232
- return new Fixtures\Service();
233
- };
234
- $pimple['factory_service'] = $pimple->factory(function () {
235
- return new Fixtures\Service();
236
- });
237
-
238
- $pimple->extend('shared_service', $service);
239
- $serviceOne = $pimple['shared_service'];
240
- $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceOne);
241
- $serviceTwo = $pimple['shared_service'];
242
- $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceTwo);
243
- $this->assertSame($serviceOne, $serviceTwo);
244
- $this->assertSame($serviceOne->value, $serviceTwo->value);
245
-
246
- $pimple->extend('factory_service', $service);
247
- $serviceOne = $pimple['factory_service'];
248
- $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceOne);
249
- $serviceTwo = $pimple['factory_service'];
250
- $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceTwo);
251
- $this->assertNotSame($serviceOne, $serviceTwo);
252
- $this->assertNotSame($serviceOne->value, $serviceTwo->value);
253
- }
254
-
255
- public function testExtendDoesNotLeakWithFactories()
256
- {
257
- if (extension_loaded('pimple')) {
258
- $this->markTestSkipped('Pimple extension does not support this test');
259
- }
260
- $pimple = new Container();
261
-
262
- $pimple['foo'] = $pimple->factory(function () { return; });
263
- $pimple['foo'] = $pimple->extend('foo', function ($foo, $pimple) { return; });
264
- unset($pimple['foo']);
265
-
266
- $p = new \ReflectionProperty($pimple, 'values');
267
- $p->setAccessible(true);
268
- $this->assertEmpty($p->getValue($pimple));
269
-
270
- $p = new \ReflectionProperty($pimple, 'factories');
271
- $p->setAccessible(true);
272
- $this->assertCount(0, $p->getValue($pimple));
273
- }
274
-
275
- /**
276
- * @expectedException \Pimple\Exception\UnknownIdentifierException
277
- * @expectedExceptionMessage Identifier "foo" is not defined.
278
- */
279
- public function testExtendValidatesKeyIsPresent()
280
- {
281
- $pimple = new Container();
282
- $pimple->extend('foo', function () {});
283
- }
284
-
285
- /**
286
- * @group legacy
287
- * @expectedException \InvalidArgumentException
288
- * @expectedExceptionMessage Identifier "foo" is not defined.
289
- */
290
- public function testLegacyExtendValidatesKeyIsPresent()
291
- {
292
- $pimple = new Container();
293
- $pimple->extend('foo', function () {});
294
- }
295
-
296
- public function testKeys()
297
- {
298
- $pimple = new Container();
299
- $pimple['foo'] = 123;
300
- $pimple['bar'] = 123;
301
-
302
- $this->assertEquals(array('foo', 'bar'), $pimple->keys());
303
- }
304
-
305
- /** @test */
306
- public function settingAnInvokableObjectShouldTreatItAsFactory()
307
- {
308
- $pimple = new Container();
309
- $pimple['invokable'] = new Fixtures\Invokable();
310
-
311
- $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $pimple['invokable']);
312
- }
313
-
314
- /** @test */
315
- public function settingNonInvokableObjectShouldTreatItAsParameter()
316
- {
317
- $pimple = new Container();
318
- $pimple['non_invokable'] = new Fixtures\NonInvokable();
319
-
320
- $this->assertInstanceOf('Pimple\Tests\Fixtures\NonInvokable', $pimple['non_invokable']);
321
- }
322
-
323
- /**
324
- * @dataProvider badServiceDefinitionProvider
325
- * @expectedException \Pimple\Exception\ExpectedInvokableException
326
- * @expectedExceptionMessage Service definition is not a Closure or invokable object.
327
- */
328
- public function testFactoryFailsForInvalidServiceDefinitions($service)
329
- {
330
- $pimple = new Container();
331
- $pimple->factory($service);
332
- }
333
-
334
- /**
335
- * @group legacy
336
- * @dataProvider badServiceDefinitionProvider
337
- * @expectedException \InvalidArgumentException
338
- * @expectedExceptionMessage Service definition is not a Closure or invokable object.
339
- */
340
- public function testLegacyFactoryFailsForInvalidServiceDefinitions($service)
341
- {
342
- $pimple = new Container();
343
- $pimple->factory($service);
344
- }
345
-
346
- /**
347
- * @dataProvider badServiceDefinitionProvider
348
- * @expectedException \Pimple\Exception\ExpectedInvokableException
349
- * @expectedExceptionMessage Callable is not a Closure or invokable object.
350
- */
351
- public function testProtectFailsForInvalidServiceDefinitions($service)
352
- {
353
- $pimple = new Container();
354
- $pimple->protect($service);
355
- }
356
-
357
- /**
358
- * @group legacy
359
- * @dataProvider badServiceDefinitionProvider
360
- * @expectedException \InvalidArgumentException
361
- * @expectedExceptionMessage Callable is not a Closure or invokable object.
362
- */
363
- public function testLegacyProtectFailsForInvalidServiceDefinitions($service)
364
- {
365
- $pimple = new Container();
366
- $pimple->protect($service);
367
- }
368
-
369
- /**
370
- * @dataProvider badServiceDefinitionProvider
371
- * @expectedException \Pimple\Exception\InvalidServiceIdentifierException
372
- * @expectedExceptionMessage Identifier "foo" does not contain an object definition.
373
- */
374
- public function testExtendFailsForKeysNotContainingServiceDefinitions($service)
375
- {
376
- $pimple = new Container();
377
- $pimple['foo'] = $service;
378
- $pimple->extend('foo', function () {});
379
- }
380
-
381
- /**
382
- * @group legacy
383
- * @dataProvider badServiceDefinitionProvider
384
- * @expectedException \InvalidArgumentException
385
- * @expectedExceptionMessage Identifier "foo" does not contain an object definition.
386
- */
387
- public function testLegacyExtendFailsForKeysNotContainingServiceDefinitions($service)
388
- {
389
- $pimple = new Container();
390
- $pimple['foo'] = $service;
391
- $pimple->extend('foo', function () {});
392
- }
393
-
394
- /**
395
- * @group legacy
396
- * @expectedDeprecation How Pimple behaves when extending protected closures will be fixed in Pimple 4. Are you sure "foo" should be protected?
397
- */
398
- public function testExtendingProtectedClosureDeprecation()
399
- {
400
- $pimple = new Container();
401
- $pimple['foo'] = $pimple->protect(function () {
402
- return 'bar';
403
- });
404
-
405
- $pimple->extend('foo', function ($value) {
406
- return $value.'-baz';
407
- });
408
-
409
- $this->assertSame('bar-baz', $pimple['foo']);
410
- }
411
-
412
- /**
413
- * @dataProvider badServiceDefinitionProvider
414
- * @expectedException \Pimple\Exception\ExpectedInvokableException
415
- * @expectedExceptionMessage Extension service definition is not a Closure or invokable object.
416
- */
417
- public function testExtendFailsForInvalidServiceDefinitions($service)
418
- {
419
- $pimple = new Container();
420
- $pimple['foo'] = function () {};
421
- $pimple->extend('foo', $service);
422
- }
423
-
424
- /**
425
- * @group legacy
426
- * @dataProvider badServiceDefinitionProvider
427
- * @expectedException \InvalidArgumentException
428
- * @expectedExceptionMessage Extension service definition is not a Closure or invokable object.
429
- */
430
- public function testLegacyExtendFailsForInvalidServiceDefinitions($service)
431
- {
432
- $pimple = new Container();
433
- $pimple['foo'] = function () {};
434
- $pimple->extend('foo', $service);
435
- }
436
-
437
- /**
438
- * @expectedException \Pimple\Exception\FrozenServiceException
439
- * @expectedExceptionMessage Cannot override frozen service "foo".
440
- */
441
- public function testExtendFailsIfFrozenServiceIsNonInvokable()
442
- {
443
- $pimple = new Container();
444
- $pimple['foo'] = function () {
445
- return new Fixtures\NonInvokable();
446
- };
447
- $foo = $pimple['foo'];
448
-
449
- $pimple->extend('foo', function () {});
450
- }
451
-
452
- /**
453
- * @expectedException \Pimple\Exception\FrozenServiceException
454
- * @expectedExceptionMessage Cannot override frozen service "foo".
455
- */
456
- public function testExtendFailsIfFrozenServiceIsInvokable()
457
- {
458
- $pimple = new Container();
459
- $pimple['foo'] = function () {
460
- return new Fixtures\Invokable();
461
- };
462
- $foo = $pimple['foo'];
463
-
464
- $pimple->extend('foo', function () {});
465
- }
466
-
467
- /**
468
- * Provider for invalid service definitions.
469
- */
470
- public function badServiceDefinitionProvider()
471
- {
472
- return array(
473
- array(123),
474
- array(new Fixtures\NonInvokable()),
475
- );
476
- }
477
-
478
- /**
479
- * Provider for service definitions.
480
- */
481
- public function serviceDefinitionProvider()
482
- {
483
- return array(
484
- array(function ($value) {
485
- $service = new Fixtures\Service();
486
- $service->value = $value;
487
-
488
- return $service;
489
- }),
490
- array(new Fixtures\Invokable()),
491
- );
492
- }
493
-
494
- public function testDefiningNewServiceAfterFreeze()
495
- {
496
- $pimple = new Container();
497
- $pimple['foo'] = function () {
498
- return 'foo';
499
- };
500
- $foo = $pimple['foo'];
501
-
502
- $pimple['bar'] = function () {
503
- return 'bar';
504
- };
505
- $this->assertSame('bar', $pimple['bar']);
506
- }
507
-
508
- /**
509
- * @expectedException \Pimple\Exception\FrozenServiceException
510
- * @expectedExceptionMessage Cannot override frozen service "foo".
511
- */
512
- public function testOverridingServiceAfterFreeze()
513
- {
514
- $pimple = new Container();
515
- $pimple['foo'] = function () {
516
- return 'foo';
517
- };
518
- $foo = $pimple['foo'];
519
-
520
- $pimple['foo'] = function () {
521
- return 'bar';
522
- };
523
- }
524
-
525
- /**
526
- * @group legacy
527
- * @expectedException \RuntimeException
528
- * @expectedExceptionMessage Cannot override frozen service "foo".
529
- */
530
- public function testLegacyOverridingServiceAfterFreeze()
531
- {
532
- $pimple = new Container();
533
- $pimple['foo'] = function () {
534
- return 'foo';
535
- };
536
- $foo = $pimple['foo'];
537
-
538
- $pimple['foo'] = function () {
539
- return 'bar';
540
- };
541
- }
542
-
543
- public function testRemovingServiceAfterFreeze()
544
- {
545
- $pimple = new Container();
546
- $pimple['foo'] = function () {
547
- return 'foo';
548
- };
549
- $foo = $pimple['foo'];
550
-
551
- unset($pimple['foo']);
552
- $pimple['foo'] = function () {
553
- return 'bar';
554
- };
555
- $this->assertSame('bar', $pimple['foo']);
556
- }
557
-
558
- public function testExtendingService()
559
- {
560
- $pimple = new Container();
561
- $pimple['foo'] = function () {
562
- return 'foo';
563
- };
564
- $pimple['foo'] = $pimple->extend('foo', function ($foo, $app) {
565
- return "$foo.bar";
566
- });
567
- $pimple['foo'] = $pimple->extend('foo', function ($foo, $app) {
568
- return "$foo.baz";
569
- });
570
- $this->assertSame('foo.bar.baz', $pimple['foo']);
571
- }
572
-
573
- public function testExtendingServiceAfterOtherServiceFreeze()
574
- {
575
- $pimple = new Container();
576
- $pimple['foo'] = function () {
577
- return 'foo';
578
- };
579
- $pimple['bar'] = function () {
580
- return 'bar';
581
- };
582
- $foo = $pimple['foo'];
583
-
584
- $pimple['bar'] = $pimple->extend('bar', function ($bar, $app) {
585
- return "$bar.baz";
586
- });
587
- $this->assertSame('bar.baz', $pimple['bar']);
588
- }
589
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/vendor/pimple/pimple/src/Pimple/Tests/Psr11/ContainerTest.php DELETED
@@ -1,77 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Pimple.
5
- *
6
- * Copyright (c) 2009-2017 Fabien Potencier
7
- *
8
- * Permission is hereby granted, free of charge, to any person obtaining a copy
9
- * of this software and associated documentation files (the "Software"), to deal
10
- * in the Software without restriction, including without limitation the rights
11
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- * copies of the Software, and to permit persons to whom the Software is furnished
13
- * to do so, subject to the following conditions:
14
- *
15
- * The above copyright notice and this permission notice shall be included in all
16
- * copies or substantial portions of the Software.
17
- *
18
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- * THE SOFTWARE.
25
- */
26
-
27
- namespace Pimple\Tests\Psr11;
28
-
29
- use PHPUnit\Framework\TestCase;
30
- use Pimple\Container;
31
- use Pimple\Psr11\Container as PsrContainer;
32
- use Pimple\Tests\Fixtures\Service;
33
-
34
- class ContainerTest extends TestCase
35
- {
36
- public function testGetReturnsExistingService()
37
- {
38
- $pimple = new Container();
39
- $pimple['service'] = function () {
40
- return new Service();
41
- };
42
- $psr = new PsrContainer($pimple);
43
-
44
- $this->assertSame($pimple['service'], $psr->get('service'));
45
- }
46
-
47
- /**
48
- * @expectedException \Psr\Container\NotFoundExceptionInterface
49
- * @expectedExceptionMessage Identifier "service" is not defined.
50
- */
51
- public function testGetThrowsExceptionIfServiceIsNotFound()
52
- {
53
- $pimple = new Container();
54
- $psr = new PsrContainer($pimple);
55
-
56
- $psr->get('service');
57
- }
58
-
59
- public function testHasReturnsTrueIfServiceExists()
60
- {
61
- $pimple = new Container();
62
- $pimple['service'] = function () {
63
- return new Service();
64
- };
65
- $psr = new PsrContainer($pimple);
66
-
67
- $this->assertTrue($psr->has('service'));
68
- }
69
-
70
- public function testHasReturnsFalseIfServiceDoesNotExist()
71
- {
72
- $pimple = new Container();
73
- $psr = new PsrContainer($pimple);
74
-
75
- $this->assertFalse($psr->has('service'));
76
- }
77
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/vendor/pimple/pimple/src/Pimple/Tests/Psr11/ServiceLocatorTest.php DELETED
@@ -1,134 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Pimple.
5
- *
6
- * Copyright (c) 2009 Fabien Potencier
7
- *
8
- * Permission is hereby granted, free of charge, to any person obtaining a copy
9
- * of this software and associated documentation files (the "Software"), to deal
10
- * in the Software without restriction, including without limitation the rights
11
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- * copies of the Software, and to permit persons to whom the Software is furnished
13
- * to do so, subject to the following conditions:
14
- *
15
- * The above copyright notice and this permission notice shall be included in all
16
- * copies or substantial portions of the Software.
17
- *
18
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- * THE SOFTWARE.
25
- */
26
-
27
- namespace Pimple\Tests\Psr11;
28
-
29
- use PHPUnit\Framework\TestCase;
30
- use Pimple\Container;
31
- use Pimple\Psr11\ServiceLocator;
32
- use Pimple\Tests\Fixtures;
33
-
34
- /**
35
- * ServiceLocator test case.
36
- *
37
- * @author Pascal Luna <skalpa@zetareticuli.org>
38
- */
39
- class ServiceLocatorTest extends TestCase
40
- {
41
- public function testCanAccessServices()
42
- {
43
- $pimple = new Container();
44
- $pimple['service'] = function () {
45
- return new Fixtures\Service();
46
- };
47
- $locator = new ServiceLocator($pimple, array('service'));
48
-
49
- $this->assertSame($pimple['service'], $locator->get('service'));
50
- }
51
-
52
- public function testCanAccessAliasedServices()
53
- {
54
- $pimple = new Container();
55
- $pimple['service'] = function () {
56
- return new Fixtures\Service();
57
- };
58
- $locator = new ServiceLocator($pimple, array('alias' => 'service'));
59
-
60
- $this->assertSame($pimple['service'], $locator->get('alias'));
61
- }
62
-
63
- /**
64
- * @expectedException \Pimple\Exception\UnknownIdentifierException
65
- * @expectedExceptionMessage Identifier "service" is not defined.
66
- */
67
- public function testCannotAccessAliasedServiceUsingRealIdentifier()
68
- {
69
- $pimple = new Container();
70
- $pimple['service'] = function () {
71
- return new Fixtures\Service();
72
- };
73
- $locator = new ServiceLocator($pimple, array('alias' => 'service'));
74
-
75
- $service = $locator->get('service');
76
- }
77
-
78
- /**
79
- * @expectedException \Pimple\Exception\UnknownIdentifierException
80
- * @expectedExceptionMessage Identifier "foo" is not defined.
81
- */
82
- public function testGetValidatesServiceCanBeLocated()
83
- {
84
- $pimple = new Container();
85
- $pimple['service'] = function () {
86
- return new Fixtures\Service();
87
- };
88
- $locator = new ServiceLocator($pimple, array('alias' => 'service'));
89
-
90
- $service = $locator->get('foo');
91
- }
92
-
93
- /**
94
- * @expectedException \Pimple\Exception\UnknownIdentifierException
95
- * @expectedExceptionMessage Identifier "invalid" is not defined.
96
- */
97
- public function testGetValidatesTargetServiceExists()
98
- {
99
- $pimple = new Container();
100
- $pimple['service'] = function () {
101
- return new Fixtures\Service();
102
- };
103
- $locator = new ServiceLocator($pimple, array('alias' => 'invalid'));
104
-
105
- $service = $locator->get('alias');
106
- }
107
-
108
- public function testHasValidatesServiceCanBeLocated()
109
- {
110
- $pimple = new Container();
111
- $pimple['service1'] = function () {
112
- return new Fixtures\Service();
113
- };
114
- $pimple['service2'] = function () {
115
- return new Fixtures\Service();
116
- };
117
- $locator = new ServiceLocator($pimple, array('service1'));
118
-
119
- $this->assertTrue($locator->has('service1'));
120
- $this->assertFalse($locator->has('service2'));
121
- }
122
-
123
- public function testHasChecksIfTargetServiceExists()
124
- {
125
- $pimple = new Container();
126
- $pimple['service'] = function () {
127
- return new Fixtures\Service();
128
- };
129
- $locator = new ServiceLocator($pimple, array('foo' => 'service', 'bar' => 'invalid'));
130
-
131
- $this->assertTrue($locator->has('foo'));
132
- $this->assertFalse($locator->has('bar'));
133
- }
134
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/vendor/pimple/pimple/src/Pimple/Tests/ServiceIteratorTest.php DELETED
@@ -1,52 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Pimple.
5
- *
6
- * Copyright (c) 2009 Fabien Potencier
7
- *
8
- * Permission is hereby granted, free of charge, to any person obtaining a copy
9
- * of this software and associated documentation files (the "Software"), to deal
10
- * in the Software without restriction, including without limitation the rights
11
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- * copies of the Software, and to permit persons to whom the Software is furnished
13
- * to do so, subject to the following conditions:
14
- *
15
- * The above copyright notice and this permission notice shall be included in all
16
- * copies or substantial portions of the Software.
17
- *
18
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- * THE SOFTWARE.
25
- */
26
-
27
- namespace Pimple\Tests;
28
-
29
- use PHPUnit\Framework\TestCase;
30
- use Pimple\Container;
31
- use Pimple\ServiceIterator;
32
- use Pimple\Tests\Fixtures\Service;
33
-
34
- class ServiceIteratorTest extends TestCase
35
- {
36
- public function testIsIterable()
37
- {
38
- $pimple = new Container();
39
- $pimple['service1'] = function () {
40
- return new Service();
41
- };
42
- $pimple['service2'] = function () {
43
- return new Service();
44
- };
45
- $pimple['service3'] = function () {
46
- return new Service();
47
- };
48
- $iterator = new ServiceIterator($pimple, array('service1', 'service2'));
49
-
50
- $this->assertSame(array('service1' => $pimple['service1'], 'service2' => $pimple['service2']), iterator_to_array($iterator));
51
- }
52
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
litespeed-cache.php CHANGED
@@ -15,7 +15,7 @@
15
  * Plugin Name: LiteSpeed Cache
16
  * Plugin URI: https://www.litespeedtech.com/products/cache-plugins/wordpress-acceleration
17
  * Description: WordPress plugin to connect to LSCache on LiteSpeed Web Server.
18
- * Version: 1.6.7
19
  * Author: LiteSpeed Technologies
20
  * Author URI: https://www.litespeedtech.com
21
  * License: GPLv3
15
  * Plugin Name: LiteSpeed Cache
16
  * Plugin URI: https://www.litespeedtech.com/products/cache-plugins/wordpress-acceleration
17
  * Description: WordPress plugin to connect to LSCache on LiteSpeed Web Server.
18
+ * Version: 1.7.2
19
  * Author: LiteSpeed Technologies
20
  * Author URI: https://www.litespeedtech.com
21
  * License: GPLv3
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: LiteSpeedTech
3
  Tags: cache, wp-cache, litespeed, super cache, http2, total cache, wordfence
4
  Requires at least: 4.0
5
  Tested up to: 4.9.1
6
- Stable tag: 1.6.7
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl.html
9
 
@@ -58,6 +58,8 @@ LiteSpeed Web Server Enterprise, LiteSpeed Web ADC and OpenLiteSpeed:
58
  * HTTP/2 Push for CSS and JS
59
  * Database Cleaner and Optimizer
60
  * Browser Cache
 
 
61
  * Automatic page caching to greatly improve site performance
62
  * Automatic purge of related pages based on certain events
63
  * Smart preload crawler with support for SEO-friendly sitemap
@@ -79,6 +81,8 @@ LiteSpeed Web Server Enterprise Edition and LiteSpeed Web ADC Only:
79
  * Supports [QUIC](https://blog.litespeedtech.com/2017/07/11/litespeed-announces-quic-support/) right out of the box
80
  * Supports ESI cache
81
 
 
 
82
  == Third Party Compatibility ==
83
 
84
  The vast majority of plugins and themes are compatible with LSCache. Our API is available for those that are not.
@@ -220,7 +224,7 @@ For more detailed information about crawler setup, please see [our blog post](ht
220
 
221
  == Screenshots ==
222
 
223
- 1. Admin Settings - General
224
  2. Admin Settings - Cache
225
  3. Admin Settings - Purge
226
  4. Admin Settings - Excludes
@@ -240,6 +244,40 @@ For more detailed information about crawler setup, please see [our blog post](ht
240
 
241
  == Changelog ==
242
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
243
  = 1.6.7 - December 15 2017 =
244
  * [IAPI] Added ability to scan for new image thumbnail sizes and auto-resend image optimization requests.
245
  * [IAPI] Added ability to destroy all optimization data.
3
  Tags: cache, wp-cache, litespeed, super cache, http2, total cache, wordfence
4
  Requires at least: 4.0
5
  Tested up to: 4.9.1
6
+ Stable tag: 1.7.2
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl.html
9
 
58
  * HTTP/2 Push for CSS and JS
59
  * Database Cleaner and Optimizer
60
  * Browser Cache
61
+ * DNS Prefetch
62
+ * Cloudflare API
63
  * Automatic page caching to greatly improve site performance
64
  * Automatic purge of related pages based on certain events
65
  * Smart preload crawler with support for SEO-friendly sitemap
81
  * Supports [QUIC](https://blog.litespeedtech.com/2017/07/11/litespeed-announces-quic-support/) right out of the box
82
  * Supports ESI cache
83
 
84
+ Please consider helping translate LiteSpeed Cache plugin at our [GlotPress project](https://translate.wordpress.org/projects/wp-plugins/litespeed-cache). Growing the LiteSpeed Cache plugin community means better software for everyone!
85
+
86
  == Third Party Compatibility ==
87
 
88
  The vast majority of plugins and themes are compatible with LSCache. Our API is available for those that are not.
224
 
225
  == Screenshots ==
226
 
227
+ 1. Plugin Benchmarks
228
  2. Admin Settings - Cache
229
  3. Admin Settings - Purge
230
  4. Admin Settings - Excludes
244
 
245
  == Changelog ==
246
 
247
+ = 1.7.2 - January 5 2018 =
248
+ * [NEW FEATURE] Cloudflare API support.
249
+ * [IMPROVEMENT] IAPI key can now be reset to avoid issues when domain is changed.
250
+ * [BUGFIX] Fixed JS optimizer breaking certain plugins JS.
251
+ * [UPDATE] Added cdn settings to environment report.
252
+ * [GUI] Added more shortcuts to backend adminbar.
253
+ * [INTEGRATION] WooCommerce visitors are now served from public cache when cart is empty.
254
+
255
+ = 1.7.1.1 - December 29 2017 =
256
+ * [BUGFIX] Fixed an extra trailing underscore issue when saving multiple lines with DNS Prefetch.
257
+ * [UPDATE] Cleaned up unused dependency vendor files.
258
+
259
+ = 1.7.1 - December 28 2017 =
260
+ * [NEW FEATURE] Added DNS Prefetch setting on the Optimize page.
261
+ * [NEW FEATURE] Added Combined File Max Size setting on the Tuning page.
262
+ * [IMPROVEMENT] Improved JS/CSS minify to achieve higher page scores.
263
+ * [IMPROVEMENT] Optimized JS/CSS files will not be served from private cache for OLS or with ESI off.
264
+ * [UPDATE] Fixed a potential warning for new installations on the Settings page.
265
+ * [UPDATE] Fixed an issue with guest users occasionally receiving PHP warnings.
266
+ * [BUGFIX] Fixed a bug with the Improve HTTPS Compatibility setting failing to save.
267
+ * Thanks to all of our users for your encouragement and support! Happy New Year!
268
+ * PS: Lookout 2018, we're back!
269
+
270
+ = 1.7 - December 22 2017 =
271
+ * [NEW FEATURE] Drop Query Strings setting in the Cache tab.
272
+ * [NEW FEATURE] Multiple CDN Mapping in the CDN tab.
273
+ * [IMPROVEMENT] Improve HTTP/HTTPS Compatibility setting in the Advanced tab.
274
+ * [IMPROVEMENT] Keep JS/CSS original position in HTML when excluded in setting.
275
+ * [IAPI] Reset client level credit after Image Optimization data is destroyed.
276
+ * [REFACTOR] Refactored build_input/textarea functions in admin_display class.
277
+ * [REFACTOR] Refactored CDN class.
278
+ * [GUI] Added a notice to Image Optimization and Crawler to warn when cache is disabled.
279
+ * [GUI] Improved image optimization indicator styles in Media Library List.
280
+
281
  = 1.6.7 - December 15 2017 =
282
  * [IAPI] Added ability to scan for new image thumbnail sizes and auto-resend image optimization requests.
283
  * [IAPI] Added ability to destroy all optimization data.
thirdparty/lscwp-3rd-contact-form-7.cls.php CHANGED
File without changes
thirdparty/lscwp-3rd-login-with-ajax.cls.php CHANGED
File without changes
thirdparty/lscwp-3rd-woocommerce.cls.php CHANGED
@@ -86,7 +86,14 @@ class LiteSpeed_Cache_ThirdParty_WooCommerce
86
  LiteSpeed_Cache_API::hook_esi_param( 'widget', array( $this, 'add_post_id' ) ) ;
87
  }
88
 
89
- LiteSpeed_Cache_API::hook_tpl_not_esi( array( $this, 'set_swap_header_cart' ) ) ;
 
 
 
 
 
 
 
90
  }
91
 
92
  if ( is_admin() ) {
@@ -129,6 +136,62 @@ class LiteSpeed_Cache_ThirdParty_WooCommerce
129
  {
130
  LiteSpeed_Cache_API::debug( '3rd woo purge ESI in action: ' . current_filter() ) ;
131
  LiteSpeed_Cache_API::purge_private( LiteSpeed_Cache_Tag::TYPE_ESI . 'storefront-cart-header' ) ;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
132
  }
133
 
134
  /**
@@ -275,7 +338,7 @@ class LiteSpeed_Cache_ThirdParty_WooCommerce
275
  */
276
  public function esi_cart_header()
277
  {
278
- echo LiteSpeed_Cache_API::esi_url('storefront-cart-header', 'STOREFRONT_CART_HEADER') ;
279
  }
280
 
281
  /**
@@ -777,14 +840,14 @@ class LiteSpeed_Cache_ThirdParty_WooCommerce
777
  <tr>
778
  <th>" . __('Use Front Page TTL for the Shop Page', 'litespeed-cache') . "</th>
779
  <td>
780
- " . LiteSpeed_Cache_API::build_switch(self::OPTION_SHOP_FRONT_TTL, false, true) . "
781
  <div class='litespeed-desc'>$ttl_desc</div>
782
  </td>
783
  </tr>
784
  <tr>
785
  <th>" . __('Privately Cache Cart', 'litespeed-cache') . "</th>
786
  <td>
787
- " . LiteSpeed_Cache_API::build_switch( self::OPTION_WOO_CACHE_CART, false, true ) . "
788
  <div class='litespeed-desc'>"
789
  . __( 'Privately cache cart when not empty.', 'litespeed-cache' ) . "
790
  </div>
86
  LiteSpeed_Cache_API::hook_esi_param( 'widget', array( $this, 'add_post_id' ) ) ;
87
  }
88
 
89
+ /**
90
+ * Only when cart is not empty, give it an ESI with private cache
91
+ * Call when template_include to make sure woo cart is initialized
92
+ * @since 1.7.2
93
+ */
94
+ add_action( 'template_include', array( $this, 'check_if_need_esi' ) ) ;
95
+ LiteSpeed_Cache_API::hook_vary_finalize( array( $this, 'vary_maintain' ) ) ;
96
+
97
  }
98
 
99
  if ( is_admin() ) {
136
  {
137
  LiteSpeed_Cache_API::debug( '3rd woo purge ESI in action: ' . current_filter() ) ;
138
  LiteSpeed_Cache_API::purge_private( LiteSpeed_Cache_Tag::TYPE_ESI . 'storefront-cart-header' ) ;
139
+
140
+ }
141
+
142
+ /**
143
+ * Check if need to give an ESI block for cart
144
+ *
145
+ * @since 1.7.2
146
+ * @access public
147
+ */
148
+ public function check_if_need_esi( $template )
149
+ {
150
+ if ( $this->vary_needed() ) {
151
+ LiteSpeed_Cache_API::debug( 'API: 3rd woo added ESI' ) ;
152
+ LiteSpeed_Cache_API::hook_tpl_not_esi( array( $this, 'set_swap_header_cart' ) ) ;
153
+ }
154
+
155
+ return $template ;
156
+
157
+ }
158
+
159
+ /**
160
+ * Keep vary on if cart is not empty
161
+ *
162
+ * @since 1.7.2
163
+ * @access public
164
+ */
165
+ public function vary_maintain( $vary )
166
+ {
167
+ if ( $this->vary_needed() ) {
168
+ LiteSpeed_Cache_API::debug( 'API: 3rd woo added vary due to cart not empty' ) ;
169
+ $vary[ 'woo_cart' ] = 1 ;
170
+ }
171
+ return $vary ;
172
+ }
173
+
174
+ /**
175
+ * Check if vary need to be on based on cart
176
+ *
177
+ * @since 1.7.2
178
+ * @access private
179
+ */
180
+ private function vary_needed()
181
+ {
182
+ if ( ! function_exists( 'WC' ) ) {
183
+ return false ;
184
+ }
185
+
186
+ $woocom = WC() ;
187
+ if ( ! $woocom ) {
188
+ return false ;
189
+ }
190
+
191
+ if ( is_null( $woocom->cart ) ) {
192
+ return false ;
193
+ }
194
+ return $woocom->cart->get_cart_contents_count() > 0 ;
195
  }
196
 
197
  /**
338
  */
339
  public function esi_cart_header()
340
  {
341
+ echo LiteSpeed_Cache_API::esi_url( 'storefront-cart-header', 'STOREFRONT_CART_HEADER' ) ;
342
  }
343
 
344
  /**
840
  <tr>
841
  <th>" . __('Use Front Page TTL for the Shop Page', 'litespeed-cache') . "</th>
842
  <td>
843
+ " . LiteSpeed_Cache_API::build_switch(self::OPTION_SHOP_FRONT_TTL, null, true) . "
844
  <div class='litespeed-desc'>$ttl_desc</div>
845
  </td>
846
  </tr>
847
  <tr>
848
  <th>" . __('Privately Cache Cart', 'litespeed-cache') . "</th>
849
  <td>
850
+ " . LiteSpeed_Cache_API::build_switch( self::OPTION_WOO_CACHE_CART, null, true ) . "
851
  <div class='litespeed-desc'>"
852
  . __( 'Privately cache cart when not empty.', 'litespeed-cache' ) . "
853
  </div>