initial commit

This commit is contained in:
2024-04-29 13:12:44 +05:45
commit 34887303c5
19300 changed files with 5268802 additions and 0 deletions

View File

@ -0,0 +1,61 @@
<?php
namespace LiteSpeed ;
defined( 'WPINC' ) || exit ;
$menu_list = array(
'settings_css' => __( 'CSS Settings', 'litespeed-cache' ),
'settings_js' => __( 'JS Settings', 'litespeed-cache' ),
'settings_html' => __( 'HTML Settings', 'litespeed-cache' ),
'settings_media' => __( 'Media Settings', 'litespeed-cache' ),
'settings_media_exc' => __( 'Media Excludes', 'litespeed-cache' ),
'settings_localization' => __( 'Localization', 'litespeed-cache' ),
'settings_tuning' => __( 'Tuning', 'litespeed-cache' ),
);
?>
<div class="wrap">
<h1 class="litespeed-h1">
<?php echo __( 'LiteSpeed Cache Page Optimization', 'litespeed-cache' ) ; ?>
</h1>
<span class="litespeed-desc">
v<?php echo Core::VER ; ?>
</span>
<hr class="wp-header-end">
</div>
<div class="litespeed-wrap">
<div class="litespeed-callout notice notice-warning inline">
<h4><?php echo __( 'NOTICE', 'litespeed-cache' ) ; ?></h4>
<p><?php echo __( 'Please test thoroughly when enabling any option in this list. After changing Minify/Combine settings, please do a Purge All action.', 'litespeed-cache' ) ; ?></p>
</div>
<h2 class="litespeed-header nav-tab-wrapper">
<?php
$i = 1 ;
foreach ($menu_list as $tab => $val){
$accesskey = $i <= 9 ? "litespeed-accesskey='$i'" : '' ;
echo "<a class='litespeed-tab nav-tab' href='#$tab' data-litespeed-tab='$tab' $accesskey>$val</a>" ;
$i ++ ;
}
?>
</h2>
<div class="litespeed-body">
<?php
$this->form_action() ;
// include all tpl for faster UE
foreach ($menu_list as $tab => $val) {
echo "<div data-litespeed-layout='$tab'>" ;
require LSCWP_DIR . "tpl/page_optm/$tab.tpl.php" ;
echo "</div>" ;
}
$this->form_end() ;
?>
</div>
</div>

View File

