LiteSpeed Cache - Version 2.1.1

Version Description

  • Mar 20 2018 =
  • [NEW FEATURE] Browser Cache Unlocked for non-LiteSpeed users.
  • [IMPROVEMENT] Image Optimization Fixed issue where images with bad postmeta value continued to show in not-yet-requested queue.
Download this release

Release Info

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

Code changes from version 2.1 to 2.1.1

admin/litespeed-cache-admin-rules.class.php CHANGED
@@ -29,11 +29,13 @@ class LiteSpeed_Cache_Admin_Rules
29
  const RW_OPTM_NO_VARY = "RewriteRule min/\w+\.(css|js) - [E=cache-control:no-vary]" ;
30
 
31
  const LS_MODULE_START = '<IfModule LiteSpeed>' ;
 
32
  const LS_MODULE_END = '</IfModule>' ;
33
  const LS_MODULE_REWRITE_START = '<IfModule mod_rewrite.c>' ;
34
  private static $LS_MODULE_REWRITE_ON ;
35
  const LS_MODULE_DONOTEDIT = "## LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! ##" ;
36
  const MARKER = 'LSCACHE' ;
 
37
  const MARKER_LOGIN_COOKIE = '### marker LOGIN COOKIE' ;
38
  const MARKER_MOBILE = '### marker MOBILE' ;
39
  const MARKER_NOCACHE_COOKIES = '### marker NOCACHE COOKIES' ;
@@ -485,41 +487,41 @@ class LiteSpeed_Cache_Admin_Rules
485
  $id = LiteSpeed_Cache_Config::OPID_CACHE_BROWSER_TTL ;
486
  $ttl = $cfg[ $id ] ;
487
  $rules = array(
488
- '<FilesMatch "\.(pdf|ico|svg|xml|jpg|jpeg|png|gif|webp|ogg|mp4|webm|js|css|woff|woff2|ttf|eot)(\.gz)?$">',
489
- '<IfModule mod_expires.c>',
490
- 'ExpiresActive on',
491
- 'ExpiresByType application/pdf A' . $ttl,
492
- 'ExpiresByType image/x-icon A' . $ttl,
493
- 'ExpiresByType image/vnd.microsoft.icon A' . $ttl,
494
- 'ExpiresByType image/svg+xml A' . $ttl,
495
- '',
496
- 'ExpiresByType image/jpg A' . $ttl,
497
- 'ExpiresByType image/jpeg A' . $ttl,
498
- 'ExpiresByType image/png A' . $ttl,
499
- 'ExpiresByType image/gif A' . $ttl,
500
- 'ExpiresByType image/webp A' . $ttl,
501
- '',
502
- 'ExpiresByType video/ogg A' . $ttl,
503
- 'ExpiresByType audio/ogg A' . $ttl,
504
- 'ExpiresByType video/mp4 A' . $ttl,
505
- 'ExpiresByType video/webm A' . $ttl,
506
- '',
507
- 'ExpiresByType text/css A' . $ttl,
508
- 'ExpiresByType text/javascript A' . $ttl,
509
- 'ExpiresByType application/javascript A' . $ttl,
510
- 'ExpiresByType application/x-javascript A' . $ttl,
511
- '',
512
- 'ExpiresByType application/x-font-ttf A' . $ttl,
513
- 'ExpiresByType application/x-font-woff A' . $ttl,
514
- 'ExpiresByType application/font-woff A' . $ttl,
515
- 'ExpiresByType application/font-woff2 A' . $ttl,
516
- 'ExpiresByType application/vnd.ms-fontobject A' . $ttl,
517
- 'ExpiresByType font/ttf A' . $ttl,
518
- 'ExpiresByType font/woff A' . $ttl,
519
- 'ExpiresByType font/woff2 A' . $ttl,
520
- '',
521
- '</IfModule>',
522
- '</FilesMatch>',
523
  ) ;
524
  return $rules ;
525
  }
@@ -550,166 +552,171 @@ class LiteSpeed_Cache_Admin_Rules
550
  * @param array $cfg The settings to be used for rewrite rule
551
  * @return array Rules array
552
  */
553
- private function _generate_rules( $cfg )
554
  {
555
  $new_rules = array() ;
 
556
  $new_rules_backend = array() ;
 
 
 
 
 
 
 
 
 
 
 
 
557
 
558
- // mobile agents
559
- $id = LiteSpeed_Cache_Config::ID_MOBILEVIEW_LIST ;
560
- if ( ! empty( $cfg[ LiteSpeed_Cache_Config::OPID_CACHE_MOBILE ] ) && ! empty( $cfg[ $id ] ) ) {
561
- $new_rules[] = self::MARKER_MOBILE . self::MARKER_START ;
562
- $new_rules[] = 'RewriteCond %{HTTP_USER_AGENT} ' . $cfg[ $id ] . ' [NC]' ;
563
- $new_rules[] = 'RewriteRule .* - [E=Cache-Control:vary=ismobile]' ;
564
- $new_rules[] = self::MARKER_MOBILE . self::MARKER_END ;
565
- $new_rules[] = '' ;
566
- }
567
 
568
- // nocache cookie
569
- $id = LiteSpeed_Cache_Config::ID_NOCACHE_COOKIES ;
570
- if ( ! empty( $cfg[ $id ] ) ) {
571
- $new_rules[] = self::MARKER_NOCACHE_COOKIES . self::MARKER_START ;
572
- $new_rules[] = 'RewriteCond %{HTTP_COOKIE} ' . $cfg[ $id ] ;
573
- $new_rules[] = 'RewriteRule .* - [E=Cache-Control:no-cache]' ;
574
- $new_rules[] = self::MARKER_NOCACHE_COOKIES . self::MARKER_END ;
575
- $new_rules[] = '' ;
576
- }
577
 
578
- // nocache user agents
579
- $id = LiteSpeed_Cache_Config::ID_NOCACHE_USERAGENTS ;
580
- if ( ! empty( $cfg[ $id ] ) ) {
581
- $new_rules[] = self::MARKER_NOCACHE_USER_AGENTS . self::MARKER_START ;
582
- $new_rules[] = 'RewriteCond %{HTTP_USER_AGENT} ' . $cfg[ $id ] ;
583
- $new_rules[] = 'RewriteRule .* - [E=Cache-Control:no-cache]' ;
584
- $new_rules[] = self::MARKER_NOCACHE_USER_AGENTS . self::MARKER_END ;
585
- $new_rules[] = '' ;
586
- }
587
 
588
- // caching php resource
589
- $id = LiteSpeed_Cache_Config::OPID_CACHE_RES ;
590
- if ( ! empty( $cfg[ $id ] ) ) {
591
- $new_rules[] = $new_rules_backend[] = self::MARKER_CACHE_RESOURCE . self::MARKER_START ;
592
- $new_rules[] = $new_rules_backend[] = 'RewriteRule ' . LSCWP_CONTENT_FOLDER . self::RW_PATTERN_RES . ' - [E=cache-control:max-age=3600]' ;
593
- $new_rules[] = $new_rules_backend[] = self::MARKER_CACHE_RESOURCE . self::MARKER_END ;
594
- $new_rules[] = $new_rules_backend[] = '' ;
595
- }
 
596
 
597
- // check login cookie
598
- $id = LiteSpeed_Cache_Config::OPID_LOGIN_COOKIE ;
599
- if ( LITESPEED_SERVER_TYPE === 'LITESPEED_SERVER_OLS' ) {
 
 
 
600
  if ( ! empty( $cfg[ $id ] ) ) {
601
- $cfg[ $id ] .= ',wp-postpass_' . COOKIEHASH ;
 
 
 
 
 
 
 
602
  }
603
- else {
604
- $cfg[ $id ] = 'wp-postpass_' . COOKIEHASH ;
 
 
 
 
 
 
 
605
  }
606
 
607
- $tp_cookies = apply_filters( 'litespeed_cache_api_vary', array() ) ;
608
- if ( ! empty( $tp_cookies ) && is_array( $tp_cookies ) ) {
609
- $cfg[ $id ] .= ',' . implode( ',', $tp_cookies ) ;
 
 
 
 
610
  }
611
- }
612
- // frontend and backend
613
- if ( ! empty( $cfg[ $id ] ) ) {
614
- $env = 'Cache-Vary:' . $cfg[ $id ] ;
615
- if ( LITESPEED_SERVER_TYPE === 'LITESPEED_SERVER_OLS' ) {
616
- $env = '"' . $env . '"' ;
 
 
 
617
  }
618
- $new_rules[] = $new_rules_backend[] = self::MARKER_LOGIN_COOKIE . self::MARKER_START ;
619
- $new_rules[] = $new_rules_backend[] = 'RewriteRule .? - [E=' . $env . ']' ;
620
- $new_rules[] = $new_rules_backend[] = self::MARKER_LOGIN_COOKIE . self::MARKER_END ;
621
- $new_rules[] = '' ;
622
- }
623
 
624
- // favicon
625
- // frontend and backend
626
- $id = LiteSpeed_Cache_Config::OPID_CACHE_FAVICON ;
627
- if ( ! empty( $cfg[ $id ] ) ) {
628
- $new_rules[] = $new_rules_backend[] = self::MARKER_FAVICON . self::MARKER_START ;
629
- $new_rules[] = $new_rules_backend[] = 'RewriteRule favicon\.ico$ - [E=cache-control:max-age=86400]' ;
630
- $new_rules[] = $new_rules_backend[] = self::MARKER_FAVICON . self::MARKER_END ;
631
- $new_rules[] = '' ;
 
 
632
  }
633
 
634
  // Browser cache
635
  $id = LiteSpeed_Cache_Config::OPID_CACHE_BROWSER ;
636
  if ( ! empty( $cfg[ $id ] ) ) {
637
- $new_rules[] = $new_rules_backend[] = self::MARKER_BROWSER_CACHE . self::MARKER_START ;
638
- $new_rules = array_merge( $new_rules, $this->_browser_cache_rules( $cfg ) ) ;
639
- $new_rules_backend = array_merge( $new_rules_backend, $this->_browser_cache_rules( $cfg ) ) ;
640
- $new_rules[] = $new_rules_backend[] = self::MARKER_BROWSER_CACHE . self::MARKER_END ;
641
- $new_rules[] = '' ;
642
  }
643
 
644
- // CORS font rules
645
- $id = LiteSpeed_Cache_Config::OPID_CDN ;
646
- if ( ! empty( $cfg[ $id ] ) ) {
647
- $new_rules[] = self::MARKER_CORS . self::MARKER_START ;
648
- $new_rules = array_merge( $new_rules, $this->_cors_rules() ) ;
649
- $new_rules[] = self::MARKER_CORS . self::MARKER_END ;
650
- $new_rules[] = '' ;
651
- }
652
 
653
- // webp support
654
- $id = LiteSpeed_Cache_Config::OPID_MEDIA_IMG_WEBP ;
655
- if ( ! empty( $cfg[ $id ] ) ) {
656
- $new_rules[] = self::MARKER_WEBP . self::MARKER_START ;
657
- $new_rules[] = 'RewriteCond %{HTTP_ACCEPT} "image/webp"' ;
658
- $new_rules[] = 'RewriteRule .* - [E=Cache-Control:vary=%{ENV:LSCACHE_VARY_VALUE}+webp]' ;
659
- $new_rules[] = self::MARKER_WEBP . self::MARKER_END ;
660
- $new_rules[] = '' ;
661
- }
662
-
663
- // drop qs support
664
- $id = LiteSpeed_Cache_Config::ITEM_CACHE_DROP_QS ;
665
- if ( $cfg_info = get_option( $id ) ) {
666
- $new_rules[] = self::MARKER_DROPQS . self::MARKER_START ;
667
- foreach ( explode( "\n", $cfg_info ) as $v ) {
668
- $new_rules[] = 'CacheKeyModify -qs:' . $v ;
669
- }
670
- $new_rules[] = self::MARKER_DROPQS . self::MARKER_END ;
671
- $new_rules[] = '' ;
672
  }
673
 
674
- return array( $new_rules, $new_rules_backend ) ;
 
 
675
 
 
676
  }
