Version Description
- Mar 28 2018 =
- [NEW] Image Optimization Clean Up Unfinished Data feature.
- [IAPI] IAPI v2.1.2.
- [IMPROVEMENT] CSS/JS Minify Reduced loading time significantly by improving CSS/JS minify loading process. (@kokers)
- [IMPROVEMENT] CSS/JS Minify Cache empty JS Minify content. (@kokers)
- [IMPROVEMENT] Cache Cache 301 redirect when scheme/host are same.
- [BUGFIX] Media Lazy load now can support webp. (@relle)
- [UPDATE] CSS/JS Optimize Serve static files for CSS async & lazy load JS library.
- [UPDATE] Report Appended Basic/Advanced View setting to Report.
- [UPDATE] CSS/JS Minify Removed zero-width space from CSS/JS content.
- [GUI] Added Purge CSS/JS Cache link in Admin.
Download this release
Release Info
Developer | LiteSpeedTech |
Plugin | LiteSpeed Cache |
Version | 2.1.2 |
Comparing to | |
See all releases |
Code changes from version 2.1.1.1 to 2.1.2
- admin/admin-api.class.php +1 -0
- admin/litespeed-cache-admin-report.class.php +9 -1
- admin/litespeed-cache-admin-rules.class.php +31 -8
- admin/tpl/edit_htaccess.php +3 -2
- admin/tpl/image_optimization.php +46 -24
- admin/tpl/manage/manage_purge.php +0 -5
- inc/config.class.php +6 -6
- inc/control.class.php +33 -15
- inc/gui.class.php +9 -1
- inc/img_optm.class.php +91 -27
- inc/litespeed-cache.class.php +10 -10
- inc/media.class.php +36 -26
- inc/optimize.class.php +97 -70
- inc/optimizer.class.php +17 -36
- inc/vary.class.php +2 -2
- includes/litespeed-cache-config.class.php +6 -6
- includes/litespeed-cache-control.class.php +33 -15
- includes/litespeed-cache-gui.class.php +9 -1
- includes/litespeed-cache-optimize.class.php +97 -70
- includes/litespeed-cache-vary.class.php +2 -2
- includes/litespeed-cache.class.php +10 -10
- languages/litespeed-cache.pot +114 -112
- lib/litespeed/litespeed-file.class.php +31 -1
- litespeed-cache.php +1 -1
- readme.txt +30 -15
admin/admin-api.class.php
CHANGED
@@ -29,6 +29,7 @@ class LiteSpeed_Cache_Admin_API
|
|
29 |
const IAPI_ACTION_PULL_IMG = 'client_pull' ;
|
30 |
const IAPI_ACTION_PULL_IMG_FAILED = 'client_pull_failed' ;
|
31 |
const IAPI_ACTION_REQUEST_DESTROY = 'imgoptm_destroy' ;
|
|
|
32 |
const IAPI_ACTION_ENV_REPORT = 'env_report' ;
|
33 |
|
34 |
/**
|
29 |
const IAPI_ACTION_PULL_IMG = 'client_pull' ;
|
30 |
const IAPI_ACTION_PULL_IMG_FAILED = 'client_pull_failed' ;
|
31 |
const IAPI_ACTION_REQUEST_DESTROY = 'imgoptm_destroy' ;
|
32 |
+
const IAPI_ACTION_REQUEST_DESTROY_UNFINISHED = 'imgoptm_destroy_unfinished' ;
|
33 |
const IAPI_ACTION_ENV_REPORT = 'env_report' ;
|
34 |
|
35 |
/**
|
admin/litespeed-cache-admin-report.class.php
CHANGED
@@ -171,7 +171,15 @@ class LiteSpeed_Cache_Admin_Report
|
|
171 |
}
|
172 |
}
|
173 |
|
174 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
175 |
|
176 |
$report = $this->build_environment_report($_SERVER, $options, $extras, $paths) ;
|
177 |
return $report ;
|
171 |
}
|
172 |
}
|
173 |
|
174 |
+
$item_options = array(
|
175 |
+
LiteSpeed_Cache_Config::ITEM_CDN_MAPPING,
|
176 |
+
LiteSpeed_Cache_Config::ITEM_SETTING_MODE,
|
177 |
+
) ;
|
178 |
+
|
179 |
+
foreach ( $item_options as $v ) {
|
180 |
+
$options[ $v ] = get_option( $v ) ;
|
181 |
+
}
|
182 |
+
|
183 |
|
184 |
$report = $this->build_environment_report($_SERVER, $options, $extras, $paths) ;
|
185 |
return $report ;
|
admin/litespeed-cache-admin-rules.class.php
CHANGED
@@ -24,14 +24,11 @@ class LiteSpeed_Cache_Admin_Rules
|
|
24 |
private $theme_htaccess_readable = false ;
|
25 |
private $theme_htaccess_writable = false ;
|
26 |
|
27 |
-
const RW_LOOKUP_BOTH = "CacheLookup on" ;
|
28 |
-
const RW_PRIV_BYPASS_POST_PURGE = "RewriteRule .* - [E=Cache-Control:no-autoflush]" ;
|
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' ;
|
@@ -73,10 +70,10 @@ class LiteSpeed_Cache_Admin_Rules
|
|
73 |
}
|
74 |
|
75 |
self::$LS_MODULE_REWRITE_ON = array(
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
) ;
|
81 |
|
82 |
// backend .htaccess privilege
|
@@ -526,6 +523,26 @@ class LiteSpeed_Cache_Admin_Rules
|
|
526 |
return $rules ;
|
527 |
}
|
528 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
529 |
/**
|
530 |
* Generate CORS rules for fonts
|
531 |
*
|
@@ -677,6 +694,12 @@ class LiteSpeed_Cache_Admin_Rules
|
|
677 |
$new_rules_nonls[] = '' ;
|
678 |
}
|
679 |
|
|
|
|
|
|
|
|
|
|
|
|
|
680 |
|
681 |
// Add module wrapper for LiteSpeed rules
|
682 |
if ( $new_rules || $disable_lscache_detail_rules ) {
|
24 |
private $theme_htaccess_readable = false ;
|
25 |
private $theme_htaccess_writable = false ;
|
26 |
|
|
|
|
|
|
|
|
|
27 |
const LS_MODULE_START = '<IfModule LiteSpeed>' ;
|
28 |
const EXPIRES_MODULE_START = '<IfModule mod_expires.c>' ;
|
29 |
const LS_MODULE_END = '</IfModule>' ;
|
30 |
const LS_MODULE_REWRITE_START = '<IfModule mod_rewrite.c>' ;
|
31 |
+
const REWRITE_ON = 'RewriteEngine on' ;
|
32 |
private static $LS_MODULE_REWRITE_ON ;
|
33 |
const LS_MODULE_DONOTEDIT = "## LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! ##" ;
|
34 |
const MARKER = 'LSCACHE' ;
|
70 |
}
|
71 |
|
72 |
self::$LS_MODULE_REWRITE_ON = array(
|
73 |
+
self::REWRITE_ON,
|
74 |
+
"CacheLookup on",
|
75 |
+
"RewriteRule .* - [E=Cache-Control:no-autoflush]",
|
76 |
+
"RewriteRule ^min/\w+\.(css|js) - [E=cache-control:no-vary]",
|
77 |
) ;
|
78 |
|
79 |
// backend .htaccess privilege
|
523 |
return $rules ;
|
524 |
}
|
525 |
|
526 |
+
/**
|
527 |
+
* Generate minify rules
|
528 |
+
*
|
529 |
+
* @since 2.1.2
|
530 |
+
* @access private
|
531 |
+
* @return array Rules set
|
532 |
+
*/
|
533 |
+
private function _minify_rules()
|
534 |
+
{
|
535 |
+
$rules = array(
|
536 |
+
self::LS_MODULE_REWRITE_START,
|
537 |
+
self::REWRITE_ON,
|
538 |
+
'RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} ^(.*)/min/(\w+)\.(css|js)$',
|
539 |
+
'RewriteCond %1/' . basename( LSCWP_CONTENT_DIR ) . '/cache/$2/$1.$2 -f',
|
540 |
+
'RewriteRule min/(\w+)\.(css|js) ' . basename( LSCWP_CONTENT_DIR ) . '/cache/$2/$1.$2 [L]',
|
541 |
+
self::LS_MODULE_END,
|
542 |
+
) ;
|
543 |
+
return $rules ;
|
544 |
+
}
|
545 |
+
|
546 |
/**
|
547 |
* Generate CORS rules for fonts
|
548 |
*
|
694 |
$new_rules_nonls[] = '' ;
|
695 |
}
|
696 |
|
697 |
+
// CSS/JS static file rewrite
|
698 |
+
$new_rules_nonls[] = $new_rules_backend_nonls[] = self::MARKER_MINIFY . self::MARKER_START ;
|
699 |
+
$new_rules_nonls = array_merge( $new_rules_nonls, $this->_minify_rules() ) ;
|
700 |
+
$new_rules_backend_nonls = array_merge( $new_rules_backend_nonls, $this->_minify_rules() ) ;
|
701 |
+
$new_rules_nonls[] = $new_rules_backend_nonls[] = self::MARKER_MINIFY . self::MARKER_END ;
|
702 |
+
$new_rules_nonls[] = '' ;
|
703 |
|
704 |
// Add module wrapper for LiteSpeed rules
|
705 |
if ( $new_rules || $disable_lscache_detail_rules ) {
|
admin/tpl/edit_htaccess.php
CHANGED
@@ -3,6 +3,7 @@ if (!defined('WPINC')) die;
|
|
3 |
|
4 |
$readonly = LiteSpeed_Cache_Admin_Rules::writable() ? '' : 'readonly';
|
5 |
$content = LiteSpeed_Cache_Admin_Rules::get_instance()->htaccess_read();
|
|
|
6 |
|
7 |
// Check if there is `ExpiresDefault` in .htaccess
|
8 |
if ( defined( 'LITESPEED_ON' ) ) {
|
@@ -58,9 +59,9 @@ if ( defined( 'LITESPEED_ON' ) ) {
|
|
58 |
|
59 |
<div class="litespeed-title"><?php echo sprintf(__('Current %s Contents', 'litespeed-cache'), '.htaccess'); ?></div>
|
60 |
|
61 |
-
|
62 |
|
63 |
-
<
|
64 |
|
65 |
<textarea name="<?php echo LiteSpeed_Cache_Admin_Rules::EDITOR_TEXTAREA_NAME; ?>" wrap="off" rows="50" class="litespeed-input-long"
|
66 |
<?php echo $readonly; ?>
|
3 |
|
4 |
$readonly = LiteSpeed_Cache_Admin_Rules::writable() ? '' : 'readonly';
|
5 |
$content = LiteSpeed_Cache_Admin_Rules::get_instance()->htaccess_read();
|
6 |
+
$htaccess_path = LiteSpeed_Cache_Admin_Rules::get_frontend_htaccess() ;
|
7 |
|
8 |
// Check if there is `ExpiresDefault` in .htaccess
|
9 |
if ( defined( 'LITESPEED_ON' ) ) {
|
59 |
|
60 |
<div class="litespeed-title"><?php echo sprintf(__('Current %s Contents', 'litespeed-cache'), '.htaccess'); ?></div>
|
61 |
|
62 |
+
<p><span class="attention"><?php echo sprintf(__('DO NOT EDIT ANYTHING WITHIN %s', 'litespeed-cache'), '<code>' . LiteSpeed_Cache_Admin_Rules::LS_MODULE_DONOTEDIT . '</code>' ); ?></span></p>
|
63 |
|
64 |
+
<h4><?php echo $htaccess_path ; ?></h4>
|
65 |
|
66 |
<textarea name="<?php echo LiteSpeed_Cache_Admin_Rules::EDITOR_TEXTAREA_NAME; ?>" wrap="off" rows="50" class="litespeed-input-long"
|
67 |
<?php echo $readonly; ?>
|
admin/tpl/image_optimization.php
CHANGED
@@ -163,8 +163,8 @@ LiteSpeed_Cache_GUI::show_promo() ;
|
|
163 |
|
164 |
<p>
|
165 |
<?php echo __('Images requested', 'litespeed-cache') ; ?>:
|
166 |
-
<b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ '
|
167 |
-
(<b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ '
|
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' ) ; ?>
|
@@ -172,10 +172,10 @@ LiteSpeed_Cache_GUI::show_promo() ;
|
|
172 |
</p>
|
173 |
<p>
|
174 |
<?php echo __('Images notified to pull', 'litespeed-cache') ; ?>:
|
175 |
-
<b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ '
|
176 |
-
(<b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ '
|
177 |
|
178 |
-
<?php if ( $img_count[ '
|
179 |
<a href="<?php echo LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_IMG_OPTM, LiteSpeed_Cache_Img_Optm::TYPE_IMG_PULL ) ; ?>" class="litespeed-btn-success">
|
180 |
<?php echo __( 'Pull Images', 'litespeed-cache' ) ; ?>
|
181 |
</a>
|
@@ -191,23 +191,37 @@ LiteSpeed_Cache_GUI::show_promo() ;
|
|
191 |
</p>
|
192 |
<p>
|
193 |
<?php echo __('Images optimized and pulled', 'litespeed-cache') ; ?>:
|
194 |
-
<b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ '
|
195 |
-
(<b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ '
|
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 />
|
@@ -258,17 +272,25 @@ LiteSpeed_Cache_GUI::show_promo() ;
|
|
258 |
</span>
|
259 |
|
260 |
<br />
|
261 |
-
<a href="<?php echo LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_IMG_OPTM, LiteSpeed_Cache_Img_Optm::
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
262 |
<?php echo __( 'Destroy All Optimization Data!', 'litespeed-cache' ) ; ?>
|
263 |
</a>
|
264 |
<span class="litespeed-desc">
|
265 |
<?php echo __( 'Remove all previous image optimization requests/results, revert completed optimizations, and delete all optimization files.', 'litespeed-cache' ) ; ?>
|
266 |
<font class="litespeed-warning">
|
267 |
<?php echo __('NOTE', 'litespeed-cache'); ?>:
|
268 |
-
<?php echo
|
269 |
</font>
|
270 |
-
|
271 |
</span>
|
|
|
272 |
<?php endif ; ?>
|
273 |
|
274 |
|
163 |
|
164 |
<p>
|
165 |
<?php echo __('Images requested', 'litespeed-cache') ; ?>:
|
166 |
+
<b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'group.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_REQUESTED ] ) ; ?></b>
|
167 |
+
(<b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'img.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_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' ) ; ?>
|
172 |
</p>
|
173 |
<p>
|
174 |
<?php echo __('Images notified to pull', 'litespeed-cache') ; ?>:
|
175 |
+
<b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'group.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_NOTIFIED ] ) ; ?></b>
|
176 |
+
(<b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'img.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_NOTIFIED ], 'image' ) ; ?></b>)
|
177 |
|
178 |
+
<?php if ( $img_count[ 'img.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_NOTIFIED ] && ! $is_running ) : ?>
|
179 |
<a href="<?php echo LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_IMG_OPTM, LiteSpeed_Cache_Img_Optm::TYPE_IMG_PULL ) ; ?>" class="litespeed-btn-success">
|
180 |
<?php echo __( 'Pull Images', 'litespeed-cache' ) ; ?>
|
181 |
</a>
|
191 |
</p>
|
192 |
<p>
|
193 |
<?php echo __('Images optimized and pulled', 'litespeed-cache') ; ?>:
|
194 |
+
<b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'group.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_PULLED ] ) ; ?></b>
|
195 |
+
(<b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'img.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_PULLED ], 'image' ) ; ?></b>)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
196 |
</p>
|
197 |
+
|
198 |
+
<div class="litespeed-desc litespeed-left20">
|
199 |
+
<p>
|
200 |
+
<?php echo __('Images failed to fetch', 'litespeed-cache') ; ?>:
|
201 |
+
<b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'group.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_ERR_FETCH ] ) ; ?></b>
|
202 |
+
(<b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'img.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_ERR_FETCH ], 'image' ) ; ?></b>)
|
203 |
+
</p>
|
204 |
+
<p>
|
205 |
+
<?php echo __('Images failed to optimize', 'litespeed-cache') ; ?>:
|
206 |
+
<b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'group.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_ERR_OPTM ] ) ; ?></b>
|
207 |
+
(<b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'img.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_ERR_OPTM ], 'image' ) ; ?></b>)
|
208 |
+
</p>
|
209 |
+
<p>
|
210 |
+
<?php echo __('Images failed with other errors', 'litespeed-cache') ; ?>:
|
211 |
+
<b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'group.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_ERR ] ) ; ?></b>
|
212 |
+
(<b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'img.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_ERR ], 'image' ) ; ?></b>)
|
213 |
+
</p>
|
214 |
+
<p>
|
215 |
+
<?php echo __('Image files missing', 'litespeed-cache') ; ?>:
|
216 |
+
<b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'group.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_MISS ] ) ; ?></b>
|
217 |
+
(<b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'img.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_MISS ], 'image' ) ; ?></b>)
|
218 |
+
</p>
|
219 |
+
<p>
|
220 |
+
<?php echo __('Images with wrong meta', 'litespeed-cache') ; ?>:
|
221 |
+
<b><?php echo LiteSpeed_Cache_Admin_Display::print_plural( $img_count[ 'img.' . LiteSpeed_Cache_Img_Optm::DB_IMG_OPTIMIZE_STATUS_XMETA ] ) ; ?></b>
|
222 |
+
</p>
|
223 |
+
</div>
|
224 |
+
|
225 |
<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>
|
226 |
|
227 |
<hr />
|
272 |
</span>
|
273 |
|
274 |
<br />
|
275 |
+
<a href="<?php echo LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_IMG_OPTM, LiteSpeed_Cache_Img_Optm::TYPE_IMG_OPTM_DESTROY_UNFINISHED ) ; ?>" class="litespeed-btn-warning">
|
276 |
+
<?php echo __( 'Clean Up Unfinished Data', 'litespeed-cache' ) ; ?>
|
277 |
+
</a>
|
278 |
+
<span class="litespeed-desc">
|
279 |
+
<?php echo __( 'Remove all previous unfinished image optimization requests.', 'litespeed-cache' ) ; ?>
|
280 |
+
</span>
|
281 |
+
|
282 |
+
<br />
|
283 |
+
<a href="<?php echo LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_IMG_OPTM, LiteSpeed_Cache_Img_Optm::TYPE_IMG_OPTM_DESTROY ) ; ?>" class="litespeed-btn-danger">
|
284 |
<?php echo __( 'Destroy All Optimization Data!', 'litespeed-cache' ) ; ?>
|
285 |
</a>
|
286 |
<span class="litespeed-desc">
|
287 |
<?php echo __( 'Remove all previous image optimization requests/results, revert completed optimizations, and delete all optimization files.', 'litespeed-cache' ) ; ?>
|
288 |
<font class="litespeed-warning">
|
289 |
<?php echo __('NOTE', 'litespeed-cache'); ?>:
|
290 |
+
<?php echo __( 'This will also reset the credit level.', 'litespeed-cache' ) ; ?>
|
291 |
</font>
|
|
|
292 |
</span>
|
293 |
+
|
294 |
<?php endif ; ?>
|
295 |
|
296 |
|
admin/tpl/manage/manage_purge.php
CHANGED
@@ -48,11 +48,6 @@ $_panels = array(
|
|
48 |
'tag' => LiteSpeed_Cache::ACTION_PURGE_ALL,
|
49 |
'icon' => 'purge-all',
|
50 |
'title_cls' => 'litespeed-warning',
|
51 |
-
'cfm' => is_multisite() && is_network_admin() ?
|
52 |
-
esc_html( __( 'This will purge everything for all blogs.', 'litespeed-cache' ) ) . ' ' .
|
53 |
-
esc_html( __( 'Are you sure you want to purge all?', 'litespeed-cache' ) )
|
54 |
-
:
|
55 |
-
esc_html( __( 'Are you sure you want to purge all?', 'litespeed-cache' ) )
|
56 |
),
|
57 |
) ;
|
58 |
|
48 |
'tag' => LiteSpeed_Cache::ACTION_PURGE_ALL,
|
49 |
'icon' => 'purge-all',
|
50 |
'title_cls' => 'litespeed-warning',
|
|
|
|
|
|
|
|
|
|
|
51 |
),
|
52 |
) ;
|
53 |
|
inc/config.class.php
CHANGED
@@ -379,7 +379,7 @@ class LiteSpeed_Cache_Config
|
|
379 |
return $this->options[$id] ;
|
380 |
}
|
381 |
|
382 |
-
defined( 'LSCWP_LOG' ) && LiteSpeed_Cache_Log::debug( 'Invalid option ID ' . $id ) ;
|
383 |
|
384 |
return NULL ;
|
385 |
}
|
@@ -469,7 +469,7 @@ class LiteSpeed_Cache_Config
|
|
469 |
}
|
470 |
|
471 |
if ( $group ) {
|
472 |
-
LiteSpeed_Cache_Log::debug2( '
|
473 |
}
|
474 |
|
475 |
return $group ;
|
@@ -919,7 +919,7 @@ class LiteSpeed_Cache_Config
|
|
919 |
self::ITEM_CDN_MAPPING_FILETYPE => $this->options[ 'cdn_filetype' ],
|
920 |
) ;
|
921 |
update_option( LiteSpeed_Cache_Config::ITEM_CDN_MAPPING, array( $cdn_mapping ) ) ;
|
922 |
-
LiteSpeed_Cache_Log::debug( "
|
923 |
}
|
924 |
|
925 |
$this->options = self::option_diff( $default_options, $this->options ) ;
|
@@ -927,7 +927,7 @@ class LiteSpeed_Cache_Config
|
|
927 |
$res = $this->update_options() ;
|
928 |
define( 'LSWCP_EMPTYCACHE', true ) ;// clear all sites caches
|
929 |
LiteSpeed_Cache_Purge::purge_all() ;
|
930 |
-
LiteSpeed_Cache_Log::debug( "
|
931 |
|
932 |
// Update img_optm table data for upgrading
|
933 |
LiteSpeed_Cache_Data::get_instance() ;
|
@@ -952,7 +952,7 @@ class LiteSpeed_Cache_Config
|
|
952 |
|
953 |
$res = update_site_option( self::OPTION_NAME, $options ) ;
|
954 |
|
955 |
-
LiteSpeed_Cache_Log::debug( "plugin_upgrade option changed = $res\n" ) ;
|
956 |
}
|
957 |
|
958 |
/**
|
@@ -1026,7 +1026,7 @@ class LiteSpeed_Cache_Config
|
|
1026 |
|
1027 |
$res = add_option( self::OPTION_NAME, $this->get_default_options() ) ;
|
1028 |
|
1029 |
-
defined( 'LSCWP_LOG' ) && LiteSpeed_Cache_Log::debug( "[
|
1030 |
|
1031 |
$disable_lscache = false ;
|
1032 |
|
379 |
return $this->options[$id] ;
|
380 |
}
|
381 |
|
382 |
+
defined( 'LSCWP_LOG' ) && LiteSpeed_Cache_Log::debug( '[Cfg] Invalid option ID ' . $id ) ;
|
383 |
|
384 |
return NULL ;
|
385 |
}
|
469 |
}
|
470 |
|
471 |
if ( $group ) {
|
472 |
+
LiteSpeed_Cache_Log::debug2( '[Cfg] role in vary_group [group] ' . $group ) ;
|
473 |
}
|
474 |
|
475 |
return $group ;
|
919 |
self::ITEM_CDN_MAPPING_FILETYPE => $this->options[ 'cdn_filetype' ],
|
920 |
) ;
|
921 |
update_option( LiteSpeed_Cache_Config::ITEM_CDN_MAPPING, array( $cdn_mapping ) ) ;
|
922 |
+
LiteSpeed_Cache_Log::debug( "[Cfg] plugin_upgrade option adding CDN map" ) ;
|
923 |
}
|
924 |
|
925 |
$this->options = self::option_diff( $default_options, $this->options ) ;
|
927 |
$res = $this->update_options() ;
|
928 |
define( 'LSWCP_EMPTYCACHE', true ) ;// clear all sites caches
|
929 |
LiteSpeed_Cache_Purge::purge_all() ;
|
930 |
+
LiteSpeed_Cache_Log::debug( "[Cfg] plugin_upgrade option changed = $res" ) ;
|
931 |
|
932 |
// Update img_optm table data for upgrading
|
933 |
LiteSpeed_Cache_Data::get_instance() ;
|
952 |
|
953 |
$res = update_site_option( self::OPTION_NAME, $options ) ;
|
954 |
|
955 |
+
LiteSpeed_Cache_Log::debug( "[Cfg] plugin_upgrade option changed = $res\n" ) ;
|
956 |
}
|
957 |
|
958 |
/**
|
1026 |
|
1027 |
$res = add_option( self::OPTION_NAME, $this->get_default_options() ) ;
|
1028 |
|
1029 |
+
defined( 'LSCWP_LOG' ) && LiteSpeed_Cache_Log::debug( "[Cfg] plugin_activation update option = " . var_export( $res, true ) ) ;
|
1030 |
|
1031 |
$disable_lscache = false ;
|
1032 |
|
inc/control.class.php
CHANGED
@@ -101,7 +101,7 @@ class LiteSpeed_Cache_Control
|
|
101 |
return ;
|
102 |
}
|
103 |
self::$_control |= self::BM_NO_VARY ;
|
104 |
-
LiteSpeed_Cache_Log::debug( 'X Cache_control -> no-vary', 3 ) ;
|
105 |
}
|
106 |
|
107 |
/**
|
@@ -127,7 +127,7 @@ class LiteSpeed_Cache_Control
|
|
127 |
return ;
|
128 |
}
|
129 |
self::$_control |= self::BM_STALE ;
|
130 |
-
LiteSpeed_Cache_Log::debug('X Cache_control -> stale') ;
|
131 |
}
|
132 |
|
133 |
/**
|
@@ -158,7 +158,7 @@ class LiteSpeed_Cache_Control
|
|
158 |
if ( $reason ) {
|
159 |
$reason = "( $reason )" ;
|
160 |
}
|
161 |
-
LiteSpeed_Cache_Log::debug( 'X Cache_control -> shared ' . $reason ) ;
|
162 |
}
|
163 |
|
164 |
/**
|
@@ -188,7 +188,7 @@ class LiteSpeed_Cache_Control
|
|
188 |
if ( $reason ) {
|
189 |
$reason = "( $reason )" ;
|
190 |
}
|
191 |
-
LiteSpeed_Cache_Log::debug( 'X Cache_control -> public forced ' . $reason ) ;
|
192 |
}
|
193 |
|
194 |
/**
|
@@ -218,7 +218,7 @@ class LiteSpeed_Cache_Control
|
|
218 |
if ( $reason ) {
|
219 |
$reason = "( $reason )" ;
|
220 |
}
|
221 |
-
LiteSpeed_Cache_Log::debug( 'X Cache_control -> private ' . $reason ) ;
|
222 |
}
|
223 |
|
224 |
/**
|
@@ -241,7 +241,7 @@ class LiteSpeed_Cache_Control
|
|
241 |
public static function set_cacheable()
|
242 |
{
|
243 |
self::$_control |= self::BM_CACHEABLE ;
|
244 |
-
LiteSpeed_Cache_Log::debug( 'X Cache_control init on' ) ;
|
245 |
}
|
246 |
|
247 |
/**
|
@@ -257,7 +257,7 @@ class LiteSpeed_Cache_Control
|
|
257 |
if ( $reason ) {
|
258 |
$reason = "( $reason )" ;
|
259 |
}
|
260 |
-
LiteSpeed_Cache_Log::debug( 'X Cache_control -> no Cache ' . $reason, 2 ) ;
|
261 |
}
|
262 |
|
263 |
/**
|
@@ -298,7 +298,7 @@ class LiteSpeed_Cache_Control
|
|
298 |
{
|
299 |
if ( is_numeric($ttl) ) {
|
300 |
self::$_custom_ttl = $ttl ;
|
301 |
-
LiteSpeed_Cache_Log::debug('X Cache_control TTL -> ' . $ttl) ;
|
302 |
}
|
303 |
}
|
304 |
|
@@ -328,7 +328,7 @@ class LiteSpeed_Cache_Control
|
|
328 |
if ( $ttl < 0 ) {
|
329 |
$ttl += 86400 ;// add one day
|
330 |
}
|
331 |
-
LiteSpeed_Cache_Log::debug( 'X Cache_control TTL is limited to ' . $ttl ) ;
|
332 |
return $ttl ;
|
333 |
}
|
334 |
}
|
@@ -374,12 +374,30 @@ class LiteSpeed_Cache_Control
|
|
374 |
public static function check_redirect( $location, $status )
|
375 |
{
|
376 |
if ( ! empty( $_SERVER[ 'SCRIPT_URI' ] ) ) { // dont check $status == '301' anymore
|
377 |
-
LiteSpeed_Cache_Log::debug( "301 from " . $_SERVER[ 'SCRIPT_URI' ] ) ;
|
378 |
-
LiteSpeed_Cache_Log::debug( "301 to $location" ) ;
|
379 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
380 |
self::set_nocache( '301 to same url' ) ;
|
381 |
}
|
382 |
}
|
|
|
383 |
return $location ;
|
384 |
}
|
385 |
|
@@ -433,7 +451,7 @@ class LiteSpeed_Cache_Control
|
|
433 |
// if is not cacheable, terminate check
|
434 |
// Even no need to run 3rd party hook
|
435 |
if ( ! self::is_cacheable() ) {
|
436 |
-
LiteSpeed_Cache_Log::debug( 'not cacheable before ctrl finalize' ) ;
|
437 |
return ;
|
438 |
}
|
439 |
|
@@ -458,7 +476,7 @@ class LiteSpeed_Cache_Control
|
|
458 |
|
459 |
// if is not cacheable, terminate check
|
460 |
if ( ! self::is_cacheable() ) {
|
461 |
-
LiteSpeed_Cache_Log::debug( 'not cacheable after api_control' ) ;
|
462 |
return ;
|
463 |
}
|
464 |
|
@@ -617,7 +635,7 @@ class LiteSpeed_Cache_Control
|
|
617 |
*/
|
618 |
private function _no_cache_for( $reason )
|
619 |
{
|
620 |
-
LiteSpeed_Cache_Log::debug('X Cache_control off - ' . $reason) ;
|
621 |
return false ;
|
622 |
}
|
623 |
|
101 |
return ;
|
102 |
}
|
103 |
self::$_control |= self::BM_NO_VARY ;
|
104 |
+
LiteSpeed_Cache_Log::debug( '[Ctrl] X Cache_control -> no-vary', 3 ) ;
|
105 |
}
|
106 |
|
107 |
/**
|
127 |
return ;
|
128 |
}
|
129 |
self::$_control |= self::BM_STALE ;
|
130 |
+
LiteSpeed_Cache_Log::debug('[Ctrl] X Cache_control -> stale') ;
|
131 |
}
|
132 |
|
133 |
/**
|
158 |
if ( $reason ) {
|
159 |
$reason = "( $reason )" ;
|
160 |
}
|
161 |
+
LiteSpeed_Cache_Log::debug( '[Ctrl] X Cache_control -> shared ' . $reason ) ;
|
162 |
}
|
163 |
|
164 |
/**
|
188 |
if ( $reason ) {
|
189 |
$reason = "( $reason )" ;
|
190 |
}
|
191 |
+
LiteSpeed_Cache_Log::debug( '[Ctrl] X Cache_control -> public forced ' . $reason ) ;
|
192 |
}
|
193 |
|
194 |
/**
|
218 |
if ( $reason ) {
|
219 |
$reason = "( $reason )" ;
|
220 |
}
|
221 |
+
LiteSpeed_Cache_Log::debug( '[Ctrl] X Cache_control -> private ' . $reason ) ;
|
222 |
}
|
223 |
|
224 |
/**
|
241 |
public static function set_cacheable()
|
242 |
{
|
243 |
self::$_control |= self::BM_CACHEABLE ;
|
244 |
+
LiteSpeed_Cache_Log::debug( '[Ctrl] X Cache_control init on' ) ;
|
245 |
}
|
246 |
|
247 |
/**
|
257 |
if ( $reason ) {
|
258 |
$reason = "( $reason )" ;
|
259 |
}
|
260 |
+
LiteSpeed_Cache_Log::debug( '[Ctrl] X Cache_control -> no Cache ' . $reason, 2 ) ;
|
261 |
}
|
262 |
|
263 |
/**
|
298 |
{
|
299 |
if ( is_numeric($ttl) ) {
|
300 |
self::$_custom_ttl = $ttl ;
|
301 |
+
LiteSpeed_Cache_Log::debug('[Ctrl] X Cache_control TTL -> ' . $ttl) ;
|
302 |
}
|
303 |
}
|
304 |
|
328 |
if ( $ttl < 0 ) {
|
329 |
$ttl += 86400 ;// add one day
|
330 |
}
|
331 |
+
LiteSpeed_Cache_Log::debug( '[Ctrl] X Cache_control TTL is limited to ' . $ttl ) ;
|
332 |
return $ttl ;
|
333 |
}
|
334 |
}
|
374 |
public static function check_redirect( $location, $status )
|
375 |
{
|
376 |
if ( ! empty( $_SERVER[ 'SCRIPT_URI' ] ) ) { // dont check $status == '301' anymore
|
377 |
+
LiteSpeed_Cache_Log::debug( "[Ctrl] 301 from " . $_SERVER[ 'SCRIPT_URI' ] ) ;
|
378 |
+
LiteSpeed_Cache_Log::debug( "[Ctrl] 301 to $location" ) ;
|
379 |
+
|
380 |
+
$to_check = array(
|
381 |
+
PHP_URL_SCHEME,
|
382 |
+
PHP_URL_HOST,
|
383 |
+
PHP_URL_PATH,
|
384 |
+
) ;
|
385 |
+
|
386 |
+
$is_same_redirect = true ;
|
387 |
+
|
388 |
+
foreach ( $to_check as $v ) {
|
389 |
+
if ( parse_url( $_SERVER[ 'SCRIPT_URI' ], $v ) != parse_url( $location, $v ) ) {
|
390 |
+
$is_same_redirect = false ;
|
391 |
+
LiteSpeed_Cache_Log::debug( "[Ctrl] 301 different redirection" ) ;
|
392 |
+
break ;
|
393 |
+
}
|
394 |
+
}
|
395 |
+
|
396 |
+
if ( $is_same_redirect ) {
|
397 |
self::set_nocache( '301 to same url' ) ;
|
398 |
}
|
399 |
}
|
400 |
+
|
401 |
return $location ;
|
402 |
}
|
403 |
|
451 |
// if is not cacheable, terminate check
|
452 |
// Even no need to run 3rd party hook
|
453 |
if ( ! self::is_cacheable() ) {
|
454 |
+
LiteSpeed_Cache_Log::debug( '[Ctrl] not cacheable before ctrl finalize' ) ;
|
455 |
return ;
|
456 |
}
|
457 |
|
476 |
|
477 |
// if is not cacheable, terminate check
|
478 |
if ( ! self::is_cacheable() ) {
|
479 |
+
LiteSpeed_Cache_Log::debug( '[Ctrl] not cacheable after api_control' ) ;
|
480 |
return ;
|
481 |
}
|
482 |
|
635 |
*/
|
636 |
private function _no_cache_for( $reason )
|
637 |
{
|
638 |
+
LiteSpeed_Cache_Log::debug('[Ctrl] X Cache_control off - ' . $reason) ;
|
639 |
return false ;
|
640 |
}
|
641 |
|
inc/gui.class.php
CHANGED
@@ -372,11 +372,19 @@ class LiteSpeed_Cache_GUI
|
|
372 |
$wp_admin_bar->add_menu( array(
|
373 |
'parent' => 'litespeed-menu',
|
374 |
'id' => 'litespeed-purge-all',
|
375 |
-
'title' => __( '
|
376 |
'href' => LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_PURGE_ALL ),
|
377 |
'meta' => array( 'tabindex' => '0' ),
|
378 |
) );
|
379 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
380 |
if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE ) ) {
|
381 |
$wp_admin_bar->add_menu( array(
|
382 |
'parent' => 'litespeed-menu',
|
372 |
$wp_admin_bar->add_menu( array(
|
373 |
'parent' => 'litespeed-menu',
|
374 |
'id' => 'litespeed-purge-all',
|
375 |
+
'title' => __( 'LSCache Purge All', 'litespeed-cache' ),
|
376 |
'href' => LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_PURGE_ALL ),
|
377 |
'meta' => array( 'tabindex' => '0' ),
|
378 |
) );
|
379 |
|
380 |
+
$wp_admin_bar->add_menu( array(
|
381 |
+
'parent' => 'litespeed-menu',
|
382 |
+
'id' => 'litespeed-purge-cssjs',
|
383 |
+
'title' => __( 'Purge CSS/JS Cache', 'litespeed-cache' ),
|
384 |
+
'href' => LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_PURGE_CSSJS ),
|
385 |
+
'meta' => array( 'tabindex' => '0' ),
|
386 |
+
) );
|
387 |
+
|
388 |
if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE ) ) {
|
389 |
$wp_admin_bar->add_menu( array(
|
390 |
'parent' => 'litespeed-menu',
|
inc/img_optm.class.php
CHANGED
@@ -16,7 +16,8 @@ class LiteSpeed_Cache_Img_Optm
|
|
16 |
const TYPE_SYNC_DATA = 'sync_data' ;
|
17 |
const TYPE_IMG_OPTIMIZE = 'img_optm' ;
|
18 |
const TYPE_IMG_OPTIMIZE_RESCAN = 'img_optm_rescan' ;
|
19 |
-
const
|
|
|
20 |
const TYPE_IMG_PULL = 'img_pull' ;
|
21 |
const TYPE_IMG_BATCH_SWITCH_ORI = 'img_optm_batch_switch_ori' ;
|
22 |
const TYPE_IMG_BATCH_SWITCH_OPTM = 'img_optm_batch_switch_optm' ;
|
@@ -32,6 +33,8 @@ 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_STATUS_XMETA = 'xmeta' ;
|
36 |
const DB_IMG_OPTIMIZE_SIZE = 'litespeed-optimize-size' ;
|
37 |
|
@@ -705,7 +708,13 @@ class LiteSpeed_Cache_Img_Optm
|
|
705 |
exit( json_encode( 'no/wrong server' ) ) ;
|
706 |
}
|
707 |
|
708 |
-
$_allowed_status = array(
|
|
|
|
|
|
|
|
|
|
|
|
|
709 |
|
710 |
if ( empty( $_POST[ 'status' ] ) || ! in_array( $_POST[ 'status' ], $_allowed_status ) ) {
|
711 |
LiteSpeed_Cache_Log::debug( '[Img_Optm] notify exit: no/wrong status' ) ;
|
@@ -1069,6 +1078,53 @@ class LiteSpeed_Cache_Img_Optm
|
|
1069 |
return $meta_value ;
|
1070 |
}
|
1071 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1072 |
/**
|
1073 |
* Send destroy all requests cmd to LiteSpeed IAPI server and get the link to finish it ( avoid click by mistake )
|
1074 |
*
|
@@ -1352,33 +1408,37 @@ class LiteSpeed_Cache_Img_Optm
|
|
1352 |
// images count from img_optm table
|
1353 |
$q_groups = "SELECT count(distinct post_id) FROM $this->_table_img_optm WHERE optm_status = %s" ;
|
1354 |
$q = "SELECT count(*) FROM $this->_table_img_optm WHERE optm_status = %s" ;
|
1355 |
-
|
1356 |
-
|
1357 |
-
$
|
1358 |
-
|
1359 |
-
|
1360 |
-
|
1361 |
-
|
1362 |
-
|
1363 |
-
|
1364 |
-
|
1365 |
-
|
1366 |
-
|
1367 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1368 |
'total_img' => $total_img,
|
1369 |
'total_not_requested' => $total_not_requested,
|
1370 |
-
'total_requested_groups' => $total_requested_groups,
|
1371 |
-
'total_requested' => $total_requested,
|
1372 |
-
'total_err_groups' => $total_err_groups,
|
1373 |
-
'total_err' => $total_err,
|
1374 |
-
'total_miss_groups' => $total_miss_groups,
|
1375 |
-
'total_miss' => $total_miss,
|
1376 |
-
'total_server_finished_groups' => $total_server_finished_groups,
|
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 |
|
1384 |
/**
|
@@ -1564,10 +1624,14 @@ class LiteSpeed_Cache_Img_Optm
|
|
1564 |
$instance->_img_optimize_rescan() ;
|
1565 |
break ;
|
1566 |
|
1567 |
-
case self::
|
1568 |
$instance->_img_optimize_destroy() ;
|
1569 |
break ;
|
1570 |
|
|
|
|
|
|
|
|
|
1571 |
case self::TYPE_IMG_PULL :
|
1572 |
LiteSpeed_Cache_Log::debug( 'ImgOptm: Manually running Cron pull_optimized_img' ) ;
|
1573 |
$result = $instance->_pull_optimized_img( true ) ;
|
16 |
const TYPE_SYNC_DATA = 'sync_data' ;
|
17 |
const TYPE_IMG_OPTIMIZE = 'img_optm' ;
|
18 |
const TYPE_IMG_OPTIMIZE_RESCAN = 'img_optm_rescan' ;
|
19 |
+
const TYPE_IMG_OPTM_DESTROY = 'img_optm_destroy' ;
|
20 |
+
const TYPE_IMG_OPTM_DESTROY_UNFINISHED = 'img_optm_destroy-unfinished' ;
|
21 |
const TYPE_IMG_PULL = 'img_pull' ;
|
22 |
const TYPE_IMG_BATCH_SWITCH_ORI = 'img_optm_batch_switch_ori' ;
|
23 |
const TYPE_IMG_BATCH_SWITCH_OPTM = 'img_optm_batch_switch_optm' ;
|
33 |
const DB_IMG_OPTIMIZE_STATUS_FAILED = 'failed' ;
|
34 |
const DB_IMG_OPTIMIZE_STATUS_MISS = 'miss' ;
|
35 |
const DB_IMG_OPTIMIZE_STATUS_ERR = 'err' ;
|
36 |
+
const DB_IMG_OPTIMIZE_STATUS_ERR_FETCH = 'err_fetch' ;
|
37 |
+
const DB_IMG_OPTIMIZE_STATUS_ERR_OPTM = 'err_optm' ;
|
38 |
const DB_IMG_OPTIMIZE_STATUS_XMETA = 'xmeta' ;
|
39 |
const DB_IMG_OPTIMIZE_SIZE = 'litespeed-optimize-size' ;
|
40 |
|
708 |
exit( json_encode( 'no/wrong server' ) ) ;
|
709 |
}
|
710 |
|
711 |
+
$_allowed_status = array(
|
712 |
+
self::DB_IMG_OPTIMIZE_STATUS_NOTIFIED,
|
713 |
+
self::DB_IMG_OPTIMIZE_STATUS_ERR,
|
714 |
+
self::DB_IMG_OPTIMIZE_STATUS_ERR_FETCH,
|
715 |
+
self::DB_IMG_OPTIMIZE_STATUS_ERR_OPTM,
|
716 |
+
self::DB_IMG_OPTIMIZE_STATUS_REQUESTED,
|
717 |
+
) ;
|
718 |
|
719 |
if ( empty( $_POST[ 'status' ] ) || ! in_array( $_POST[ 'status' ], $_allowed_status ) ) {
|
720 |
LiteSpeed_Cache_Log::debug( '[Img_Optm] notify exit: no/wrong status' ) ;
|
1078 |
return $meta_value ;
|
1079 |
}
|
1080 |
|
1081 |
+
/**
|
1082 |
+
* Destroy all unfinished queue locally and to LiteSpeed IAPI server
|
1083 |
+
*
|
1084 |
+
* @since 2.1.2
|
1085 |
+
* @access private
|
1086 |
+
*/
|
1087 |
+
private function _img_optimize_destroy_unfinished()
|
1088 |
+
{
|
1089 |
+
global $wpdb ;
|
1090 |
+
|
1091 |
+
LiteSpeed_Cache_Log::debug( '[Img_Optm] sending DESTROY_UNFINISHED cmd to LiteSpeed IAPI' ) ;
|
1092 |
+
|
1093 |
+
// Push to LiteSpeed IAPI server and recover credit
|
1094 |
+
$json = LiteSpeed_Cache_Admin_API::post( LiteSpeed_Cache_Admin_API::IAPI_ACTION_REQUEST_DESTROY_UNFINISHED ) ;
|
1095 |
+
|
1096 |
+
// confirm link will be displayed by Admin_API automatically
|
1097 |
+
if ( is_array( $json ) && $json ) {
|
1098 |
+
LiteSpeed_Cache_Log::debug( '[Img_Optm] cmd result', $json ) ;
|
1099 |
+
}
|
1100 |
+
|
1101 |
+
// If failed to run request to IAPI
|
1102 |
+
if ( ! is_array( $json ) || empty( $json[ 'success' ] ) ) {
|
1103 |
+
|
1104 |
+
// For other errors that Admin_API didn't take
|
1105 |
+
if ( ! is_array( $json ) && $json !== null ) {
|
1106 |
+
LiteSpeed_Cache_Admin_Display::error( $json ) ;
|
1107 |
+
|
1108 |
+
LiteSpeed_Cache_Log::debug( '[Img_Optm] err ', $json ) ;
|
1109 |
+
}
|
1110 |
+
return ;
|
1111 |
+
}
|
1112 |
+
|
1113 |
+
// Clear local queue
|
1114 |
+
$_status_to_clear = array(
|
1115 |
+
self::DB_IMG_OPTIMIZE_STATUS_NOTIFIED,
|
1116 |
+
self::DB_IMG_OPTIMIZE_STATUS_REQUESTED,
|
1117 |
+
self::DB_IMG_OPTIMIZE_STATUS_ERR_FETCH,
|
1118 |
+
) ;
|
1119 |
+
$q = "DELETE FROM $this->_table_img_optm WHERE optm_status IN ( " . implode( ',', array_fill( 0, count( $_status_to_clear ), '%s' ) ) . " )" ;
|
1120 |
+
$wpdb->query( $wpdb->prepare( $q, $_status_to_clear ) ) ;
|
1121 |
+
|
1122 |
+
|
1123 |
+
$msg = __( 'Destroy unfinished data successfully.', 'litespeed-cache' ) ;
|
1124 |
+
LiteSpeed_Cache_Admin_Display::succeed( $msg ) ;
|
1125 |
+
|
1126 |
+
}
|
1127 |
+
|
1128 |
/**
|
1129 |
* Send destroy all requests cmd to LiteSpeed IAPI server and get the link to finish it ( avoid click by mistake )
|
1130 |
*
|
1408 |
// images count from img_optm table
|
1409 |
$q_groups = "SELECT count(distinct post_id) FROM $this->_table_img_optm WHERE optm_status = %s" ;
|
1410 |
$q = "SELECT count(*) FROM $this->_table_img_optm WHERE optm_status = %s" ;
|
1411 |
+
|
1412 |
+
// The groups to check
|
1413 |
+
$images_to_check = $groups_to_check = array(
|
1414 |
+
self::DB_IMG_OPTIMIZE_STATUS_REQUESTED,
|
1415 |
+
self::DB_IMG_OPTIMIZE_STATUS_NOTIFIED,
|
1416 |
+
self::DB_IMG_OPTIMIZE_STATUS_PULLED,
|
1417 |
+
self::DB_IMG_OPTIMIZE_STATUS_ERR,
|
1418 |
+
self::DB_IMG_OPTIMIZE_STATUS_ERR_FETCH,
|
1419 |
+
self::DB_IMG_OPTIMIZE_STATUS_ERR_OPTM,
|
1420 |
+
self::DB_IMG_OPTIMIZE_STATUS_MISS,
|
1421 |
+
) ;
|
1422 |
+
|
1423 |
+
// The images to check
|
1424 |
+
$images_to_check[] = self::DB_IMG_OPTIMIZE_STATUS_XMETA ;
|
1425 |
+
|
1426 |
+
$count_list = array() ;
|
1427 |
+
|
1428 |
+
foreach ( $groups_to_check as $v ) {
|
1429 |
+
$count_list[ 'group.' . $v ] = $wpdb->get_var( $wpdb->prepare( $q_groups, $v ) ) ;
|
1430 |
+
}
|
1431 |
+
|
1432 |
+
foreach ( $images_to_check as $v ) {
|
1433 |
+
$count_list[ 'img.' . $v ] = $wpdb->get_var( $wpdb->prepare( $q, $v ) ) ;
|
1434 |
+
}
|
1435 |
+
|
1436 |
+
$data = array(
|
1437 |
'total_img' => $total_img,
|
1438 |
'total_not_requested' => $total_not_requested,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1439 |
) ;
|
1440 |
+
|
1441 |
+
return array_merge( $data, $count_list ) ;
|
1442 |
}
|
1443 |
|
1444 |
/**
|
1624 |
$instance->_img_optimize_rescan() ;
|
1625 |
break ;
|
1626 |
|
1627 |
+
case self::TYPE_IMG_OPTM_DESTROY :
|
1628 |
$instance->_img_optimize_destroy() ;
|
1629 |
break ;
|
1630 |
|
1631 |
+
case self::TYPE_IMG_OPTM_DESTROY_UNFINISHED :
|
1632 |
+
$instance->_img_optimize_destroy_unfinished() ;
|
1633 |
+
break ;
|
1634 |
+
|
1635 |
case self::TYPE_IMG_PULL :
|
1636 |
LiteSpeed_Cache_Log::debug( 'ImgOptm: Manually running Cron pull_optimized_img' ) ;
|
1637 |
$result = $instance->_pull_optimized_img( true ) ;
|
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 |
|
@@ -120,7 +120,7 @@ class LiteSpeed_Cache
|
|
120 |
// Check if there is a purge request in queue
|
121 |
if ( $purge_queue = get_option( LiteSpeed_Cache_Purge::PURGE_QUEUE ) ) {
|
122 |
@header( $purge_queue ) ;
|
123 |
-
LiteSpeed_Cache_Log::debug( 'Purge Queue found&sent: ' . $purge_queue ) ;
|
124 |
delete_option( LiteSpeed_Cache_Purge::PURGE_QUEUE ) ;
|
125 |
}
|
126 |
|
@@ -440,7 +440,7 @@ class LiteSpeed_Cache
|
|
440 |
*/
|
441 |
public static function footer_hook()
|
442 |
{
|
443 |
-
LiteSpeed_Cache_Log::debug( 'Footer hook called' ) ;
|
444 |
if ( ! defined( 'LITESPEED_FOOTER_CALLED' ) ) {
|
445 |
define( 'LITESPEED_FOOTER_CALLED', true ) ;
|
446 |
}
|
@@ -455,22 +455,22 @@ class LiteSpeed_Cache
|
|
455 |
private function _check_is_html( $buffer = null )
|
456 |
{
|
457 |
if ( ! defined( 'LITESPEED_FOOTER_CALLED' ) ) {
|
458 |
-
LiteSpeed_Cache_Log::debug2( 'CHK html bypass: miss footer const' ) ;
|
459 |
return ;
|
460 |
}
|
461 |
|
462 |
if ( defined( 'DOING_AJAX' ) ) {
|
463 |
-
LiteSpeed_Cache_Log::debug2( 'CHK html bypass: doing ajax' ) ;
|
464 |
return ;
|
465 |
}
|
466 |
|
467 |
if ( defined( 'DOING_CRON' ) ) {
|
468 |
-
LiteSpeed_Cache_Log::debug2( 'CHK html bypass: doing cron' ) ;
|
469 |
return ;
|
470 |
}
|
471 |
|
472 |
if ( $_SERVER[ 'REQUEST_METHOD' ] !== 'GET' ) {
|
473 |
-
LiteSpeed_Cache_Log::debug2( 'CHK html bypass: not get method ' . $_SERVER[ 'REQUEST_METHOD' ] ) ;
|
474 |
return ;
|
475 |
}
|
476 |
|
@@ -489,11 +489,11 @@ class LiteSpeed_Cache
|
|
489 |
$is_html = stripos( $buffer, '<html' ) === 0 || stripos( $buffer, '<!DOCTYPE' ) === 0 ;
|
490 |
|
491 |
if ( ! $is_html ) {
|
492 |
-
LiteSpeed_Cache_Log::debug( 'Footer check failed: ' . ob_get_level() . '-' . substr( $buffer, 0, 100 ) ) ;
|
493 |
return ;
|
494 |
}
|
495 |
|
496 |
-
LiteSpeed_Cache_Log::debug( 'Footer check passed' ) ;
|
497 |
|
498 |
if ( ! defined( 'LITESPEED_IS_HTML' ) ) {
|
499 |
define( 'LITESPEED_IS_HTML', true ) ;
|
@@ -581,7 +581,7 @@ class LiteSpeed_Cache
|
|
581 |
$running_info_showing = ( defined( 'LITESPEED_IS_HTML' ) && LITESPEED_IS_HTML ) || ( defined( 'LSCACHE_IS_ESI' ) && LSCACHE_IS_ESI ) ;
|
582 |
if ( defined( 'LSCACHE_ESI_SILENCE' ) ) {
|
583 |
$running_info_showing = false ;
|
584 |
-
LiteSpeed_Cache_Log::debug( 'ESI silence' ) ;
|
585 |
}
|
586 |
|
587 |
if ( $running_info_showing ) {
|
19 |
private static $_instance ;
|
20 |
|
21 |
const PLUGIN_NAME = 'litespeed-cache' ;
|
22 |
+
const PLUGIN_VERSION = '2.1.2' ;
|
23 |
|
24 |
const PAGE_EDIT_HTACCESS = 'lscache-edit-htaccess' ;
|
25 |
|
120 |
// Check if there is a purge request in queue
|
121 |
if ( $purge_queue = get_option( LiteSpeed_Cache_Purge::PURGE_QUEUE ) ) {
|
122 |
@header( $purge_queue ) ;
|
123 |
+
LiteSpeed_Cache_Log::debug( '[Boot] Purge Queue found&sent: ' . $purge_queue ) ;
|
124 |
delete_option( LiteSpeed_Cache_Purge::PURGE_QUEUE ) ;
|
125 |
}
|
126 |
|
440 |
*/
|
441 |
public static function footer_hook()
|
442 |
{
|
443 |
+
LiteSpeed_Cache_Log::debug( '[Boot] Footer hook called' ) ;
|
444 |
if ( ! defined( 'LITESPEED_FOOTER_CALLED' ) ) {
|
445 |
define( 'LITESPEED_FOOTER_CALLED', true ) ;
|
446 |
}
|
455 |
private function _check_is_html( $buffer = null )
|
456 |
{
|
457 |
if ( ! defined( 'LITESPEED_FOOTER_CALLED' ) ) {
|
458 |
+
LiteSpeed_Cache_Log::debug2( '[Boot] CHK html bypass: miss footer const' ) ;
|
459 |
return ;
|
460 |
}
|
461 |
|
462 |
if ( defined( 'DOING_AJAX' ) ) {
|
463 |
+
LiteSpeed_Cache_Log::debug2( '[Boot] CHK html bypass: doing ajax' ) ;
|
464 |
return ;
|
465 |
}
|
466 |
|
467 |
if ( defined( 'DOING_CRON' ) ) {
|
468 |
+
LiteSpeed_Cache_Log::debug2( '[Boot] CHK html bypass: doing cron' ) ;
|
469 |
return ;
|
470 |
}
|
471 |
|
472 |
if ( $_SERVER[ 'REQUEST_METHOD' ] !== 'GET' ) {
|
473 |
+
LiteSpeed_Cache_Log::debug2( '[Boot] CHK html bypass: not get method ' . $_SERVER[ 'REQUEST_METHOD' ] ) ;
|
474 |
return ;
|
475 |
}
|
476 |
|
489 |
$is_html = stripos( $buffer, '<html' ) === 0 || stripos( $buffer, '<!DOCTYPE' ) === 0 ;
|
490 |
|
491 |
if ( ! $is_html ) {
|
492 |
+
LiteSpeed_Cache_Log::debug( '[Boot] Footer check failed: ' . ob_get_level() . '-' . substr( $buffer, 0, 100 ) ) ;
|
493 |
return ;
|
494 |
}
|
495 |
|
496 |
+
LiteSpeed_Cache_Log::debug( '[Boot] Footer check passed' ) ;
|
497 |
|
498 |
if ( ! defined( 'LITESPEED_IS_HTML' ) ) {
|
499 |
define( 'LITESPEED_IS_HTML', true ) ;
|
581 |
$running_info_showing = ( defined( 'LITESPEED_IS_HTML' ) && LITESPEED_IS_HTML ) || ( defined( 'LSCACHE_IS_ESI' ) && LSCACHE_IS_ESI ) ;
|
582 |
if ( defined( 'LSCACHE_ESI_SILENCE' ) ) {
|
583 |
$running_info_showing = false ;
|
584 |
+
LiteSpeed_Cache_Log::debug( '[Boot] ESI silence' ) ;
|
585 |
}
|
586 |
|
587 |
if ( $running_info_showing ) {
|
inc/media.class.php
CHANGED
@@ -240,7 +240,19 @@ class LiteSpeed_Cache_Media
|
|
240 |
{
|
241 |
// This request is for js/css_async.js
|
242 |
if ( strpos( $_SERVER[ 'REQUEST_URI' ], self::LAZY_LIB ) !== false ) {
|
243 |
-
LiteSpeed_Cache_Log::debug( 'Media run lazyload lib' ) ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
244 |
|
245 |
LiteSpeed_Cache_Control::set_cacheable() ;
|
246 |
LiteSpeed_Cache_Control::set_public_forced( 'OPTM: lazyload js' ) ;
|
@@ -248,12 +260,10 @@ class LiteSpeed_Cache_Media
|
|
248 |
LiteSpeed_Cache_Control::set_custom_ttl( 8640000 ) ;
|
249 |
LiteSpeed_Cache_Tag::add( LiteSpeed_Cache_Tag::TYPE_MIN . '_LAZY' ) ;
|
250 |
|
251 |
-
|
252 |
-
|
253 |
-
header( 'Content-Length: ' . filesize( $file ) ) ;
|
254 |
header( 'Content-Type: application/x-javascript; charset=utf-8' ) ;
|
255 |
|
256 |
-
echo
|
257 |
exit ;
|
258 |
}
|
259 |
}
|
@@ -291,16 +301,16 @@ class LiteSpeed_Cache_Media
|
|
291 |
public static function finalize( $content )
|
292 |
{
|
293 |
if ( defined( 'LITESPEED_NO_LAZY' ) ) {
|
294 |
-
LiteSpeed_Cache_Log::debug2( 'Media bypass: NO_LAZY const' ) ;
|
295 |
return $content ;
|
296 |
}
|
297 |
|
298 |
if ( ! defined( 'LITESPEED_IS_HTML' ) ) {
|
299 |
-
LiteSpeed_Cache_Log::debug2( 'Media bypass: Not frontend HTML type' ) ;
|
300 |
return $content ;
|
301 |
}
|
302 |
|
303 |
-
LiteSpeed_Cache_Log::debug( 'Media finalize' ) ;
|
304 |
|
305 |
$instance = self::get_instance() ;
|
306 |
$instance->content = $content ;
|
@@ -317,14 +327,6 @@ class LiteSpeed_Cache_Media
|
|
317 |
*/
|
318 |
private function _finalize()
|
319 |
{
|
320 |
-
$cfg_img_lazy = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_MEDIA_IMG_LAZY ) ;
|
321 |
-
$cfg_iframe_lazy = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_MEDIA_IFRAME_LAZY ) ;
|
322 |
-
|
323 |
-
if ( $cfg_img_lazy ) {
|
324 |
-
list( $src_list, $html_list ) = $this->_parse_img() ;
|
325 |
-
$html_list_ori = $html_list ;
|
326 |
-
}
|
327 |
-
|
328 |
/**
|
329 |
* Use webp for optimized images
|
330 |
* @since 1.6.2
|
@@ -333,6 +335,14 @@ class LiteSpeed_Cache_Media
|
|
333 |
$this->_replace_buffer_img_webp() ;
|
334 |
}
|
335 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
336 |
// image lazy load
|
337 |
if ( $cfg_img_lazy ) {
|
338 |
|
@@ -411,14 +421,14 @@ class LiteSpeed_Cache_Media
|
|
411 |
* @since 1.6
|
412 |
*/
|
413 |
if ( strpos( $attrs[ 'src' ], 'base64' ) !== false || substr( $attrs[ 'src' ], 0, 5 ) === 'data:' ) {
|
414 |
-
LiteSpeed_Cache_Log::debug2( 'Media bypassed base64 img' ) ;
|
415 |
continue ;
|
416 |
}
|
417 |
|
418 |
-
LiteSpeed_Cache_Log::debug2( 'Media
|
419 |
|
420 |
if ( ! empty( $attrs[ 'data-no-lazy' ] ) || ! empty( $attrs[ 'data-lazyloaded' ] ) || ! empty( $attrs[ 'data-src' ] ) || ! empty( $attrs[ 'data-srcset' ] ) ) {
|
421 |
-
LiteSpeed_Cache_Log::debug2( 'Media bypassed' ) ;
|
422 |
continue ;
|
423 |
}
|
424 |
|
@@ -427,7 +437,7 @@ class LiteSpeed_Cache_Media
|
|
427 |
* @since 1.5
|
428 |
*/
|
429 |
if ( $excludes && LiteSpeed_Cache_Utility::str_hit_array( $attrs[ 'src' ], $excludes ) ) {
|
430 |
-
LiteSpeed_Cache_Log::debug2( 'Media
|
431 |
continue ;
|
432 |
}
|
433 |
|
@@ -463,10 +473,10 @@ class LiteSpeed_Cache_Media
|
|
463 |
continue ;
|
464 |
}
|
465 |
|
466 |
-
LiteSpeed_Cache_Log::debug2( 'Media found iframe: ' . $attrs[ 'src' ] ) ;
|
467 |
|
468 |
if ( ! empty( $attrs[ 'data-no-lazy' ] ) || ! empty( $attrs[ 'data-lazyloaded' ] ) || ! empty( $attrs[ 'data-src' ] ) ) {
|
469 |
-
LiteSpeed_Cache_Log::debug2( 'Media bypassed' ) ;
|
470 |
continue ;
|
471 |
}
|
472 |
|
@@ -520,7 +530,7 @@ class LiteSpeed_Cache_Media
|
|
520 |
*/
|
521 |
public function webp_attach_img_src( $img )
|
522 |
{
|
523 |
-
LiteSpeed_Cache_Log::debug2( 'Media changing attach src: ' . $img[0] ) ;
|
524 |
if ( $img && $url = $this->_replace_webp( $img[ 0 ] ) ) {
|
525 |
$img[ 0 ] = $url ;
|
526 |
}
|
@@ -572,19 +582,19 @@ class LiteSpeed_Cache_Media
|
|
572 |
*/
|
573 |
private function _replace_webp( $url )
|
574 |
{
|
575 |
-
LiteSpeed_Cache_Log::debug2( 'Media
|
576 |
if ( LiteSpeed_Cache_Utility::is_internal_file( $url ) ) {
|
577 |
// check if has webp file
|
578 |
if ( LiteSpeed_Cache_Utility::is_internal_file( $url . '.webp' ) ) {
|
579 |
$url .= '.webp' ;
|
580 |
}
|
581 |
else {
|
582 |
-
LiteSpeed_Cache_Log::debug2( 'Media
|
583 |
return false ;
|
584 |
}
|
585 |
}
|
586 |
else {
|
587 |
-
LiteSpeed_Cache_Log::debug2( 'Media
|
588 |
return false ;
|
589 |
}
|
590 |
|
240 |
{
|
241 |
// This request is for js/css_async.js
|
242 |
if ( strpos( $_SERVER[ 'REQUEST_URI' ], self::LAZY_LIB ) !== false ) {
|
243 |
+
LiteSpeed_Cache_Log::debug( '[Media] run lazyload lib' ) ;
|
244 |
+
|
245 |
+
$file = LSCWP_DIR . 'js/lazyload.min.js' ;
|
246 |
+
|
247 |
+
$content = Litespeed_File::read( $file ) ;
|
248 |
+
|
249 |
+
$static_file = LSCWP_CONTENT_DIR . '/cache/js/lazyload.js' ;
|
250 |
+
|
251 |
+
// Save to cache folder to enable directly usage by .htacess
|
252 |
+
if ( ! file_exists( $static_file ) ) {
|
253 |
+
Litespeed_File::save( $static_file, $content, true ) ;
|
254 |
+
LiteSpeed_Cache_Log::debug( '[Media] save lazyload lib to ' . $static_file ) ;
|
255 |
+
}
|
256 |
|
257 |
LiteSpeed_Cache_Control::set_cacheable() ;
|
258 |
LiteSpeed_Cache_Control::set_public_forced( 'OPTM: lazyload js' ) ;
|
260 |
LiteSpeed_Cache_Control::set_custom_ttl( 8640000 ) ;
|
261 |
LiteSpeed_Cache_Tag::add( LiteSpeed_Cache_Tag::TYPE_MIN . '_LAZY' ) ;
|
262 |
|
263 |
+
header( 'Content-Length: ' . strlen( $content ) ) ;
|
|
|
|
|
264 |
header( 'Content-Type: application/x-javascript; charset=utf-8' ) ;
|
265 |
|
266 |
+
echo $content ;
|
267 |
exit ;
|
268 |
}
|
269 |
}
|
301 |
public static function finalize( $content )
|
302 |
{
|
303 |
if ( defined( 'LITESPEED_NO_LAZY' ) ) {
|
304 |
+
LiteSpeed_Cache_Log::debug2( '[Media] bypass: NO_LAZY const' ) ;
|
305 |
return $content ;
|
306 |
}
|
307 |
|
308 |
if ( ! defined( 'LITESPEED_IS_HTML' ) ) {
|
309 |
+
LiteSpeed_Cache_Log::debug2( '[Media] bypass: Not frontend HTML type' ) ;
|
310 |
return $content ;
|
311 |
}
|
312 |
|
313 |
+
LiteSpeed_Cache_Log::debug( '[Media] finalize' ) ;
|
314 |
|
315 |
$instance = self::get_instance() ;
|
316 |
$instance->content = $content ;
|
327 |
*/
|
328 |
private function _finalize()
|
329 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
330 |
/**
|
331 |
* Use webp for optimized images
|
332 |
* @since 1.6.2
|
335 |
$this->_replace_buffer_img_webp() ;
|
336 |
}
|
337 |
|
338 |
+
$cfg_img_lazy = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_MEDIA_IMG_LAZY ) ;
|
339 |
+
$cfg_iframe_lazy = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_MEDIA_IFRAME_LAZY ) ;
|
340 |
+
|
341 |
+
if ( $cfg_img_lazy ) {
|
342 |
+
list( $src_list, $html_list ) = $this->_parse_img() ;
|
343 |
+
$html_list_ori = $html_list ;
|
344 |
+
}
|
345 |
+
|
346 |
// image lazy load
|
347 |
if ( $cfg_img_lazy ) {
|
348 |
|
421 |
* @since 1.6
|
422 |
*/
|
423 |
if ( strpos( $attrs[ 'src' ], 'base64' ) !== false || substr( $attrs[ 'src' ], 0, 5 ) === 'data:' ) {
|
424 |
+
LiteSpeed_Cache_Log::debug2( '[Media] bypassed base64 img' ) ;
|
425 |
continue ;
|
426 |
}
|
427 |
|
428 |
+
LiteSpeed_Cache_Log::debug2( '[Media] found: ' . $attrs[ 'src' ] ) ;
|
429 |
|
430 |
if ( ! empty( $attrs[ 'data-no-lazy' ] ) || ! empty( $attrs[ 'data-lazyloaded' ] ) || ! empty( $attrs[ 'data-src' ] ) || ! empty( $attrs[ 'data-srcset' ] ) ) {
|
431 |
+
LiteSpeed_Cache_Log::debug2( '[Media] bypassed' ) ;
|
432 |
continue ;
|
433 |
}
|
434 |
|
437 |
* @since 1.5
|
438 |
*/
|
439 |
if ( $excludes && LiteSpeed_Cache_Utility::str_hit_array( $attrs[ 'src' ], $excludes ) ) {
|
440 |
+
LiteSpeed_Cache_Log::debug2( '[Media] lazyload image exclude ' . $attrs[ 'src' ] ) ;
|
441 |
continue ;
|
442 |
}
|
443 |
|
473 |
continue ;
|
474 |
}
|
475 |
|
476 |
+
LiteSpeed_Cache_Log::debug2( '[Media] found iframe: ' . $attrs[ 'src' ] ) ;
|
477 |
|
478 |
if ( ! empty( $attrs[ 'data-no-lazy' ] ) || ! empty( $attrs[ 'data-lazyloaded' ] ) || ! empty( $attrs[ 'data-src' ] ) ) {
|
479 |
+
LiteSpeed_Cache_Log::debug2( '[Media] bypassed' ) ;
|
480 |
continue ;
|
481 |
}
|
482 |
|
530 |
*/
|
531 |
public function webp_attach_img_src( $img )
|
532 |
{
|
533 |
+
LiteSpeed_Cache_Log::debug2( '[Media] changing attach src: ' . $img[0] ) ;
|
534 |
if ( $img && $url = $this->_replace_webp( $img[ 0 ] ) ) {
|
535 |
$img[ 0 ] = $url ;
|
536 |
}
|
582 |
*/
|
583 |
private function _replace_webp( $url )
|
584 |
{
|
585 |
+
LiteSpeed_Cache_Log::debug2( '[Media] webp replacing: ' . $url ) ;
|
586 |
if ( LiteSpeed_Cache_Utility::is_internal_file( $url ) ) {
|
587 |
// check if has webp file
|
588 |
if ( LiteSpeed_Cache_Utility::is_internal_file( $url . '.webp' ) ) {
|
589 |
$url .= '.webp' ;
|
590 |
}
|
591 |
else {
|
592 |
+
LiteSpeed_Cache_Log::debug2( '[Media] no WebP file, bypassed' ) ;
|
593 |
return false ;
|
594 |
}
|
595 |
}
|
596 |
else {
|
597 |
+
LiteSpeed_Cache_Log::debug2( '[Media] no file, bypassed' ) ;
|
598 |
return false ;
|
599 |
}
|
600 |
|
inc/optimize.class.php
CHANGED
@@ -34,6 +34,7 @@ class LiteSpeed_Cache_Optimize
|
|
34 |
private $cfg_exc_jquery ;
|
35 |
private $cfg_ggfonts_async ;
|
36 |
private $cfg_optm_max_size ;
|
|
|
37 |
|
38 |
private $dns_prefetch ;
|
39 |
|
@@ -69,6 +70,7 @@ class LiteSpeed_Cache_Optimize
|
|
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 |
|
@@ -181,7 +183,19 @@ class LiteSpeed_Cache_Optimize
|
|
181 |
{
|
182 |
// This request is for js/css_async.js
|
183 |
if ( ( $this->cfg_css_async || $this->cfg_ggfonts_async ) && strpos( $_SERVER[ 'REQUEST_URI' ], self::CSS_ASYNC_LIB ) !== false ) {
|
184 |
-
LiteSpeed_Cache_Log::debug( '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
185 |
|
186 |
LiteSpeed_Cache_Control::set_cacheable() ;
|
187 |
LiteSpeed_Cache_Control::set_public_forced( 'OPTM: css async js' ) ;
|
@@ -189,12 +203,10 @@ class LiteSpeed_Cache_Optimize
|
|
189 |
LiteSpeed_Cache_Control::set_custom_ttl( 8640000 ) ;
|
190 |
LiteSpeed_Cache_Tag::add( LiteSpeed_Cache_Tag::TYPE_MIN . '_CSS_ASYNC' ) ;
|
191 |
|
192 |
-
|
193 |
-
|
194 |
-
header( 'Content-Length: ' . filesize( $file ) ) ;
|
195 |
header( 'Content-Type: application/x-javascript; charset=utf-8' ) ;
|
196 |
|
197 |
-
echo
|
198 |
exit ;
|
199 |
}
|
200 |
|
@@ -212,70 +224,69 @@ class LiteSpeed_Cache_Optimize
|
|
212 |
return ;
|
213 |
}
|
214 |
|
215 |
-
LiteSpeed_Cache_Log::debug( '
|
216 |
|
217 |
// Proceed css/js file generation
|
218 |
define( 'LITESPEED_MIN_FILE', true ) ;
|
219 |
|
220 |
-
$file_type =
|
221 |
-
|
222 |
-
$ttl = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTIMIZE_TTL ) ;
|
223 |
|
224 |
-
|
225 |
-
if ( ! defined( 'LITESPEED_ON' ) ) {
|
226 |
-
LiteSpeed_Cache_Log::debug( '[Optimize] Not enabled lscache, using file based cache' ) ;
|
227 |
|
228 |
-
|
229 |
-
|
230 |
-
|
|
|
|
|
|
|
|
|
231 |
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
|
236 |
-
|
237 |
-
$headers[ 'Content-Type' ] = 'text/css; charset=utf-8' ;
|
238 |
-
}
|
239 |
-
else {
|
240 |
-
$headers[ 'Content-Type' ] = 'application/x-javascript' ;
|
241 |
-
}
|
242 |
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
}
|
247 |
|
248 |
-
echo $content ;
|
249 |
-
exit ;
|
250 |
-
}
|
251 |
}
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
if ( ! $content ) {
|
258 |
-
LiteSpeed_Cache_Control::set_nocache( 'Empty content from optimizer' ) ;
|
259 |
-
exit ;
|
260 |
}
|
261 |
|
262 |
-
//
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
Litespeed_File::save( $static_file, $content, true ) ;
|
267 |
-
}
|
268 |
|
269 |
LiteSpeed_Cache_Control::set_cacheable() ;
|
270 |
LiteSpeed_Cache_Control::set_public_forced( 'OPTM: min file ' . $match[ 1 ] ) ;
|
271 |
LiteSpeed_Cache_Control::set_no_vary() ;
|
272 |
-
LiteSpeed_Cache_Control::set_custom_ttl( $
|
273 |
LiteSpeed_Cache_Tag::add( LiteSpeed_Cache_Tag::TYPE_MIN ) ;
|
274 |
|
275 |
echo $content ;
|
276 |
exit ;
|
277 |
}
|
278 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
279 |
/**
|
280 |
* Delete file-based cache folder
|
281 |
*
|
@@ -349,7 +360,7 @@ class LiteSpeed_Cache_Optimize
|
|
349 |
}
|
350 |
|
351 |
if ( ! defined( 'LITESPEED_IS_HTML' ) ) {
|
352 |
-
LiteSpeed_Cache_Log::debug( '
|
353 |
return $content ;
|
354 |
}
|
355 |
|
@@ -358,19 +369,19 @@ class LiteSpeed_Cache_Optimize
|
|
358 |
if ( ! empty( $excludes ) ) {
|
359 |
$result = LiteSpeed_Cache_Utility::str_hit_array( esc_url( $_SERVER[ 'REQUEST_URI' ] ), explode( "\n", $excludes ) ) ;
|
360 |
if ( $result ) {
|
361 |
-
LiteSpeed_Cache_Log::debug( '
|
362 |
return $content ;
|
363 |
}
|
364 |
}
|
365 |
|
366 |
// Check if is exclude optm roles ( Need to set Vary too )
|
367 |
if ( $result = LiteSpeed_Cache_Config::get_instance()->in_exclude_optimization_roles() ) {
|
368 |
-
LiteSpeed_Cache_Log::debug( '
|
369 |
return $content ;
|
370 |
}
|
371 |
|
372 |
|
373 |
-
LiteSpeed_Cache_Log::debug( '
|
374 |
|
375 |
$instance = self::get_instance() ;
|
376 |
$instance->content = $content ;
|
@@ -388,7 +399,7 @@ class LiteSpeed_Cache_Optimize
|
|
388 |
private function _optimize()
|
389 |
{
|
390 |
if ( ! $this->_can_optm() ) {
|
391 |
-
LiteSpeed_Cache_Log::debug( '
|
392 |
return ;
|
393 |
}
|
394 |
|
@@ -492,7 +503,7 @@ class LiteSpeed_Cache_Optimize
|
|
492 |
continue ;
|
493 |
}
|
494 |
|
495 |
-
LiteSpeed_Cache_Log::debug( 'Optm
|
496 |
}
|
497 |
// async html
|
498 |
$html_list_async = $this->_async_css_list( $html_list ) ;
|
@@ -662,7 +673,7 @@ class LiteSpeed_Cache_Optimize
|
|
662 |
$this->content .= "\n" . '<!-- Page optimized by LiteSpeed Cache on '.date('Y-m-d H:i:s').' -->' ;
|
663 |
|
664 |
} catch ( ErrorException $e ) {
|
665 |
-
LiteSpeed_Cache_Log::debug( 'Error when optimizing HTML: ' . $e->getMessage() ) ;
|
666 |
error_log( 'LiteSpeed Optimizer optimizing HTML Error: ' . $e->getMessage() ) ;
|
667 |
// If failed to minify HTML, restore original content
|
668 |
$this->content = $ori ;
|
@@ -759,7 +770,7 @@ class LiteSpeed_Cache_Optimize
|
|
759 |
}
|
760 |
}
|
761 |
if ( count( $src_arr ) > 1 ) {
|
762 |
-
LiteSpeed_Cache_Log::debug( '
|
763 |
}
|
764 |
|
765 |
// group build
|
@@ -831,7 +842,7 @@ class LiteSpeed_Cache_Optimize
|
|
831 |
|
832 |
// Analyse links
|
833 |
foreach ( $src_list as $key => $src ) {
|
834 |
-
LiteSpeed_Cache_Log::debug2( 'Optm
|
835 |
|
836 |
/**
|
837 |
* Excluded links won't be done any optm
|
@@ -839,14 +850,14 @@ class LiteSpeed_Cache_Optimize
|
|
839 |
*/
|
840 |
// if ( $excludes && $exclude = LiteSpeed_Cache_Utility::str_hit_array( $src, $excludes ) ) {
|
841 |
// $ignored_html[] = $html_list[ $key ] ;
|
842 |
-
// LiteSpeed_Cache_Log::debug2( 'Optm: Abort excludes: ' . $exclude ) ;
|
843 |
// continue ;
|
844 |
// }
|
845 |
|
846 |
// Check if has no-optimize attr
|
847 |
if ( strpos( $html_list[ $key ], 'data-no-optimize' ) !== false ) {
|
848 |
$ignored_html[] = $html_list[ $key ] ;
|
849 |
-
LiteSpeed_Cache_Log::debug2( 'Optm
|
850 |
continue ;
|
851 |
}
|
852 |
|
@@ -854,7 +865,7 @@ class LiteSpeed_Cache_Optimize
|
|
854 |
$url_parsed = parse_url( $src ) ;
|
855 |
if ( ! $file_info = LiteSpeed_Cache_Utility::is_internal_file( $src ) ) {
|
856 |
$ignored_html[ $src ] = $html_list[ $key ] ;
|
857 |
-
LiteSpeed_Cache_Log::debug2( 'Optm
|
858 |
continue ;
|
859 |
}
|
860 |
|
@@ -865,7 +876,7 @@ class LiteSpeed_Cache_Optimize
|
|
865 |
*/
|
866 |
if ( $this->cfg_exc_jquery && $this->_is_jquery( $src ) ) {
|
867 |
$ignored_html[ $src ] = $html_list[ $key ] ;
|
868 |
-
LiteSpeed_Cache_Log::debug2( 'Optm
|
869 |
|
870 |
// Add to HTTP2 as its ignored but still internal src
|
871 |
$this->append_http2( $src, 'js' ) ;
|
@@ -896,6 +907,7 @@ class LiteSpeed_Cache_Optimize
|
|
896 |
if ( ! is_array( $src ) ) {
|
897 |
$src = array( $src ) ;
|
898 |
}
|
|
|
899 |
$src = array_values( $src ) ;
|
900 |
|
901 |
$hash = md5( serialize( $src ) ) ;
|
@@ -918,6 +930,21 @@ class LiteSpeed_Cache_Optimize
|
|
918 |
LiteSpeed_Cache_Data::optm_save_src( $short . '.' . $file_type, $src ) ;
|
919 |
}
|
920 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
921 |
$file_to_save = self::DIR_MIN . '/' . $filename . '.' . $file_type ;
|
922 |
|
923 |
return LiteSpeed_Cache_Utility::get_permalink_url( $file_to_save ) ;
|
@@ -967,7 +994,7 @@ class LiteSpeed_Cache_Optimize
|
|
967 |
}
|
968 |
// todo @v2.0: allow defer even exclude from optm
|
969 |
if ( $excludes && $exclude = LiteSpeed_Cache_Utility::str_hit_array( $attrs[ 'src' ], $excludes ) ) {
|
970 |
-
LiteSpeed_Cache_Log::debug2( 'Optm
|
971 |
continue ;
|
972 |
}
|
973 |
|
@@ -1027,13 +1054,13 @@ class LiteSpeed_Cache_Optimize
|
|
1027 |
}
|
1028 |
|
1029 |
if ( $excludes && $exclude = LiteSpeed_Cache_Utility::str_hit_array( $attrs[ 'href' ], $excludes ) ) {
|
1030 |
-
LiteSpeed_Cache_Log::debug2( 'Optm
|
1031 |
continue ;
|
1032 |
}
|
1033 |
|
1034 |
// Check if need to remove this css
|
1035 |
if ( $this->css_to_be_removed && LiteSpeed_Cache_Utility::str_hit_array( $attrs[ 'href' ], $this->css_to_be_removed ) ) {
|
1036 |
-
LiteSpeed_Cache_Log::debug( 'Optm
|
1037 |
// Delete this css snippet from orig html
|
1038 |
$this->content = str_replace( $match[ 0 ], '', $this->content ) ;
|
1039 |
continue ;
|
@@ -1063,12 +1090,12 @@ class LiteSpeed_Cache_Optimize
|
|
1063 |
{
|
1064 |
foreach ( $html_list as $k => $ori ) {
|
1065 |
if ( strpos( $ori, 'data-asynced' ) !== false ) {
|
1066 |
-
LiteSpeed_Cache_Log::debug2( 'Optm bypass: attr data-asynced exist' ) ;
|
1067 |
continue ;
|
1068 |
}
|
1069 |
|
1070 |
if ( strpos( $ori, 'data-no-async' ) !== false ) {
|
1071 |
-
LiteSpeed_Cache_Log::debug2( 'Optm bypass: attr api data-no-async' ) ;
|
1072 |
continue ;
|
1073 |
}
|
1074 |
|
@@ -1098,11 +1125,11 @@ class LiteSpeed_Cache_Optimize
|
|
1098 |
continue ;
|
1099 |
}
|
1100 |
if ( strpos( $v, 'data-deferred' ) !== false ) {
|
1101 |
-
LiteSpeed_Cache_Log::debug2( 'Optm bypass: attr data-deferred exist' ) ;
|
1102 |
continue ;
|
1103 |
}
|
1104 |
if ( strpos( $v, 'data-no-defer' ) !== false ) {
|
1105 |
-
LiteSpeed_Cache_Log::debug2( 'Optm bypass: attr api data-no-defer' ) ;
|
1106 |
continue ;
|
1107 |
}
|
1108 |
|
@@ -1114,14 +1141,14 @@ class LiteSpeed_Cache_Optimize
|
|
1114 |
// parse js src
|
1115 |
preg_match( '#<script \s*([^>]+)>#isU', $v, $matches ) ;
|
1116 |
if ( empty( $matches[ 1 ] ) ) {
|
1117 |
-
LiteSpeed_Cache_Log::debug( 'Optm
|
1118 |
continue ;
|
1119 |
}
|
1120 |
|
1121 |
$attrs = LiteSpeed_Cache_Utility::parse_attr( $matches[ 1 ] ) ;
|
1122 |
|
1123 |
if ( empty( $attrs[ 'src' ] ) ) {
|
1124 |
-
LiteSpeed_Cache_Log::debug( 'Optm
|
1125 |
continue ;
|
1126 |
}
|
1127 |
|
@@ -1133,7 +1160,7 @@ class LiteSpeed_Cache_Optimize
|
|
1133 |
* @since 1.5
|
1134 |
*/
|
1135 |
if ( $this->cfg_js_defer_exc && LiteSpeed_Cache_Utility::str_hit_array( $src, $this->cfg_js_defer_exc ) ) {
|
1136 |
-
LiteSpeed_Cache_Log::debug( 'Optm
|
1137 |
continue ;
|
1138 |
}
|
1139 |
|
@@ -1142,7 +1169,7 @@ class LiteSpeed_Cache_Optimize
|
|
1142 |
* @since 1.5
|
1143 |
*/
|
1144 |
if ( $this->cfg_exc_jquery && $this->_is_jquery( $src ) ) {
|
1145 |
-
LiteSpeed_Cache_Log::debug2( 'Optm
|
1146 |
continue ;
|
1147 |
}
|
1148 |
|
34 |
private $cfg_exc_jquery ;
|
35 |
private $cfg_ggfonts_async ;
|
36 |
private $cfg_optm_max_size ;
|
37 |
+
private $cfg_ttl ;
|
38 |
|
39 |
private $dns_prefetch ;
|
40 |
|
70 |
$this->cfg_exc_jquery = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTM_EXC_JQUERY ) ;
|
71 |
$this->cfg_ggfonts_async = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTM_GGFONTS_ASYNC ) ;
|
72 |
$this->cfg_optm_max_size = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTM_MAX_SIZE ) * 1000000 ;
|
73 |
+
$this->cfg_ttl = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTIMIZE_TTL ) ;
|
74 |
|
75 |
$this->_static_request_check() ;
|
76 |
|
183 |
{
|
184 |
// This request is for js/css_async.js
|
185 |
if ( ( $this->cfg_css_async || $this->cfg_ggfonts_async ) && strpos( $_SERVER[ 'REQUEST_URI' ], self::CSS_ASYNC_LIB ) !== false ) {
|
186 |
+
LiteSpeed_Cache_Log::debug( '[Optm] start serving static file' ) ;
|
187 |
+
|
188 |
+
$file = LSCWP_DIR . 'js/css_async.min.js' ;
|
189 |
+
|
190 |
+
$content = Litespeed_File::read( $file ) ;
|
191 |
+
|
192 |
+
$static_file = LSCWP_CONTENT_DIR . '/cache/js/css_async.js' ;
|
193 |
+
|
194 |
+
// Save to cache folder to enable directly usage by .htacess
|
195 |
+
if ( ! file_exists( $static_file ) ) {
|
196 |
+
Litespeed_File::save( $static_file, $content, true ) ;
|
197 |
+
LiteSpeed_Cache_Log::debug( '[Optm] save css_async lib to ' . $static_file ) ;
|
198 |
+
}
|
199 |
|
200 |
LiteSpeed_Cache_Control::set_cacheable() ;
|
201 |
LiteSpeed_Cache_Control::set_public_forced( 'OPTM: css async js' ) ;
|
203 |
LiteSpeed_Cache_Control::set_custom_ttl( 8640000 ) ;
|
204 |
LiteSpeed_Cache_Tag::add( LiteSpeed_Cache_Tag::TYPE_MIN . '_CSS_ASYNC' ) ;
|
205 |
|
206 |
+
header( 'Content-Length: ' . strlen( $content ) ) ;
|
|
|
|
|
207 |
header( 'Content-Type: application/x-javascript; charset=utf-8' ) ;
|
208 |
|
209 |
+
echo $content ;
|
210 |
exit ;
|
211 |
}
|
212 |
|
224 |
return ;
|
225 |
}
|
226 |
|
227 |
+
LiteSpeed_Cache_Log::debug( '[Optm] start minifying file' ) ;
|
228 |
|
229 |
// Proceed css/js file generation
|
230 |
define( 'LITESPEED_MIN_FILE', true ) ;
|
231 |
|
232 |
+
$file_type = $match[ 2 ] ;
|
|
|
|
|
233 |
|
234 |
+
$static_file = LSCWP_CONTENT_DIR . '/cache/' . $file_type . '/' . $match[ 1 ] ;
|
|
|
|
|
235 |
|
236 |
+
$headers = array() ;
|
237 |
+
if ( $file_type === 'css' ) {
|
238 |
+
$headers[ 'Content-Type' ] = 'text/css; charset=utf-8' ;
|
239 |
+
}
|
240 |
+
else {
|
241 |
+
$headers[ 'Content-Type' ] = 'application/x-javascript' ;
|
242 |
+
}
|
243 |
|
244 |
+
// Even if hit PHP, still check if the file is valid to bypass minify process
|
245 |
+
if ( ! file_exists( $static_file ) || time() - filemtime( $static_file ) > $this->cfg_ttl ) {
|
246 |
+
$concat_only = ! ( $file_type === 'css' ? $this->cfg_css_minify : $this->cfg_js_minify ) ;
|
247 |
|
248 |
+
$content = LiteSpeed_Cache_Optimizer::get_instance()->serve( $match[ 1 ], $concat_only ) ;
|
|
|
|
|
|
|
|
|
|
|
249 |
|
250 |
+
// Generate static file
|
251 |
+
Litespeed_File::save( $static_file, $content, true ) ;
|
252 |
+
LiteSpeed_Cache_Log::debug( '[Optm] Saved cache to file [path] ' . $static_file ) ;
|
|
|
253 |
|
|
|
|
|
|
|
254 |
}
|
255 |
+
else {
|
256 |
+
// Load file from file based cache if not expired
|
257 |
+
LiteSpeed_Cache_Log::debug( '[Optm] Static file available' ) ;
|
258 |
+
$content = Litespeed_File::read( $static_file ) ;
|
|
|
|
|
|
|
|
|
259 |
}
|
260 |
|
261 |
+
// Output header first
|
262 |
+
$headers[ 'Content-Length' ] = strlen( $content ) ;
|
263 |
+
$this->_output_header( $headers ) ;
|
|
|
|
|
|
|
264 |
|
265 |
LiteSpeed_Cache_Control::set_cacheable() ;
|
266 |
LiteSpeed_Cache_Control::set_public_forced( 'OPTM: min file ' . $match[ 1 ] ) ;
|
267 |
LiteSpeed_Cache_Control::set_no_vary() ;
|
268 |
+
LiteSpeed_Cache_Control::set_custom_ttl( $this->cfg_ttl ) ;
|
269 |
LiteSpeed_Cache_Tag::add( LiteSpeed_Cache_Tag::TYPE_MIN ) ;
|
270 |
|
271 |
echo $content ;
|
272 |
exit ;
|
273 |
}
|
274 |
|
275 |
+
/**
|
276 |
+
* Output header info
|
277 |
+
*
|
278 |
+
* @since 2.1.2
|
279 |
+
* @access public
|
280 |
+
*/
|
281 |
+
private function _output_header( $headers )
|
282 |
+
{
|
283 |
+
foreach ( $headers as $k => $v ) {
|
284 |
+
header( $k . ': ' . $v ) ;
|
285 |
+
LiteSpeed_Cache_Log::debug( '[Optm] HEADER ' . $k . ': ' . $v ) ;
|
286 |
+
}
|
287 |
+
|
288 |
+
}
|
289 |
+
|
290 |
/**
|
291 |
* Delete file-based cache folder
|
292 |
*
|
360 |
}
|
361 |
|
362 |
if ( ! defined( 'LITESPEED_IS_HTML' ) ) {
|
363 |
+
LiteSpeed_Cache_Log::debug( '[Optm] bypass: Not frontend HTML type' ) ;
|
364 |
return $content ;
|
365 |
}
|
366 |
|
369 |
if ( ! empty( $excludes ) ) {
|
370 |
$result = LiteSpeed_Cache_Utility::str_hit_array( esc_url( $_SERVER[ 'REQUEST_URI' ] ), explode( "\n", $excludes ) ) ;
|
371 |
if ( $result ) {
|
372 |
+
LiteSpeed_Cache_Log::debug( '[Optm] bypass: hit URI Excludes setting: ' . $result ) ;
|
373 |
return $content ;
|
374 |
}
|
375 |
}
|
376 |
|
377 |
// Check if is exclude optm roles ( Need to set Vary too )
|
378 |
if ( $result = LiteSpeed_Cache_Config::get_instance()->in_exclude_optimization_roles() ) {
|
379 |
+
LiteSpeed_Cache_Log::debug( '[Optm] bypass: hit Role Excludes setting: ' . $result ) ;
|
380 |
return $content ;
|
381 |
}
|
382 |
|
383 |
|
384 |
+
LiteSpeed_Cache_Log::debug( '[Optm] start' ) ;
|
385 |
|
386 |
$instance = self::get_instance() ;
|
387 |
$instance->content = $content ;
|
399 |
private function _optimize()
|
400 |
{
|
401 |
if ( ! $this->_can_optm() ) {
|
402 |
+
LiteSpeed_Cache_Log::debug( '[Optm] bypass: admin/feed/preview' ) ;
|
403 |
return ;
|
404 |
}
|
405 |
|
503 |
continue ;
|
504 |
}
|
505 |
|
506 |
+
LiteSpeed_Cache_Log::debug( '[Optm] google fonts async loading: ' . $src_list[ $k ] ) ;
|
507 |
}
|
508 |
// async html
|
509 |
$html_list_async = $this->_async_css_list( $html_list ) ;
|
673 |
$this->content .= "\n" . '<!-- Page optimized by LiteSpeed Cache on '.date('Y-m-d H:i:s').' -->' ;
|
674 |
|
675 |
} catch ( ErrorException $e ) {
|
676 |
+
LiteSpeed_Cache_Log::debug( '[Optm] Error when optimizing HTML: ' . $e->getMessage() ) ;
|
677 |
error_log( 'LiteSpeed Optimizer optimizing HTML Error: ' . $e->getMessage() ) ;
|
678 |
// If failed to minify HTML, restore original content
|
679 |
$this->content = $ori ;
|
770 |
}
|
771 |
}
|
772 |
if ( count( $src_arr ) > 1 ) {
|
773 |
+
LiteSpeed_Cache_Log::debug( '[Optm] separate ' . $file_type . ' to ' . count( $src_arr ) ) ;
|
774 |
}
|
775 |
|
776 |
// group build
|
842 |
|
843 |
// Analyse links
|
844 |
foreach ( $src_list as $key => $src ) {
|
845 |
+
LiteSpeed_Cache_Log::debug2( '[Optm] ' . $src ) ;
|
846 |
|
847 |
/**
|
848 |
* Excluded links won't be done any optm
|
850 |
*/
|
851 |
// if ( $excludes && $exclude = LiteSpeed_Cache_Utility::str_hit_array( $src, $excludes ) ) {
|
852 |
// $ignored_html[] = $html_list[ $key ] ;
|
853 |
+
// LiteSpeed_Cache_Log::debug2( '[Optm]: Abort excludes: ' . $exclude ) ;
|
854 |
// continue ;
|
855 |
// }
|
856 |
|
857 |
// Check if has no-optimize attr
|
858 |
if ( strpos( $html_list[ $key ], 'data-no-optimize' ) !== false ) {
|
859 |
$ignored_html[] = $html_list[ $key ] ;
|
860 |
+
LiteSpeed_Cache_Log::debug2( '[Optm] Abort excludes: attr data-no-optimize' ) ;
|
861 |
continue ;
|
862 |
}
|
863 |
|
865 |
$url_parsed = parse_url( $src ) ;
|
866 |
if ( ! $file_info = LiteSpeed_Cache_Utility::is_internal_file( $src ) ) {
|
867 |
$ignored_html[ $src ] = $html_list[ $key ] ;
|
868 |
+
LiteSpeed_Cache_Log::debug2( '[Optm] Abort external/non-exist' ) ;
|
869 |
continue ;
|
870 |
}
|
871 |
|
876 |
*/
|
877 |
if ( $this->cfg_exc_jquery && $this->_is_jquery( $src ) ) {
|
878 |
$ignored_html[ $src ] = $html_list[ $key ] ;
|
879 |
+
LiteSpeed_Cache_Log::debug2( '[Optm] Abort jQuery by setting' ) ;
|
880 |
|
881 |
// Add to HTTP2 as its ignored but still internal src
|
882 |
$this->append_http2( $src, 'js' ) ;
|
907 |
if ( ! is_array( $src ) ) {
|
908 |
$src = array( $src ) ;
|
909 |
}
|
910 |
+
|
911 |
$src = array_values( $src ) ;
|
912 |
|
913 |
$hash = md5( serialize( $src ) ) ;
|
930 |
LiteSpeed_Cache_Data::optm_save_src( $short . '.' . $file_type, $src ) ;
|
931 |
}
|
932 |
|
933 |
+
// Generate static files
|
934 |
+
$static_file = LSCWP_CONTENT_DIR . "/cache/$file_type/$filename.$file_type" ;
|
935 |
+
// Check if the file is valid to bypass minify process
|
936 |
+
if ( ! file_exists( $static_file ) || time() - filemtime( $static_file ) > $this->cfg_ttl ) {
|
937 |
+
$concat_only = ! ( $file_type === 'css' ? $this->cfg_css_minify : $this->cfg_js_minify ) ;
|
938 |
+
|
939 |
+
$content = LiteSpeed_Cache_Optimizer::get_instance()->serve( $src, $concat_only ) ;
|
940 |
+
|
941 |
+
// Generate static file
|
942 |
+
Litespeed_File::save( $static_file, $content, true ) ;
|
943 |
+
|
944 |
+
LiteSpeed_Cache_Log::debug( '[Optm] Saved static file [path] ' . $static_file ) ;
|
945 |
+
|
946 |
+
}
|
947 |
+
|
948 |
$file_to_save = self::DIR_MIN . '/' . $filename . '.' . $file_type ;
|
949 |
|
950 |
return LiteSpeed_Cache_Utility::get_permalink_url( $file_to_save ) ;
|
994 |
}
|
995 |
// todo @v2.0: allow defer even exclude from optm
|
996 |
if ( $excludes && $exclude = LiteSpeed_Cache_Utility::str_hit_array( $attrs[ 'src' ], $excludes ) ) {
|
997 |
+
LiteSpeed_Cache_Log::debug2( '[Optm] _parse_js bypassed exclude ' . $exclude ) ;
|
998 |
continue ;
|
999 |
}
|
1000 |
|
1054 |
}
|
1055 |
|
1056 |
if ( $excludes && $exclude = LiteSpeed_Cache_Utility::str_hit_array( $attrs[ 'href' ], $excludes ) ) {
|
1057 |
+
LiteSpeed_Cache_Log::debug2( '[Optm] _handle_css bypassed exclude ' . $exclude ) ;
|
1058 |
continue ;
|
1059 |
}
|
1060 |
|
1061 |
// Check if need to remove this css
|
1062 |
if ( $this->css_to_be_removed && LiteSpeed_Cache_Utility::str_hit_array( $attrs[ 'href' ], $this->css_to_be_removed ) ) {
|
1063 |
+
LiteSpeed_Cache_Log::debug( '[Optm] rm css snippet ' . $attrs[ 'href' ] ) ;
|
1064 |
// Delete this css snippet from orig html
|
1065 |
$this->content = str_replace( $match[ 0 ], '', $this->content ) ;
|
1066 |
continue ;
|
1090 |
{
|
1091 |
foreach ( $html_list as $k => $ori ) {
|
1092 |
if ( strpos( $ori, 'data-asynced' ) !== false ) {
|
1093 |
+
LiteSpeed_Cache_Log::debug2( '[Optm] bypass: attr data-asynced exist' ) ;
|
1094 |
continue ;
|
1095 |
}
|
1096 |
|
1097 |
if ( strpos( $ori, 'data-no-async' ) !== false ) {
|
1098 |
+
LiteSpeed_Cache_Log::debug2( '[Optm] bypass: attr api data-no-async' ) ;
|
1099 |
continue ;
|
1100 |
}
|
1101 |
|
1125 |
continue ;
|
1126 |
}
|
1127 |
if ( strpos( $v, 'data-deferred' ) !== false ) {
|
1128 |
+
LiteSpeed_Cache_Log::debug2( '[Optm] bypass: attr data-deferred exist' ) ;
|
1129 |
continue ;
|
1130 |
}
|
1131 |
if ( strpos( $v, 'data-no-defer' ) !== false ) {
|
1132 |
+
LiteSpeed_Cache_Log::debug2( '[Optm] bypass: attr api data-no-defer' ) ;
|
1133 |
continue ;
|
1134 |
}
|
1135 |
|
1141 |
// parse js src
|
1142 |
preg_match( '#<script \s*([^>]+)>#isU', $v, $matches ) ;
|
1143 |
if ( empty( $matches[ 1 ] ) ) {
|
1144 |
+
LiteSpeed_Cache_Log::debug( '[Optm] js defer parse html failed: ' . $v ) ;
|
1145 |
continue ;
|
1146 |
}
|
1147 |
|
1148 |
$attrs = LiteSpeed_Cache_Utility::parse_attr( $matches[ 1 ] ) ;
|
1149 |
|
1150 |
if ( empty( $attrs[ 'src' ] ) ) {
|
1151 |
+
LiteSpeed_Cache_Log::debug( '[Optm] js defer parse src failed: ' . $matches[ 1 ] ) ;
|
1152 |
continue ;
|
1153 |
}
|
1154 |
|
1160 |
* @since 1.5
|
1161 |
*/
|
1162 |
if ( $this->cfg_js_defer_exc && LiteSpeed_Cache_Utility::str_hit_array( $src, $this->cfg_js_defer_exc ) ) {
|
1163 |
+
LiteSpeed_Cache_Log::debug( '[Optm] js defer exclude ' . $src ) ;
|
1164 |
continue ;
|
1165 |
}
|
1166 |
|
1169 |
* @since 1.5
|
1170 |
*/
|
1171 |
if ( $this->cfg_exc_jquery && $this->_is_jquery( $src ) ) {
|
1172 |
+
LiteSpeed_Cache_Log::debug2( '[Optm] js defer Abort jQuery by setting' ) ;
|
1173 |
continue ;
|
1174 |
}
|
1175 |
|
inc/optimizer.class.php
CHANGED
@@ -65,12 +65,16 @@ class LiteSpeed_Cache_Optimizer
|
|
65 |
*/
|
66 |
public function serve( $filename, $concat_only )
|
67 |
{
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
|
|
|
|
|
|
|
|
|
|
72 |
}
|
73 |
-
|
74 |
|
75 |
// Parse real file path
|
76 |
$real_files = array() ;
|
@@ -86,26 +90,25 @@ class LiteSpeed_Cache_Optimizer
|
|
86 |
return false;
|
87 |
}
|
88 |
|
|
|
89 |
|
90 |
set_error_handler( 'litespeed_exception_handler' ) ;
|
91 |
|
92 |
-
$headers = array() ;
|
93 |
$content = '' ;
|
94 |
-
$
|
|
|
95 |
try {
|
96 |
// Handle CSS
|
97 |
if ( $file_type === 'css' ) {
|
98 |
$content = $this->_serve_css( $real_files, $concat_only ) ;
|
99 |
-
$headers[ 'Content-Type' ] = 'text/css; charset=utf-8' ;
|
100 |
}
|
101 |
// Handle JS
|
102 |
else {
|
103 |
$content = $this->_serve_js( $real_files, $concat_only ) ;
|
104 |
-
$headers[ 'Content-Type' ] = 'application/x-javascript' ;
|
105 |
}
|
106 |
|
107 |
} catch ( ErrorException $e ) {
|
108 |
-
LiteSpeed_Cache_Log::debug( 'Error when serving from optimizer: ' . $e->getMessage() ) ;
|
109 |
error_log( 'LiteSpeed Optimizer serving Error: ' . $e->getMessage() ) ;
|
110 |
return false ;
|
111 |
}
|
@@ -119,14 +122,7 @@ class LiteSpeed_Cache_Optimizer
|
|
119 |
$content = $this->_remove_comment( $content, $file_type ) ;
|
120 |
}
|
121 |
|
122 |
-
LiteSpeed_Cache_Log::debug( '
|
123 |
-
|
124 |
-
$headers[ 'Content-Length' ] = strlen( $content ) ;
|
125 |
-
|
126 |
-
foreach ( $headers as $key => $val ) {
|
127 |
-
header( $key . ': ' . $val ) ;
|
128 |
-
LiteSpeed_Cache_Log::debug( 'HEADER ' . $key . ': ' . $val ) ;
|
129 |
-
}
|
130 |
|
131 |
return $content ;
|
132 |
}
|
@@ -141,8 +137,8 @@ class LiteSpeed_Cache_Optimizer
|
|
141 |
{
|
142 |
$con = array() ;
|
143 |
foreach ( $files as $real_path ) {
|
144 |
-
LiteSpeed_Cache_Log::debug( '
|
145 |
-
$data =
|
146 |
|
147 |
$data = preg_replace( '/@charset[^;]+;\\s*/', '', $data ) ;
|
148 |
|
@@ -169,7 +165,7 @@ class LiteSpeed_Cache_Optimizer
|
|
169 |
{
|
170 |
$con = array() ;
|
171 |
foreach ( $files as $real_path ) {
|
172 |
-
$data =
|
173 |
|
174 |
if ( ! $concat_only && ! $this->_is_min( $real_path ) ) {
|
175 |
$data = JSMin\JSMin::minify( $data ) ;
|
@@ -207,21 +203,6 @@ class LiteSpeed_Cache_Optimizer
|
|
207 |
return false ;
|
208 |
}
|
209 |
|
210 |
-
/**
|
211 |
-
* Read content and remove UTF-8 BOM if present
|
212 |
-
*
|
213 |
-
* @since 1.9
|
214 |
-
* @access private
|
215 |
-
*/
|
216 |
-
private function _read( $file )
|
217 |
-
{
|
218 |
-
$content = file_get_contents( $file ) ;
|
219 |
-
if ( substr( $content, 0, 3 ) === "\xEF\xBB\xBF" ) {
|
220 |
-
$content = substr( $content, 3 ) ;
|
221 |
-
}
|
222 |
-
return $content ;
|
223 |
-
}
|
224 |
-
|
225 |
/**
|
226 |
* Remove comment when minify
|
227 |
*
|
65 |
*/
|
66 |
public function serve( $filename, $concat_only )
|
67 |
{
|
68 |
+
if ( ! is_array( $filename ) ) {
|
69 |
+
// Search filename in db for src URLs
|
70 |
+
$urls = LiteSpeed_Cache_Data::optm_hash2src( $filename ) ;
|
71 |
+
if ( ! $urls || ! is_array( $urls ) ) {
|
72 |
+
return false;
|
73 |
+
}
|
74 |
+
}
|
75 |
+
else {
|
76 |
+
$urls = $filename ;
|
77 |
}
|
|
|
78 |
|
79 |
// Parse real file path
|
80 |
$real_files = array() ;
|
90 |
return false;
|
91 |
}
|
92 |
|
93 |
+
LiteSpeed_Cache_Log::debug2( '[Optmer] urls : ', $urls ) ;
|
94 |
|
95 |
set_error_handler( 'litespeed_exception_handler' ) ;
|
96 |
|
|
|
97 |
$content = '' ;
|
98 |
+
$tmp = parse_url( $urls[ 0 ], PHP_URL_PATH ) ;
|
99 |
+
$file_type = substr( $tmp, strrpos( $tmp, '.' ) + 1 ) ;
|
100 |
try {
|
101 |
// Handle CSS
|
102 |
if ( $file_type === 'css' ) {
|
103 |
$content = $this->_serve_css( $real_files, $concat_only ) ;
|
|
|
104 |
}
|
105 |
// Handle JS
|
106 |
else {
|
107 |
$content = $this->_serve_js( $real_files, $concat_only ) ;
|
|
|
108 |
}
|
109 |
|
110 |
} catch ( ErrorException $e ) {
|
111 |
+
LiteSpeed_Cache_Log::debug( '[Optmer] Error when serving from optimizer: ' . $e->getMessage() ) ;
|
112 |
error_log( 'LiteSpeed Optimizer serving Error: ' . $e->getMessage() ) ;
|
113 |
return false ;
|
114 |
}
|
122 |
$content = $this->_remove_comment( $content, $file_type ) ;
|
123 |
}
|
124 |
|
125 |
+
LiteSpeed_Cache_Log::debug( '[Optmer] Generated content ' . $file_type ) ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
|
127 |
return $content ;
|
128 |
}
|
137 |
{
|
138 |
$con = array() ;
|
139 |
foreach ( $files as $real_path ) {
|
140 |
+
LiteSpeed_Cache_Log::debug( '[Optmer] [real_path] ' . $real_path ) ;
|
141 |
+
$data = Litespeed_File::read( $real_path ) ;
|
142 |
|
143 |
$data = preg_replace( '/@charset[^;]+;\\s*/', '', $data ) ;
|
144 |
|
165 |
{
|
166 |
$con = array() ;
|
167 |
foreach ( $files as $real_path ) {
|
168 |
+
$data = Litespeed_File::read( $real_path ) ;
|
169 |
|
170 |
if ( ! $concat_only && ! $this->_is_min( $real_path ) ) {
|
171 |
$data = JSMin\JSMin::minify( $data ) ;
|
203 |
return false ;
|
204 |
}
|
205 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
206 |
/**
|
207 |
* Remove comment when minify
|
208 |
*
|
inc/vary.class.php
CHANGED
@@ -331,7 +331,7 @@ class LiteSpeed_Cache_Vary
|
|
331 |
// Get admin bar set
|
332 |
// see @_get_admin_bar_pref()
|
333 |
$pref = get_user_option( 'show_admin_bar_front', $uid ) ;
|
334 |
-
LiteSpeed_Cache_Log::debug2( 'Vary
|
335 |
$admin_bar = $pref === false || $pref === 'true' ;
|
336 |
|
337 |
if ( $admin_bar ) {
|
@@ -509,7 +509,7 @@ class LiteSpeed_Cache_Vary
|
|
509 |
}
|
510 |
|
511 |
if ( empty($tp_cookies) ) {
|
512 |
-
LiteSpeed_Cache_Log::debug2( 'Vary
|
513 |
return ;
|
514 |
}
|
515 |
|
331 |
// Get admin bar set
|
332 |
// see @_get_admin_bar_pref()
|
333 |
$pref = get_user_option( 'show_admin_bar_front', $uid ) ;
|
334 |
+
LiteSpeed_Cache_Log::debug2( '[Vary] show_admin_bar_front: ' . $pref ) ;
|
335 |
$admin_bar = $pref === false || $pref === 'true' ;
|
336 |
|
337 |
if ( $admin_bar ) {
|
509 |
}
|
510 |
|
511 |
if ( empty($tp_cookies) ) {
|
512 |
+
LiteSpeed_Cache_Log::debug2( '[Vary] no custimzed vary ' ) ;
|
513 |
return ;
|
514 |
}
|
515 |
|
includes/litespeed-cache-config.class.php
CHANGED
@@ -379,7 +379,7 @@ class LiteSpeed_Cache_Config
|
|
379 |
return $this->options[$id] ;
|
380 |
}
|
381 |
|
382 |
-
defined( 'LSCWP_LOG' ) && LiteSpeed_Cache_Log::debug( 'Invalid option ID ' . $id ) ;
|
383 |
|
384 |
return NULL ;
|
385 |
}
|
@@ -469,7 +469,7 @@ class LiteSpeed_Cache_Config
|
|
469 |
}
|
470 |
|
471 |
if ( $group ) {
|
472 |
-
LiteSpeed_Cache_Log::debug2( '
|
473 |
}
|
474 |
|
475 |
return $group ;
|
@@ -919,7 +919,7 @@ class LiteSpeed_Cache_Config
|
|
919 |
self::ITEM_CDN_MAPPING_FILETYPE => $this->options[ 'cdn_filetype' ],
|
920 |
) ;
|
921 |
update_option( LiteSpeed_Cache_Config::ITEM_CDN_MAPPING, array( $cdn_mapping ) ) ;
|
922 |
-
LiteSpeed_Cache_Log::debug( "
|
923 |
}
|
924 |
|
925 |
$this->options = self::option_diff( $default_options, $this->options ) ;
|
@@ -927,7 +927,7 @@ class LiteSpeed_Cache_Config
|
|
927 |
$res = $this->update_options() ;
|
928 |
define( 'LSWCP_EMPTYCACHE', true ) ;// clear all sites caches
|
929 |
LiteSpeed_Cache_Purge::purge_all() ;
|
930 |
-
LiteSpeed_Cache_Log::debug( "
|
931 |
|
932 |
// Update img_optm table data for upgrading
|
933 |
LiteSpeed_Cache_Data::get_instance() ;
|
@@ -952,7 +952,7 @@ class LiteSpeed_Cache_Config
|
|
952 |
|
953 |
$res = update_site_option( self::OPTION_NAME, $options ) ;
|
954 |
|
955 |
-
LiteSpeed_Cache_Log::debug( "plugin_upgrade option changed = $res\n" ) ;
|
956 |
}
|
957 |
|
958 |
/**
|
@@ -1026,7 +1026,7 @@ class LiteSpeed_Cache_Config
|
|
1026 |
|
1027 |
$res = add_option( self::OPTION_NAME, $this->get_default_options() ) ;
|
1028 |
|
1029 |
-
defined( 'LSCWP_LOG' ) && LiteSpeed_Cache_Log::debug( "[
|
1030 |
|
1031 |
$disable_lscache = false ;
|
1032 |
|
379 |
return $this->options[$id] ;
|
380 |
}
|
381 |
|
382 |
+
defined( 'LSCWP_LOG' ) && LiteSpeed_Cache_Log::debug( '[Cfg] Invalid option ID ' . $id ) ;
|
383 |
|
384 |
return NULL ;
|
385 |
}
|
469 |
}
|
470 |
|
471 |
if ( $group ) {
|
472 |
+
LiteSpeed_Cache_Log::debug2( '[Cfg] role in vary_group [group] ' . $group ) ;
|
473 |
}
|
474 |
|
475 |
return $group ;
|
919 |
self::ITEM_CDN_MAPPING_FILETYPE => $this->options[ 'cdn_filetype' ],
|
920 |
) ;
|
921 |
update_option( LiteSpeed_Cache_Config::ITEM_CDN_MAPPING, array( $cdn_mapping ) ) ;
|
922 |
+
LiteSpeed_Cache_Log::debug( "[Cfg] plugin_upgrade option adding CDN map" ) ;
|
923 |
}
|
924 |
|
925 |
$this->options = self::option_diff( $default_options, $this->options ) ;
|
927 |
$res = $this->update_options() ;
|
928 |
define( 'LSWCP_EMPTYCACHE', true ) ;// clear all sites caches
|
929 |
LiteSpeed_Cache_Purge::purge_all() ;
|
930 |
+
LiteSpeed_Cache_Log::debug( "[Cfg] plugin_upgrade option changed = $res" ) ;
|
931 |
|
932 |
// Update img_optm table data for upgrading
|
933 |
LiteSpeed_Cache_Data::get_instance() ;
|
952 |
|
953 |
$res = update_site_option( self::OPTION_NAME, $options ) ;
|
954 |
|
955 |
+
LiteSpeed_Cache_Log::debug( "[Cfg] plugin_upgrade option changed = $res\n" ) ;
|
956 |
}
|
957 |
|
958 |
/**
|
1026 |
|
1027 |
$res = add_option( self::OPTION_NAME, $this->get_default_options() ) ;
|
1028 |
|
1029 |
+
defined( 'LSCWP_LOG' ) && LiteSpeed_Cache_Log::debug( "[Cfg] plugin_activation update option = " . var_export( $res, true ) ) ;
|
1030 |
|
1031 |
$disable_lscache = false ;
|
1032 |
|
includes/litespeed-cache-control.class.php
CHANGED
@@ -101,7 +101,7 @@ class LiteSpeed_Cache_Control
|
|
101 |
return ;
|
102 |
}
|
103 |
self::$_control |= self::BM_NO_VARY ;
|
104 |
-
LiteSpeed_Cache_Log::debug( 'X Cache_control -> no-vary', 3 ) ;
|
105 |
}
|
106 |
|
107 |
/**
|
@@ -127,7 +127,7 @@ class LiteSpeed_Cache_Control
|
|
127 |
return ;
|
128 |
}
|
129 |
self::$_control |= self::BM_STALE ;
|
130 |
-
LiteSpeed_Cache_Log::debug('X Cache_control -> stale') ;
|
131 |
}
|
132 |
|
133 |
/**
|
@@ -158,7 +158,7 @@ class LiteSpeed_Cache_Control
|
|
158 |
if ( $reason ) {
|
159 |
$reason = "( $reason )" ;
|
160 |
}
|
161 |
-
LiteSpeed_Cache_Log::debug( 'X Cache_control -> shared ' . $reason ) ;
|
162 |
}
|
163 |
|
164 |
/**
|
@@ -188,7 +188,7 @@ class LiteSpeed_Cache_Control
|
|
188 |
if ( $reason ) {
|
189 |
$reason = "( $reason )" ;
|
190 |
}
|
191 |
-
LiteSpeed_Cache_Log::debug( 'X Cache_control -> public forced ' . $reason ) ;
|
192 |
}
|
193 |
|
194 |
/**
|
@@ -218,7 +218,7 @@ class LiteSpeed_Cache_Control
|
|
218 |
if ( $reason ) {
|
219 |
$reason = "( $reason )" ;
|
220 |
}
|
221 |
-
LiteSpeed_Cache_Log::debug( 'X Cache_control -> private ' . $reason ) ;
|
222 |
}
|
223 |
|
224 |
/**
|
@@ -241,7 +241,7 @@ class LiteSpeed_Cache_Control
|
|
241 |
public static function set_cacheable()
|
242 |
{
|
243 |
self::$_control |= self::BM_CACHEABLE ;
|
244 |
-
LiteSpeed_Cache_Log::debug( 'X Cache_control init on' ) ;
|
245 |
}
|
246 |
|
247 |
/**
|
@@ -257,7 +257,7 @@ class LiteSpeed_Cache_Control
|
|
257 |
if ( $reason ) {
|
258 |
$reason = "( $reason )" ;
|
259 |
}
|
260 |
-
LiteSpeed_Cache_Log::debug( 'X Cache_control -> no Cache ' . $reason, 2 ) ;
|
261 |
}
|
262 |
|
263 |
/**
|
@@ -298,7 +298,7 @@ class LiteSpeed_Cache_Control
|
|
298 |
{
|
299 |
if ( is_numeric($ttl) ) {
|
300 |
self::$_custom_ttl = $ttl ;
|
301 |
-
LiteSpeed_Cache_Log::debug('X Cache_control TTL -> ' . $ttl) ;
|
302 |
}
|
303 |
}
|
304 |
|
@@ -328,7 +328,7 @@ class LiteSpeed_Cache_Control
|
|
328 |
if ( $ttl < 0 ) {
|
329 |
$ttl += 86400 ;// add one day
|
330 |
}
|
331 |
-
LiteSpeed_Cache_Log::debug( 'X Cache_control TTL is limited to ' . $ttl ) ;
|
332 |
return $ttl ;
|
333 |
}
|
334 |
}
|
@@ -374,12 +374,30 @@ class LiteSpeed_Cache_Control
|
|
374 |
public static function check_redirect( $location, $status )
|
375 |
{
|
376 |
if ( ! empty( $_SERVER[ 'SCRIPT_URI' ] ) ) { // dont check $status == '301' anymore
|
377 |
-
LiteSpeed_Cache_Log::debug( "301 from " . $_SERVER[ 'SCRIPT_URI' ] ) ;
|
378 |
-
LiteSpeed_Cache_Log::debug( "301 to $location" ) ;
|
379 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
380 |
self::set_nocache( '301 to same url' ) ;
|
381 |
}
|
382 |
}
|
|
|
383 |
return $location ;
|
384 |
}
|
385 |
|
@@ -433,7 +451,7 @@ class LiteSpeed_Cache_Control
|
|
433 |
// if is not cacheable, terminate check
|
434 |
// Even no need to run 3rd party hook
|
435 |
if ( ! self::is_cacheable() ) {
|
436 |
-
LiteSpeed_Cache_Log::debug( 'not cacheable before ctrl finalize' ) ;
|
437 |
return ;
|
438 |
}
|
439 |
|
@@ -458,7 +476,7 @@ class LiteSpeed_Cache_Control
|
|
458 |
|
459 |
// if is not cacheable, terminate check
|
460 |
if ( ! self::is_cacheable() ) {
|
461 |
-
LiteSpeed_Cache_Log::debug( 'not cacheable after api_control' ) ;
|
462 |
return ;
|
463 |
}
|
464 |
|
@@ -617,7 +635,7 @@ class LiteSpeed_Cache_Control
|
|
617 |
*/
|
618 |
private function _no_cache_for( $reason )
|
619 |
{
|
620 |
-
LiteSpeed_Cache_Log::debug('X Cache_control off - ' . $reason) ;
|
621 |
return false ;
|
622 |
}
|
623 |
|
101 |
return ;
|
102 |
}
|
103 |
self::$_control |= self::BM_NO_VARY ;
|
104 |
+
LiteSpeed_Cache_Log::debug( '[Ctrl] X Cache_control -> no-vary', 3 ) ;
|
105 |
}
|
106 |
|
107 |
/**
|
127 |
return ;
|
128 |
}
|
129 |
self::$_control |= self::BM_STALE ;
|
130 |
+
LiteSpeed_Cache_Log::debug('[Ctrl] X Cache_control -> stale') ;
|
131 |
}
|
132 |
|
133 |
/**
|
158 |
if ( $reason ) {
|
159 |
$reason = "( $reason )" ;
|
160 |
}
|
161 |
+
LiteSpeed_Cache_Log::debug( '[Ctrl] X Cache_control -> shared ' . $reason ) ;
|
162 |
}
|
163 |
|
164 |
/**
|
188 |
if ( $reason ) {
|
189 |
$reason = "( $reason )" ;
|
190 |
}
|
191 |
+
LiteSpeed_Cache_Log::debug( '[Ctrl] X Cache_control -> public forced ' . $reason ) ;
|
192 |
}
|
193 |
|
194 |
/**
|
218 |
if ( $reason ) {
|
219 |
$reason = "( $reason )" ;
|
220 |
}
|
221 |
+
LiteSpeed_Cache_Log::debug( '[Ctrl] X Cache_control -> private ' . $reason ) ;
|
222 |
}
|
223 |
|
224 |
/**
|
241 |
public static function set_cacheable()
|
242 |
{
|
243 |
self::$_control |= self::BM_CACHEABLE ;
|
244 |
+
LiteSpeed_Cache_Log::debug( '[Ctrl] X Cache_control init on' ) ;
|
245 |
}
|
246 |
|
247 |
/**
|
257 |
if ( $reason ) {
|
258 |
$reason = "( $reason )" ;
|
259 |
}
|
260 |
+
LiteSpeed_Cache_Log::debug( '[Ctrl] X Cache_control -> no Cache ' . $reason, 2 ) ;
|
261 |
}
|
262 |
|
263 |
/**
|
298 |
{
|
299 |
if ( is_numeric($ttl) ) {
|
300 |
self::$_custom_ttl = $ttl ;
|
301 |
+
LiteSpeed_Cache_Log::debug('[Ctrl] X Cache_control TTL -> ' . $ttl) ;
|
302 |
}
|
303 |
}
|
304 |
|
328 |
if ( $ttl < 0 ) {
|
329 |
$ttl += 86400 ;// add one day
|
330 |
}
|
331 |
+
LiteSpeed_Cache_Log::debug( '[Ctrl] X Cache_control TTL is limited to ' . $ttl ) ;
|
332 |
return $ttl ;
|
333 |
}
|
334 |
}
|
374 |
public static function check_redirect( $location, $status )
|
375 |
{
|
376 |
if ( ! empty( $_SERVER[ 'SCRIPT_URI' ] ) ) { // dont check $status == '301' anymore
|
377 |
+
LiteSpeed_Cache_Log::debug( "[Ctrl] 301 from " . $_SERVER[ 'SCRIPT_URI' ] ) ;
|
378 |
+
LiteSpeed_Cache_Log::debug( "[Ctrl] 301 to $location" ) ;
|
379 |
+
|
380 |
+
$to_check = array(
|
381 |
+
PHP_URL_SCHEME,
|
382 |
+
PHP_URL_HOST,
|
383 |
+
PHP_URL_PATH,
|
384 |
+
) ;
|
385 |
+
|
386 |
+
$is_same_redirect = true ;
|
387 |
+
|
388 |
+
foreach ( $to_check as $v ) {
|
389 |
+
if ( parse_url( $_SERVER[ 'SCRIPT_URI' ], $v ) != parse_url( $location, $v ) ) {
|
390 |
+
$is_same_redirect = false ;
|
391 |
+
LiteSpeed_Cache_Log::debug( "[Ctrl] 301 different redirection" ) ;
|
392 |
+
break ;
|
393 |
+
}
|
394 |
+
}
|
395 |
+
|
396 |
+
if ( $is_same_redirect ) {
|
397 |
self::set_nocache( '301 to same url' ) ;
|
398 |
}
|
399 |
}
|
400 |
+
|
401 |
return $location ;
|
402 |
}
|
403 |
|
451 |
// if is not cacheable, terminate check
|
452 |
// Even no need to run 3rd party hook
|
453 |
if ( ! self::is_cacheable() ) {
|
454 |
+
LiteSpeed_Cache_Log::debug( '[Ctrl] not cacheable before ctrl finalize' ) ;
|
455 |
return ;
|
456 |
}
|
457 |
|
476 |
|
477 |
// if is not cacheable, terminate check
|
478 |
if ( ! self::is_cacheable() ) {
|
479 |
+
LiteSpeed_Cache_Log::debug( '[Ctrl] not cacheable after api_control' ) ;
|
480 |
return ;
|
481 |
}
|
482 |
|
635 |
*/
|
636 |
private function _no_cache_for( $reason )
|
637 |
{
|
638 |
+
LiteSpeed_Cache_Log::debug('[Ctrl] X Cache_control off - ' . $reason) ;
|
639 |
return false ;
|
640 |
}
|
641 |
|
includes/litespeed-cache-gui.class.php
CHANGED
@@ -372,11 +372,19 @@ class LiteSpeed_Cache_GUI
|
|
372 |
$wp_admin_bar->add_menu( array(
|
373 |
'parent' => 'litespeed-menu',
|
374 |
'id' => 'litespeed-purge-all',
|
375 |
-
'title' => __( '
|
376 |
'href' => LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_PURGE_ALL ),
|
377 |
'meta' => array( 'tabindex' => '0' ),
|
378 |
) );
|
379 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
380 |
if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE ) ) {
|
381 |
$wp_admin_bar->add_menu( array(
|
382 |
'parent' => 'litespeed-menu',
|
372 |
$wp_admin_bar->add_menu( array(
|
373 |
'parent' => 'litespeed-menu',
|
374 |
'id' => 'litespeed-purge-all',
|
375 |
+
'title' => __( 'LSCache Purge All', 'litespeed-cache' ),
|
376 |
'href' => LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_PURGE_ALL ),
|
377 |
'meta' => array( 'tabindex' => '0' ),
|
378 |
) );
|
379 |
|
380 |
+
$wp_admin_bar->add_menu( array(
|
381 |
+
'parent' => 'litespeed-menu',
|
382 |
+
'id' => 'litespeed-purge-cssjs',
|
383 |
+
'title' => __( 'Purge CSS/JS Cache', 'litespeed-cache' ),
|
384 |
+
'href' => LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_PURGE_CSSJS ),
|
385 |
+
'meta' => array( 'tabindex' => '0' ),
|
386 |
+
) );
|
387 |
+
|
388 |
if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE ) ) {
|
389 |
$wp_admin_bar->add_menu( array(
|
390 |
'parent' => 'litespeed-menu',
|
includes/litespeed-cache-optimize.class.php
CHANGED
@@ -34,6 +34,7 @@ class LiteSpeed_Cache_Optimize
|
|
34 |
private $cfg_exc_jquery ;
|
35 |
private $cfg_ggfonts_async ;
|
36 |
private $cfg_optm_max_size ;
|
|
|
37 |
|
38 |
private $dns_prefetch ;
|
39 |
|
@@ -69,6 +70,7 @@ class LiteSpeed_Cache_Optimize
|
|
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 |
|
@@ -181,7 +183,19 @@ class LiteSpeed_Cache_Optimize
|
|
181 |
{
|
182 |
// This request is for js/css_async.js
|
183 |
if ( ( $this->cfg_css_async || $this->cfg_ggfonts_async ) && strpos( $_SERVER[ 'REQUEST_URI' ], self::CSS_ASYNC_LIB ) !== false ) {
|
184 |
-
LiteSpeed_Cache_Log::debug( '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
185 |
|
186 |
LiteSpeed_Cache_Control::set_cacheable() ;
|
187 |
LiteSpeed_Cache_Control::set_public_forced( 'OPTM: css async js' ) ;
|
@@ -189,12 +203,10 @@ class LiteSpeed_Cache_Optimize
|
|
189 |
LiteSpeed_Cache_Control::set_custom_ttl( 8640000 ) ;
|
190 |
LiteSpeed_Cache_Tag::add( LiteSpeed_Cache_Tag::TYPE_MIN . '_CSS_ASYNC' ) ;
|
191 |
|
192 |
-
|
193 |
-
|
194 |
-
header( 'Content-Length: ' . filesize( $file ) ) ;
|
195 |
header( 'Content-Type: application/x-javascript; charset=utf-8' ) ;
|
196 |
|
197 |
-
echo
|
198 |
exit ;
|
199 |
}
|
200 |
|
@@ -212,70 +224,69 @@ class LiteSpeed_Cache_Optimize
|
|
212 |
return ;
|
213 |
}
|
214 |
|
215 |
-
LiteSpeed_Cache_Log::debug( '
|
216 |
|
217 |
// Proceed css/js file generation
|
218 |
define( 'LITESPEED_MIN_FILE', true ) ;
|
219 |
|
220 |
-
$file_type =
|
221 |
-
|
222 |
-
$ttl = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTIMIZE_TTL ) ;
|
223 |
|
224 |
-
|
225 |
-
if ( ! defined( 'LITESPEED_ON' ) ) {
|
226 |
-
LiteSpeed_Cache_Log::debug( '[Optimize] Not enabled lscache, using file based cache' ) ;
|
227 |
|
228 |
-
|
229 |
-
|
230 |
-
|
|
|
|
|
|
|
|
|
231 |
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
|
236 |
-
|
237 |
-
$headers[ 'Content-Type' ] = 'text/css; charset=utf-8' ;
|
238 |
-
}
|
239 |
-
else {
|
240 |
-
$headers[ 'Content-Type' ] = 'application/x-javascript' ;
|
241 |
-
}
|
242 |
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
}
|
247 |
|
248 |
-
echo $content ;
|
249 |
-
exit ;
|
250 |
-
}
|
251 |
}
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
if ( ! $content ) {
|
258 |
-
LiteSpeed_Cache_Control::set_nocache( 'Empty content from optimizer' ) ;
|
259 |
-
exit ;
|
260 |
}
|
261 |
|
262 |
-
//
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
Litespeed_File::save( $static_file, $content, true ) ;
|
267 |
-
}
|
268 |
|
269 |
LiteSpeed_Cache_Control::set_cacheable() ;
|
270 |
LiteSpeed_Cache_Control::set_public_forced( 'OPTM: min file ' . $match[ 1 ] ) ;
|
271 |
LiteSpeed_Cache_Control::set_no_vary() ;
|
272 |
-
LiteSpeed_Cache_Control::set_custom_ttl( $
|
273 |
LiteSpeed_Cache_Tag::add( LiteSpeed_Cache_Tag::TYPE_MIN ) ;
|
274 |
|
275 |
echo $content ;
|
276 |
exit ;
|
277 |
}
|
278 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
279 |
/**
|
280 |
* Delete file-based cache folder
|
281 |
*
|
@@ -349,7 +360,7 @@ class LiteSpeed_Cache_Optimize
|
|
349 |
}
|
350 |
|
351 |
if ( ! defined( 'LITESPEED_IS_HTML' ) ) {
|
352 |
-
LiteSpeed_Cache_Log::debug( '
|
353 |
return $content ;
|
354 |
}
|
355 |
|
@@ -358,19 +369,19 @@ class LiteSpeed_Cache_Optimize
|
|
358 |
if ( ! empty( $excludes ) ) {
|
359 |
$result = LiteSpeed_Cache_Utility::str_hit_array( esc_url( $_SERVER[ 'REQUEST_URI' ] ), explode( "\n", $excludes ) ) ;
|
360 |
if ( $result ) {
|
361 |
-
LiteSpeed_Cache_Log::debug( '
|
362 |
return $content ;
|
363 |
}
|
364 |
}
|
365 |
|
366 |
// Check if is exclude optm roles ( Need to set Vary too )
|
367 |
if ( $result = LiteSpeed_Cache_Config::get_instance()->in_exclude_optimization_roles() ) {
|
368 |
-
LiteSpeed_Cache_Log::debug( '
|
369 |
return $content ;
|
370 |
}
|
371 |
|
372 |
|
373 |
-
LiteSpeed_Cache_Log::debug( '
|
374 |
|
375 |
$instance = self::get_instance() ;
|
376 |
$instance->content = $content ;
|
@@ -388,7 +399,7 @@ class LiteSpeed_Cache_Optimize
|
|
388 |
private function _optimize()
|
389 |
{
|
390 |
if ( ! $this->_can_optm() ) {
|
391 |
-
LiteSpeed_Cache_Log::debug( '
|
392 |
return ;
|
393 |
}
|
394 |
|
@@ -492,7 +503,7 @@ class LiteSpeed_Cache_Optimize
|
|
492 |
continue ;
|
493 |
}
|
494 |
|
495 |
-
LiteSpeed_Cache_Log::debug( 'Optm
|
496 |
}
|
497 |
// async html
|
498 |
$html_list_async = $this->_async_css_list( $html_list ) ;
|
@@ -662,7 +673,7 @@ class LiteSpeed_Cache_Optimize
|
|
662 |
$this->content .= "\n" . '<!-- Page optimized by LiteSpeed Cache on '.date('Y-m-d H:i:s').' -->' ;
|
663 |
|
664 |
} catch ( ErrorException $e ) {
|
665 |
-
LiteSpeed_Cache_Log::debug( 'Error when optimizing HTML: ' . $e->getMessage() ) ;
|
666 |
error_log( 'LiteSpeed Optimizer optimizing HTML Error: ' . $e->getMessage() ) ;
|
667 |
// If failed to minify HTML, restore original content
|
668 |
$this->content = $ori ;
|
@@ -759,7 +770,7 @@ class LiteSpeed_Cache_Optimize
|
|
759 |
}
|
760 |
}
|
761 |
if ( count( $src_arr ) > 1 ) {
|
762 |
-
LiteSpeed_Cache_Log::debug( '
|
763 |
}
|
764 |
|
765 |
// group build
|
@@ -831,7 +842,7 @@ class LiteSpeed_Cache_Optimize
|
|
831 |
|
832 |
// Analyse links
|
833 |
foreach ( $src_list as $key => $src ) {
|
834 |
-
LiteSpeed_Cache_Log::debug2( 'Optm
|
835 |
|
836 |
/**
|
837 |
* Excluded links won't be done any optm
|
@@ -839,14 +850,14 @@ class LiteSpeed_Cache_Optimize
|
|
839 |
*/
|
840 |
// if ( $excludes && $exclude = LiteSpeed_Cache_Utility::str_hit_array( $src, $excludes ) ) {
|
841 |
// $ignored_html[] = $html_list[ $key ] ;
|
842 |
-
// LiteSpeed_Cache_Log::debug2( 'Optm: Abort excludes: ' . $exclude ) ;
|
843 |
// continue ;
|
844 |
// }
|
845 |
|
846 |
// Check if has no-optimize attr
|
847 |
if ( strpos( $html_list[ $key ], 'data-no-optimize' ) !== false ) {
|
848 |
$ignored_html[] = $html_list[ $key ] ;
|
849 |
-
LiteSpeed_Cache_Log::debug2( 'Optm
|
850 |
continue ;
|
851 |
}
|
852 |
|
@@ -854,7 +865,7 @@ class LiteSpeed_Cache_Optimize
|
|
854 |
$url_parsed = parse_url( $src ) ;
|
855 |
if ( ! $file_info = LiteSpeed_Cache_Utility::is_internal_file( $src ) ) {
|
856 |
$ignored_html[ $src ] = $html_list[ $key ] ;
|
857 |
-
LiteSpeed_Cache_Log::debug2( 'Optm
|
858 |
continue ;
|
859 |
}
|
860 |
|
@@ -865,7 +876,7 @@ class LiteSpeed_Cache_Optimize
|
|
865 |
*/
|
866 |
if ( $this->cfg_exc_jquery && $this->_is_jquery( $src ) ) {
|
867 |
$ignored_html[ $src ] = $html_list[ $key ] ;
|
868 |
-
LiteSpeed_Cache_Log::debug2( 'Optm
|
869 |
|
870 |
// Add to HTTP2 as its ignored but still internal src
|
871 |
$this->append_http2( $src, 'js' ) ;
|
@@ -896,6 +907,7 @@ class LiteSpeed_Cache_Optimize
|
|
896 |
if ( ! is_array( $src ) ) {
|
897 |
$src = array( $src ) ;
|
898 |
}
|
|
|
899 |
$src = array_values( $src ) ;
|
900 |
|
901 |
$hash = md5( serialize( $src ) ) ;
|
@@ -918,6 +930,21 @@ class LiteSpeed_Cache_Optimize
|
|
918 |
LiteSpeed_Cache_Data::optm_save_src( $short . '.' . $file_type, $src ) ;
|
919 |
}
|
920 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
921 |
$file_to_save = self::DIR_MIN . '/' . $filename . '.' . $file_type ;
|
922 |
|
923 |
return LiteSpeed_Cache_Utility::get_permalink_url( $file_to_save ) ;
|
@@ -967,7 +994,7 @@ class LiteSpeed_Cache_Optimize
|
|
967 |
}
|
968 |
// todo @v2.0: allow defer even exclude from optm
|
969 |
if ( $excludes && $exclude = LiteSpeed_Cache_Utility::str_hit_array( $attrs[ 'src' ], $excludes ) ) {
|
970 |
-
LiteSpeed_Cache_Log::debug2( 'Optm
|
971 |
continue ;
|
972 |
}
|
973 |
|
@@ -1027,13 +1054,13 @@ class LiteSpeed_Cache_Optimize
|
|
1027 |
}
|
1028 |
|
1029 |
if ( $excludes && $exclude = LiteSpeed_Cache_Utility::str_hit_array( $attrs[ 'href' ], $excludes ) ) {
|
1030 |
-
LiteSpeed_Cache_Log::debug2( 'Optm
|
1031 |
continue ;
|
1032 |
}
|
1033 |
|
1034 |
// Check if need to remove this css
|
1035 |
if ( $this->css_to_be_removed && LiteSpeed_Cache_Utility::str_hit_array( $attrs[ 'href' ], $this->css_to_be_removed ) ) {
|
1036 |
-
LiteSpeed_Cache_Log::debug( 'Optm
|
1037 |
// Delete this css snippet from orig html
|
1038 |
$this->content = str_replace( $match[ 0 ], '', $this->content ) ;
|
1039 |
continue ;
|
@@ -1063,12 +1090,12 @@ class LiteSpeed_Cache_Optimize
|
|
1063 |
{
|
1064 |
foreach ( $html_list as $k => $ori ) {
|
1065 |
if ( strpos( $ori, 'data-asynced' ) !== false ) {
|
1066 |
-
LiteSpeed_Cache_Log::debug2( 'Optm bypass: attr data-asynced exist' ) ;
|
1067 |
continue ;
|
1068 |
}
|
1069 |
|
1070 |
if ( strpos( $ori, 'data-no-async' ) !== false ) {
|
1071 |
-
LiteSpeed_Cache_Log::debug2( 'Optm bypass: attr api data-no-async' ) ;
|
1072 |
continue ;
|
1073 |
}
|
1074 |
|
@@ -1098,11 +1125,11 @@ class LiteSpeed_Cache_Optimize
|
|
1098 |
continue ;
|
1099 |
}
|
1100 |
if ( strpos( $v, 'data-deferred' ) !== false ) {
|
1101 |
-
LiteSpeed_Cache_Log::debug2( 'Optm bypass: attr data-deferred exist' ) ;
|
1102 |
continue ;
|
1103 |
}
|
1104 |
if ( strpos( $v, 'data-no-defer' ) !== false ) {
|
1105 |
-
LiteSpeed_Cache_Log::debug2( 'Optm bypass: attr api data-no-defer' ) ;
|
1106 |
continue ;
|
1107 |
}
|
1108 |
|
@@ -1114,14 +1141,14 @@ class LiteSpeed_Cache_Optimize
|
|
1114 |
// parse js src
|
1115 |
preg_match( '#<script \s*([^>]+)>#isU', $v, $matches ) ;
|
1116 |
if ( empty( $matches[ 1 ] ) ) {
|
1117 |
-
LiteSpeed_Cache_Log::debug( 'Optm
|
1118 |
continue ;
|
1119 |
}
|
1120 |
|
1121 |
$attrs = LiteSpeed_Cache_Utility::parse_attr( $matches[ 1 ] ) ;
|
1122 |
|
1123 |
if ( empty( $attrs[ 'src' ] ) ) {
|
1124 |
-
LiteSpeed_Cache_Log::debug( 'Optm
|
1125 |
continue ;
|
1126 |
}
|
1127 |
|
@@ -1133,7 +1160,7 @@ class LiteSpeed_Cache_Optimize
|
|
1133 |
* @since 1.5
|
1134 |
*/
|
1135 |
if ( $this->cfg_js_defer_exc && LiteSpeed_Cache_Utility::str_hit_array( $src, $this->cfg_js_defer_exc ) ) {
|
1136 |
-
LiteSpeed_Cache_Log::debug( 'Optm
|
1137 |
continue ;
|
1138 |
}
|
1139 |
|
@@ -1142,7 +1169,7 @@ class LiteSpeed_Cache_Optimize
|
|
1142 |
* @since 1.5
|
1143 |
*/
|
1144 |
if ( $this->cfg_exc_jquery && $this->_is_jquery( $src ) ) {
|
1145 |
-
LiteSpeed_Cache_Log::debug2( 'Optm
|
1146 |
continue ;
|
1147 |
}
|
1148 |
|
34 |
private $cfg_exc_jquery ;
|
35 |
private $cfg_ggfonts_async ;
|
36 |
private $cfg_optm_max_size ;
|
37 |
+
private $cfg_ttl ;
|
38 |
|
39 |
private $dns_prefetch ;
|
40 |
|
70 |
$this->cfg_exc_jquery = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTM_EXC_JQUERY ) ;
|
71 |
$this->cfg_ggfonts_async = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTM_GGFONTS_ASYNC ) ;
|
72 |
$this->cfg_optm_max_size = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTM_MAX_SIZE ) * 1000000 ;
|
73 |
+
$this->cfg_ttl = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTIMIZE_TTL ) ;
|
74 |
|
75 |
$this->_static_request_check() ;
|
76 |
|
183 |
{
|
184 |
// This request is for js/css_async.js
|
185 |
if ( ( $this->cfg_css_async || $this->cfg_ggfonts_async ) && strpos( $_SERVER[ 'REQUEST_URI' ], self::CSS_ASYNC_LIB ) !== false ) {
|
186 |
+
LiteSpeed_Cache_Log::debug( '[Optm] start serving static file' ) ;
|
187 |
+
|
188 |
+
$file = LSCWP_DIR . 'js/css_async.min.js' ;
|
189 |
+
|
190 |
+
$content = Litespeed_File::read( $file ) ;
|
191 |
+
|
192 |
+
$static_file = LSCWP_CONTENT_DIR . '/cache/js/css_async.js' ;
|
193 |
+
|
194 |
+
// Save to cache folder to enable directly usage by .htacess
|
195 |
+
if ( ! file_exists( $static_file ) ) {
|
196 |
+
Litespeed_File::save( $static_file, $content, true ) ;
|
197 |
+
LiteSpeed_Cache_Log::debug( '[Optm] save css_async lib to ' . $static_file ) ;
|
198 |
+
}
|
199 |
|
200 |
LiteSpeed_Cache_Control::set_cacheable() ;
|
201 |
LiteSpeed_Cache_Control::set_public_forced( 'OPTM: css async js' ) ;
|
203 |
LiteSpeed_Cache_Control::set_custom_ttl( 8640000 ) ;
|
204 |
LiteSpeed_Cache_Tag::add( LiteSpeed_Cache_Tag::TYPE_MIN . '_CSS_ASYNC' ) ;
|
205 |
|
206 |
+
header( 'Content-Length: ' . strlen( $content ) ) ;
|
|
|
|
|
207 |
header( 'Content-Type: application/x-javascript; charset=utf-8' ) ;
|
208 |
|
209 |
+
echo $content ;
|
210 |
exit ;
|
211 |
}
|
212 |
|
224 |
return ;
|
225 |
}
|
226 |
|
227 |
+
LiteSpeed_Cache_Log::debug( '[Optm] start minifying file' ) ;
|
228 |
|
229 |
// Proceed css/js file generation
|
230 |
define( 'LITESPEED_MIN_FILE', true ) ;
|
231 |
|
232 |
+
$file_type = $match[ 2 ] ;
|
|
|
|
|
233 |
|
234 |
+
$static_file = LSCWP_CONTENT_DIR . '/cache/' . $file_type . '/' . $match[ 1 ] ;
|
|
|
|
|
235 |
|
236 |
+
$headers = array() ;
|
237 |
+
if ( $file_type === 'css' ) {
|
238 |
+
$headers[ 'Content-Type' ] = 'text/css; charset=utf-8' ;
|
239 |
+
}
|
240 |
+
else {
|
241 |
+
$headers[ 'Content-Type' ] = 'application/x-javascript' ;
|
242 |
+
}
|
243 |
|
244 |
+
// Even if hit PHP, still check if the file is valid to bypass minify process
|
245 |
+
if ( ! file_exists( $static_file ) || time() - filemtime( $static_file ) > $this->cfg_ttl ) {
|
246 |
+
$concat_only = ! ( $file_type === 'css' ? $this->cfg_css_minify : $this->cfg_js_minify ) ;
|
247 |
|
248 |
+
$content = LiteSpeed_Cache_Optimizer::get_instance()->serve( $match[ 1 ], $concat_only ) ;
|
|
|
|
|
|
|
|
|
|
|
249 |
|
250 |
+
// Generate static file
|
251 |
+
Litespeed_File::save( $static_file, $content, true ) ;
|
252 |
+
LiteSpeed_Cache_Log::debug( '[Optm] Saved cache to file [path] ' . $static_file ) ;
|
|
|
253 |
|
|
|
|
|
|
|
254 |
}
|
255 |
+
else {
|
256 |
+
// Load file from file based cache if not expired
|
257 |
+
LiteSpeed_Cache_Log::debug( '[Optm] Static file available' ) ;
|
258 |
+
$content = Litespeed_File::read( $static_file ) ;
|
|
|
|
|
|
|
|
|
259 |
}
|
260 |
|
261 |
+
// Output header first
|
262 |
+
$headers[ 'Content-Length' ] = strlen( $content ) ;
|
263 |
+
$this->_output_header( $headers ) ;
|
|
|
|
|
|
|
264 |
|
265 |
LiteSpeed_Cache_Control::set_cacheable() ;
|
266 |
LiteSpeed_Cache_Control::set_public_forced( 'OPTM: min file ' . $match[ 1 ] ) ;
|
267 |
LiteSpeed_Cache_Control::set_no_vary() ;
|
268 |
+
LiteSpeed_Cache_Control::set_custom_ttl( $this->cfg_ttl ) ;
|
269 |
LiteSpeed_Cache_Tag::add( LiteSpeed_Cache_Tag::TYPE_MIN ) ;
|
270 |
|
271 |
echo $content ;
|
272 |
exit ;
|
273 |
}
|
274 |
|
275 |
+
/**
|
276 |
+
* Output header info
|
277 |
+
*
|
278 |
+
* @since 2.1.2
|
279 |
+
* @access public
|
280 |
+
*/
|
281 |
+
private function _output_header( $headers )
|
282 |
+
{
|
283 |
+
foreach ( $headers as $k => $v ) {
|
284 |
+
header( $k . ': ' . $v ) ;
|
285 |
+
LiteSpeed_Cache_Log::debug( '[Optm] HEADER ' . $k . ': ' . $v ) ;
|
286 |
+
}
|
287 |
+
|
288 |
+
}
|
289 |
+
|
290 |
/**
|
291 |
* Delete file-based cache folder
|
292 |
*
|
360 |
}
|
361 |
|
362 |
if ( ! defined( 'LITESPEED_IS_HTML' ) ) {
|
363 |
+
LiteSpeed_Cache_Log::debug( '[Optm] bypass: Not frontend HTML type' ) ;
|
364 |
return $content ;
|
365 |
}
|
366 |
|
369 |
if ( ! empty( $excludes ) ) {
|
370 |
$result = LiteSpeed_Cache_Utility::str_hit_array( esc_url( $_SERVER[ 'REQUEST_URI' ] ), explode( "\n", $excludes ) ) ;
|
371 |
if ( $result ) {
|
372 |
+
LiteSpeed_Cache_Log::debug( '[Optm] bypass: hit URI Excludes setting: ' . $result ) ;
|
373 |
return $content ;
|
374 |
}
|
375 |
}
|
376 |
|
377 |
// Check if is exclude optm roles ( Need to set Vary too )
|
378 |
if ( $result = LiteSpeed_Cache_Config::get_instance()->in_exclude_optimization_roles() ) {
|
379 |
+
LiteSpeed_Cache_Log::debug( '[Optm] bypass: hit Role Excludes setting: ' . $result ) ;
|
380 |
return $content ;
|
381 |
}
|
382 |
|
383 |
|
384 |
+
LiteSpeed_Cache_Log::debug( '[Optm] start' ) ;
|
385 |
|
386 |
$instance = self::get_instance() ;
|
387 |
$instance->content = $content ;
|
399 |
private function _optimize()
|
400 |
{
|
401 |
if ( ! $this->_can_optm() ) {
|
402 |
+
LiteSpeed_Cache_Log::debug( '[Optm] bypass: admin/feed/preview' ) ;
|
403 |
return ;
|
404 |
}
|
405 |
|
503 |
continue ;
|
504 |
}
|
505 |
|
506 |
+
LiteSpeed_Cache_Log::debug( '[Optm] google fonts async loading: ' . $src_list[ $k ] ) ;
|
507 |
}
|
508 |
// async html
|
509 |
$html_list_async = $this->_async_css_list( $html_list ) ;
|
673 |
$this->content .= "\n" . '<!-- Page optimized by LiteSpeed Cache on '.date('Y-m-d H:i:s').' -->' ;
|
674 |
|
675 |
} catch ( ErrorException $e ) {
|
676 |
+
LiteSpeed_Cache_Log::debug( '[Optm] Error when optimizing HTML: ' . $e->getMessage() ) ;
|
677 |
error_log( 'LiteSpeed Optimizer optimizing HTML Error: ' . $e->getMessage() ) ;
|
678 |
// If failed to minify HTML, restore original content
|
679 |
$this->content = $ori ;
|
770 |
}
|
771 |
}
|
772 |
if ( count( $src_arr ) > 1 ) {
|
773 |
+
LiteSpeed_Cache_Log::debug( '[Optm] separate ' . $file_type . ' to ' . count( $src_arr ) ) ;
|
774 |
}
|
775 |
|
776 |
// group build
|
842 |
|
843 |
// Analyse links
|
844 |
foreach ( $src_list as $key => $src ) {
|
845 |
+
LiteSpeed_Cache_Log::debug2( '[Optm] ' . $src ) ;
|
846 |
|
847 |
/**
|
848 |
* Excluded links won't be done any optm
|
850 |
*/
|
851 |
// if ( $excludes && $exclude = LiteSpeed_Cache_Utility::str_hit_array( $src, $excludes ) ) {
|
852 |
// $ignored_html[] = $html_list[ $key ] ;
|
853 |
+
// LiteSpeed_Cache_Log::debug2( '[Optm]: Abort excludes: ' . $exclude ) ;
|
854 |
// continue ;
|
855 |
// }
|
856 |
|
857 |
// Check if has no-optimize attr
|
858 |
if ( strpos( $html_list[ $key ], 'data-no-optimize' ) !== false ) {
|
859 |
$ignored_html[] = $html_list[ $key ] ;
|
860 |
+
LiteSpeed_Cache_Log::debug2( '[Optm] Abort excludes: attr data-no-optimize' ) ;
|
861 |
continue ;
|
862 |
}
|
863 |
|
865 |
$url_parsed = parse_url( $src ) ;
|
866 |
if ( ! $file_info = LiteSpeed_Cache_Utility::is_internal_file( $src ) ) {
|
867 |
$ignored_html[ $src ] = $html_list[ $key ] ;
|
868 |
+
LiteSpeed_Cache_Log::debug2( '[Optm] Abort external/non-exist' ) ;
|
869 |
continue ;
|
870 |
}
|
871 |
|
876 |
*/
|
877 |
if ( $this->cfg_exc_jquery && $this->_is_jquery( $src ) ) {
|
878 |
$ignored_html[ $src ] = $html_list[ $key ] ;
|
879 |
+
LiteSpeed_Cache_Log::debug2( '[Optm] Abort jQuery by setting' ) ;
|
880 |
|
881 |
// Add to HTTP2 as its ignored but still internal src
|
882 |
$this->append_http2( $src, 'js' ) ;
|
907 |
if ( ! is_array( $src ) ) {
|
908 |
$src = array( $src ) ;
|
909 |
}
|
910 |
+
|
911 |
$src = array_values( $src ) ;
|
912 |
|
913 |
$hash = md5( serialize( $src ) ) ;
|
930 |
LiteSpeed_Cache_Data::optm_save_src( $short . '.' . $file_type, $src ) ;
|
931 |
}
|
932 |
|
933 |
+
// Generate static files
|
934 |
+
$static_file = LSCWP_CONTENT_DIR . "/cache/$file_type/$filename.$file_type" ;
|
935 |
+
// Check if the file is valid to bypass minify process
|
936 |
+
if ( ! file_exists( $static_file ) || time() - filemtime( $static_file ) > $this->cfg_ttl ) {
|
937 |
+
$concat_only = ! ( $file_type === 'css' ? $this->cfg_css_minify : $this->cfg_js_minify ) ;
|
938 |
+
|
939 |
+
$content = LiteSpeed_Cache_Optimizer::get_instance()->serve( $src, $concat_only ) ;
|
940 |
+
|
941 |
+
// Generate static file
|
942 |
+
Litespeed_File::save( $static_file, $content, true ) ;
|
943 |
+
|
944 |
+
LiteSpeed_Cache_Log::debug( '[Optm] Saved static file [path] ' . $static_file ) ;
|
945 |
+
|
946 |
+
}
|
947 |
+
|
948 |
$file_to_save = self::DIR_MIN . '/' . $filename . '.' . $file_type ;
|
949 |
|
950 |
return LiteSpeed_Cache_Utility::get_permalink_url( $file_to_save ) ;
|
994 |
}
|
995 |
// todo @v2.0: allow defer even exclude from optm
|
996 |
if ( $excludes && $exclude = LiteSpeed_Cache_Utility::str_hit_array( $attrs[ 'src' ], $excludes ) ) {
|
997 |
+
LiteSpeed_Cache_Log::debug2( '[Optm] _parse_js bypassed exclude ' . $exclude ) ;
|
998 |
continue ;
|
999 |
}
|
1000 |
|
1054 |
}
|
1055 |
|
1056 |
if ( $excludes && $exclude = LiteSpeed_Cache_Utility::str_hit_array( $attrs[ 'href' ], $excludes ) ) {
|
1057 |
+
LiteSpeed_Cache_Log::debug2( '[Optm] _handle_css bypassed exclude ' . $exclude ) ;
|
1058 |
continue ;
|
1059 |
}
|
1060 |
|
1061 |
// Check if need to remove this css
|
1062 |
if ( $this->css_to_be_removed && LiteSpeed_Cache_Utility::str_hit_array( $attrs[ 'href' ], $this->css_to_be_removed ) ) {
|
1063 |
+
LiteSpeed_Cache_Log::debug( '[Optm] rm css snippet ' . $attrs[ 'href' ] ) ;
|
1064 |
// Delete this css snippet from orig html
|
1065 |
$this->content = str_replace( $match[ 0 ], '', $this->content ) ;
|
1066 |
continue ;
|
1090 |
{
|
1091 |
foreach ( $html_list as $k => $ori ) {
|
1092 |
if ( strpos( $ori, 'data-asynced' ) !== false ) {
|
1093 |
+
LiteSpeed_Cache_Log::debug2( '[Optm] bypass: attr data-asynced exist' ) ;
|
1094 |
continue ;
|
1095 |
}
|
1096 |
|
1097 |
if ( strpos( $ori, 'data-no-async' ) !== false ) {
|
1098 |
+
LiteSpeed_Cache_Log::debug2( '[Optm] bypass: attr api data-no-async' ) ;
|
1099 |
continue ;
|
1100 |
}
|
1101 |
|
1125 |
continue ;
|
1126 |
}
|
1127 |
if ( strpos( $v, 'data-deferred' ) !== false ) {
|
1128 |
+
LiteSpeed_Cache_Log::debug2( '[Optm] bypass: attr data-deferred exist' ) ;
|
1129 |
continue ;
|
1130 |
}
|
1131 |
if ( strpos( $v, 'data-no-defer' ) !== false ) {
|
1132 |
+
LiteSpeed_Cache_Log::debug2( '[Optm] bypass: attr api data-no-defer' ) ;
|
1133 |
continue ;
|
1134 |
}
|
1135 |
|
1141 |
// parse js src
|
1142 |
preg_match( '#<script \s*([^>]+)>#isU', $v, $matches ) ;
|
1143 |
if ( empty( $matches[ 1 ] ) ) {
|
1144 |
+
LiteSpeed_Cache_Log::debug( '[Optm] js defer parse html failed: ' . $v ) ;
|
1145 |
continue ;
|
1146 |
}
|
1147 |
|
1148 |
$attrs = LiteSpeed_Cache_Utility::parse_attr( $matches[ 1 ] ) ;
|
1149 |
|
1150 |
if ( empty( $attrs[ 'src' ] ) ) {
|
1151 |
+
LiteSpeed_Cache_Log::debug( '[Optm] js defer parse src failed: ' . $matches[ 1 ] ) ;
|
1152 |
continue ;
|
1153 |
}
|
1154 |
|
1160 |
* @since 1.5
|
1161 |
*/
|
1162 |
if ( $this->cfg_js_defer_exc && LiteSpeed_Cache_Utility::str_hit_array( $src, $this->cfg_js_defer_exc ) ) {
|
1163 |
+
LiteSpeed_Cache_Log::debug( '[Optm] js defer exclude ' . $src ) ;
|
1164 |
continue ;
|
1165 |
}
|
1166 |
|
1169 |
* @since 1.5
|
1170 |
*/
|
1171 |
if ( $this->cfg_exc_jquery && $this->_is_jquery( $src ) ) {
|
1172 |
+
LiteSpeed_Cache_Log::debug2( '[Optm] js defer Abort jQuery by setting' ) ;
|
1173 |
continue ;
|
1174 |
}
|
1175 |
|
includes/litespeed-cache-vary.class.php
CHANGED
@@ -331,7 +331,7 @@ class LiteSpeed_Cache_Vary
|
|
331 |
// Get admin bar set
|
332 |
// see @_get_admin_bar_pref()
|
333 |
$pref = get_user_option( 'show_admin_bar_front', $uid ) ;
|
334 |
-
LiteSpeed_Cache_Log::debug2( 'Vary
|
335 |
$admin_bar = $pref === false || $pref === 'true' ;
|
336 |
|
337 |
if ( $admin_bar ) {
|
@@ -509,7 +509,7 @@ class LiteSpeed_Cache_Vary
|
|
509 |
}
|
510 |
|
511 |
if ( empty($tp_cookies) ) {
|
512 |
-
LiteSpeed_Cache_Log::debug2( 'Vary
|
513 |
return ;
|
514 |
}
|
515 |
|
331 |
// Get admin bar set
|
332 |
// see @_get_admin_bar_pref()
|
333 |
$pref = get_user_option( 'show_admin_bar_front', $uid ) ;
|
334 |
+
LiteSpeed_Cache_Log::debug2( '[Vary] show_admin_bar_front: ' . $pref ) ;
|
335 |
$admin_bar = $pref === false || $pref === 'true' ;
|
336 |
|
337 |
if ( $admin_bar ) {
|
509 |
}
|
510 |
|
511 |
if ( empty($tp_cookies) ) {
|
512 |
+
LiteSpeed_Cache_Log::debug2( '[Vary] no custimzed vary ' ) ;
|
513 |
return ;
|
514 |
}
|
515 |
|
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 |
|
@@ -120,7 +120,7 @@ class LiteSpeed_Cache
|
|
120 |
// Check if there is a purge request in queue
|
121 |
if ( $purge_queue = get_option( LiteSpeed_Cache_Purge::PURGE_QUEUE ) ) {
|
122 |
@header( $purge_queue ) ;
|
123 |
-
LiteSpeed_Cache_Log::debug( 'Purge Queue found&sent: ' . $purge_queue ) ;
|
124 |
delete_option( LiteSpeed_Cache_Purge::PURGE_QUEUE ) ;
|
125 |
}
|
126 |
|
@@ -440,7 +440,7 @@ class LiteSpeed_Cache
|
|
440 |
*/
|
441 |
public static function footer_hook()
|
442 |
{
|
443 |
-
LiteSpeed_Cache_Log::debug( 'Footer hook called' ) ;
|
444 |
if ( ! defined( 'LITESPEED_FOOTER_CALLED' ) ) {
|
445 |
define( 'LITESPEED_FOOTER_CALLED', true ) ;
|
446 |
}
|
@@ -455,22 +455,22 @@ class LiteSpeed_Cache
|
|
455 |
private function _check_is_html( $buffer = null )
|
456 |
{
|
457 |
if ( ! defined( 'LITESPEED_FOOTER_CALLED' ) ) {
|
458 |
-
LiteSpeed_Cache_Log::debug2( 'CHK html bypass: miss footer const' ) ;
|
459 |
return ;
|
460 |
}
|
461 |
|
462 |
if ( defined( 'DOING_AJAX' ) ) {
|
463 |
-
LiteSpeed_Cache_Log::debug2( 'CHK html bypass: doing ajax' ) ;
|
464 |
return ;
|
465 |
}
|
466 |
|
467 |
if ( defined( 'DOING_CRON' ) ) {
|
468 |
-
LiteSpeed_Cache_Log::debug2( 'CHK html bypass: doing cron' ) ;
|
469 |
return ;
|
470 |
}
|
471 |
|
472 |
if ( $_SERVER[ 'REQUEST_METHOD' ] !== 'GET' ) {
|
473 |
-
LiteSpeed_Cache_Log::debug2( 'CHK html bypass: not get method ' . $_SERVER[ 'REQUEST_METHOD' ] ) ;
|
474 |
return ;
|
475 |
}
|
476 |
|
@@ -489,11 +489,11 @@ class LiteSpeed_Cache
|
|
489 |
$is_html = stripos( $buffer, '<html' ) === 0 || stripos( $buffer, '<!DOCTYPE' ) === 0 ;
|
490 |
|
491 |
if ( ! $is_html ) {
|
492 |
-
LiteSpeed_Cache_Log::debug( 'Footer check failed: ' . ob_get_level() . '-' . substr( $buffer, 0, 100 ) ) ;
|
493 |
return ;
|
494 |
}
|
495 |
|
496 |
-
LiteSpeed_Cache_Log::debug( 'Footer check passed' ) ;
|
497 |
|
498 |
if ( ! defined( 'LITESPEED_IS_HTML' ) ) {
|
499 |
define( 'LITESPEED_IS_HTML', true ) ;
|
@@ -581,7 +581,7 @@ class LiteSpeed_Cache
|
|
581 |
$running_info_showing = ( defined( 'LITESPEED_IS_HTML' ) && LITESPEED_IS_HTML ) || ( defined( 'LSCACHE_IS_ESI' ) && LSCACHE_IS_ESI ) ;
|
582 |
if ( defined( 'LSCACHE_ESI_SILENCE' ) ) {
|
583 |
$running_info_showing = false ;
|
584 |
-
LiteSpeed_Cache_Log::debug( 'ESI silence' ) ;
|
585 |
}
|
586 |
|
587 |
if ( $running_info_showing ) {
|
19 |
private static $_instance ;
|
20 |
|
21 |
const PLUGIN_NAME = 'litespeed-cache' ;
|
22 |
+
const PLUGIN_VERSION = '2.1.2' ;
|
23 |
|
24 |
const PAGE_EDIT_HTACCESS = 'lscache-edit-htaccess' ;
|
25 |
|
120 |
// Check if there is a purge request in queue
|
121 |
if ( $purge_queue = get_option( LiteSpeed_Cache_Purge::PURGE_QUEUE ) ) {
|
122 |
@header( $purge_queue ) ;
|
123 |
+
LiteSpeed_Cache_Log::debug( '[Boot] Purge Queue found&sent: ' . $purge_queue ) ;
|
124 |
delete_option( LiteSpeed_Cache_Purge::PURGE_QUEUE ) ;
|
125 |
}
|
126 |
|
440 |
*/
|
441 |
public static function footer_hook()
|
442 |
{
|
443 |
+
LiteSpeed_Cache_Log::debug( '[Boot] Footer hook called' ) ;
|
444 |
if ( ! defined( 'LITESPEED_FOOTER_CALLED' ) ) {
|
445 |
define( 'LITESPEED_FOOTER_CALLED', true ) ;
|
446 |
}
|
455 |
private function _check_is_html( $buffer = null )
|
456 |
{
|
457 |
if ( ! defined( 'LITESPEED_FOOTER_CALLED' ) ) {
|
458 |
+
LiteSpeed_Cache_Log::debug2( '[Boot] CHK html bypass: miss footer const' ) ;
|
459 |
return ;
|
460 |
}
|
461 |
|
462 |
if ( defined( 'DOING_AJAX' ) ) {
|
463 |
+
LiteSpeed_Cache_Log::debug2( '[Boot] CHK html bypass: doing ajax' ) ;
|
464 |
return ;
|
465 |
}
|
466 |
|
467 |
if ( defined( 'DOING_CRON' ) ) {
|
468 |
+
LiteSpeed_Cache_Log::debug2( '[Boot] CHK html bypass: doing cron' ) ;
|
469 |
return ;
|
470 |
}
|
471 |
|
472 |
if ( $_SERVER[ 'REQUEST_METHOD' ] !== 'GET' ) {
|
473 |
+
LiteSpeed_Cache_Log::debug2( '[Boot] CHK html bypass: not get method ' . $_SERVER[ 'REQUEST_METHOD' ] ) ;
|
474 |
return ;
|
475 |
}
|
476 |
|
489 |
$is_html = stripos( $buffer, '<html' ) === 0 || stripos( $buffer, '<!DOCTYPE' ) === 0 ;
|
490 |
|
491 |
if ( ! $is_html ) {
|
492 |
+
LiteSpeed_Cache_Log::debug( '[Boot] Footer check failed: ' . ob_get_level() . '-' . substr( $buffer, 0, 100 ) ) ;
|
493 |
return ;
|
494 |
}
|
495 |
|
496 |
+
LiteSpeed_Cache_Log::debug( '[Boot] Footer check passed' ) ;
|
497 |
|
498 |
if ( ! defined( 'LITESPEED_IS_HTML' ) ) {
|
499 |
define( 'LITESPEED_IS_HTML', true ) ;
|
581 |
$running_info_showing = ( defined( 'LITESPEED_IS_HTML' ) && LITESPEED_IS_HTML ) || ( defined( 'LSCACHE_IS_ESI' ) && LSCACHE_IS_ESI ) ;
|
582 |
if ( defined( 'LSCACHE_ESI_SILENCE' ) ) {
|
583 |
$running_info_showing = false ;
|
584 |
+
LiteSpeed_Cache_Log::debug( '[Boot] ESI silence' ) ;
|
585 |
}
|
586 |
|
587 |
if ( $running_info_showing ) {
|
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.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/litespeed-cache\n"
|
7 |
-
"POT-Creation-Date: 2018-03-
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
@@ -12,19 +12,19 @@ msgstr ""
|
|
12 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
14 |
|
15 |
-
#: admin/admin-api.class.php:
|
16 |
msgid "IAPI Error %s"
|
17 |
msgstr ""
|
18 |
|
19 |
-
#: admin/admin-api.class.php:
|
20 |
msgid "Reset IAPI key successfully."
|
21 |
msgstr ""
|
22 |
|
23 |
-
#: admin/admin-api.class.php:
|
24 |
msgid "Failed to communicate with LiteSpeed image server"
|
25 |
msgstr ""
|
26 |
|
27 |
-
#: admin/admin-api.class.php:
|
28 |
msgid "Message from LiteSpeed image server"
|
29 |
msgstr ""
|
30 |
|
@@ -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:
|
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:
|
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:
|
403 |
msgid "File Saved."
|
404 |
msgstr ""
|
405 |
|
@@ -655,7 +655,7 @@ msgstr ""
|
|
655 |
msgid "Sitemap Generation Blacklist"
|
656 |
msgstr ""
|
657 |
|
658 |
-
#: admin/tpl/crawler.php:250 admin/tpl/edit_htaccess.php:
|
659 |
msgid "Save"
|
660 |
msgstr ""
|
661 |
|
@@ -677,40 +677,34 @@ msgstr ""
|
|
677 |
msgid "Clear Log"
|
678 |
msgstr ""
|
679 |
|
680 |
-
#: admin/tpl/edit_htaccess.php:
|
681 |
msgid "LiteSpeed Cache Edit .htaccess"
|
682 |
msgstr ""
|
683 |
|
684 |
-
#: admin/tpl/edit_htaccess.php:
|
685 |
msgid "WARNING: This page is meant for advanced users."
|
686 |
msgstr ""
|
687 |
|
688 |
-
#: admin/tpl/edit_htaccess.php:
|
689 |
msgid "Any changes made to the .htaccess file may break the site."
|
690 |
msgstr ""
|
691 |
|
692 |
-
#: admin/tpl/edit_htaccess.php:
|
693 |
msgid "Please consult the host/server admin before making any changes."
|
694 |
msgstr ""
|
695 |
|
696 |
-
#: admin/tpl/edit_htaccess.php:
|
697 |
msgid "File editing is disabled in configuration."
|
698 |
msgstr ""
|
699 |
|
700 |
-
#: admin/tpl/edit_htaccess.php:
|
701 |
msgid "Current %s Contents"
|
702 |
msgstr ""
|
703 |
|
704 |
-
#: admin/tpl/edit_htaccess.php:
|
705 |
msgid "DO NOT EDIT ANYTHING WITHIN %s"
|
706 |
msgstr ""
|
707 |
|
708 |
-
#: admin/tpl/edit_htaccess.php:63
|
709 |
-
msgid ""
|
710 |
-
"These are added by the LS Cache plugin and may cause problems if they are "
|
711 |
-
"changed."
|
712 |
-
msgstr ""
|
713 |
-
|
714 |
#: admin/tpl/esi_widget_edit.php:30 admin/tpl/setting/settings_esi.php:37
|
715 |
msgid "Enable ESI"
|
716 |
msgstr ""
|
@@ -771,7 +765,7 @@ msgstr ""
|
|
771 |
msgid "Images pulled"
|
772 |
msgstr ""
|
773 |
|
774 |
-
#: admin/tpl/image_optimization.php:32
|
775 |
msgid "Images failed to fetch"
|
776 |
msgstr ""
|
777 |
|
@@ -895,79 +889,91 @@ msgstr ""
|
|
895 |
msgid "Images optimized and pulled"
|
896 |
msgstr ""
|
897 |
|
898 |
-
#: admin/tpl/image_optimization.php:
|
899 |
msgid "Images failed to optimize"
|
900 |
msgstr ""
|
901 |
|
902 |
-
#: admin/tpl/image_optimization.php:
|
|
|
|
|
|
|
|
|
903 |
msgid "Image files missing"
|
904 |
msgstr ""
|
905 |
|
906 |
-
#: admin/tpl/image_optimization.php:
|
907 |
msgid "Images with wrong meta"
|
908 |
msgstr ""
|
909 |
|
910 |
-
#: admin/tpl/image_optimization.php:
|
911 |
msgid "Revert Optimization"
|
912 |
msgstr ""
|
913 |
|
914 |
-
#: admin/tpl/image_optimization.php:
|
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:
|
921 |
msgid "Undo Optimization"
|
922 |
msgstr ""
|
923 |
|
924 |
-
#: admin/tpl/image_optimization.php:
|
925 |
msgid "Revert all optimized images back to their original versions."
|
926 |
msgstr ""
|
927 |
|
928 |
-
#: admin/tpl/image_optimization.php:
|
929 |
msgid "Re-do Optimization"
|
930 |
msgstr ""
|
931 |
|
932 |
-
#: admin/tpl/image_optimization.php:
|
933 |
msgid "Switch back to using optimized images."
|
934 |
msgstr ""
|
935 |
|
936 |
-
#: admin/tpl/image_optimization.php:
|
937 |
msgid "Results can be checked in <a %s>Media Library</a>."
|
938 |
msgstr ""
|
939 |
|
940 |
-
#: admin/tpl/image_optimization.php:
|
941 |
msgid "Send New Thumbnail Requests"
|
942 |
msgstr ""
|
943 |
|
944 |
-
#: admin/tpl/image_optimization.php:
|
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:
|
951 |
msgid "Reset IAPI Key"
|
952 |
msgstr ""
|
953 |
|
954 |
-
#: admin/tpl/image_optimization.php:
|
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:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
961 |
msgid "Destroy All Optimization Data!"
|
962 |
msgstr ""
|
963 |
|
964 |
-
#: admin/tpl/image_optimization.php:
|
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:
|
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,16 +995,8 @@ msgstr ""
|
|
989 |
msgid "NOTE"
|
990 |
msgstr ""
|
991 |
|
992 |
-
#: admin/tpl/image_optimization.php:
|
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"
|
1002 |
msgstr ""
|
1003 |
|
1004 |
#: admin/tpl/import_export.php:9
|
@@ -1044,7 +1042,7 @@ msgstr ""
|
|
1044 |
msgid "Rate %s on %s"
|
1045 |
msgstr ""
|
1046 |
|
1047 |
-
#. #-#-#-#-# litespeed-cache.pot (LiteSpeed Cache 2.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
|
@@ -1406,7 +1404,8 @@ msgstr ""
|
|
1406 |
msgid "This will Purge Pages only"
|
1407 |
msgstr ""
|
1408 |
|
1409 |
-
#: admin/tpl/manage/manage_purge.php:19
|
|
|
1410 |
msgid "Purge CSS/JS Cache"
|
1411 |
msgstr ""
|
1412 |
|
@@ -1446,72 +1445,64 @@ msgstr ""
|
|
1446 |
msgid "Purge the cache entries created by this plugin"
|
1447 |
msgstr ""
|
1448 |
|
1449 |
-
#: admin/tpl/manage/manage_purge.php:
|
1450 |
-
|
1451 |
-
msgstr ""
|
1452 |
-
|
1453 |
-
#: admin/tpl/manage/manage_purge.php:53 admin/tpl/manage/manage_purge.php:55
|
1454 |
-
msgid "Are you sure you want to purge all?"
|
1455 |
-
msgstr ""
|
1456 |
-
|
1457 |
-
#: admin/tpl/manage/manage_purge.php:61 inc/gui.class.php:394
|
1458 |
-
#: includes/litespeed-cache-gui.class.php:394
|
1459 |
msgid "Object Cache Purge All"
|
1460 |
msgstr ""
|
1461 |
|
1462 |
-
#: admin/tpl/manage/manage_purge.php:
|
1463 |
msgid "Purge all the object caches"
|
1464 |
msgstr ""
|
1465 |
|
1466 |
-
#: admin/tpl/manage/manage_purge.php:
|
1467 |
-
#: includes/litespeed-cache-gui.class.php:
|
1468 |
msgid "Opcode Cache Purge All"
|
1469 |
msgstr ""
|
1470 |
|
1471 |
-
#: admin/tpl/manage/manage_purge.php:
|
1472 |
msgid "Reset the entire opcode cache"
|
1473 |
msgstr ""
|
1474 |
|
1475 |
-
#: admin/tpl/manage/manage_purge.php:
|
1476 |
msgid "Empty Entire Cache"
|
1477 |
msgstr ""
|
1478 |
|
1479 |
-
#: admin/tpl/manage/manage_purge.php:
|
1480 |
msgid ""
|
1481 |
"Clears all cache entries related to this site, <i>including other web "
|
1482 |
"applications</i>."
|
1483 |
msgstr ""
|
1484 |
|
1485 |
-
#: admin/tpl/manage/manage_purge.php:
|
1486 |
msgid "This action should only be used if things are cached incorrectly."
|
1487 |
msgstr ""
|
1488 |
|
1489 |
-
#: admin/tpl/manage/manage_purge.php:
|
1490 |
msgid "This will clear EVERYTHING inside the cache."
|
1491 |
msgstr ""
|
1492 |
|
1493 |
-
#: admin/tpl/manage/manage_purge.php:
|
1494 |
msgid "This may cause heavy load on the server."
|
1495 |
msgstr ""
|
1496 |
|
1497 |
-
#: admin/tpl/manage/manage_purge.php:
|
1498 |
msgid "If only the WordPress site should be purged, use purge all."
|
1499 |
msgstr ""
|
1500 |
|
1501 |
-
#: admin/tpl/manage/manage_purge.php:
|
1502 |
#: admin/tpl/network_settings.php:7 admin/tpl/settings.php:7
|
1503 |
msgid "Purge"
|
1504 |
msgstr ""
|
1505 |
|
1506 |
-
#: admin/tpl/manage/manage_purge.php:
|
1507 |
msgid "Purge By..."
|
1508 |
msgstr ""
|
1509 |
|
1510 |
-
#: admin/tpl/manage/manage_purge.php:
|
1511 |
msgid "Select below for \"Purge by\" options."
|
1512 |
msgstr ""
|
1513 |
|
1514 |
-
#: admin/tpl/manage/manage_purge.php:
|
1515 |
#: admin/tpl/setting/settings_cache.php:73
|
1516 |
#: admin/tpl/setting/settings_cache.php:90
|
1517 |
#: admin/tpl/setting/settings_cdn.php:116
|
@@ -1534,44 +1525,44 @@ msgstr ""
|
|
1534 |
msgid "One per line."
|
1535 |
msgstr ""
|
1536 |
|
1537 |
-
#: admin/tpl/manage/manage_purge.php:
|
1538 |
msgid "Category"
|
1539 |
msgstr ""
|
1540 |
|
1541 |
-
#: admin/tpl/manage/manage_purge.php:
|
1542 |
msgid "Post ID"
|
1543 |
msgstr ""
|
1544 |
|
1545 |
-
#: admin/tpl/manage/manage_purge.php:
|
1546 |
msgid "Tag"
|
1547 |
msgstr ""
|
1548 |
|
1549 |
-
#: admin/tpl/manage/manage_purge.php:
|
1550 |
msgid "URL"
|
1551 |
msgstr ""
|
1552 |
|
1553 |
-
#: admin/tpl/manage/manage_purge.php:
|
1554 |
msgid ""
|
1555 |
"Purge pages by category name - e.g. %2$s should be used for the URL %1$s."
|
1556 |
msgstr ""
|
1557 |
|
1558 |
-
#: admin/tpl/manage/manage_purge.php:
|
1559 |
msgid "Purge pages by post ID."
|
1560 |
msgstr ""
|
1561 |
|
1562 |
-
#: admin/tpl/manage/manage_purge.php:
|
1563 |
msgid "Purge pages by tag name - e.g. %2$s should be used for the URL %1$s."
|
1564 |
msgstr ""
|
1565 |
|
1566 |
-
#: admin/tpl/manage/manage_purge.php:
|
1567 |
msgid "Purge pages by relative or full URL."
|
1568 |
msgstr ""
|
1569 |
|
1570 |
-
#: admin/tpl/manage/manage_purge.php:
|
1571 |
msgid "e.g. Use %s or %s."
|
1572 |
msgstr ""
|
1573 |
|
1574 |
-
#: admin/tpl/manage/manage_purge.php:
|
1575 |
msgid "Purge List"
|
1576 |
msgstr ""
|
1577 |
|
@@ -3187,6 +3178,11 @@ msgstr ""
|
|
3187 |
msgid "Minify inline JS code."
|
3188 |
msgstr ""
|
3189 |
|
|
|
|
|
|
|
|
|
|
|
3190 |
#: admin/tpl/setting/settings_optimize.php:91
|
3191 |
msgid "Combine JS files."
|
3192 |
msgstr ""
|
@@ -3682,72 +3678,78 @@ msgstr ""
|
|
3682 |
msgid "More settings"
|
3683 |
msgstr ""
|
3684 |
|
3685 |
-
#: inc/gui.class.php:333
|
3686 |
-
#: includes/litespeed-cache-gui.class.php:333
|
3687 |
-
#: includes/litespeed-cache-gui.class.php:375
|
3688 |
msgid "LiteSpeed Cache Purge All"
|
3689 |
msgstr ""
|
3690 |
|
3691 |
-
#: inc/gui.class.php:
|
|
|
|
|
|
|
|
|
3692 |
msgid "Cloudflare Purge All"
|
3693 |
msgstr ""
|
3694 |
|
3695 |
-
#: inc/img_optm.class.php:
|
3696 |
msgid "Failed to communicate with LiteSpeed IAPI server"
|
3697 |
msgstr ""
|
3698 |
|
3699 |
-
#: inc/img_optm.class.php:
|
3700 |
msgid "Communicated with LiteSpeed Image Optimization Server successfully."
|
3701 |
msgstr ""
|
3702 |
|
3703 |
-
#: inc/img_optm.class.php:
|
3704 |
-
#: inc/img_optm.class.php:
|
3705 |
msgid "No image found."
|
3706 |
msgstr ""
|
3707 |
|
3708 |
-
#: inc/img_optm.class.php:
|
3709 |
msgid "Number of images in one image group (%s) exceeds the credit (%s)"
|
3710 |
msgstr ""
|
3711 |
|
3712 |
-
#: inc/img_optm.class.php:
|
3713 |
msgid "Requested successfully."
|
3714 |
msgstr ""
|
3715 |
|
3716 |
-
#: inc/img_optm.class.php:
|
3717 |
msgid "Optimized successfully."
|
3718 |
msgstr ""
|
3719 |
|
3720 |
-
#: inc/img_optm.class.php:
|
3721 |
msgid "Pushed %1$s to LiteSpeed optimization server, accepted %2$s."
|
3722 |
msgstr ""
|
3723 |
|
3724 |
-
#: inc/img_optm.class.php:
|
3725 |
msgid "Failed to push to LiteSpeed IAPI server: %s"
|
3726 |
msgstr ""
|
3727 |
|
3728 |
-
#: inc/img_optm.class.php:
|
3729 |
msgid "Failed to parse data from LiteSpeed IAPI server: %s"
|
3730 |
msgstr ""
|
3731 |
|
3732 |
-
#: inc/img_optm.class.php:
|
|
|
|
|
|
|
|
|
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:
|
3739 |
msgid "Disabled WebP file successfully."
|
3740 |
msgstr ""
|
3741 |
|
3742 |
-
#: inc/img_optm.class.php:
|
3743 |
msgid "Enabled WebP file successfully."
|
3744 |
msgstr ""
|
3745 |
|
3746 |
-
#: inc/img_optm.class.php:
|
3747 |
msgid "Restored original file successfully."
|
3748 |
msgstr ""
|
3749 |
|
3750 |
-
#: inc/img_optm.class.php:
|
3751 |
msgid "Switched to optimized file successfully."
|
3752 |
msgstr ""
|
3753 |
|
@@ -3895,24 +3897,24 @@ msgstr ""
|
|
3895 |
msgid "Stopped due to load over limit"
|
3896 |
msgstr ""
|
3897 |
|
3898 |
-
#: lib/litespeed/litespeed-file.class.php:
|
3899 |
msgid "Folder does not exist: %s"
|
3900 |
msgstr ""
|
3901 |
|
3902 |
-
#: lib/litespeed/litespeed-file.class.php:
|
3903 |
msgid "Can not create folder: %1$s. Error: %2$s"
|
3904 |
msgstr ""
|
3905 |
|
3906 |
-
#: lib/litespeed/litespeed-file.class.php:
|
3907 |
msgid "Folder is not writable: %s."
|
3908 |
msgstr ""
|
3909 |
|
3910 |
-
#: lib/litespeed/litespeed-file.class.php:
|
3911 |
-
#: lib/litespeed/litespeed-file.class.php:
|
3912 |
msgid "File %s is not writable."
|
3913 |
msgstr ""
|
3914 |
|
3915 |
-
#: lib/litespeed/litespeed-file.class.php:
|
3916 |
msgid "Failed to write to %s."
|
3917 |
msgstr ""
|
3918 |
|
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.2\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/litespeed-cache\n"
|
7 |
+
"POT-Creation-Date: 2018-03-28 15:43:27+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
14 |
|
15 |
+
#: admin/admin-api.class.php:239
|
16 |
msgid "IAPI Error %s"
|
17 |
msgstr ""
|
18 |
|
19 |
+
#: admin/admin-api.class.php:262
|
20 |
msgid "Reset IAPI key successfully."
|
21 |
msgstr ""
|
22 |
|
23 |
+
#: admin/admin-api.class.php:318
|
24 |
msgid "Failed to communicate with LiteSpeed image server"
|
25 |
msgstr ""
|
26 |
|
27 |
+
#: admin/admin-api.class.php:326 admin/admin-api.class.php:334
|
28 |
msgid "Message from LiteSpeed image server"
|
29 |
msgstr ""
|
30 |
|
110 |
msgstr ""
|
111 |
|
112 |
#: admin/litespeed-cache-admin-display.class.php:934
|
113 |
+
#: admin/tpl/image_optimization.php:150 admin/tpl/image_optimization.php:225
|
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:902
|
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:1004
|
403 |
msgid "File Saved."
|
404 |
msgstr ""
|
405 |
|
655 |
msgid "Sitemap Generation Blacklist"
|
656 |
msgstr ""
|
657 |
|
658 |
+
#: admin/tpl/crawler.php:250 admin/tpl/edit_htaccess.php:70
|
659 |
msgid "Save"
|
660 |
msgstr ""
|
661 |
|
677 |
msgid "Clear Log"
|
678 |
msgstr ""
|
679 |
|
680 |
+
#: admin/tpl/edit_htaccess.php:32
|
681 |
msgid "LiteSpeed Cache Edit .htaccess"
|
682 |
msgstr ""
|
683 |
|
684 |
+
#: admin/tpl/edit_htaccess.php:42
|
685 |
msgid "WARNING: This page is meant for advanced users."
|
686 |
msgstr ""
|
687 |
|
688 |
+
#: admin/tpl/edit_htaccess.php:44
|
689 |
msgid "Any changes made to the .htaccess file may break the site."
|
690 |
msgstr ""
|
691 |
|
692 |
+
#: admin/tpl/edit_htaccess.php:45
|
693 |
msgid "Please consult the host/server admin before making any changes."
|
694 |
msgstr ""
|
695 |
|
696 |
+
#: admin/tpl/edit_htaccess.php:50
|
697 |
msgid "File editing is disabled in configuration."
|
698 |
msgstr ""
|
699 |
|
700 |
+
#: admin/tpl/edit_htaccess.php:60
|
701 |
msgid "Current %s Contents"
|
702 |
msgstr ""
|
703 |
|
704 |
+
#: admin/tpl/edit_htaccess.php:62
|
705 |
msgid "DO NOT EDIT ANYTHING WITHIN %s"
|
706 |
msgstr ""
|
707 |
|
|
|
|
|
|
|
|
|
|
|
|
|
708 |
#: admin/tpl/esi_widget_edit.php:30 admin/tpl/setting/settings_esi.php:37
|
709 |
msgid "Enable ESI"
|
710 |
msgstr ""
|
765 |
msgid "Images pulled"
|
766 |
msgstr ""
|
767 |
|
768 |
+
#: admin/tpl/image_optimization.php:32 admin/tpl/image_optimization.php:200
|
769 |
msgid "Images failed to fetch"
|
770 |
msgstr ""
|
771 |
|
889 |
msgid "Images optimized and pulled"
|
890 |
msgstr ""
|
891 |
|
892 |
+
#: admin/tpl/image_optimization.php:205
|
893 |
msgid "Images failed to optimize"
|
894 |
msgstr ""
|
895 |
|
896 |
+
#: admin/tpl/image_optimization.php:210
|
897 |
+
msgid "Images failed with other errors"
|
898 |
+
msgstr ""
|
899 |
+
|
900 |
+
#: admin/tpl/image_optimization.php:215
|
901 |
msgid "Image files missing"
|
902 |
msgstr ""
|
903 |
|
904 |
+
#: admin/tpl/image_optimization.php:220
|
905 |
msgid "Images with wrong meta"
|
906 |
msgstr ""
|
907 |
|
908 |
+
#: admin/tpl/image_optimization.php:230
|
909 |
msgid "Revert Optimization"
|
910 |
msgstr ""
|
911 |
|
912 |
+
#: admin/tpl/image_optimization.php:233
|
913 |
msgid ""
|
914 |
"Switch all images in the media library back to their original unoptimized "
|
915 |
"versions."
|
916 |
msgstr ""
|
917 |
|
918 |
+
#: admin/tpl/image_optimization.php:239
|
919 |
msgid "Undo Optimization"
|
920 |
msgstr ""
|
921 |
|
922 |
+
#: admin/tpl/image_optimization.php:242
|
923 |
msgid "Revert all optimized images back to their original versions."
|
924 |
msgstr ""
|
925 |
|
926 |
+
#: admin/tpl/image_optimization.php:248
|
927 |
msgid "Re-do Optimization"
|
928 |
msgstr ""
|
929 |
|
930 |
+
#: admin/tpl/image_optimization.php:251
|
931 |
msgid "Switch back to using optimized images."
|
932 |
msgstr ""
|
933 |
|
934 |
+
#: admin/tpl/image_optimization.php:256
|
935 |
msgid "Results can be checked in <a %s>Media Library</a>."
|
936 |
msgstr ""
|
937 |
|
938 |
+
#: admin/tpl/image_optimization.php:260
|
939 |
msgid "Send New Thumbnail Requests"
|
940 |
msgstr ""
|
941 |
|
942 |
+
#: admin/tpl/image_optimization.php:263
|
943 |
msgid ""
|
944 |
"Scan for any new unoptimized image thumbnail sizes and resend necessary "
|
945 |
"image optimization requests."
|
946 |
msgstr ""
|
947 |
|
948 |
+
#: admin/tpl/image_optimization.php:268
|
949 |
msgid "Reset IAPI Key"
|
950 |
msgstr ""
|
951 |
|
952 |
+
#: admin/tpl/image_optimization.php:271
|
953 |
msgid ""
|
954 |
"The current IAPI key must be reset after changing home URL or domain before "
|
955 |
"making any further optimization requests."
|
956 |
msgstr ""
|
957 |
|
958 |
+
#: admin/tpl/image_optimization.php:276
|
959 |
+
msgid "Clean Up Unfinished Data"
|
960 |
+
msgstr ""
|
961 |
+
|
962 |
+
#: admin/tpl/image_optimization.php:279
|
963 |
+
msgid "Remove all previous unfinished image optimization requests."
|
964 |
+
msgstr ""
|
965 |
+
|
966 |
+
#: admin/tpl/image_optimization.php:284
|
967 |
msgid "Destroy All Optimization Data!"
|
968 |
msgstr ""
|
969 |
|
970 |
+
#: admin/tpl/image_optimization.php:287
|
971 |
msgid ""
|
972 |
"Remove all previous image optimization requests/results, revert completed "
|
973 |
"optimizations, and delete all optimization files."
|
974 |
msgstr ""
|
975 |
|
976 |
+
#: admin/tpl/image_optimization.php:289
|
977 |
#: admin/tpl/setting/settings_advanced.php:50
|
978 |
#: admin/tpl/setting/settings_cdn.php:97
|
979 |
#: admin/tpl/setting/settings_crawler.php:22
|
995 |
msgid "NOTE"
|
996 |
msgstr ""
|
997 |
|
998 |
+
#: admin/tpl/image_optimization.php:290
|
999 |
+
msgid "This will also reset the credit level."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1000 |
msgstr ""
|
1001 |
|
1002 |
#: admin/tpl/import_export.php:9
|
1042 |
msgid "Rate %s on %s"
|
1043 |
msgstr ""
|
1044 |
|
1045 |
+
#. #-#-#-#-# litespeed-cache.pot (LiteSpeed Cache 2.1.2) #-#-#-#-#
|
1046 |
#. Plugin Name of the plugin/theme
|
1047 |
#: admin/tpl/inc/admin_footer.php:6 inc/gui.class.php:341
|
1048 |
#: includes/litespeed-cache-gui.class.php:341
|
1404 |
msgid "This will Purge Pages only"
|
1405 |
msgstr ""
|
1406 |
|
1407 |
+
#: admin/tpl/manage/manage_purge.php:19 inc/gui.class.php:383
|
1408 |
+
#: includes/litespeed-cache-gui.class.php:383
|
1409 |
msgid "Purge CSS/JS Cache"
|
1410 |
msgstr ""
|
1411 |
|
1445 |
msgid "Purge the cache entries created by this plugin"
|
1446 |
msgstr ""
|
1447 |
|
1448 |
+
#: admin/tpl/manage/manage_purge.php:56 inc/gui.class.php:402
|
1449 |
+
#: includes/litespeed-cache-gui.class.php:402
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1450 |
msgid "Object Cache Purge All"
|
1451 |
msgstr ""
|
1452 |
|
1453 |
+
#: admin/tpl/manage/manage_purge.php:57
|
1454 |
msgid "Purge all the object caches"
|
1455 |
msgstr ""
|
1456 |
|
1457 |
+
#: admin/tpl/manage/manage_purge.php:66 inc/gui.class.php:412
|
1458 |
+
#: includes/litespeed-cache-gui.class.php:412
|
1459 |
msgid "Opcode Cache Purge All"
|
1460 |
msgstr ""
|
1461 |
|
1462 |
+
#: admin/tpl/manage/manage_purge.php:67
|
1463 |
msgid "Reset the entire opcode cache"
|
1464 |
msgstr ""
|
1465 |
|
1466 |
+
#: admin/tpl/manage/manage_purge.php:76
|
1467 |
msgid "Empty Entire Cache"
|
1468 |
msgstr ""
|
1469 |
|
1470 |
+
#: admin/tpl/manage/manage_purge.php:77
|
1471 |
msgid ""
|
1472 |
"Clears all cache entries related to this site, <i>including other web "
|
1473 |
"applications</i>."
|
1474 |
msgstr ""
|
1475 |
|
1476 |
+
#: admin/tpl/manage/manage_purge.php:78
|
1477 |
msgid "This action should only be used if things are cached incorrectly."
|
1478 |
msgstr ""
|
1479 |
|
1480 |
+
#: admin/tpl/manage/manage_purge.php:83
|
1481 |
msgid "This will clear EVERYTHING inside the cache."
|
1482 |
msgstr ""
|
1483 |
|
1484 |
+
#: admin/tpl/manage/manage_purge.php:84
|
1485 |
msgid "This may cause heavy load on the server."
|
1486 |
msgstr ""
|
1487 |
|
1488 |
+
#: admin/tpl/manage/manage_purge.php:85
|
1489 |
msgid "If only the WordPress site should be purged, use purge all."
|
1490 |
msgstr ""
|
1491 |
|
1492 |
+
#: admin/tpl/manage/manage_purge.php:93 admin/tpl/manage.php:5
|
1493 |
#: admin/tpl/network_settings.php:7 admin/tpl/settings.php:7
|
1494 |
msgid "Purge"
|
1495 |
msgstr ""
|
1496 |
|
1497 |
+
#: admin/tpl/manage/manage_purge.php:124
|
1498 |
msgid "Purge By..."
|
1499 |
msgstr ""
|
1500 |
|
1501 |
+
#: admin/tpl/manage/manage_purge.php:126
|
1502 |
msgid "Select below for \"Purge by\" options."
|
1503 |
msgstr ""
|
1504 |
|
1505 |
+
#: admin/tpl/manage/manage_purge.php:127
|
1506 |
#: admin/tpl/setting/settings_cache.php:73
|
1507 |
#: admin/tpl/setting/settings_cache.php:90
|
1508 |
#: admin/tpl/setting/settings_cdn.php:116
|
1525 |
msgid "One per line."
|
1526 |
msgstr ""
|
1527 |
|
1528 |
+
#: admin/tpl/manage/manage_purge.php:154
|
1529 |
msgid "Category"
|
1530 |
msgstr ""
|
1531 |
|
1532 |
+
#: admin/tpl/manage/manage_purge.php:160
|
1533 |
msgid "Post ID"
|
1534 |
msgstr ""
|
1535 |
|
1536 |
+
#: admin/tpl/manage/manage_purge.php:166
|
1537 |
msgid "Tag"
|
1538 |
msgstr ""
|
1539 |
|
1540 |
+
#: admin/tpl/manage/manage_purge.php:172
|
1541 |
msgid "URL"
|
1542 |
msgstr ""
|
1543 |
|
1544 |
+
#: admin/tpl/manage/manage_purge.php:178
|
1545 |
msgid ""
|
1546 |
"Purge pages by category name - e.g. %2$s should be used for the URL %1$s."
|
1547 |
msgstr ""
|
1548 |
|
1549 |
+
#: admin/tpl/manage/manage_purge.php:183
|
1550 |
msgid "Purge pages by post ID."
|
1551 |
msgstr ""
|
1552 |
|
1553 |
+
#: admin/tpl/manage/manage_purge.php:187
|
1554 |
msgid "Purge pages by tag name - e.g. %2$s should be used for the URL %1$s."
|
1555 |
msgstr ""
|
1556 |
|
1557 |
+
#: admin/tpl/manage/manage_purge.php:192
|
1558 |
msgid "Purge pages by relative or full URL."
|
1559 |
msgstr ""
|
1560 |
|
1561 |
+
#: admin/tpl/manage/manage_purge.php:193
|
1562 |
msgid "e.g. Use %s or %s."
|
1563 |
msgstr ""
|
1564 |
|
1565 |
+
#: admin/tpl/manage/manage_purge.php:206
|
1566 |
msgid "Purge List"
|
1567 |
msgstr ""
|
1568 |
|
3178 |
msgid "Minify inline JS code."
|
3179 |
msgstr ""
|
3180 |
|
3181 |
+
#: admin/tpl/setting/settings_optimize.php:87
|
3182 |
+
#: admin/tpl/setting/settings_optimize.php:163
|
3183 |
+
msgid "JS Combine"
|
3184 |
+
msgstr ""
|
3185 |
+
|
3186 |
#: admin/tpl/setting/settings_optimize.php:91
|
3187 |
msgid "Combine JS files."
|
3188 |
msgstr ""
|
3678 |
msgid "More settings"
|
3679 |
msgstr ""
|
3680 |
|
3681 |
+
#: inc/gui.class.php:333 includes/litespeed-cache-gui.class.php:333
|
|
|
|
|
3682 |
msgid "LiteSpeed Cache Purge All"
|
3683 |
msgstr ""
|
3684 |
|
3685 |
+
#: inc/gui.class.php:375 includes/litespeed-cache-gui.class.php:375
|
3686 |
+
msgid "LSCache Purge All"
|
3687 |
+
msgstr ""
|
3688 |
+
|
3689 |
+
#: inc/gui.class.php:392 includes/litespeed-cache-gui.class.php:392
|
3690 |
msgid "Cloudflare Purge All"
|
3691 |
msgstr ""
|
3692 |
|
3693 |
+
#: inc/img_optm.class.php:80
|
3694 |
msgid "Failed to communicate with LiteSpeed IAPI server"
|
3695 |
msgstr ""
|
3696 |
|
3697 |
+
#: inc/img_optm.class.php:89
|
3698 |
msgid "Communicated with LiteSpeed Image Optimization Server successfully."
|
3699 |
msgstr ""
|
3700 |
|
3701 |
+
#: inc/img_optm.class.php:138 inc/img_optm.class.php:1233
|
3702 |
+
#: inc/img_optm.class.php:1298
|
3703 |
msgid "No image found."
|
3704 |
msgstr ""
|
3705 |
|
3706 |
+
#: inc/img_optm.class.php:166
|
3707 |
msgid "Number of images in one image group (%s) exceeds the credit (%s)"
|
3708 |
msgstr ""
|
3709 |
|
3710 |
+
#: inc/img_optm.class.php:194
|
3711 |
msgid "Requested successfully."
|
3712 |
msgstr ""
|
3713 |
|
3714 |
+
#: inc/img_optm.class.php:214
|
3715 |
msgid "Optimized successfully."
|
3716 |
msgstr ""
|
3717 |
|
3718 |
+
#: inc/img_optm.class.php:271
|
3719 |
msgid "Pushed %1$s to LiteSpeed optimization server, accepted %2$s."
|
3720 |
msgstr ""
|
3721 |
|
3722 |
+
#: inc/img_optm.class.php:623
|
3723 |
msgid "Failed to push to LiteSpeed IAPI server: %s"
|
3724 |
msgstr ""
|
3725 |
|
3726 |
+
#: inc/img_optm.class.php:631
|
3727 |
msgid "Failed to parse data from LiteSpeed IAPI server: %s"
|
3728 |
msgstr ""
|
3729 |
|
3730 |
+
#: inc/img_optm.class.php:1123
|
3731 |
+
msgid "Destroy unfinished data successfully."
|
3732 |
+
msgstr ""
|
3733 |
+
|
3734 |
+
#: inc/img_optm.class.php:1336
|
3735 |
msgid ""
|
3736 |
"Pushed %1$s groups with %2$s images to LiteSpeed optimization server, "
|
3737 |
"accepted %3$s groups with %4$s images."
|
3738 |
msgstr ""
|
3739 |
|
3740 |
+
#: inc/img_optm.class.php:1564
|
3741 |
msgid "Disabled WebP file successfully."
|
3742 |
msgstr ""
|
3743 |
|
3744 |
+
#: inc/img_optm.class.php:1570
|
3745 |
msgid "Enabled WebP file successfully."
|
3746 |
msgstr ""
|
3747 |
|
3748 |
+
#: inc/img_optm.class.php:1586
|
3749 |
msgid "Restored original file successfully."
|
3750 |
msgstr ""
|
3751 |
|
3752 |
+
#: inc/img_optm.class.php:1593
|
3753 |
msgid "Switched to optimized file successfully."
|
3754 |
msgstr ""
|
3755 |
|
3897 |
msgid "Stopped due to load over limit"
|
3898 |
msgstr ""
|
3899 |
|
3900 |
+
#: lib/litespeed/litespeed-file.class.php:135
|
3901 |
msgid "Folder does not exist: %s"
|
3902 |
msgstr ""
|
3903 |
|
3904 |
+
#: lib/litespeed/litespeed-file.class.php:144
|
3905 |
msgid "Can not create folder: %1$s. Error: %2$s"
|
3906 |
msgstr ""
|
3907 |
|
3908 |
+
#: lib/litespeed/litespeed-file.class.php:152
|
3909 |
msgid "Folder is not writable: %s."
|
3910 |
msgstr ""
|
3911 |
|
3912 |
+
#: lib/litespeed/litespeed-file.class.php:159
|
3913 |
+
#: lib/litespeed/litespeed-file.class.php:164
|
3914 |
msgid "File %s is not writable."
|
3915 |
msgstr ""
|
3916 |
|
3917 |
+
#: lib/litespeed/litespeed-file.class.php:171
|
3918 |
msgid "Failed to write to %s."
|
3919 |
msgstr ""
|
3920 |
|
lib/litespeed/litespeed-file.class.php
CHANGED
@@ -92,7 +92,11 @@ class Litespeed_File
|
|
92 |
return $res ;
|
93 |
}
|
94 |
|
95 |
-
|
|
|
|
|
|
|
|
|
96 |
}
|
97 |
|
98 |
/**
|
@@ -160,6 +164,8 @@ class Litespeed_File
|
|
160 |
return $silence ? false : sprintf( __( 'File %s is not writable.', 'litespeed-cache' ), $filename ) ;
|
161 |
}
|
162 |
|
|
|
|
|
163 |
$ret = file_put_contents( $filename, $data, $append ? FILE_APPEND : LOCK_EX ) ;
|
164 |
if ( $ret === false ) {
|
165 |
return $silence ? false : sprintf( __( 'Failed to write to %s.', 'litespeed-cache' ), $filename ) ;
|
@@ -168,6 +174,30 @@ class Litespeed_File
|
|
168 |
return true ;
|
169 |
}
|
170 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
171 |
/**
|
172 |
* Appends an array of strings into a file (.htaccess ), placing it between
|
173 |
* BEGIN and END markers.
|
92 |
return $res ;
|
93 |
}
|
94 |
|
95 |
+
$content = file_get_contents( $filename ) ;
|
96 |
+
|
97 |
+
$content = self::_remove_zero_space( $content ) ;
|
98 |
+
|
99 |
+
return $content ;
|
100 |
}
|
101 |
|
102 |
/**
|
164 |
return $silence ? false : sprintf( __( 'File %s is not writable.', 'litespeed-cache' ), $filename ) ;
|
165 |
}
|
166 |
|
167 |
+
$data = self::_remove_zero_space( $data ) ;
|
168 |
+
|
169 |
$ret = file_put_contents( $filename, $data, $append ? FILE_APPEND : LOCK_EX ) ;
|
170 |
if ( $ret === false ) {
|
171 |
return $silence ? false : sprintf( __( 'Failed to write to %s.', 'litespeed-cache' ), $filename ) ;
|
174 |
return true ;
|
175 |
}
|
176 |
|
177 |
+
/**
|
178 |
+
* Remove Unicode zero-width space <200b><200c>
|
179 |
+
*
|
180 |
+
* @since 2.1.2
|
181 |
+
*/
|
182 |
+
private static function _remove_zero_space( $content )
|
183 |
+
{
|
184 |
+
if ( is_array( $content ) ) {
|
185 |
+
$content = array_map( 'self::_remove_zero_space', $content ) ;
|
186 |
+
return $content ;
|
187 |
+
}
|
188 |
+
|
189 |
+
// Remove UTF-8 BOM if present
|
190 |
+
if ( substr( $content, 0, 3 ) === "\xEF\xBB\xBF" ) {
|
191 |
+
$content = substr( $content, 3 ) ;
|
192 |
+
}
|
193 |
+
|
194 |
+
$content = str_replace( "\xe2\x80\x8b", '', $content ) ;
|
195 |
+
$content = str_replace( "\xe2\x80\x8c", '', $content ) ;
|
196 |
+
$content = str_replace( "\xe2\x80\x8d", '', $content ) ;
|
197 |
+
|
198 |
+
return $content ;
|
199 |
+
}
|
200 |
+
|
201 |
/**
|
202 |
* Appends an array of strings into a file (.htaccess ), placing it between
|
203 |
* BEGIN and END markers.
|
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.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, 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 |
|
@@ -15,6 +15,11 @@ LiteSpeed Cache for WordPress (LSCWP) is an all-in-one site acceleration plugin,
|
|
15 |
|
16 |
LSCWP supports WordPress Multisite and is compatible with most popular plugins, including WooCommerce, bbPress, and Yoast SEO.
|
17 |
|
|
|
|
|
|
|
|
|
|
|
18 |
== Plugin Features ==
|
19 |
|
20 |
= General Features =
|
@@ -55,8 +60,6 @@ LSCWP supports WordPress Multisite and is compatible with most popular plugins,
|
|
55 |
* HTTP/2 & [QUIC](https://blog.litespeedtech.com/2017/07/11/litespeed-announces-quic-support/) support (QUIC not available in OpenLiteSpeed)
|
56 |
* ESI (Edge Side Includes) support (Not available in OpenLiteSpeed)
|
57 |
|
58 |
-
NOTE: **LiteSpeed Exclusive Features** require the use of a LiteSpeed web server with cache module installed. **General Features** may be used by anyone with any web server.
|
59 |
-
|
60 |
== Screenshots ==
|
61 |
|
62 |
1. Plugin Benchmarks
|
@@ -249,21 +252,33 @@ Click on the `Advanced View` link at the top of the page, and several more tabs
|
|
249 |
|
250 |
== Changelog ==
|
251 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
252 |
= 2.1.1.1 - Mar 21 2018 =
|
253 |
* [BUGFIX] Fixed issue where activation failed to add rules to .htaccess.
|
254 |
* [BUGFIX] Fixed issue where 304 header was blank on feed page refresh.
|
255 |
|
256 |
= 2.1.1 - Mar 20 2018 =
|
257 |
-
* [NEW
|
258 |
* [IMPROVEMENT] <strong>Image Optimization</strong> Fixed issue where images with bad postmeta value continued to show in not-yet-requested queue.
|
259 |
|
260 |
= 2.1 - Mar 15 2018 =
|
261 |
-
* [NEW
|
262 |
-
* [NEW
|
263 |
-
* [NEW
|
264 |
-
* [NEW
|
265 |
-
* [NEW
|
266 |
-
* [NEW
|
267 |
* [IAPI] IAPI v2.0.
|
268 |
* [IAPI] Increased max rows prefetch when client has additional credit.
|
269 |
* [IMPROVEMENT] <strong>CDN</strong> Multiple domains may now be used.
|
@@ -275,7 +290,7 @@ Click on the `Advanced View` link at the top of the page, and several more tabs
|
|
275 |
* [INTEGRATION] CDN compatibility with WPML multiple domains. (@egemensarica)
|
276 |
|
277 |
= 2.0 - Mar 7 2018 =
|
278 |
-
* [NEW
|
279 |
* [REFACTOR] <strong>Image Optimization</strong> Refactored Image Optimization class.
|
280 |
* [IAPI] <strong>Image Optimization</strong> New European Image Optimization server (EU2).
|
281 |
* [IMPROVEMENT] <strong>Image Optimization</strong> Manual pull action continues pulling until complete.
|
@@ -299,15 +314,15 @@ Click on the `Advanced View` link at the top of the page, and several more tabs
|
|
299 |
* [Hotfix] Removed empty crawler when no role simulation is set.
|
300 |
|
301 |
= 1.9.1 - February 20 2018 =
|
302 |
-
* [NEW
|
303 |
-
* [NEW
|
304 |
-
* [NEW
|
305 |
* [BUGFIX] Fixed a js bug with the auto complete mobile user agents field when cache mobile is turned on.
|
306 |
* [BUGFIX] Fixed a constant undefined warning after activation.
|
307 |
* [GUI] Sitemap generation settings are no longer hidden when using a custom sitemap.
|
308 |
|
309 |
= 1.9 - February 12 2018 =
|
310 |
-
* [NEW
|
311 |
* [IMPROVEMENT] Removed Composer vendor to thin the plugin folder.
|
312 |
* [UPDATE] Tweaked H2 to H1 in Admin headings for accessibility. (@steverep)
|
313 |
* [GUI] Added Mobile User Agents to basic view.
|
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.2
|
7 |
License: GPLv3
|
8 |
License URI: http://www.gnu.org/licenses/gpl.html
|
9 |
|
15 |
|
16 |
LSCWP supports WordPress Multisite and is compatible with most popular plugins, including WooCommerce, bbPress, and Yoast SEO.
|
17 |
|
18 |
+
== Requirements ==
|
19 |
+
**General Features** may be used by anyone with any web server.
|
20 |
+
|
21 |
+
**LiteSpeed Exclusive Features** require the use of [OpenLiteSpeed](http://openlitespeed.org) (free, open source) or [LiteSpeed Web Server Enterprise](https://www.litespeedtech.com/products/litespeed-web-server) with cache module installed.
|
22 |
+
|
23 |
== Plugin Features ==
|
24 |
|
25 |
= General Features =
|
60 |
* HTTP/2 & [QUIC](https://blog.litespeedtech.com/2017/07/11/litespeed-announces-quic-support/) support (QUIC not available in OpenLiteSpeed)
|
61 |
* ESI (Edge Side Includes) support (Not available in OpenLiteSpeed)
|
62 |
|
|
|
|
|
63 |
== Screenshots ==
|
64 |
|
65 |
1. Plugin Benchmarks
|
252 |
|
253 |
== Changelog ==
|
254 |
|
255 |
+
= 2.1.2 - Mar 28 2018 =
|
256 |
+
* [NEW] <strong>Image Optimization</strong> Clean Up Unfinished Data feature.
|
257 |
+
* [IAPI] IAPI v2.1.2.
|
258 |
+
* [IMPROVEMENT] <strong>CSS/JS Minify</strong> Reduced loading time significantly by improving CSS/JS minify loading process. (@kokers)
|
259 |
+
* [IMPROVEMENT] <strong>CSS/JS Minify</strong> Cache empty JS Minify content. (@kokers)
|
260 |
+
* [IMPROVEMENT] <strong>Cache</strong> Cache 301 redirect when scheme/host are same.
|
261 |
+
* [BUGFIX] <strong>Media</strong> Lazy load now can support webp. (@relle)
|
262 |
+
* [UPDATE] <strong>CSS/JS Optimize</strong> Serve static files for CSS async & lazy load JS library.
|
263 |
+
* [UPDATE] <strong>Report</strong> Appended Basic/Advanced View setting to Report.
|
264 |
+
* [UPDATE] <strong>CSS/JS Minify</strong> Removed zero-width space from CSS/JS content.
|
265 |
+
* [GUI] Added Purge CSS/JS Cache link in Admin.
|
266 |
+
|
267 |
= 2.1.1.1 - Mar 21 2018 =
|
268 |
* [BUGFIX] Fixed issue where activation failed to add rules to .htaccess.
|
269 |
* [BUGFIX] Fixed issue where 304 header was blank on feed page refresh.
|
270 |
|
271 |
= 2.1.1 - Mar 20 2018 =
|
272 |
+
* [NEW] <strong>Browser Cache</strong> Unlocked for non-LiteSpeed users.
|
273 |
* [IMPROVEMENT] <strong>Image Optimization</strong> Fixed issue where images with bad postmeta value continued to show in not-yet-requested queue.
|
274 |
|
275 |
= 2.1 - Mar 15 2018 =
|
276 |
+
* [NEW] <strong>Image Optimization</strong> Unlocked for non-LiteSpeed users.
|
277 |
+
* [NEW] <strong>Object Cache</strong> Unlocked for non-LiteSpeed users.
|
278 |
+
* [NEW] <strong>Crawler</strong> Unlocked for non-LiteSpeed users.
|
279 |
+
* [NEW] <strong>Database Cleaner and Optimizer</strong> Unlocked for non-LiteSpeed users.
|
280 |
+
* [NEW] <strong>Lazy Load Images</strong> Unlocked for non-LiteSpeed users.
|
281 |
+
* [NEW] <strong>CSS/JS/HTML Minify/Combine Optimize</strong> Unlocked for non-LiteSpeed users.
|
282 |
* [IAPI] IAPI v2.0.
|
283 |
* [IAPI] Increased max rows prefetch when client has additional credit.
|
284 |
* [IMPROVEMENT] <strong>CDN</strong> Multiple domains may now be used.
|
290 |
* [INTEGRATION] CDN compatibility with WPML multiple domains. (@egemensarica)
|
291 |
|
292 |
= 2.0 - Mar 7 2018 =
|
293 |
+
* [NEW] <strong>Image Optimization</strong> Added level up guidance.
|
294 |
* [REFACTOR] <strong>Image Optimization</strong> Refactored Image Optimization class.
|
295 |
* [IAPI] <strong>Image Optimization</strong> New European Image Optimization server (EU2).
|
296 |
* [IMPROVEMENT] <strong>Image Optimization</strong> Manual pull action continues pulling until complete.
|
314 |
* [Hotfix] Removed empty crawler when no role simulation is set.
|
315 |
|
316 |
= 1.9.1 - February 20 2018 =
|
317 |
+
* [NEW] Role Simulation crawler.
|
318 |
+
* [NEW] WebP multiple crawler.
|
319 |
+
* [NEW] HTTP/2 support for crawler.
|
320 |
* [BUGFIX] Fixed a js bug with the auto complete mobile user agents field when cache mobile is turned on.
|
321 |
* [BUGFIX] Fixed a constant undefined warning after activation.
|
322 |
* [GUI] Sitemap generation settings are no longer hidden when using a custom sitemap.
|
323 |
|
324 |
= 1.9 - February 12 2018 =
|
325 |
+
* [NEW] Inline CSS/JS Minify.
|
326 |
* [IMPROVEMENT] Removed Composer vendor to thin the plugin folder.
|
327 |
* [UPDATE] Tweaked H2 to H1 in Admin headings for accessibility. (@steverep)
|
328 |
* [GUI] Added Mobile User Agents to basic view.
|