@ -0,0 +1,275 @@
<?php
namespace LiteSpeed;
defined( 'WPINC' ) || exit;
// CSS::cls()->test_url( '' );
// exit;
$css_summary = CSS::get_summary();
$closest_server = Cloud::get_summary( 'server.' . Cloud::SVC_CCSS );
$ccss_queue = $this->load_queue( 'ccss' );
$ucss_queue = $this->load_queue( 'ucss' );
?>
<h3 class="litespeed-title-short">
<?php echo __( 'CSS Settings', 'litespeed-cache' ); ?>
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/pageopt/' ); ?>
</h3>
<table class="wp-list-table striped litespeed-table"><tbody>
<tr>
<th>
<?php $id = Base::O_OPTM_CSS_MIN; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_switch( $id ); ?>
<div class="litespeed-desc">
<?php echo __( 'Minify CSS files and inline CSS code.', 'litespeed-cache' ); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $id = Base::O_OPTM_CSS_COMB; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_switch( $id ); ?>
<div class="litespeed-desc">
<?php echo __( 'Combine CSS files and inline CSS code.', 'litespeed-cache' ); ?>
<a href="https://docs.litespeedtech.com/lscache/lscwp/ts-optimize/" target="_blank"><?php echo __( 'How to Fix Problems Caused by CSS/JS Optimization.', 'litespeed-cache' ); ?></a>
</div>
</td>
</tr>
<tr>
<th class="litespeed-padding-left">
<?php $id = Base::O_OPTM_UCSS; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_switch( $id ); ?>
<div class="litespeed-desc">
<?php if ( ! $this->conf( Base::O_API_KEY ) ) : ?>
<div class="litespeed-callout notice notice-error inline">
<h4><?php echo __( 'WARNING', 'litespeed-cache' ) ; ?></h4>
<?php echo Error::msg( 'lack_of_api_key' ); ?>
</div>
<?php endif; ?>
<?php echo __( 'Use QUIC.cloud online service to generate unique CSS.', 'litespeed-cache' ); ?>
<?php echo __( 'This will drop the unused CSS on each page from the combined file.', 'litespeed-cache' ); ?>
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/pageopt/#generate-ucss' ); ?>
<br /><?php echo __( 'Automatic generation of unique CSS is in the background via a cron-based queue.', 'litespeed-cache' ); ?>
<br /><font class="litespeed-success">API: <?php echo sprintf( __( 'Filter %s available for UCSS per page type generation.', 'litespeed-cache' ), "<code>add_filter( 'litespeed_ucss_per_pagetype', '__return_true' );</code>" ); ?></font>
<?php if ( $this->conf( Base::O_OPTM_UCSS ) && ! $this->conf( Base::O_OPTM_CSS_COMB ) ) : ?>
<br /><font class="litespeed-warning">
<?php echo sprintf( __( 'This option is bypassed because %1$s option is %2$s.', 'litespeed-cache' ), '<code>' . Lang::title( Base::O_OPTM_CSS_COMB ) . '</code>', '<code>' . __( 'OFF', 'litespeed-cache' ) . '</code>' ); ?>
</font>
<?php endif; ?>
</div>
<div class="litespeed-desc litespeed-left20">
<?php if ( $css_summary ) : ?>
<?php if ( ! empty( $css_summary[ 'last_request_ucss' ] ) ) : ?>
<p>
<?php echo __( 'Last generated', 'litespeed-cache' ) . ': <code>' . Utility::readable_time( $css_summary[ 'last_request_ucss' ] ) . '</code>'; ?>
</p>
<p>
<?php echo __( 'Last requested cost', 'litespeed-cache' ) . ': <code>' . $css_summary[ 'last_spent_ucss' ] . 's</code>'; ?>
</p>
<?php endif; ?>
<?php endif; ?>
<?php if ( $closest_server ) : ?>
<a href="<?php echo Utility::build_url( Router::ACTION_CLOUD, Cloud::TYPE_REDETECT_CLOUD, false, null, array( 'svc' => Cloud::SVC_CCSS ) ); ?>" data-balloon-pos="up" data-balloon-break aria-label='<?php echo sprintf( __( 'Current closest Cloud server is %s.&#10; Click to redetect.', 'litespeed-cache' ), $closest_server ); ?>' data-litespeed-cfm="<?php echo __( 'Are you sure you want to redetect the closest cloud server for this service?', 'litespeed-cache' ) ; ?>"><i class='litespeed-quic-icon'></i></a>
<?php endif; ?>
<?php if ( ! empty( $ucss_queue ) ) : ?>
<div class="litespeed-callout notice notice-warning inline">
<h4>
<?php echo sprintf( __( 'URL list in %s queue waiting for cron', 'litespeed-cache' ), 'UCSS' ); ?> ( <?php echo count( $ucss_queue ); ?> )
<a href="<?php echo Utility::build_url( Router::ACTION_CSS, CSS::TYPE_CLEAR_Q_UCSS ); ?>" class="button litespeed-btn-warning litespeed-right">Clear</a>
</h4>
<p>
<?php $i=0; foreach ( $ucss_queue as $k => $v ) : ?>
<?php if ( $i++ > 20 ) : ?>
<?php echo '...'; ?>
<?php break; ?>
<?php endif; ?>
<?php if ( ! is_array( $v ) ) continue; ?>
<?php if ( ! empty( $v[ '_status' ] ) ) : ?><span class="litespeed-success"><?php endif; ?>
<?php echo esc_html( $v[ 'url' ] ); ?>
<?php if ( ! empty( $v[ '_status' ] ) ) : ?></span><?php endif; ?>
<?php if ( $pos = strpos( $k, ' ' ) ) echo ' (' . __( 'Vary Group', 'litespeed-cache' ) . ':' . substr( $k, 0, $pos ) . ')'; ?>
<?php if ( $v[ 'is_mobile' ] ) echo ' <span data-balloon-pos="up" aria-label="mobile">📱</span>'; ?>
<?php if ( ! empty( $v[ 'is_webp' ] ) ) echo ' WebP'; ?>
<br />
<?php endforeach; ?>
</p>
</div>
<a href="<?php echo Utility::build_url( Router::ACTION_CSS, CSS::TYPE_GEN_UCSS ); ?>" class="button litespeed-btn-success">
<?php echo sprintf( __( 'Run %s Queue Manually', 'litespeed-cache' ), 'UCSS' ); ?>
</a>
<?php endif; ?>
</div>
</td>
</tr>
<tr>
<th class="litespeed-padding-left">
<?php $id = Base::O_OPTM_UCSS_INLINE; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_switch( $id ); ?>
<div class="litespeed-desc">
<?php echo sprintf( __( 'Inline UCSS to reduce the extra CSS file loading. This option will not be automatically turned on for %1$s pages. To use it on %1$s pages, please set it to ON.', 'litespeed-cache' ), '<code>' . Lang::title( Base::O_GUEST ) . '</code>' ); ?>
<br /><font class="litespeed-info">
<?php echo sprintf( __( 'This option will automatically bypass %s option.', 'litespeed-cache' ), '<code>' . Lang::title( Base::O_OPTM_CSS_ASYNC ) . '</code>' ); ?>
</font>
</div>
</td>
</tr>
<tr>
<th>
<?php $id = Base::O_OPTM_CSS_COMB_EXT_INL; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_switch( $id ); ?>
<div class="litespeed-desc">
<?php echo sprintf( __( 'Include external CSS and inline CSS in combined file when %1$s is also enabled. This option helps maintain the priorities of CSS, which should minimize potential errors caused by CSS Combine.', 'litespeed-cache' ), '<code>' . Lang::title( Base::O_OPTM_CSS_COMB ) . '</code>' ); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $id = Base::O_OPTM_CSS_ASYNC; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_switch( $id ); ?>
<div class="litespeed-desc">
<?php if ( ! $this->conf( Base::O_API_KEY ) ) : ?>
<div class="litespeed-callout notice notice-error inline">
<h4><?php echo __( 'WARNING', 'litespeed-cache' ) ; ?></h4>
<?php echo Error::msg( 'lack_of_api_key' ); ?>
</div>
<?php endif; ?>
<?php echo __( 'Optimize CSS delivery.', 'litespeed-cache' ); ?>
<?php echo __( 'This can improve your speed score in services like Pingdom, GTmetrix and PageSpeed.', 'litespeed-cache' ); ?><br />
<?php echo __( 'Use QUIC.cloud online service to generate critical CSS and load remaining CSS asynchronously.', 'litespeed-cache' ); ?>
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/pageopt/#load-css-asynchronously' ); ?><br />
<?php echo __( 'Automatic generation of critical CSS is in the background via a cron-based queue.', 'litespeed-cache' ); ?><br />
<?php echo sprintf( __( 'When this option is turned %s, it will also load Google Fonts asynchronously.', 'litespeed-cache' ), '<code>' . __( 'ON', 'litespeed-cache' ) . '</code>' ); ?>
<br /><font class="litespeed-success">
<?php echo __( 'API', 'litespeed-cache' ); ?>:
<?php echo sprintf( __( 'Elements with attribute %s in HTML code will be excluded.', 'litespeed-cache' ), '<code>data-no-async="1"</code>' ); ?>
</font>
<?php if ( $this->conf( Base::O_OPTM_CSS_ASYNC ) && $this->conf( Base::O_OPTM_CSS_COMB ) && $this->conf( Base::O_OPTM_UCSS ) && $this->conf( Base::O_OPTM_UCSS_INLINE ) ) : ?>
<br /><font class="litespeed-warning">
<?php echo sprintf( __( 'This option is bypassed due to %s option.', 'litespeed-cache' ), '<code>' . Lang::title( Base::O_OPTM_UCSS_INLINE ) . '</code>' ); ?>
</font>
<?php endif; ?>
</div>
<div class="litespeed-desc litespeed-left20">
<?php if ( $css_summary ) : ?>
<?php if ( ! empty( $css_summary[ 'last_request_ccss' ] ) ) : ?>
<p>
<?php echo __( 'Last generated', 'litespeed-cache' ) . ': <code>' . Utility::readable_time( $css_summary[ 'last_request_ccss' ] ) . '</code>'; ?>
</p>
<p>
<?php echo __( 'Last requested cost', 'litespeed-cache' ) . ': <code>' . $css_summary[ 'last_spent_ccss' ] . 's</code>'; ?>
</p>
<?php endif; ?>
<?php endif; ?>
<?php if ( $closest_server ) : ?>
<a href="<?php echo Utility::build_url( Router::ACTION_CLOUD, Cloud::TYPE_REDETECT_CLOUD, false, null, array( 'svc' => Cloud::SVC_CCSS ) ); ?>" data-balloon-pos="up" data-balloon-break aria-label='<?php echo sprintf( __( 'Current closest Cloud server is %s.&#10; Click to redetect.', 'litespeed-cache' ), $closest_server ); ?>' data-litespeed-cfm="<?php echo __( 'Are you sure you want to redetect the closest cloud server for this service?', 'litespeed-cache' ) ; ?>"><i class='litespeed-quic-icon'></i></a>
<?php endif; ?>
<?php if ( ! empty( $ccss_queue ) ) : ?>
<div class="litespeed-callout notice notice-warning inline">
<h4>
<?php echo sprintf( __( 'URL list in %s queue waiting for cron', 'litespeed-cache' ), 'CCSS' ); ?> ( <?php echo count( $ccss_queue ); ?> )
<a href="<?php echo Utility::build_url( Router::ACTION_CSS, CSS::TYPE_CLEAR_Q_CCSS ); ?>" class="button litespeed-btn-warning litespeed-right">Clear</a>
</h4>
<p>
<?php $i=0; foreach ( $ccss_queue as $k => $v ) : ?>
<?php if ( $i++ > 20 ) : ?>
<?php echo '...'; ?>
<?php break; ?>
<?php endif; ?>
<?php if ( ! is_array( $v ) ) continue; ?>
<?php if ( ! empty( $v[ '_status' ] ) ) : ?><span class="litespeed-success"><?php endif; ?>
<?php echo esc_html( $v[ 'url' ] ); ?>
<?php if ( ! empty( $v[ '_status' ] ) ) : ?></span><?php endif; ?>
<?php if ( $pos = strpos( $k, ' ' ) ) echo ' (' . __( 'Vary Group', 'litespeed-cache' ) . ':' . substr( $k, 0, $pos ) . ')'; ?>
<?php if ( $v[ 'is_mobile' ] ) echo ' <span data-balloon-pos="up" aria-label="mobile">📱</span>'; ?>
<?php if ( ! empty( $v[ 'is_webp' ] ) ) echo ' WebP'; ?>
<br />
<?php endforeach; ?>
</p>
</div>
<a href="<?php echo Utility::build_url( Router::ACTION_CSS, CSS::TYPE_GEN_CCSS ); ?>" class="button litespeed-btn-success">
<?php echo sprintf( __( 'Run %s Queue Manually', 'litespeed-cache' ), 'CCSS' ); ?>
</a>
<?php endif; ?>
</div>
</td>
</tr>
<tr>
<th class="litespeed-padding-left">
<?php $id = Base::O_OPTM_CCSS_PER_URL; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_switch( $id ); ?>
<div class="litespeed-desc">
<?php echo __( 'Disable this option to generate CCSS per Post Type instead of per page. This can save significant CCSS quota, however it may result in incorrect CSS styling if your site uses a page builder.', 'litespeed-cache' ); ?>
</div>
</td>
</tr>
<tr>
<th class="litespeed-padding-left">
<?php $id = Base::O_OPTM_CSS_ASYNC_INLINE; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_switch( $id ); ?>
<div class="litespeed-desc">
<?php echo __( 'This will inline the asynchronous CSS library to avoid render blocking.', 'litespeed-cache' ); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $id = Base::O_OPTM_CSS_FONT_DISPLAY; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_switch( $id, array( __( 'Default', 'litespeed-cache' ), 'Swap' ) ); ?>
<div class="litespeed-desc">
<?php echo sprintf( __( 'Set this to append %1$s to all %2$s rules before caching CSS to specify how fonts should be displayed while being downloaded.', 'litespeed-cache' ), '<code>font-display</code>', '<code>@font-face</code>' ); ?>
<br /><?php echo sprintf( __( '%s is recommended.', 'litespeed-cache' ), '<code>' . __( 'Swap', 'litespeed-cache' ) . '</code>' ); ?>
</div>
</td>
</tr>
</tbody></table>