677
 
678
  /**
679
- * Output the msg with rules plain data for manual insert
680
  *
681
- * @since 1.1.5
682
- * @param string $file
683
- * @param array $rules
684
- * @return string final msg to output
685
  */
686
- private function rewrite_codes_msg( $file, $rules )
687
  {
688
- return sprintf( __( '<p>Please add/replace the following codes into the beginning of %1$s:</p> %2$s' , 'litespeed-cache' ),
689
- $file,
690
- '<textarea style="width:100%;" rows="10" readonly>' . htmlspecialchars( $this->_wrap_rules_with_marker( $rules ) ) . '</textarea>'
691
- ) ;
 
 
 
692
  }
693
 
694
  /**
695
- * Generate rules plain data for manual insert
696
  *
697
- * @since 1.1.5
698
- * @param array $rules
699
- * @return array final rules data for htaccess
700
  */
701
- private function _wrap_rules_with_marker( $rules )
702
  {
703
- $marker = self::MARKER ;
704
- $start_marker = "# BEGIN {$marker}" ;
705
- $end_marker = "# END {$marker}" ;
706
- $new_file_data = implode( "\n", array_merge(
707
- array( $start_marker ),
708
- $this->_wrap_rules($rules),
709
- array( $end_marker )
710
- ) ) ;
711
-
712
- return $new_file_data ;
713
  }
714
 
715
  /**
@@ -719,19 +726,19 @@ class LiteSpeed_Cache_Admin_Rules
719
  * @param array $rules
720
  * @return array wrapped rules with module info
721
  */
722
- private function _wrap_rules( $rules )
723
  {
724
- if ( $rules !== false ) {
725
- $rules = array_merge(
726
- array(self::LS_MODULE_DONOTEDIT),
727
- array(self::LS_MODULE_START),
728
- self::$LS_MODULE_REWRITE_ON,
729
- array(''),
730
- $rules,
731
- array(self::LS_MODULE_END),
732
- array(self::LS_MODULE_DONOTEDIT)
733
- ) ;
734
  }
 
 
 
 
 
 
 
735
  return $rules ;
736
  }
737
 
@@ -739,17 +746,27 @@ class LiteSpeed_Cache_Admin_Rules
739
  * Write to htaccess with rules
740
  *
741
  * @since 1.1.0
 
742
  * @param array $rules
743
  * @param string $kind which htaccess
744
  */
745
- public function insert_wrapper( $rules = array(), $kind = 'frontend' )
746
  {
 
 
 
 
 
 
 
 
 
747
  $res = $this->htaccess_backup( $kind ) ;
748
  if ( ! $res ) {
749
  return false ;
750
  }
751
 
752
- return Litespeed_File::insert_with_markers( $this->htaccess_path($kind), $this->_wrap_rules( $rules ), self::MARKER, true ) ;
753
  }
754
 
755
  /**
@@ -759,7 +776,7 @@ class LiteSpeed_Cache_Admin_Rules
759
  * @access public
760
  * @param array $cfg The rules that need to be set.
761
  */
762
- public function update( $cfg )
763
  {
764
  if ( ! LiteSpeed_Cache_Admin_Rules::readable() ) {
765
  return LiteSpeed_Cache_Admin_Display::get_error( LiteSpeed_Cache_Admin_Error::E_HTA_R ) ;
@@ -771,22 +788,54 @@ class LiteSpeed_Cache_Admin_Rules
771
  }
772
  }
773
 
774
- list( $frontend_rules, $backend_rules ) = $this->_generate_rules( $cfg ) ;
 
775
  // Check frontend content
776
- if ( $this->_wrap_rules( $frontend_rules ) != $this->extract_rules() ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
777
  // Need to update frontend htaccess
778
- if ( ! $this->insert_wrapper( $frontend_rules ) ) {
779
- $manual_guide_codes = $this->rewrite_codes_msg( $this->frontend_htaccess, $frontend_rules ) ;
 
780
  return array( LiteSpeed_Cache_Admin_Display::get_error( LiteSpeed_Cache_Admin_Error::E_HTA_W ), $manual_guide_codes ) ;
781
  }
782
  }
783
 
784
  if ( $this->frontend_htaccess !== $this->backend_htaccess ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
785
  // Check backend content
786
- if ( $this->_wrap_rules( $backend_rules ) != $this->extract_rules( 'backend' ) ) {
 
787
  // Need to update backend htaccess
788
- if ( ! $this->insert_wrapper( $backend_rules, 'backend' ) ) {
789
- $manual_guide_codes = $this->rewrite_codes_msg( $this->backend_htaccess, $backend_rules ) ;
 
790
  return array( LiteSpeed_Cache_Admin_Display::get_error( LiteSpeed_Cache_Admin_Error::E_HTA_W ), $manual_guide_codes ) ;
791
  }
792
  }
@@ -799,11 +848,11 @@ class LiteSpeed_Cache_Admin_Rules
799
  * Get existing rewrite rules
800
  *
801
  * @since 1.3
802
- * @access public
803
  * @param string $kind Frontend or backend .htaccess file
804
  * @return bool|array False if failed to read, rules array otherwise
805
  */
806
- public function extract_rules( $kind = 'frontend' )
807
  {
808
  clearstatcache() ;
809
  $path = $this->htaccess_path( $kind ) ;
@@ -812,8 +861,50 @@ class LiteSpeed_Cache_Admin_Rules
812
  }
813
 
814
  $rules = Litespeed_File::extract_from_markers( $path, self::MARKER ) ;
 
815
 
816
- return $rules ;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
817
  }
818
 
819
  /**
@@ -821,13 +912,17 @@ class LiteSpeed_Cache_Admin_Rules
821
  *
822
  * @since 1.0.4
823
  * @access public
 
824
  */
825
- public function clear_rules( $clear_all = false )
826
  {
827
- $keep_wrapper = $clear_all === true ? false : array() ;
828
- $this->insert_wrapper( $keep_wrapper ) ;
 
 
829
  if ( $this->frontend_htaccess !== $this->backend_htaccess ) {
830
- $this->insert_wrapper( $keep_wrapper, 'backend' ) ;
 
831
  }
832
  }
833
 
29
  const RW_OPTM_NO_VARY = "RewriteRule min/\w+\.(css|js) - [E=cache-control:no-vary]" ;
30
 
31
  const LS_MODULE_START = '<IfModule LiteSpeed>' ;
32
+ const EXPIRES_MODULE_START = '<IfModule mod_expires.c>' ;
33
  const LS_MODULE_END = '</IfModule>' ;
34
  const LS_MODULE_REWRITE_START = '<IfModule mod_rewrite.c>' ;
35
  private static $LS_MODULE_REWRITE_ON ;
36
  const LS_MODULE_DONOTEDIT = "## LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! ##" ;
37
  const MARKER = 'LSCACHE' ;
38
+ const MARKER_NONLS = 'NON_LSCACHE' ;
39
  const MARKER_LOGIN_COOKIE = '### marker LOGIN COOKIE' ;
40
  const MARKER_MOBILE = '### marker MOBILE' ;
41
  const MARKER_NOCACHE_COOKIES = '### marker NOCACHE COOKIES' ;
487
  $id = LiteSpeed_Cache_Config::OPID_CACHE_BROWSER_TTL ;
488
  $ttl = $cfg[ $id ] ;
489
  $rules = array(
490
+ self::EXPIRES_MODULE_START,
491
+ // '<FilesMatch "\.(pdf|ico|svg|xml|jpg|jpeg|png|gif|webp|ogg|mp4|webm|js|css|woff|woff2|ttf|eot)(\.gz)?$">',
492
+ 'ExpiresActive on',
493
+ 'ExpiresByType application/pdf A' . $ttl,
494
+ 'ExpiresByType image/x-icon A' . $ttl,
495
+ 'ExpiresByType image/vnd.microsoft.icon A' . $ttl,
496
+ 'ExpiresByType image/svg+xml A' . $ttl,
497
+ '',
498
+ 'ExpiresByType image/jpg A' . $ttl,
499
+ 'ExpiresByType image/jpeg A' . $ttl,
500
+ 'ExpiresByType image/png A' . $ttl,
501
+ 'ExpiresByType image/gif A' . $ttl,
502
+ 'ExpiresByType image/webp A' . $ttl,
503
+ '',
504
+ 'ExpiresByType video/ogg A' . $ttl,
505
+ 'ExpiresByType audio/ogg A' . $ttl,
506
+ 'ExpiresByType video/mp4 A' . $ttl,
507
+ 'ExpiresByType video/webm A' . $ttl,
508
+ '',
509
+ 'ExpiresByType text/css A' . $ttl,
510
+ 'ExpiresByType text/javascript A' . $ttl,
511
+ 'ExpiresByType application/javascript A' . $ttl,
512
+ 'ExpiresByType application/x-javascript A' . $ttl,
513
+ '',
514
+ 'ExpiresByType application/x-font-ttf A' . $ttl,
515
+ 'ExpiresByType application/x-font-woff A' . $ttl,
516
+ 'ExpiresByType application/font-woff A' . $ttl,
517
+ 'ExpiresByType application/font-woff2 A' . $ttl,
518
+ 'ExpiresByType application/vnd.ms-fontobject A' . $ttl,
519
+ 'ExpiresByType font/ttf A' . $ttl,
520
+ 'ExpiresByType font/woff A' . $ttl,
521
+ 'ExpiresByType font/woff2 A' . $ttl,
522
+ '',
523
+ // '</FilesMatch>',
524
+ self::LS_MODULE_END,
525
  ) ;
526
  return $rules ;
527
  }
552
  * @param array $cfg The settings to be used for rewrite rule
553
  * @return array Rules array
554
  */
