Initial commit: Atomaste website

This commit is contained in:
2025-12-10 12:17:30 -05:00
commit 0b9e5d1605
19260 changed files with 5206382 additions and 0 deletions

View File

@@ -0,0 +1,67 @@
<?php
/**
* LiteSpeed Cache Page Optimization Interface
*
* Renders the page optimization settings interface for LiteSpeed Cache with tabbed navigation.
*
* @package LiteSpeed
* @since 1.0.0
*/
namespace LiteSpeed;
defined( 'WPINC' ) || exit;
$menu_list = array(
'settings_css' => esc_html__( 'CSS Settings', 'litespeed-cache' ),
'settings_js' => esc_html__( 'JS Settings', 'litespeed-cache' ),
'settings_html' => esc_html__( 'HTML Settings', 'litespeed-cache' ),
'settings_media' => esc_html__( 'Media Settings', 'litespeed-cache' ),
'settings_vpi' => esc_html__( 'VPI', 'litespeed-cache' ),
'settings_media_exc' => esc_html__( 'Media Excludes', 'litespeed-cache' ),
'settings_localization' => esc_html__( 'Localization', 'litespeed-cache' ),
'settings_tuning' => esc_html__( 'Tuning', 'litespeed-cache' ),
'settings_tuning_css' => esc_html__( 'Tuning', 'litespeed-cache' ) . ' - CSS',
);
?>
<div class="wrap">
<h1 class="litespeed-h1">
<?php esc_html_e( 'LiteSpeed Cache Page Optimization', 'litespeed-cache' ); ?>
</h1>
<span class="litespeed-desc">
v<?php echo esc_html( Core::VER ); ?>
</span>
<hr class="wp-header-end">
</div>
<div class="litespeed-wrap">
<div class="litespeed-callout notice notice-warning inline">
<h4><?php esc_html_e( 'NOTICE', 'litespeed-cache' ); ?></h4>
<p><?php esc_html_e( '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 GUI::display_tab_list( $menu_list ); ?>
</h2>
<div class="litespeed-body">
<?php
$this->form_action();
// Include all tpl for faster UE
foreach ( $menu_list as $tab_key => $tab_val ) {
?>
<div data-litespeed-layout='<?php echo esc_attr( $tab_key ); ?>'>
<?php require LSCWP_DIR . 'tpl/page_optm/' . $tab_key . '.tpl.php'; ?>
</div>
<?php
}
$this->form_end();
?>
</div>
</div>

View File

@@ -0,0 +1,346 @@
<?php
/**
* LiteSpeed Cache CSS Settings
*
* Renders the CSS optimization settings interface for LiteSpeed Cache.
*
* @package LiteSpeed
* @since 1.0.0
*/
namespace LiteSpeed;
defined( 'WPINC' ) || exit;
$__admin_display = Admin_Display::cls();
$css_summary = CSS::get_summary();
$ucss_summary = UCSS::get_summary();
$closest_server_ucss = Cloud::get_summary( 'server.' . Cloud::SVC_UCSS );
$closest_server = Cloud::get_summary( 'server.' . Cloud::SVC_CCSS );
$ccss_queue = $this->load_queue( 'ccss' );
$ucss_queue = $this->load_queue( 'ucss' );
$next_gen = '<code class="litespeed-success">' . $this->cls( 'Media' )->next_gen_image_title() . '</code>';
$ucss_service_hot = $this->cls( 'Cloud' )->service_hot( Cloud::SVC_UCSS );
$ccss_service_hot = $this->cls( 'Cloud' )->service_hot( Cloud::SVC_CCSS );
?>
<h3 class="litespeed-title-short">
<?php esc_html_e( '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 $option_id = Base::O_OPTM_CSS_MIN; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_switch( $option_id ); ?>
<?php Doc::maybe_on_by_gm( $option_id ); ?>
<div class="litespeed-desc">
<?php esc_html_e( 'Minify CSS files and inline CSS code.', 'litespeed-cache' ); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $option_id = Base::O_OPTM_CSS_COMB; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_switch( $option_id ); ?>
<?php Doc::maybe_on_by_gm( $option_id ); ?>
<div class="litespeed-desc">
<?php esc_html_e( 'Combine CSS files and inline CSS code.', 'litespeed-cache' ); ?>
<a href="https://docs.litespeedtech.com/lscache/lscwp/ts-optimize/" target="_blank"><?php esc_html_e( 'How to Fix Problems Caused by CSS/JS Optimization.', 'litespeed-cache' ); ?></a>
</div>
</td>
</tr>
<tr>
<th class="litespeed-padding-left">
<?php $option_id = Base::O_OPTM_UCSS; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_switch( $option_id ); ?>
<?php Doc::maybe_on_by_gm( $option_id ); ?>
<div class="litespeed-desc">
<?php if ( ! $this->cls( 'Cloud' )->activated() ) : ?>
<div class="litespeed-callout notice notice-error inline">
<h4><?php esc_html_e( 'WARNING', 'litespeed-cache' ); ?></h4>
<?php echo wp_kses_post( Error::msg( 'qc_setup_required' ) ); ?>
</div>
<?php endif; ?>
<?php esc_html_e( 'Use QUIC.cloud online service to generate unique CSS.', 'litespeed-cache' ); ?>
<?php esc_html_e( '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 esc_html_e( 'Automatic generation of unique CSS is in the background via a cron-based queue.', 'litespeed-cache' ); ?>
<br />
<font class="litespeed-success"><?php esc_html_e( 'API', 'litespeed-cache' ); ?>: <?php printf( esc_html__( 'Filter %s available for UCSS per page type generation.', 'litespeed-cache' ), '<code>add_filter( "litespeed_ucss_per_pagetype", "__return_true" );</code>' ); ?></font>
<?php $__admin_display->_check_overwritten( 'optm-ucss_per_pagetype' ); ?>
<?php if ( $this->conf( Base::O_OPTM_UCSS ) && ! $this->conf( Base::O_OPTM_CSS_COMB ) ) : ?>
<br />
<font class="litespeed-warning">
<?php printf( esc_html__( 'This option is bypassed because %1$s option is %2$s.', 'litespeed-cache' ), '<code>' . esc_html( Lang::title( Base::O_OPTM_CSS_COMB ) ) . '</code>', '<code>' . esc_html__( 'OFF', 'litespeed-cache' ) . '</code>' ); ?>
</font>
<?php endif; ?>
</div>
<div class="litespeed-desc litespeed-left20">
<?php if ( $ucss_summary ) : ?>
<?php if ( ! empty( $ucss_summary['last_request'] ) ) : ?>
<p>
<?php echo esc_html__( 'Last generated', 'litespeed-cache' ) . ': <code>' . esc_html( Utility::readable_time( $ucss_summary['last_request'] ) ) . '</code>'; ?>
</p>
<p>
<?php echo esc_html__( 'Last requested cost', 'litespeed-cache' ) . ': <code>' . esc_html( $ucss_summary['last_spent'] ) . 's</code>'; ?>
</p>
<?php endif; ?>
<?php endif; ?>
<?php if ( $closest_server_ucss ) : ?>
<a class="litespeed-redetect" href="<?php echo esc_url( Utility::build_url( Router::ACTION_CLOUD, Cloud::TYPE_REDETECT_CLOUD, false, null, array( 'svc' => Cloud::SVC_UCSS ) ) ); ?>" data-balloon-pos="up" data-balloon-break aria-label="<?php printf( esc_html__( 'Current closest Cloud server is %s. Click to redetect.', 'litespeed-cache' ), esc_html( $closest_server_ucss ) ); ?>" data-litespeed-cfm="<?php esc_html_e( 'Are you sure you want to redetect the closest cloud server for this service?', 'litespeed-cache' ); ?>"><i class="litespeed-quic-icon"></i> <?php esc_html_e( 'Redetect', 'litespeed-cache' ); ?></a>
<?php endif; ?>
<?php if ( ! empty( $ucss_queue ) ) : ?>
<div class="litespeed-callout notice notice-warning inline">
<h4>
<?php printf( esc_html__( 'URL list in %s queue waiting for cron', 'litespeed-cache' ), 'UCSS' ); ?> ( <?php echo esc_html( count( $ucss_queue ) ); ?> )
<a href="<?php echo esc_url( Utility::build_url( Router::ACTION_UCSS, UCSS::TYPE_CLEAR_Q ) ); ?>" class="button litespeed-btn-warning litespeed-right"><?php esc_html_e( 'Clear', 'litespeed-cache' ); ?></a>
</h4>
<p>
<?php
$i = 0;
foreach ( $ucss_queue as $queue_key => $queue_val ) :
if ( $i++ > 20 ) :
echo '...';
break;
endif;
if ( ! is_array( $queue_val ) ) {
continue;
}
if ( ! empty( $queue_val['_status'] ) ) {
echo '<span class="litespeed-success">';
}
echo esc_html( $queue_val['url'] );
if ( ! empty( $queue_val['_status'] ) ) {
echo '</span>';
}
$pos = strpos( $queue_key, ' ' );
if ( $pos ) {
echo ' (' . esc_html__( 'Vary Group', 'litespeed-cache' ) . ':' . esc_html( substr( $queue_key, 0, $pos ) ) . ')';
}
if ( $queue_val['is_mobile'] ) {
echo ' <span data-balloon-pos="up" aria-label="mobile">📱</span>';
}
if ( ! empty( $queue_val['is_webp'] ) ) {
echo ' ' . wp_kses_post( $next_gen );
}
echo '<br />';
endforeach;
?>
</p>
</div>
<?php if ( $ucss_service_hot ) : ?>
<button class="button button-secondary" disabled>
<?php printf( esc_html__( 'Run %s Queue Manually', 'litespeed-cache' ), 'UCSS' ); ?>
- <?php printf( esc_html__( 'Available after %d second(s)', 'litespeed-cache' ), esc_html( $ucss_service_hot ) ); ?>
</button>
<?php else : ?>
<a href="<?php echo esc_url( Utility::build_url( Router::ACTION_UCSS, UCSS::TYPE_GEN ) ); ?>" class="button litespeed-btn-success">
<?php printf( esc_html__( 'Run %s Queue Manually', 'litespeed-cache' ), 'UCSS' ); ?>
</a>
<?php endif; ?>
<?php Doc::queue_issues(); ?>
<?php endif; ?>
</div>
</td>
</tr>
<tr>
<th class="litespeed-padding-left">
<?php $option_id = Base::O_OPTM_UCSS_INLINE; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_switch( $option_id ); ?>
<?php Doc::maybe_on_by_gm( $option_id ); ?>
<div class="litespeed-desc">
<?php printf( esc_html__( '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>' . esc_html( Lang::title( Base::O_GUEST ) ) . '</code>' ); ?>
<br />
<font class="litespeed-info">
<?php printf( esc_html__( 'This option will automatically bypass %s option.', 'litespeed-cache' ), '<code>' . esc_html( Lang::title( Base::O_OPTM_CSS_ASYNC ) ) . '</code>' ); ?>
</font>
</div>
</td>
</tr>
<tr>
<th>
<?php $option_id = Base::O_OPTM_CSS_COMB_EXT_INL; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_switch( $option_id ); ?>
<div class="litespeed-desc">
<?php printf( esc_html__( '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>' . esc_html( Lang::title( Base::O_OPTM_CSS_COMB ) ) . '</code>' ); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $option_id = Base::O_OPTM_CSS_ASYNC; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_switch( $option_id ); ?>
<?php Doc::maybe_on_by_gm( $option_id ); ?>
<div class="litespeed-desc">
<?php if ( ! $this->cls( 'Cloud' )->activated() ) : ?>
<div class="litespeed-callout notice notice-error inline">
<h4><?php esc_html_e( 'WARNING', 'litespeed-cache' ); ?></h4>
<?php echo wp_kses_post( Error::msg( 'qc_setup_required' ) ); ?>
</div>
<?php endif; ?>
<?php esc_html_e( 'Optimize CSS delivery.', 'litespeed-cache' ); ?>
<?php esc_html_e( 'This can improve your speed score in services like Pingdom, GTmetrix and PageSpeed.', 'litespeed-cache' ); ?><br />
<?php esc_html_e( '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 esc_html_e( 'Automatic generation of critical CSS is in the background via a cron-based queue.', 'litespeed-cache' ); ?><br />
<?php printf( esc_html__( 'When this option is turned %s, it will also load Google Fonts asynchronously.', 'litespeed-cache' ), '<code>' . esc_html__( 'ON', 'litespeed-cache' ) . '</code>' ); ?>
<br />
<font class="litespeed-success">
<?php esc_html_e( 'API', 'litespeed-cache' ); ?>:
<?php printf( esc_html__( '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 printf( esc_html__( 'This option is bypassed due to %s option.', 'litespeed-cache' ), '<code>' . esc_html( 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 esc_html__( 'Last generated', 'litespeed-cache' ) . ': <code>' . esc_html( Utility::readable_time( $css_summary['last_request_ccss'] ) ) . '</code>'; ?>
</p>
<p>
<?php echo esc_html__( 'Last requested cost', 'litespeed-cache' ) . ': <code>' . esc_html( $css_summary['last_spent_ccss'] ) . 's</code>'; ?>
</p>
<?php endif; ?>
<?php endif; ?>
<?php if ( $closest_server ) : ?>
<a class="litespeed-redetect" href="<?php echo esc_url( 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 printf( esc_html__( 'Current closest Cloud server is %s. Click to redetect.', 'litespeed-cache' ), esc_html( $closest_server ) ); ?>" data-litespeed-cfm="<?php esc_html_e( 'Are you sure you want to redetect the closest cloud server for this service?', 'litespeed-cache' ); ?>"><i class="litespeed-quic-icon"></i> <?php esc_html_e( 'Redetect', 'litespeed-cache' ); ?></a>
<?php endif; ?>
<?php if ( ! empty( $ccss_queue ) ) : ?>
<div class="litespeed-callout notice notice-warning inline">
<h4>
<?php printf( esc_html__( 'URL list in %s queue waiting for cron', 'litespeed-cache' ), 'CCSS' ); ?> ( <?php echo esc_html( count( $ccss_queue ) ); ?> )
<a href="<?php echo esc_url( Utility::build_url( Router::ACTION_CSS, CSS::TYPE_CLEAR_Q_CCSS ) ); ?>" class="button litespeed-btn-warning litespeed-right"><?php esc_html_e( 'Clear', 'litespeed-cache' ); ?></a>
</h4>
<p>
<?php
$i = 0;
foreach ( $ccss_queue as $queue_key => $queue_val ) :
if ( $i++ > 20 ) :
echo '...';
break;
endif;
if ( ! is_array( $queue_val ) ) {
continue;
}
if ( ! empty( $queue_val['_status'] ) ) {
echo '<span class="litespeed-success">';
}
echo esc_html( $queue_val['url'] );
if ( ! empty( $queue_val['_status'] ) ) {
echo '</span>';
}
$pos = strpos( $queue_key, ' ' );
if ( $pos ) {
echo ' (' . esc_html__( 'Vary Group', 'litespeed-cache' ) . ':' . esc_html( substr( $queue_key, 0, $pos ) ) . ')';
}
if ( $queue_val['is_mobile'] ) {
echo ' <span data-balloon-pos="up" aria-label="mobile">📱</span>';
}
if ( ! empty( $queue_val['is_webp'] ) ) {
echo ' ' . wp_kses_post( $next_gen );
}
echo '<br />';
endforeach;
?>
</p>
</div>
<?php if ( $ccss_service_hot ) : ?>
<button class="button button-secondary" disabled>
<?php printf( esc_html__( 'Run %s Queue Manually', 'litespeed-cache' ), 'CCSS' ); ?>
- <?php printf( esc_html__( 'Available after %d second(s)', 'litespeed-cache' ), esc_html( $ccss_service_hot ) ); ?>
</button>
<?php else : ?>
<a href="<?php echo esc_url( Utility::build_url( Router::ACTION_CSS, CSS::TYPE_GEN_CCSS ) ); ?>" class="button litespeed-btn-success">
<?php printf( esc_html__( 'Run %s Queue Manually', 'litespeed-cache' ), 'CCSS' ); ?>
</a>
<?php endif; ?>
<?php Doc::queue_issues(); ?>
<?php endif; ?>
</div>
</td>
</tr>
<tr>
<th class="litespeed-padding-left">
<?php $option_id = Base::O_OPTM_CCSS_PER_URL; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_switch( $option_id ); ?>
<div class="litespeed-desc">
<?php esc_html_e( '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 $option_id = Base::O_OPTM_CSS_ASYNC_INLINE; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_switch( $option_id ); ?>
<div class="litespeed-desc">
<?php esc_html_e( 'This will inline the asynchronous CSS library to avoid render blocking.', 'litespeed-cache' ); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $option_id = Base::O_OPTM_CSS_FONT_DISPLAY; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_switch( $option_id, array( esc_html__( 'Default', 'litespeed-cache' ), 'Swap' ) ); ?>
<div class="litespeed-desc">
<?php printf( esc_html__( '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 printf( esc_html__( '%s is recommended.', 'litespeed-cache' ), '<code>' . esc_html__( 'Swap', 'litespeed-cache' ) . '</code>' ); ?>
</div>
</td>
</tr>
</tbody>
</table>

View File

@@ -0,0 +1,195 @@
<?php
/**
* LiteSpeed Cache HTML Settings
*
* Renders the HTML optimization settings interface for LiteSpeed Cache.
*
* @package LiteSpeed
* @since 1.0.0
*/
namespace LiteSpeed;
defined( 'WPINC' ) || exit;
?>
<h3 class="litespeed-title-short">
<?php esc_html_e( '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 $option_id = Base::O_OPTM_HTML_MIN; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_switch( $option_id ); ?>
<div class="litespeed-desc">
<?php esc_html_e( 'Minify HTML content.', 'litespeed-cache' ); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $option_id = Base::O_OPTM_DNS_PREFETCH; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_textarea( $option_id ); ?>
<div class="litespeed-desc">
<?php esc_html_e( 'Prefetching DNS can reduce latency for visitors.', 'litespeed-cache' ); ?>
<?php esc_html_e( '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 $option_id = Base::O_OPTM_DNS_PREFETCH_CTRL; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_switch( $option_id ); ?>
<div class="litespeed-desc">
<?php esc_html_e( 'Automatically enable DNS prefetching for all URLs in the document, including images, CSS, JavaScript, and so forth.', 'litespeed-cache' ); ?>
<?php esc_html_e( '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 $option_id = Base::O_OPTM_DNS_PRECONNECT; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_textarea( $option_id ); ?>
<div class="litespeed-desc">
<?php esc_html_e( 'Preconnecting speeds up future loads from a given origin.', 'litespeed-cache' ); ?>
<?php esc_html_e( 'For example', 'litespeed-cache' ); ?>: <code>https://example.com</code>
<?php Doc::one_per_line(); ?>
<?php Doc::learn_more( 'https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel/preconnect' ); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $option_id = Base::O_OPTM_HTML_LAZY; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_textarea( $option_id ); ?>
<div class="litespeed-desc">
<?php esc_html_e( '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 $option_id = Base::O_OPTM_HTML_SKIP_COMMENTS; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_textarea( $option_id ); ?>
<div class="litespeed-desc">
<?php esc_html_e( 'When minifying HTML do not discard comments that match a specified pattern.', 'litespeed-cache' ); ?>
<br />
<?php printf( esc_html__( 'If comment to be kept is like: %1$s write: %2$s', 'litespeed-cache' ), '<code>&lt;!-- A comment that needs to be here --&gt;</code>', '<code>A comment that needs to be here</code>' ); ?>
<br />
<?php Doc::one_per_line(); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $option_id = Base::O_OPTM_QS_RM; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_switch( $option_id ); ?>
<div class="litespeed-desc">
<?php esc_html_e( 'Remove query strings from internal static resources.', 'litespeed-cache' ); ?>
<br />
<font class="litespeed-warning">
⚠️
<?php esc_html_e( 'Google reCAPTCHA will be bypassed automatically.', 'litespeed-cache' ); ?>
</font>
<br />
<font class="litespeed-success">
<?php esc_html_e( 'API', 'litespeed-cache' ); ?>:
<?php printf( esc_html__( 'Append query string %s to the resources to bypass this action.', 'litespeed-cache' ), '<code>&amp;_litespeed_rm_qs=0</code>' ); ?>
</font>
</div>
</td>
</tr>
<tr>
<th>
<?php $option_id = Base::O_OPTM_GGFONTS_ASYNC; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_switch( $option_id ); ?>
<div class="litespeed-desc">
<?php esc_html_e( 'Use Web Font Loader library to load Google Fonts asynchronously while leaving other CSS intact.', 'litespeed-cache' ); ?>
<?php esc_html_e( '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 $option_id = Base::O_OPTM_GGFONTS_RM; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_switch( $option_id ); ?>
<div class="litespeed-desc">
<?php esc_html_e( 'Prevent Google Fonts from loading on all pages.', 'litespeed-cache' ); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $option_id = Base::O_OPTM_EMOJI_RM; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_switch( $option_id ); ?>
<div class="litespeed-desc">
<?php esc_html_e( 'Stop loading WordPress.org emoji. Browser default emoji will be displayed instead.', 'litespeed-cache' ); ?>
<?php esc_html_e( 'This can improve your speed score in services like Pingdom, GTmetrix and PageSpeed.', 'litespeed-cache' ); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $option_id = Base::O_OPTM_NOSCRIPT_RM; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_switch( $option_id ); ?>
<div class="litespeed-desc">
<?php printf( esc_html__( '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,92 @@
<?php
/**
* LiteSpeed Cache JS Settings
*
* Renders the JS optimization settings interface for LiteSpeed Cache.
*
* @package LiteSpeed
* @since 1.0.0
*/
namespace LiteSpeed;
defined( 'WPINC' ) || exit;
?>
<h3 class="litespeed-title-short">
<?php esc_html_e( '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 $option_id = Base::O_OPTM_JS_MIN; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_switch( $option_id ); ?>
<?php Doc::maybe_on_by_gm( $option_id ); ?>
<div class="litespeed-desc">
<?php esc_html_e( 'Minify JS files and inline JS codes.', 'litespeed-cache' ); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $option_id = Base::O_OPTM_JS_COMB; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_switch( $option_id ); ?>
<?php Doc::maybe_on_by_gm( $option_id ); ?>
<div class="litespeed-desc">
<?php esc_html_e( 'Combine all local JS files into a single file.', 'litespeed-cache' ); ?>
<a href="https://docs.litespeedtech.com/lscache/lscwp/ts-optimize/" target="_blank"><?php esc_html_e( 'How to Fix Problems Caused by CSS/JS Optimization.', 'litespeed-cache' ); ?></a>
<br />
<font class="litespeed-danger">
🚨 <?php esc_html_e( 'This option may result in a JS error or layout issue on frontend pages with certain themes/plugins.', 'litespeed-cache' ); ?>
<?php esc_html_e( '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 $option_id = Base::O_OPTM_JS_COMB_EXT_INL; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_switch( $option_id ); ?>
<div class="litespeed-desc">
<?php printf( esc_html__( '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>' . esc_html( Lang::title( Base::O_OPTM_JS_COMB ) ) . '</code>' ); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $option_id = Base::O_OPTM_JS_DEFER; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_switch( $option_id, array( esc_html__( 'OFF', 'litespeed-cache' ), esc_html__( 'Deferred', 'litespeed-cache' ), esc_html__( 'Delayed', 'litespeed-cache' ) ) ); ?>
<div class="litespeed-desc">
<?php esc_html_e( '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 esc_html_e( '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 esc_html_e( '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,147 @@
<?php
/**
* LiteSpeed Cache Localization Settings
*
* Renders the localization settings interface for LiteSpeed Cache, including Gravatar caching and resource localization.
*
* @package LiteSpeed
* @since 1.0.0
*/
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 esc_html_e( 'WARNING', 'litespeed-cache' ); ?></h4>
<p><?php printf( esc_html__( '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 esc_html_e( '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 $option_id = Base::O_DISCUSS_AVATAR_CACHE; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_switch( $option_id ); ?>
<div class="litespeed-desc">
<?php esc_html_e( 'Store Gravatar locally.', 'litespeed-cache' ); ?>
<?php esc_html_e( 'Accelerates the speed by caching Gravatar (Globally Recognized Avatars).', 'litespeed-cache' ); ?>
</div>
</td>
</tr>
<tr>
<th class="litespeed-padding-left">
<?php $option_id = Base::O_DISCUSS_AVATAR_CRON; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_switch( $option_id ); ?>
<div class="litespeed-desc">
<?php esc_html_e( '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 esc_html__( 'Last ran', 'litespeed-cache' ) . ': <code>' . esc_html( 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 esc_html__( 'Avatar list in queue waiting for update', 'litespeed-cache' ); ?>:
<?php echo esc_html( $avatar_queue ); ?>
</h4>
</div>
<a href="<?php echo esc_url( Utility::build_url( Router::ACTION_AVATAR, Avatar::TYPE_GENERATE ) ); ?>" class="button litespeed-btn-success">
<?php esc_html_e( 'Run Queue Manually', 'litespeed-cache' ); ?>
</a>
<?php endif; ?>
</div>
<?php endif; ?>
</td>
</tr>
<tr>
<th class="litespeed-padding-left">
<?php $option_id = Base::O_DISCUSS_AVATAR_CACHE_TTL; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_input( $option_id ); ?> <?php $this->readable_seconds(); ?>
<div class="litespeed-desc">
<?php esc_html_e( 'Specify how long, in seconds, Gravatar files are cached.', 'litespeed-cache' ); ?>
<?php $this->recommended( $option_id ); ?>
<?php $this->_validate_ttl( $option_id, 3600 ); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $option_id = Base::O_OPTM_LOCALIZE; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_switch( $option_id ); ?>
<div class="litespeed-desc">
<?php esc_html_e( 'Localize external resources.', 'litespeed-cache' ); ?>
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/pageopt/#localize' ); ?>
<br /><font class="litespeed-danger">
🚨 <?php printf( esc_html__( 'Please thoroughly test all items in %s to ensure they function as expected.', 'litespeed-cache' ), '<code>' . esc_html( Lang::title( Base::O_OPTM_LOCALIZE_DOMAINS ) ) . '</code>' ); ?>
</font>
</div>
</td>
</tr>
<tr>
<th class="litespeed-padding-left">
<?php $option_id = Base::O_OPTM_LOCALIZE_DOMAINS; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<div class="litespeed-textarea-recommended">
<div>
<?php $this->build_textarea( $option_id ); ?>
</div>
<div>
<?php $this->recommended( $option_id, true ); ?>
</div>
</div>
<div class="litespeed-desc">
<?php esc_html_e( 'Resources listed here will be copied and replaced with local URLs.', 'litespeed-cache' ); ?>
<?php esc_html_e( 'HTTPS sources only.', 'litespeed-cache' ); ?>
<?php Doc::one_per_line(); ?>
<br /><?php printf( esc_html__( 'Comments are supported. Start a line with a %s to turn it into a comment line.', 'litespeed-cache' ), '<code>#</code>' ); ?>
<br /><?php esc_html_e( 'Example', 'litespeed-cache' ); ?>: <code>https://www.example.com/one.js</code>
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/pageopt/#localization-files' ); ?>
<br /><font class="litespeed-danger">
🚨 <?php esc_html_e( 'Please thoroughly test each JS file you add to ensure it functions as expected.', 'litespeed-cache' ); ?>
</font>
</div>
</td>
</tr>
</tbody></table>

View File

@@ -0,0 +1,314 @@
<?php
/**
* LiteSpeed Cache Media Settings
*
* Renders the media settings interface for LiteSpeed Cache, including lazy loading, placeholders, and image optimization options.
*
* @package LiteSpeed
* @since 1.0.0
*/
namespace LiteSpeed;
defined( 'WPINC' ) || exit;
$__admin_display = Admin_Display::cls();
$placeholder_summary = Placeholder::get_summary();
$closest_server = Cloud::get_summary( 'server.' . Cloud::SVC_LQIP );
$lqip_queue = $this->load_queue( 'lqip' );
$scaled_size = apply_filters( 'big_image_size_threshold', 2560, [], '', 0 ) . 'px';
?>
<h3 class="litespeed-title-short">
<?php esc_html_e( '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 $option_id = Base::O_MEDIA_LAZY; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_switch( $option_id ); ?>
<div class="litespeed-desc">
<?php esc_html_e( 'Load images only when they enter the viewport.', 'litespeed-cache' ); ?>
<?php esc_html_e( '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 esc_html_e( 'Adding Style to Your Lazy-Loaded Images', 'litespeed-cache' ); ?></a>
</font>
</div>
</td>
</tr>
<tr>
<th>
<?php $option_id = Base::O_MEDIA_LAZY_PLACEHOLDER; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_input( $option_id, 'litespeed-input-long' ); ?>
<div class="litespeed-desc">
<?php esc_html_e( 'Specify a base64 image to be used as a simple placeholder while images finish loading.', 'litespeed-cache' ); ?>
<br /><?php printf( esc_html__( '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 printf( esc_html__( 'By default a gray image placeholder %s will be used.', 'litespeed-cache' ), '<code>data:image/gif;base64,R0lGODdhAQABAPAAAMPDwwAAACwAAAAAAQABAAACAkQBADs=</code>' ); ?>
<br /><?php printf( esc_html__( '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 $option_id = Base::O_MEDIA_PLACEHOLDER_RESP; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_switch( $option_id ); ?>
<?php Doc::maybe_on_by_gm( $option_id ); ?>
<div class="litespeed-desc">
<?php esc_html_e( 'Responsive image placeholders can help to reduce layout reshuffle when images are loaded.', 'litespeed-cache' ); ?>
<?php esc_html_e( '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 $option_id = Base::O_MEDIA_PLACEHOLDER_RESP_SVG; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_input( $option_id, 'litespeed-input-long' ); ?>
<div class="litespeed-desc">
<?php esc_html_e( 'Specify an SVG to be used as a placeholder when generating locally.', 'litespeed-cache' ); ?>
<?php esc_html_e( 'It will be converted to a base64 SVG placeholder on-the-fly.', 'litespeed-cache' ); ?>
<br /><?php printf( esc_html__( 'Variables %s will be replaced with the corresponding image properties.', 'litespeed-cache' ), '<code>{width} {height}</code>' ); ?>
<br /><?php printf( esc_html__( 'Variables %s will be replaced with the configured background color.', 'litespeed-cache' ), '<code>{color}</code>' ); ?>
<br /><?php $this->recommended( $option_id ); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $option_id = Base::O_MEDIA_PLACEHOLDER_RESP_COLOR; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_input( $option_id, null, null, 'color' ); ?>
<div class="litespeed-desc">
<?php esc_html_e( 'Specify the responsive placeholder SVG color.', 'litespeed-cache' ); ?>
<?php $this->recommended( $option_id ); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $option_id = Base::O_MEDIA_LQIP; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_switch( $option_id ); ?>
<?php Doc::maybe_on_by_gm( $option_id ); ?>
<div class="litespeed-desc">
<?php esc_html_e( 'Use QUIC.cloud LQIP (Low Quality Image Placeholder) generator service for responsive image previews while loading.', 'litespeed-cache' ); ?>
<br /><?php esc_html_e( '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 $option_id = Base::O_MEDIA_LQIP_QUAL; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_input( $option_id, 'litespeed-input-short' ); ?>
<div class="litespeed-desc">
<?php esc_html_e( 'Specify the quality when generating LQIP.', 'litespeed-cache' ); ?>
<br /><?php esc_html_e( '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( $option_id ); ?>
<?php $this->_validate_ttl( $option_id, 1, 20 ); ?>
<br />💡 <?php printf( esc_html__( '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>' . esc_html__( 'Purge All', 'litespeed-cache' ) . ' - ' . esc_html__( 'LQIP Cache', 'litespeed-cache' ) . '</code>' ); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $option_id = Base::O_MEDIA_LQIP_MIN_W; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_input( $option_id, 'litespeed-input-short' ); ?> x
<?php $this->build_input( Base::O_MEDIA_LQIP_MIN_H, 'litespeed-input-short' ); ?>
<?php esc_html_e( 'pixels', 'litespeed-cache' ); ?>
<div class="litespeed-desc">
<?php esc_html_e( 'LQIP requests will not be sent for images where both width and height are smaller than these dimensions.', 'litespeed-cache' ); ?>
<?php $this->recommended( $option_id ); ?>
<?php $this->_validate_ttl( $option_id, 10, 800 ); ?>
<?php $this->_validate_ttl( Base::O_MEDIA_LQIP_MIN_H, 10, 800 ); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $option_id = Base::O_MEDIA_PLACEHOLDER_RESP_ASYNC; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_switch( $option_id ); ?>
<div class="litespeed-desc">
<?php esc_html_e( 'Automatically generate LQIP in the background via a cron-based queue.', 'litespeed-cache' ); ?>
<?php
printf(
esc_html__( 'If set to %1$s, before the placeholder is localized, the %2$s configuration will be used.', 'litespeed-cache' ),
'<code>' . esc_html__( 'ON', 'litespeed-cache' ) . '</code>',
'<code>' . esc_html( Lang::title( Base::O_MEDIA_PLACEHOLDER_RESP_SVG ) ) . '</code>'
);
?>
<?php printf( esc_html__( 'If set to %s this is done in the foreground, which may slow down page load.', 'litespeed-cache' ), '<code>' . esc_html__( '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 esc_html__( 'Last generated', 'litespeed-cache' ) . ': <code>' . esc_html( Utility::readable_time( $placeholder_summary['last_request'] ) ) . '</code>'; ?>
</p>
<?php endif; ?>
<?php endif; ?>
<?php if ( $closest_server ) : ?>
<a class="litespeed-redetect" href="<?php echo esc_url( 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 printf( esc_html__( 'Current closest Cloud server is %s. Click to redetect.', 'litespeed-cache' ), esc_html( $closest_server ) ); ?>' data-litespeed-cfm="<?php esc_html_e( 'Are you sure you want to redetect the closest cloud server for this service?', 'litespeed-cache' ); ?>"><i class='litespeed-quic-icon'></i> <?php esc_html_e( 'Redetect', 'litespeed-cache' ); ?></a>
<?php endif; ?>
<?php if ( ! empty( $lqip_queue ) ) : ?>
<div class="litespeed-callout notice notice-warning inline">
<h4>
<?php esc_html_e( 'Size list in queue waiting for cron', 'litespeed-cache' ); ?> ( <?php echo esc_html( count( $lqip_queue ) ); ?> )
<a href="<?php echo esc_url( Utility::build_url( Router::ACTION_PLACEHOLDER, Placeholder::TYPE_CLEAR_Q ) ); ?>" class="button litespeed-btn-warning litespeed-right"><?php esc_html_e( 'Clear', 'litespeed-cache' ); ?></a>
</h4>
<p>
<?php
$i = 0;
foreach ( $lqip_queue as $k => $v ) {
if ( $i++ > 20 ) {
echo '...';
break;
}
echo esc_html( $v );
echo '<br />';
}
?>
</p>
</div>
<a href="<?php echo esc_url( Utility::build_url( Router::ACTION_PLACEHOLDER, Placeholder::TYPE_GENERATE ) ); ?>" class="button litespeed-btn-success">
<?php esc_html_e( 'Run Queue Manually', 'litespeed-cache' ); ?>
</a>
<?php Doc::queue_issues(); ?>
<?php endif; ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $option_id = Base::O_MEDIA_IFRAME_LAZY; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_switch( $option_id ); ?>
<div class="litespeed-desc">
<?php esc_html_e( 'Load iframes only when they enter the viewport.', 'litespeed-cache' ); ?>
<?php esc_html_e( 'This can improve page loading time by reducing initial HTTP requests.', 'litespeed-cache' ); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $option_id = Base::O_MEDIA_ADD_MISSING_SIZES; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_switch( $option_id ); ?>
<div class="litespeed-desc">
<?php esc_html_e( '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 />
<font class="litespeed-warning litespeed-left10">
⚠️ <?php esc_html_e( 'Notice', 'litespeed-cache' ); ?>: <?php printf( esc_html__( '%s must be turned ON for this setting to work.', 'litespeed-cache' ), '<code>' . esc_html( Lang::title( Base::O_MEDIA_LAZY ) ) . '</code>' ); ?>
</font>
<br />
<font class="litespeed-success">
<?php esc_html_e( 'API', 'litespeed-cache' ); ?>:
<?php printf( esc_html__( 'Use %1$s to bypass remote image dimension check when %2$s is ON.', 'litespeed-cache' ), '<code>add_filter( "litespeed_media_ignore_remote_missing_sizes", "__return_true" );</code>', '<code>' . esc_html( Lang::title( Base::O_MEDIA_ADD_MISSING_SIZES ) ) . '</code>' ); ?>
</font>
<?php $__admin_display->_check_overwritten( Base::O_MEDIA_ADD_MISSING_SIZES ); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $option_id = Base::O_IMG_OPTM_JPG_QUALITY; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_input( $option_id, 'litespeed-input-short' ); ?>
<div class="litespeed-desc">
<?php esc_html_e( 'The image compression quality setting of WordPress out of 100.', 'litespeed-cache' ); ?>
<?php $this->recommended( $option_id ); ?>
<?php $this->_validate_ttl( $option_id, 0, 100 ); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $option_id = Base::O_MEDIA_AUTO_RESCALE_ORI; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_switch( $option_id ); ?>
<div class="litespeed-desc">
<?php esc_html_e( 'Automatically replace large images with scaled versions.', 'litespeed-cache' ); ?>
<?php esc_html_e( 'Scaled size threshold', 'litespeed-cache' ); ?>: <code><?php echo wp_kses_post( $scaled_size ); ?></code>
<br />
<span class="litespeed-success">
API:
<?php
printf(
esc_html__( 'Filter %s available to change threshold.', 'litespeed-cache' ),
'<code>big_image_size_threshold</code>'
);
?>
<a href="https://developer.wordpress.org/reference/hooks/big_image_size_threshold/" target="_blank" class="litespeed-learn-more">
<?php esc_html_e('Learn More', 'litespeed-cache'); ?>
</a>
</span>
<br />
<font class="litespeed-danger">
🚨
<?php esc_html_e( 'This is irreversible.', 'litespeed-cache' ); ?>
</font>
</div>
</td>
</tr>
</tbody>
</table>

View File

@@ -0,0 +1,138 @@
<?php
/**
* LiteSpeed Cache Media Excludes Settings
*
* Renders the media excludes settings interface for LiteSpeed Cache, allowing configuration of exclusions for lazy loading and LQIP.
*
* @package LiteSpeed
* @since 1.0.0
*/
namespace LiteSpeed;
defined( 'WPINC' ) || exit;
?>
<h3 class="litespeed-title-short">
<?php esc_html_e( '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 $option_id = Base::O_MEDIA_LAZY_EXC; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_textarea( $option_id ); ?>
<div class="litespeed-desc">
<?php esc_html_e( 'Listed images will not be lazy loaded.', 'litespeed-cache' ); ?>
<?php Doc::full_or_partial_url(); ?>
<?php Doc::one_per_line(); ?>
<br /><?php esc_html_e( 'Useful for above-the-fold images causing CLS (a Core Web Vitals metric).', 'litespeed-cache' ); ?>
<br /><font class="litespeed-success">
<?php esc_html_e( 'API', 'litespeed-cache' ); ?>:
<?php printf( esc_html__( 'Filter %s is supported.', 'litespeed-cache' ), '<code>litespeed_media_lazy_img_excludes</code>' ); ?>
<?php printf( esc_html__( '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 $option_id = Base::O_MEDIA_LAZY_CLS_EXC; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<div class="litespeed-textarea-recommended">
<div>
<?php $this->build_textarea( $option_id ); ?>
</div>
<div>
<?php $this->recommended( $option_id ); ?>
</div>
</div>
<div class="litespeed-desc">
<?php esc_html_e( '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 $option_id = Base::O_MEDIA_LAZY_PARENT_CLS_EXC; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_textarea( $option_id ); ?>
<div class="litespeed-desc">
<?php esc_html_e( 'Images having these parent class names will not be lazy loaded.', 'litespeed-cache' ); ?>
<?php Doc::one_per_line(); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $option_id = Base::O_MEDIA_IFRAME_LAZY_CLS_EXC; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_textarea( $option_id ); ?>
<div class="litespeed-desc">
<?php esc_html_e( '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 $option_id = Base::O_MEDIA_IFRAME_LAZY_PARENT_CLS_EXC; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_textarea( $option_id ); ?>
<div class="litespeed-desc">
<?php esc_html_e( 'Iframes having these parent class names will not be lazy loaded.', 'litespeed-cache' ); ?>
<?php Doc::one_per_line(); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $option_id = Base::O_MEDIA_LAZY_URI_EXC; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_textarea( $option_id ); ?>
<div class="litespeed-desc">
<?php esc_html_e( 'Prevent any lazy load of listed pages.', 'litespeed-cache' ); ?>
<?php $this->_uri_usage_example(); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $option_id = Base::O_MEDIA_LQIP_EXC; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_textarea( $option_id ); ?>
<div class="litespeed-desc">
<?php esc_html_e( 'These images will not generate LQIP.', 'litespeed-cache' ); ?>
<?php Doc::full_or_partial_url(); ?>
</div>
</td>
</tr>
</tbody></table>

View File

@@ -0,0 +1,169 @@
<?php
/**
* LiteSpeed Cache Tuning Settings
*
* Renders the tuning settings interface for LiteSpeed Cache, allowing configuration of optimization exclusions and role-based settings.
*
* @package LiteSpeed
* @since 1.0.0
*/
namespace LiteSpeed;
defined( 'WPINC' ) || exit;
global $wp_roles;
$wp_orig_roles = $wp_roles;
if ( ! isset( $wp_roles ) ) {
$wp_orig_roles = new \WP_Roles();
}
$roles = array();
foreach ( $wp_orig_roles->roles as $k => $v ) {
$roles[ $k ] = $v['name'];
}
ksort( $roles );
?>
<h3 class="litespeed-title-short">
<?php esc_html_e( '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 $option_id = Base::O_OPTM_JS_DELAY_INC; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_textarea( $option_id ); ?>
<div class="litespeed-desc">
<?php esc_html_e( 'Listed JS files or inline JS code will be delayed.', 'litespeed-cache' ); ?>
<?php Doc::full_or_partial_url(); ?>
<?php Doc::one_per_line(); ?>
<br />
<font class="litespeed-success">
<?php esc_html_e( 'API', 'litespeed-cache' ); ?>:
<?php printf( esc_html__( 'Filter %s is supported.', 'litespeed-cache' ), '<code>litespeed_optm_js_delay_inc</code>' ); ?>
</font>
</div>
</td>
</tr>
<tr>
<th>
<?php $option_id = Base::O_OPTM_JS_EXC; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_textarea( $option_id ); ?>
<div class="litespeed-desc">
<?php esc_html_e( 'Listed JS files or inline JS code will not be minified or combined.', 'litespeed-cache' ); ?>
<?php Doc::full_or_partial_url(); ?>
<?php Doc::one_per_line(); ?>
<br />
<font class="litespeed-success">
<?php esc_html_e( 'API', 'litespeed-cache' ); ?>:
<?php printf( esc_html__( 'Filter %s is supported.', 'litespeed-cache' ), '<code>litespeed_optimize_js_excludes</code>' ); ?>
<?php printf( esc_html__( 'Elements with attribute %s in html code will be excluded.', 'litespeed-cache' ), '<code>data-no-optimize="1"</code>' ); ?>
<br /><?php esc_html_e( 'Predefined list will also be combined with 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 $option_id = Base::O_OPTM_JS_DEFER_EXC; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_textarea( $option_id ); ?>
<div class="litespeed-desc">
<?php esc_html_e( 'Listed JS files or inline JS code will not be deferred or delayed.', 'litespeed-cache' ); ?>
<?php Doc::full_or_partial_url(); ?>
<?php Doc::one_per_line(); ?>
<br /><span class="litespeed-success">
<?php esc_html_e( 'API', 'litespeed-cache' ); ?>:
<?php printf( esc_html__( 'Filter %s is supported.', 'litespeed-cache' ), '<code>litespeed_optm_js_defer_exc</code>' ); ?>
<?php printf( esc_html__( 'Elements with attribute %s in html code will be excluded.', 'litespeed-cache' ), '<code>data-no-defer="1"</code>' ); ?>
<br /><?php esc_html_e( 'Predefined list will also be combined with 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 $option_id = Base::O_OPTM_GM_JS_EXC; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_textarea( $option_id ); ?>
<div class="litespeed-desc">
<?php printf( esc_html__( 'Listed JS files or inline JS code will not be optimized by %s.', 'litespeed-cache' ), '<code>' . esc_html( Lang::title( Base::O_GUEST ) ) . '</code>' ); ?>
<?php Doc::full_or_partial_url(); ?>
<?php Doc::one_per_line(); ?>
<br /><span class="litespeed-success">
<?php esc_html_e( 'API', 'litespeed-cache' ); ?>:
<?php printf( esc_html__( 'Filter %s is supported.', 'litespeed-cache' ), '<code>litespeed_optm_gm_js_exc</code>' ); ?>
<?php printf( esc_html__( '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 $option_id = Base::O_OPTM_EXC; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_textarea( $option_id ); ?>
<div class="litespeed-desc">
<?php esc_html_e( 'Prevent any optimization of listed pages.', 'litespeed-cache' ); ?>
<?php $this->_uri_usage_example(); ?>
<br /><span class="litespeed-success">
<?php esc_html_e( 'API', 'litespeed-cache' ); ?>:
<?php printf( esc_html__( 'Filter %s is supported.', 'litespeed-cache' ), '<code>litespeed_optm_uri_exc</code>' ); ?>
</span>
</div>
</td>
</tr>
<tr>
<th>
<?php $option_id = Base::O_OPTM_GUEST_ONLY; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_switch( $option_id ); ?>
<div class="litespeed-desc">
<?php esc_html_e( '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 $option_id = Base::O_OPTM_EXC_ROLES; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<div class="litespeed-desc">
<?php esc_html_e( 'Selected roles will be excluded from all optimizations.', 'litespeed-cache' ); ?>
</div>
<div class="litespeed-tick-list">
<?php
foreach ( $roles as $role_id => $role_title ) {
$this->build_checkbox( $option_id . '[]', $role_title, $this->cls( 'Conf' )->in_optm_exc_roles( $role_id ), $role_id );
}
?>
</div>
</td>
</tr>
</tbody>
</table>

View File

@@ -0,0 +1,172 @@
<?php
/**
* LiteSpeed Cache Tuning CSS Settings
*
* Renders the Tuning CSS settings interface for LiteSpeed Cache, allowing configuration of CSS exclusions and optimizations.
*
* @package LiteSpeed
* @since 1.0.0
*/
namespace LiteSpeed;
defined( 'WPINC' ) || exit;
?>
<h3 class="litespeed-title-short">
<?php esc_html_e( 'Tuning CSS Settings', 'litespeed-cache' ); ?>
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/pageopt/#tuning-css-settings-tab' ); ?>
</h3>
<table class="wp-list-table striped litespeed-table">
<tbody>
<tr>
<th>
<?php $option_id = Base::O_OPTM_CSS_EXC; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_textarea( $option_id ); ?>
<div class="litespeed-desc">
<?php esc_html_e( 'Listed CSS files or inline CSS code will not be minified or combined.', 'litespeed-cache' ); ?>
<?php Doc::full_or_partial_url(); ?>
<?php Doc::one_per_line(); ?>
<br /><font class="litespeed-success">
<?php echo esc_html_e( 'API', 'litespeed-cache' ); ?>:
<?php printf( esc_html__( 'Filter %s is supported.', 'litespeed-cache' ), '<code>litespeed_optimize_css_excludes</code>' ); ?>
<?php printf( esc_html__( 'Elements with attribute %s in html code will be excluded.', 'litespeed-cache' ), '<code>data-no-optimize="1"</code>' ); ?>
<br /><?php echo esc_html_e( 'Predefined list will also be combined with 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 $option_id = Base::O_OPTM_UCSS_FILE_EXC_INLINE; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_textarea( $option_id ); ?>
<div class="litespeed-desc">
<?php esc_html_e( 'Listed CSS files will be excluded from UCSS and saved to inline.', 'litespeed-cache' ); ?>
<?php Doc::full_or_partial_url(); ?>
<?php Doc::one_per_line(); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $option_id = Base::O_OPTM_UCSS_SELECTOR_WHITELIST; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_textarea( $option_id ); ?>
<div class="litespeed-desc">
<?php esc_html_e( 'List the CSS selectors whose styles should always be included in UCSS.', 'litespeed-cache' ); ?>
<?php Doc::one_per_line(); ?>
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/pageopt/#ucss-selector-allowlist', esc_html__( 'Learn more', 'litespeed-cache' ) ); ?>.
<br /><?php printf( esc_html__( 'Wildcard %s supported.', 'litespeed-cache' ), '<code>*</code>' ); ?>
<div class="litespeed-callout notice notice-warning inline">
<h4><?php esc_html_e( 'Note', 'litespeed-cache' ); ?></h4>
<p>
<?php esc_html_e( 'The selector must exist in the CSS. Parent classes in the HTML will not work.', 'litespeed-cache' ); ?>
</p>
</div>
<font class="litespeed-success">
<?php esc_html_e( '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 $option_id = Base::O_OPTM_UCSS_EXC; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_textarea( $option_id ); ?>
<div class="litespeed-desc">
<?php esc_html_e( '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 esc_html_e( 'API', 'litespeed-cache' ); ?>:
<?php printf( esc_html__( 'Filter %s is supported.', 'litespeed-cache' ), '<code>litespeed_ucss_exc</code>' ); ?>
</span>
<br /><font class="litespeed-success"><?php esc_html_e( 'API', 'litespeed-cache' ); ?>: <?php printf( esc_html__( '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"><?php esc_html_e( 'API', 'litespeed-cache' ); ?>: <?php printf( esc_html__( '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 $option_id = Base::O_OPTM_CCSS_SEP_POSTTYPE; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_textarea( $option_id ); ?>
<div class="litespeed-desc">
<?php esc_html_e( 'List post types where each item of that type should have its own CCSS generated.', 'litespeed-cache' ); ?>
<?php printf( esc_html__( '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 $option_id = Base::O_OPTM_CCSS_SEP_URI; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_textarea( $option_id ); ?>
<div class="litespeed-desc">
<?php esc_html_e( '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 $option_id = Base::O_OPTM_CCSS_SELECTOR_WHITELIST; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_textarea( $option_id ); ?>
<div class="litespeed-desc">
<?php esc_html_e( 'List the CSS selectors whose styles should always be included in CCSS.', 'litespeed-cache' ); ?>
<?php Doc::one_per_line(); ?>
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/pageopt/#ccss-selector-allowlist', esc_html__( 'Learn more', 'litespeed-cache' ) ); ?>.
<br /><?php printf( esc_html__( 'Wildcard %s supported.', 'litespeed-cache' ), '<code>*</code>' ); ?>
<div class="litespeed-callout notice notice-warning inline">
<h4><?php esc_html_e( 'Note', 'litespeed-cache' ); ?></h4>
<p>
<?php esc_html_e( 'Selectors must exist in the CSS. Parent classes in the HTML will not work.', 'litespeed-cache' ); ?>
</p>
</div>
<font class="litespeed-success">
<?php esc_html_e( 'Predefined list will also be combined w/ the above settings', 'litespeed-cache' ); ?>: <a href="https://github.com/litespeedtech/lscache_wp/blob/dev/data/ccss_whitelist.txt" target="_blank">https://github.com/litespeedtech/lscache_wp/blob/dev/data/ccss_whitelist.txt</a>
</font>
</div>
</td>
</tr>
<tr>
<th>
<?php $option_id = Base::O_OPTM_CCSS_CON; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_textarea( $option_id ); ?>
<div class="litespeed-desc">
<?php printf( esc_html__( 'Specify critical CSS rules for above-the-fold content when enabling %s.', 'litespeed-cache' ), esc_html__( 'Load CSS Asynchronously', 'litespeed-cache' ) ); ?>
</div>
</td>
</tr>
</tbody></table>

View File

@@ -0,0 +1,127 @@
<?php
/**
* LiteSpeed Cache Viewport Images Settings
*
* Renders the Viewport Images settings interface for LiteSpeed Cache, allowing configuration of viewport image detection and exclusions.
*
* @package LiteSpeed
* @since 1.0.0
*/
namespace LiteSpeed;
defined( 'WPINC' ) || exit;
$summary = VPI::get_summary();
$closest_server = Cloud::get_summary( 'server.' . Cloud::SVC_VPI );
$queue = $this->load_queue( 'vpi' );
$vpi_service_hot = $this->cls( 'Cloud' )->service_hot( Cloud::SVC_VPI );
?>
<h3 class="litespeed-title-short">
<?php esc_html_e( 'Viewport Images', 'litespeed-cache' ); ?>
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/pageopt/#vpi-settings-tab' ); ?>
</h3>
<table class="wp-list-table striped litespeed-table">
<tbody>
<tr>
<th>
<?php $option_id = Base::O_MEDIA_VPI; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_switch( $option_id ); ?>
<div class="litespeed-desc">
<?php esc_html_e( 'When you use Lazy Load, it will delay the loading of all images on a page.', 'litespeed-cache' ); ?>
<br /><?php esc_html_e( 'The Viewport Images service detects which images appear above the fold, and excludes them from lazy load.', 'litespeed-cache' ); ?>
<br /><?php esc_html_e( "This enables the page's initial screenful of imagery to be fully displayed without delay.", 'litespeed-cache' ); ?>
<?php if ( ! $this->conf( Base::O_MEDIA_LAZY ) ) : ?>
<br />
<font class="litespeed-warning litespeed-left10">
⚠️ <?php esc_html_e( 'Notice', 'litespeed-cache' ); ?>: <?php printf( esc_html__( '%s must be turned ON for this setting to work.', 'litespeed-cache' ), '<code>' . esc_html( Lang::title( Base::O_MEDIA_LAZY ) ) . '</code>' ); ?>
</font>
<?php endif; ?>
</div>
<div class="litespeed-desc litespeed-left20">
<?php if ( $summary ) : ?>
<?php if ( ! empty( $summary['last_request'] ) ) : ?>
<p>
<?php echo esc_html__( 'Last generated', 'litespeed-cache' ) . ': <code>' . esc_html( Utility::readable_time( $summary['last_request'] ) ) . '</code>'; ?>
</p>
<?php endif; ?>
<?php endif; ?>
<?php if ( $closest_server ) : ?>
<a class='litespeed-redetect' href="<?php echo esc_url( Utility::build_url( Router::ACTION_CLOUD, Cloud::TYPE_REDETECT_CLOUD, false, null, array( 'svc' => Cloud::SVC_VPI ) ) ); ?>" data-balloon-pos="up" data-balloon-break aria-label='<?php printf( esc_html__( 'Current closest Cloud server is %s. Click to redetect.', 'litespeed-cache' ), esc_html( $closest_server ) ); ?>' data-litespeed-cfm="<?php esc_html_e( 'Are you sure you want to redetect the closest cloud server for this service?', 'litespeed-cache' ); ?>"><i class='litespeed-quic-icon'></i> <?php esc_html_e( 'Redetect', 'litespeed-cache' ); ?></a>
<?php endif; ?>
<?php if ( ! empty( $queue ) ) : ?>
<div class="litespeed-callout notice notice-warning inline">
<h4>
<?php printf( esc_html__( 'URL list in %s queue waiting for cron', 'litespeed-cache' ), 'VPI' ); ?> ( <?php echo esc_html( count( $queue ) ); ?> )
<a href="<?php echo esc_url( Utility::build_url( Router::ACTION_VPI, VPI::TYPE_CLEAR_Q ) ); ?>" class="button litespeed-btn-warning litespeed-right"><?php esc_html_e( 'Clear', 'litespeed-cache' ); ?></a>
</h4>
<p>
<?php
$i = 0;
foreach ( $queue as $k => $v ) {
if ( $i++ > 20 ) {
echo '...';
break;
}
if ( ! is_array( $v ) ) {
continue;
}
if ( ! empty( $v['_status'] ) ) {
echo '<span class="litespeed-success">';
}
echo esc_html( $v['url'] );
if ( ! empty( $v['_status'] ) ) {
echo '</span>';
}
$pos = strpos( $k, ' ' );
if ( $pos ) {
echo ' (' . esc_html__( 'Vary Group', 'litespeed-cache' ) . ':' . esc_html( substr( $k, 0, $pos ) ) . ')';
}
if ( $v['is_mobile'] ) {
echo ' <span data-balloon-pos="up" aria-label="mobile">📱</span>';
}
echo '<br />';
}
?>
</p>
</div>
<?php if ( $vpi_service_hot ) : ?>
<button class="button button-secondary" disabled>
<?php printf( esc_html__( 'Run %s Queue Manually', 'litespeed-cache' ), 'VPI' ); ?>
- <?php printf( esc_html__( 'Available after %d second(s)', 'litespeed-cache' ), esc_html( $vpi_service_hot ) ); ?>
</button>
<?php else : ?>
<a href="<?php echo esc_url( Utility::build_url( Router::ACTION_VPI, VPI::TYPE_GEN ) ); ?>" class="button litespeed-btn-success">
<?php printf( esc_html__( 'Run %s Queue Manually', 'litespeed-cache' ), 'VPI' ); ?>
</a>
<?php endif; ?>
<?php Doc::queue_issues(); ?>
<?php endif; ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $option_id = Base::O_MEDIA_VPI_CRON; ?>
<?php $this->title( $option_id ); ?>
</th>
<td>
<?php $this->build_switch( $option_id ); ?>
<div class="litespeed-desc">
<?php esc_html_e( 'Enable Viewport Images auto generation cron.', 'litespeed-cache' ); ?>
</div>
</td>
</tr>
</tbody>
</table>