View File

@ -0,0 +1,148 @@
<?php
namespace LiteSpeed;
defined( 'WPINC' ) || exit;
?>
<h3 class="litespeed-title-short">
<?php echo __( 'HTML Settings', 'litespeed-cache' ); ?>
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/pageopt/#html-settings-tab' ); ?>
</h3>
<table class="wp-list-table striped litespeed-table"><tbody>
<tr>
<th>
<?php $id = Base::O_OPTM_HTML_MIN; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_switch( $id ); ?>
<div class="litespeed-desc">
<?php echo __( 'Minify HTML content.', 'litespeed-cache' ); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $id = Base::O_OPTM_DNS_PREFETCH; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_textarea( $id ); ?>
<div class="litespeed-desc">
<?php echo __( 'Prefetching DNS can reduce latency for visitors.', 'litespeed-cache' ); ?>
<?php echo __( 'For example', 'litespeed-cache' ); ?>: <code>//www.example.com</code>
<?php Doc::one_per_line(); ?>
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/pageopt/#dns-prefetch' ); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $id = Base::O_OPTM_DNS_PREFETCH_CTRL; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_switch( $id ); ?>
<div class="litespeed-desc">
<?php echo __( 'Automatically enable DNS prefetching for all URLs in the document, including images, CSS, JavaScript, and so forth.', 'litespeed-cache' ); ?>
<?php echo __( 'This can improve the page loading speed.', 'litespeed-cache' ); ?>
<?php Doc::learn_more( 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-DNS-Prefetch-Control' ); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $id = Base::O_OPTM_HTML_LAZY; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_textarea( $id ); ?>
<div class="litespeed-desc">
<?php echo __( 'Delay rendering off-screen HTML elements by its selector.', 'litespeed-cache' ); ?>
<?php Doc::one_per_line(); ?>
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/pageopt/#html-lazyload-selectors' ); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $id = Base::O_OPTM_QS_RM; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_switch( $id ); ?>
<div class="litespeed-desc">
<?php echo __( 'Remove query strings from internal static resources.', 'litespeed-cache' ); ?>
<br /><font class="litespeed-warning">
⚠️
<?php echo __( 'Google reCAPTCHA will be bypassed automatically.', 'litespeed-cache' ); ?>
</font>
<br /><font class="litespeed-success">
<?php echo __( 'API', 'litespeed-cache' ); ?>:
<?php echo sprintf( __( 'Append query string %s to the resources to bypass this action.', 'litespeed-cache' ), '<code>&_litespeed_rm_qs=0</code>' ); ?>
</font>
</div>
</td>
</tr>
<tr>
<th>
<?php $id = Base::O_OPTM_GGFONTS_ASYNC; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_switch( $id ); ?>
<div class="litespeed-desc">
<?php echo __( 'Use Web Font Loader library to load Google Fonts asynchronously while leaving other CSS intact.', 'litespeed-cache' ); ?>
<?php echo __( 'This will also add a preconnect to Google Fonts to establish a connection earlier.', 'litespeed-cache' ); ?>
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/pageopt/#load-google-fonts-asynchronously' ); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $id = Base::O_OPTM_GGFONTS_RM; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_switch( $id ); ?>
<div class="litespeed-desc">
<?php echo __( 'Prevent Google Fonts from loading on all pages.', 'litespeed-cache' ); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $id = Base::O_OPTM_EMOJI_RM; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_switch( $id ); ?>
<div class="litespeed-desc">
<?php echo __( 'Stop loading WordPress.org emoji. Browser default emoji will be displayed instead.', 'litespeed-cache' ); ?>
<?php echo __( 'This can improve your speed score in services like Pingdom, GTmetrix and PageSpeed.', 'litespeed-cache' ); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $id = Base::O_OPTM_NOSCRIPT_RM; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_switch( $id ); ?>
<div class="litespeed-desc">
<?php echo sprintf( __( 'This option will remove all %s tags from HTML.', 'litespeed-cache' ), '<code>&lt;noscript&gt;</code>' ); ?>
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/pageopt/#remove-noscript-tags' ); ?>
</div>
</td>
</tr>
</tbody></table>

View File

@ -0,0 +1,76 @@
<?php
namespace LiteSpeed;
defined( 'WPINC' ) || exit;
?>
<h3 class="litespeed-title-short">
<?php echo __( 'JS Settings', 'litespeed-cache' ); ?>
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/pageopt/#js-settings-tab' ); ?>
</h3>
<table class="wp-list-table striped litespeed-table"><tbody>
<tr>
<th>
<?php $id = Base::O_OPTM_JS_MIN; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_switch( $id ); ?>
<div class="litespeed-desc">
<?php echo __( 'Minify JS files and inline JS codes.', 'litespeed-cache' ); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $id = Base::O_OPTM_JS_COMB; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_switch( $id ); ?>
<div class="litespeed-desc">
<?php echo __( 'Combine all local JS files into a single file.', 'litespeed-cache' ); ?>
<a href="https://docs.litespeedtech.com/lscache/lscwp/ts-optimize/" target="_blank"><?php echo __( 'How to Fix Problems Caused by CSS/JS Optimization.', 'litespeed-cache' ); ?></a>
<br /><font class="litespeed-danger">
🚨 <?php echo __( 'This option may result in a JS error or layout issue on frontend pages with certain themes/plugins.', 'litespeed-cache' ); ?>
<?php echo __( 'JS error can be found from the developer console of browser by right clicking and choosing Inspect.', 'litespeed-cache' ); ?>
</font>
</div>
</td>
</tr>
<tr>
<th>
<?php $id = Base::O_OPTM_JS_COMB_EXT_INL; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_switch( $id ); ?>
<div class="litespeed-desc">
<?php echo sprintf( __( 'Include external JS and inline JS in combined file when %1$s is also enabled. This option helps maintain the priorities of JS execution, which should minimize potential errors caused by JS Combine.', 'litespeed-cache' ), '<code>' . Lang::title( Base::O_OPTM_JS_COMB ) . '</code>' ); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $id = Base::O_OPTM_JS_DEFER; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_switch( $id, array( __( 'OFF', 'litespeed-cache' ), __( 'Deferred', 'litespeed-cache' ), __( 'Delayed', 'litespeed-cache' ) ) ); ?>
<div class="litespeed-desc">
<?php echo __( 'Deferring until page is parsed or delaying till interaction can help reduce resource contention and improve performance causing a lower FID (Core Web Vitals metric).', 'litespeed-cache' ); ?>
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/pageopt/#load-js-deferred' ); ?><br />
<?php echo __( 'This can improve your speed score in services like Pingdom, GTmetrix and PageSpeed.', 'litespeed-cache' ); ?>
<?php Doc::learn_more( 'https://web.dev/fid/#what-is-fid' ); ?>
<br /><font class="litespeed-danger">
🚨 <?php echo __( 'This option may result in a JS error or layout issue on frontend pages with certain themes/plugins.', 'litespeed-cache' ); ?>
</font>
</div>
</td>
</tr>
</tbody></table>

View File

@ -0,0 +1,131 @@
<?php
namespace LiteSpeed;
defined( 'WPINC' ) || exit;
$last_generated = Avatar::get_summary();
$avatar_queue = Avatar::cls()->queue_count();
?>
<?php if ( $this->cls( 'Avatar' )->need_db() && ! $this->cls( 'Data' )->tb_exist( 'avatar' ) ) : ?>
<div class="litespeed-callout notice notice-error inline">
<h4><?php echo __( 'WARNING', 'litespeed-cache' ); ?></h4>
<p><?php echo sprintf( __( 'Failed to create Avatar table. Please follow <a %s>Table Creation guidance from LiteSpeed Wiki</a> to finish setup.', 'litespeed-cache' ), 'href="https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp:installation" target="_blank"' ); ?></p>
</div>
<?php endif; ?>
<h3 class="litespeed-title-short">
<?php echo __( 'Localization Settings', 'litespeed-cache' ); ?>
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/pageopt/#localization-settings-tab' ); ?>
</h3>
<table class="wp-list-table striped litespeed-table"><tbody>
<tr>
<th>
<?php $id = Base::O_DISCUSS_AVATAR_CACHE; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_switch( $id ); ?>
<div class="litespeed-desc">
<?php echo __( 'Store Gravatar locally.', 'litespeed-cache' ); ?>
<?php echo __( 'Accelerates the speed by caching Gravatar (Globally Recognized Avatars).', 'litespeed-cache' ); ?>
</div>
</td>
</tr>
<tr>
<th class="litespeed-padding-left">
<?php $id = Base::O_DISCUSS_AVATAR_CRON; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_switch( $id ); ?>
<div class="litespeed-desc">
<?php echo __( 'Refresh Gravatar cache by cron.', 'litespeed-cache' ); ?>
</div>
<?php if ( $last_generated ) : ?>
<div class="litespeed-desc">
<?php if ( ! empty( $last_generated[ 'last_request' ] ) ) : ?>
<p>
<?php echo __( 'Last ran', 'litespeed-cache' ) . ': <code>' . Utility::readable_time( $last_generated[ 'last_request' ] ) . '</code>'; ?>
</p>
<?php endif; ?>
<?php if ( $avatar_queue ) : ?>
<div class="litespeed-callout notice notice-warning inline">
<h4>
<?php echo __( 'Avatar list in queue waiting for update','litespeed-cache' ); ?>:
<?php echo $avatar_queue; ?>
</h4>
</div>
<a href="<?php echo Utility::build_url( Router::ACTION_AVATAR, Avatar::TYPE_GENERATE ); ?>" class="button litespeed-btn-success">
<?php echo __( 'Run Queue Manually', 'litespeed-cache' ); ?>
</a>
<?php endif; ?>
</div>
<?php endif; ?>
</td>
</tr>
<tr>
<th class="litespeed-padding-left">
<?php $id = Base::O_DISCUSS_AVATAR_CACHE_TTL; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_input( $id ); ?> <?php $this->readable_seconds(); ?>
<div class="litespeed-desc">
<?php echo __( 'Specify how long, in seconds, Gravatar files are cached.', 'litespeed-cache' ); ?>
<?php $this->recommended( $id ); ?>
<?php $this->_validate_ttl( $id, 3600 ); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $id = Base::O_OPTM_LOCALIZE; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_switch( $id ); ?>
<div class="litespeed-desc">
<?php echo __( 'Localize external resources.', 'litespeed-cache' ); ?>
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/pageopt/#localize' ); ?>
</div>
</td>
</tr>
<tr>
<th class="litespeed-padding-left">
<?php $id = Base::O_OPTM_LOCALIZE_DOMAINS; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<div class="litespeed-textarea-recommended">
<div>
<?php $this->build_textarea( $id ); ?>
</div>
<div>
<?php $this->recommended( $id, true ); ?>
</div>
</div>
<div class="litespeed-desc">
<?php echo __( 'Resources listed here will be copied and replaced with local URLs.', 'litespeed-cache' ); ?>
<?php echo __( 'HTTPS sources only.', 'litespeed-cache' ); ?>
<?php Doc::one_per_line(); ?>
<br /><?php echo sprintf( __( 'Comments are supported. Start a line with a %s to turn it into a comment line.', 'litespeed-cache' ), '<code>#</code>' ); ?>
<br /><?php echo __( 'Non-`.js` file extensions will be ignored.', 'litespeed-cache' ); ?>
<?php echo __( 'Example', 'litespeed-cache' ); ?>: <code>https://www.example.com/one.js</code>
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/pageopt/#localization-files' ); ?>
</div>
</td>
</tr>
</tbody></table>

View File

@ -0,0 +1,234 @@
<?php
namespace LiteSpeed;
defined( 'WPINC' ) || exit;
$placeholder_summary = Placeholder::get_summary();
$closest_server = Cloud::get_summary( 'server.' . Cloud::SVC_LQIP );
$lqip_queue = $this->load_queue( 'lqip' );
?>
<h3 class="litespeed-title-short">
<?php echo __( 'Media Settings', 'litespeed-cache' ); ?>
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/pageopt/#media-settings-tab' ); ?>
</h3>
<table class="wp-list-table striped litespeed-table"><tbody>
<tr>
<th>
<?php $id = Base::O_MEDIA_LAZY; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_switch( $id ); ?>
<div class="litespeed-desc">
<?php echo __( 'Load images only when they enter the viewport.', 'litespeed-cache' ); ?>
<?php echo __( 'This can improve page loading time by reducing initial HTTP requests.', 'litespeed-cache' ); ?>
<br /><font class="litespeed-success">
💡
<a href="https://docs.litespeedtech.com/lscache/lscwp/pageopt/#lazy-load-images" target="_blank"><?php echo __('Adding Style to Your Lazy-Loaded Images', 'litespeed-cache'); ?></a>
</font>
</div>
</td>
</tr>
<tr>
<th>
<?php $id = Base::O_MEDIA_LAZY_PLACEHOLDER; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_input( $id, 'litespeed-input-long' ); ?>
<div class="litespeed-desc">
<?php echo __( 'Specify a base64 image to be used as a simple placeholder while images finish loading.', 'litespeed-cache' ); ?>
<br /><?php echo sprintf( __( 'This can be predefined in %2$s as well using constant %1$s, with this setting taking priority.', 'litespeed-cache' ), '<code>LITESPEED_PLACEHOLDER</code>', '<code>wp-config.php</code>' ); ?>
<br /><?php echo sprintf( __( 'By default a gray image placeholder %s will be used.', 'litespeed-cache' ), '<code>data:image/gif;base64,R0lGODdhAQABAPAAAMPDwwAAACwAAAAAAQABAAACAkQBADs=</code>' ); ?>
<br /><?php echo sprintf( __( 'For example, %s can be used for a transparent placeholder.', 'litespeed-cache' ), '<code>data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7</code>' ); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $id = Base::O_MEDIA_PLACEHOLDER_RESP; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_switch( $id ); ?>
<div class="litespeed-desc">
<?php echo __( 'Responsive image placeholders can help to reduce layout reshuffle when images are loaded.', 'litespeed-cache' ); ?>
<?php echo __( 'This will generate the placeholder with same dimensions as the image if it has the width and height attributes.', 'litespeed-cache' ); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $id = Base::O_MEDIA_PLACEHOLDER_RESP_SVG; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_input( $id, 'litespeed-input-long' ); ?>
<div class="litespeed-desc">
<?php echo __( 'Specify an SVG to be used as a placeholder when generating locally.', 'litespeed-cache' ); ?>
<?php echo __( 'It will be converted to a base64 SVG placeholder on-the-fly.', 'litespeed-cache' ); ?>
<br /><?php echo sprintf( __( 'Variables %s will be replaced with the corresponding image properties.', 'litespeed-cache' ), '<code>{width} {height}</code>' ); ?>
<br /><?php echo sprintf( __( 'Variables %s will be replaced with the configured background color.', 'litespeed-cache' ), '<code>{color}</code>' ); ?>
<br /><?php $this->recommended( $id ); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $id = Base::O_MEDIA_PLACEHOLDER_RESP_COLOR; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_input( $id, null, null, 'color' ); ?>
<div class="litespeed-desc">
<?php echo __( 'Specify the responsive placeholder SVG color.', 'litespeed-cache' ); ?>
<?php $this->recommended( $id ); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $id = Base::O_MEDIA_LQIP; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_switch( $id ); ?>
<div class="litespeed-desc">
<?php echo __( 'Use QUIC.cloud LQIP (Low Quality Image Placeholder) generator service for responsive image previews while loading.', 'litespeed-cache' ); ?>
<br /><?php echo __( 'Keep this off to use plain color placeholders.', 'litespeed-cache' ); ?>
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/pageopt/#lqip-cloud-generator' ); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $id = Base::O_MEDIA_LQIP_QUAL; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_input( $id, 'litespeed-input-short' ); ?>
<div class="litespeed-desc">
<?php echo __( 'Specify the quality when generating LQIP.', 'litespeed-cache' ); ?>
<br /><?php echo __( 'Larger number will generate higher resolution quality placeholder, but will result in larger files which will increase page size and consume more points.', 'litespeed-cache' ); ?>
<?php $this->recommended( $id ); ?>
<?php $this->_validate_ttl( $id, 1, 20 ); ?>
<br />💡 <?php echo sprintf(__('Changes to this setting do not apply to already-generated LQIPs. To regenerate existing LQIPs, please %s first from the admin bar menu.', 'litespeed-cache'), '<code>' . __( 'Purge All', 'litespeed-cache' ) . ' - ' . __( 'LQIP Cache', 'litespeed-cache' ) . '</code>'); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $id = Base::O_MEDIA_LQIP_MIN_W; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_input( $id, 'litespeed-input-short' ); ?> x
<?php $this->build_input( Base::O_MEDIA_LQIP_MIN_H, 'litespeed-input-short' ); ?>
<?php echo __( 'pixels', 'litespeed-cache' ); ?>
<div class="litespeed-desc">
<?php echo __( 'LQIP requests will not be sent for images where both width and height are smaller than these dimensions.', 'litespeed-cache' ); ?>
<?php $this->recommended( $id ); ?>
<?php $this->_validate_ttl( $id, 10, 800 ); ?>
<?php $this->_validate_ttl( Base::O_MEDIA_LQIP_MIN_H, 10, 800 ); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $id = Base::O_MEDIA_PLACEHOLDER_RESP_ASYNC; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_switch( $id ); ?>
<div class="litespeed-desc">
<?php echo __( 'Automatically generate LQIP in the background via a cron-based queue.', 'litespeed-cache' ); ?>
<?php echo sprintf(
__( 'If set to %1$s, before the placeholder is localized, the %2$s configuration will be used.', 'litespeed-cache' ),
'<code>' . __('ON', 'litespeed-cache') . '</code>',
'<code>' . Lang::title( Base::O_MEDIA_PLACEHOLDER_RESP_SVG ) . '</code>'
); ?>
<?php echo sprintf( __( 'If set to %s this is done in the foreground, which may slow down page load.', 'litespeed-cache' ), '<code>' . __('OFF', 'litespeed-cache') . '</code>' ); ?>
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/pageopt/#generate-lqip-in-background' ); ?>
</div>
<div class="litespeed-desc">
<?php if ( $placeholder_summary ) : ?>
<?php if ( ! empty( $placeholder_summary[ 'last_request' ] ) ) : ?>
<p>
<?php echo __( 'Last generated', 'litespeed-cache' ) . ': <code>' . Utility::readable_time( $placeholder_summary[ 'last_request' ] ) . '</code>'; ?>
</p>
<?php endif; ?>
<?php endif; ?>
<?php if ( $closest_server ) : ?>
<a href="<?php echo Utility::build_url( Router::ACTION_CLOUD, Cloud::TYPE_REDETECT_CLOUD, false, null, array( 'svc' => Cloud::SVC_LQIP ) ); ?>" data-balloon-pos="up" data-balloon-break aria-label='<?php echo sprintf( __( 'Current closest Cloud server is %s.&#10; Click to redetect.', 'litespeed-cache' ), $closest_server ); ?>' data-litespeed-cfm="<?php echo __( 'Are you sure you want to redetect the closest cloud server for this service?', 'litespeed-cache' ) ; ?>"><i class='litespeed-quic-icon'></i></a>
<?php endif; ?>
<?php if ( ! empty( $lqip_queue ) ) : ?>
<div class="litespeed-callout notice notice-warning inline">
<h4>
<?php echo __( 'Size list in queue waiting for cron','litespeed-cache' ); ?> ( <?php echo count( $lqip_queue ); ?> )
<a href="<?php echo Utility::build_url( Router::ACTION_PLACEHOLDER, Placeholder::TYPE_CLEAR_Q ); ?>" class="button litespeed-btn-warning litespeed-right">Clear</a>
</h4>
<p>
<?php $i=0; foreach ( $lqip_queue as $k => $v ) : ?>
<?php if ( $i++ > 20 ) : ?>
<?php echo '...'; ?>
<?php break; ?>
<?php endif; ?>
<?php echo $v; ?>
<br />
<?php endforeach; ?>
</p>
</div>
<a href="<?php echo Utility::build_url( Router::ACTION_PLACEHOLDER, Placeholder::TYPE_GENERATE ); ?>" class="button litespeed-btn-success">
<?php echo __( 'Run Queue Manually', 'litespeed-cache' ); ?>
</a>
<?php endif; ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $id = Base::O_MEDIA_IFRAME_LAZY; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_switch( $id ); ?>
<div class="litespeed-desc">
<?php echo __( 'Load iframes only when they enter the viewport.', 'litespeed-cache' ); ?>
<?php echo __( 'This can improve page loading time by reducing initial HTTP requests.', 'litespeed-cache' ); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $id = Base::O_MEDIA_ADD_MISSING_SIZES; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_switch( $id ); ?>
<div class="litespeed-desc">
<?php echo __( 'Set an explicit width and height on image elements to reduce layout shifts and improve CLS (a Core Web Vitals metric).', 'litespeed-cache' ); ?>
<?php Doc::learn_more( 'https://web.dev/optimize-cls/#images-without-dimensions' ); ?>
<br /><?php echo sprintf( __( 'Note: this option only works when %1$s is %2$s.', 'litespeed-cache' ), '<code>' . Lang::title( Base::O_MEDIA_LAZY ) . '</code>', '<code>' . __( 'ON', 'litespeed-cache' ) . '</code>' ); ?>
</div>
</td>
</tr>
</tbody></table>

View File

@ -0,0 +1,128 @@
<?php
namespace LiteSpeed;
defined( 'WPINC' ) || exit;
?>
<h3 class="litespeed-title-short">
<?php echo __( 'Media Excludes', 'litespeed-cache' ); ?>
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/pageopt/#media-excludes-tab' ); ?>
</h3>
<table class="wp-list-table striped litespeed-table"><tbody>
<tr>
<th>
<?php $id = Base::O_MEDIA_LAZY_EXC; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_textarea( $id ); ?>
<div class="litespeed-desc">
<?php echo __( 'Listed images will not be lazy loaded.', 'litespeed-cache' ); ?>
<?php Doc::full_or_partial_url(); ?>
<?php Doc::one_per_line(); ?>
<br /><?php echo __( 'Useful for above-the-fold images causing CLS (a Core Web Vitals metric).', 'litespeed-cache' ); ?>
<br /><font class="litespeed-success">
<?php echo __( 'API', 'litespeed-cache' ); ?>:
<?php echo sprintf( __( 'Filter %s is supported.', 'litespeed-cache' ), '<code>litespeed_media_lazy_img_excludes</code>' ); ?>
<?php echo sprintf( __( 'Elements with attribute %s in html code will be excluded.', 'litespeed-cache' ), '<code>data-no-lazy="1"</code>' ); ?>
</font>
</div>
</td>
</tr>
<tr>
<th>
<?php $id = Base::O_MEDIA_LAZY_CLS_EXC; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<div class="litespeed-textarea-recommended">
<div>
<?php $this->build_textarea( $id ); ?>
</div>
<div>
<?php $this->recommended( $id ); ?>
</div>
</div>
<div class="litespeed-desc">
<?php echo __( 'Images containing these class names will not be lazy loaded.', 'litespeed-cache' ); ?>
<?php Doc::full_or_partial_url( true ); ?>
<?php Doc::one_per_line(); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $id = Base::O_MEDIA_LAZY_PARENT_CLS_EXC; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_textarea( $id ); ?>
<div class="litespeed-desc">
<?php echo __( 'Images having these parent class names will not be lazy loaded.', 'litespeed-cache' ); ?>
<?php Doc::one_per_line(); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $id = Base::O_MEDIA_IFRAME_LAZY_CLS_EXC; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_textarea( $id ); ?>
<div class="litespeed-desc">
<?php echo __( 'Iframes containing these class names will not be lazy loaded.', 'litespeed-cache' ); ?>
<?php Doc::full_or_partial_url( true ); ?>
<?php Doc::one_per_line(); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $id = Base::O_MEDIA_IFRAME_LAZY_PARENT_CLS_EXC; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_textarea( $id ); ?>
<div class="litespeed-desc">
<?php echo __( 'Iframes having these parent class names will not be lazy loaded.', 'litespeed-cache' ); ?>
<?php Doc::one_per_line(); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $id = Base::O_MEDIA_LAZY_URI_EXC; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_textarea( $id ); ?>
<div class="litespeed-desc">
<?php echo __( 'Prevent any lazy load of listed pages.', 'litespeed-cache' ); ?>
<?php $this->_uri_usage_example(); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $id = Base::O_MEDIA_LQIP_EXC; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_textarea( $id ); ?>
<div class="litespeed-desc">
<?php echo __( 'These images will not generate LQIP.', 'litespeed-cache' ); ?>
<?php Doc::full_or_partial_url(); ?>
</div>
</td>
</tr>
</tbody></table>

View File

@ -0,0 +1,239 @@
<?php
namespace LiteSpeed;
defined( 'WPINC' ) || exit;
global $wp_roles;
if ( !isset( $wp_roles ) ) {
$wp_roles = new \WP_Roles();
}
$roles = array();
foreach ( $wp_roles->roles as $k => $v ) {
$roles[ $k ] = $v[ 'name' ];
}
ksort( $roles );
?>
<h3 class="litespeed-title-short">
<?php echo __( 'Tuning Settings', 'litespeed-cache' ); ?>
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/pageopt/#tuning-settings-tab' ); ?>
</h3>
<table class="wp-list-table striped litespeed-table"><tbody>
<tr>
<th>
<?php $id = Base::O_OPTM_CSS_EXC; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_textarea( $id ); ?>
<div class="litespeed-desc">
<?php echo __( 'Listed CSS files or inline CSS code will not be minified/combined.', 'litespeed-cache' ); ?>
<?php Doc::full_or_partial_url(); ?>
<?php Doc::one_per_line(); ?>
<br /><font class="litespeed-success">
<?php echo __( 'API', 'litespeed-cache' ); ?>:
<?php echo sprintf( __( 'Filter %s is supported.', 'litespeed-cache' ), '<code>litespeed_optimize_css_excludes</code>' ); ?>
<?php echo sprintf( __( 'Elements with attribute %s in html code will be excluded.', 'litespeed-cache' ), '<code>data-no-optimize="1"</code>' ); ?>
<br /><?php echo __( 'Predefined list will also be combined w/ the above settings', 'litespeed-cache' ); ?>: <a href="https://github.com/litespeedtech/lscache_wp/blob/dev/data/css_excludes.txt" target="_blank">https://github.com/litespeedtech/lscache_wp/blob/dev/data/css_excludes.txt</a>
</font>
</div>
</td>
</tr>
<tr>
<th>
<?php $id = Base::O_OPTM_JS_EXC; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_textarea( $id ); ?>
<div class="litespeed-desc">
<?php echo __( 'Listed JS files or inline JS code will not be minified/combined.', 'litespeed-cache' ); ?>
<?php Doc::full_or_partial_url(); ?>
<?php Doc::one_per_line(); ?>
<br /><font class="litespeed-success">
<?php echo __( 'API', 'litespeed-cache' ); ?>:
<?php echo sprintf( __( 'Filter %s is supported.', 'litespeed-cache' ), '<code>litespeed_optimize_js_excludes</code>' ); ?>
<?php echo sprintf( __( 'Elements with attribute %s in html code will be excluded.', 'litespeed-cache' ), '<code>data-no-optimize="1"</code>' ); ?>
<br /><?php echo __( 'Predefined list will also be combined w/ the above settings', 'litespeed-cache' ); ?>: <a href="https://github.com/litespeedtech/lscache_wp/blob/dev/data/js_excludes.txt" target="_blank">https://github.com/litespeedtech/lscache_wp/blob/dev/data/js_excludes.txt</a>
</font>
</div>
</td>
</tr>
<tr>
<th>
<?php $id = Base::O_OPTM_UCSS_WHITELIST; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_textarea( $id ); ?>
<div class="litespeed-desc">
<?php echo __( 'List the CSS selector that its style should be always contained in UCSS.', 'litespeed-cache' ); ?>
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/pageopt/#ucss-whitelist', __( 'How to choose an UCSS allowlist selector?', 'litespeed-cache' ) ); ?>
<br /><?php echo sprintf( __( 'Wildcard %s supported.', 'litespeed-cache' ), '<code>*</code>' ); ?>
<div class="litespeed-callout notice notice-warning inline">
<h4><?php echo __( 'Note', 'litespeed-cache' ); ?></h4>
<p>
<?php echo __( 'The selector must exist in the CSS. Parent classes in the HTML will not work.', 'litespeed-cache' ); ?>
</p>
</div>
<font class="litespeed-success">
<?php echo __( 'Predefined list will also be combined w/ the above settings', 'litespeed-cache' ); ?>: <a href="https://github.com/litespeedtech/lscache_wp/blob/dev/data/ucss_whitelist.txt" target="_blank">https://github.com/litespeedtech/lscache_wp/blob/dev/data/ucss_whitelist.txt</a>
</font>
</div>
</td>
</tr>
<tr>
<th>
<?php $id = Base::O_OPTM_UCSS_EXC; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_textarea( $id ); ?>
<div class="litespeed-desc">
<?php echo __( 'Listed URI will not generate UCSS.', 'litespeed-cache' ); ?>
<?php Doc::full_or_partial_url(); ?>
<?php Doc::one_per_line(); ?>
<br /><span class="litespeed-success">
<?php echo __( 'API', 'litespeed-cache' ); ?>:
<?php echo sprintf( __( 'Filter %s is supported.', 'litespeed-cache' ), '<code>litespeed_ucss_exc</code>' ); ?>
</span>
<br /><font class="litespeed-success">API: <?php echo sprintf( __( 'Use %1$s to generate one single UCSS for the pages which page type is %2$s while other page types still per URL.', 'litespeed-cache' ), "<code>add_filter( 'litespeed_ucss_per_pagetype', function(){return get_post_type() == 'page';} );</code>", '<code>page</code>' ); ?></font>
<br /><font class="litespeed-success">API: <?php echo sprintf( __( 'Use %1$s to bypass UCSS for the pages which page type is %2$s.', 'litespeed-cache' ), "<code>add_action( 'litespeed_optm', function(){get_post_type() == 'page' && do_action( 'litespeed_conf_force', 'optm-ucss', false );});</code>", '<code>page</code>' ); ?></font>
</div>
</td>
</tr>
<tr>
<th>
<?php $id = Base::O_OPTM_CCSS_SEP_POSTTYPE; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_textarea( $id ); ?>
<div class="litespeed-desc">
<?php echo __('List post types where each item of that type should have its own CCSS generated.', 'litespeed-cache'); ?>
<?php echo sprintf( __( 'For example, if every Page on the site has different formatting, enter %s in the box. Separate critical CSS files will be stored for every Page on the site.', 'litespeed-cache' ), '<code>page</code>' ); ?>
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/pageopt/#separate-ccss-cache-post-types_1' ); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $id = Base::O_OPTM_CCSS_SEP_URI; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_textarea( $id ); ?>
<div class="litespeed-desc">
<?php echo __( 'Separate critical CSS files will be generated for paths containing these strings.', 'litespeed-cache' ); ?>
<?php $this->_uri_usage_example(); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $id = Base::O_OPTM_CCSS_CON; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_textarea( $id ); ?>
<div class="litespeed-desc">
<?php echo sprintf( __( 'Specify critical CSS rules for above-the-fold content when enabling %s.', 'litespeed-cache' ), __( 'Load CSS Asynchronously', 'litespeed-cache' ) ); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $id = Base::O_OPTM_JS_DEFER_EXC; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_textarea( $id ); ?>
<div class="litespeed-desc">
<?php echo __( 'Listed JS files or inline JS code will not be deferred.', 'litespeed-cache' ); ?>
<?php Doc::full_or_partial_url(); ?>
<?php Doc::one_per_line(); ?>
<br /><span class="litespeed-success">
<?php echo __( 'API', 'litespeed-cache' ); ?>:
<?php echo sprintf( __( 'Filter %s is supported.', 'litespeed-cache' ), '<code>litespeed_optm_js_defer_exc</code>' ); ?>
<?php echo sprintf( __( 'Elements with attribute %s in html code will be excluded.', 'litespeed-cache' ), '<code>data-no-defer="1"</code>' ); ?>
<br /><?php echo __( 'Predefined list will also be combined w/ the above settings', 'litespeed-cache' ); ?>: <a href="https://github.com/litespeedtech/lscache_wp/blob/dev/data/js_defer_excludes.txt" target="_blank">https://github.com/litespeedtech/lscache_wp/blob/dev/data/js_defer_excludes.txt</a>
</span>
</div>
</td>
</tr>
<tr>
<th>
<?php $id = Base::O_OPTM_GM_JS_EXC; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_textarea( $id ); ?>
<div class="litespeed-desc">
<?php echo sprintf( __( 'Listed JS files or inline JS code will not be optimized by %s.', 'litespeed-cache' ), '<code>' . Lang::title( Base::O_GUEST ) . '</code>' ); ?>
<?php Doc::full_or_partial_url(); ?>
<?php Doc::one_per_line(); ?>
<br /><span class="litespeed-success">
<?php echo __( 'API', 'litespeed-cache' ); ?>:
<?php echo sprintf( __( 'Filter %s is supported.', 'litespeed-cache' ), '<code>litespeed_optm_gm_js_exc</code>' ); ?>
<?php echo sprintf( __( 'Elements with attribute %s in html code will be excluded.', 'litespeed-cache' ), '<code>data-no-defer="1"</code>' ); ?>
</span>
</div>
</td>
</tr>
<tr>
<th>
<?php $id = Base::O_OPTM_EXC; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_textarea( $id ); ?>
<div class="litespeed-desc">
<?php echo __( 'Prevent any optimization of listed pages.', 'litespeed-cache' ); ?>
<?php $this->_uri_usage_example(); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $id = Base::O_OPTM_GUEST_ONLY; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_switch( $id ); ?>
<div class="litespeed-desc">
<?php echo __( 'Only optimize pages for guest (not logged in) visitors. If turned this OFF, CSS/JS/CCSS files will be doubled by each user group.', 'litespeed-cache' ); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $id = Base::O_OPTM_EXC_ROLES; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<div class="litespeed-desc">
<?php echo __( 'Selected roles will be excluded from all optimizations.', 'litespeed-cache' ); ?>
</div>
<div class="litespeed-tick-list">
<?php foreach ( $roles as $role => $title ): ?>
<?php $this->build_checkbox( $id . '[]', $title, $this->cls( 'Conf' )->in_optm_exc_roles( $role ), $role ); ?>
<?php endforeach; ?>
</div>
</td>
</tr>
</tbody></table>