555
+ private function _generate_rules( $cfg, $disable_lscache_detail_rules = false )
556
  {
557
  $new_rules = array() ;
558
+ $new_rules_nonls = array() ;
559
  $new_rules_backend = array() ;
560
+ $new_rules_backend_nonls = array() ;
561
+
562
+ if ( ! $disable_lscache_detail_rules ) {
563
+ // mobile agents
564
+ $id = LiteSpeed_Cache_Config::ID_MOBILEVIEW_LIST ;
565
+ if ( ! empty( $cfg[ LiteSpeed_Cache_Config::OPID_CACHE_MOBILE ] ) && ! empty( $cfg[ $id ] ) ) {
566
+ $new_rules[] = self::MARKER_MOBILE . self::MARKER_START ;
567
+ $new_rules[] = 'RewriteCond %{HTTP_USER_AGENT} ' . $cfg[ $id ] . ' [NC]' ;
568
+ $new_rules[] = 'RewriteRule .* - [E=Cache-Control:vary=ismobile]' ;
569
+ $new_rules[] = self::MARKER_MOBILE . self::MARKER_END ;
570
+ $new_rules[] = '' ;
571
+ }
572
 
573
+ // nocache cookie
574
+ $id = LiteSpeed_Cache_Config::ID_NOCACHE_COOKIES ;
575
+ if ( ! empty( $cfg[ $id ] ) ) {
576
+ $new_rules[] = self::MARKER_NOCACHE_COOKIES . self::MARKER_START ;
577
+ $new_rules[] = 'RewriteCond %{HTTP_COOKIE} ' . $cfg[ $id ] ;
578
+ $new_rules[] = 'RewriteRule .* - [E=Cache-Control:no-cache]' ;
579
+ $new_rules[] = self::MARKER_NOCACHE_COOKIES . self::MARKER_END ;
580
+ $new_rules[] = '' ;
581
+ }
582
 
583
+ // nocache user agents
584
+ $id = LiteSpeed_Cache_Config::ID_NOCACHE_USERAGENTS ;
585
+ if ( ! empty( $cfg[ $id ] ) ) {
586
+ $new_rules[] = self::MARKER_NOCACHE_USER_AGENTS . self::MARKER_START ;
587
+ $new_rules[] = 'RewriteCond %{HTTP_USER_AGENT} ' . $cfg[ $id ] ;
588
+ $new_rules[] = 'RewriteRule .* - [E=Cache-Control:no-cache]' ;
589
+ $new_rules[] = self::MARKER_NOCACHE_USER_AGENTS . self::MARKER_END ;
590
+ $new_rules[] = '' ;
591
+ }
592
 
593
+ // caching php resource
594
+ $id = LiteSpeed_Cache_Config::OPID_CACHE_RES ;
595
+ if ( ! empty( $cfg[ $id ] ) ) {
596
+ $new_rules[] = $new_rules_backend[] = self::MARKER_CACHE_RESOURCE . self::MARKER_START ;
597
+ $new_rules[] = $new_rules_backend[] = 'RewriteRule ' . LSCWP_CONTENT_FOLDER . self::RW_PATTERN_RES . ' - [E=cache-control:max-age=3600]' ;
598
+ $new_rules[] = $new_rules_backend[] = self::MARKER_CACHE_RESOURCE . self::MARKER_END ;
599
+ $new_rules[] = $new_rules_backend[] = '' ;
600
+ }
 
601
 
602
+ // check login cookie
603
+ $id = LiteSpeed_Cache_Config::OPID_LOGIN_COOKIE ;
604
+ if ( LITESPEED_SERVER_TYPE === 'LITESPEED_SERVER_OLS' ) {
605
+ if ( ! empty( $cfg[ $id ] ) ) {
606
+ $cfg[ $id ] .= ',wp-postpass_' . COOKIEHASH ;
607
+ }
608
+ else {
609
+ $cfg[ $id ] = 'wp-postpass_' . COOKIEHASH ;
610
+ }
611
 
612
+ $tp_cookies = apply_filters( 'litespeed_cache_api_vary', array() ) ;
613
+ if ( ! empty( $tp_cookies ) && is_array( $tp_cookies ) ) {
614
+ $cfg[ $id ] .= ',' . implode( ',', $tp_cookies ) ;
615
+ }
616
+ }
617
+ // frontend and backend
618
  if ( ! empty( $cfg[ $id ] ) ) {
619
+ $env = 'Cache-Vary:' . $cfg[ $id ] ;
620
+ if ( LITESPEED_SERVER_TYPE === 'LITESPEED_SERVER_OLS' ) {
621
+ $env = '"' . $env . '"' ;
622
+ }
623
+ $new_rules[] = $new_rules_backend[] = self::MARKER_LOGIN_COOKIE . self::MARKER_START ;
624
+ $new_rules[] = $new_rules_backend[] = 'RewriteRule .? - [E=' . $env . ']' ;
625
+ $new_rules[] = $new_rules_backend[] = self::MARKER_LOGIN_COOKIE . self::MARKER_END ;
626
+ $new_rules[] = '' ;
627
  }
628
+
629
+ // favicon
630
+ // frontend and backend
631
+ $id = LiteSpeed_Cache_Config::OPID_CACHE_FAVICON ;
632
+ if ( ! empty( $cfg[ $id ] ) ) {
633
+ $new_rules[] = $new_rules_backend[] = self::MARKER_FAVICON . self::MARKER_START ;
634
+ $new_rules[] = $new_rules_backend[] = 'RewriteRule favicon\.ico$ - [E=cache-control:max-age=86400]' ;
635
+ $new_rules[] = $new_rules_backend[] = self::MARKER_FAVICON . self::MARKER_END ;
636
+ $new_rules[] = '' ;
637
  }
638
 
639
+ // CORS font rules
640
+ $id = LiteSpeed_Cache_Config::OPID_CDN ;
641
+ if ( ! empty( $cfg[ $id ] ) ) {
642
+ $new_rules[] = self::MARKER_CORS . self::MARKER_START ;
643
+ $new_rules = array_merge( $new_rules, $this->_cors_rules() ) ;
644
+ $new_rules[] = self::MARKER_CORS . self::MARKER_END ;
645
+ $new_rules[] = '' ;
646
  }
647
+
648
+ // webp support
649
+ $id = LiteSpeed_Cache_Config::OPID_MEDIA_IMG_WEBP ;
650
+ if ( ! empty( $cfg[ $id ] ) ) {
651
+ $new_rules[] = self::MARKER_WEBP . self::MARKER_START ;
652
+ $new_rules[] = 'RewriteCond %{HTTP_ACCEPT} "image/webp"' ;
653
+ $new_rules[] = 'RewriteRule .* - [E=Cache-Control:vary=%{ENV:LSCACHE_VARY_VALUE}+webp]' ;
654
+ $new_rules[] = self::MARKER_WEBP . self::MARKER_END ;
655
+ $new_rules[] = '' ;
656
  }
 
 
 
 
 
657
 
658
+ // drop qs support
659
+ $id = LiteSpeed_Cache_Config::ITEM_CACHE_DROP_QS ;
660
+ if ( $cfg_info = get_option( $id ) ) {
661
+ $new_rules[] = self::MARKER_DROPQS . self::MARKER_START ;
662
+ foreach ( explode( "\n", $cfg_info ) as $v ) {
663
+ $new_rules[] = 'CacheKeyModify -qs:' . $v ;
664
+ }
665
+ $new_rules[] = self::MARKER_DROPQS . self::MARKER_END ;
666
+ $new_rules[] = '' ;
667
+ }
668
  }
669
 
670
  // Browser cache
671
  $id = LiteSpeed_Cache_Config::OPID_CACHE_BROWSER ;
672
  if ( ! empty( $cfg[ $id ] ) ) {
673
+ $new_rules_nonls[] = $new_rules_backend_nonls[] = self::MARKER_BROWSER_CACHE . self::MARKER_START ;
674
+ $new_rules_nonls = array_merge( $new_rules_nonls, $this->_browser_cache_rules( $cfg ) ) ;
675
+ $new_rules_backend_nonls = array_merge( $new_rules_backend_nonls, $this->_browser_cache_rules( $cfg ) ) ;
676
+ $new_rules_nonls[] = $new_rules_backend_nonls[] = self::MARKER_BROWSER_CACHE . self::MARKER_END ;
677
+ $new_rules_nonls[] = '' ;
678
  }
679
 
 
 
 
 
 
 
 
 
680
 
681
+ // Add module wrapper for LiteSpeed rules
682
+ if ( $new_rules || $disable_lscache_detail_rules ) {
683
+ $new_rules = $this->_wrap_ls_module( $new_rules ) ;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
684
  }
685
 
686
+ if ( $new_rules_backend || $disable_lscache_detail_rules ) {
687
+ $new_rules_backend = $this->_wrap_ls_module( $new_rules_backend ) ;
688
+ }
689
 
690
+ return array( $new_rules, $new_rules_backend, $new_rules_nonls, $new_rules_backend_nonls ) ;
691
  }
692
 
693
  /**
694
+ * Add LitSpeed module wrapper with rewrite on
695
  *
696
+ * @since 2.1.1
697
+ * @access private
 
 
698
  */
699
+ private function _wrap_ls_module( $rules = array() )
700
  {
701
+ return array_merge(
702
+ array( self::LS_MODULE_START ),
703
+ self::$LS_MODULE_REWRITE_ON,
704
+ array( '' ),
705
+ $rules,
706
+ array( self::LS_MODULE_END )
707
+ ) ;
708
  }
709
 
710
  /**
711
+ * Insert LitSpeed module wrapper with rewrite on
712
  *
713
+ * @since 2.1.1
714
+ * @access public
 
715
  */
716
+ public function insert_ls_wrapper()
717
  {
718
+ $rules = $this->_wrap_ls_module() ;
719
+ return $this->_insert_wrapper( $rules ) ;
 
 
 
 
 
 
 
 
720
  }
721
 
722
  /**
726
  * @param array $rules
727
  * @return array wrapped rules with module info
728
  */
729
+ private function _wrap_do_no_edit( $rules )
730
  {
731
+ // When to clear rules, don't need DONOTEDIT msg
732
+ if ( $rules === false || ! is_array( $rules ) ) {
733
+ return $rules ;
 
 
 
 
 
 
 
734
  }
735
+
736
+ $rules = array_merge(
737
+ array( self::LS_MODULE_DONOTEDIT ),
738
+ $rules,
739
+ array( self::LS_MODULE_DONOTEDIT )
740
+ ) ;
741
+
742
  return $rules ;
743
  }
744
 
746
  * Write to htaccess with rules
747
  *
748
  * @since 1.1.0
749
+ * @access private
750
  * @param array $rules
751
  * @param string $kind which htaccess
752
  */
753
+ private function _insert_wrapper( $rules = array(), $kind = false, $marker = false )
754
  {
755
+ if ( $kind === false ) {
756
+ $kind = 'frontend' ;
757
+ }
758
+
759
+ // Default marker is LiteSpeed marker `LSCACHE`
760
+ if ( $marker === false ) {
761
+ $marker = self::MARKER ;
762
+ }
763
+
764
  $res = $this->htaccess_backup( $kind ) ;
765
  if ( ! $res ) {
766
  return false ;
767
  }
768
 
769
+ return Litespeed_File::insert_with_markers( $this->htaccess_path($kind), $this->_wrap_do_no_edit( $rules ), $marker, true ) ;
770
  }
771
 
772
  /**
776
  * @access public
777
  * @param array $cfg The rules that need to be set.
778
  */
779
+ public function update( $cfg, $disable_lscache_detail_rules = false )
780
  {
781
  if ( ! LiteSpeed_Cache_Admin_Rules::readable() ) {
782
  return LiteSpeed_Cache_Admin_Display::get_error( LiteSpeed_Cache_Admin_Error::E_HTA_R ) ;
788
  }
789
  }
790
 
791
+ list( $frontend_rules, $backend_rules, $frontend_rules_nonls, $backend_rules_nonls ) = $this->_generate_rules( $cfg, $disable_lscache_detail_rules ) ;
792
+
793
  // Check frontend content
794
+ list( $rules, $rules_nonls ) = $this->_extract_rules() ;
795
+
796
+ // Check Non-LiteSpeed rules
797
+ if ( $this->_wrap_do_no_edit( $frontend_rules_nonls ) != $rules_nonls ) {
798
+ LiteSpeed_Cache_Log::debug( '[Rules] Update non-ls frontend rules' ) ;
799
+ // Need to update frontend htaccess
800
+ if ( ! $this->_insert_wrapper( $frontend_rules_nonls, false, self::MARKER_NONLS ) ) {
801
+ $manual_guide_codes = $this->_rewrite_codes_msg( $this->frontend_htaccess, $frontend_rules_nonls, self::MARKER_NONLS ) ;
802
+ LiteSpeed_Cache_Log::debug( '[Rules] Update Failed' ) ;
803
+ return array( LiteSpeed_Cache_Admin_Display::get_error( LiteSpeed_Cache_Admin_Error::E_HTA_W ), $manual_guide_codes ) ;
804
+ }
805
+ }
806
+
807
+ // Check LiteSpeed rules
808
+ if ( $this->_wrap_do_no_edit( $frontend_rules ) != $rules ) {
809
+ LiteSpeed_Cache_Log::debug( '[Rules] Update frontend rules' ) ;
810
  // Need to update frontend htaccess
811
+ if ( ! $this->_insert_wrapper( $frontend_rules ) ) {
812
+ LiteSpeed_Cache_Log::debug( '[Rules] Update Failed' ) ;
813
+ $manual_guide_codes = $this->_rewrite_codes_msg( $this->frontend_htaccess, $frontend_rules ) ;
814
  return array( LiteSpeed_Cache_Admin_Display::get_error( LiteSpeed_Cache_Admin_Error::E_HTA_W ), $manual_guide_codes ) ;
815
  }
816
  }
817
 
818
  if ( $this->frontend_htaccess !== $this->backend_htaccess ) {
819
+ list( $rules, $rules_nonls ) = $this->_extract_rules( 'backend' ) ;
820
+
821
+ // Check Non-LiteSpeed rules for backend
822
+ if ( $this->_wrap_do_no_edit( $backend_rules_nonls ) != $rules_nonls ) {
823
+ LiteSpeed_Cache_Log::debug( '[Rules] Update non-ls backend rules' ) ;
824
+ // Need to update frontend htaccess
825
+ if ( ! $this->_insert_wrapper( $backend_rules_nonls, 'backend', self::MARKER_NONLS ) ) {
826
+ LiteSpeed_Cache_Log::debug( '[Rules] Update Failed' ) ;
827
+ $manual_guide_codes = $this->_rewrite_codes_msg( $this->backend_htaccess, $backend_rules_nonls, self::MARKER_NONLS ) ;
828
+ return array( LiteSpeed_Cache_Admin_Display::get_error( LiteSpeed_Cache_Admin_Error::E_HTA_W ), $manual_guide_codes ) ;
829
+ }
830
+ }
831
+
832
  // Check backend content
833
+ if ( $this->_wrap_do_no_edit( $backend_rules ) != $rules ) {
834
+ LiteSpeed_Cache_Log::debug( '[Rules] Update backend rules' ) ;
835
  // Need to update backend htaccess
836
+ if ( ! $this->_insert_wrapper( $backend_rules, 'backend' ) ) {
837
+ LiteSpeed_Cache_Log::debug( '[Rules] Update Failed' ) ;
838
+ $manual_guide_codes = $this->_rewrite_codes_msg( $this->backend_htaccess, $backend_rules ) ;
839
  return array( LiteSpeed_Cache_Admin_Display::get_error( LiteSpeed_Cache_Admin_Error::E_HTA_W ), $manual_guide_codes ) ;
840
  }
841
  }
848
  * Get existing rewrite rules
849
  *
850
  * @since 1.3
851
+ * @access private
852
  * @param string $kind Frontend or backend .htaccess file
853
  * @return bool|array False if failed to read, rules array otherwise
854
  */
855
+ private function _extract_rules( $kind = 'frontend' )
856
  {
857
  clearstatcache() ;
858
  $path = $this->htaccess_path( $kind ) ;
861
  }
862
 
863
  $rules = Litespeed_File::extract_from_markers( $path, self::MARKER ) ;
864
+ $rules_nonls = Litespeed_File::extract_from_markers( $path, self::MARKER_NONLS ) ;
865
 
866
+ return array( $rules, $rules_nonls ) ;
867
+ }
868
+
869
+ /**
870
+ * Output the msg with rules plain data for manual insert
871
+ *
872
+ * @since 1.1.5
873
+ * @param string $file
874
+ * @param array $rules
875
+ * @return string final msg to output
876
+ */
877
+ private function _rewrite_codes_msg( $file, $rules, $marker = false )
878
+ {
879
+ return sprintf( __( '<p>Please add/replace the following codes into the beginning of %1$s:</p> %2$s' , 'litespeed-cache' ),
880
+ $file,
881
+ '<textarea style="width:100%;" rows="10" readonly>' . htmlspecialchars( $this->_wrap_rules_with_marker( $rules, $marker ) ) . '</textarea>'
882
+ ) ;
883
+ }
884
+
885
+ /**
886
+ * Generate rules plain data for manual insert
887
+ *
888
+ * @since 1.1.5
889
+ * @param array $rules
890
+ * @return array final rules data for htaccess
891
+ */
892
+ private function _wrap_rules_with_marker( $rules, $marker = false )
893
+ {
894
+ // Default marker is LiteSpeed marker `LSCACHE`
895
+ if ( $marker === false ) {
896
+ $marker = self::MARKER ;
897
+ }
898
+
899
+ $start_marker = "# BEGIN {$marker}" ;
900
+ $end_marker = "# END {$marker}" ;
901
+ $new_file_data = implode( "\n", array_merge(
902
+ array( $start_marker ),
903
+ $this->_wrap_do_no_edit($rules),
904
+ array( $end_marker )
905
+ ) ) ;
906
+
907
+ return $new_file_data ;
908
  }
909
 
910
  /**
912
  *
913
  * @since 1.0.4
914
  * @access public
915
+ * @param string $clear_all Deactivation will give true, so clear all rules, otherwise only clear lscache related rules.
916
  */
917
+ public function clear_rules()
918
  {
919
+ $this->_insert_wrapper( false ) ;// Use false to avoid do-not-edit msg
920
+ // Clear non ls rules
921
+ $this->_insert_wrapper( false, false, self::MARKER_NONLS ) ;
922
+
923
  if ( $this->frontend_htaccess !== $this->backend_htaccess ) {
924
+ $this->_insert_wrapper( false, 'backend' ) ;
925
+ $this->_insert_wrapper( false, 'backend', self::MARKER_NONLS ) ;
926
  }
927
  }
928
 
admin/litespeed-cache-admin-settings.class.php CHANGED
@@ -146,20 +146,19 @@ class LiteSpeed_Cache_Admin_Settings
146
  $this->_options = array_merge( $this->_options, $new_options ) ;
147
 
148
  // Try to update rewrite rules
149
- if ( ! defined( 'LITESPEED_NEW_OFF' ) ) {
150
- // Only update needs to get error, for clear rules, can ignore for now
151
- $res = LiteSpeed_Cache_Admin_Rules::get_instance()->update( $this->_options ) ;
152
- if ( $res !== true ) {
153
- if ( ! is_array( $res ) ) {
154
- $this->_err[] = $res ;
155
- }
156
- else {
157
- $this->_err = array_merge( $this->_err, $res ) ;
158
- }
 
 
159
  }
160
- }
161
- else {
162
- LiteSpeed_Cache_Admin_Rules::get_instance()->clear_rules() ;
163
  }
164
 
165
  /**
@@ -217,20 +216,20 @@ class LiteSpeed_Cache_Admin_Settings
217
  $options = array_merge( $options, $new_options ) ;
218
 
219
  // Update htaccess
220
- if ( $network_enabled ) {
221
- $res = LiteSpeed_Cache_Admin_Rules::get_instance()->update( $options ) ;
222
- if ( $res !== true ) {
223
- if ( ! is_array( $res ) ) {
224
- $this->_err[] = $res ;
225
- }
226
- else {
227
- $this->_err = array_merge( $this->_err, $res ) ;
228
- }
229
- }
230
- }
231
- else {
232
  // Need to set cachePublicOn in case subblogs turn on cache manually
233
- LiteSpeed_Cache_Admin_Rules::get_instance()->insert_wrapper() ;
 
 
 
 
 
 
 
 
 
234
  }
235
 
236
  /**
146
  $this->_options = array_merge( $this->_options, $new_options ) ;
147
 
148
  // Try to update rewrite rules
149
+ $disable_lscache_detail_rules = false ;
150
+ if ( defined( 'LITESPEED_NEW_OFF' ) ) {
151
+ // Clear lscache rules but keep lscache module rules, keep non-lscache rules
152
+ $disable_lscache_detail_rules = true ;
153
+ }
154
+ $res = LiteSpeed_Cache_Admin_Rules::get_instance()->update( $this->_options, $disable_lscache_detail_rules ) ;
155
+ if ( $res !== true ) {
156
+ if ( ! is_array( $res ) ) {
157
+ $this->_err[] = $res ;
158
+ }
159
+ else {
160
+ $this->_err = array_merge( $this->_err, $res ) ;
161
  }
 
 
 
162
  }
163
 
164
  /**
216
  $options = array_merge( $options, $new_options ) ;
217
 
218
  // Update htaccess
219
+ $disable_lscache_detail_rules = false ;
220
+ if ( ! $network_enabled ) {
221
+ // Clear lscache rules but keep lscache module rules, keep non-lscache rules
 
 
 
 
 
 
 
 
 
222
  // Need to set cachePublicOn in case subblogs turn on cache manually
223
+ $disable_lscache_detail_rules = true ;
224
+ }
225
+ $res = LiteSpeed_Cache_Admin_Rules::get_instance()->update( $options, $disable_lscache_detail_rules ) ;
226
+ if ( $res !== true ) {
227
+ if ( ! is_array( $res ) ) {
228
+ $this->_err[] = $res ;
229
+ }
230
+ else {
231
+ $this->_err = array_merge( $this->_err, $res ) ;
232
+ }
233
  }
234
 
235
  /**
admin/tpl/crawler.php CHANGED
@@ -91,7 +91,7 @@ LiteSpeed_Cache_GUI::show_promo() ;
91
  <div class="litespeed-callout-danger">
92
  <h4><?php echo __('WARNING', 'litespeed-cache'); ?></h4>
93
  <p><?php echo __('The crawler feature is not enabled on the LiteSpeed server. Please consult your server admin.', 'litespeed-cache'); ?></p>
94
- <p><?php echo sprintf(__('See <a %s>Introduction for Enabling the Crawler</a> for detailed infomation.', 'litespeed-cache'), 'href="https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp:configuration:enabling_the_crawler" target="_blank"') ; ?></p>
95
  </div>
96
  <?php endif; ?>
97
 
91
  <div class="litespeed-callout-danger">
92
  <h4><?php echo __('WARNING', 'litespeed-cache'); ?></h4>
93
  <p><?php echo __('The crawler feature is not enabled on the LiteSpeed server. Please consult your server admin.', 'litespeed-cache'); ?></p>
94
+ <p><?php echo sprintf(__('See <a %s>Introduction for Enabling the Crawler</a> for detailed information.', 'litespeed-cache'), 'href="https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp:configuration:enabling_the_crawler" target="_blank"') ; ?></p>
95
  </div>
96
  <?php endif; ?>
97
 
admin/tpl/image_optimization.php CHANGED
@@ -166,16 +166,6 @@ LiteSpeed_Cache_GUI::show_promo() ;
166
  <b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'total_requested_groups' ] ) ; ?></b>
167
  (<b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'total_requested' ], 'image' ) ; ?></b>)
168
  </p>
169
- <p>
170
- <?php echo __('Images failed to optimize', 'litespeed-cache') ; ?>:
171
- <b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'total_err_groups' ] ) ; ?></b>
172
- (<b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'total_err' ], 'image' ) ; ?></b>)
173
- </p>
174
- <p>
175
- <?php echo __('Image files missing', 'litespeed-cache') ; ?>:
176
- <b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'total_miss_groups' ] ) ; ?></b>
177
- (<b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'total_miss' ], 'image' ) ; ?></b>)
178
- </p>
179
  <p class="litespeed-desc">
180
  <?php echo __( 'After LiteSpeed\'s Image Optimization Server finishes optimization, it will notify your site to pull the optimized images.', 'litespeed-cache' ) ; ?>
181
  <?php echo __( 'This process is automatic.', 'litespeed-cache' ) ; ?>
@@ -204,6 +194,20 @@ LiteSpeed_Cache_GUI::show_promo() ;
204
  <b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'total_pulled_groups' ] ) ; ?></b>
205
  (<b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'total_pulled' ], 'image' ) ; ?></b>)
206
  </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
207
  <p><a href="https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp:image-optimization#image_optimization_in_litespeed_cache_for_wordpress" target="_blank"><?php echo __('Learn More', 'litespeed-cache') ; ?></a></p>
208
 
209
  <hr />
166
  <b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'total_requested_groups' ] ) ; ?></b>
167
  (<b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'total_requested' ], 'image' ) ; ?></b>)
168
  </p>
 
 
 
 
 
 
 
 
 
 
169
  <p class="litespeed-desc">
170
  <?php echo __( 'After LiteSpeed\'s Image Optimization Server finishes optimization, it will notify your site to pull the optimized images.', 'litespeed-cache' ) ; ?>
171
  <?php echo __( 'This process is automatic.', 'litespeed-cache' ) ; ?>
194
  <b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'total_pulled_groups' ] ) ; ?></b>
195
  (<b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'total_pulled' ], 'image' ) ; ?></b>)
196
  </p>
197
+ <p>
198
+ <?php echo __('Images failed to optimize', 'litespeed-cache') ; ?>:
199
+ <b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'total_err_groups' ] ) ; ?></b>
200
+ (<b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'total_err' ], 'image' ) ; ?></b>)
201
+ </p>
202
+ <p>
203
+ <?php echo __('Image files missing', 'litespeed-cache') ; ?>:
204
+ <b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'total_miss_groups' ] ) ; ?></b>
205
+ (<b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'total_miss' ], 'image' ) ; ?></b>)
206
+ </p>
207
+ <p>
208
+ <?php echo __('Images with wrong meta', 'litespeed-cache') ; ?>:
209
+ <b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'total_xmeta_groups' ] ) ; ?></b>
210
+ </p>
211
  <p><a href="https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp:image-optimization#image_optimization_in_litespeed_cache_for_wordpress" target="_blank"><?php echo __('Learn More', 'litespeed-cache') ; ?></a></p>
212
 
213
  <hr />
admin/tpl/inc/check_cache_disabled.php CHANGED
@@ -6,7 +6,7 @@ $reasons = array() ;
6
  if ( ! defined( 'LITESPEED_ALLOWED' ) ) {
7
  $reasons[] = array(
8
  'title' => __( 'LSCache Module is disabled.', 'litespeed-cache' ),
9
- 'link' => 'https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache#prerequisites',
10
  ) ;
11
  }
12
 
6
  if ( ! defined( 'LITESPEED_ALLOWED' ) ) {
7
  $reasons[] = array(
8
  'title' => __( 'LSCache Module is disabled.', 'litespeed-cache' ),
9
+ 'link' => 'https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp:installation',
10
  ) ;
11
  }
12
 
inc/activation.class.php CHANGED
@@ -55,7 +55,7 @@ class LiteSpeed_Cache_Activation
55
  public static function uninstall_litespeed_cache()
56
  {
57
  LiteSpeed_Cache_Task::clear() ;
58
- LiteSpeed_Cache_Admin_Rules::get_instance()->clear_rules( true ) ;
59
  delete_option( LiteSpeed_Cache_Config::OPTION_NAME ) ;
60
  if ( is_multisite() ) {
61
  delete_site_option( LiteSpeed_Cache_Config::OPTION_NAME ) ;
@@ -181,7 +181,7 @@ class LiteSpeed_Cache_Activation
181
  if ( ! self::is_deactivate_last() ) {
182
  if ( is_network_admin() ) {
183
  // Still other activated subsite left, set .htaccess with only CacheLookUp
184
- LiteSpeed_Cache_Admin_Rules::get_instance()->insert_wrapper() ;
185
  }
186
  return ;
187
  }
@@ -211,7 +211,7 @@ class LiteSpeed_Cache_Activation
211
  error_log('In wp-config.php: WP_CACHE could not be set to false during deactivation!') ;
212
  }
213
 
214
- LiteSpeed_Cache_Admin_Rules::get_instance()->clear_rules( true ) ;
215
 
216
  // delete in case it's not deleted prior to deactivation.
217
  self::dismiss_whm() ;
55
  public static function uninstall_litespeed_cache()
56
  {
57
  LiteSpeed_Cache_Task::clear() ;
58
+ LiteSpeed_Cache_Admin_Rules::get_instance()->clear_rules() ;
59
  delete_option( LiteSpeed_Cache_Config::OPTION_NAME ) ;
60
  if ( is_multisite() ) {
61
  delete_site_option( LiteSpeed_Cache_Config::OPTION_NAME ) ;
181
  if ( ! self::is_deactivate_last() ) {
182
  if ( is_network_admin() ) {
183
  // Still other activated subsite left, set .htaccess with only CacheLookUp
184
+ LiteSpeed_Cache_Admin_Rules::get_instance()->insert_ls_wrapper() ;
185
  }
186
  return ;
187
  }
211
  error_log('In wp-config.php: WP_CACHE could not be set to false during deactivation!') ;
212
  }
213
 
214
+ LiteSpeed_Cache_Admin_Rules::get_instance()->clear_rules() ;
215
 
216
  // delete in case it's not deleted prior to deactivation.
217
  self::dismiss_whm() ;
inc/config.class.php CHANGED
@@ -1033,13 +1033,13 @@ class LiteSpeed_Cache_Config
1033
  if ( ! is_network_admin() ) {
1034
  if ( $count === 1 ) {
1035
  // Only itself is activated, set .htaccess with only CacheLookUp
1036
- LiteSpeed_Cache_Admin_Rules::get_instance()->insert_wrapper() ;
1037
  }
1038
  return ;
1039
  }
1040
  else {
1041
  // Network admin should make a wapper to avoid subblogs cache not work
1042
- LiteSpeed_Cache_Admin_Rules::get_instance()->insert_wrapper() ;
1043
  }
1044
 
1045
  $options = $this->get_site_options() ;
1033
  if ( ! is_network_admin() ) {
1034
  if ( $count === 1 ) {
1035
  // Only itself is activated, set .htaccess with only CacheLookUp
1036
+ LiteSpeed_Cache_Admin_Rules::get_instance()->insert_ls_wrapper() ;
1037
  }
1038
  return ;
1039
  }
1040
  else {
1041
  // Network admin should make a wapper to avoid subblogs cache not work
1042
+ LiteSpeed_Cache_Admin_Rules::get_instance()->insert_ls_wrapper() ;
1043
  }
1044
 
1045
  $options = $this->get_site_options() ;
inc/img_optm.class.php CHANGED
@@ -32,6 +32,7 @@ class LiteSpeed_Cache_Img_Optm
32
  const DB_IMG_OPTIMIZE_STATUS_FAILED = 'failed' ;
33
  const DB_IMG_OPTIMIZE_STATUS_MISS = 'miss' ;
34
  const DB_IMG_OPTIMIZE_STATUS_ERR = 'err' ;
 
35
  const DB_IMG_OPTIMIZE_SIZE = 'litespeed-optimize-size' ;
36
 
37
  const DB_IMG_OPTM_SUMMARY = 'litespeed_img_optm_summary' ;
@@ -144,6 +145,7 @@ class LiteSpeed_Cache_Img_Optm
144
 
145
  $meta_value = $this->_parse_wp_meta_value( $v ) ;
146
  if ( ! $meta_value ) {
 
147
  continue ;
148
  }
149
 
@@ -330,6 +332,22 @@ class LiteSpeed_Cache_Img_Optm
330
  return $existing_img_list ;
331
  }
332
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
333
  /**
334
  * Handle existing same src path images
335
  *
@@ -1030,8 +1048,13 @@ class LiteSpeed_Cache_Img_Optm
1030
  return false ;
1031
  }
1032
 
 
 
 
 
 
1033
  try {
1034
- $meta_value = unserialize( $v->meta_value ) ;
1035
  }
1036
  catch ( \Exception $e ) {
1037
  LiteSpeed_Cache_Log::debug( '[Img_Optm] bypassed parsing meta due to meta_value not json: pid ' . $v->post_id ) ;
@@ -1339,6 +1362,7 @@ class LiteSpeed_Cache_Img_Optm
1339
  $total_err = $wpdb->get_var( $wpdb->prepare( $q, self::DB_IMG_OPTIMIZE_STATUS_ERR ) ) ;
1340
  $total_miss_groups = $wpdb->get_var( $wpdb->prepare( $q_groups, self::DB_IMG_OPTIMIZE_STATUS_MISS ) ) ;
1341
  $total_miss = $wpdb->get_var( $wpdb->prepare( $q, self::DB_IMG_OPTIMIZE_STATUS_MISS ) ) ;
 
1342
 
1343
  return array(
1344
  'total_img' => $total_img,
@@ -1353,6 +1377,7 @@ class LiteSpeed_Cache_Img_Optm
1353
  'total_server_finished' => $total_server_finished,
1354
  'total_pulled_groups' => $total_pulled_groups,
1355
  'total_pulled' => $total_pulled,
 
1356
  ) ;
1357
  }
1358
 
32
  const DB_IMG_OPTIMIZE_STATUS_FAILED = 'failed' ;
33
  const DB_IMG_OPTIMIZE_STATUS_MISS = 'miss' ;
34
  const DB_IMG_OPTIMIZE_STATUS_ERR = 'err' ;
35
+ const DB_IMG_OPTIMIZE_STATUS_XMETA = 'xmeta' ;
36
  const DB_IMG_OPTIMIZE_SIZE = 'litespeed-optimize-size' ;
37
 
38
  const DB_IMG_OPTM_SUMMARY = 'litespeed_img_optm_summary' ;
145
 
146
  $meta_value = $this->_parse_wp_meta_value( $v ) ;
147
  if ( ! $meta_value ) {
148
+ $this->_mark_wrong_meta_src( $v->post_id ) ;
149
  continue ;
150
  }
151
 
332
  return $existing_img_list ;
333
  }
334
 
335
+ /**
336
+ * Save failed to parse meta info
337
+ *
338
+ * @since 2.1.1
339
+ * @access private
340
+ */
341
+ private function _mark_wrong_meta_src( $pid )
342
+ {
343
+ $data = array(
344
+ $pid,
345
+ self::DB_IMG_OPTIMIZE_STATUS_XMETA,
346
+ ) ;
347
+ $this->_insert_img_optm( $data, 'post_id, optm_status' ) ;
348
+ LiteSpeed_Cache_Log::debug( '[Img_Optm] Mark wrong meta [pid] ' . $pid ) ;
349
+ }
350
+
351
  /**
352
  * Handle existing same src path images
353
  *
1048
  return false ;
1049
  }
1050
 
1051
+ if ( function_exists( 'is_serialized' ) && ! is_serialized( $v->meta_value ) ) {
1052
+ LiteSpeed_Cache_Log::debug( '[Img_Optm] bypassed parsing meta due to wrong meta_value: pid ' . $v->post_id ) ;
1053
+ return false ;
1054
+ }
1055
+
1056
  try {
1057
+ $meta_value = @unserialize( $v->meta_value ) ;
1058
  }
1059
  catch ( \Exception $e ) {
1060
  LiteSpeed_Cache_Log::debug( '[Img_Optm] bypassed parsing meta due to meta_value not json: pid ' . $v->post_id ) ;
1362
  $total_err = $wpdb->get_var( $wpdb->prepare( $q, self::DB_IMG_OPTIMIZE_STATUS_ERR ) ) ;
1363
  $total_miss_groups = $wpdb->get_var( $wpdb->prepare( $q_groups, self::DB_IMG_OPTIMIZE_STATUS_MISS ) ) ;
1364
  $total_miss = $wpdb->get_var( $wpdb->prepare( $q, self::DB_IMG_OPTIMIZE_STATUS_MISS ) ) ;
1365
+ $total_xmeta_groups = $wpdb->get_var( $wpdb->prepare( $q, self::DB_IMG_OPTIMIZE_STATUS_XMETA ) ) ;
1366
 
1367
  return array(
1368
  'total_img' => $total_img,
1377
  'total_server_finished' => $total_server_finished,
1378
  'total_pulled_groups' => $total_pulled_groups,
1379
  'total_pulled' => $total_pulled,
1380
+ 'total_xmeta_groups' => $total_xmeta_groups,
1381
  ) ;
1382
  }
1383
 
inc/litespeed-cache.class.php CHANGED
@@ -19,7 +19,7 @@ class LiteSpeed_Cache
19
  private static $_instance ;
20
 
21
  const PLUGIN_NAME = 'litespeed-cache' ;
22
- const PLUGIN_VERSION = '2.1' ;
23
 
24
  const PAGE_EDIT_HTACCESS = 'lscache-edit-htaccess' ;
25
 
19
  private static $_instance ;
20
 
21
  const PLUGIN_NAME = 'litespeed-cache' ;
22
+ const PLUGIN_VERSION = '2.1.1' ;
23
 
24
  const PAGE_EDIT_HTACCESS = 'lscache-edit-htaccess' ;
25
 
includes/litespeed-cache-activation.class.php CHANGED
@@ -55,7 +55,7 @@ class LiteSpeed_Cache_Activation
55
  public static function uninstall_litespeed_cache()
56
  {
57
  LiteSpeed_Cache_Task::clear() ;
58
- LiteSpeed_Cache_Admin_Rules::get_instance()->clear_rules( true ) ;
59
  delete_option( LiteSpeed_Cache_Config::OPTION_NAME ) ;
60
  if ( is_multisite() ) {
61
  delete_site_option( LiteSpeed_Cache_Config::OPTION_NAME ) ;
@@ -181,7 +181,7 @@ class LiteSpeed_Cache_Activation
181
  if ( ! self::is_deactivate_last() ) {
182
  if ( is_network_admin() ) {
183
  // Still other activated subsite left, set .htaccess with only CacheLookUp
184
- LiteSpeed_Cache_Admin_Rules::get_instance()->insert_wrapper() ;
185
  }
186
  return ;
187
  }
@@ -211,7 +211,7 @@ class LiteSpeed_Cache_Activation
211
  error_log('In wp-config.php: WP_CACHE could not be set to false during deactivation!') ;
212
  }
213
 
214
- LiteSpeed_Cache_Admin_Rules::get_instance()->clear_rules( true ) ;
215
 
216
  // delete in case it's not deleted prior to deactivation.
217
  self::dismiss_whm() ;
55
  public static function uninstall_litespeed_cache()
56
  {
57
  LiteSpeed_Cache_Task::clear() ;
58
+ LiteSpeed_Cache_Admin_Rules::get_instance()->clear_rules() ;
59
  delete_option( LiteSpeed_Cache_Config::OPTION_NAME ) ;
60
  if ( is_multisite() ) {
61
  delete_site_option( LiteSpeed_Cache_Config::OPTION_NAME ) ;
181
  if ( ! self::is_deactivate_last() ) {
182
  if ( is_network_admin() ) {
183
  // Still other activated subsite left, set .htaccess with only CacheLookUp
184
+ LiteSpeed_Cache_Admin_Rules::get_instance()->insert_ls_wrapper() ;
185
  }
186
  return ;
187
  }
211
  error_log('In wp-config.php: WP_CACHE could not be set to false during deactivation!') ;
212
  }
213
 
214
+ LiteSpeed_Cache_Admin_Rules::get_instance()->clear_rules() ;
215
 
216
  // delete in case it's not deleted prior to deactivation.
217
  self::dismiss_whm() ;
includes/litespeed-cache-config.class.php CHANGED
@@ -1033,13 +1033,13 @@ class LiteSpeed_Cache_Config
1033
  if ( ! is_network_admin() ) {
1034
  if ( $count === 1 ) {
1035
  // Only itself is activated, set .htaccess with only CacheLookUp
1036
- LiteSpeed_Cache_Admin_Rules::get_instance()->insert_wrapper() ;
1037
  }
1038
  return ;
1039
  }
1040
  else {
1041
  // Network admin should make a wapper to avoid subblogs cache not work
1042
- LiteSpeed_Cache_Admin_Rules::get_instance()->insert_wrapper() ;
1043
  }
1044
 
1045
  $options = $this->get_site_options() ;
1033
  if ( ! is_network_admin() ) {
1034
  if ( $count === 1 ) {
1035
  // Only itself is activated, set .htaccess with only CacheLookUp
1036
+ LiteSpeed_Cache_Admin_Rules::get_instance()->insert_ls_wrapper() ;
1037
  }
1038
  return ;
1039
  }
1040
  else {
1041
  // Network admin should make a wapper to avoid subblogs cache not work
1042
+ LiteSpeed_Cache_Admin_Rules::get_instance()->insert_ls_wrapper() ;
1043
  }
1044
 
1045
  $options = $this->get_site_options() ;
includes/litespeed-cache.class.php CHANGED
@@ -19,7 +19,7 @@ class LiteSpeed_Cache
19
  private static $_instance ;
20
 
21
  const PLUGIN_NAME = 'litespeed-cache' ;
22
- const PLUGIN_VERSION = '2.1' ;
23
 
24
  const PAGE_EDIT_HTACCESS = 'lscache-edit-htaccess' ;
25
 
19
  private static $_instance ;
20
 
21
  const PLUGIN_NAME = 'litespeed-cache' ;
22
+ const PLUGIN_VERSION = '2.1.1' ;
23
 
24
  const PAGE_EDIT_HTACCESS = 'lscache-edit-htaccess' ;
25
 
languages/litespeed-cache.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the same license as the LiteSpeed Cache package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: LiteSpeed Cache 2.1\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/litespeed-cache\n"
7
- "POT-Creation-Date: 2018-03-15 15:02:49+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -110,7 +110,7 @@ msgid "Server variable(s) %s available to override this setting."
110
  msgstr ""
111
 
112
  #: admin/litespeed-cache-admin-display.class.php:934
113
- #: admin/tpl/image_optimization.php:150 admin/tpl/image_optimization.php:207
114
  #: admin/tpl/manage/manage_cdn.php:60
115
  #: admin/tpl/setting/settings_advanced.php:10
116
  #: admin/tpl/setting/settings_advanced.php:36
@@ -393,13 +393,13 @@ msgstr ""
393
  msgid "Failed to push to LiteSpeed server: %s"
394
  msgstr ""
395
 
396
- #: admin/litespeed-cache-admin-rules.class.php:688
397
  msgid ""
398
  "<p>Please add/replace the following codes into the beginning of %1$s:</p> "
399
  "%2$s"
400
  msgstr ""
401
 
402
- #: admin/litespeed-cache-admin-rules.class.php:886
403
  msgid "File Saved."
404
  msgstr ""
405
 
@@ -552,7 +552,7 @@ msgstr ""
552
 
553
  #: admin/tpl/crawler.php:94
554
  msgid ""
555
- "See <a %s>Introduction for Enabling the Crawler</a> for detailed infomation."
556
  msgstr ""
557
 
558
  #: admin/tpl/crawler.php:101
@@ -805,7 +805,7 @@ msgstr ""
805
  msgid "Click the %s button or wait for the cron job to finish the pull action."
806
  msgstr ""
807
 
808
- #: admin/tpl/image_optimization.php:54 admin/tpl/image_optimization.php:190
809
  msgid "Pull Images"
810
  msgstr ""
811
 
@@ -866,104 +866,108 @@ msgid "Images requested"
866
  msgstr ""
867
 
868
  #: admin/tpl/image_optimization.php:170
869
- msgid "Images failed to optimize"
870
- msgstr ""
871
-
872
- #: admin/tpl/image_optimization.php:175
873
- msgid "Image files missing"
874
- msgstr ""
875
-
876
- #: admin/tpl/image_optimization.php:180
877
  msgid ""
878
  "After LiteSpeed's Image Optimization Server finishes optimization, it will "
879
  "notify your site to pull the optimized images."
880
  msgstr ""
881
 
882
- #: admin/tpl/image_optimization.php:181
883
  msgid "This process is automatic."
884
  msgstr ""
885
 
886
- #: admin/tpl/image_optimization.php:184
887
  msgid "Images notified to pull"
888
  msgstr ""
889
 
890
- #: admin/tpl/image_optimization.php:193
891
  msgid "Only press the button if the pull cron job is disabled."
892
  msgstr ""
893
 
894
- #: admin/tpl/image_optimization.php:194
895
  msgid "Images will be pulled automatically if the cron job is running."
896
  msgstr ""
897
 
898
- #: admin/tpl/image_optimization.php:198
899
  msgid "Last pull initiated by cron at %s."
900
  msgstr ""
901
 
902
- #: admin/tpl/image_optimization.php:203
903
  msgid "Images optimized and pulled"
904
  msgstr ""
905
 
906
- #: admin/tpl/image_optimization.php:212
 
 
 
 
 
 
 
 
 
 
 
 
907
  msgid "Revert Optimization"
908
  msgstr ""
909
 
910
- #: admin/tpl/image_optimization.php:215
911
  msgid ""
912
  "Switch all images in the media library back to their original unoptimized "
913
  "versions."
914
  msgstr ""
915
 
916
- #: admin/tpl/image_optimization.php:221
917
  msgid "Undo Optimization"
918
  msgstr ""
919
 
920
- #: admin/tpl/image_optimization.php:224
921
  msgid "Revert all optimized images back to their original versions."
922
  msgstr ""
923
 
924
- #: admin/tpl/image_optimization.php:230
925
  msgid "Re-do Optimization"
926
  msgstr ""
927
 
928
- #: admin/tpl/image_optimization.php:233
929
  msgid "Switch back to using optimized images."
930
  msgstr ""
931
 
932
- #: admin/tpl/image_optimization.php:238
933
  msgid "Results can be checked in <a %s>Media Library</a>."
934
  msgstr ""
935
 
936
- #: admin/tpl/image_optimization.php:242
937
  msgid "Send New Thumbnail Requests"
938
  msgstr ""
939
 
940
- #: admin/tpl/image_optimization.php:245
941
  msgid ""
942
  "Scan for any new unoptimized image thumbnail sizes and resend necessary "
943
  "image optimization requests."
944
  msgstr ""
945
 
946
- #: admin/tpl/image_optimization.php:250
947
  msgid "Reset IAPI Key"
948
  msgstr ""
949
 
950
- #: admin/tpl/image_optimization.php:253
951
  msgid ""
952
  "The current IAPI key must be reset after changing home URL or domain before "
953
  "making any further optimization requests."
954
  msgstr ""
955
 
956
- #: admin/tpl/image_optimization.php:258
957
  msgid "Destroy All Optimization Data!"
958
  msgstr ""
959
 
960
- #: admin/tpl/image_optimization.php:261
961
  msgid ""
962
  "Remove all previous image optimization requests/results, revert completed "
963
  "optimizations, and delete all optimization files."
964
  msgstr ""
965
 
966
- #: admin/tpl/image_optimization.php:263
967
  #: admin/tpl/setting/settings_advanced.php:50
968
  #: admin/tpl/setting/settings_cdn.php:97
969
  #: admin/tpl/setting/settings_crawler.php:22
@@ -985,13 +989,13 @@ msgstr ""
985
  msgid "NOTE"
986
  msgstr ""
987
 
988
- #: admin/tpl/image_optimization.php:264
989
  msgid ""
990
  "If there are unfinished requests in progress, the requests' credits will NOT "
991
  "be recovered."
992
  msgstr ""
993
 
994
- #: admin/tpl/image_optimization.php:264
995
  #: admin/tpl/setting/settings_optimize.php:87
996
  #: admin/tpl/setting/settings_optimize.php:163
997
  msgid "JS Combine"
@@ -1040,7 +1044,7 @@ msgstr ""
1040
  msgid "Rate %s on %s"
1041
  msgstr ""
1042
 
1043
- #. #-#-#-#-# litespeed-cache.pot (LiteSpeed Cache 2.1) #-#-#-#-#
1044
  #. Plugin Name of the plugin/theme
1045
  #: admin/tpl/inc/admin_footer.php:6 inc/gui.class.php:341
1046
  #: includes/litespeed-cache-gui.class.php:341
@@ -3688,62 +3692,62 @@ msgstr ""
3688
  msgid "Cloudflare Purge All"
3689
  msgstr ""
3690
 
3691
- #: inc/img_optm.class.php:76
3692
  msgid "Failed to communicate with LiteSpeed IAPI server"
3693
  msgstr ""
3694
 
3695
- #: inc/img_optm.class.php:85
3696
  msgid "Communicated with LiteSpeed Image Optimization Server successfully."
3697
  msgstr ""
3698
 
3699
- #: inc/img_optm.class.php:134 inc/img_optm.class.php:1154
3700
- #: inc/img_optm.class.php:1219
3701
  msgid "No image found."
3702
  msgstr ""
3703
 
3704
- #: inc/img_optm.class.php:161
3705
  msgid "Number of images in one image group (%s) exceeds the credit (%s)"
3706
  msgstr ""
3707
 
3708
- #: inc/img_optm.class.php:189
3709
  msgid "Requested successfully."
3710
  msgstr ""
3711
 
3712
- #: inc/img_optm.class.php:209
3713
  msgid "Optimized successfully."
3714
  msgstr ""
3715
 
3716
- #: inc/img_optm.class.php:266
3717
  msgid "Pushed %1$s to LiteSpeed optimization server, accepted %2$s."
3718
  msgstr ""
3719
 
3720
- #: inc/img_optm.class.php:602
3721
  msgid "Failed to push to LiteSpeed IAPI server: %s"
3722
  msgstr ""
3723
 
3724
- #: inc/img_optm.class.php:610
3725
  msgid "Failed to parse data from LiteSpeed IAPI server: %s"
3726
  msgstr ""
3727
 
3728
- #: inc/img_optm.class.php:1257
3729
  msgid ""
3730
  "Pushed %1$s groups with %2$s images to LiteSpeed optimization server, "
3731
  "accepted %3$s groups with %4$s images."
3732
  msgstr ""
3733
 
3734
- #: inc/img_optm.class.php:1479
3735
  msgid "Disabled WebP file successfully."
3736
  msgstr ""
3737
 
3738
- #: inc/img_optm.class.php:1485
3739
  msgid "Enabled WebP file successfully."
3740
  msgstr ""
3741
 
3742
- #: inc/img_optm.class.php:1501
3743
  msgid "Restored original file successfully."
3744
  msgstr ""
3745
 
3746
- #: inc/img_optm.class.php:1508
3747
  msgid "Switched to optimized file successfully."
3748
  msgstr ""
3749
 
2
  # This file is distributed under the same license as the LiteSpeed Cache package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: LiteSpeed Cache 2.1.1\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/litespeed-cache\n"
7
+ "POT-Creation-Date: 2018-03-19 20:32:22+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
110
  msgstr ""
111
 
112
  #: admin/litespeed-cache-admin-display.class.php:934
113
+ #: admin/tpl/image_optimization.php:150 admin/tpl/image_optimization.php:211
114
  #: admin/tpl/manage/manage_cdn.php:60
115
  #: admin/tpl/setting/settings_advanced.php:10
116
  #: admin/tpl/setting/settings_advanced.php:36
393
  msgid "Failed to push to LiteSpeed server: %s"
394
  msgstr ""
395
 
396
+ #: admin/litespeed-cache-admin-rules.class.php:876
397
  msgid ""
398
  "<p>Please add/replace the following codes into the beginning of %1$s:</p> "
399
  "%2$s"
400
  msgstr ""
401
 
402
+ #: admin/litespeed-cache-admin-rules.class.php:979
403
  msgid "File Saved."
404
  msgstr ""
405
 
552
 
553
  #: admin/tpl/crawler.php:94
554
  msgid ""
555
+ "See <a %s>Introduction for Enabling the Crawler</a> for detailed information."
556
  msgstr ""
557
 
558
  #: admin/tpl/crawler.php:101
805
  msgid "Click the %s button or wait for the cron job to finish the pull action."
806
  msgstr ""
807
 
808
+ #: admin/tpl/image_optimization.php:54 admin/tpl/image_optimization.php:180
809
  msgid "Pull Images"
810
  msgstr ""
811
 
866
  msgstr ""
867
 
868
  #: admin/tpl/image_optimization.php:170
 
 
 
 
 
 
 
 
869
  msgid ""
870
  "After LiteSpeed's Image Optimization Server finishes optimization, it will "
871
  "notify your site to pull the optimized images."
872
  msgstr ""
873
 
874
+ #: admin/tpl/image_optimization.php:171
875
  msgid "This process is automatic."
876
  msgstr ""
877
 
878
+ #: admin/tpl/image_optimization.php:174
879
  msgid "Images notified to pull"
880
  msgstr ""
881
 
882
+ #: admin/tpl/image_optimization.php:183
883
  msgid "Only press the button if the pull cron job is disabled."
884
  msgstr ""
885
 
886
+ #: admin/tpl/image_optimization.php:184
887
  msgid "Images will be pulled automatically if the cron job is running."
888
  msgstr ""
889
 
890
+ #: admin/tpl/image_optimization.php:188
891
  msgid "Last pull initiated by cron at %s."
892
  msgstr ""
893
 
894
+ #: admin/tpl/image_optimization.php:193
895
  msgid "Images optimized and pulled"
896
  msgstr ""
897
 
898
+ #: admin/tpl/image_optimization.php:198
899
+ msgid "Images failed to optimize"
900
+ msgstr ""
901
+
902
+ #: admin/tpl/image_optimization.php:203
903
+ msgid "Image files missing"
904
+ msgstr ""
905
+
906
+ #: admin/tpl/image_optimization.php:208
907
+ msgid "Images with wrong meta"
908
+ msgstr ""
909
+
910
+ #: admin/tpl/image_optimization.php:216
911
  msgid "Revert Optimization"
912
  msgstr ""
913
 
914
+ #: admin/tpl/image_optimization.php:219
915
  msgid ""
916
  "Switch all images in the media library back to their original unoptimized "
917
  "versions."
918
  msgstr ""
919
 
920
+ #: admin/tpl/image_optimization.php:225
921
  msgid "Undo Optimization"
922
  msgstr ""
923
 
924
+ #: admin/tpl/image_optimization.php:228
925
  msgid "Revert all optimized images back to their original versions."
926
  msgstr ""
927
 
928
+ #: admin/tpl/image_optimization.php:234
929
  msgid "Re-do Optimization"
930
  msgstr ""
931
 
932
+ #: admin/tpl/image_optimization.php:237
933
  msgid "Switch back to using optimized images."
934
  msgstr ""
935
 
936
+ #: admin/tpl/image_optimization.php:242
937
  msgid "Results can be checked in <a %s>Media Library</a>."
938
  msgstr ""
939
 
940
+ #: admin/tpl/image_optimization.php:246
941
  msgid "Send New Thumbnail Requests"
942
  msgstr ""
943
 
944
+ #: admin/tpl/image_optimization.php:249
945
  msgid ""
946
  "Scan for any new unoptimized image thumbnail sizes and resend necessary "
947
  "image optimization requests."
948
  msgstr ""
949
 
950
+ #: admin/tpl/image_optimization.php:254
951
  msgid "Reset IAPI Key"
952
  msgstr ""
953
 
954
+ #: admin/tpl/image_optimization.php:257
955
  msgid ""
956
  "The current IAPI key must be reset after changing home URL or domain before "
957
  "making any further optimization requests."
958
  msgstr ""
959
 
960
+ #: admin/tpl/image_optimization.php:262
961
  msgid "Destroy All Optimization Data!"
962
  msgstr ""
963
 
964
+ #: admin/tpl/image_optimization.php:265
965
  msgid ""
966
  "Remove all previous image optimization requests/results, revert completed "
967
  "optimizations, and delete all optimization files."
968
  msgstr ""
969
 
970
+ #: admin/tpl/image_optimization.php:267
971
  #: admin/tpl/setting/settings_advanced.php:50
972
  #: admin/tpl/setting/settings_cdn.php:97
973
  #: admin/tpl/setting/settings_crawler.php:22
989
  msgid "NOTE"
990
  msgstr ""
991
 
992
+ #: admin/tpl/image_optimization.php:268
993
  msgid ""
994
  "If there are unfinished requests in progress, the requests' credits will NOT "
995
  "be recovered."
996
  msgstr ""
997
 
998
+ #: admin/tpl/image_optimization.php:268
999
  #: admin/tpl/setting/settings_optimize.php:87
1000
  #: admin/tpl/setting/settings_optimize.php:163
1001
  msgid "JS Combine"
1044
  msgid "Rate %s on %s"
1045
  msgstr ""
1046
 
1047
+ #. #-#-#-#-# litespeed-cache.pot (LiteSpeed Cache 2.1.1) #-#-#-#-#
1048
  #. Plugin Name of the plugin/theme
1049
  #: admin/tpl/inc/admin_footer.php:6 inc/gui.class.php:341
1050
  #: includes/litespeed-cache-gui.class.php:341
3692
  msgid "Cloudflare Purge All"
3693
  msgstr ""
3694
 
3695
+ #: inc/img_optm.class.php:77
3696
  msgid "Failed to communicate with LiteSpeed IAPI server"
3697
  msgstr ""
3698
 
3699
+ #: inc/img_optm.class.php:86
3700
  msgid "Communicated with LiteSpeed Image Optimization Server successfully."
3701
  msgstr ""
3702
 
3703
+ #: inc/img_optm.class.php:135 inc/img_optm.class.php:1177
3704
+ #: inc/img_optm.class.php:1242
3705
  msgid "No image found."
3706
  msgstr ""
3707
 
3708
+ #: inc/img_optm.class.php:163
3709
  msgid "Number of images in one image group (%s) exceeds the credit (%s)"
3710
  msgstr ""
3711
 
3712
+ #: inc/img_optm.class.php:191
3713
  msgid "Requested successfully."
3714
  msgstr ""
3715
 
3716
+ #: inc/img_optm.class.php:211
3717
  msgid "Optimized successfully."
3718
  msgstr ""
3719
 
3720
+ #: inc/img_optm.class.php:268
3721
  msgid "Pushed %1$s to LiteSpeed optimization server, accepted %2$s."
3722
  msgstr ""
3723
 
3724
+ #: inc/img_optm.class.php:620
3725
  msgid "Failed to push to LiteSpeed IAPI server: %s"
3726
  msgstr ""
3727
 
3728
+ #: inc/img_optm.class.php:628
3729
  msgid "Failed to parse data from LiteSpeed IAPI server: %s"
3730
  msgstr ""
3731
 
3732
+ #: inc/img_optm.class.php:1280
3733
  msgid ""
3734
  "Pushed %1$s groups with %2$s images to LiteSpeed optimization server, "
3735
  "accepted %3$s groups with %4$s images."
3736
  msgstr ""
3737
 
3738
+ #: inc/img_optm.class.php:1504
3739
  msgid "Disabled WebP file successfully."
3740
  msgstr ""
3741
 
3742
+ #: inc/img_optm.class.php:1510
3743
  msgid "Enabled WebP file successfully."
3744
  msgstr ""
3745
 
3746
+ #: inc/img_optm.class.php:1526
3747
  msgid "Restored original file successfully."
3748
  msgstr ""
3749
 
3750
+ #: inc/img_optm.class.php:1533
3751
  msgid "Switched to optimized file successfully."
3752
  msgstr ""
3753
 
lib/litespeed/litespeed-file.class.php CHANGED
@@ -270,7 +270,7 @@ class Litespeed_File
270
  */
271
  private static function _extract_from_markers( $filename, $marker )
272
  {
273
- $result = array () ;
274
 
275
  if (!file_exists($filename) ) {
276
  return $result ;
270
  */
271
  private static function _extract_from_markers( $filename, $marker )
272
  {
273
+ $result = array() ;
274
 
275
  if (!file_exists($filename) ) {
276
  return $result ;
litespeed-cache.php CHANGED
@@ -15,7 +15,7 @@
15
  * Plugin Name: LiteSpeed Cache
16
  * Plugin URI: https://www.litespeedtech.com/products/cache-plugins/wordpress-acceleration
17
  * Description: WordPress plugin to connect to LSCache on LiteSpeed Web Server.
18
- * Version: 2.1
19
  * Author: LiteSpeed Technologies
20
  * Author URI: https://www.litespeedtech.com
21
  * License: GPLv3
15
  * Plugin Name: LiteSpeed Cache
16
  * Plugin URI: https://www.litespeedtech.com/products/cache-plugins/wordpress-acceleration
17
  * Description: WordPress plugin to connect to LSCache on LiteSpeed Web Server.
18
+ * Version: 2.1.1
19
  * Author: LiteSpeed Technologies
20
  * Author URI: https://www.litespeedtech.com
21
  * License: GPLv3
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: LiteSpeedTech
3
  Tags: cache, wp-cache, litespeed, super cache, http2, total cache, optimize, object cache, redis, memcached, lazy load, database cleaner
4
  Requires at least: 4.0
5
  Tested up to: 4.9.4
6
- Stable tag: 2.1
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl.html
9
 
@@ -19,19 +19,21 @@ LSCWP supports WordPress Multisite and is compatible with most popular plugins,
19
 
20
  = General Features =
21
 
22
- * Image optimization
 
 
 
 
 
23
  * Load CSS/JS Asynchronously
24
- * Content Delivery Network support
 
25
  * Database Cleaner and Optimizer
 
26
  * OPcode Cache
27
- * Lazyload images/iframes
28
- * Minify CSS, JavaScript, and HTML
29
- * Combine CSS and JavaScript
30
  * HTTP/2 Push for CSS and JS
31
- * Object Cache (Memcached/LSMCD/Redis)
32
  * DNS Prefetch
33
  * Cloudflare API
34
- * Smart preload crawler with support for SEO-friendly sitemap
35
  * Single Site and Multi Site (Network) support
36
  * Import/Export settings
37
  * Basic/Advanced setting view
@@ -41,8 +43,6 @@ LSCWP supports WordPress Multisite and is compatible with most popular plugins,
41
 
42
  = LiteSpeed Exclusive Features =
43
 
44
- * PageSpeed score optimization
45
- * Browser Cache
46
  * Automatic page caching to greatly improve site performance
47
  * Automatic purge of related pages based on certain events
48
  * Private cache for logged-in users
@@ -80,11 +80,11 @@ NOTE: **LiteSpeed Exclusive Features** require the use of a LiteSpeed web server
80
  18. Frontend Adminbar Shortcut
81
 
82
  == LSCWP Resources ==
83
- [Join our Slack community](https://goo.gl/FG9S4N) to connect with other LiteSpeed users.
84
- [Ask a question on our support forum](https://wordpress.org/support/plugin/litespeed-cache/).
85
- [View detailed documentation on our wiki](https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp).
86
- [Read WordPress Wednesday tutorials on our blog](http://blog.litespeedtech.com/tag/wordpress-wednesday).
87
- [Help translate LSCWP](https://translate.wordpress.org/projects/wp-plugins/litespeed-cache).
88
 
89
  == Installation ==
90
 
@@ -250,42 +250,46 @@ Click on the `Advanced View` link at the top of the page, and several more tabs
250
 
251
  == Changelog ==
252
 
 
 
 
 
253
  = 2.1 - Mar 15 2018 =
254
- * [NEW FEATURE] <b>Image Optimization</b> Unlocked for non-LiteSpeed users.
255
- * [NEW FEATURE] <b>Object Cache</b> Unlocked for non-LiteSpeed users.
256
- * [NEW FEATURE] <b>Crawler</b> Unlocked for non-LiteSpeed users.
257
- * [NEW FEATURE] <b>Database Cleaner and Optimizer</b> Unlocked for non-LiteSpeed users.
258
- * [NEW FEATURE] <b>Lazy Load Images</b> Unlocked for non-LiteSpeed users.
259
- * [NEW FEATURE] <b>CSS/JS/HTML Minify/Combine Optimize</b> Unlocked for non-LiteSpeed users.
260
  * [IAPI] IAPI v2.0.
261
  * [IAPI] Increased max rows prefetch when client has additional credit.
262
- * [IMPROVEMENT] <b>CDN</b> Multiple domains may now be used.
263
- * [IMPROVEMENT] <b>Report</b> Added WP environment constants for better debugging.
264
  * [REFACTOR] Separated Cloudflare CDN class.
265
- * [BUGFIX] <b>Image Optimization</b> Fixed issue where certain MySQL version failed to create img_optm table. (@philippwidmer)
266
- * [BUGFIX] <b>Image Optimization</b> Fixed issue where callback validation failed when pulling and sending request simultaneously.
267
  * [GUI] Added Slack community banner.
268
  * [INTEGRATION] CDN compatibility with WPML multiple domains. (@egemensarica)
269
 
270
  = 2.0 - Mar 7 2018 =
271
- * [NEW FEATURE] <b>Image Optimization</b> Added level up guidance.
272
- * [REFACTOR] <b>Image Optimization</b> Refactored Image Optimization class.
273
- * [IAPI] <b>Image Optimization</b> New European Image Optimization server (EU2).
274
- * [IMPROVEMENT] <b>Image Optimization</b> Manual pull action continues pulling until complete.
275
- * [IMPROVEMENT] <b>CDN</b> Multiple CDNs can now be randomized for a single resource.
276
- * [IMPROVEMENT] <b>Image Optimization</b> Improved compatibility of long src images.
277
- * [IMPROVEMENT] <b>Image Optimization</b> Reduced runtime load.
278
- * [IMPROVEMENT] <b>Image Optimization</b> Avoid potential loss/reset of notified images status when pulling.
279
- * [IMPROVEMENT] <b>Image Optimization</b> Avoid duplicated optimization for multiple records in Media that have the same image source.
280
- * [IMPROVEMENT] <b>Image Optimization</b> Fixed issue where phantom images continued to show in not-yet-requested queue.
281
- * [BUGFIX] <b>Core</b> Improved compatibility when upgrading outside of WP Admin. (@jikatal @TylorB)
282
- * [BUGFIX] <b>Crawler</b> Improved HTTP/2 compatibility to avoid erroneous blacklisting.
283
- * [BUGFIX] <b>Crawler</b> Changing Delay setting will use server variable for min value validation if set.
284
- * [UPDATE] <b>Crawler</b> Added HTTP/2 protocol switch in the Crawler settings.
285
  * [UPDATE] Removed unnecessary translation strings.
286
  * [GUI] Display translated role group name string instead of English values. (@Richard Hordern)
287
  * [GUI] Added Join LiteSpeed Slack link.
288
- * [GUI] <b>Import / Export</b> Cosmetic changes to Import Settings file field.
289
  * [INTEGRATION] Improved compatibility with WPML Media for Image Optimization. (@szmigieldesign)
290
 
291
  = 1.9.1.1 - February 20 2018 =
3
  Tags: cache, wp-cache, litespeed, super cache, http2, total cache, optimize, object cache, redis, memcached, lazy load, database cleaner
4
  Requires at least: 4.0
5
  Tested up to: 4.9.4
6
+ Stable tag: 2.1.1
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl.html
9
 
19
 
20
  = General Features =
21
 
22
+ * Object Cache (Memcached/LSMCD/Redis)
23
+ * Image Optimization
24
+ * Minify CSS, JavaScript, and HTML
25
+ * Combine CSS and JavaScript
26
+ * Lazyload images/iframes
27
+ * Multiple CDN support
28
  * Load CSS/JS Asynchronously
29
+ * Browser Cache
30
+ * Smart preload crawler with support for SEO-friendly sitemap
31
  * Database Cleaner and Optimizer
32
+ * PageSpeed score optimization
33
  * OPcode Cache
 
 
 
34
  * HTTP/2 Push for CSS and JS
 
35
  * DNS Prefetch
36
  * Cloudflare API
 
37
  * Single Site and Multi Site (Network) support
38
  * Import/Export settings
39
  * Basic/Advanced setting view
43
 
44
  = LiteSpeed Exclusive Features =
45
 
 
 
46
  * Automatic page caching to greatly improve site performance
47
  * Automatic purge of related pages based on certain events
48
  * Private cache for logged-in users
80
  18. Frontend Adminbar Shortcut
81
 
82
  == LSCWP Resources ==
83
+ * [Join our Slack community](https://goo.gl/FG9S4N) to connect with other LiteSpeed users.
84
+ * [Ask a question on our support forum](https://wordpress.org/support/plugin/litespeed-cache/).
85
+ * [View detailed documentation on our wiki](https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp).
86
+ * [Read WordPress Wednesday tutorials on our blog](http://blog.litespeedtech.com/tag/wordpress-wednesday).
87
+ * [Help translate LSCWP](https://translate.wordpress.org/projects/wp-plugins/litespeed-cache).
88
 
89
  == Installation ==
90
 
250
 
251
  == Changelog ==
252
 
253
+ = 2.1.1 - Mar 20 2018 =
254
+ * [NEW FEATURE] <strong>Browser Cache</strong> Unlocked for non-LiteSpeed users.
255
+ * [IMPROVEMENT] <strong>Image Optimization</strong> Fixed issue where images with bad postmeta value continued to show in not-yet-requested queue.
256
+
257
  = 2.1 - Mar 15 2018 =
258
+ * [NEW FEATURE] <strong>Image Optimization</strong> Unlocked for non-LiteSpeed users.
259
+ * [NEW FEATURE] <strong>Object Cache</strong> Unlocked for non-LiteSpeed users.
260
+ * [NEW FEATURE] <strong>Crawler</strong> Unlocked for non-LiteSpeed users.
261
+ * [NEW FEATURE] <strong>Database Cleaner and Optimizer</strong> Unlocked for non-LiteSpeed users.
262
+ * [NEW FEATURE] <strong>Lazy Load Images</strong> Unlocked for non-LiteSpeed users.
263
+ * [NEW FEATURE] <strong>CSS/JS/HTML Minify/Combine Optimize</strong> Unlocked for non-LiteSpeed users.
264
  * [IAPI] IAPI v2.0.
265
  * [IAPI] Increased max rows prefetch when client has additional credit.
266
+ * [IMPROVEMENT] <strong>CDN</strong> Multiple domains may now be used.
267
+ * [IMPROVEMENT] <strong>Report</strong> Added WP environment constants for better debugging.
268
  * [REFACTOR] Separated Cloudflare CDN class.
269
+ * [BUGFIX] <strong>Image Optimization</strong> Fixed issue where certain MySQL version failed to create img_optm table. (@philippwidmer)
270
+ * [BUGFIX] <strong>Image Optimization</strong> Fixed issue where callback validation failed when pulling and sending request simultaneously.
271
  * [GUI] Added Slack community banner.
272
  * [INTEGRATION] CDN compatibility with WPML multiple domains. (@egemensarica)
273
 
274
  = 2.0 - Mar 7 2018 =
275
+ * [NEW FEATURE] <strong>Image Optimization</strong> Added level up guidance.
276
+ * [REFACTOR] <strong>Image Optimization</strong> Refactored Image Optimization class.
277
+ * [IAPI] <strong>Image Optimization</strong> New European Image Optimization server (EU2).
278
+ * [IMPROVEMENT] <strong>Image Optimization</strong> Manual pull action continues pulling until complete.
279
+ * [IMPROVEMENT] <strong>CDN</strong> Multiple CDNs can now be randomized for a single resource.
280
+ * [IMPROVEMENT] <strong>Image Optimization</strong> Improved compatibility of long src images.
281
+ * [IMPROVEMENT] <strong>Image Optimization</strong> Reduced runtime load.
282
+ * [IMPROVEMENT] <strong>Image Optimization</strong> Avoid potential loss/reset of notified images status when pulling.
283
+ * [IMPROVEMENT] <strong>Image Optimization</strong> Avoid duplicated optimization for multiple records in Media that have the same image source.
284
+ * [IMPROVEMENT] <strong>Image Optimization</strong> Fixed issue where phantom images continued to show in not-yet-requested queue.
285
+ * [BUGFIX] <strong>Core</strong> Improved compatibility when upgrading outside of WP Admin. (@jikatal @TylorB)
286
+ * [BUGFIX] <strong>Crawler</strong> Improved HTTP/2 compatibility to avoid erroneous blacklisting.
287
+ * [BUGFIX] <strong>Crawler</strong> Changing Delay setting will use server variable for min value validation if set.
288
+ * [UPDATE] <strong>Crawler</strong> Added HTTP/2 protocol switch in the Crawler settings.
289
  * [UPDATE] Removed unnecessary translation strings.
290
  * [GUI] Display translated role group name string instead of English values. (@Richard Hordern)
291
  * [GUI] Added Join LiteSpeed Slack link.
292
+ * [GUI] <strong>Import / Export</strong> Cosmetic changes to Import Settings file field.
293
  * [INTEGRATION] Improved compatibility with WPML Media for Image Optimization. (@szmigieldesign)
294
 
295
  = 1.9.1.1 - February 20 2018 =