Initial commit: Atomaste website
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
/**
|
||||
* Health Check Script
|
||||
*
|
||||
* Triggers a health check request for speed when the document is loaded.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
* @deprecated 3.3 Will only show banner after user manually checked score
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
$url = Utility::build_url( Router::ACTION_HEALTH, Health::TYPE_SPEED, true, null, array(), true );
|
||||
?>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
jQuery(document).ready( function() {
|
||||
jQuery.get( '<?php echo $url; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>' ) ;
|
||||
} ) ;
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Promotion Banner
|
||||
*
|
||||
* Displays a promotional banner with news and installation options.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
?>
|
||||
|
||||
<div class="litespeed-wrap notice notice-success litespeed-banner-promo-full">
|
||||
<div class="litespeed-banner-promo-content">
|
||||
<h3 class="litespeed-banner-title litespeed-top15"><?php echo wp_kses_post( $this->_summary['news.title'] ); ?></h3>
|
||||
<div class="litespeed-banner-description" style="flex-direction: column;">
|
||||
<div class="litespeed-banner-description-padding-right-15">
|
||||
<p class="litespeed-banner-description-content">
|
||||
<?php echo wp_kses_post( $this->_summary['news.content'] ); ?>
|
||||
</p>
|
||||
</div>
|
||||
<div class="litespeed-inline">
|
||||
<div class="litespeed-banner-description-padding-right-15 litespeed-margin-bottom10">
|
||||
<?php if ( ! empty( $this->_summary['news.plugin'] ) ) : ?>
|
||||
<?php $install_link = Utility::build_url( Router::ACTION_ACTIVATION, Activation::TYPE_INSTALL_3RD, false, null, array( 'plugin' => $this->_summary['news.plugin'] ) ); ?>
|
||||
<a href="<?php echo esc_url( $install_link ); ?>" class="button litespeed-btn-success">
|
||||
<?php esc_html_e( 'Install', 'litespeed-cache' ); ?>
|
||||
<?php
|
||||
if ( ! empty( $this->_summary['news.plugin_name'] ) ) {
|
||||
echo esc_html( $this->_summary['news.plugin_name'] );
|
||||
}
|
||||
?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php if ( ! empty( $this->_summary['news.zip'] ) ) : ?>
|
||||
<?php $install_link = Utility::build_url( Router::ACTION_ACTIVATION, Activation::TYPE_INSTALL_ZIP ); ?>
|
||||
<a href="<?php echo esc_url( $install_link ); ?>" class="button litespeed-btn-success">
|
||||
<?php esc_html_e( 'Install', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<?php $dismiss_url = Utility::build_url( Router::ACTION_ACTIVATION, Activation::TYPE_DISMISS_RECOMMENDED ); ?>
|
||||
<span class="screen-reader-text"><?php esc_html_e( 'Dismiss this notice', 'litespeed-cache' ); ?></span>
|
||||
<a href="<?php echo esc_url( $dismiss_url ); ?>" class="litespeed-notice-dismiss">X</a>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
/**
|
||||
* QUIC.cloud Promotion Banner
|
||||
*
|
||||
* Displays a promotional banner for QUIC.cloud services with a tweet option to earn credits.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
?>
|
||||
|
||||
<div class="litespeed-wrap notice notice-success litespeed-banner-promo-qc">
|
||||
|
||||
<div class="litespeed-banner-promo-qc-content">
|
||||
|
||||
<div class="litespeed-banner-promo-qc-description">
|
||||
<h2><?php esc_html_e( 'You just unlocked a promotion from QUIC.cloud!', 'litespeed-cache' ); ?></h2>
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
esc_html__( 'Spread the love and earn %s credits to use in our QUIC.cloud online services.', 'litespeed-cache' ),
|
||||
'<strong>' . absint($this->_summary['promo'][0]['quota']) . '</strong>'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<p>
|
||||
<a class="button button-primary" href="<?php echo esc_url($this->_summary['promo'][0]['url']); ?>" target="_blank">
|
||||
<?php
|
||||
printf(
|
||||
esc_html__( 'Send to twitter to get %s bonus', 'litespeed-cache' ),
|
||||
absint($this->_summary['promo'][0]['quota'])
|
||||
);
|
||||
?>
|
||||
</a>
|
||||
<a href="https://www.quic.cloud/faq/#credit" target="_blank"><?php esc_html_e( 'Learn more', 'litespeed-cache' ); ?></a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="litespeed-banner-promo-qc-preview">
|
||||
<h4 class="litespeed-tweet-preview-title"><?php esc_html_e( 'Tweet preview', 'litespeed-cache' ); ?></h4>
|
||||
<div class="litespeed-tweet-preview">
|
||||
|
||||
<div class="litespeed-tweet-img"><img src="<?php echo esc_url($this->_summary['promo'][0]['image']); ?>"></div>
|
||||
|
||||
<div class="litespeed-tweet-preview-content">
|
||||
<p class="litespeed-tweet-text"><?php echo esc_html($this->_summary['promo'][0]['content']); ?></p>
|
||||
|
||||
<div class="litespeed-tweet-cta">
|
||||
<a href="<?php echo esc_url($this->_summary['promo'][0]['url']); ?>" class="litespeed-tweet-btn" target="_blank"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 250 250" xml:space="preserve">
|
||||
<path class="st0" d="M78.6,226.6c94.3,0,145.9-78.2,145.9-145.9c0-2.2,0-4.4-0.1-6.6c10-7.3,18.7-16.3,25.6-26.5
|
||||
c-9.4,4.1-19.3,6.9-29.5,8.1c10.7-6.4,18.7-16.5,22.5-28.4c-10.1,6-21.1,10.2-32.6,12.4c-19.4-20.7-51.9-21.7-72.6-2.2
|
||||
c-13.3,12.5-19,31.2-14.8,49C81.9,84.3,43.4,64.8,17.4,32.8c-13.6,23.4-6.7,53.4,15.9,68.5c-8.2-0.2-16.1-2.4-23.3-6.4
|
||||
c0,0.2,0,0.4,0,0.6c0,24.4,17.2,45.4,41.2,50.3c-7.6,2.1-15.5,2.4-23.2,0.9c6.7,20.9,26,35.2,47.9,35.6c-18.2,14.3-40.6,22-63.7,22
|
||||
c-4.1,0-8.2-0.3-12.2-0.7C23.5,218.6,50.7,226.6,78.6,226.6" />
|
||||
</svg>
|
||||
<?php esc_html_e( 'Tweet this', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<?php $dismiss_url = Utility::build_url( Router::ACTION_CLOUD, Cloud::TYPE_CLEAR_PROMO ); ?>
|
||||
<span class="screen-reader-text"><?php esc_html_e( 'Dismiss this notice', 'litespeed-cache' ); ?>.</span>
|
||||
<a href="<?php echo esc_url($dismiss_url); ?>" class="litespeed-notice-dismiss">X</a>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache New Version Banner
|
||||
*
|
||||
* Displays a promotional banner for a new version of LiteSpeed Cache.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
* @note Only shown for single site installations.
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
// Exit if multisite or auto-upgrade is enabled.
|
||||
if ( is_multisite() || $this->conf( Base::O_AUTO_UPGRADE ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$current = get_site_transient( 'update_plugins' );
|
||||
if ( ! isset( $current->response[ Core::PLUGIN_FILE ] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check for new version every 12 hours.
|
||||
$last_check = empty( $this->_summary['new_version.last_check'] ) ? 0 : $this->_summary['new_version.last_check'];
|
||||
if ( time() - $last_check > 43200 ) {
|
||||
GUI::save_summary( array( 'new_version.last_check' => time() ) );
|
||||
|
||||
// Detect version
|
||||
$auto_v = Cloud::version_check( 'new_version_banner' );
|
||||
if ( ! empty( $auto_v['latest'] ) ) {
|
||||
GUI::save_summary( array( 'new_version.v' => $auto_v['latest'] ) );
|
||||
}
|
||||
// After detect, don't show, just return and show next time
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! isset( $this->_summary['new_version.v'] ) || version_compare( Core::VER, $this->_summary['new_version.v'], '>=' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Banner can be shown now.
|
||||
$this->_promo_true = true;
|
||||
|
||||
if ( $check_only ) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="litespeed-wrap notice notice-success litespeed-banner-promo-full">
|
||||
<div class="litespeed-banner-promo-logo"></div>
|
||||
|
||||
<div class="litespeed-banner-promo-content">
|
||||
<h3 class="litespeed-banner-title litespeed-top15">
|
||||
<?php esc_html_e( 'LiteSpeed Cache', 'litespeed-cache' ); ?>:
|
||||
<?php esc_html_e( 'New Version Available!', 'litespeed-cache' ); ?>
|
||||
</h3>
|
||||
<div class="litespeed-banner-description">
|
||||
<div class="litespeed-banner-description-padding-right-15">
|
||||
<p class="litespeed-banner-description-content">
|
||||
<?php
|
||||
/* translators: %s: New version number */
|
||||
printf(
|
||||
esc_html__( 'New release %s is available now.', 'litespeed-cache' ),
|
||||
'v' . esc_html( $this->_summary['new_version.v'] )
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
<div class="litespeed-row-flex litespeed-banner-description">
|
||||
<div class="litespeed-banner-description-padding-right-15">
|
||||
<?php $url = Utility::build_url( Router::ACTION_ACTIVATION, Activation::TYPE_UPGRADE ); ?>
|
||||
<a href="<?php echo esc_url( $url ); ?>" class="button litespeed-btn-success litespeed-btn-mini">
|
||||
<span class="dashicons dashicons-image-rotate"></span>
|
||||
<?php esc_html_e( 'Upgrade', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
</div>
|
||||
<div class="litespeed-banner-description-padding-right-15">
|
||||
<?php
|
||||
$cfg = array( Conf::TYPE_SET . '[' . Base::O_AUTO_UPGRADE . ']' => 1 );
|
||||
$url = Utility::build_url( Router::ACTION_CONF, Conf::TYPE_SET, false, null, $cfg );
|
||||
?>
|
||||
<a href="<?php echo esc_url( $url ); ?>" class="button litespeed-btn-primary litespeed-btn-mini">
|
||||
<span class="dashicons dashicons-update"></span>
|
||||
<?php esc_html_e( 'Turn On Auto Upgrade', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
</div>
|
||||
<div class="litespeed-banner-description-padding-right-15">
|
||||
<?php $url = Utility::build_url( Core::ACTION_DISMISS, GUI::TYPE_DISMISS_PROMO, false, null, array( 'promo_tag' => 'new_version' ) ); ?>
|
||||
<a href="<?php echo esc_url( $url ); ?>" class="button litespeed-btn-warning litespeed-btn-mini">
|
||||
<?php esc_html_e( 'Maybe Later', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<?php
|
||||
$dismiss_url = Utility::build_url(
|
||||
Core::ACTION_DISMISS,
|
||||
GUI::TYPE_DISMISS_PROMO,
|
||||
false,
|
||||
null,
|
||||
array(
|
||||
'promo_tag' => 'new_version',
|
||||
'later' => 1,
|
||||
)
|
||||
);
|
||||
?>
|
||||
<span class="screen-reader-text"><?php esc_html_e( 'Dismiss this notice.', 'litespeed-cache' ); ?></span>
|
||||
<a href="<?php echo esc_url( $dismiss_url ); ?>" class="litespeed-notice-dismiss"><?php esc_html_e( 'Dismiss', 'litespeed-cache' ); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Developer Version Banner
|
||||
*
|
||||
* Displays a promotional banner for a new developer version of LiteSpeed Cache.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
?>
|
||||
|
||||
<div class="litespeed-wrap notice notice-warning litespeed-banner-promo-full">
|
||||
<div class="litespeed-banner-promo-logo"></div>
|
||||
|
||||
<div class="litespeed-banner-promo-content">
|
||||
<h3 class="litespeed-banner-title litespeed-top15">
|
||||
<?php esc_html_e( 'LiteSpeed Cache', 'litespeed-cache' ); ?>:
|
||||
<?php esc_html_e( 'New Developer Version Available!', 'litespeed-cache' ); ?>
|
||||
</h3>
|
||||
<div class="litespeed-banner-description">
|
||||
<div class="litespeed-banner-description-padding-right-15">
|
||||
<p class="litespeed-banner-description-content">
|
||||
<?php
|
||||
/* translators: %s: Developer version number */
|
||||
printf(
|
||||
esc_html__( 'New developer version %s is available now.', 'litespeed-cache' ),
|
||||
'v' . esc_html( $this->_summary['version.dev'] )
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
<div class="litespeed-row-flex litespeed-banner-description">
|
||||
<div class="litespeed-banner-description-padding-right-15">
|
||||
<?php $url = Utility::build_url( Router::ACTION_DEBUG2, Debug2::TYPE_BETA_TEST, false, null, array( Debug2::BETA_TEST_URL => 'dev' ) ); ?>
|
||||
<a href="<?php echo esc_url( $url ); ?>" class="button litespeed-btn-success litespeed-btn-mini">
|
||||
<span class="dashicons dashicons-image-rotate"></span>
|
||||
<?php esc_html_e( 'Upgrade', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,160 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Performance Review Banner
|
||||
*
|
||||
* Displays a promotional banner showing page load time and PageSpeed score improvements.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
$health_scores = Health::cls()->scores();
|
||||
|
||||
// Exit if speed is not significantly improved or score is reduced.
|
||||
if ( $health_scores['speed_before'] <= $health_scores['speed_after'] * 2 || $health_scores['score_before'] >= $health_scores['score_after'] ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Banner can be shown now.
|
||||
$this->_promo_true = true;
|
||||
|
||||
if ( $check_only ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$ajax_url_promo = Utility::build_url(Core::ACTION_DISMISS, GUI::TYPE_DISMISS_PROMO, true, null, array( 'promo_tag' => $promo_tag ), true);
|
||||
?>
|
||||
|
||||
<div class="litespeed-wrap notice notice-info litespeed-banner-promo-full">
|
||||
<div class="litespeed-banner-promo-logo"></div>
|
||||
|
||||
<div class="litespeed-banner-promo-content">
|
||||
<h3 class="litespeed-banner-title litespeed-banner-promo-content"><?php esc_html_e( 'Thank You for Using the LiteSpeed Cache Plugin!', 'litespeed-cache' ); ?></h3>
|
||||
|
||||
<div class="litespeed-row-flex litespeed-banner-promo-content litespeed-margin-left-remove litespeed-flex-wrap">
|
||||
<div class="litespeed-right50 litespeed-margin-bottom20">
|
||||
<h2 class="litespeed-text-grey litespeed-margin-bottom-remove litespeed-top10"><?php esc_html_e( 'Page Load Time', 'litespeed-cache' ); ?></h2>
|
||||
<hr class="litespeed-margin-bottom-remove" />
|
||||
<div class="litespeed-row-flex" style="margin-left: -10px;">
|
||||
<div class="litespeed-width-1-3 litespeed-padding-space litespeed-margin-x5">
|
||||
<div>
|
||||
<p class="litespeed-text-grey litespeed-margin-y-remove"><?php esc_html_e( 'Before', 'litespeed-cache' ); ?></p>
|
||||
</div>
|
||||
<div class="litespeed-top10 litespeed-text-jumbo litespeed-text-grey">
|
||||
<?php echo esc_html( $health_scores['speed_before'] ); ?><span class="litespeed-text-large">s</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="litespeed-width-1-3 litespeed-padding-space litespeed-margin-x5">
|
||||
<div>
|
||||
<p class="litespeed-text-grey litespeed-margin-y-remove"><?php esc_html_e( 'After', 'litespeed-cache' ); ?></p>
|
||||
</div>
|
||||
<div class="litespeed-top10 litespeed-text-jumbo litespeed-success">
|
||||
<?php echo esc_html( $health_scores['speed_after'] ); ?><span class="litespeed-text-large">s</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="litespeed-width-1-3 litespeed-padding-space litespeed-margin-x5">
|
||||
<div>
|
||||
<p class="litespeed-text-grey litespeed-margin-y-remove" style="white-space: nowrap;">
|
||||
<?php esc_html_e( 'Improved by', 'litespeed-cache' ); ?>
|
||||
</p>
|
||||
</div>
|
||||
<div class="litespeed-top10 litespeed-text-jumbo litespeed-text-fern">
|
||||
<?php echo esc_html( $health_scores['speed_improved'] ); ?><span class="litespeed-text-large">%</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ( $health_scores['score_before'] < $health_scores['score_after'] ) : ?>
|
||||
<div class="litespeed-margin-bottom20">
|
||||
<h2 class="litespeed-text-grey litespeed-margin-bottom-remove litespeed-top10"><?php esc_html_e( 'PageSpeed Score', 'litespeed-cache' ); ?></h2>
|
||||
<hr class="litespeed-margin-bottom-remove" />
|
||||
<div class="litespeed-row-flex" style="margin-left: -10px;">
|
||||
<div class="litespeed-width-1-3 litespeed-padding-space litespeed-margin-x5">
|
||||
<div>
|
||||
<p class="litespeed-text-grey litespeed-text-center litespeed-margin-y-remove"><?php esc_html_e( 'Before', 'litespeed-cache' ); ?></p>
|
||||
</div>
|
||||
<div class="litespeed-promo-score" style="margin-top: -5px;">
|
||||
<?php echo wp_kses( GUI::pie( esc_html( $health_scores['score_before'] ), 45, false, true, 'litespeed-pie-' . esc_attr( $this->get_cls_of_pagescore( $health_scores['score_before'] ) ) ), GUI::allowed_svg_tags() ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="litespeed-width-1-3 litespeed-padding-space litespeed-margin-x5">
|
||||
<div>
|
||||
<p class="litespeed-text-grey litespeed-text-center litespeed-margin-y-remove"><?php esc_html_e( 'After', 'litespeed-cache' ); ?></p>
|
||||
</div>
|
||||
<div class="litespeed-promo-score" style="margin-top: -5px;">
|
||||
<?php echo wp_kses( GUI::pie( esc_html( $health_scores['score_after'] ), 45, false, true, 'litespeed-pie-' . esc_attr( $this->get_cls_of_pagescore( $health_scores['score_after'] ) ) ), GUI::allowed_svg_tags() ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="litespeed-width-1-3 litespeed-padding-space litespeed-margin-x5">
|
||||
<div>
|
||||
<p class="litespeed-text-grey litespeed-margin-y-remove" style="white-space: nowrap;">
|
||||
<?php esc_html_e( 'Improved by', 'litespeed-cache' ); ?>
|
||||
</p>
|
||||
</div>
|
||||
<div class="litespeed-top10 litespeed-text-jumbo litespeed-text-fern">
|
||||
<?php echo esc_html( $health_scores['score_improved'] ); ?><span class="litespeed-text-large">%</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="litespeed-row-flex litespeed-flex-wrap litespeed-margin-y5">
|
||||
<div class="litespeed-banner-description-padding-right-15">
|
||||
<a href="https://wordpress.org/support/plugin/litespeed-cache/reviews/?filter=5#new-post" target="_blank" rel="noopener" style="text-decoration: none;">
|
||||
<button class="button litespeed-btn-success litespeed-btn-mini">
|
||||
<?php esc_html_e( "Sure I'd love to review!", 'litespeed-cache' ); ?>
|
||||
⭐⭐⭐⭐⭐
|
||||
</button>
|
||||
</a>
|
||||
<button type="button" class="button litespeed-btn-primary litespeed-btn-mini" id="litespeed-promo-done"><?php esc_html_e( "I've already left a review", 'litespeed-cache' ); ?></button>
|
||||
<button type="button" class="button litespeed-btn-warning litespeed-btn-mini" id="litespeed-promo-later"><?php esc_html_e( 'Maybe later', 'litespeed-cache' ); ?></button>
|
||||
</div>
|
||||
<div>
|
||||
<p class="litespeed-text-small">
|
||||
<?php esc_html_e( 'Created with ❤️ by LiteSpeed team.', 'litespeed-cache' ); ?>
|
||||
<a href="https://wordpress.org/support/plugin/litespeed-cache" target="_blank" rel="noopener"><?php esc_html_e( 'Support forum', 'litespeed-cache' ); ?></a> | <a href="https://www.litespeedtech.com/support" target="_blank" rel="noopener"><?php esc_html_e( 'Submit a ticket', 'litespeed-cache' ); ?></a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<?php
|
||||
$dismiss_url = Utility::build_url(
|
||||
Core::ACTION_DISMISS,
|
||||
GUI::TYPE_DISMISS_PROMO,
|
||||
false,
|
||||
null,
|
||||
array(
|
||||
'promo_tag' => 'score',
|
||||
'later' => 1,
|
||||
)
|
||||
);
|
||||
?>
|
||||
<span class="screen-reader-text"><?php esc_html_e( 'Dismiss this notice.', 'litespeed-cache' ); ?></span>
|
||||
<a href="<?php echo esc_url( $dismiss_url ); ?>" class="litespeed-notice-dismiss"><?php esc_html_e( 'Dismiss', 'litespeed-cache' ); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
(function ($) {
|
||||
jQuery(document).ready(function () {
|
||||
/** Promo banner **/
|
||||
$('#litespeed-promo-done').on('click', function (event) {
|
||||
$('.litespeed-banner-promo-full').slideUp();
|
||||
$.get('<?php echo $ajax_url_promo;// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>&done=1');
|
||||
});
|
||||
$('#litespeed-promo-later').on('click', function (event) {
|
||||
$('.litespeed-banner-promo-full').slideUp();
|
||||
$.get('<?php echo $ajax_url_promo;// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>');
|
||||
});
|
||||
});
|
||||
})(jQuery);
|
||||
</script>
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Slack Community Banner
|
||||
*
|
||||
* Displays a promotional banner inviting users to join the LiteSpeed Slack community.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
?>
|
||||
|
||||
<div class="litespeed-wrap notice notice-info litespeed-banner-promo-full" id="litespeed-banner-promo-slack">
|
||||
<div class="litespeed-banner-promo-logo"></div>
|
||||
|
||||
<div class="litespeed-banner-promo-content">
|
||||
<h3 class="litespeed-banner-title"><?php esc_html_e( 'Welcome to LiteSpeed', 'litespeed-cache' ); ?></h3>
|
||||
<div class="litespeed-banner-description">
|
||||
<div class="litespeed-banner-description-padding-right-15">
|
||||
<p class="litespeed-banner-description-content">
|
||||
<?php esc_html_e( 'Want to connect with other LiteSpeed users?', 'litespeed-cache' ); ?>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: Link to LiteSpeed Slack community */
|
||||
esc_html__( 'Join the %s community.', 'litespeed-cache' ),
|
||||
'<a href="https://join.slack.com/t/golitespeed/shared_invite/enQtMzE5ODgxMTUyNTgzLTNiNWQ1MWZlYmI4YjEzNTM4NjdiODY2YTQ0OWVlMzBlNGZkY2E3Y2E4MjIzNmNmZmU0ZjIyNWM1ZmNmMWRlOTk" target="_blank" class="litespeed-banner-promo-slack-textlink" rel="noopener">LiteSpeed Slack</a>'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<p class="litespeed-banner-promo-slack-line2">
|
||||
golitespeed.slack.com
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<h3 class="litespeed-banner-button-link">
|
||||
<a href="https://join.slack.com/t/golitespeed/shared_invite/enQtMzE5ODgxMTUyNTgzLTNiNWQ1MWZlYmI4YjEzNTM4NjdiODY2YTQ0OWVlMzBlNGZkY2E3Y2E4MjIzNmNmZmU0ZjIyNWM1ZmNmMWRlOTk" target="_blank" rel="noopener">
|
||||
<?php esc_html_e( 'Join Us on Slack', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<?php $dismiss_url = Utility::build_url( Core::ACTION_DISMISS, GUI::TYPE_DISMISS_PROMO, false, null, array( 'promo_tag' => 'slack' ) ); ?>
|
||||
<span class="screen-reader-text"><?php esc_html_e( 'Dismiss this notice.', 'litespeed-cache' ); ?></span>
|
||||
<a href="<?php echo esc_url( $dismiss_url ); ?>" class="litespeed-notice-dismiss"><?php esc_html_e( 'Dismiss', 'litespeed-cache' ); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
150
Atomaste Reference/public_html/wp-content/plugins/litespeed-cache/tpl/cache/entry.tpl.php
vendored
Normal file
150
Atomaste Reference/public_html/wp-content/plugins/litespeed-cache/tpl/cache/entry.tpl.php
vendored
Normal file
@@ -0,0 +1,150 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Settings
|
||||
*
|
||||
* Displays the cache settings page with tabbed navigation for LiteSpeed Cache.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
if ( $this->_is_network_admin ) {
|
||||
$menu_list = array(
|
||||
'cache' => __( 'Cache', 'litespeed-cache' ),
|
||||
'purge' => __( 'Purge', 'litespeed-cache' ),
|
||||
'excludes' => __( 'Excludes', 'litespeed-cache' ),
|
||||
'object' => __( 'Object', 'litespeed-cache' ),
|
||||
'browser' => __( 'Browser', 'litespeed-cache' ),
|
||||
'advanced' => __( 'Advanced', 'litespeed-cache' ),
|
||||
);
|
||||
?>
|
||||
|
||||
<div class="wrap">
|
||||
<h1 class="litespeed-h1">
|
||||
<?php esc_html_e( 'LiteSpeed Cache Network Cache Settings', 'litespeed-cache' ); ?>
|
||||
</h1>
|
||||
<span class="litespeed-desc">
|
||||
<?php echo esc_html( 'v' . Core::VER ); ?>
|
||||
</span>
|
||||
<hr class="wp-header-end">
|
||||
</div>
|
||||
|
||||
<div class="litespeed-wrap">
|
||||
<h2 class="litespeed-header nav-tab-wrapper">
|
||||
<?php GUI::display_tab_list( $menu_list ); ?>
|
||||
</h2>
|
||||
<div class="litespeed-body">
|
||||
<?php $this->cache_disabled_warning(); ?>
|
||||
|
||||
<?php
|
||||
$this->form_action( Router::ACTION_SAVE_SETTINGS_NETWORK );
|
||||
|
||||
foreach ( $menu_list as $k => $val ) {
|
||||
$k_escaped = esc_attr( $k );
|
||||
?>
|
||||
<div data-litespeed-layout="<?php echo esc_html( $k_escaped ); ?>">
|
||||
<?php
|
||||
require LSCWP_DIR . "tpl/cache/network_settings-$k.tpl.php";
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
$this->form_end();
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
return;
|
||||
}
|
||||
|
||||
$menu_list = array(
|
||||
'cache' => __( 'Cache', 'litespeed-cache' ),
|
||||
'ttl' => __( 'TTL', 'litespeed-cache' ),
|
||||
'purge' => __( 'Purge', 'litespeed-cache' ),
|
||||
'excludes' => __( 'Excludes', 'litespeed-cache' ),
|
||||
'esi' => __( 'ESI', 'litespeed-cache' ),
|
||||
);
|
||||
|
||||
if ( ! $this->_is_multisite ) {
|
||||
$menu_list['object'] = __( 'Object', 'litespeed-cache' );
|
||||
$menu_list['browser'] = __( 'Browser', 'litespeed-cache' );
|
||||
}
|
||||
|
||||
$menu_list['advanced'] = __( 'Advanced', 'litespeed-cache' );
|
||||
|
||||
/**
|
||||
* Generate roles for setting usage
|
||||
*
|
||||
* @since 1.6.2
|
||||
*/
|
||||
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 );
|
||||
?>
|
||||
|
||||
<div class="wrap">
|
||||
<h1 class="litespeed-h1">
|
||||
<?php esc_html_e( 'LiteSpeed Cache Settings', 'litespeed-cache' ); ?>
|
||||
</h1>
|
||||
<span class="litespeed-desc">
|
||||
<?php echo esc_html( 'v' . Core::VER ); ?>
|
||||
</span>
|
||||
<hr class="wp-header-end">
|
||||
</div>
|
||||
<div class="litespeed-wrap">
|
||||
<h2 class="litespeed-header nav-tab-wrapper">
|
||||
<?php
|
||||
$i = 1;
|
||||
$accesskey_set = array();
|
||||
foreach ( $menu_list as $k => $val ) {
|
||||
$accesskey = '';
|
||||
if ( $i <= 9 ) {
|
||||
$accesskey = $i;
|
||||
} else {
|
||||
$tmp = strtoupper( substr( $k, 0, 1 ) );
|
||||
if ( ! in_array( $tmp, $accesskey_set, true ) ) {
|
||||
$accesskey_set[] = $tmp;
|
||||
$accesskey = esc_attr( $tmp );
|
||||
}
|
||||
}
|
||||
printf('<a class="litespeed-tab nav-tab" href="#%1$s" data-litespeed-tab="%1$s" litespeed-accesskey="%2$s">%3$s</a>', esc_attr( $k ), esc_attr($accesskey), esc_html( $val ));
|
||||
++$i;
|
||||
}
|
||||
do_action( 'litespeed_settings_tab', 'cache' );
|
||||
?>
|
||||
</h2>
|
||||
|
||||
<div class="litespeed-body">
|
||||
<?php $this->cache_disabled_warning(); ?>
|
||||
|
||||
<?php
|
||||
$this->form_action();
|
||||
|
||||
require LSCWP_DIR . 'tpl/inc/check_if_network_disable_all.php';
|
||||
require LSCWP_DIR . 'tpl/cache/more_settings_tip.tpl.php';
|
||||
|
||||
foreach ( $menu_list as $k => $val ) {
|
||||
echo '<div data-litespeed-layout="' . esc_attr( $k ) . '">';
|
||||
require LSCWP_DIR . "tpl/cache/settings-$k.tpl.php";
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
do_action( 'litespeed_settings_content', 'cache' );
|
||||
|
||||
$this->form_end();
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Setting Tip
|
||||
*
|
||||
* Displays a notice to inform users about additional LiteSpeed Cache settings.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
global $pagenow;
|
||||
if ( 'options-general.php' !== $pagenow ) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="litespeed-callout notice notice-success inline">
|
||||
<h4><?php esc_html_e( 'NOTE', 'litespeed-cache' ); ?></h4>
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: LiteSpeed Cache menu label */
|
||||
esc_html__( 'More settings available under %s menu', 'litespeed-cache' ),
|
||||
'<code>' . esc_html__( 'LiteSpeed Cache', 'litespeed-cache' ) . '</code>'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Advanced Settings
|
||||
*
|
||||
* Displays the advanced settings section for LiteSpeed Cache.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
?>
|
||||
|
||||
<h3 class="litespeed-title-short">
|
||||
<?php esc_html_e( 'Advanced Settings', 'litespeed-cache' ); ?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/cache/#advanced-tab' ); ?>
|
||||
</h3>
|
||||
|
||||
<table class="wp-list-table striped litespeed-table">
|
||||
<tbody>
|
||||
<?php require LSCWP_DIR . 'tpl/cache/settings_inc.login_cookie.tpl.php'; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Browser Settings
|
||||
*
|
||||
* Includes the browser cache settings template for LiteSpeed Cache.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
require LSCWP_DIR . 'tpl/cache/settings_inc.browser.tpl.php';
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Network Cache Settings
|
||||
*
|
||||
* Displays the network cache control settings section for LiteSpeed Cache.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
?>
|
||||
|
||||
<h3 class="litespeed-title-short">
|
||||
<?php esc_html_e( 'Cache Control Settings', 'litespeed-cache' ); ?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/cache/' ); ?>
|
||||
</h3>
|
||||
|
||||
<table class="wp-list-table striped litespeed-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th><?php esc_html_e( 'Network Enable Cache', 'litespeed-cache' ); ?></th>
|
||||
<td>
|
||||
<?php $this->build_switch( Base::O_CACHE ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Enabling LiteSpeed Cache for WordPress here enables the cache for the network.', 'litespeed-cache' ); ?><br />
|
||||
<?php esc_html_e( 'It is STRONGLY recommended that the compatibility with other plugins on a single/few sites is tested first.', 'litespeed-cache' ); ?><br />
|
||||
<?php esc_html_e( 'This is to ensure compatibility prior to enabling the cache for all sites.', 'litespeed-cache' ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
require LSCWP_DIR . 'tpl/cache/settings_inc.cache_mobile.tpl.php';
|
||||
require LSCWP_DIR . 'tpl/cache/settings_inc.cache_dropquery.tpl.php';
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Network Exclude Settings
|
||||
*
|
||||
* Displays the network exclude settings section for LiteSpeed Cache.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
?>
|
||||
|
||||
<h3 class="litespeed-title-short">
|
||||
<?php esc_html_e( 'Exclude Settings', 'litespeed-cache' ); ?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/cache/#excludes-tab' ); ?>
|
||||
</h3>
|
||||
|
||||
<table class="wp-list-table striped litespeed-table">
|
||||
<tbody>
|
||||
<?php
|
||||
// Cookie
|
||||
require LSCWP_DIR . 'tpl/cache/settings_inc.exclude_cookies.tpl.php';
|
||||
|
||||
// User Agent
|
||||
require LSCWP_DIR . 'tpl/cache/settings_inc.exclude_useragent.tpl.php';
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Network Object Settings
|
||||
*
|
||||
* Includes the network object cache settings template for LiteSpeed Cache.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
require LSCWP_DIR . 'tpl/cache/settings_inc.object.tpl.php';
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Network Purge Settings
|
||||
*
|
||||
* Displays the network purge settings section for LiteSpeed Cache.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
?>
|
||||
|
||||
<h3 class="litespeed-title-short">
|
||||
<?php esc_html_e( 'Purge Settings', 'litespeed-cache' ); ?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/cache/#purge-tab' ); ?>
|
||||
</h3>
|
||||
|
||||
<table class="wp-list-table striped litespeed-table">
|
||||
<tbody>
|
||||
<?php require LSCWP_DIR . 'tpl/cache/settings_inc.purge_on_upgrade.tpl.php'; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
/**
|
||||
* Advanced Settings Template
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
?>
|
||||
|
||||
<h3 class="litespeed-title-short">
|
||||
<?php esc_html_e( 'Advanced Settings', 'litespeed-cache' ); ?>
|
||||
<?php Doc::learn_more( esc_url( 'https://docs.litespeedtech.com/lscache/lscwp/cache/#advanced-tab' ) ); ?>
|
||||
</h3>
|
||||
|
||||
<div class="litespeed-callout notice notice-warning inline">
|
||||
<h4><?php esc_html_e( 'NOTICE:', 'litespeed-cache' ); ?></h4>
|
||||
<p><?php esc_html_e( 'These settings are meant for ADVANCED USERS ONLY.', 'litespeed-cache' ); ?></p>
|
||||
</div>
|
||||
|
||||
<table class="wp-list-table striped litespeed-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php $option_id = Base::O_CACHE_AJAX_TTL; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<div class="litespeed-textarea-recommended">
|
||||
<div>
|
||||
<?php $this->build_textarea( $option_id, 60 ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Specify an AJAX action in POST/GET and the number of seconds to cache that request, separated by a space.', 'litespeed-cache' ); ?>
|
||||
<?php Doc::one_per_line(); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php if ( ! $this->_is_multisite ) : ?>
|
||||
<?php require LSCWP_DIR . 'tpl/cache/settings_inc.login_cookie.tpl.php'; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php $option_id = Base::O_UTIL_NO_HTTPS_VARY; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_switch( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Enable this option if you are using both HTTP and HTTPS in the same domain and are noticing cache irregularities.', 'litespeed-cache' ); ?>
|
||||
<?php Doc::learn_more( esc_url( 'https://docs.litespeedtech.com/lscache/lscwp/cache/#improve-httphttps-compatibility' ) ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php $option_id = Base::O_UTIL_INSTANT_CLICK; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_switch( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'When a visitor hovers over a page link, preload that page. This will speed up the visit to that link.', 'litespeed-cache' ); ?>
|
||||
<?php Doc::learn_more( esc_url( 'https://docs.litespeedtech.com/lscache/lscwp/cache/#instant-click' ) ); ?>
|
||||
<br />
|
||||
<span class="litespeed-danger">
|
||||
⚠️
|
||||
<?php esc_html_e( 'This will generate extra requests to the server, which will increase server load.', 'litespeed-cache' ); ?>
|
||||
</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Browser Cache Setting
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
require LSCWP_DIR . 'tpl/cache/settings_inc.browser.tpl.php';
|
||||
180
Atomaste Reference/public_html/wp-content/plugins/litespeed-cache/tpl/cache/settings-cache.tpl.php
vendored
Normal file
180
Atomaste Reference/public_html/wp-content/plugins/litespeed-cache/tpl/cache/settings-cache.tpl.php
vendored
Normal file
@@ -0,0 +1,180 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Control Settings
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
?>
|
||||
|
||||
<h3 class="litespeed-title-short">
|
||||
<?php esc_html_e( 'Cache Control Settings', 'litespeed-cache' ); ?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/cache/' ); ?>
|
||||
</h3>
|
||||
|
||||
<table class="wp-list-table striped litespeed-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_CACHE; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php if ( $this->_is_multisite ) : ?>
|
||||
<?php $this->build_switch( $option_id, array( esc_html__( 'OFF', 'litespeed-cache' ), esc_html__( 'ON', 'litespeed-cache' ), esc_html__( 'Use Network Admin Setting', 'litespeed-cache' ) ) ); ?>
|
||||
<?php else : ?>
|
||||
<?php $this->build_switch( $option_id ); ?>
|
||||
<?php endif; ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: Link tags */
|
||||
esc_html__( 'Please visit the %sInformation%s page on how to test the cache.', 'litespeed-cache' ),
|
||||
'<a href="https://docs.litespeedtech.com/lscache/lscwp/installation/#testing" target="_blank" rel="noopener">',
|
||||
'</a>'
|
||||
);
|
||||
?>
|
||||
<br>
|
||||
<strong><?php esc_html_e( 'NOTICE', 'litespeed-cache' ); ?>: </strong><?php esc_html_e( 'When disabling the cache, all cached entries for this site will be purged.', 'litespeed-cache' ); ?>
|
||||
<br>
|
||||
<?php if ( $this->_is_multisite ) : ?>
|
||||
<?php esc_html_e( 'The network admin setting can be overridden here.', 'litespeed-cache' ); ?>
|
||||
<br>
|
||||
<?php endif; ?>
|
||||
<?php if ( ! $this->conf( Base::O_CACHE ) && $this->conf( Base::O_CDN_QUIC ) ) : ?>
|
||||
<span class="litespeed-success"><?php esc_html_e( 'With QUIC.cloud CDN enabled, you may still be seeing cache headers from your local server.', 'litespeed-cache' ); ?></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_CACHE_PRIV; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_switch( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php printf( esc_html__( 'Privately cache frontend pages for logged-in users. (LSWS %s required)', 'litespeed-cache' ), 'v5.2.1+' ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_CACHE_COMMENTER; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_switch( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php printf( esc_html__( 'Privately cache commenters that have pending comments. Disabling this option will serve non-cacheable pages to commenters. (LSWS %s required)', 'litespeed-cache' ), 'v5.2.1+' ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_CACHE_REST; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_switch( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Cache requests made by WordPress REST API calls.', 'litespeed-cache' ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_CACHE_PAGE_LOGIN; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_switch( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Disabling this option may negatively affect performance.', 'litespeed-cache' ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php if ( ! $this->_is_multisite ) : ?>
|
||||
<?php require LSCWP_DIR . 'tpl/cache/settings_inc.cache_mobile.tpl.php'; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_CACHE_PRIV_URI; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_textarea( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'URI Paths containing these strings will NOT be cached as public.', 'litespeed-cache' ); ?>
|
||||
<?php $this->_uri_usage_example(); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_CACHE_FORCE_URI; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_textarea( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Paths containing these strings will be cached regardless of no-cacheable settings.', 'litespeed-cache' ); ?>
|
||||
<?php $this->_uri_usage_example(); ?>
|
||||
<br>
|
||||
<?php esc_html_e( 'To define a custom TTL for a URI, add a space followed by the TTL value to the end of the URI.', 'litespeed-cache' ); ?>
|
||||
<?php
|
||||
printf(
|
||||
esc_html__( 'For example, %1$s defines a TTL of %2$s seconds for %3$s.', 'litespeed-cache' ),
|
||||
'<code>/mypath/mypage 300</code>',
|
||||
300,
|
||||
'<code>/mypath/mypage</code>'
|
||||
);
|
||||
?>
|
||||
<?php Doc::one_per_line(); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_CACHE_FORCE_PUB_URI; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_textarea( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Paths containing these strings will be forced to public cached regardless of no-cacheable settings.', 'litespeed-cache' ); ?>
|
||||
<?php $this->_uri_usage_example(); ?>
|
||||
<br>
|
||||
<?php esc_html_e( 'To define a custom TTL for a URI, add a space followed by the TTL value to the end of the URI.', 'litespeed-cache' ); ?>
|
||||
<?php
|
||||
printf(
|
||||
esc_html__( 'For example, %1$s defines a TTL of %2$s seconds for %3$s.', 'litespeed-cache' ),
|
||||
'<code>/mypath/mypage 300</code>',
|
||||
300,
|
||||
'<code>/mypath/mypage</code>'
|
||||
);
|
||||
?>
|
||||
<?php Doc::one_per_line(); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php if ( ! $this->_is_multisite ) : ?>
|
||||
<?php require LSCWP_DIR . 'tpl/cache/settings_inc.cache_dropquery.tpl.php'; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
148
Atomaste Reference/public_html/wp-content/plugins/litespeed-cache/tpl/cache/settings-esi.tpl.php
vendored
Normal file
148
Atomaste Reference/public_html/wp-content/plugins/litespeed-cache/tpl/cache/settings-esi.tpl.php
vendored
Normal file
@@ -0,0 +1,148 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache ESI Settings
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
?>
|
||||
|
||||
<h3 class="litespeed-title-short">
|
||||
<?php echo esc_html__( 'ESI Settings', 'litespeed-cache' ); ?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/cache/#esi-tab' ); ?>
|
||||
</h3>
|
||||
|
||||
<div class="litespeed-description">
|
||||
<p><?php echo esc_html__( 'With ESI (Edge Side Includes), pages may be served from cache for logged-in users.', 'litespeed-cache' ); ?></p>
|
||||
<p><?php echo esc_html__( 'ESI allows you to designate parts of your dynamic page as separate fragments that are then assembled together to make the whole page. In other words, ESI lets you “punch holes” in a page, and then fill those holes with content that may be cached privately, cached publicly with its own TTL, or not cached at all.', 'litespeed-cache' ); ?>
|
||||
<?php Doc::learn_more( 'https://blog.litespeedtech.com/2017/08/30/wpw-private-cache-vs-public-cache/', esc_html__( 'WpW: Private Cache vs. Public Cache', 'litespeed-cache' ) ); ?>
|
||||
</p>
|
||||
<p>
|
||||
💡:
|
||||
<?php echo esc_html__( 'You can turn shortcodes into ESI blocks.', 'litespeed-cache' ); ?>
|
||||
<?php
|
||||
printf(
|
||||
esc_html__( 'Replace %1$s with %2$s.', 'litespeed-cache' ),
|
||||
'<code>[shortcodeA att1="val1" att2="val2"]</code>',
|
||||
'<code>[esi shortcodeA att1="val1" att2="val2"]</code>'
|
||||
);
|
||||
?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/admin/#turning-wordpress-shortcodes-into-esi-blocks' ); ?>
|
||||
</p>
|
||||
<p>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/api/#generate-esi-block-url', esc_html__( 'ESI sample for developers', 'litespeed-cache' ) ); ?>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="litespeed-relative">
|
||||
|
||||
<?php if ( ! LSWCP_ESI_SUPPORT && ! $this->conf( Base::O_CDN_QUIC ) ) : ?>
|
||||
<div class="litespeed-callout-danger">
|
||||
<h4><?php echo esc_html__( 'WARNING', 'litespeed-cache' ); ?></h4>
|
||||
<h4><?php echo esc_html__( 'These options are only available with LiteSpeed Enterprise Web Server or QUIC.cloud CDN.', 'litespeed-cache' ); ?></h4>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<table class="wp-list-table striped litespeed-table"><tbody>
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_ESI; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_switch( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php echo esc_html__( 'Turn ON to cache public pages for logged in users, and serve the Admin Bar and Comment Form via ESI blocks. These two blocks will be uncached unless enabled below.', 'litespeed-cache' ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_ESI_CACHE_ADMBAR; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_switch( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php echo esc_html__( 'Cache the built-in Admin Bar ESI block.', 'litespeed-cache' ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_ESI_CACHE_COMMFORM; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_switch( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php echo esc_html__( 'Cache the built-in Comment Form ESI block.', 'litespeed-cache' ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_ESI_NONCE; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<div>
|
||||
<?php $this->build_textarea( $option_id ); ?>
|
||||
</div>
|
||||
<p class="litespeed-desc">
|
||||
<?php echo esc_html__( 'The list will be merged with the predefined nonces in your local data file.', 'litespeed-cache' ); ?>
|
||||
<?php echo esc_html__( 'The latest data file is', 'litespeed-cache' ); ?>: <a href="https://github.com/litespeedtech/lscache_wp/blob/master/data/esi.nonces.txt" target="_blank">https://github.com/litespeedtech/lscache_wp/blob/master/data/esi.nonces.txt</a>
|
||||
<br><span class="litespeed-success">
|
||||
<?php echo esc_html__( 'API', 'litespeed-cache' ); ?>:
|
||||
<?php printf( esc_html__( 'Filter %s is supported.', 'litespeed-cache' ), '<code>litespeed_esi_nonces</code>' ); ?>
|
||||
</span>
|
||||
</p>
|
||||
<div class="litespeed-desc">
|
||||
<?php echo esc_html__( 'The above nonces will be converted to ESI automatically.', 'litespeed-cache' ); ?>
|
||||
<?php Doc::one_per_line(); ?>
|
||||
<br><?php echo esc_html__( 'An optional second parameter may be used to specify cache control. Use a space to separate', 'litespeed-cache' ); ?>: <code>my_nonce_action private</code>
|
||||
</div>
|
||||
<div class="litespeed-desc">
|
||||
<?php printf( esc_html__( 'Wildcard %1$s supported (match zero or more characters). For example, to match %2$s and %3$s, use %4$s.', 'litespeed-cache' ), '<code>*</code>', '<code>nonce_formid_1</code>', '<code>nonce_formid_3</code>', '<code>nonce_formid_*</code>' ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_CACHE_VARY_GROUP; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<table class="litespeed-vary-table wp-list-table striped litespeed-table form-table"><tbody>
|
||||
<?php foreach ( $roles as $curr_role => $curr_title ) : ?>
|
||||
<tr>
|
||||
<td class="litespeed-vary-title"><?php echo esc_html( $curr_title ); ?></td>
|
||||
<td class="litespeed-vary-val">
|
||||
<?php
|
||||
$this->build_input(
|
||||
$option_id . '[' . $curr_role . ']',
|
||||
'litespeed-input-short',
|
||||
$this->cls( 'Vary' )->in_vary_group( $curr_role )
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody></table>
|
||||
<div class="litespeed-desc">
|
||||
<?php echo esc_html__( 'If your site contains public content that certain user roles can see but other roles cannot, you can specify a Vary Group for those user roles. For example, specifying an administrator vary group allows there to be a separate publicly-cached page tailored to administrators (with “edit” links, etc), while all other user roles see the default public page.', 'litespeed-cache' ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody></table>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,146 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Exclude Settings
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
?>
|
||||
|
||||
<h3 class="litespeed-title-short">
|
||||
<?php echo esc_html__( 'Exclude Settings', 'litespeed-cache' ); ?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/cache/#excludes-tab' ); ?>
|
||||
</h3>
|
||||
|
||||
<table class="wp-list-table striped litespeed-table">
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_CACHE_EXC; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_textarea( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php echo esc_html__( 'Paths containing these strings will not be cached.', 'litespeed-cache' ); ?>
|
||||
<?php $this->_uri_usage_example(); ?>
|
||||
<br><?php echo esc_html__( 'Predefined list will also be combined w/ the above settings', 'litespeed-cache' ); ?>: <a href="https://github.com/litespeedtech/lscache_wp/blob/dev/data/cache_nocacheable.txt" target="_blank">https://github.com/litespeedtech/lscache_wp/blob/dev/data/cache_nocacheable.txt</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_CACHE_EXC_QS; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_textarea( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php echo esc_html__( 'Query strings containing these parameters will not be cached.', 'litespeed-cache' ); ?>
|
||||
<?php printf( esc_html__( 'For example, for %1$s, %2$s and %3$s can be used here.', 'litespeed-cache' ), '<code>?aa=bb&cc=dd</code>', '<code>aa</code>', '<code>cc</code>' ); ?>
|
||||
<?php Doc::one_per_line(); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_CACHE_EXC_CAT; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php
|
||||
$excludes_buf = '';
|
||||
if ( $this->conf( $option_id ) ) {
|
||||
$excludes_buf = implode( "\n", array_map( 'get_cat_name', $this->conf( $option_id ) ) );
|
||||
}
|
||||
$this->build_textarea( $option_id, false, $excludes_buf );
|
||||
?>
|
||||
<div class="litespeed-desc">
|
||||
<b><?php echo esc_html__( 'All categories are cached by default.', 'litespeed-cache' ); ?></b>
|
||||
<?php printf( esc_html__( 'To prevent %s from being cached, enter them here.', 'litespeed-cache' ), esc_html__( 'categories', 'litespeed-cache' ) ); ?>
|
||||
<?php Doc::one_per_line(); ?>
|
||||
</div>
|
||||
<div class="litespeed-callout notice notice-warning inline">
|
||||
<h4><?php echo esc_html__( 'NOTE', 'litespeed-cache' ); ?>:</h4>
|
||||
<ol>
|
||||
<li><?php echo esc_html__( 'If the category name is not found, the category will be removed from the list on save.', 'litespeed-cache' ); ?></li>
|
||||
</ol>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_CACHE_EXC_TAG; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php
|
||||
$excludes_buf = '';
|
||||
if ( $this->conf( $option_id ) ) {
|
||||
$tag_names = array();
|
||||
foreach ( array_map( 'get_tag', $this->conf( $option_id ) ) as $curr_tag ) {
|
||||
$tag_names[] = $curr_tag->name;
|
||||
}
|
||||
if ( ! empty( $tag_names ) ) {
|
||||
$excludes_buf = implode( "\n", $tag_names );
|
||||
}
|
||||
}
|
||||
$this->build_textarea( $option_id, false, $excludes_buf );
|
||||
?>
|
||||
<div class="litespeed-desc">
|
||||
<b><?php echo esc_html__( 'All tags are cached by default.', 'litespeed-cache' ); ?></b>
|
||||
<?php printf( esc_html__( 'To prevent %s from being cached, enter them here.', 'litespeed-cache' ), esc_html__( 'tags', 'litespeed-cache' ) ); ?>
|
||||
<?php Doc::one_per_line(); ?>
|
||||
</div>
|
||||
<div class="litespeed-callout notice notice-warning inline">
|
||||
<h4><?php echo esc_html__( 'NOTE', 'litespeed-cache' ); ?>:</h4>
|
||||
<ol>
|
||||
<li><?php echo esc_html__( 'If the tag slug is not found, the tag will be removed from the list on save.', 'litespeed-cache' ); ?></li>
|
||||
<li>
|
||||
<?php
|
||||
printf(
|
||||
esc_html__( 'To exclude %1$s, insert %2$s.', 'litespeed-cache' ),
|
||||
'<code>http://www.example.com/tag/category/tag-slug/</code>',
|
||||
'<code>tag-slug</code>'
|
||||
);
|
||||
?>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
if ( ! $this->_is_multisite ) :
|
||||
require LSCWP_DIR . 'tpl/cache/settings_inc.exclude_cookies.tpl.php';
|
||||
require LSCWP_DIR . 'tpl/cache/settings_inc.exclude_useragent.tpl.php';
|
||||
endif;
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_CACHE_EXC_ROLES; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<div class="litespeed-desc">
|
||||
<?php echo esc_html__( 'Selected roles will be excluded from cache.', 'litespeed-cache' ); ?>
|
||||
</div>
|
||||
<div class="litespeed-tick-list">
|
||||
<?php foreach ( $roles as $curr_role => $curr_title ) : ?>
|
||||
<?php $this->build_checkbox( $option_id . '[]', esc_html( $curr_title ), Control::cls()->in_cache_exc_roles( $curr_role ), $curr_role ); ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Object Cache Settings
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
require LSCWP_DIR . 'tpl/cache/settings_inc.object.tpl.php';
|
||||
158
Atomaste Reference/public_html/wp-content/plugins/litespeed-cache/tpl/cache/settings-purge.tpl.php
vendored
Normal file
158
Atomaste Reference/public_html/wp-content/plugins/litespeed-cache/tpl/cache/settings-purge.tpl.php
vendored
Normal file
@@ -0,0 +1,158 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Purge Settings
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
?>
|
||||
|
||||
<h3 class="litespeed-title-short">
|
||||
<?php esc_html_e( 'Purge Settings', 'litespeed-cache' ); ?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/cache/#purge-tab' ); ?>
|
||||
</h3>
|
||||
|
||||
<?php
|
||||
$option_list = array(
|
||||
Base::O_PURGE_POST_ALL => esc_html__( 'All pages', 'litespeed-cache' ),
|
||||
Base::O_PURGE_POST_FRONTPAGE => esc_html__( 'Front page', 'litespeed-cache' ),
|
||||
Base::O_PURGE_POST_HOMEPAGE => esc_html__( 'Home page', 'litespeed-cache' ),
|
||||
Base::O_PURGE_POST_PAGES => esc_html__( 'Pages', 'litespeed-cache' ),
|
||||
Base::O_PURGE_POST_PAGES_WITH_RECENT_POSTS => esc_html__( 'All pages with Recent Posts Widget', 'litespeed-cache' ),
|
||||
Base::O_PURGE_POST_AUTHOR => esc_html__( 'Author archive', 'litespeed-cache' ),
|
||||
Base::O_PURGE_POST_POSTTYPE => esc_html__( 'Post type archive', 'litespeed-cache' ),
|
||||
Base::O_PURGE_POST_YEAR => esc_html__( 'Yearly archive', 'litespeed-cache' ),
|
||||
Base::O_PURGE_POST_MONTH => esc_html__( 'Monthly archive', 'litespeed-cache' ),
|
||||
Base::O_PURGE_POST_DATE => esc_html__( 'Daily archive', 'litespeed-cache' ),
|
||||
Base::O_PURGE_POST_TERM => esc_html__( 'Term archive (include category, tag, and tax)', 'litespeed-cache' ),
|
||||
);
|
||||
|
||||
// break line at these ids
|
||||
$break_arr = array(
|
||||
Base::O_PURGE_POST_PAGES,
|
||||
Base::O_PURGE_POST_PAGES_WITH_RECENT_POSTS,
|
||||
Base::O_PURGE_POST_POSTTYPE,
|
||||
Base::O_PURGE_POST_DATE,
|
||||
);
|
||||
?>
|
||||
|
||||
<table class="wp-list-table striped litespeed-table"><tbody>
|
||||
|
||||
<?php if ( ! $this->_is_multisite ) : ?>
|
||||
<?php require LSCWP_DIR . 'tpl/cache/settings_inc.purge_on_upgrade.tpl.php'; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<tr>
|
||||
<th><?php esc_html_e( 'Auto Purge Rules For Publish/Update', 'litespeed-cache' ); ?></th>
|
||||
<td>
|
||||
<div class="litespeed-callout notice notice-warning inline">
|
||||
<h4><?php esc_html_e( 'Note', 'litespeed-cache' ); ?></h4>
|
||||
<p>
|
||||
<?php esc_html_e( 'Select "All" if there are dynamic widgets linked to posts on pages other than the front or home pages.', 'litespeed-cache' ); ?><br>
|
||||
<?php esc_html_e( 'Other checkboxes will be ignored.', 'litespeed-cache' ); ?><br>
|
||||
<?php esc_html_e( 'Select only the archive types that are currently used, the others can be left unchecked.', 'litespeed-cache' ); ?>
|
||||
</p>
|
||||
</div>
|
||||
<div class="litespeed-top20">
|
||||
<div class="litespeed-tick-wrapper">
|
||||
<?php
|
||||
foreach ( $option_list as $option_id => $cur_title ) {
|
||||
$this->build_checkbox( $option_id, $cur_title );
|
||||
if ( in_array( $option_id, $break_arr, true ) ) {
|
||||
echo '</div><div class="litespeed-tick-wrapper litespeed-top10">';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Select which pages will be automatically purged when posts are published/updated.', 'litespeed-cache' ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_PURGE_STALE; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_switch( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'If ON, the stale copy of a cached page will be shown to visitors until a new cache copy is available. Reduces the server load for following visits. If OFF, the page will be dynamically generated while visitors wait.', 'litespeed-cache' ); ?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/cache/#serve-stale' ); ?>
|
||||
</div>
|
||||
<div class="litespeed-callout notice notice-warning inline">
|
||||
<h4><?php esc_html_e( 'Note', 'litespeed-cache' ); ?></h4>
|
||||
<p>
|
||||
<?php esc_html_e( 'By design, this option may serve stale content. Do not enable this option, if that is not OK with you.', 'litespeed-cache' ); ?><br>
|
||||
</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_PURGE_TIMED_URLS; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_textarea( $option_id, 80 ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php printf( esc_html__( 'The URLs here (one per line) will be purged automatically at the time set in the option "%s".', 'litespeed-cache' ), esc_html__( 'Scheduled Purge Time', 'litespeed-cache' ) ); ?><br>
|
||||
<?php printf( esc_html__( 'Both %1$s and %2$s are acceptable.', 'litespeed-cache' ), '<code>http://www.example.com/path/url.php</code>', '<code>/path/url.php</code>' ); ?>
|
||||
<?php Doc::one_per_line(); ?>
|
||||
</div>
|
||||
<div class="litespeed-desc">
|
||||
<?php printf( esc_html__( 'Wildcard %1$s supported (match zero or more characters). For example, to match %2$s and %3$s, use %4$s.', 'litespeed-cache' ), '<code>*</code>', '<code>/path/u-1.html</code>', '<code>/path/u-2.html</code>', '<code>/path/u-*.html</code>' ); ?>
|
||||
</div>
|
||||
<div class="litespeed-callout notice notice-warning inline">
|
||||
<h4><?php esc_html_e( 'Note', 'litespeed-cache' ); ?></h4>
|
||||
<p>
|
||||
<?php esc_html_e( 'For URLs with wildcards, there may be a delay in initiating scheduled purge.', 'litespeed-cache' ); ?><br>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/cache/#scheduled-purge-urls' ); ?>
|
||||
</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_PURGE_TIMED_URLS_TIME; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_input( $option_id, null, null, 'time' ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php printf( esc_html__( 'Specify the time to purge the "%s" list.', 'litespeed-cache' ), esc_html__( 'Scheduled Purge URLs', 'litespeed-cache' ) ); ?>
|
||||
<?php printf( esc_html__( 'Current server time is %s.', 'litespeed-cache' ), '<code>' . esc_html( gmdate( 'H:i:s', time() + LITESPEED_TIME_OFFSET ) ) . '</code>' ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_PURGE_HOOK_ALL; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<div class="litespeed-textarea-recommended">
|
||||
<div>
|
||||
<?php $this->build_textarea( $option_id, 50 ); ?>
|
||||
</div>
|
||||
<div>
|
||||
<?php $this->recommended( $option_id ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'A Purge All will be executed when WordPress runs these hooks.', 'litespeed-cache' ); ?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/cache/#purge-all-hooks' ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody></table>
|
||||
117
Atomaste Reference/public_html/wp-content/plugins/litespeed-cache/tpl/cache/settings-ttl.tpl.php
vendored
Normal file
117
Atomaste Reference/public_html/wp-content/plugins/litespeed-cache/tpl/cache/settings-ttl.tpl.php
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache TTL Settings
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
?>
|
||||
|
||||
<h3 class="litespeed-title-short">
|
||||
<?php echo esc_html__( 'TTL', 'litespeed-cache' ); ?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/cache/#ttl-tab' ); ?>
|
||||
</h3>
|
||||
|
||||
<table class="wp-list-table striped litespeed-table"><tbody>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_CACHE_TTL_PUB; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_input( $option_id ); ?> <?php $this->readable_seconds(); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php echo esc_html__( 'Specify how long, in seconds, public pages are cached.', 'litespeed-cache' ); ?>
|
||||
<?php $this->recommended( $option_id ); ?>
|
||||
<?php $this->_validate_ttl( $option_id, 30 ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_CACHE_TTL_PRIV; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_input( $option_id ); ?> <?php $this->readable_seconds(); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php echo esc_html__( 'Specify how long, in seconds, private pages are cached.', 'litespeed-cache' ); ?>
|
||||
<?php $this->recommended( $option_id ); ?>
|
||||
<?php $this->_validate_ttl( $option_id, 60, 3600 ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_CACHE_TTL_FRONTPAGE; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_input( $option_id ); ?> <?php $this->readable_seconds(); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php echo esc_html__( 'Specify how long, in seconds, the front page is cached.', 'litespeed-cache' ); ?>
|
||||
<?php $this->recommended( $option_id ); ?>
|
||||
<?php $this->_validate_ttl( $option_id, 30 ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_CACHE_TTL_FEED; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_input( $option_id ); ?> <?php $this->readable_seconds(); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php echo esc_html__( 'Specify how long, in seconds, feeds are cached.', 'litespeed-cache' ); ?>
|
||||
<?php echo esc_html__( 'If this is set to a number less than 30, feeds will not be cached.', 'litespeed-cache' ); ?>
|
||||
<?php $this->recommended( $option_id ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_CACHE_TTL_REST; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_input( $option_id ); ?> <?php $this->readable_seconds(); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php echo esc_html__( 'Specify how long, in seconds, REST calls are cached.', 'litespeed-cache' ); ?>
|
||||
<?php echo esc_html__( 'If this is set to a number less than 30, feeds will not be cached.', 'litespeed-cache' ); ?>
|
||||
<?php $this->recommended( $option_id ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_CACHE_TTL_STATUS; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<div class="litespeed-textarea-recommended">
|
||||
<div>
|
||||
<?php $this->build_textarea( $option_id, 30 ); ?>
|
||||
</div>
|
||||
<div>
|
||||
<?php $this->recommended( $option_id ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="litespeed-desc">
|
||||
<?php echo esc_html__( 'Specify an HTTP status code and the number of seconds to cache that page, separated by a space.', 'litespeed-cache' ); ?>
|
||||
<?php Doc::one_per_line(); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody></table>
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Browser Cache Settings
|
||||
*
|
||||
* Displays the browser cache settings section for LiteSpeed Cache.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
?>
|
||||
|
||||
<h3 class="litespeed-title-short">
|
||||
<?php esc_html_e( 'Browser Cache Settings', 'litespeed-cache' ); ?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/cache/#browser-tab' ); ?>
|
||||
</h3>
|
||||
|
||||
<?php if ( 'LITESPEED_SERVER_OLS' === LITESPEED_SERVER_TYPE ) : ?>
|
||||
<div class="litespeed-callout notice notice-warning inline">
|
||||
<h4><?php esc_html_e( 'NOTICE:', 'litespeed-cache' ); ?></h4>
|
||||
<p>
|
||||
<?php esc_html_e( 'OpenLiteSpeed users please check this', 'litespeed-cache' ); ?>:
|
||||
<?php Doc::learn_more( 'https://openlitespeed.org/kb/how-to-set-up-custom-headers/', esc_html__( 'Setting Up Custom Headers', 'litespeed-cache' ) ); ?>
|
||||
</p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<table class="wp-list-table striped litespeed-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php $option_id = Base::O_CACHE_BROWSER; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_switch( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( "Browser caching stores static files locally in the user's browser. Turn on this setting to reduce repeated requests for static files.", 'litespeed-cache' ); ?><br>
|
||||
<?php Doc::notice_htaccess(); ?><br>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: Link tags */
|
||||
esc_html__( 'You can turn on browser caching in server admin too. %sLearn more about LiteSpeed browser cache settings%s.', 'litespeed-cache' ),
|
||||
'<a href="https://docs.litespeedtech.com/lscache/lscwp/cache/#how-to-set-it-up" target="_blank" rel="noopener">',
|
||||
'</a>'
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php $option_id = Base::O_CACHE_TTL_BROWSER; ?>
|
||||
<?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( 'The amount of time, in seconds, that files will be stored in browser cache before expiring.', 'litespeed-cache' ); ?>
|
||||
<?php $this->recommended( $option_id ); ?>
|
||||
<?php $this->_validate_ttl( $option_id, 30 ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Drop Query Strings Setting
|
||||
*
|
||||
* Displays the drop query strings setting for LiteSpeed Cache.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php $option_id = Base::O_CACHE_DROP_QS; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_textarea( $option_id, 40 ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: LiteSpeed Web Server version */
|
||||
esc_html__( 'Ignore certain query strings when caching. (LSWS %s required)', 'litespeed-cache' ),
|
||||
'v5.2.3+'
|
||||
);
|
||||
?>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %1$s: Example query string, %2$s: Example wildcard */
|
||||
esc_html__( 'For example, to drop parameters beginning with %1$s, %2$s can be used here.', 'litespeed-cache' ),
|
||||
'<code>utm</code>',
|
||||
'<code>utm*</code>'
|
||||
);
|
||||
?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/cache/#drop-query-string' ); ?>
|
||||
<br />
|
||||
<?php Doc::one_per_line(); ?>
|
||||
<br />
|
||||
<?php Doc::notice_htaccess(); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Mobile View Settings
|
||||
*
|
||||
* Displays the mobile view cache settings for LiteSpeed Cache.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php $cid = Base::O_CACHE_MOBILE; ?>
|
||||
<?php $this->title( $cid ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_switch( $cid ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Serve a separate cache copy for mobile visitors.', 'litespeed-cache' ); ?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/cache/#cache-mobile', esc_html__( 'Learn more about when this is needed', 'litespeed-cache' ) ); ?>
|
||||
<br /><?php Doc::notice_htaccess(); ?>
|
||||
<br /><?php Doc::crawler_affected(); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row" class="litespeed-padding-left">
|
||||
<?php $cid = Base::O_CACHE_MOBILE_RULES; ?>
|
||||
<?php $this->title( $cid ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php
|
||||
if ( $this->conf( Base::O_CACHE_MOBILE ) ) {
|
||||
if ( defined( 'LITESPEED_ON' ) ) {
|
||||
try {
|
||||
$mobile_agents = Htaccess::cls()->current_mobile_agents();
|
||||
if ( Utility::arr2regex( $this->conf( $cid ), true ) !== $mobile_agents ) {
|
||||
?>
|
||||
<div class="litespeed-callout notice notice-error inline">
|
||||
<p>
|
||||
<?php esc_html_e( 'Htaccess did not match configuration option.', 'litespeed-cache' ); ?>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: Current mobile agents in htaccess */
|
||||
esc_html__( 'Htaccess rule is: %s', 'litespeed-cache' ),
|
||||
'<code>' . esc_html( $mobile_agents ) . '</code>'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
} catch ( \Exception $e ) {
|
||||
?>
|
||||
<div class="litespeed-callout notice notice-error inline">
|
||||
<p><?php echo wp_kses_post( $e->getMessage() ); ?></p>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="litespeed-textarea-recommended">
|
||||
<div>
|
||||
<?php $this->build_textarea( $cid, 40 ); ?>
|
||||
</div>
|
||||
<div>
|
||||
<?php $this->recommended( $cid ); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="litespeed-desc">
|
||||
<?php Doc::one_per_line(); ?>
|
||||
<?php $this->_validate_syntax( $cid ); ?>
|
||||
|
||||
<?php if ( $this->conf( Base::O_CACHE_MOBILE ) && ! $this->conf( $cid ) ) : ?>
|
||||
<span class="litespeed-warning">
|
||||
❌
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %1$s: Cache Mobile label, %2$s: ON status, %3$s: List of Mobile User Agents label */
|
||||
esc_html__( 'If %1$s is %2$s, then %3$s must be populated!', 'litespeed-cache' ),
|
||||
'<code>' . esc_html__( 'Cache Mobile', 'litespeed-cache' ) . '</code>',
|
||||
'<code>' . esc_html__( 'ON', 'litespeed-cache' ) . '</code>',
|
||||
'<code>' . esc_html__( 'List of Mobile User Agents', 'litespeed-cache' ) . '</code>'
|
||||
);
|
||||
?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Exclude Cookies Setting
|
||||
*
|
||||
* Displays the exclude cookies setting for LiteSpeed Cache.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php $option_id = Base::O_CACHE_EXC_COOKIES; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_textarea( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: "cookies" */
|
||||
esc_html__( 'To prevent %s from being cached, enter them here.', 'litespeed-cache' ),
|
||||
esc_html__( 'cookies', 'litespeed-cache' )
|
||||
);
|
||||
?>
|
||||
<?php Doc::one_per_line(); ?>
|
||||
<?php $this->_validate_syntax( $option_id ); ?>
|
||||
<br /><?php Doc::notice_htaccess(); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Exclude User Agents Setting
|
||||
*
|
||||
* Displays the exclude user agents setting for LiteSpeed Cache.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php $option_id = Base::O_CACHE_EXC_USERAGENTS; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_textarea( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: "user agents" */
|
||||
esc_html__( 'To prevent %s from being cached, enter them here.', 'litespeed-cache' ),
|
||||
esc_html__( 'user agents', 'litespeed-cache' )
|
||||
);
|
||||
?>
|
||||
<?php Doc::one_per_line(); ?>
|
||||
<?php $this->_validate_syntax( $option_id ); ?>
|
||||
<br /><?php Doc::notice_htaccess(); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Login Cookie and Vary Cookies Settings
|
||||
*
|
||||
* Displays the login cookie and vary cookies settings for LiteSpeed Cache.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php $option_id = Base::O_CACHE_LOGIN_COOKIE; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_input( $option_id ); ?>
|
||||
<?php $this->_validate_syntax( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php
|
||||
esc_html_e( 'SYNTAX: alphanumeric and "_". No spaces and case sensitive. MUST BE UNIQUE FROM OTHER WEB APPLICATIONS.', 'litespeed-cache' );
|
||||
?>
|
||||
<br />
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: Default login cookie name */
|
||||
esc_html__( 'The default login cookie is %s.', 'litespeed-cache' ),
|
||||
'<code>_lscache_vary</code>'
|
||||
);
|
||||
?>
|
||||
<?php esc_html_e( 'The server will determine if the user is logged in based on the existence of this cookie.', 'litespeed-cache' ); ?>
|
||||
<?php esc_html_e( 'This setting is useful for those that have multiple web applications for the same domain.', 'litespeed-cache' ); ?>
|
||||
<?php esc_html_e( 'If every web application uses the same cookie, the server may confuse whether a user is logged in or not.', 'litespeed-cache' ); ?>
|
||||
<?php esc_html_e( 'The cookie set here will be used for this WordPress installation.', 'litespeed-cache' ); ?>
|
||||
<br />
|
||||
<?php esc_html_e( 'Example use case:', 'litespeed-cache' ); ?><br />
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: Example domain */
|
||||
esc_html__( 'There is a WordPress installed for %s.', 'litespeed-cache' ),
|
||||
'<u>www.example.com</u>'
|
||||
);
|
||||
?>
|
||||
<br />
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: Example subdomain */
|
||||
esc_html__( 'Then another WordPress is installed (NOT MULTISITE) at %s', 'litespeed-cache' ),
|
||||
'<u>www.example.com/blog/</u>'
|
||||
);
|
||||
?>
|
||||
<?php esc_html_e( 'The cache needs to distinguish who is logged into which WordPress site in order to cache correctly.', 'litespeed-cache' ); ?><br />
|
||||
<?php Doc::notice_htaccess(); ?>
|
||||
</div>
|
||||
|
||||
<?php if ( preg_match( '#[^\w\-]#', $this->conf( $option_id ) ) ) : ?>
|
||||
<div class="litespeed-callout notice notice-error inline">
|
||||
<p>❌ <?php esc_html_e( 'Invalid login cookie. Invalid characters found.', 'litespeed-cache' ); ?></p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
if ( defined( 'LITESPEED_ON' ) && $this->conf( $option_id ) ) {
|
||||
$cookie_rule = '';
|
||||
try {
|
||||
$cookie_rule = Htaccess::cls()->current_login_cookie();
|
||||
} catch ( \Exception $e ) {
|
||||
?>
|
||||
<div class="litespeed-callout notice notice-error inline">
|
||||
<p><?php echo esc_html( $e->getMessage() ); ?></p>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
$cookie_arr = explode( ',', $cookie_rule );
|
||||
if ( ! in_array( $this->conf( $option_id ), $cookie_arr, true ) ) {
|
||||
?>
|
||||
<div class="litespeed-callout notice notice-warning inline">
|
||||
<p><?php esc_html_e( 'WARNING: The .htaccess login cookie and Database login cookie do not match.', 'litespeed-cache' ); ?></p>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php $option_id = Base::O_CACHE_VARY_COOKIES; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_textarea( $option_id, 50 ); ?>
|
||||
<?php $this->_validate_syntax( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'SYNTAX: alphanumeric and "_". No spaces and case sensitive.', 'litespeed-cache' ); ?>
|
||||
<br />
|
||||
<?php esc_html_e( 'You can list the 3rd party vary cookies here.', 'litespeed-cache' ); ?>
|
||||
<br />
|
||||
<?php Doc::notice_htaccess(); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -0,0 +1,306 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Object Cache Settings
|
||||
*
|
||||
* Displays the object cache settings section for LiteSpeed Cache.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
$lang_enabled = '<span class="litespeed-success">' . esc_html__( 'Enabled', 'litespeed-cache' ) . '</span>';
|
||||
$lang_disabled = '<span class="litespeed-warning">' . esc_html__( 'Disabled', 'litespeed-cache' ) . '</span>';
|
||||
|
||||
$mem_enabled = class_exists( 'Memcached' ) ? $lang_enabled : $lang_disabled;
|
||||
$redis_enabled = class_exists( 'Redis' ) ? $lang_enabled : $lang_disabled;
|
||||
|
||||
$mem_conn = $this->cls( 'Object_Cache' )->test_connection();
|
||||
if ( null === $mem_conn ) {
|
||||
$mem_conn_desc = '<span class="litespeed-desc">' . esc_html__( 'Not Available', 'litespeed-cache' ) . '</span>';
|
||||
} elseif ( $mem_conn ) {
|
||||
$mem_conn_desc = '<span class="litespeed-success">' . esc_html__( 'Passed', 'litespeed-cache' ) . '</span>';
|
||||
} else {
|
||||
$severity = $this->conf( Base::O_OBJECT, true ) ? 'danger' : 'warning';
|
||||
$mem_conn_desc = '<span class="litespeed-' . esc_attr( $severity ) . '">' . esc_html__( 'Failed', 'litespeed-cache' ) . '</span>';
|
||||
}
|
||||
?>
|
||||
|
||||
<h3 class="litespeed-title-short">
|
||||
<?php esc_html_e( 'Object Cache Settings', 'litespeed-cache' ); ?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/cache/#object-tab' ); ?>
|
||||
</h3>
|
||||
|
||||
<table class="wp-list-table striped litespeed-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php $option_id = Base::O_OBJECT; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_switch( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Use external object cache functionality.', 'litespeed-cache' ); ?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/admin/#memcached-lsmcd-and-redis-object-cache-support-in-lscwp' ); ?>
|
||||
</div>
|
||||
<div class="litespeed-block">
|
||||
<div class="litespeed-col-auto">
|
||||
<h4><?php esc_html_e( 'Status', 'litespeed-cache' ); ?></h4>
|
||||
</div>
|
||||
<div class="litespeed-col-auto">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: Object cache name */
|
||||
esc_html__( '%s Extension', 'litespeed-cache' ),
|
||||
'Memcached'
|
||||
);
|
||||
?>
|
||||
: <?php echo wp_kses_post( $mem_enabled ); ?><br>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: Object cache name */
|
||||
esc_html__( '%s Extension', 'litespeed-cache' ),
|
||||
'Redis'
|
||||
);
|
||||
?>
|
||||
: <?php echo wp_kses_post( $redis_enabled ); ?><br>
|
||||
<?php esc_html_e( 'Connection Test', 'litespeed-cache' ); ?>: <?php echo wp_kses_post( $mem_conn_desc ); ?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/admin/#how-to-debug' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php $option_id = Base::O_OBJECT_KIND; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_switch( $option_id, array( 'Memcached', 'Redis' ) ); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php $option_id = Base::O_OBJECT_HOST; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_input( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: Object cache name */
|
||||
esc_html__( 'Your %s Hostname or IP address.', 'litespeed-cache' ),
|
||||
'Memcached/<a href="https://docs.litespeedtech.com/products/lsmcd/" target="_blank" rel="noopener">LSMCD</a>/Redis'
|
||||
);
|
||||
?>
|
||||
<br>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %1$s: Socket name, %2$s: Host field title, %3$s: Example socket path */
|
||||
esc_html__( 'If you are using a %1$s socket, %2$s should be set to %3$s', 'litespeed-cache' ),
|
||||
'UNIX',
|
||||
esc_html( Lang::title( $option_id ) ),
|
||||
'<code>/path/to/memcached.sock</code>'
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php $option_id = Base::O_OBJECT_PORT; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_input( $option_id, 'litespeed-input-short2' ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %1$s: Object cache name, %2$s: Port number */
|
||||
esc_html__( 'Default port for %1$s is %2$s.', 'litespeed-cache' ),
|
||||
'Memcached',
|
||||
'<code>11211</code>'
|
||||
);
|
||||
?>
|
||||
<br>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %1$s: Object cache name, %2$s: Port number */
|
||||
esc_html__( 'Default port for %1$s is %2$s.', 'litespeed-cache' ),
|
||||
'Redis',
|
||||
'<code>6379</code>'
|
||||
);
|
||||
?>
|
||||
<br>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %1$s: Socket name, %2$s: Port field title, %3$s: Port value */
|
||||
esc_html__( 'If you are using a %1$s socket, %2$s should be set to %3$s', 'litespeed-cache' ),
|
||||
'UNIX',
|
||||
esc_html( Lang::title( $option_id ) ),
|
||||
'<code>0</code>'
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php $option_id = Base::O_OBJECT_LIFE; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_input( $option_id, 'litespeed-input-short2' ); ?> <?php esc_html_e( 'seconds', 'litespeed-cache' ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Default TTL for cached objects.', 'litespeed-cache' ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php $option_id = Base::O_OBJECT_USER; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_input( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: SASL */
|
||||
esc_html__( 'Only available when %s is installed.', 'litespeed-cache' ),
|
||||
'SASL'
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php $option_id = Base::O_OBJECT_PSWD; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_input( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Specify the password used when connecting.', 'litespeed-cache' ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php $option_id = Base::O_OBJECT_DB_ID; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_input( $option_id, 'litespeed-input-short' ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Database to be used', 'litespeed-cache' ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php $option_id = Base::O_OBJECT_GLOBAL_GROUPS; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_textarea( $option_id, 30 ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Groups cached at the network level.', 'litespeed-cache' ); ?>
|
||||
<?php Doc::one_per_line(); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php $option_id = Base::O_OBJECT_NON_PERSISTENT_GROUPS; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_textarea( $option_id, 30 ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php Doc::one_per_line(); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php $option_id = Base::O_OBJECT_PERSISTENT; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_switch( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Use keep-alive connections to speed up cache operations.', 'litespeed-cache' ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php $option_id = Base::O_OBJECT_ADMIN; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_switch( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Improve wp-admin speed through caching. (May encounter expired data)', 'litespeed-cache' ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php $option_id = Base::O_OBJECT_TRANSIENTS; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_switch( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %1$s: Object Cache Admin title, %2$s: OFF status */
|
||||
esc_html__( 'Save transients in database when %1$s is %2$s.', 'litespeed-cache' ),
|
||||
'<code>' . esc_html( Lang::title( Base::O_OBJECT_ADMIN ) ) . '</code>',
|
||||
'<code>' . esc_html__( 'OFF', 'litespeed-cache' ) . '</code>'
|
||||
);
|
||||
?>
|
||||
<br>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/cache/#store-transients' ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<script>
|
||||
jQuery(document).ready(function($) {
|
||||
// Auto-fill port based on object cache type
|
||||
$('input[name="object-kind"]').on('change', function() {
|
||||
var portInput = $('#input_objectport');
|
||||
var selectedKind = $(this).val();
|
||||
|
||||
// Memcached (0) -> 11211, Redis (1) -> 6379
|
||||
if (selectedKind === '0') {
|
||||
portInput.val('11211');
|
||||
} else if (selectedKind === '1') {
|
||||
portInput.val('6379');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Purge on Upgrade Setting
|
||||
*
|
||||
* Displays the purge on upgrade setting for LiteSpeed Cache.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
?>
|
||||
|
||||
<!-- build_setting_purge_on_upgrade -->
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php $option_id = Base::O_PURGE_ON_UPGRADE; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_switch( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'When enabled, the cache will automatically purge when any plugin, theme or the WordPress core is upgraded.', 'litespeed-cache' ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -0,0 +1,164 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Cloudflare Settings
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
$this->form_action();
|
||||
?>
|
||||
|
||||
<h3 class="litespeed-title-short">
|
||||
<?php esc_html_e( 'Cloudflare Settings', 'litespeed-cache' ); ?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/cdn/' ); ?>
|
||||
</h3>
|
||||
|
||||
<table class="wp-list-table striped litespeed-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_CDN_CLOUDFLARE; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_switch( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php printf( esc_html__( 'Use %s API functionality.', 'litespeed-cache' ), 'Cloudflare' ); ?>
|
||||
</div>
|
||||
<div class="litespeed-block">
|
||||
<div class='litespeed-col'>
|
||||
<label class="litespeed-form-label"><?php esc_html_e( 'Global API Key / API Token', 'litespeed-cache' ); ?></label>
|
||||
<?php $this->build_input( Base::O_CDN_CLOUDFLARE_KEY ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php printf( esc_html__( 'Your API key / token is used to access %s APIs.', 'litespeed-cache' ), 'Cloudflare' ); ?>
|
||||
<?php printf( esc_html__( 'Get it from %s.', 'litespeed-cache' ), '<a href="https://dash.cloudflare.com/profile/api-tokens" target="_blank" rel="noopener">Cloudflare</a>' ); ?>
|
||||
<?php esc_html_e( 'Recommended to generate the token from Cloudflare API token template "WordPress".', 'litespeed-cache' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class='litespeed-col'>
|
||||
<label class="litespeed-form-label"><?php esc_html_e( 'Email Address', 'litespeed-cache' ); ?></label>
|
||||
<?php $this->build_input( Base::O_CDN_CLOUDFLARE_EMAIL ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php printf( esc_html__( 'Your Email address on %s.', 'litespeed-cache' ), 'Cloudflare' ); ?>
|
||||
<?php esc_html_e( 'Optional when API token used.', 'litespeed-cache' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class='litespeed-col'>
|
||||
<label class="litespeed-form-label"><?php esc_html_e( 'Domain', 'litespeed-cache' ); ?></label>
|
||||
<?php
|
||||
$cf_zone = $this->conf( Base::O_CDN_CLOUDFLARE_ZONE );
|
||||
$cls = $cf_zone ? ' litespeed-input-success' : ' litespeed-input-warning';
|
||||
$this->build_input( Base::O_CDN_CLOUDFLARE_NAME, $cls );
|
||||
?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'You can just type part of the domain.', 'litespeed-cache' ); ?>
|
||||
<?php esc_html_e( 'Once saved, it will be matched with the current list and completed automatically.', 'litespeed-cache' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_CDN_CLOUDFLARE_CLEAR; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_switch( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php printf( esc_html__( 'Clear %s cache when "Purge All" is run.', 'litespeed-cache' ), 'Cloudflare' ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php
|
||||
$this->form_end();
|
||||
$cf_on = $this->conf( Base::O_CDN_CLOUDFLARE );
|
||||
$cf_domain = $this->conf( Base::O_CDN_CLOUDFLARE_NAME );
|
||||
$cf_zone = $this->conf( Base::O_CDN_CLOUDFLARE_ZONE );
|
||||
if ( ! $cf_domain ) {
|
||||
$cf_domain = '-';
|
||||
}
|
||||
if ( ! $cf_zone ) {
|
||||
$cf_zone = '-';
|
||||
}
|
||||
|
||||
$curr_status = CDN\Cloudflare::get_option( CDN\Cloudflare::ITEM_STATUS, array() );
|
||||
?>
|
||||
|
||||
<h3 class="litespeed-title"><?php esc_html_e( 'Cloudflare', 'litespeed-cache' ); ?></h3>
|
||||
|
||||
<?php if ( ! $cf_on ) : ?>
|
||||
<div class="litespeed-callout notice notice-error inline">
|
||||
<h4><?php esc_html_e( 'WARNING', 'litespeed-cache' ); ?></h4>
|
||||
<p>
|
||||
<?php esc_html_e( 'To enable the following functionality, turn ON Cloudflare API in CDN Settings.', 'litespeed-cache' ); ?>
|
||||
</p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<p><?php esc_html_e( 'Cloudflare Domain', 'litespeed-cache' ); ?>: <code><?php echo esc_textarea( $cf_domain ); ?></code></p>
|
||||
<p><?php esc_html_e( 'Cloudflare Zone', 'litespeed-cache' ); ?>: <code><?php echo esc_textarea( $cf_zone ); ?></code></p>
|
||||
|
||||
<p>
|
||||
<b><?php esc_html_e( 'Development Mode', 'litespeed-cache' ); ?>:</b>
|
||||
<a href="<?php echo esc_url( Utility::build_url( Router::ACTION_CDN_CLOUDFLARE, CDN\Cloudflare::TYPE_SET_DEVMODE_ON ) ); ?>" class="button litespeed-btn-warning">
|
||||
<?php esc_html_e( 'Turn ON', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
<a href="<?php echo esc_url( Utility::build_url( Router::ACTION_CDN_CLOUDFLARE, CDN\Cloudflare::TYPE_SET_DEVMODE_OFF ) ); ?>" class="button litespeed-btn-warning">
|
||||
<?php esc_html_e( 'Turn OFF', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
<a href="<?php echo esc_url( Utility::build_url( Router::ACTION_CDN_CLOUDFLARE, CDN\Cloudflare::TYPE_GET_DEVMODE ) ); ?>" class="button litespeed-btn-success">
|
||||
<?php esc_html_e( 'Check Status', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
|
||||
<?php if ( $curr_status ) : ?>
|
||||
<span class="litespeed-desc">
|
||||
<?php
|
||||
if ( time() >= $curr_status['devmode_expired'] ) {
|
||||
$expired_at = gmdate( 'm/d/Y H:i:s', $curr_status['devmode_expired'] + LITESPEED_TIME_OFFSET );
|
||||
$curr_status['devmode'] = 'OFF';
|
||||
printf(
|
||||
esc_html__( 'Current status is %1$s since %2$s.', 'litespeed-cache' ),
|
||||
'<code>' . esc_html( strtoupper( $curr_status['devmode'] ) ) . '</code>',
|
||||
'<code>' . esc_html( $expired_at ) . '</code>'
|
||||
);
|
||||
} else {
|
||||
$expired_at = $curr_status['devmode_expired'] - time();
|
||||
$expired_at = Utility::readable_time( $expired_at, 3600 * 3, true );
|
||||
printf(
|
||||
esc_html__( 'Current status is %s.', 'litespeed-cache' ),
|
||||
'<code>' . esc_html( strtoupper( $curr_status['devmode'] ) ) . '</code>'
|
||||
);
|
||||
printf(
|
||||
esc_html__( 'Development mode will be automatically turned off in %s.', 'litespeed-cache' ),
|
||||
'<code>' . esc_html( $expired_at ) . '</code>'
|
||||
);
|
||||
}
|
||||
?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
<br>
|
||||
<?php esc_html_e( 'Temporarily bypass Cloudflare cache. This allows changes to the origin server to be seen in realtime.', 'litespeed-cache' ); ?>
|
||||
<br>
|
||||
<?php esc_html_e( 'Development Mode will be turned off automatically after three hours.', 'litespeed-cache' ); ?>
|
||||
<?php printf( esc_html__( '%1$sLearn More%2$s', 'litespeed-cache' ), '<a href="https://support.cloudflare.com/hc/en-us/articles/200168246" target="_blank" rel="noopener">', '</a>' ); ?>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b><?php esc_html_e( 'Cloudflare Cache', 'litespeed-cache' ); ?>:</b>
|
||||
<?php if ( ! $cf_on ) : ?>
|
||||
<a href="#" class="button button-secondary disabled">
|
||||
<?php else : ?>
|
||||
<a href="<?php echo esc_url( Utility::build_url( Router::ACTION_CDN_CLOUDFLARE, CDN\Cloudflare::TYPE_PURGE_ALL ) ); ?>" class="button litespeed-btn-danger">
|
||||
<?php endif; ?>
|
||||
<?php esc_html_e( 'Purge Everything', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
</p>
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache CDN Settings
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
$menu_list = array(
|
||||
'qc' => esc_html__( 'QUIC.cloud', 'litespeed-cache' ),
|
||||
'cf' => esc_html__( 'Cloudflare', 'litespeed-cache' ),
|
||||
'other' => esc_html__( 'Other Static CDN', 'litespeed-cache' ),
|
||||
);
|
||||
?>
|
||||
|
||||
<div class="wrap">
|
||||
<h1 class="litespeed-h1">
|
||||
<?php esc_html_e( 'LiteSpeed Cache CDN', 'litespeed-cache' ); ?>
|
||||
</h1>
|
||||
<span class="litespeed-desc">
|
||||
<?php echo esc_html( 'v' . Core::VER ); ?>
|
||||
</span>
|
||||
<hr class="wp-header-end">
|
||||
</div>
|
||||
|
||||
<div class="litespeed-wrap">
|
||||
<h2 class="litespeed-header nav-tab-wrapper">
|
||||
<?php GUI::display_tab_list( $menu_list ); ?>
|
||||
</h2>
|
||||
|
||||
<div class="litespeed-body">
|
||||
<?php
|
||||
foreach ( $menu_list as $menu_key => $menu_value ) {
|
||||
printf(
|
||||
'<div data-litespeed-layout="%s">',
|
||||
esc_attr( $menu_key )
|
||||
);
|
||||
require LSCWP_DIR . "tpl/cdn/$menu_key.tpl.php";
|
||||
echo '</div>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,218 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache CDN Settings
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
$home_url = home_url( '/' );
|
||||
$parsed = wp_parse_url( $home_url );
|
||||
$home_url = str_replace( $parsed['scheme'] . ':', '', $home_url );
|
||||
|
||||
$cdn_mapping = $this->conf( Base::O_CDN_MAPPING );
|
||||
// Special handler: Append one row if somehow the DB default preset value got deleted
|
||||
if ( ! $cdn_mapping ) {
|
||||
$this->load_default_vals();
|
||||
$cdn_mapping = self::$_default_options[ Base::O_CDN_MAPPING ];
|
||||
}
|
||||
|
||||
$this->form_action();
|
||||
?>
|
||||
|
||||
<h3 class="litespeed-title-short">
|
||||
<?php esc_html_e( 'CDN Settings', 'litespeed-cache' ); ?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/cdn/' ); ?>
|
||||
</h3>
|
||||
|
||||
<table class="wp-list-table striped litespeed-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_CDN; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_switch( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php
|
||||
printf(
|
||||
esc_html__( 'Turn this setting %s if you are using a traditional Content Delivery Network (CDN) or a subdomain for static content with QUIC.cloud CDN.', 'litespeed-cache' ),
|
||||
'<code>' . esc_html__( 'ON', 'litespeed-cache' ) . '</code>'
|
||||
);
|
||||
?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/cdn/#use-cdn-mapping' ); ?>
|
||||
<br>
|
||||
<?php
|
||||
printf(
|
||||
esc_html__( 'NOTE: QUIC.cloud CDN and Cloudflare do not use CDN Mapping. If you are only using QUIC.cloud or Cloudflare, leave this setting %s.', 'litespeed-cache' ),
|
||||
'<code>' . esc_html__( 'OFF', 'litespeed-cache' ) . '</code>'
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th class="litespeed-padding-left"></th>
|
||||
<td>
|
||||
<?php $this->enroll( Base::O_CDN_MAPPING . '[' . Base::CDN_MAPPING_URL . '][]' ); ?>
|
||||
<?php $this->enroll( Base::O_CDN_MAPPING . '[' . Base::CDN_MAPPING_INC_IMG . '][]' ); ?>
|
||||
<?php $this->enroll( Base::O_CDN_MAPPING . '[' . Base::CDN_MAPPING_INC_CSS . '][]' ); ?>
|
||||
<?php $this->enroll( Base::O_CDN_MAPPING . '[' . Base::CDN_MAPPING_INC_JS . '][]' ); ?>
|
||||
<?php $this->enroll( Base::O_CDN_MAPPING . '[' . Base::CDN_MAPPING_FILETYPE . '][]' ); ?>
|
||||
|
||||
<div id="litespeed_cdn_mapping_div"></div>
|
||||
|
||||
<script type="text/babel">
|
||||
ReactDOM.render(
|
||||
<CDNMapping list={ <?php echo wp_json_encode( $cdn_mapping ); ?> } />,
|
||||
document.getElementById( 'litespeed_cdn_mapping_div' )
|
||||
);
|
||||
</script>
|
||||
|
||||
<div class="litespeed-warning">
|
||||
<?php esc_html_e( 'NOTE', 'litespeed-cache' ); ?>:
|
||||
<?php esc_html_e( 'To randomize CDN hostname, define multiple hostnames for the same resources.', 'litespeed-cache' ); ?>
|
||||
</div>
|
||||
|
||||
<div class="litespeed-desc">
|
||||
<b><?php $this->title( Base::CDN_MAPPING_INC_IMG ); ?></b>:
|
||||
<?php
|
||||
printf(
|
||||
esc_html__( 'Serve all image files through the CDN. This will affect all attachments, HTML %1$s tags, and CSS %2$s attributes.', 'litespeed-cache' ),
|
||||
'<code><img</code>',
|
||||
'<code>url()</code>'
|
||||
);
|
||||
?>
|
||||
<br>
|
||||
<b><?php $this->title( Base::CDN_MAPPING_INC_CSS ); ?></b>:
|
||||
<?php esc_html_e( 'Serve all CSS files through the CDN. This will affect all enqueued WP CSS files.', 'litespeed-cache' ); ?>
|
||||
<br>
|
||||
<b><?php $this->title( Base::CDN_MAPPING_INC_JS ); ?></b>:
|
||||
<?php esc_html_e( 'Serve all JavaScript files through the CDN. This will affect all enqueued WP JavaScript files.', 'litespeed-cache' ); ?>
|
||||
<br>
|
||||
<b><?php $this->title( Base::CDN_MAPPING_FILETYPE ); ?></b>:
|
||||
<?php esc_html_e( 'Static file type links to be replaced by CDN links.', 'litespeed-cache' ); ?>
|
||||
<?php Doc::one_per_line(); ?>
|
||||
<?php
|
||||
printf(
|
||||
esc_html__( 'This will affect all tags containing attributes: %s.', 'litespeed-cache' ),
|
||||
'<code>src=""</code> <code>data-src=""</code> <code>href=""</code>'
|
||||
);
|
||||
?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/cdn/#include-file-types', esc_html__( 'Default value', 'litespeed-cache' ) ); ?>
|
||||
<br>
|
||||
<?php
|
||||
printf(
|
||||
esc_html__( 'If you turn any of the above settings OFF, please remove the related file types from the %s box.', 'litespeed-cache' ),
|
||||
'<b>' . esc_html__( 'Include File Types', 'litespeed-cache' ) . '</b>'
|
||||
);
|
||||
?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/cdn/#include-file-types' ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_CDN_ATTR; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<div class="litespeed-textarea-recommended">
|
||||
<div>
|
||||
<?php $this->build_textarea( $option_id, 40 ); ?>
|
||||
</div>
|
||||
<div>
|
||||
<?php $this->recommended( $option_id ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Specify which HTML element attributes will be replaced with CDN Mapping.', 'litespeed-cache' ); ?>
|
||||
<?php esc_html_e( 'Only attributes listed here will be replaced.', 'litespeed-cache' ); ?>
|
||||
<br>
|
||||
<?php
|
||||
printf(
|
||||
esc_html__( 'Use the format %1$s or %2$s (element is optional).', 'litespeed-cache' ),
|
||||
'<code>element.attribute</code>',
|
||||
'<code>.attribute</code>'
|
||||
);
|
||||
?>
|
||||
<?php Doc::one_per_line(); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th class="litespeed-padding-left">
|
||||
<?php $option_id = Base::O_CDN_ORI; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_textarea( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php
|
||||
printf(
|
||||
esc_html__( 'Site URL to be served through the CDN. Beginning with %1$s. For example, %2$s.', 'litespeed-cache' ),
|
||||
'<code>//</code>',
|
||||
'<code>' . esc_html( $home_url ) . '</code>'
|
||||
);
|
||||
?>
|
||||
<br>
|
||||
<?php
|
||||
printf(
|
||||
esc_html__( 'Wildcard %1$s supported (match zero or more characters). For example, to match %2$s and %3$s, use %4$s.', 'litespeed-cache' ),
|
||||
'<code>*</code>',
|
||||
'<code>//www.aa.com</code>',
|
||||
'<code>//aa.com</code>',
|
||||
'<code>//*aa.com</code>'
|
||||
);
|
||||
?>
|
||||
<?php Doc::one_per_line(); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th class="litespeed-padding-left">
|
||||
<?php $option_id = Base::O_CDN_ORI_DIR; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<div class="litespeed-textarea-recommended">
|
||||
<div>
|
||||
<?php $this->build_textarea( $option_id, 40 ); ?>
|
||||
</div>
|
||||
<div>
|
||||
<?php $this->recommended( $option_id ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Only files within these directories will be pointed to the CDN.', 'litespeed-cache' ); ?>
|
||||
<?php Doc::one_per_line(); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th class="litespeed-padding-left">
|
||||
<?php $option_id = Base::O_CDN_EXC; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_textarea( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Paths containing these strings will not be served from the CDN.', 'litespeed-cache' ); ?>
|
||||
<?php Doc::one_per_line(); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php $this->form_end(); ?>
|
||||
@@ -0,0 +1,159 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache QUIC.cloud CDN Settings
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
$__cloud = Cloud::cls();
|
||||
$__cloud->finish_qc_activation( 'cdn' );
|
||||
$cloud_summary = Cloud::get_summary();
|
||||
?>
|
||||
|
||||
<div class="litespeed-flex-container litespeed-column-with-boxes">
|
||||
<div class="litespeed-width-7-10 litespeed-column-left litespeed-cdn-summary-wrapper">
|
||||
<div class="litespeed-column-left-inside">
|
||||
<h3>
|
||||
<?php if ( $__cloud->activated() ) : ?>
|
||||
<a class="button button-small litespeed-right litespeed-learn-more" href="<?php echo esc_url( Utility::build_url( Router::ACTION_CLOUD, Cloud::TYPE_SYNC_STATUS ) ); ?>">
|
||||
<span class="dashicons dashicons-update"></span> <?php esc_html_e( 'Refresh Status', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<span class="litespeed-quic-icon"></span> <?php esc_html_e( 'QUIC.cloud CDN Status Overview', 'litespeed-cache' ); ?>
|
||||
</h3>
|
||||
<p class="litespeed-desc"><?php esc_html_e( 'Check the status of your most important settings and the health of your CDN setup here.', 'litespeed-cache' ); ?></p>
|
||||
|
||||
<?php if ( ! $__cloud->activated() ) : ?>
|
||||
<div class="litespeed-dashboard-unlock litespeed-dashboard-unlock--inline">
|
||||
<div>
|
||||
<h3 class="litespeed-dashboard-unlock-title"><strong class="litespeed-qc-text-gradient"><?php esc_html_e( 'Accelerate, Optimize, Protect', 'litespeed-cache' ); ?></strong></h3>
|
||||
<p class="litespeed-dashboard-unlock-desc">
|
||||
<?php echo wp_kses_post( __( 'Speed up your WordPress site even further with <strong>QUIC.cloud Online Services and CDN</strong>.', 'litespeed-cache' ) ); ?>
|
||||
</p>
|
||||
<p><?php esc_html_e( 'Free monthly quota available.', 'litespeed-cache' ); ?></p>
|
||||
<p>
|
||||
<a class="button button-primary" href="<?php echo esc_url( Utility::build_url( Router::ACTION_CLOUD, Cloud::TYPE_ACTIVATE, false, null, array( 'ref' => 'cdn' ) ) ); ?>">
|
||||
<span class="dashicons dashicons-yes"></span><?php esc_html_e( 'Enable QUIC.cloud services', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
</p>
|
||||
<p class="litespeed-dashboard-unlock-footer">
|
||||
<?php esc_html_e( 'QUIC.cloud provides CDN and online optimization services, and is not required. You may use many features of this plugin without QUIC.cloud.', 'litespeed-cache' ); ?><br>
|
||||
<a href="https://www.quic.cloud/" target="_blank" rel="noopener"><?php esc_html_e( 'Learn More about QUIC.cloud', 'litespeed-cache' ); ?></a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<?php elseif ( empty( $cloud_summary['qc_activated'] ) || 'cdn' !== $cloud_summary['qc_activated'] ) : ?>
|
||||
<div class="litespeed-top20">
|
||||
<?php if ( ! empty( $cloud_summary['qc_activated'] ) && 'linked' === $cloud_summary['qc_activated'] ) : ?>
|
||||
<p><?php echo wp_kses_post( __( 'QUIC.cloud CDN is currently <strong>fully disabled</strong>.', 'litespeed-cache' ) ); ?></p>
|
||||
<?php else : ?>
|
||||
<p><?php echo wp_kses_post( __( 'QUIC.cloud CDN is <strong>not available</strong> for anonymous (unlinked) users.', 'litespeed-cache' ) ); ?></p>
|
||||
<?php endif; ?>
|
||||
<p>
|
||||
<?php
|
||||
$btn_title = esc_html__( 'Link & Enable QUIC.cloud CDN', 'litespeed-cache' );
|
||||
if ( ! empty( $cloud_summary['qc_activated'] ) && 'linked' === $cloud_summary['qc_activated'] ) {
|
||||
$btn_title = esc_html__( 'Enable QUIC.cloud CDN', 'litespeed-cache' );
|
||||
}
|
||||
Doc::learn_more(
|
||||
esc_url( Utility::build_url( Router::ACTION_CLOUD, Cloud::TYPE_ENABLE_CDN, false, null, array( 'ref' => 'cdn' ) ) ),
|
||||
'<span class="dashicons dashicons-yes"></span>' . $btn_title,
|
||||
true,
|
||||
'button button-primary litespeed-button-cta'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<h3 class="litespeed-title-section"><?php esc_html_e( 'Content Delivery Network Service', 'litespeed-cache' ); ?></h3>
|
||||
<p class="litespeed-text-md">
|
||||
<?php esc_html_e( 'Serve your visitors fast', 'litespeed-cache' ); ?> <strong class="litespeed-qc-text-gradient"><?php esc_html_e( 'no matter where they live.', 'litespeed-cache' ); ?></strong>
|
||||
</p>
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: Link tags */
|
||||
esc_html__( 'Best available WordPress performance, globally fast TTFB, easy setup, and %smore%s!', 'litespeed-cache' ),
|
||||
'<a href="https://www.quic.cloud/quic-cloud-services-and-features/litespeed-cache-service/" target="_blank" rel="noopener">',
|
||||
'</a>'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
<?php else : ?>
|
||||
<?php echo wp_kses_post( $__cloud->load_qc_status_for_dash( 'cdn_dash' ) ); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="litespeed-width-3-10 litespeed-column-right">
|
||||
<div class="postbox litespeed-postbox">
|
||||
<div class="inside">
|
||||
<h3 class="litespeed-title">
|
||||
<?php esc_html_e( 'QUIC.cloud CDN Options', 'litespeed-cache' ); ?>
|
||||
</h3>
|
||||
<?php if ( ! empty( $cloud_summary['partner'] ) && ! empty( $cloud_summary['partner']['disable_qc_login'] ) ) : ?>
|
||||
<?php if ( ! empty( $cloud_summary['partner']['logo'] ) ) : ?>
|
||||
<?php if ( ! empty( $cloud_summary['partner']['url'] ) ) : ?>
|
||||
<a href="<?php echo esc_url( $cloud_summary['partner']['url'] ); ?>" target="_blank" rel="noopener">
|
||||
<img src="<?php echo esc_url( $cloud_summary['partner']['logo'] ); ?>" alt="<?php echo esc_attr( $cloud_summary['partner']['name'] ); ?>">
|
||||
</a>
|
||||
<?php else : ?>
|
||||
<img src="<?php echo esc_url( $cloud_summary['partner']['logo'] ); ?>" alt="<?php echo esc_attr( $cloud_summary['partner']['name'] ); ?>">
|
||||
<?php endif; ?>
|
||||
<?php elseif ( ! empty( $cloud_summary['partner']['name'] ) ) : ?>
|
||||
<?php if ( ! empty( $cloud_summary['partner']['url'] ) ) : ?>
|
||||
<a href="<?php echo esc_url( $cloud_summary['partner']['url'] ); ?>" target="_blank" rel="noopener">
|
||||
<span class="postbox-partner-name"><?php echo esc_html( $cloud_summary['partner']['name'] ); ?></span>
|
||||
</a>
|
||||
<?php else : ?>
|
||||
<span class="postbox-partner-name"><?php echo esc_html( $cloud_summary['partner']['name'] ); ?></span>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<?php if ( ! $__cloud->activated() ) : ?>
|
||||
<p><?php esc_html_e( 'To manage your QUIC.cloud options, go to your hosting provider\'s portal.', 'litespeed-cache' ); ?></p>
|
||||
<?php else : ?>
|
||||
<p><?php esc_html_e( 'To manage your QUIC.cloud options, please contact your hosting provider.', 'litespeed-cache' ); ?></p>
|
||||
<?php endif; ?>
|
||||
<?php else : ?>
|
||||
<?php if ( ! $__cloud->activated() ) : ?>
|
||||
<p><?php esc_html_e( 'To manage your QUIC.cloud options, go to QUIC.cloud Dashboard.', 'litespeed-cache' ); ?></p>
|
||||
<p class="litespeed-top20">
|
||||
<button type="button" class="button button-primary disabled">
|
||||
<?php esc_html_e( 'Link to QUIC.cloud', 'litespeed-cache' ); ?>
|
||||
</button>
|
||||
</p>
|
||||
<?php elseif ( 'anonymous' === $cloud_summary['qc_activated'] ) : ?>
|
||||
<p><?php esc_html_e( 'You are currently using services as an anonymous user. To manage your QUIC.cloud options, use the button below to create an account and link to the QUIC.cloud Dashboard.', 'litespeed-cache' ); ?></p>
|
||||
<p class="litespeed-top20">
|
||||
<a href="<?php echo esc_url( Utility::build_url( Router::ACTION_CLOUD, Cloud::TYPE_LINK, false, null, array( 'ref' => 'cdn' ) ) ); ?>" class="button button-<?php echo ( empty( $cloud_summary['qc_activated'] ) || 'cdn' !== $cloud_summary['qc_activated'] ) ? 'secondary' : 'primary'; ?>">
|
||||
<?php esc_html_e( 'Link to QUIC.cloud', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
</p>
|
||||
<?php elseif ( 'linked' === $cloud_summary['qc_activated'] ) : ?>
|
||||
<p class="litespeed-top20">
|
||||
<a href="<?php echo esc_url( $__cloud->qc_link() ); ?>" target="qc" rel="noopener" class="button button-<?php echo ( empty( $cloud_summary['qc_activated'] ) || 'cdn' !== $cloud_summary['qc_activated'] ) ? 'secondary' : 'primary'; ?>">
|
||||
<?php esc_html_e( 'My QUIC.cloud Dashboard', 'litespeed-cache' ); ?> <span class="dashicons dashicons-external"></span>
|
||||
</a>
|
||||
</p>
|
||||
<?php else : ?>
|
||||
<p><?php esc_html_e( 'To manage your QUIC.cloud options, go to QUIC.cloud Dashboard.', 'litespeed-cache' ); ?></p>
|
||||
<p class="litespeed-top20">
|
||||
<a href="<?php echo esc_url( $__cloud->qc_link() ); ?>" target="qc" rel="noopener" class="button button-<?php echo ( empty( $cloud_summary['qc_activated'] ) || 'cdn' !== $cloud_summary['qc_activated'] ) ? 'secondary' : 'primary'; ?>">
|
||||
<?php esc_html_e( 'My QUIC.cloud Dashboard', 'litespeed-cache' ); ?> <span class="dashicons dashicons-external"></span>
|
||||
</a>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php $promo_mini = $__cloud->load_qc_status_for_dash( 'promo_mini' ); ?>
|
||||
<?php if ( $promo_mini ) : ?>
|
||||
<?php echo wp_kses_post( $promo_mini ); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Crawler Blocklist
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
$crawler_summary = Crawler::get_summary();
|
||||
$__map = Crawler_Map::cls();
|
||||
$__admin_display = Admin_Display::cls();
|
||||
$list = $__map->list_blacklist( 30 );
|
||||
$count = $__map->count_blacklist();
|
||||
$pagination = Utility::pagination( $count, 30 );
|
||||
?>
|
||||
|
||||
<p class="litespeed-right">
|
||||
<a href="<?php echo esc_url( Utility::build_url( Router::ACTION_CRAWLER, Crawler::TYPE_BLACKLIST_EMPTY ) ); ?>" class="button litespeed-btn-warning" data-litespeed-cfm="<?php esc_attr_e( 'Are you sure to delete all existing blocklist items?', 'litespeed-cache' ); ?>">
|
||||
<?php esc_html_e( 'Empty blocklist', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<h3 class="litespeed-title">
|
||||
<?php esc_html_e( 'Blocklist', 'litespeed-cache' ); ?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/crawler/#blocklist-tab' ); ?>
|
||||
</h3>
|
||||
|
||||
<?php echo esc_html__( 'Total', 'litespeed-cache' ) . ': ' . esc_html( $count ); ?>
|
||||
|
||||
<?php echo wp_kses_post( $pagination ); ?>
|
||||
|
||||
<div class="litespeed-table-responsive">
|
||||
<table class="wp-list-table widefat striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">#</th>
|
||||
<th scope="col"><?php esc_html_e( 'URL', 'litespeed-cache' ); ?></th>
|
||||
<th scope="col"><?php esc_html_e( 'Status', 'litespeed-cache' ); ?></th>
|
||||
<th scope="col"><?php esc_html_e( 'Operation', 'litespeed-cache' ); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ( $list as $i => $v ) : ?>
|
||||
<tr>
|
||||
<td><?php echo esc_html( $i + 1 ); ?></td>
|
||||
<td><?php echo esc_html( $v['url'] ); ?></td>
|
||||
<td><?php echo wp_kses_post( Crawler::cls()->display_status( $v['res'], $v['reason'] ) ); ?></td>
|
||||
<td>
|
||||
<a href="<?php echo esc_url( Utility::build_url( Router::ACTION_CRAWLER, Crawler::TYPE_BLACKLIST_DEL, false, null, array( 'id' => $v['id'] ) ) ); ?>" class="button button-secondary">
|
||||
<?php esc_html_e( 'Remove from Blocklist', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<?php echo wp_kses_post( $pagination ); ?>
|
||||
|
||||
<p>
|
||||
<span class="litespeed-success">
|
||||
<?php
|
||||
printf(
|
||||
esc_html__( 'API: PHP Constant %s available to disable blocklist.', 'litespeed-cache' ),
|
||||
'<code>LITESPEED_CRAWLER_DISABLE_BLOCKLIST</code>'
|
||||
);
|
||||
?>
|
||||
</span>
|
||||
</p>
|
||||
<p>
|
||||
<span class="litespeed-success">
|
||||
<?php
|
||||
printf(
|
||||
esc_html__( 'API: Filter %s available to disable blocklist.', 'litespeed-cache' ),
|
||||
'<code>add_filter( \'litespeed_crawler_disable_blocklist\', \'__return_true\' );</code>'
|
||||
);
|
||||
?>
|
||||
</span>
|
||||
</p>
|
||||
<?php $__admin_display->_check_overwritten( 'crawler-blocklist' ); ?>
|
||||
<p>
|
||||
<i class="litespeed-dot litespeed-bg-default"></i> = <?php esc_html_e( 'Not blocklisted', 'litespeed-cache' ); ?><br>
|
||||
<i class="litespeed-dot litespeed-bg-warning"></i> = <?php esc_html_e( 'Blocklisted due to not cacheable', 'litespeed-cache' ); ?><br>
|
||||
<i class="litespeed-dot litespeed-bg-danger"></i> = <?php esc_html_e( 'Blocklisted', 'litespeed-cache' ); ?><br>
|
||||
</p>
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Crawler Settings
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
$menu_list = [
|
||||
'summary' => esc_html__( 'Summary', 'litespeed-cache' ),
|
||||
'map' => esc_html__( 'Map', 'litespeed-cache' ),
|
||||
'blacklist' => esc_html__( 'Blocklist', 'litespeed-cache' ),
|
||||
'settings' => esc_html__( 'Settings', 'litespeed-cache' ),
|
||||
];
|
||||
?>
|
||||
|
||||
<div class="wrap">
|
||||
<h1 class="litespeed-h1">
|
||||
<?php esc_html_e( 'LiteSpeed Cache Crawler', 'litespeed-cache' ); ?>
|
||||
</h1>
|
||||
<span class="litespeed-desc">
|
||||
<?php echo esc_html( 'v' . Core::VER ); ?>
|
||||
</span>
|
||||
<hr class="wp-header-end">
|
||||
</div>
|
||||
|
||||
<div class="litespeed-wrap">
|
||||
<h2 class="litespeed-header nav-tab-wrapper">
|
||||
<?php GUI::display_tab_list( $menu_list ); ?>
|
||||
</h2>
|
||||
|
||||
<div class="litespeed-body">
|
||||
<?php
|
||||
foreach ( $menu_list as $menu_key => $menu_value ) {
|
||||
printf(
|
||||
'<div data-litespeed-layout="%s">',
|
||||
esc_attr( $menu_key )
|
||||
);
|
||||
require LSCWP_DIR . "tpl/crawler/$menu_key.tpl.php";
|
||||
echo '</div>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<iframe name="litespeedHiddenIframe" src="" width="0" height="0" frameborder="0"></iframe>
|
||||
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Crawler Sitemap List
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
$crawler_summary = Crawler::get_summary();
|
||||
$__map = Crawler_Map::cls();
|
||||
$list = $__map->list_map( 30 );
|
||||
$count = $__map->count_map();
|
||||
$pagination = Utility::pagination( $count, 30 );
|
||||
$kw = '';
|
||||
if (! empty( $_POST['kw'] ) && ! empty( $_POST['_wpnonce'] )) {
|
||||
$nonce = sanitize_text_field(wp_unslash($_POST['_wpnonce']));
|
||||
if (wp_verify_nonce($nonce)) {
|
||||
$kw = sanitize_text_field(wp_unslash($_POST['kw']));
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<p class="litespeed-right">
|
||||
<a href="<?php echo esc_url( Utility::build_url( Router::ACTION_CRAWLER, Crawler::TYPE_EMPTY ) ); ?>" class="button litespeed-btn-warning">
|
||||
<?php esc_html_e( 'Clean Crawler Map', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
<a href="<?php echo esc_url( Utility::build_url( Router::ACTION_CRAWLER, Crawler::TYPE_REFRESH_MAP ) ); ?>" class="button button-secondary">
|
||||
<?php esc_html_e( 'Refresh Crawler Map', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<?php
|
||||
if ( ! empty( $crawler_summary['sitemap_time'] ) ) {
|
||||
printf(
|
||||
esc_html__( 'Generated at %s', 'litespeed-cache' ),
|
||||
esc_html( Utility::readable_time( $crawler_summary['sitemap_time'] ) )
|
||||
);
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
|
||||
<h3 class="litespeed-title">
|
||||
<?php esc_html_e( 'Sitemap List', 'litespeed-cache' ); ?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/crawler/#map-tab' ); ?>
|
||||
</h3>
|
||||
|
||||
<?php echo esc_html__( 'Sitemap Total', 'litespeed-cache' ) . ': ' . esc_html( $count ); ?>
|
||||
|
||||
<div style="display: flex; justify-content: space-between;">
|
||||
<div style="margin-top:10px;">
|
||||
<form action="<?php echo esc_url( admin_url( 'admin.php?page=litespeed-crawler' ) ); ?>" method="post">
|
||||
<?php wp_nonce_field(); ?>
|
||||
<input type="text" name="kw" value="<?php echo esc_attr( $kw ); ?>" placeholder="<?php esc_attr_e( 'URL Search', 'litespeed-cache' ); ?>" style="width: 600px;" />
|
||||
</form>
|
||||
</div>
|
||||
<div>
|
||||
<a style="padding-right:10px;" href="<?php echo esc_url( admin_url( 'admin.php?page=litespeed-crawler&' . Router::TYPE . '=hit' ) ); ?>"><?php esc_html_e( 'Cache Hit', 'litespeed-cache' ); ?></a>
|
||||
<a style="padding-right:10px;" href="<?php echo esc_url( admin_url( 'admin.php?page=litespeed-crawler&' . Router::TYPE . '=miss' ) ); ?>"><?php esc_html_e( 'Cache Miss', 'litespeed-cache' ); ?></a>
|
||||
<a style="padding-right:10px;" href="<?php echo esc_url( admin_url( 'admin.php?page=litespeed-crawler&' . Router::TYPE . '=blacklisted' ) ); ?>"><?php esc_html_e( 'Blocklisted', 'litespeed-cache' ); ?></a>
|
||||
</div>
|
||||
<div>
|
||||
<?php echo wp_kses_post( $pagination ); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="litespeed-table-responsive">
|
||||
<table class="wp-list-table widefat striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">#</th>
|
||||
<th scope="col"><?php esc_html_e( 'URL', 'litespeed-cache' ); ?></th>
|
||||
<th scope="col"><?php esc_html_e( 'Crawler Status', 'litespeed-cache' ); ?></th>
|
||||
<th scope="col"><?php esc_html_e( 'Operation', 'litespeed-cache' ); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ( $list as $i => $v ) : ?>
|
||||
<tr>
|
||||
<td><?php echo esc_html( $i + 1 ); ?></td>
|
||||
<td><?php echo esc_html( $v['url'] ); ?></td>
|
||||
<td><?php echo wp_kses_post( Crawler::cls()->display_status( $v['res'], $v['reason'] ) ); ?></td>
|
||||
<td>
|
||||
<a href="<?php echo esc_url( Utility::build_url( Router::ACTION_CRAWLER, Crawler::TYPE_BLACKLIST_ADD, false, null, array( 'id' => $v['id'] ) ) ); ?>" class="button button-secondary">
|
||||
<?php esc_html_e( 'Add to Blocklist', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<?php echo wp_kses_post( $pagination ); ?>
|
||||
|
||||
<p>
|
||||
<i class="litespeed-dot litespeed-bg-success"></i> = <?php esc_html_e( 'Cache Hit', 'litespeed-cache' ); ?><br>
|
||||
<i class="litespeed-dot litespeed-bg-primary"></i> = <?php esc_html_e( 'Cache Miss', 'litespeed-cache' ); ?><br>
|
||||
<i class="litespeed-dot litespeed-bg-warning"></i> = <?php esc_html_e( 'Blocklisted due to not cacheable', 'litespeed-cache' ); ?><br>
|
||||
<i class="litespeed-dot litespeed-bg-danger"></i> = <?php esc_html_e( 'Blocklisted', 'litespeed-cache' ); ?><br>
|
||||
</p>
|
||||
@@ -0,0 +1,189 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Crawler General Settings
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
$this->form_action();
|
||||
?>
|
||||
|
||||
<h3 class="litespeed-title-short">
|
||||
<?php esc_html_e( 'Crawler General Settings', 'litespeed-cache' ); ?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/crawler/#general-settings-tab' ); ?>
|
||||
</h3>
|
||||
|
||||
<table class="wp-list-table striped litespeed-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_CRAWLER; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_switch( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'This will enable crawler cron.', 'litespeed-cache' ); ?>
|
||||
<br><?php Doc::notice_htaccess(); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_CRAWLER_CRAWL_INTERVAL; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_input( $option_id ); ?> <?php esc_html_e( 'seconds', 'litespeed-cache' ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Specify how long in seconds before the crawler should initiate crawling the entire sitemap again.', 'litespeed-cache' ); ?>
|
||||
<?php $this->recommended( $option_id ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_CRAWLER_SITEMAP; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_textarea( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'The crawler will use your XML sitemap or sitemap index. Enter the full URL to your sitemap here.', 'litespeed-cache' ); ?>
|
||||
<?php Doc::one_per_line(); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_CRAWLER_LOAD_LIMIT; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_input( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'The maximum average server load allowed while crawling. The number of crawler threads in use will be actively reduced until average server load falls under this limit. If this cannot be achieved with a single thread, the current crawler run will be terminated.', 'litespeed-cache' ); ?>
|
||||
<?php if ( ! empty( $_SERVER[ Base::ENV_CRAWLER_LOAD_LIMIT_ENFORCE ] ) ) : ?>
|
||||
<span class="litespeed-warning">
|
||||
<?php esc_html_e( 'NOTE', 'litespeed-cache' ); ?>:
|
||||
<?php
|
||||
printf(
|
||||
esc_html__( 'Server enforced value: %s', 'litespeed-cache' ),
|
||||
'<code>' . esc_html( sanitize_text_field( wp_unslash( $_SERVER[ Base::ENV_CRAWLER_LOAD_LIMIT_ENFORCE ] ) ) ) . '</code>'
|
||||
);
|
||||
?>
|
||||
</span>
|
||||
<?php elseif ( ! empty( $_SERVER[ Base::ENV_CRAWLER_LOAD_LIMIT ] ) ) : ?>
|
||||
<span class="litespeed-warning">
|
||||
<?php esc_html_e( 'NOTE', 'litespeed-cache' ); ?>:
|
||||
<?php
|
||||
printf(
|
||||
esc_html__( 'Server allowed max value: %s', 'litespeed-cache' ),
|
||||
'<code>' . esc_html( sanitize_text_field( wp_unslash( $_SERVER[ Base::ENV_CRAWLER_LOAD_LIMIT ] ) ) ) . '</code>'
|
||||
);
|
||||
?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
<br>
|
||||
<?php $this->_api_env_var( Base::ENV_CRAWLER_LOAD_LIMIT, Base::ENV_CRAWLER_LOAD_LIMIT_ENFORCE ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_CRAWLER_ROLES; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_textarea( $option_id, 20 ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'To crawl the site as a logged-in user, enter the user ids to be simulated.', 'litespeed-cache' ); ?>
|
||||
<?php Doc::one_per_line(); ?>
|
||||
<?php if ( empty( $this->conf( Base::O_SERVER_IP ) ) ) : ?>
|
||||
<div class="litespeed-danger litespeed-text-bold">
|
||||
🚨 <?php esc_html_e( 'NOTICE', 'litespeed-cache' ); ?>:
|
||||
<?php
|
||||
printf(
|
||||
esc_html__( 'You must set %s before using this feature.', 'litespeed-cache' ),
|
||||
esc_html( Lang::title( Base::O_SERVER_IP ) )
|
||||
);
|
||||
?>
|
||||
<?php
|
||||
Doc::learn_more(
|
||||
esc_url( admin_url( 'admin.php?page=litespeed-general#settings' ) ),
|
||||
esc_html__( 'Click here to set.', 'litespeed-cache' ),
|
||||
true,
|
||||
false,
|
||||
true
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ( empty( $this->conf( Base::O_ESI ) ) ) : ?>
|
||||
<div class="litespeed-danger litespeed-text-bold">
|
||||
🚨 <?php esc_html_e( 'NOTICE', 'litespeed-cache' ); ?>:
|
||||
<?php
|
||||
printf(
|
||||
esc_html__( 'You must set %1$s to %2$s before using this feature.', 'litespeed-cache' ),
|
||||
esc_html( Lang::title( Base::O_ESI ) ),
|
||||
esc_html__( 'ON', 'litespeed-cache' )
|
||||
);
|
||||
?>
|
||||
<?php
|
||||
Doc::learn_more(
|
||||
esc_url( admin_url( 'admin.php?page=litespeed-cache#esi' ) ),
|
||||
esc_html__( 'Click here to set.', 'litespeed-cache' ),
|
||||
true,
|
||||
false,
|
||||
true
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_CRAWLER_COOKIES; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->enroll( $option_id . '[name][]' ); ?>
|
||||
<?php $this->enroll( $option_id . '[vals][]' ); ?>
|
||||
<div id="litespeed_crawler_simulation_div"></div>
|
||||
<script type="text/babel">
|
||||
ReactDOM.render(
|
||||
<CrawlerSimulate list={ <?php echo wp_json_encode( $this->conf( $option_id ) ); ?> } />,
|
||||
document.getElementById( 'litespeed_crawler_simulation_div' )
|
||||
);
|
||||
</script>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'To crawl for a particular cookie, enter the cookie name, and the values you wish to crawl for. Values should be one per line. There will be one crawler created per cookie value, per simulated role.', 'litespeed-cache' ); ?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/crawler/#cookie-simulation' ); ?>
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
esc_html__( 'Use %1$s in %2$s to indicate this cookie has not been set.', 'litespeed-cache' ),
|
||||
'<code>_null</code>',
|
||||
esc_html__( 'Cookie Values', 'litespeed-cache' )
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php $this->form_end(); ?>
|
||||
@@ -0,0 +1,521 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Crawler Summary
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
$__crawler = Crawler::cls();
|
||||
$crawler_list = $__crawler->list_crawlers();
|
||||
$summary = Crawler::get_summary();
|
||||
|
||||
if ( $summary['curr_crawler'] >= count( $crawler_list ) ) {
|
||||
$summary['curr_crawler'] = 0;
|
||||
}
|
||||
|
||||
$is_running = time() - $summary['is_running'] <= 900;
|
||||
|
||||
$disabled = Router::can_crawl() ? '' : 'disabled';
|
||||
$disabled_tip = '';
|
||||
if ( ! $this->conf( Base::O_CRAWLER_SITEMAP ) ) {
|
||||
$disabled = 'disabled';
|
||||
$disabled_tip = '<span class="litespeed-callout notice notice-error inline litespeed-left20">' . sprintf(
|
||||
esc_html__( 'You need to set the %s in Settings first before using the crawler', 'litespeed-cache' ),
|
||||
'<code>' . esc_html( Lang::title( Base::O_CRAWLER_SITEMAP ) ) . '</code>'
|
||||
) . '</span>';
|
||||
}
|
||||
|
||||
$crawler_run_interval = defined( 'LITESPEED_CRAWLER_RUN_INTERVAL' ) ? LITESPEED_CRAWLER_RUN_INTERVAL : 600;
|
||||
if ( $crawler_run_interval > 0 ) :
|
||||
$recurrence = '';
|
||||
$hours = (int) floor( $crawler_run_interval / 3600 );
|
||||
if ( $hours ) {
|
||||
$recurrence .= sprintf(
|
||||
$hours > 1 ? esc_html__( '%d hours', 'litespeed-cache' ) : esc_html__( '%d hour', 'litespeed-cache' ),
|
||||
$hours
|
||||
);
|
||||
}
|
||||
$minutes = (int) floor( ( $crawler_run_interval % 3600 ) / 60 );
|
||||
if ( $minutes ) {
|
||||
$recurrence .= ' ';
|
||||
$recurrence .= sprintf(
|
||||
$minutes > 1 ? esc_html__( '%d minutes', 'litespeed-cache' ) : esc_html__( '%d minute', 'litespeed-cache' ),
|
||||
$minutes
|
||||
);
|
||||
}
|
||||
?>
|
||||
|
||||
<h3 class="litespeed-title litespeed-relative">
|
||||
<?php esc_html_e( 'Crawler Cron', 'litespeed-cache' ); ?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/crawler/' ); ?>
|
||||
</h3>
|
||||
|
||||
<?php if ( ! Router::can_crawl() ) : ?>
|
||||
<div class="litespeed-callout notice notice-error inline">
|
||||
<h4><?php esc_html_e( 'WARNING', 'litespeed-cache' ); ?></h4>
|
||||
<p><?php esc_html_e( 'The crawler feature is not enabled on the LiteSpeed server. Please consult your server admin or hosting provider.', 'litespeed-cache' ); ?></p>
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: Link tags */
|
||||
esc_html__( 'See %sIntroduction for Enabling the Crawler%s for detailed information.', 'litespeed-cache' ),
|
||||
'<a href="https://docs.litespeedtech.com/lscache/lscwp/admin/#enabling-and-limiting-the-crawler" target="_blank" rel="noopener">',
|
||||
'</a>'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( $summary['this_full_beginning_time'] ) : ?>
|
||||
<p>
|
||||
<b><?php esc_html_e( 'Current sitemap crawl started at', 'litespeed-cache' ); ?>:</b>
|
||||
<?php echo esc_html( Utility::readable_time( $summary['this_full_beginning_time'] ) ); ?>
|
||||
</p>
|
||||
<?php if ( ! $is_running ) : ?>
|
||||
<p>
|
||||
<b><?php esc_html_e( 'The next complete sitemap crawl will start at', 'litespeed-cache' ); ?>:</b>
|
||||
<?php echo esc_html( gmdate( 'm/d/Y H:i:s', $summary['this_full_beginning_time'] + LITESPEED_TIME_OFFSET + (int) $summary['last_full_time_cost'] + $this->conf( Base::O_CRAWLER_CRAWL_INTERVAL ) ) ); ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( $summary['last_full_time_cost'] ) : ?>
|
||||
<p>
|
||||
<b><?php esc_html_e( 'Last complete run time for all crawlers', 'litespeed-cache' ); ?>:</b>
|
||||
<?php printf( esc_html__( '%d seconds', 'litespeed-cache' ), (int) $summary['last_full_time_cost'] ); ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( $summary['last_crawler_total_cost'] ) : ?>
|
||||
<p>
|
||||
<b><?php esc_html_e( 'Run time for previous crawler', 'litespeed-cache' ); ?>:</b>
|
||||
<?php printf( esc_html__( '%d seconds', 'litespeed-cache' ), (int) $summary['last_crawler_total_cost'] ); ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( $summary['curr_crawler_beginning_time'] ) : ?>
|
||||
<p>
|
||||
<b><?php esc_html_e( 'Current crawler started at', 'litespeed-cache' ); ?>:</b>
|
||||
<?php echo esc_html( Utility::readable_time( $summary['curr_crawler_beginning_time'] ) ); ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<p>
|
||||
<b><?php esc_html_e( 'Current server load', 'litespeed-cache' ); ?>:</b>
|
||||
<?php echo esc_html( $__crawler->get_server_load() ); ?>
|
||||
</p>
|
||||
|
||||
<?php if ( $summary['last_start_time'] ) : ?>
|
||||
<p class="litespeed-desc">
|
||||
<b><?php esc_html_e( 'Last interval', 'litespeed-cache' ); ?>:</b>
|
||||
<?php echo esc_html( Utility::readable_time( $summary['last_start_time'] ) ); ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( $summary['end_reason'] ) : ?>
|
||||
<p class="litespeed-desc">
|
||||
<b><?php esc_html_e( 'Ended reason', 'litespeed-cache' ); ?>:</b>
|
||||
<?php echo esc_html( $summary['end_reason'] ); ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( $summary['last_crawled'] ) : ?>
|
||||
<p class="litespeed-desc">
|
||||
<b><?php esc_html_e( 'Last crawled', 'litespeed-cache' ); ?>:</b>
|
||||
<?php
|
||||
printf(
|
||||
esc_html__( '%d item(s)', 'litespeed-cache' ),
|
||||
esc_html( $summary['last_crawled'] )
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<p>
|
||||
<a href="<?php echo esc_url( Utility::build_url( Router::ACTION_CRAWLER, Crawler::TYPE_RESET ) ); ?>" class="button litespeed-btn-warning"><?php esc_html_e( 'Reset position', 'litespeed-cache' ); ?></a>
|
||||
<a href="<?php echo Router::can_crawl() ? esc_url( Utility::build_url( Router::ACTION_CRAWLER, Crawler::TYPE_START ) ) : 'javascript:;'; ?>" id="litespeed_manual_trigger" class="button litespeed-btn-success" litespeed-accesskey="R" <?php echo wp_kses_post( $disabled ); ?>><?php esc_html_e( 'Manually run', 'litespeed-cache' ); ?></a>
|
||||
<?php echo wp_kses_post( $disabled_tip ); ?>
|
||||
</p>
|
||||
|
||||
<div class="litespeed-table-responsive">
|
||||
<table class="wp-list-table widefat striped" data-crawler-list>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">#</th>
|
||||
<th scope="col"><?php esc_html_e( 'Cron Name', 'litespeed-cache' ); ?></th>
|
||||
<th scope="col"><?php esc_html_e( 'Run Frequency', 'litespeed-cache' ); ?></th>
|
||||
<th scope="col"><?php esc_html_e( 'Status', 'litespeed-cache' ); ?></th>
|
||||
<th scope="col"><?php esc_html_e( 'Activate', 'litespeed-cache' ); ?></th>
|
||||
<th scope="col"><?php esc_html_e( 'Running', 'litespeed-cache' ); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
foreach ( $crawler_list as $i => $v ) :
|
||||
$hit = ! empty( $summary['crawler_stats'][ $i ][ Crawler::STATUS_HIT ] ) ? (int) $summary['crawler_stats'][ $i ][ Crawler::STATUS_HIT ] : 0;
|
||||
$miss = ! empty( $summary['crawler_stats'][ $i ][ Crawler::STATUS_MISS ] ) ? (int) $summary['crawler_stats'][ $i ][ Crawler::STATUS_MISS ] : 0;
|
||||
$blacklisted = ! empty( $summary['crawler_stats'][ $i ][ Crawler::STATUS_BLACKLIST ] ) ? (int) $summary['crawler_stats'][ $i ][ Crawler::STATUS_BLACKLIST ] : 0;
|
||||
$blacklisted += ! empty( $summary['crawler_stats'][ $i ][ Crawler::STATUS_NOCACHE ] ) ? (int) $summary['crawler_stats'][ $i ][ Crawler::STATUS_NOCACHE ] : 0;
|
||||
$waiting = isset( $summary['crawler_stats'][ $i ][ Crawler::STATUS_WAIT ] )
|
||||
? (int) $summary['crawler_stats'][ $i ][ Crawler::STATUS_WAIT ]
|
||||
: (int) ( $summary['list_size'] - $hit - $miss - $blacklisted );
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
<?php
|
||||
echo esc_html( $i + 1 );
|
||||
if ( $i === $summary['curr_crawler'] ) {
|
||||
echo '<img class="litespeed-crawler-curr" src="' . esc_url( LSWCP_PLUGIN_URL . 'assets/img/Litespeed.icon.svg' ) . '" alt="Current Crawler">';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td><?php echo wp_kses_post( $v['title'] ); ?></td>
|
||||
<td><?php echo esc_html( $recurrence ); ?></td>
|
||||
<td>
|
||||
<?php
|
||||
printf(
|
||||
'<i class="litespeed-badge litespeed-bg-default" data-balloon-pos="up" aria-label="%s">%s</i> ',
|
||||
esc_attr__( 'Waiting', 'litespeed-cache' ),
|
||||
esc_html( $waiting > 0 ? $waiting : '-' )
|
||||
);
|
||||
printf(
|
||||
'<i class="litespeed-badge litespeed-bg-success" data-balloon-pos="up" aria-label="%s">%s</i> ',
|
||||
esc_attr__( 'Hit', 'litespeed-cache' ),
|
||||
esc_html( $hit > 0 ? $hit : '-' )
|
||||
);
|
||||
printf(
|
||||
'<i class="litespeed-badge litespeed-bg-primary" data-balloon-pos="up" aria-label="%s">%s</i> ',
|
||||
esc_attr__( 'Miss', 'litespeed-cache' ),
|
||||
esc_html( $miss > 0 ? $miss : '-' )
|
||||
);
|
||||
printf(
|
||||
'<i class="litespeed-badge litespeed-bg-danger" data-balloon-pos="up" aria-label="%s">%s</i> ',
|
||||
esc_attr__( 'Blocklisted', 'litespeed-cache' ),
|
||||
esc_html( $blacklisted > 0 ? $blacklisted : '-' )
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php $this->build_toggle( 'litespeed-crawler-' . $i, $__crawler->is_active( $i ) ); ?>
|
||||
<?php if ( ! empty( $v['uid'] ) && empty( $this->conf( Base::O_SERVER_IP ) ) ) : ?>
|
||||
<div class="litespeed-danger litespeed-text-bold">
|
||||
🚨 <?php esc_html_e( 'NOTICE', 'litespeed-cache' ); ?>:
|
||||
<?php
|
||||
printf(
|
||||
esc_html__( 'You must set %s before using this feature.', 'litespeed-cache' ),
|
||||
esc_html( Lang::title( Base::O_SERVER_IP ) )
|
||||
);
|
||||
?>
|
||||
<?php
|
||||
Doc::learn_more(
|
||||
esc_url( admin_url( 'admin.php?page=litespeed-general#settings' ) ),
|
||||
esc_html__( 'Click here to set.', 'litespeed-cache' ),
|
||||
true,
|
||||
false,
|
||||
true
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
if ( $i === $summary['curr_crawler'] ) {
|
||||
echo esc_html__( 'Position: ', 'litespeed-cache' ) . esc_html( $summary['last_pos'] + 1 );
|
||||
if ( $is_running ) {
|
||||
echo ' <span class="litespeed-label-success">' . esc_html__( 'running', 'litespeed-cache' ) . '</span>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
<i class="litespeed-badge litespeed-bg-default"></i> = <?php esc_html_e( 'Waiting to be Crawled', 'litespeed-cache' ); ?><br>
|
||||
<i class="litespeed-badge litespeed-bg-success"></i> = <?php esc_html_e( 'Already Cached', 'litespeed-cache' ); ?><br>
|
||||
<i class="litespeed-badge litespeed-bg-primary"></i> = <?php esc_html_e( 'Successfully Crawled', 'litespeed-cache' ); ?><br>
|
||||
<i class="litespeed-badge litespeed-bg-danger"></i> = <?php esc_html_e( 'Blocklisted', 'litespeed-cache' ); ?><br>
|
||||
</p>
|
||||
|
||||
<div class="litespeed-desc">
|
||||
<div><?php esc_html_e( 'Run frequency is set by the Interval Between Runs setting.', 'litespeed-cache' ); ?></div>
|
||||
<div>
|
||||
<?php
|
||||
esc_html_e( 'Crawlers cannot run concurrently. If both the cron and a manual run start at similar times, the first to be started will take precedence.', 'litespeed-cache' );
|
||||
?>
|
||||
</div>
|
||||
<div>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: Link tags */
|
||||
esc_html__( 'Please see %sHooking WP-Cron Into the System Task Scheduler%s to learn how to create the system cron task.', 'litespeed-cache' ),
|
||||
'<a href="https://developer.wordpress.org/plugins/cron/hooking-wp-cron-into-the-system-task-scheduler/" target="_blank" rel="noopener">',
|
||||
'</a>'
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
endif;
|
||||
?>
|
||||
|
||||
<h3 class="litespeed-title"><?php esc_html_e( 'Watch Crawler Status', 'litespeed-cache' ); ?></h3>
|
||||
|
||||
<?php
|
||||
$ajax_url = $__crawler->json_path();
|
||||
if ( $ajax_url ) :
|
||||
?>
|
||||
<input type="button" id="litespeed-crawl-url-btn" value="<?php esc_attr_e( 'Show crawler status', 'litespeed-cache' ); ?>" class="button button-secondary" data-url="<?php echo esc_url( $ajax_url ); ?>" />
|
||||
<div class="litespeed-shell litespeed-hide">
|
||||
<div class="litespeed-shell-header-bar"></div>
|
||||
<div class="litespeed-shell-header">
|
||||
<div class="litespeed-shell-header-bg"></div>
|
||||
<div class="litespeed-shell-header-icon-container">
|
||||
<img id="litespeed-shell-icon" src="<?php echo esc_url( LSWCP_PLUGIN_URL . 'assets/img/Litespeed.icon.svg' ); ?>" alt="LiteSpeed Icon" />
|
||||
</div>
|
||||
</div>
|
||||
<ul class="litespeed-shell-body">
|
||||
<li><?php esc_html_e( 'Start watching...', 'litespeed-cache' ); ?></li>
|
||||
<li id="litespeed-loading-dot"></li>
|
||||
</ul>
|
||||
</div>
|
||||
<?php else : ?>
|
||||
<p><?php esc_html_e( 'No crawler meta file generated yet', 'litespeed-cache' ); ?></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<script>
|
||||
var _litespeed_meta;
|
||||
var _litespeed_shell_interval = 3; // seconds
|
||||
var _litespeed_shell_interval_range = [3, 60];
|
||||
var _litespeed_shell_handle;
|
||||
var _litespeed_shell_display_handle;
|
||||
var _litespeed_crawler_url;
|
||||
var _litespeed_dots;
|
||||
|
||||
|
||||
(function ($) {
|
||||
'use strict';
|
||||
jQuery(document).ready(function () {
|
||||
$('#litespeed-crawl-url-btn').on('click', function () {
|
||||
if (!$(this).data('url')) {
|
||||
return false;
|
||||
}
|
||||
$('.litespeed-shell').removeClass('litespeed-hide');
|
||||
_litespeed_dots = window.setInterval(_litespeed_loading_dots, 300);
|
||||
_litespeed_crawler_url = $(this).data('url');
|
||||
litespeed_fetch_meta();
|
||||
$(this).hide();
|
||||
});
|
||||
|
||||
$('#litespeed_manual_trigger').on('click', function (event) {
|
||||
$('#litespeed-loading-dot').before('<li>Manually Started</li>');
|
||||
_litespeed_shell_interval = _litespeed_shell_interval_range[0];
|
||||
litespeed_fetch_meta();
|
||||
});
|
||||
|
||||
/**
|
||||
* Freeze or melt a specific crawler
|
||||
* @since 4.3
|
||||
*/
|
||||
if ($('[data-crawler-list] [data-litespeed_toggle_id]').length > 0) {
|
||||
$('[data-crawler-list] [data-litespeed_toggle_id]').on('click', function (e) {
|
||||
var crawler_id = $(this).attr('data-litespeed_toggle_id');
|
||||
var crawler_id = Number(crawler_id.split('-').pop());
|
||||
var that = this;
|
||||
$.ajax({
|
||||
url: '<?php echo function_exists('get_rest_url') ? get_rest_url(null, 'litespeed/v1/toggle_crawler_state') : '/'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>',
|
||||
dataType: 'json',
|
||||
method: 'POST',
|
||||
cache: false,
|
||||
data: { crawler_id: crawler_id },
|
||||
beforeSend: function (xhr) {
|
||||
xhr.setRequestHeader('X-WP-Nonce', '<?php echo esc_js( wp_create_nonce('wp_rest') ); ?>');
|
||||
},
|
||||
success: function (data) {
|
||||
$(that)
|
||||
.toggleClass('litespeed-toggle-btn-default litespeed-toggleoff', data == 0)
|
||||
.toggleClass('litespeed-toggle-btn-primary', data == 1);
|
||||
console.log('litespeed-crawler-ajax: change Activate option');
|
||||
},
|
||||
error: function (xhr, error) {
|
||||
console.log(xhr);
|
||||
console.log(error);
|
||||
console.log('litespeed-crawler-ajax: option failed to save due to some error');
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
})(jQuery);
|
||||
|
||||
|
||||
function litespeed_fetch_meta() {
|
||||
window.clearTimeout(_litespeed_shell_handle);
|
||||
jQuery('#litespeed-loading-dot').text('');
|
||||
jQuery.ajaxSetup({ cache: false });
|
||||
jQuery.getJSON(_litespeed_crawler_url, function (meta) {
|
||||
litespeed_pulse();
|
||||
var changed = false;
|
||||
if (meta && 'list_size' in meta) {
|
||||
new_meta =
|
||||
meta.list_size + ' ' + meta.file_time + ' ' + meta.curr_crawler + ' ' + meta.last_pos + ' ' + meta.last_count + ' ' + meta.last_start_time + ' ' + meta.is_running;
|
||||
if (new_meta != _litespeed_meta) {
|
||||
_litespeed_meta = new_meta;
|
||||
changed = true;
|
||||
string = _litespeed_build_meta(meta);
|
||||
jQuery('#litespeed-loading-dot').before(string);
|
||||
// remove first log elements
|
||||
log_length = jQuery('.litespeed-shell-body li').length;
|
||||
if (log_length > 50) {
|
||||
jQuery('.litespeed-shell-body li:lt(' + (log_length - 50) + ')').remove();
|
||||
}
|
||||
// scroll to end
|
||||
jQuery('.litespeed-shell-body')
|
||||
.stop()
|
||||
.animate(
|
||||
{
|
||||
scrollTop: jQuery('.litespeed-shell-body')[0].scrollHeight,
|
||||
},
|
||||
800,
|
||||
);
|
||||
}
|
||||
|
||||
// dynamic adjust the interval length
|
||||
_litespeed_adjust_interval(changed);
|
||||
}
|
||||
// display interval counting
|
||||
litespeed_display_interval_reset();
|
||||
_litespeed_shell_handle = window.setTimeout(_litespeed_dynamic_timeout, _litespeed_shell_interval * 1000);
|
||||
});
|
||||
}
|
||||
|
||||
function _litespeed_loading_dots() {
|
||||
jQuery('#litespeed-loading-dot').append('.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamic adjust interval
|
||||
*/
|
||||
function _litespeed_adjust_interval(changed) {
|
||||
if (changed) {
|
||||
_litespeed_shell_interval -= Math.ceil(_litespeed_shell_interval / 2);
|
||||
} else {
|
||||
_litespeed_shell_interval++;
|
||||
}
|
||||
|
||||
if (_litespeed_shell_interval < _litespeed_shell_interval_range[0]) {
|
||||
_litespeed_shell_interval = _litespeed_shell_interval_range[0];
|
||||
}
|
||||
if (_litespeed_shell_interval > _litespeed_shell_interval_range[1]) {
|
||||
_litespeed_shell_interval = _litespeed_shell_interval_range[1];
|
||||
}
|
||||
}
|
||||
|
||||
function _litespeed_build_meta(meta) {
|
||||
var string =
|
||||
'<li>' +
|
||||
litespeed_date(meta.last_update_time) +
|
||||
' Size: ' +
|
||||
meta.list_size +
|
||||
' Crawler: #' +
|
||||
(meta.curr_crawler * 1 + 1) +
|
||||
' Position: ' +
|
||||
(meta.last_pos * 1 + 1) +
|
||||
' Threads: ' +
|
||||
meta.last_count +
|
||||
' Status: ';
|
||||
if (meta.is_running) {
|
||||
string += 'crawling, ' + meta.last_status;
|
||||
} else {
|
||||
string += meta.end_reason ? meta.end_reason : '-';
|
||||
}
|
||||
string += '</li>';
|
||||
return string;
|
||||
}
|
||||
|
||||
function _litespeed_dynamic_timeout() {
|
||||
litespeed_fetch_meta();
|
||||
}
|
||||
|
||||
function litespeed_display_interval_reset() {
|
||||
window.clearInterval(_litespeed_shell_display_handle);
|
||||
jQuery('.litespeed-shell-header-bar').data('num', _litespeed_shell_interval);
|
||||
_litespeed_shell_display_handle = window.setInterval(_litespeed_display_interval, 1000);
|
||||
|
||||
jQuery('.litespeed-shell-header-bar')
|
||||
.stop()
|
||||
.animate({ width: '100%' }, 500, function () {
|
||||
jQuery('.litespeed-shell-header-bar').css('width', '0%');
|
||||
});
|
||||
}
|
||||
|
||||
function _litespeed_display_interval() {
|
||||
var num = jQuery('.litespeed-shell-header-bar').data('num');
|
||||
jQuery('.litespeed-shell-header-bar')
|
||||
.stop()
|
||||
.animate({ width: litespeed_get_percent(num, _litespeed_shell_interval) + '%' }, 1000);
|
||||
if (num > 0) num--;
|
||||
if (num < 0) num = 0;
|
||||
jQuery('.litespeed-shell-header-bar').data('num', num);
|
||||
}
|
||||
|
||||
function litespeed_get_percent(num1, num2) {
|
||||
num1 = num1 * 1;
|
||||
num2 = num2 * 1;
|
||||
num = (num2 - num1) / num2;
|
||||
return num * 100;
|
||||
}
|
||||
|
||||
function litespeed_date(timestamp) {
|
||||
var a = new Date(timestamp * 1000);
|
||||
var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
||||
var year = a.getFullYear();
|
||||
var month = months[a.getMonth()];
|
||||
var date = litespeed_add_zero(a.getDate());
|
||||
var hour = litespeed_add_zero(a.getHours());
|
||||
var min = litespeed_add_zero(a.getMinutes());
|
||||
var sec = litespeed_add_zero(a.getSeconds());
|
||||
var time = date + ' ' + month + ' ' + year + ' ' + hour + ':' + min + ':' + sec;
|
||||
return time;
|
||||
}
|
||||
|
||||
function litespeed_add_zero(i) {
|
||||
if (i < 10) {
|
||||
i = '0' + i;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
function litespeed_pulse() {
|
||||
jQuery('#litespeed-shell-icon').animate(
|
||||
{
|
||||
width: 27,
|
||||
height: 34,
|
||||
opacity: 1,
|
||||
},
|
||||
700,
|
||||
function () {
|
||||
jQuery('#litespeed-shell-icon').animate(
|
||||
{
|
||||
width: 23,
|
||||
height: 29,
|
||||
opacity: 0.5,
|
||||
},
|
||||
700,
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,921 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Dashboard
|
||||
*
|
||||
* Displays the dashboard for LiteSpeed Cache plugin, including cache status,
|
||||
* crawler status, QUIC.cloud service usage, and optimization statistics.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
$health_scores = Health::cls()->scores();
|
||||
$crawler_summary = Crawler::get_summary();
|
||||
|
||||
// Image related info
|
||||
$img_optm_summary = Img_Optm::get_summary();
|
||||
$img_count = Img_Optm::cls()->img_count();
|
||||
$img_finished_percentage = 0;
|
||||
if ( ! empty( $img_count['groups_all'] ) ) {
|
||||
$img_finished_percentage = 100 - floor( $img_count['groups_new'] * 100 / $img_count['groups_all'] );
|
||||
}
|
||||
if ( 100 === $img_finished_percentage && ! empty( $img_count['groups_new'] ) ) {
|
||||
$img_finished_percentage = 99;
|
||||
}
|
||||
|
||||
$cloud_instance = Cloud::cls();
|
||||
$cloud_instance->finish_qc_activation();
|
||||
|
||||
$cloud_summary = Cloud::get_summary();
|
||||
$css_summary = CSS::get_summary();
|
||||
$ucss_summary = UCSS::get_summary();
|
||||
$placeholder_summary = Placeholder::get_summary();
|
||||
$vpi_summary = VPI::get_summary();
|
||||
$ccss_count = count( $this->load_queue( 'ccss' ) );
|
||||
$ucss_count = count( $this->load_queue( 'ucss' ) );
|
||||
$placeholder_queue_count = count( $this->load_queue( 'lqip' ) );
|
||||
$vpi_queue_count = count( $this->load_queue( 'vpi' ) );
|
||||
$can_page_load_time = defined( 'LITESPEED_SERVER_TYPE' ) && 'NONE' !== LITESPEED_SERVER_TYPE;
|
||||
|
||||
?>
|
||||
|
||||
<div class="litespeed-dashboard">
|
||||
<?php if ( ! $cloud_instance->activated() && ! Admin_Display::has_qc_hide_banner() ) : ?>
|
||||
<div class="litespeed-dashboard-group">
|
||||
<div class="litespeed-flex-container">
|
||||
<div class="postbox litespeed-postbox litespeed-postbox-cache">
|
||||
<div class="inside">
|
||||
<h3 class="litespeed-title">
|
||||
<?php esc_html_e( 'Cache Status', 'litespeed-cache' ); ?>
|
||||
<a href="<?php echo esc_url( admin_url( 'admin.php?page=litespeed-cache' ) ); ?>" class="litespeed-title-right-icon"><?php esc_html_e( 'More', 'litespeed-cache' ); ?></a>
|
||||
</h3>
|
||||
<?php
|
||||
$cache_list = array(
|
||||
Base::O_CACHE => esc_html__( 'Public Cache', 'litespeed-cache' ),
|
||||
Base::O_CACHE_PRIV => esc_html__( 'Private Cache', 'litespeed-cache' ),
|
||||
Base::O_OBJECT => esc_html__( 'Object Cache', 'litespeed-cache' ),
|
||||
Base::O_CACHE_BROWSER => esc_html__( 'Browser Cache', 'litespeed-cache' ),
|
||||
);
|
||||
foreach ( $cache_list as $cache_option => $cache_title ) :
|
||||
?>
|
||||
<p>
|
||||
<?php if ( $this->conf( $cache_option ) ) : ?>
|
||||
<span class="litespeed-label-success litespeed-label-dashboard"><?php esc_html_e( 'ON', 'litespeed-cache' ); ?></span>
|
||||
<?php else : ?>
|
||||
<span class="litespeed-label-danger litespeed-label-dashboard"><?php esc_html_e( 'OFF', 'litespeed-cache' ); ?></span>
|
||||
<?php endif; ?>
|
||||
<?php echo esc_html( $cache_title ); ?>
|
||||
</p>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="postbox litespeed-postbox litespeed-postbox-crawler">
|
||||
<div class="inside">
|
||||
<h3 class="litespeed-title">
|
||||
<?php esc_html_e( 'Crawler Status', 'litespeed-cache' ); ?>
|
||||
<a href="<?php echo esc_url( admin_url( 'admin.php?page=litespeed-crawler' ) ); ?>" class="litespeed-title-right-icon"><?php esc_html_e( 'More', 'litespeed-cache' ); ?></a>
|
||||
</h3>
|
||||
<p>
|
||||
<code><?php echo esc_html( count( Crawler::cls()->list_crawlers() ) ); ?></code> <?php esc_html_e( 'Crawler(s)', 'litespeed-cache' ); ?>
|
||||
</p>
|
||||
<p>
|
||||
<?php esc_html_e( 'Currently active crawler', 'litespeed-cache' ); ?>: <code><?php echo esc_html( $crawler_summary['curr_crawler'] ); ?></code>
|
||||
</p>
|
||||
<?php if ( ! empty( $crawler_summary['curr_crawler_beginning_time'] ) ) : ?>
|
||||
<p>
|
||||
<span class="litespeed-bold"><?php esc_html_e( 'Current crawler started at', 'litespeed-cache' ); ?>:</span>
|
||||
<?php echo esc_html( Utility::readable_time( $crawler_summary['curr_crawler_beginning_time'] ) ); ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php if ( ! empty( $crawler_summary['last_start_time'] ) ) : ?>
|
||||
<p class="litespeed-desc">
|
||||
<span class="litespeed-bold"><?php esc_html_e( 'Last interval', 'litespeed-cache' ); ?>:</span>
|
||||
<?php echo esc_html( Utility::readable_time( $crawler_summary['last_start_time'] ) ); ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php if ( ! empty( $crawler_summary['end_reason'] ) ) : ?>
|
||||
<p class="litespeed-desc">
|
||||
<span class="litespeed-bold"><?php esc_html_e( 'Ended reason', 'litespeed-cache' ); ?>:</span>
|
||||
<?php echo esc_html( $crawler_summary['end_reason'] ); ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php if ( ! empty( $crawler_summary['last_crawled'] ) ) : ?>
|
||||
<p class="litespeed-desc">
|
||||
<?php
|
||||
printf(
|
||||
esc_html__( '%1$s %2$d item(s)', 'litespeed-cache' ),
|
||||
'<span class="litespeed-bold">' . esc_html__( 'Last crawled:', 'litespeed-cache' ) . '</span>',
|
||||
esc_html( $crawler_summary['last_crawled'] )
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
$news = $cloud_instance->load_qc_status_for_dash( 'news_dash_guest' );
|
||||
if ( ! empty( $news ) ) :
|
||||
?>
|
||||
<div class="postbox litespeed-postbox">
|
||||
<div class="inside litespeed-text-center">
|
||||
<h3 class="litespeed-title">
|
||||
<?php esc_html_e( 'News', 'litespeed-cache' ); ?>
|
||||
</h3>
|
||||
<div class="litespeed-top20">
|
||||
<?php echo wp_kses_post( $news ); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="litespeed-dashboard-qc">
|
||||
<?php if ( ! $cloud_instance->activated() && ! Admin_Display::has_qc_hide_banner() ) : ?>
|
||||
<div class="litespeed-dashboard-unlock">
|
||||
<div>
|
||||
<h3 class="litespeed-dashboard-unlock-title">
|
||||
<strong class="litespeed-qc-text-gradient">
|
||||
<?php esc_html_e( 'Accelerate, Optimize, Protect', 'litespeed-cache' ); ?>
|
||||
</strong>
|
||||
</h3>
|
||||
<p class="litespeed-dashboard-unlock-desc">
|
||||
<?php echo wp_kses_post( __( 'Speed up your WordPress site even further with <strong>QUIC.cloud Online Services and CDN</strong>.', 'litespeed-cache' ) ); ?>
|
||||
</p>
|
||||
<p>
|
||||
<?php esc_html_e( 'Free monthly quota available. Can also be used anonymously (no email required).', 'litespeed-cache' ); ?>
|
||||
</p>
|
||||
<p>
|
||||
<a class="button button-primary" href="<?php echo esc_url( Utility::build_url( Router::ACTION_CLOUD, Cloud::TYPE_ACTIVATE ) ); ?>">
|
||||
<span class="dashicons dashicons-yes"></span>
|
||||
<?php esc_html_e( 'Enable QUIC.cloud services', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
</p>
|
||||
<p>
|
||||
<a class="litespeed-top10" href="<?php echo esc_url( Utility::build_url( Router::ACTION_ADMIN_DISPLAY, Admin_Display::TYPE_QC_HIDE_BANNER ) ); ?>">
|
||||
<?php esc_html_e( 'Do not show this again', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
</p>
|
||||
<p class="litespeed-dashboard-unlock-footer">
|
||||
<?php esc_html_e( 'QUIC.cloud provides CDN and online optimization services, and is not required. You may use many features of this plugin without QUIC.cloud.', 'litespeed-cache' ); ?><br>
|
||||
<a href="https://www.quic.cloud/" target="_blank">
|
||||
<?php esc_html_e( 'Learn More about QUIC.cloud', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
<br>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="litespeed-dashboard-qc-enable">
|
||||
<div class="litespeed-dashboard-header">
|
||||
<h3 class="litespeed-dashboard-title litespeed-dashboard-title--w-btn">
|
||||
<span class="litespeed-right10"><?php esc_html_e( 'QUIC.cloud Service Usage Statistics', 'litespeed-cache' ); ?></span>
|
||||
<a href="<?php echo esc_url( Utility::build_url( Router::ACTION_CLOUD, Cloud::TYPE_SYNC_USAGE ) ); ?>" class="button button-secondary button-small">
|
||||
<span class="dashicons dashicons-update"></span> <?php esc_html_e( 'Refresh Usage', 'litespeed-cache' ); ?>
|
||||
<span class="screen-reader-text"><?php esc_html_e( 'Sync data from Cloud', 'litespeed-cache' ); ?></span>
|
||||
</a>
|
||||
</h3>
|
||||
<hr>
|
||||
<a href="https://docs.litespeedtech.com/lscache/lscwp/dashboard/#usage-statistics" target="_blank" class="litespeed-learn-more"><?php esc_html_e( 'Learn More', 'litespeed-cache' ); ?></a>
|
||||
</div>
|
||||
|
||||
<?php if ( ! $cloud_instance->activated() && Admin_Display::has_qc_hide_banner() ) : ?>
|
||||
<p class="litespeed-desc litespeed-margin-top-remove">
|
||||
<?php
|
||||
printf(
|
||||
esc_html__( 'The features below are provided by %s', 'litespeed-cache' ),
|
||||
'<a href="https://quic.cloud" target="_blank">QUIC.cloud</a>'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="litespeed-dashboard-stats-wrapper">
|
||||
<?php
|
||||
$cat_list = array(
|
||||
'img_optm' => esc_html__( 'Image Optimization', 'litespeed-cache' ),
|
||||
'page_optm' => esc_html__( 'Page Optimization', 'litespeed-cache' ),
|
||||
'cdn' => esc_html__( 'CDN Bandwidth', 'litespeed-cache' ),
|
||||
'lqip' => esc_html__( 'Low Quality Image Placeholder', 'litespeed-cache' ),
|
||||
);
|
||||
|
||||
foreach ( $cat_list as $svc => $svc_title ) :
|
||||
$finished_percentage = 0;
|
||||
$total_used = '-';
|
||||
$used = '-';
|
||||
$quota = '-';
|
||||
$pag_used = '-';
|
||||
$pag_total = '-';
|
||||
$pag_width = 0;
|
||||
$percentage_bg = 'success';
|
||||
$pag_txt_color = '';
|
||||
$usage = false;
|
||||
|
||||
if ( ! empty( $cloud_summary[ 'usage.' . $svc ] ) ) {
|
||||
$usage = $cloud_summary[ 'usage.' . $svc ];
|
||||
$finished_percentage = floor( $usage['used'] * 100 / $usage['quota'] );
|
||||
$used = (int) $usage['used'];
|
||||
$quota = (int) $usage['quota'];
|
||||
$pag_used = ! empty( $usage['pag_used'] ) ? (int) $usage['pag_used'] : 0;
|
||||
$pag_bal = ! empty( $usage['pag_bal'] ) ? (int) $usage['pag_bal'] : 0;
|
||||
$pag_total = $pag_used + $pag_bal;
|
||||
if ( ! empty( $usage['total_used'] ) ) {
|
||||
$total_used = (int) $usage['total_used'];
|
||||
}
|
||||
|
||||
if ( $pag_total ) {
|
||||
$pag_width = round( $pag_used / $pag_total * 100 ) . '%';
|
||||
}
|
||||
|
||||
if ( $finished_percentage > 85 ) {
|
||||
$percentage_bg = 'warning';
|
||||
if ( $finished_percentage > 95 ) {
|
||||
$percentage_bg = 'danger';
|
||||
if ( $pag_bal ) {
|
||||
$percentage_bg = 'warning';
|
||||
$pag_txt_color = 'litespeed-success';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div class="postbox litespeed-postbox">
|
||||
<div class="inside">
|
||||
<h3 class="litespeed-title"><?php echo esc_html( $svc_title ); ?></h3>
|
||||
<div class="litespeed-flex-container">
|
||||
<div class="litespeed-icon-vertical-middle litespeed-pie-<?php echo esc_attr( $percentage_bg ); ?>">
|
||||
<?php echo wp_kses( GUI::pie( $finished_percentage, 60, false ), GUI::allowed_svg_tags() ); ?>
|
||||
</div>
|
||||
<div>
|
||||
<div class="litespeed-dashboard-stats">
|
||||
<h3><?php echo 'img_optm' === $svc ? esc_html__( 'Fast Queue Usage', 'litespeed-cache' ) : esc_html__( 'Usage', 'litespeed-cache' ); ?></h3>
|
||||
<p>
|
||||
<strong><?php echo esc_html( $used ); ?></strong>
|
||||
<?php if ( $used !== $quota ) : ?>
|
||||
<span class="litespeed-desc"> / <?php echo esc_html( $quota ); ?></span>
|
||||
<?php endif; ?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ( $pag_total > 0 ) : ?>
|
||||
<p class="litespeed-dashboard-stats-payg <?php echo esc_attr( $pag_txt_color ); ?>">
|
||||
<?php esc_html_e( 'PAYG Balance', 'litespeed-cache' ); ?>: <strong><?php echo esc_html( $pag_bal ); ?></strong>
|
||||
<button class="litespeed-info-button" data-balloon-pos="up" aria-label="<?php echo esc_attr( sprintf( esc_html__( 'PAYG used this month: %s. PAYG balance and usage not included in above quota calculation.', 'litespeed-cache' ), $pag_used ) ); ?>">
|
||||
<span class="dashicons dashicons-info"></span>
|
||||
<span class="screen-reader-text"><?php esc_html_e( 'Pay as You Go Usage Statistics', 'litespeed-cache' ); ?></span>
|
||||
</button>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php if ( 'page_optm' === $svc && ! empty( $usage['sub_svc'] ) ) : ?>
|
||||
<p class="litespeed-dashboard-stats-total">
|
||||
<?php
|
||||
$i = 0;
|
||||
foreach ( $usage['sub_svc'] as $sub_svc => $sub_usage ) :
|
||||
?>
|
||||
<span class="<?php echo $i++ > 0 ? 'litespeed-left10' : ''; ?>">
|
||||
<?php echo esc_html( strtoupper( $sub_svc ) ); ?>: <strong><?php echo (int) $sub_usage; ?></strong>
|
||||
</span>
|
||||
<?php endforeach; ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php if ( 'img_optm' === $svc ) : ?>
|
||||
<p class="litespeed-dashboard-stats-total">
|
||||
<?php esc_html_e( 'Total Usage', 'litespeed-cache' ); ?>: <strong><?php echo esc_html( $total_used ); ?> / ∞</strong>
|
||||
<button class="litespeed-info-button" data-balloon-pos="up" aria-label="<?php esc_attr_e( 'Total images optimized in this month', 'litespeed-cache' ); ?>">
|
||||
<span class="dashicons dashicons-info"></span>
|
||||
</button>
|
||||
</p>
|
||||
<div class="clear"></div>
|
||||
<?php endif; ?>
|
||||
<?php if ( isset( $usage['remaining_daily_quota'] ) && $usage['remaining_daily_quota'] >= 0 && isset( $usage['daily_quota'] ) && $usage['daily_quota'] >= 0 ) : ?>
|
||||
<p class="litespeed-dashboard-stats-total">
|
||||
<?php esc_html_e( 'Remaining Daily Quota', 'litespeed-cache' ); ?>: <strong><?php echo esc_html( $usage['remaining_daily_quota'] ); ?> / <?php echo esc_html( $usage['daily_quota'] ); ?></strong>
|
||||
</p>
|
||||
<div class="clear"></div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php if ( ! empty( $cloud_summary['partner'] ) ) : ?>
|
||||
<div class="litespeed-postbox litespeed-postbox-partner">
|
||||
<div class="inside">
|
||||
<h3 class="litespeed-title"><?php esc_html_e( 'Partner Benefits Provided by', 'litespeed-cache' ); ?></h3>
|
||||
<div>
|
||||
<?php if ( ! empty( $cloud_summary['partner']['logo'] ) ) : ?>
|
||||
<?php if ( ! empty( $cloud_summary['partner']['url'] ) ) : ?>
|
||||
<a href="<?php echo esc_url( $cloud_summary['partner']['url'] ); ?>" target="_blank">
|
||||
<img src="<?php echo esc_url( $cloud_summary['partner']['logo'] ); ?>" alt="<?php echo esc_attr( $cloud_summary['partner']['name'] ); ?>">
|
||||
</a>
|
||||
<?php else : ?>
|
||||
<img src="<?php echo esc_url( $cloud_summary['partner']['logo'] ); ?>" alt="<?php echo esc_attr( $cloud_summary['partner']['name'] ); ?>">
|
||||
<?php endif; ?>
|
||||
<?php elseif ( ! empty( $cloud_summary['partner']['name'] ) ) : ?>
|
||||
<?php if ( ! empty( $cloud_summary['partner']['url'] ) ) : ?>
|
||||
<a href="<?php echo esc_url( $cloud_summary['partner']['url'] ); ?>" target="_blank">
|
||||
<span class="postbox-partner-name"><?php echo esc_html( $cloud_summary['partner']['name'] ); ?></span>
|
||||
</a>
|
||||
<?php else : ?>
|
||||
<span class="postbox-partner-name"><?php echo esc_html( $cloud_summary['partner']['name'] ); ?></span>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<p class="litespeed-right litespeed-qc-dashboard-link">
|
||||
<?php
|
||||
if ( ! empty( $cloud_summary['partner'] ) && ! empty( $cloud_summary['partner']['login_title'] ) && ! empty( $cloud_summary['partner']['login_link'] ) ) :
|
||||
Doc::learn_more( $cloud_summary['partner']['login_link'], $cloud_summary['partner']['login_title'], true, 'button litespeed-btn-warning' );
|
||||
elseif ( ! empty( $cloud_summary['partner'] ) && ! empty( $cloud_summary['partner']['disable_qc_login'] ) ) :
|
||||
// Skip rendering any link or button.
|
||||
echo '';
|
||||
else :
|
||||
if ( ! $cloud_instance->activated() ) :
|
||||
Doc::learn_more(
|
||||
Utility::build_url( Router::ACTION_CLOUD, Cloud::TYPE_ACTIVATE ),
|
||||
esc_html__( 'Enable QUIC.cloud Services', 'litespeed-cache' ),
|
||||
true,
|
||||
'button litespeed-btn-warning'
|
||||
);
|
||||
elseif ( ! empty( $cloud_summary['qc_activated'] ) && 'anonymous' !== $cloud_summary['qc_activated'] ) :
|
||||
?>
|
||||
<a href="<?php echo esc_url( $cloud_instance->qc_link() ); ?>" class="litespeed-link-with-icon" target="qc">
|
||||
<?php esc_html_e( 'Go to QUIC.cloud dashboard', 'litespeed-cache' ); ?> <span class="dashicons dashicons-external"></span>
|
||||
</a>
|
||||
<?php else : ?>
|
||||
<?php
|
||||
Doc::learn_more(
|
||||
Utility::build_url( Router::ACTION_CLOUD, Cloud::TYPE_LINK ),
|
||||
esc_html__( 'Link to QUIC.cloud', 'litespeed-cache' ),
|
||||
true,
|
||||
'button litespeed-btn-warning'
|
||||
);
|
||||
?>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</p>
|
||||
|
||||
<div class="litespeed-dashboard-group">
|
||||
<hr>
|
||||
<div class="litespeed-flex-container">
|
||||
<div class="postbox litespeed-postbox litespeed-postbox-pagetime">
|
||||
<div class="inside">
|
||||
<h3 class="litespeed-title">
|
||||
<?php esc_html_e( 'Page Load Time', 'litespeed-cache' ); ?>
|
||||
<?php if ( $can_page_load_time ) : ?>
|
||||
<?php $closest_server = Cloud::get_summary( 'server.' . Cloud::SVC_HEALTH ); ?>
|
||||
<?php if ( $closest_server ) : ?>
|
||||
<a href="<?php echo esc_url( Utility::build_url( Router::ACTION_CLOUD, Cloud::TYPE_REDETECT_CLOUD, false, null, array( 'svc' => Cloud::SVC_HEALTH ) ) ); ?>"
|
||||
data-balloon-pos="up"
|
||||
data-balloon-break
|
||||
aria-label="<?php echo esc_attr( sprintf( esc_html__( 'Current closest Cloud server is %s. Click to redetect.', 'litespeed-cache' ), esc_html( $closest_server ) ) ); ?>"
|
||||
data-litespeed-cfm="<?php esc_attr_e( 'Are you sure you want to redetect the closest cloud server for this service?', 'litespeed-cache' ); ?>"
|
||||
class="litespeed-title-right-icon">
|
||||
<i class='litespeed-quic-icon'></i> <small><?php esc_html_e( 'Redetect', 'litespeed-cache' ); ?></small>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</h3>
|
||||
<div>
|
||||
<div class="litespeed-flex-container">
|
||||
<?php if ( $can_page_load_time && ! empty( $health_scores['speed_before'] ) ) : ?>
|
||||
<div class="litespeed-score-col">
|
||||
<p class="litespeed-text-grey">
|
||||
<?php esc_html_e( 'Before', 'litespeed-cache' ); ?>
|
||||
</p>
|
||||
<div class="litespeed-text-md litespeed-text-grey">
|
||||
<?php echo esc_html( $health_scores['speed_before'] ); ?><span class="litespeed-text-large">s</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="litespeed-score-col">
|
||||
<p class="litespeed-text-grey">
|
||||
<?php esc_html_e( 'After', 'litespeed-cache' ); ?>
|
||||
</p>
|
||||
<div class="litespeed-text-md litespeed-text-success">
|
||||
<?php echo esc_html( $health_scores['speed_after'] ); ?><span class="litespeed-text-large">s</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="litespeed-score-col litespeed-score-col--imp">
|
||||
<p class="litespeed-text-grey" style="white-space: nowrap;">
|
||||
<?php esc_html_e( 'Improved by', 'litespeed-cache' ); ?>
|
||||
</p>
|
||||
<div class="litespeed-text-jumbo litespeed-text-success">
|
||||
<?php echo esc_html( $health_scores['speed_improved'] ); ?><span class="litespeed-text-large">%</span>
|
||||
</div>
|
||||
</div>
|
||||
<?php else : ?>
|
||||
<div>
|
||||
<p><?php esc_html_e( 'You must be using one of the following products in order to measure Page Load Time:', 'litespeed-cache' ); ?></p>
|
||||
<a href="https://www.litespeedtech.com/products/litespeed-web-server" target="_blank"><?php esc_html_e( 'LiteSpeed Web Server', 'litespeed-cache' ); ?></a>
|
||||
<br />
|
||||
<a href="https://openlitespeed.org/" target="_blank"><?php esc_html_e( 'OpenLiteSpeed Web Server', 'litespeed-cache' ); ?></a>
|
||||
<br />
|
||||
<a href="https://www.litespeedtech.com/products/litespeed-web-adc" target="_blank"><?php esc_html_e( 'LiteSpeed Web ADC', 'litespeed-cache' ); ?></a>
|
||||
<br />
|
||||
<a href="https://quic.cloud" target="_blank"><?php esc_html_e( 'QUIC.cloud CDN', 'litespeed-cache' ); ?></a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ( $can_page_load_time ) : ?>
|
||||
<div class="inside litespeed-postbox-footer litespeed-postbox-footer--compact">
|
||||
<?php if ( ! empty( $cloud_summary['last_request.health-speed'] ) ) : ?>
|
||||
<span class="litespeed-right10">
|
||||
<?php
|
||||
printf(
|
||||
esc_html__( 'Requested: %s ago', 'litespeed-cache' ),
|
||||
'<span data-balloon-pos="up" aria-label="' . esc_attr( Utility::readable_time( $cloud_summary['last_request.health-speed'] ) ) . '">' . esc_html( human_time_diff( $cloud_summary['last_request.health-speed'] ) ) . '</span>'
|
||||
);
|
||||
?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
<a href="<?php echo esc_url( Utility::build_url( Router::ACTION_HEALTH, Health::TYPE_SPEED ) ); ?>" class="button button-secondary button-small">
|
||||
<span class="dashicons dashicons-update"></span>
|
||||
<?php esc_html_e( 'Refresh', 'litespeed-cache' ); ?>
|
||||
<span class="screen-reader-text"><?php esc_html_e( 'Refresh page load time', 'litespeed-cache' ); ?></span>
|
||||
</a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="postbox litespeed-postbox litespeed-postbox-pagespeed">
|
||||
<div class="inside">
|
||||
<h3 class="litespeed-title">
|
||||
<?php esc_html_e( 'PageSpeed Score', 'litespeed-cache' ); ?>
|
||||
<?php $guest_option = Base::O_GUEST; ?>
|
||||
<a href="<?php echo esc_url( admin_url( 'admin.php?page=litespeed-general#settings' ) ); ?>" class="litespeed-title-right-icon"><?php echo esc_html( Lang::title( $guest_option ) ); ?></a>
|
||||
<?php if ( $this->conf( $guest_option ) ) : ?>
|
||||
<span class="litespeed-label-success litespeed-label-dashboard"><?php esc_html_e( 'ON', 'litespeed-cache' ); ?></span>
|
||||
<?php else : ?>
|
||||
<span class="litespeed-label-danger litespeed-label-dashboard"><?php esc_html_e( 'OFF', 'litespeed-cache' ); ?></span>
|
||||
<?php endif; ?>
|
||||
</h3>
|
||||
<div>
|
||||
<div class="litespeed-margin-bottom20">
|
||||
<div class="litespeed-row-flex" style="margin-left: -10px;">
|
||||
<?php if ( ! empty( $health_scores['score_before'] ) ) : ?>
|
||||
<div class="litespeed-width-1-3 litespeed-padding-space litespeed-margin-x5">
|
||||
<p class="litespeed-text-grey litespeed-text-center">
|
||||
<?php esc_html_e( 'Before', 'litespeed-cache' ); ?>
|
||||
</p>
|
||||
<div class="litespeed-promo-score">
|
||||
<?php echo wp_kses( GUI::pie( $health_scores['score_before'], 45, false, true, 'litespeed-pie-' . esc_attr( GUI::cls()->get_cls_of_pagescore( $health_scores['score_before'] ) ) ), GUI::allowed_svg_tags() ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="litespeed-width-1-3 litespeed-padding-space litespeed-margin-x5">
|
||||
<p class="litespeed-text-grey litespeed-text-center">
|
||||
<?php esc_html_e( 'After', 'litespeed-cache' ); ?>
|
||||
</p>
|
||||
<div class="litespeed-promo-score">
|
||||
<?php echo wp_kses( GUI::pie( $health_scores['score_after'], 45, false, true, 'litespeed-pie-' . esc_attr( GUI::cls()->get_cls_of_pagescore( $health_scores['score_after'] ) ) ), GUI::allowed_svg_tags() ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="litespeed-width-1-3 litespeed-padding-space litespeed-margin-x5">
|
||||
<p class="litespeed-text-grey" style="white-space: nowrap;">
|
||||
<?php esc_html_e( 'Improved by', 'litespeed-cache' ); ?>
|
||||
</p>
|
||||
<div class="litespeed-postbox-score-improve litespeed-text-fern">
|
||||
<?php echo esc_html( $health_scores['score_improved'] ); ?><span class="litespeed-text-large">%</span>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="inside litespeed-postbox-footer litespeed-postbox-footer--compact">
|
||||
<?php if ( ! empty( $cloud_summary['last_request.health-score'] ) ) : ?>
|
||||
<span class="litespeed-right10">
|
||||
<?php
|
||||
printf(
|
||||
esc_html__( 'Requested: %s ago', 'litespeed-cache' ),
|
||||
'<span data-balloon-pos="up" aria-label="' . esc_attr( Utility::readable_time( $cloud_summary['last_request.health-score'] ) ) . '">' . esc_html( human_time_diff( $cloud_summary['last_request.health-score'] ) ) . '</span>'
|
||||
);
|
||||
?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
<a href="<?php echo esc_url( Utility::build_url( Router::ACTION_HEALTH, Health::TYPE_SCORE ) ); ?>" class="button button-secondary button-small">
|
||||
<span class="dashicons dashicons-update"></span>
|
||||
<?php esc_html_e( 'Refresh', 'litespeed-cache' ); ?>
|
||||
<span class="screen-reader-text"><?php esc_html_e( 'Refresh page score', 'litespeed-cache' ); ?></span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="postbox litespeed-postbox litespeed-postbox-double litespeed-postbox-imgopt">
|
||||
<div class="inside">
|
||||
<h3 class="litespeed-title">
|
||||
<?php esc_html_e( 'Image Optimization Summary', 'litespeed-cache' ); ?>
|
||||
<a href="<?php echo esc_url( admin_url( 'admin.php?page=litespeed-img_optm' ) ); ?>" class="litespeed-title-right-icon"><?php esc_html_e( 'More', 'litespeed-cache' ); ?></a>
|
||||
</h3>
|
||||
<div class="litespeed-postbox-double-content">
|
||||
<div class="litespeed-postbox-double-col">
|
||||
<div class="litespeed-flex-container">
|
||||
<div class="litespeed-icon-vertical-middle">
|
||||
<?php echo wp_kses( GUI::pie( $img_finished_percentage, 70, true ), GUI::allowed_svg_tags() ); ?>
|
||||
</div>
|
||||
<div>
|
||||
<div class="litespeed-dashboard-stats">
|
||||
<a data-litespeed-onlyonce class="button button-primary"
|
||||
<?php if ( ! empty( $img_count['groups_new'] ) || ! empty( $img_count[ 'groups.' . Img_Optm::STATUS_RAW ] ) ) : ?>
|
||||
href="<?php echo esc_url( Utility::build_url( Router::ACTION_IMG_OPTM, Img_Optm::TYPE_NEW_REQ ) ); ?>"
|
||||
<?php else : ?>
|
||||
href="javascript:;" disabled
|
||||
<?php endif; ?>>
|
||||
<span class="dashicons dashicons-images-alt2"></span><?php esc_html_e( 'Send Optimization Request', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p>
|
||||
<?php esc_html_e( 'Total Reduction', 'litespeed-cache' ); ?>: <code><?php echo isset( $img_optm_summary['reduced'] ) ? esc_html( Utility::real_size( $img_optm_summary['reduced'] ) ) : '-'; ?></code>
|
||||
</p>
|
||||
<p>
|
||||
<?php esc_html_e( 'Images Pulled', 'litespeed-cache' ); ?>: <code><?php echo isset( $img_optm_summary['img_taken'] ) ? esc_html( $img_optm_summary['img_taken'] ) : '-'; ?></code>
|
||||
</p>
|
||||
</div>
|
||||
<div class="litespeed-postbox-double-col">
|
||||
<?php if ( ! empty( $img_count[ 'group.' . Img_Optm::STATUS_REQUESTED ] ) ) : ?>
|
||||
<p class="litespeed-success">
|
||||
<?php esc_html_e( 'Images requested', 'litespeed-cache' ); ?>:
|
||||
<code>
|
||||
<?php echo esc_html( Admin_Display::print_plural( $img_count[ 'group.' . Img_Optm::STATUS_REQUESTED ] ) ); ?>
|
||||
(<?php echo esc_html( Admin_Display::print_plural( $img_count[ 'img.' . Img_Optm::STATUS_REQUESTED ], 'image' ) ); ?>)
|
||||
</code>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php if ( ! empty( $img_count[ 'group.' . Img_Optm::STATUS_NOTIFIED ] ) ) : ?>
|
||||
<p class="litespeed-success">
|
||||
<?php esc_html_e( 'Images notified to pull', 'litespeed-cache' ); ?>:
|
||||
<code>
|
||||
<?php echo esc_html( Admin_Display::print_plural( $img_count[ 'group.' . Img_Optm::STATUS_NOTIFIED ] ) ); ?>
|
||||
(<?php echo esc_html( Admin_Display::print_plural( $img_count[ 'img.' . Img_Optm::STATUS_NOTIFIED ], 'image' ) ); ?>)
|
||||
</code>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<p>
|
||||
<?php esc_html_e( 'Last Request', 'litespeed-cache' ); ?>: <code><?php echo ! empty( $img_optm_summary['last_requested'] ) ? esc_html( Utility::readable_time( $img_optm_summary['last_requested'] ) ) : '-'; ?></code>
|
||||
</p>
|
||||
<p>
|
||||
<?php esc_html_e( 'Last Pull', 'litespeed-cache' ); ?>: <code><?php echo ! empty( $img_optm_summary['last_pull'] ) ? esc_html( Utility::readable_time( $img_optm_summary['last_pull'] ) ) : '-'; ?></code>
|
||||
</p>
|
||||
<?php
|
||||
$opt_list = array(
|
||||
Base::O_IMG_OPTM_AUTO => Lang::title( Base::O_IMG_OPTM_AUTO ),
|
||||
);
|
||||
foreach ( $opt_list as $opt_id => $opt_title ) :
|
||||
?>
|
||||
<p>
|
||||
<?php if ( $this->conf( $opt_id ) ) : ?>
|
||||
<span class="litespeed-label-success litespeed-label-dashboard"><?php esc_html_e( 'ON', 'litespeed-cache' ); ?></span>
|
||||
<?php else : ?>
|
||||
<span class="litespeed-label-danger litespeed-label-dashboard"><?php esc_html_e( 'OFF', 'litespeed-cache' ); ?></span>
|
||||
<?php endif; ?>
|
||||
<a href="<?php echo esc_url( admin_url( 'admin.php?page=litespeed-img_optm#settings' ) ); ?>"><?php echo esc_html( $opt_title ); ?></a>
|
||||
</p>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="postbox litespeed-postbox litespeed-postbox-cache">
|
||||
<div class="inside">
|
||||
<h3 class="litespeed-title">
|
||||
<?php esc_html_e( 'Cache Status', 'litespeed-cache' ); ?>
|
||||
<a href="<?php echo esc_url( admin_url( 'admin.php?page=litespeed-cache' ) ); ?>" class="litespeed-title-right-icon"><?php esc_html_e( 'More', 'litespeed-cache' ); ?></a>
|
||||
</h3>
|
||||
<?php
|
||||
$cache_list = array(
|
||||
Base::O_CACHE => esc_html__( 'Public Cache', 'litespeed-cache' ),
|
||||
Base::O_CACHE_PRIV => esc_html__( 'Private Cache', 'litespeed-cache' ),
|
||||
Base::O_OBJECT => esc_html__( 'Object Cache', 'litespeed-cache' ),
|
||||
Base::O_CACHE_BROWSER => esc_html__( 'Browser Cache', 'litespeed-cache' ),
|
||||
);
|
||||
foreach ( $cache_list as $cache_option => $cache_title ) :
|
||||
?>
|
||||
<p>
|
||||
<?php if ( $this->conf( $cache_option ) ) : ?>
|
||||
<span class="litespeed-label-success litespeed-label-dashboard"><?php esc_html_e( 'ON', 'litespeed-cache' ); ?></span>
|
||||
<?php else : ?>
|
||||
<span class="litespeed-label-danger litespeed-label-dashboard"><?php esc_html_e( 'OFF', 'litespeed-cache' ); ?></span>
|
||||
<?php endif; ?>
|
||||
<?php echo esc_html( $cache_title ); ?>
|
||||
</p>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="postbox litespeed-postbox litespeed-postbox-ccss">
|
||||
<div class="inside">
|
||||
<h3 class="litespeed-title">
|
||||
<?php esc_html_e( 'Critical CSS', 'litespeed-cache' ); ?>
|
||||
<a href="<?php echo esc_url( admin_url( 'admin.php?page=litespeed-page_optm#settings_css' ) ); ?>" class="litespeed-title-right-icon"><?php esc_html_e( 'More', 'litespeed-cache' ); ?></a>
|
||||
</h3>
|
||||
<?php if ( ! empty( $css_summary['last_request_ccss'] ) ) : ?>
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
esc_html__( 'Last generated: %s', 'litespeed-cache' ),
|
||||
'<code>' . esc_html( Utility::readable_time( $css_summary['last_request_ccss'] ) ) . '</code>'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
esc_html__( 'Time to execute previous request: %s', 'litespeed-cache' ),
|
||||
'<code>' . esc_html( $css_summary['last_spent_ccss'] ) . 's</code>'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<p>
|
||||
<?php esc_html_e( 'Requests in queue', 'litespeed-cache' ); ?>: <code><?php echo ! empty( $ccss_count ) ? esc_html( $ccss_count ) : '-'; ?></code>
|
||||
<a href="<?php echo ! empty( $ccss_count ) ? esc_url( Utility::build_url( Router::ACTION_CSS, CSS::TYPE_GEN_CCSS ) ) : 'javascript:;'; ?>"
|
||||
class="button button-secondary button-small <?php echo empty( $ccss_count ) ? 'disabled' : ''; ?>">
|
||||
<?php esc_html_e( 'Force cron', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
<?php if ( ! empty( $cloud_summary['last_request.ccss'] ) ) : ?>
|
||||
<div class="inside litespeed-postbox-footer litespeed-postbox-footer--compact">
|
||||
<?php
|
||||
printf(
|
||||
esc_html__( 'Last requested: %s', 'litespeed-cache' ),
|
||||
esc_html( Utility::readable_time( $cloud_summary['last_request.ccss'] ) )
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="postbox litespeed-postbox litespeed-postbox-ucss">
|
||||
<div class="inside">
|
||||
<h3 class="litespeed-title">
|
||||
<?php esc_html_e( 'Unique CSS', 'litespeed-cache' ); ?>
|
||||
<a href="<?php echo esc_url( admin_url( 'admin.php?page=litespeed-page_optm#settings_css' ) ); ?>" class="litespeed-title-right-icon"><?php esc_html_e( 'More', 'litespeed-cache' ); ?></a>
|
||||
</h3>
|
||||
<?php if ( ! empty( $ucss_summary['last_request'] ) ) : ?>
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
esc_html__( 'Last generated: %s', 'litespeed-cache' ),
|
||||
'<code>' . esc_html( Utility::readable_time( $ucss_summary['last_request'] ) ) . '</code>'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
esc_html__( 'Time to execute previous request: %s', 'litespeed-cache' ),
|
||||
'<code>' . esc_html( $ucss_summary['last_spent'] ) . 's</code>'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<p>
|
||||
<?php esc_html_e( 'Requests in queue', 'litespeed-cache' ); ?>: <code><?php echo ! empty( $ucss_count ) ? esc_html( $ucss_count ) : '-'; ?></code>
|
||||
<a href="<?php echo ! empty( $ucss_count ) ? esc_url( Utility::build_url( Router::ACTION_UCSS, UCSS::TYPE_GEN ) ) : 'javascript:;'; ?>"
|
||||
class="button button-secondary button-small <?php echo empty( $ucss_count ) ? 'disabled' : ''; ?>">
|
||||
<?php esc_html_e( 'Force cron', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
<?php if ( ! empty( $cloud_summary['last_request.ucss'] ) ) : ?>
|
||||
<div class="inside litespeed-postbox-footer litespeed-postbox-footer--compact">
|
||||
<?php
|
||||
printf(
|
||||
esc_html__( 'Last requested: %s', 'litespeed-cache' ),
|
||||
esc_html( Utility::readable_time( $cloud_summary['last_request.ucss'] ) )
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="postbox litespeed-postbox litespeed-postbox-lqip">
|
||||
<div class="inside">
|
||||
<h3 class="litespeed-title">
|
||||
<?php esc_html_e( 'Low Quality Image Placeholder', 'litespeed-cache' ); ?>
|
||||
<a href="<?php echo esc_url( admin_url( 'admin.php?page=litespeed-page_optm#settings_media' ) ); ?>" class="litespeed-title-right-icon"><?php esc_html_e( 'More', 'litespeed-cache' ); ?></a>
|
||||
</h3>
|
||||
<?php if ( ! empty( $placeholder_summary['last_request'] ) ) : ?>
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
esc_html__( 'Last generated: %s', 'litespeed-cache' ),
|
||||
'<code>' . esc_html( Utility::readable_time( $placeholder_summary['last_request'] ) ) . '</code>'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
esc_html__( 'Time to execute previous request: %s', 'litespeed-cache' ),
|
||||
'<code>' . esc_html( $placeholder_summary['last_spent'] ) . 's</code>'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<p>
|
||||
<?php esc_html_e( 'Requests in queue', 'litespeed-cache' ); ?>: <code><?php echo ! empty( $placeholder_queue_count ) ? esc_html( $placeholder_queue_count ) : '-'; ?></code>
|
||||
<a href="<?php echo ! empty( $placeholder_queue_count ) ? esc_url( Utility::build_url( Router::ACTION_PLACEHOLDER, Placeholder::TYPE_GENERATE ) ) : 'javascript:;'; ?>"
|
||||
class="button button-secondary button-small <?php echo empty( $placeholder_queue_count ) ? 'disabled' : ''; ?>">
|
||||
<?php esc_html_e( 'Force cron', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
<?php if ( ! empty( $cloud_summary['last_request.lqip'] ) ) : ?>
|
||||
<div class="inside litespeed-postbox-footer litespeed-postbox-footer--compact">
|
||||
<?php
|
||||
printf(
|
||||
esc_html__( 'Last requested: %s', 'litespeed-cache' ),
|
||||
esc_html( Utility::readable_time( $cloud_summary['last_request.lqip'] ) )
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="postbox litespeed-postbox litespeed-postbox-vpi">
|
||||
<div class="inside">
|
||||
<h3 class="litespeed-title">
|
||||
<?php esc_html_e( 'Viewport Image', 'litespeed-cache' ); ?> (VPI)
|
||||
<a href="<?php echo esc_url( admin_url( 'admin.php?page=litespeed-page_optm#settings_vpi' ) ); ?>" class="litespeed-title-right-icon"><?php esc_html_e( 'More', 'litespeed-cache' ); ?></a>
|
||||
</h3>
|
||||
<?php if ( ! empty( $vpi_summary['last_request'] ) ) : ?>
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
esc_html__( 'Last generated: %s', 'litespeed-cache' ),
|
||||
'<code>' . esc_html( Utility::readable_time( $vpi_summary['last_request'] ) ) . '</code>'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
esc_html__( 'Time to execute previous request: %s', 'litespeed-cache' ),
|
||||
'<code>' . esc_html( $vpi_summary['last_spent'] ) . 's</code>'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<p>
|
||||
<?php esc_html_e( 'Requests in queue', 'litespeed-cache' ); ?>: <code><?php echo ! empty( $vpi_queue_count ) ? esc_html( $vpi_queue_count ) : '-'; ?></code>
|
||||
<a href="<?php echo ! empty( $vpi_queue_count ) ? esc_url( Utility::build_url( Router::ACTION_VPI, VPI::TYPE_GEN ) ) : 'javascript:;'; ?>"
|
||||
class="button button-secondary button-small <?php echo empty( $vpi_queue_count ) ? 'disabled' : ''; ?>">
|
||||
<?php esc_html_e( 'Force cron', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
<?php if ( ! empty( $cloud_summary['last_request.vpi'] ) ) : ?>
|
||||
<div class="inside litespeed-postbox-footer litespeed-postbox-footer--compact">
|
||||
<?php
|
||||
printf(
|
||||
esc_html__( 'Last requested: %s', 'litespeed-cache' ),
|
||||
esc_html( Utility::readable_time( $cloud_summary['last_request.vpi'] ) )
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="postbox litespeed-postbox litespeed-postbox-crawler">
|
||||
<div class="inside">
|
||||
<h3 class="litespeed-title">
|
||||
<?php esc_html_e( 'Crawler Status', 'litespeed-cache' ); ?>
|
||||
<a href="<?php echo esc_url( admin_url( 'admin.php?page=litespeed-crawler' ) ); ?>" class="litespeed-title-right-icon"><?php esc_html_e( 'More', 'litespeed-cache' ); ?></a>
|
||||
</h3>
|
||||
<p>
|
||||
<code><?php echo esc_html( count( Crawler::cls()->list_crawlers() ) ); ?></code> <?php esc_html_e( 'Crawler(s)', 'litespeed-cache' ); ?>
|
||||
</p>
|
||||
<p>
|
||||
<?php esc_html_e( 'Currently active crawler', 'litespeed-cache' ); ?>: <code><?php echo esc_html( $crawler_summary['curr_crawler'] ); ?></code>
|
||||
</p>
|
||||
<?php if ( ! empty( $crawler_summary['curr_crawler_beginning_time'] ) ) : ?>
|
||||
<p>
|
||||
<span class="litespeed-bold"><?php esc_html_e( 'Current crawler started at', 'litespeed-cache' ); ?>:</span>
|
||||
<?php echo esc_html( Utility::readable_time( $crawler_summary['curr_crawler_beginning_time'] ) ); ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php if ( ! empty( $crawler_summary['last_start_time'] ) ) : ?>
|
||||
<p class="litespeed-desc">
|
||||
<span class="litespeed-bold"><?php esc_html_e( 'Last interval', 'litespeed-cache' ); ?>:</span>
|
||||
<?php echo esc_html( Utility::readable_time( $crawler_summary['last_start_time'] ) ); ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php if ( ! empty( $crawler_summary['end_reason'] ) ) : ?>
|
||||
<p class="litespeed-desc">
|
||||
<span class="litespeed-bold"><?php esc_html_e( 'Ended reason', 'litespeed-cache' ); ?>:</span>
|
||||
<?php echo esc_html( $crawler_summary['end_reason'] ); ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php if ( ! empty( $crawler_summary['last_crawled'] ) ) : ?>
|
||||
<p class="litespeed-desc">
|
||||
<?php
|
||||
printf(
|
||||
esc_html__( '%1$s %2$d item(s)', 'litespeed-cache' ),
|
||||
'<span class="litespeed-bold">' . esc_html__( 'Last crawled:', 'litespeed-cache' ) . '</span>',
|
||||
esc_html( $crawler_summary['last_crawled'] )
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="postbox litespeed-postbox litespeed-postbox-quiccloud <?php echo empty( $cloud_summary['qc_activated'] ) || 'cdn' !== $cloud_summary['qc_activated'] ? 'litespeed-postbox--quiccloud' : ''; ?>">
|
||||
<div class="inside">
|
||||
<h3 class="litespeed-title litespeed-dashboard-title--w-btn">
|
||||
<span class="litespeed-quic-icon"></span><?php esc_html_e( 'QUIC.cloud CDN', 'litespeed-cache' ); ?>
|
||||
<?php if ( empty( $cloud_summary['qc_activated'] ) || 'cdn' !== $cloud_summary['qc_activated'] ) : ?>
|
||||
<a href="https://www.quic.cloud/quic-cloud-services-and-features/litespeed-cache-service/" class="litespeed-title-right-icon" target="_blank"><?php esc_html_e( 'Learn More', 'litespeed-cache' ); ?></a>
|
||||
<?php else : ?>
|
||||
<a href="<?php echo esc_url( admin_url( 'admin.php?page=litespeed-cdn' ) ); ?>" class="litespeed-title-right-icon"><?php esc_html_e( 'More', 'litespeed-cache' ); ?></a>
|
||||
<?php endif; ?>
|
||||
</h3>
|
||||
<?php if ( empty( $cloud_summary['qc_activated'] ) || 'cdn' !== $cloud_summary['qc_activated'] ) : ?>
|
||||
<div class="litespeed-text-center litespeed-empty-space-medium">
|
||||
<p class="litespeed-margin-bottom20">
|
||||
<?php
|
||||
Doc::learn_more(
|
||||
esc_url( Utility::build_url( Router::ACTION_CLOUD, $cloud_instance->activated() ? Cloud::TYPE_ENABLE_CDN : Cloud::TYPE_ACTIVATE ) ),
|
||||
'<span class="dashicons dashicons-saved"></span>' . esc_html__( 'Enable QUIC.cloud CDN', 'litespeed-cache' ),
|
||||
true,
|
||||
'button button-primary litespeed-button-cta'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<p class="litespeed-margin-bottom10 litespeed-top20 litespeed-text-md">
|
||||
<strong class="litespeed-qc-text-gradient"><?php esc_html_e( 'Best available WordPress performance', 'litespeed-cache' ); ?></strong>
|
||||
</p>
|
||||
<p class="litespeed-margin-bottom20 litespeed-margin-top-remove">
|
||||
<?php
|
||||
printf(
|
||||
esc_html__( 'Globally fast TTFB, easy setup, and %s!', 'litespeed-cache' ),
|
||||
'<a href="https://www.quic.cloud/quic-cloud-services-and-features/litespeed-cache-service/" target="_blank">' . esc_html__( 'more', 'litespeed-cache' ) . '</a>'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
<?php else : ?>
|
||||
<?php echo wp_kses_post( $cloud_instance->load_qc_status_for_dash( 'cdn_dash_mini' ) ); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php if ( $cloud_instance->activated() ) : ?>
|
||||
<div class="inside litespeed-postbox-footer litespeed-postbox-footer--compact">
|
||||
<a href="<?php echo esc_url( Utility::build_url( Router::ACTION_CLOUD, Cloud::TYPE_SYNC_STATUS ) ); ?>"
|
||||
class="button button-<?php echo 'cdn' !== $cloud_summary['qc_activated'] ? 'link' : 'secondary'; ?> button-small">
|
||||
<?php if ( 'cdn' === $cloud_summary['qc_activated'] ) : ?>
|
||||
<span class="dashicons dashicons-update"></span>
|
||||
<?php endif; ?>
|
||||
<?php esc_html_e( 'Refresh Status', 'litespeed-cache' ); ?>
|
||||
<span class="screen-reader-text"><?php esc_html_e( 'Refresh QUIC.cloud status', 'litespeed-cache' ); ?></span>
|
||||
</a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
$promo_mini = $cloud_instance->load_qc_status_for_dash( 'promo_mini' );
|
||||
if ( $promo_mini ) :
|
||||
echo wp_kses_post( $promo_mini );
|
||||
endif;
|
||||
?>
|
||||
|
||||
<?php if ( $cloud_instance->activated() ) : ?>
|
||||
<?php
|
||||
$news = $cloud_instance->load_qc_status_for_dash( 'news_dash' );
|
||||
if ( $news ) :
|
||||
?>
|
||||
<div class="postbox litespeed-postbox">
|
||||
<div class="inside litespeed-text-center">
|
||||
<h3 class="litespeed-title">
|
||||
<?php esc_html_e( 'News', 'litespeed-cache' ); ?>
|
||||
</h3>
|
||||
<div class="litespeed-top20">
|
||||
<?php echo wp_kses_post( $news ); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Dashboard Wrapper
|
||||
*
|
||||
* Renders the main dashboard page for the LiteSpeed Cache plugin in the WordPress admin area.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
$menu_list = array(
|
||||
'dashboard' => esc_html__( 'Dashboard', 'litespeed-cache' ),
|
||||
);
|
||||
|
||||
if ( $this->_is_network_admin ) {
|
||||
$menu_list = array(
|
||||
'network_dash' => esc_html__( 'Network Dashboard', 'litespeed-cache' ),
|
||||
);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<div class="wrap">
|
||||
<h1 class="litespeed-h1">
|
||||
<?php echo esc_html__( 'LiteSpeed Cache Dashboard', 'litespeed-cache' ); ?>
|
||||
</h1>
|
||||
<span class="litespeed-desc">
|
||||
<?php echo esc_html( 'v' . Core::VER ); ?>
|
||||
</span>
|
||||
<hr class="wp-header-end">
|
||||
</div>
|
||||
|
||||
<div class="litespeed-wrap">
|
||||
<?php
|
||||
foreach ( $menu_list as $tab_key => $tab_val ) {
|
||||
echo '<div data-litespeed-layout="' . esc_attr( $tab_key ) . '">';
|
||||
require LSCWP_DIR . 'tpl/dash/' . $tab_key . '.tpl.php';
|
||||
echo '</div>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
@@ -0,0 +1,132 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Network Dashboard
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
$cloud_summaries = array();
|
||||
$blogs = Activation::get_network_ids();
|
||||
foreach ( $blogs as $network_blog_id ) {
|
||||
switch_to_blog( $network_blog_id );
|
||||
$cloud_summaries[ home_url() ] = Cloud::get_summary();
|
||||
// May need restore_current_blog();
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<div class="litespeed-dashboard">
|
||||
<?php foreach ( $cloud_summaries as $home_url => $cloud_summary ) : ?>
|
||||
|
||||
<div class="litespeed-dashboard-header">
|
||||
<h3 class="litespeed-dashboard-title">
|
||||
<?php echo esc_html( sprintf( __( 'Usage Statistics: %s', 'litespeed-cache' ), $home_url ) ); ?>
|
||||
</h3>
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<div class="litespeed-dashboard-stats-wrapper">
|
||||
<?php
|
||||
$cat_list = array(
|
||||
'img_optm' => esc_html__( 'Image Optimization', 'litespeed-cache' ),
|
||||
'page_optm' => esc_html__( 'Page Optimization', 'litespeed-cache' ),
|
||||
'cdn' => esc_html__( 'CDN Bandwidth', 'litespeed-cache' ),
|
||||
'lqip' => esc_html__( 'Low Quality Image Placeholder', 'litespeed-cache' ),
|
||||
);
|
||||
|
||||
foreach ( $cat_list as $svc => $svc_title ) :
|
||||
$finished_percentage = 0;
|
||||
$total_used = '-';
|
||||
$used = '-';
|
||||
$quota = '-';
|
||||
$pag_used = '-';
|
||||
$pag_total = '-';
|
||||
$pag_width = 0;
|
||||
$pag_bal = 0;
|
||||
|
||||
if ( ! empty( $cloud_summary[ 'usage.' . $svc ] ) ) {
|
||||
$usage = $cloud_summary[ 'usage.' . $svc ];
|
||||
$finished_percentage = floor( $usage['used'] * 100 / $usage['quota'] );
|
||||
$used = $usage['used'];
|
||||
$quota = $usage['quota'];
|
||||
$pag_used = ! empty( $usage['pag_used'] ) ? $usage['pag_used'] : 0;
|
||||
$pag_bal = ! empty( $usage['pag_bal'] ) ? $usage['pag_bal'] : 0;
|
||||
$pag_total = $pag_used + $pag_bal;
|
||||
|
||||
if ( $pag_total ) {
|
||||
$pag_width = round( $pag_used / $pag_total * 100 ) . '%';
|
||||
}
|
||||
|
||||
if ( 'cdn' === $svc ) {
|
||||
$used = Utility::real_size( $used * 1024 * 1024 );
|
||||
$quota = Utility::real_size( $quota * 1024 * 1024 );
|
||||
$pag_used = Utility::real_size( $pag_used * 1024 * 1024 );
|
||||
$pag_total = Utility::real_size( $pag_total * 1024 * 1024 );
|
||||
}
|
||||
|
||||
if ( ! empty( $usage['total_used'] ) ) {
|
||||
$total_used = $usage['total_used'];
|
||||
}
|
||||
}
|
||||
|
||||
$percentage_bg = 'success';
|
||||
if ( 95 < $finished_percentage ) {
|
||||
$percentage_bg = 'danger';
|
||||
} elseif ( 85 < $finished_percentage ) {
|
||||
$percentage_bg = 'warning';
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="postbox litespeed-postbox">
|
||||
<div class="inside">
|
||||
<h3 class="litespeed-title"><?php echo esc_html( $svc_title ); ?></h3>
|
||||
|
||||
<div class="litespeed-flex-container">
|
||||
<div class="litespeed-icon-vertical-middle litespeed-pie-<?php echo esc_attr( $percentage_bg ); ?>">
|
||||
<?php echo wp_kses( GUI::pie( $finished_percentage, 60, false ), GUI::allowed_svg_tags() ); ?>
|
||||
</div>
|
||||
<div>
|
||||
<div class="litespeed-dashboard-stats">
|
||||
<h3><?php echo esc_html( 'img_optm' === $svc ? __( 'Fast Queue Usage', 'litespeed-cache' ) : __( 'Usage', 'litespeed-cache' ) ); ?></h3>
|
||||
<p>
|
||||
<strong><?php echo esc_html( $used ); ?></strong>
|
||||
<?php if ( $quota !== $used ) : ?>
|
||||
<span class="litespeed-desc"> / <?php echo esc_html( $quota ); ?></span>
|
||||
<?php endif; ?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ( 0 < $pag_total ) : ?>
|
||||
<p class="litespeed-dashboard-stats-payg" data-balloon-pos="up" aria-label="<?php echo esc_attr__( 'Pay as You Go', 'litespeed-cache' ); ?>">
|
||||
<?php esc_html_e( 'PAYG Balance', 'litespeed-cache' ); ?>: <strong><?php echo esc_html( $pag_bal ); ?></strong>
|
||||
<button class="litespeed-info-button" data-balloon-pos="up" aria-label="<?php echo esc_attr( sprintf( __( 'This Month Usage: %s', 'litespeed-cache' ), esc_html( $pag_used ) ) ); ?>">
|
||||
<span class="dashicons dashicons-info"></span>
|
||||
<span class="screen-reader-text"><?php esc_html_e( 'Pay as You Go Usage Statistics', 'litespeed-cache' ); ?></span>
|
||||
</button>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( 'img_optm' === $svc ) : ?>
|
||||
<p class="litespeed-dashboard-stats-total">
|
||||
<?php esc_html_e( 'Total Usage', 'litespeed-cache' ); ?>: <strong><?php echo esc_html( $total_used ); ?> / ∞</strong>
|
||||
<button class="litespeed-info-button" data-balloon-pos="up" aria-label="<?php echo esc_attr__( 'Total images optimized in this month', 'litespeed-cache' ); ?>">
|
||||
<span class="dashicons dashicons-info"></span>
|
||||
</button>
|
||||
</p>
|
||||
<div class="clear"></div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Database Optimization
|
||||
*
|
||||
* @package LiteSpeed
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
$menu_list = array(
|
||||
'manage' => esc_html__( 'Manage', 'litespeed-cache' ),
|
||||
);
|
||||
|
||||
if ( ! is_network_admin() ) {
|
||||
$menu_list['settings'] = esc_html__( 'DB Optimization Settings', 'litespeed-cache' );
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<div class="wrap">
|
||||
<h1 class="litespeed-h1">
|
||||
<?php esc_html_e( 'LiteSpeed Cache Database Optimization', 'litespeed-cache' ); ?>
|
||||
</h1>
|
||||
<span class="litespeed-desc">
|
||||
<?php echo esc_html( 'v' . Core::VER ); ?>
|
||||
</span>
|
||||
<hr class="wp-header-end">
|
||||
</div>
|
||||
|
||||
<div class="litespeed-wrap">
|
||||
<h2 class="litespeed-header nav-tab-wrapper">
|
||||
<?php GUI::display_tab_list( $menu_list ); ?>
|
||||
</h2>
|
||||
|
||||
<div class="litespeed-body">
|
||||
<?php
|
||||
foreach ( $menu_list as $tab_key => $tab_val ) {
|
||||
echo '<div data-litespeed-layout="' . esc_attr( $tab_key ) . '">';
|
||||
require LSCWP_DIR . 'tpl/db_optm/' . $tab_key . '.tpl.php';
|
||||
echo '</div>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,202 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Database Optimization
|
||||
*
|
||||
* Manages database optimization options and displays table engine conversion tools.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
$_panels = array(
|
||||
'all' => array(
|
||||
'title' => esc_html__( 'Clean All', 'litespeed-cache' ),
|
||||
'desc' => '',
|
||||
),
|
||||
'revision' => array(
|
||||
'title' => esc_html__( 'Post Revisions', 'litespeed-cache' ),
|
||||
'desc' => esc_html__( 'Clean all post revisions', 'litespeed-cache' ),
|
||||
),
|
||||
'orphaned_post_meta' => array(
|
||||
'title' => esc_html__( 'Orphaned Post Meta', 'litespeed-cache' ),
|
||||
'desc' => esc_html__( 'Clean all orphaned post meta records', 'litespeed-cache' ),
|
||||
),
|
||||
'auto_draft' => array(
|
||||
'title' => esc_html__( 'Auto Drafts', 'litespeed-cache' ),
|
||||
'desc' => esc_html__( 'Clean all auto saved drafts', 'litespeed-cache' ),
|
||||
),
|
||||
'trash_post' => array(
|
||||
'title' => esc_html__( 'Trashed Posts', 'litespeed-cache' ),
|
||||
'desc' => esc_html__( 'Clean all trashed posts and pages', 'litespeed-cache' ),
|
||||
),
|
||||
'spam_comment' => array(
|
||||
'title' => esc_html__( 'Spam Comments', 'litespeed-cache' ),
|
||||
'desc' => esc_html__( 'Clean all spam comments', 'litespeed-cache' ),
|
||||
),
|
||||
'trash_comment' => array(
|
||||
'title' => esc_html__( 'Trashed Comments', 'litespeed-cache' ),
|
||||
'desc' => esc_html__( 'Clean all trashed comments', 'litespeed-cache' ),
|
||||
),
|
||||
'trackback-pingback' => array(
|
||||
'title' => esc_html__( 'Trackbacks/Pingbacks', 'litespeed-cache' ),
|
||||
'desc' => esc_html__( 'Clean all trackbacks and pingbacks', 'litespeed-cache' ),
|
||||
),
|
||||
'expired_transient' => array(
|
||||
'title' => esc_html__( 'Expired Transients', 'litespeed-cache' ),
|
||||
'desc' => esc_html__( 'Clean expired transient options', 'litespeed-cache' ),
|
||||
),
|
||||
'all_transients' => array(
|
||||
'title' => esc_html__( 'All Transients', 'litespeed-cache' ),
|
||||
'desc' => esc_html__( 'Clean all transient options', 'litespeed-cache' ),
|
||||
),
|
||||
'optimize_tables' => array(
|
||||
'title' => esc_html__( 'Optimize Tables', 'litespeed-cache' ),
|
||||
'desc' => esc_html__( 'Optimize all tables in your database', 'litespeed-cache' ),
|
||||
),
|
||||
);
|
||||
|
||||
$rev_max = $this->conf( Base::O_DB_OPTM_REVISIONS_MAX );
|
||||
$rev_age = $this->conf( Base::O_DB_OPTM_REVISIONS_AGE );
|
||||
if ( $rev_max || $rev_age ) {
|
||||
$_panels['revision']['desc'] = sprintf(
|
||||
esc_html__( 'Clean revisions older than %1$s day(s), excluding %2$s latest revisions', 'litespeed-cache' ),
|
||||
'<strong>' . esc_html( $rev_age ) . '</strong>',
|
||||
'<strong>' . esc_html( $rev_max ) . '</strong>'
|
||||
);
|
||||
}
|
||||
|
||||
$total = 0;
|
||||
foreach ( $_panels as $key => $v ) {
|
||||
if ( 'all' !== $key ) {
|
||||
$_panels[ $key ]['count'] = $this->cls( 'DB_Optm' )->db_count( $key );
|
||||
if ( ! in_array( $key, array( 'optimize_tables' ), true ) ) {
|
||||
$total += $_panels[ $key ]['count'];
|
||||
}
|
||||
}
|
||||
$_panels[ $key ]['link'] = Utility::build_url( Router::ACTION_DB_OPTM, $key );
|
||||
}
|
||||
|
||||
$_panels['all']['count'] = $total;
|
||||
|
||||
$autoload_summary = DB_Optm::cls()->autoload_summary();
|
||||
|
||||
?>
|
||||
|
||||
<h3 class="litespeed-title">
|
||||
<?php esc_html_e( 'Database Optimizer', 'litespeed-cache' ); ?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/database/' ); ?>
|
||||
</h3>
|
||||
|
||||
<div class="litespeed-panel-wrapper litespeed-cards-wrapper">
|
||||
|
||||
<?php foreach ( $_panels as $key => $v ) : ?>
|
||||
<a href="<?php echo esc_url( $v['link'] ); ?>" class="litespeed-panel postbox">
|
||||
<section class="litespeed-panel-wrapper-icon">
|
||||
<span class="litespeed-panel-icon-<?php echo esc_attr( $key ); ?>"></span>
|
||||
</section>
|
||||
<section class="litespeed-panel-content">
|
||||
<div class="litespeed-h3">
|
||||
<?php echo esc_html( $v['title'] ); ?>
|
||||
<span class="litespeed-panel-counter<?php echo $v['count'] > 0 ? '-red' : ''; ?>">(<?php echo esc_html( $v['count'] ); ?><?php echo DB_Optm::hide_more() ? '+' : ''; ?>)</span>
|
||||
</div>
|
||||
<span class="litespeed-panel-para"><?php echo wp_kses_post( $v['desc'] ); ?></span>
|
||||
</section>
|
||||
<section class="litespeed-panel-wrapper-top-right">
|
||||
<span class="litespeed-panel-top-right-icon<?php echo $v['count'] > 0 ? '-cross' : '-tick'; ?>"></span>
|
||||
</section>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
|
||||
</div>
|
||||
|
||||
<h3 class="litespeed-title"><?php esc_html_e( 'Database Table Engine Converter', 'litespeed-cache' ); ?></h3>
|
||||
|
||||
<div class="litespeed-panel-wrapper">
|
||||
|
||||
<table class="wp-list-table widefat striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">#</th>
|
||||
<th scope="col"><?php esc_html_e( 'Table', 'litespeed-cache' ); ?></th>
|
||||
<th scope="col"><?php esc_html_e( 'Engine', 'litespeed-cache' ); ?></th>
|
||||
<th scope="col"><?php esc_html_e( 'Tool', 'litespeed-cache' ); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$list = DB_Optm::cls()->list_myisam();
|
||||
if ( ! empty( $list ) ) :
|
||||
foreach ( $list as $k => $v ) :
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo esc_html( $k + 1 ); ?></td>
|
||||
<td><?php echo esc_html( $v->table_name ); ?></td>
|
||||
<td><?php echo esc_html( $v->engine ); ?></td>
|
||||
<td>
|
||||
<a href="<?php echo esc_url( Utility::build_url( Router::ACTION_DB_OPTM, DB_Optm::TYPE_CONV_TB, false, false, array( 'tb' => $v->table_name ) ) ); ?>">
|
||||
<?php esc_html_e( 'Convert to InnoDB', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php else : ?>
|
||||
<tr>
|
||||
<td colspan="4" class="litespeed-success litespeed-text-center">
|
||||
<?php esc_html_e( 'We are good. No table uses MyISAM engine.', 'litespeed-cache' ); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
<style type="text/css">
|
||||
.litespeed-body .field-col {
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
margin-left: 20px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.litespeed-body .field-col:first-child {
|
||||
margin-left: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<h3 class="litespeed-title"><?php esc_html_e( 'Database Summary', 'litespeed-cache' ); ?></h3>
|
||||
<div>
|
||||
<div class="field-col">
|
||||
<p>
|
||||
<?php esc_html_e( 'Autoload size', 'litespeed-cache' ); ?>: <strong><?php echo esc_html( Utility::real_size( $autoload_summary->autoload_size ) ); ?></strong></p>
|
||||
<p><?php esc_html_e( 'Autoload entries', 'litespeed-cache' ); ?>: <strong><?php echo esc_html( $autoload_summary->autload_entries ); ?></strong></p>
|
||||
</div>
|
||||
|
||||
<div class="field-col">
|
||||
<p><?php esc_html_e( 'Autoload top list', 'litespeed-cache' ); ?>:</p>
|
||||
<table class="wp-list-table widefat striped litespeed-width-auto litespeed-table-compact">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">#</th>
|
||||
<th scope="col"><?php esc_html_e( 'Option Name', 'litespeed-cache' ); ?></th>
|
||||
<th scope="col"><?php esc_html_e( 'Autoload', 'litespeed-cache' ); ?></th>
|
||||
<th scope="col"><?php esc_html_e( 'Size', 'litespeed-cache' ); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ( $autoload_summary->autoload_toplist as $k => $v ) : ?>
|
||||
<tr>
|
||||
<td><?php echo esc_html( $k + 1 ); ?></td>
|
||||
<td><?php echo esc_html( $v->option_name ); ?></td>
|
||||
<td><?php echo esc_html( $v->autoload ); ?></td>
|
||||
<td><?php echo esc_html( $v->option_value_length ); ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Database Optimization Settings
|
||||
*
|
||||
* Manages settings for database optimization in LiteSpeed Cache.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
$this->form_action();
|
||||
?>
|
||||
|
||||
<h3 class="litespeed-title-short">
|
||||
<?php esc_html_e( 'DB Optimization Settings', 'litespeed-cache' ); ?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/database/#db-optimization-settings-tab' ); ?>
|
||||
</h3>
|
||||
|
||||
<table class="wp-list-table striped litespeed-table"><tbody>
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_DB_OPTM_REVISIONS_MAX; ?>
|
||||
<?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 number of most recent revisions to keep when cleaning revisions.', 'litespeed-cache' ); ?>
|
||||
<?php $this->_validate_ttl( $option_id, 1, 100, true ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_DB_OPTM_REVISIONS_AGE; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_input( $option_id, 'litespeed-input-short' ); ?> <?php esc_html_e( 'Day(s)', 'litespeed-cache' ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Revisions newer than this many days will be kept when cleaning revisions.', 'litespeed-cache' ); ?>
|
||||
<?php $this->_validate_ttl( $option_id, 1, 600, true ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody></table>
|
||||
|
||||
<?php
|
||||
$this->form_end();
|
||||
?>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache ESI Block Loader
|
||||
*
|
||||
* Loads the ESI block for LiteSpeed Cache.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
\LiteSpeed\ESI::cls()->load_esi_block();
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Widget Settings
|
||||
*
|
||||
* Configures ESI settings for widgets in LiteSpeed Cache.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
$options = ! empty( $instance[ Base::OPTION_NAME ] ) ? $instance[ Base::OPTION_NAME ] : array();
|
||||
|
||||
if ( empty( $options ) ) {
|
||||
$options = array(
|
||||
ESI::WIDGET_O_ESIENABLE => Base::VAL_OFF,
|
||||
ESI::WIDGET_O_TTL => '28800',
|
||||
);
|
||||
|
||||
add_filter( 'litespeed_widget_default_options', 'LiteSpeed\ESI::widget_default_options', 10, 2 );
|
||||
|
||||
$options = apply_filters( 'litespeed_widget_default_options', $options, $widget );
|
||||
}
|
||||
|
||||
if ( empty( $options ) ) {
|
||||
$esi = Base::VAL_OFF;
|
||||
$ttl = '28800';
|
||||
} else {
|
||||
$esi = $options[ ESI::WIDGET_O_ESIENABLE ];
|
||||
$ttl = $options[ ESI::WIDGET_O_TTL ];
|
||||
}
|
||||
|
||||
$display = Admin_Display::cls();
|
||||
|
||||
?>
|
||||
<div class="litespeed-widget-setting">
|
||||
|
||||
<h4><?php esc_html_e( 'LiteSpeed Cache', 'litespeed-cache' ); ?>:</h4>
|
||||
|
||||
<b><?php esc_html_e( 'Enable ESI', 'litespeed-cache' ); ?>:</b>
|
||||
|
||||
<div class="litespeed-inline">
|
||||
<div class="litespeed-switch litespeed-mini">
|
||||
<?php
|
||||
$esi_option = ESI::WIDGET_O_ESIENABLE;
|
||||
$name = $widget->get_field_name( $esi_option );
|
||||
|
||||
$cache_status_list = array(
|
||||
array( Base::VAL_ON, esc_html__( 'Public', 'litespeed-cache' ) ),
|
||||
array( Base::VAL_ON2, esc_html__( 'Private', 'litespeed-cache' ) ),
|
||||
array( Base::VAL_OFF, esc_html__( 'Disable', 'litespeed-cache' ) ),
|
||||
);
|
||||
|
||||
foreach ( $cache_status_list as $v ) {
|
||||
list( $value, $label ) = $v;
|
||||
$id_attr = $widget->get_field_id( $esi_option ) . '_' . $value;
|
||||
$checked = $esi === $value ? 'checked' : '';
|
||||
?>
|
||||
<input type="radio" autocomplete="off" name="<?php echo esc_attr($name); ?>" id="<?php echo esc_attr($id_attr); ?>" value="<?php echo esc_attr( $value ); ?>" <?php echo esc_attr($checked); ?> />
|
||||
<label for="<?php echo esc_attr($id_attr); ?>"><?php echo esc_html( $label ); ?></label>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<br /><br />
|
||||
|
||||
<b><?php esc_html_e( 'Widget Cache TTL', 'litespeed-cache' ); ?>:</b>
|
||||
|
||||
<?php
|
||||
$ttl_option = ESI::WIDGET_O_TTL;
|
||||
$name = $widget->get_field_name( $ttl_option );
|
||||
?>
|
||||
<input type="text" class="regular-text litespeed-reset" name="<?php echo esc_attr($name); ?>" value="<?php echo esc_attr($ttl); ?>" size="7" />
|
||||
<?php esc_html_e( 'seconds', 'litespeed-cache' ); ?>
|
||||
|
||||
<p class="install-help">
|
||||
<?php esc_html_e( 'Recommended value: 28800 seconds (8 hours).', 'litespeed-cache' ); ?>
|
||||
<?php esc_html_e( 'A TTL of 0 indicates do not cache.', 'litespeed-cache' ); ?>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<br />
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache General Settings
|
||||
*
|
||||
* Manages general settings interface for LiteSpeed Cache.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
$menu_list = array(
|
||||
'online' => esc_html__( 'Online Services', 'litespeed-cache' ),
|
||||
'settings' => esc_html__( 'General Settings', 'litespeed-cache' ),
|
||||
'settings_tuning' => esc_html__( 'Tuning', 'litespeed-cache' ),
|
||||
);
|
||||
|
||||
if ( is_network_admin() ) {
|
||||
$menu_list = array(
|
||||
'network_settings' => esc_html__( 'General Settings', 'litespeed-cache' ),
|
||||
);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<div class="wrap">
|
||||
<h1 class="litespeed-h1">
|
||||
<?php esc_html_e( 'LiteSpeed Cache General Settings', '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">
|
||||
<h2 class="litespeed-header nav-tab-wrapper">
|
||||
<?php GUI::display_tab_list( $menu_list ); ?>
|
||||
</h2>
|
||||
|
||||
<div class="litespeed-body">
|
||||
<?php
|
||||
foreach ( $menu_list as $menu_key => $val ) {
|
||||
echo '<div data-litespeed-layout="' . esc_attr( $menu_key ) . '">';
|
||||
require LSCWP_DIR . 'tpl/general/' . $menu_key . '.tpl.php';
|
||||
echo '</div>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Network General Settings
|
||||
*
|
||||
* Manages network-wide general settings for LiteSpeed Cache.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
$this->form_action();
|
||||
?>
|
||||
|
||||
<h3 class="litespeed-title-short">
|
||||
<?php esc_html_e( 'General Settings', 'litespeed-cache' ); ?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/general/' ); ?>
|
||||
</h3>
|
||||
|
||||
<?php
|
||||
$this->form_action( Router::ACTION_SAVE_SETTINGS_NETWORK );
|
||||
?>
|
||||
|
||||
<table class="wp-list-table striped litespeed-table"><tbody>
|
||||
<?php require LSCWP_DIR . 'tpl/general/settings_inc.auto_upgrade.tpl.php'; ?>
|
||||
|
||||
<tr>
|
||||
<th><?php esc_html_e( 'Use Primary Site Configuration', 'litespeed-cache' ); ?></th>
|
||||
<td>
|
||||
<?php $this->build_switch( Base::NETWORK_O_USE_PRIMARY ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( "Check this option to use the primary site's configuration for all subsites.", 'litespeed-cache' ); ?>
|
||||
<?php esc_html_e( 'This will disable the settings page on all subsites.', 'litespeed-cache' ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php require LSCWP_DIR . 'tpl/general/settings_inc.guest.tpl.php'; ?>
|
||||
|
||||
</tbody></table>
|
||||
|
||||
<?php
|
||||
$this->form_end();
|
||||
?>
|
||||
@@ -0,0 +1,162 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache QUIC.cloud Online Services
|
||||
*
|
||||
* Manages QUIC.cloud online services integration for LiteSpeed Cache.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
$cloud_summary = Cloud::get_summary();
|
||||
|
||||
$cloud_instance = Cloud::cls();
|
||||
$cloud_instance->finish_qc_activation( 'online' );
|
||||
?>
|
||||
|
||||
<h3 class="litespeed-title-short">
|
||||
<?php esc_html_e( 'QUIC.cloud Online Services', 'litespeed-cache' ); ?>
|
||||
<?php Doc::learn_more( 'https://www.quic.cloud/quic-cloud-services-and-features/' ); ?>
|
||||
</h3>
|
||||
|
||||
<div class="litespeed-desc"><?php esc_html_e( 'QUIC.cloud provides CDN and online optimization services, and is not required. You may use many features of this plugin without QUIC.cloud.', 'litespeed-cache' ); ?></div>
|
||||
|
||||
<?php if ( $cloud_instance->activated() ) : ?>
|
||||
<div class="litespeed-callout notice notice-success inline">
|
||||
<h4><?php esc_html_e( 'Current Cloud Nodes in Service', 'litespeed-cache' ); ?>
|
||||
<a class="litespeed-right litespeed-redetect" href="<?php echo esc_url( Utility::build_url( Router::ACTION_CLOUD, Cloud::TYPE_CLEAR_CLOUD, false, null, array( 'ref' => 'online' ) ) ); ?>" data-balloon-pos="up" data-balloon-break aria-label='<?php esc_html_e( 'Click to clear all nodes for further redetection.', 'litespeed-cache' ); ?>' data-litespeed-cfm="<?php esc_html_e( 'Are you sure you want to clear all cloud nodes?', 'litespeed-cache' ); ?>"><i class='litespeed-quic-icon'></i> <?php esc_html_e( 'Redetect', 'litespeed-cache' ); ?></a>
|
||||
</h4>
|
||||
<p>
|
||||
<?php
|
||||
$has_service = false;
|
||||
foreach ( Cloud::$services as $svc ) {
|
||||
if ( isset( $cloud_summary[ 'server.' . $svc ] ) ) {
|
||||
$has_service = true;
|
||||
printf(
|
||||
'<p><strong>%1$s</strong> <code>%2$s</code> <strong>%3$s</strong> <code>%4$s</code> <strong>%5$s</strong> <code>%6$s</code></p>',
|
||||
esc_html__( 'Service:', 'litespeed-cache' ),
|
||||
esc_html( $svc ),
|
||||
esc_html__( 'Node:', 'litespeed-cache' ),
|
||||
esc_html( $cloud_summary[ 'server.' . $svc ] ),
|
||||
esc_html__( 'Connected Date:', 'litespeed-cache' ),
|
||||
esc_html( Utility::readable_time( $cloud_summary[ 'server_date.' . $svc ] ) )
|
||||
);
|
||||
}
|
||||
}
|
||||
if ( ! $has_service ) {
|
||||
esc_html_e( 'No cloud services currently in use', 'litespeed-cache' );
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( ! $cloud_instance->activated() ) : ?>
|
||||
<h4 class="litespeed-text-md litespeed-top30"><span class="dashicons dashicons-no-alt litespeed-danger"></span> <?php esc_html_e( 'QUIC.cloud Integration Disabled', 'litespeed-cache' ); ?></h4>
|
||||
<p><?php esc_html_e( 'Speed up your WordPress site even further with QUIC.cloud Online Services and CDN.', 'litespeed-cache' ); ?></p>
|
||||
<div class="litespeed-desc"><?php esc_html_e( 'Free monthly quota available.', 'litespeed-cache' ); ?></div>
|
||||
<p><a class="button button-primary" href="<?php echo esc_url( Utility::build_url( Router::ACTION_CLOUD, Cloud::TYPE_ACTIVATE, false, null, array( 'ref' => 'online' ) ) ); ?>">
|
||||
<span class="dashicons dashicons-yes"></span>
|
||||
<?php esc_html_e( 'Enable QUIC.cloud services', 'litespeed-cache' ); ?>
|
||||
</a></p>
|
||||
|
||||
<div>
|
||||
<h3 class="litespeed-title-section"><?php esc_html_e( 'Online Services', 'litespeed-cache' ); ?></h3>
|
||||
<p><?php esc_html_e( "QUIC.cloud's Online Services improve your site in the following ways:", 'litespeed-cache' ); ?></p>
|
||||
<ul>
|
||||
<li><span class="dashicons dashicons-saved litespeed-primary"></span> <?php echo wp_kses_post( __( '<strong>Image Optimization</strong> gives you smaller image file sizes that transmit faster.', 'litespeed-cache' ) ); ?></li>
|
||||
<li><span class="dashicons dashicons-saved litespeed-primary"></span> <?php echo wp_kses_post( __( '<strong>Page Optimization</strong> streamlines page styles and visual elements for faster loading.', 'litespeed-cache' ) ); ?></li>
|
||||
</ul>
|
||||
|
||||
<h4 class="litespeed-text-md litespeed-margin-bottom-remove"><?php esc_html_e( 'Image Optimization', 'litespeed-cache' ); ?></h4>
|
||||
<p><?php esc_html_e( "QUIC.cloud's Image Optimization service does the following:", 'litespeed-cache' ); ?></p>
|
||||
<ul>
|
||||
<li><span class="dashicons dashicons-saved litespeed-primary"></span> <?php esc_html_e( "Processes your uploaded PNG and JPG images to produce smaller versions that don't sacrifice quality.", 'litespeed-cache' ); ?></li>
|
||||
<li><span class="dashicons dashicons-saved litespeed-primary"></span> <?php esc_html_e( 'Optionally creates next-generation WebP or AVIF image files.', 'litespeed-cache' ); ?></li>
|
||||
</ul>
|
||||
<p><?php esc_html_e( 'Processing for PNG, JPG, and WebP image formats is free. AVIF is available for a fee.', 'litespeed-cache' ); ?> <a href="https://www.quic.cloud/quic-cloud-services-and-features/image-optimization-service/" target="_blank"><?php esc_html_e( 'Learn More', 'litespeed-cache' ); ?></a></p>
|
||||
|
||||
<h4 class="litespeed-text-md litespeed-margin-bottom-remove"><?php esc_html_e( 'Page Optimization', 'litespeed-cache' ); ?></h4>
|
||||
<p><?php esc_html_e( "QUIC.cloud's Page Optimization services address CSS bloat, and improve the user experience during page load, which can lead to improved page speed scores.", 'litespeed-cache' ); ?></p>
|
||||
<ul>
|
||||
<li><span class="dashicons dashicons-saved litespeed-primary"></span> <?php echo wp_kses_post( __( '<strong>Critical CSS (CCSS)</strong> loads visible above-the-fold content faster and with full styling.', 'litespeed-cache' ) ); ?></li>
|
||||
<li><span class="dashicons dashicons-saved litespeed-primary"></span> <?php echo wp_kses_post( __( '<strong>Unique CSS (UCSS)</strong> removes unused style definitions for a speedier page load overall.', 'litespeed-cache' ) ); ?></li>
|
||||
<li><span class="dashicons dashicons-saved litespeed-primary"></span> <?php echo wp_kses_post( __( '<strong>Low Quality Image Placeholder (LQIP)</strong> gives your imagery a more pleasing look as it lazy loads.', 'litespeed-cache' ) ); ?></li>
|
||||
<li><span class="dashicons dashicons-saved litespeed-primary"></span> <?php echo wp_kses_post( __( '<strong>Viewport Images (VPI)</strong> provides a well-polished fully-loaded view above the fold.', 'litespeed-cache' ) ); ?></li>
|
||||
</ul>
|
||||
|
||||
<div>
|
||||
<a href="https://www.quic.cloud/quic-cloud-services-and-features/page-optimization/"><?php esc_html_e( 'Learn More', 'litespeed-cache' ); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h3 class="litespeed-title-section"><?php esc_html_e( 'Content Delivery Network', 'litespeed-cache' ); ?></h3>
|
||||
|
||||
<h4 class="litespeed-text-md litespeed-margin-bottom-remove"><?php esc_html_e( 'QUIC.cloud CDN:', 'litespeed-cache' ); ?></h4>
|
||||
<ul>
|
||||
<li><span class="dashicons dashicons-saved litespeed-primary"></span> <?php echo wp_kses_post( __( 'Caches your entire site, including dynamic content and <strong>ESI blocks</strong>.', 'litespeed-cache' ) ); ?></li>
|
||||
<li><span class="dashicons dashicons-saved litespeed-primary"></span> <?php echo wp_kses_post( __( 'Delivers global coverage with a growing <strong>network of 80+ PoPs</strong>.', 'litespeed-cache' ) ); ?></li>
|
||||
<li><span class="dashicons dashicons-saved litespeed-primary"></span> <?php echo wp_kses_post( __( 'Provides <strong>security at the CDN level</strong>, protecting your server from attack.', 'litespeed-cache' ) ); ?></li>
|
||||
<li><span class="dashicons dashicons-saved litespeed-primary"></span> <?php echo wp_kses_post( __( 'Offers optional <strong>built-in DNS service</strong> to simplify CDN onboarding.', 'litespeed-cache' ) ); ?></li>
|
||||
</ul>
|
||||
|
||||
<div>
|
||||
<a href="https://www.quic.cloud/quic-cloud-services-and-features/quic-cloud-cdn-service/"><?php esc_html_e( 'Learn More', 'litespeed-cache' ); ?></a>
|
||||
</div>
|
||||
|
||||
<hr class="litespeed-hr-with-space">
|
||||
|
||||
<p class="litespeed-desc"><?php esc_html_e( 'In order to use most QUIC.cloud services, you need quota. QUIC.cloud gives you free quota every month, but if you need more, you can purchase it.', 'litespeed-cache' ); ?> <a href="https://docs.quic.cloud/billing/services/" target="_blank"><?php esc_html_e( 'Learn More', 'litespeed-cache' ); ?></a></p>
|
||||
|
||||
<div class="litespeed-flex litespeed-flex-align-center">
|
||||
<a class="button button-secondary litespeed-right20" href="<?php echo esc_url( Utility::build_url( Router::ACTION_CLOUD, Cloud::TYPE_ACTIVATE, false, null, array( 'ref' => 'online' ) ) ); ?>">
|
||||
<span class="dashicons dashicons-yes"></span>
|
||||
<?php esc_html_e( 'Enable QUIC.cloud services', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php elseif ( ! empty( $cloud_summary['qc_activated'] ) && ( 'linked' === $cloud_summary['qc_activated'] || 'cdn' === $cloud_summary['qc_activated'] ) ) : ?>
|
||||
<h4 class="litespeed-text-md litespeed-top30"><span class="dashicons dashicons-saved litespeed-success"></span> <?php esc_html_e( 'QUIC.cloud Integration Enabled', 'litespeed-cache' ); ?></h4>
|
||||
<p><?php esc_html_e( 'Your site is connected and ready to use QUIC.cloud Online Services.', 'litespeed-cache' ); ?>
|
||||
<?php if ( empty( $cloud_summary['partner'] ) ) : ?>
|
||||
<a href="<?php echo esc_url( $cloud_instance->qc_link() ); ?>" class="litespeed-link-with-icon" target="_blank"><?php esc_html_e( 'Go to QUIC.cloud dashboard', 'litespeed-cache' ); ?> <span class="dashicons dashicons-external"></span></a>
|
||||
<?php endif; ?>
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
<li><span class="dashicons dashicons-yes litespeed-success"></span> <?php esc_html_e( 'Page Optimization', 'litespeed-cache' ); ?></li>
|
||||
<li><span class="dashicons dashicons-yes litespeed-success"></span> <?php esc_html_e( 'Image Optimization', 'litespeed-cache' ); ?></li>
|
||||
<?php if ( 'cdn' === $cloud_summary['qc_activated'] ) : ?>
|
||||
<li><span class="dashicons dashicons-yes litespeed-success"></span> <?php esc_html_e( 'CDN - Enabled', 'litespeed-cache' ); ?></li>
|
||||
<?php else : ?>
|
||||
<li><span class="dashicons dashicons-no-alt litespeed-default"></span> <span class="litespeed-default"><?php esc_html_e( 'CDN - Disabled', 'litespeed-cache' ); ?></span></li>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
|
||||
<?php else : ?>
|
||||
<h4 class="litespeed-text-md litespeed-top30"><span class="dashicons dashicons-saved litespeed-success"></span> <?php esc_html_e( 'QUIC.cloud Integration Enabled with limitations', 'litespeed-cache' ); ?></h4>
|
||||
<p><?php echo wp_kses_post( __( 'Your site is connected and using QUIC.cloud Online Services as an <strong>anonymous user</strong>. The CDN function and certain features of optimization services are not available for anonymous users. Link to QUIC.cloud to use the CDN and all available Online Services features.', 'litespeed-cache' ) ); ?></p>
|
||||
<div class="litespeed-desc"><?php esc_html_e( 'Free monthly quota available.', 'litespeed-cache' ); ?></div>
|
||||
|
||||
<ul>
|
||||
<li><span class="dashicons dashicons-yes litespeed-success"></span> <?php esc_html_e( 'Page Optimization', 'litespeed-cache' ); ?></li>
|
||||
<li><span class="dashicons dashicons-yes litespeed-success"></span> <?php esc_html_e( 'Image Optimization', 'litespeed-cache' ); ?></li>
|
||||
<li><span class="dashicons dashicons-no-alt litespeed-danger"></span> <?php esc_html_e( 'CDN - not available for anonymous users', 'litespeed-cache' ); ?></li>
|
||||
</ul>
|
||||
|
||||
<p><a class="button button-primary" href="<?php echo esc_url( Utility::build_url( Router::ACTION_CLOUD, Cloud::TYPE_ACTIVATE, false, null, array( 'ref' => 'online' ) ) ); ?>"><span class="dashicons dashicons-yes"></span><?php esc_html_e( 'Link to QUIC.cloud', 'litespeed-cache' ); ?></a></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( $cloud_instance->activated() ) : ?>
|
||||
<div class="litespeed-empty-space-medium"></div>
|
||||
<div class="litespeed-column-with-boxes-footer">
|
||||
<a href="<?php echo esc_url( Utility::build_url( Router::ACTION_CLOUD, Cloud::TYPE_RESET, false, null, array( 'ref' => 'online' ) ) ); ?>" class="litespeed-link-with-icon litespeed-danger" data-litespeed-cfm="<?php esc_html_e( 'Are you sure you want to disconnect from QUIC.cloud? This will not remove any data from the QUIC.cloud dashboard.', 'litespeed-cache' ); ?>"><span class="dashicons dashicons-dismiss"></span><?php esc_html_e( 'Disconnect from QUIC.cloud', 'litespeed-cache' ); ?></a>
|
||||
<div class="litespeed-desc litespeed-margin-bottom-remove"><?php esc_html_e( 'Remove QUIC.cloud integration from this site. Note: QUIC.cloud data will be preserved so you can re-enable services at any time. If you want to fully remove your site from QUIC.cloud, delete the domain through the QUIC.cloud Dashboard first.', 'litespeed-cache' ); ?></div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
@@ -0,0 +1,161 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache General Settings
|
||||
*
|
||||
* Manages general settings for LiteSpeed Cache, including Guest Mode optimization, server IP, and news settings.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
$cloud_instance = Cloud::cls();
|
||||
$cloud_summary = Cloud::get_summary();
|
||||
|
||||
$ajax_url_get_ip = function_exists('get_rest_url') ? get_rest_url(null, 'litespeed/v1/tool/check_ip') : '/';
|
||||
|
||||
$this->form_action();
|
||||
?>
|
||||
|
||||
<h3 class="litespeed-title-short">
|
||||
<?php esc_html_e( 'General Settings', 'litespeed-cache' ); ?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/general/' ); ?>
|
||||
</h3>
|
||||
|
||||
<table class="wp-list-table striped litespeed-table">
|
||||
<tbody>
|
||||
<?php if ( ! $this->_is_multisite ) : ?>
|
||||
<?php require LSCWP_DIR . 'tpl/general/settings_inc.auto_upgrade.tpl.php'; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( ! $this->_is_multisite ) : ?>
|
||||
<?php require LSCWP_DIR . 'tpl/general/settings_inc.guest.tpl.php'; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_GUEST_OPTM; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_switch( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<span class="litespeed-danger litespeed-text-bold">
|
||||
🚨
|
||||
<?php esc_html_e( 'This option enables maximum optimization for Guest Mode visitors.', 'litespeed-cache' ); ?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/general/#guest-optimization', esc_html__( 'Please read all warnings before enabling this option.', 'litespeed-cache' ), false, 'litespeed-danger' ); ?>
|
||||
</span>
|
||||
|
||||
<?php
|
||||
$type_list = array();
|
||||
if ( $this->conf( Base::O_GUEST ) && ! $this->conf( Base::O_OPTM_UCSS ) ) {
|
||||
$type_list[] = 'UCSS';
|
||||
}
|
||||
if ( $this->conf( Base::O_GUEST ) && ! $this->conf( Base::O_OPTM_CSS_ASYNC ) ) {
|
||||
$type_list[] = 'CCSS';
|
||||
}
|
||||
if ( ! empty( $type_list ) ) {
|
||||
$the_type = implode( '/', $type_list );
|
||||
echo '<br />';
|
||||
echo '<font class="litespeed-info">';
|
||||
echo '⚠️ ' . sprintf( esc_html__( 'Your %1$s quota on %2$s will still be in use.', 'litespeed-cache' ), esc_html( $the_type ), 'QUIC.cloud' );
|
||||
echo '</font>';
|
||||
}
|
||||
?>
|
||||
|
||||
<?php if ( ! $this->conf( Base::O_GUEST ) ) : ?>
|
||||
<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_GUEST ) ) . '</code>' ); ?>
|
||||
</font>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( ! $this->conf( Base::O_CACHE_MOBILE ) ) : ?>
|
||||
<br />
|
||||
<font class="litespeed-primary litespeed-left10">
|
||||
⚠️ <?php esc_html_e( 'Notice', 'litespeed-cache' ); ?>: <?php printf( esc_html__( 'You need to turn %s on to get maximum result.', 'litespeed-cache' ), '<code>' . esc_html( Lang::title( Base::O_CACHE_MOBILE ) ) . '</code>' ); ?>
|
||||
</font>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( ! $this->conf( Base::O_IMG_OPTM_WEBP ) ) : ?>
|
||||
<br />
|
||||
<font class="litespeed-primary litespeed-left10">
|
||||
⚠️ <?php esc_html_e( 'Notice', 'litespeed-cache' ); ?>: <?php printf( esc_html__( 'You need to turn %s on and finish all WebP generation to get maximum result.', 'litespeed-cache' ), '<code>' . esc_html( Lang::title( Base::O_IMG_OPTM_WEBP ) ) . '</code>' ); ?>
|
||||
</font>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_SERVER_IP; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_input( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( "Enter this site's IP address to allow cloud services directly call IP instead of domain name. This eliminates the overhead of DNS and CDN lookups.", 'litespeed-cache' ); ?>
|
||||
<br /><?php esc_html_e( 'Your server IP', 'litespeed-cache' ); ?>: <code id='litespeed_server_ip'>-</code> <a href="javascript:;" class="button button-link" id="litespeed_get_ip"><?php esc_html_e( 'Check my public IP from', 'litespeed-cache' ); ?> CyberPanel.sh</a>
|
||||
⚠️ <?php esc_html_e( 'Notice', 'litespeed-cache' ); ?>: <?php esc_html_e( 'the auto-detected IP may not be accurate if you have an additional outgoing IP set, or you have multiple IPs configured on your server.', 'litespeed-cache' ); ?>
|
||||
<br /><?php esc_html_e( 'Please make sure this IP is the correct one for visiting your site.', 'litespeed-cache' ); ?>
|
||||
|
||||
<?php $this->_validate_ip( $option_id ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_NEWS; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_switch( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Turn this option ON to show latest news automatically, including hotfixes, new releases, available beta versions, and promotions.', 'litespeed-cache' ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php $this->form_end(); ?>
|
||||
|
||||
<script>
|
||||
(function ($) {
|
||||
jQuery(document).ready(function () {
|
||||
/**
|
||||
* Get server IP
|
||||
* @since 3.0
|
||||
*/
|
||||
$('#litespeed_get_ip').on('click', function (e) {
|
||||
console.log('[litespeed] get server IP');
|
||||
$.ajax({
|
||||
url: '<?php echo $ajax_url_get_ip; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>',
|
||||
dataType: 'json',
|
||||
beforeSend: function (xhr) {
|
||||
xhr.setRequestHeader('X-WP-Nonce', '<?php echo esc_js(wp_create_nonce('wp_rest')); ?>');
|
||||
$('#litespeed_server_ip').html('Detecting...');
|
||||
},
|
||||
success: function (data) {
|
||||
$('#litespeed_server_ip').html('Done');
|
||||
console.log('[litespeed] get server IP response: ' + data);
|
||||
$('#litespeed_server_ip').html(data);
|
||||
},
|
||||
error: function (xhr, error) {
|
||||
console.log('[litespeed] get server IP error', error);
|
||||
$('#litespeed_server_ip').html('Failed to detect IP');
|
||||
},
|
||||
complete: function (xhr, status) {
|
||||
console.log('[litespeed] AJAX complete', status, xhr);
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
})(jQuery);
|
||||
</script>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Auto Upgrade Setting
|
||||
*
|
||||
* Manages the auto-upgrade setting for LiteSpeed Cache.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
?>
|
||||
|
||||
<!-- build_setting_auto_upgrade -->
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_AUTO_UPGRADE; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_switch( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Turn this option ON to have LiteSpeed Cache updated automatically, whenever a new version is released. If OFF, update manually as usual.', 'litespeed-cache' ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Guest Mode Setting
|
||||
*
|
||||
* Manages the Guest Mode setting for LiteSpeed Cache.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
$guest_update_url = wp_parse_url( LSWCP_PLUGIN_URL . GUI::PHP_GUEST, PHP_URL_PATH );
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_GUEST; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_switch( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( "Guest Mode provides an always cacheable landing page for an automated guest's first time visit, and then attempts to update cache varies via AJAX.", 'litespeed-cache' ); ?>
|
||||
<?php esc_html_e( 'This option can help to correct the cache vary for certain advanced mobile or tablet visitors.', 'litespeed-cache' ); ?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/general/#guest-mode' ); ?>
|
||||
<br /><?php Doc::notice_htaccess(); ?>
|
||||
<br /><?php Doc::crawler_affected(); ?>
|
||||
</div>
|
||||
<?php if ( $this->conf( $option_id ) ) : ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Guest Mode testing result', 'litespeed-cache' ); ?>:
|
||||
<font id='litespeed_gm_status'><?php esc_html_e( 'Testing', 'litespeed-cache' ); ?>...</font>
|
||||
</div>
|
||||
<script>
|
||||
(function ($) {
|
||||
jQuery(document).ready(function () {
|
||||
$.post( '<?php echo $guest_update_url; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>', function(data){
|
||||
if ( data === '[]' || data === '{"reload":"yes"}' ) {
|
||||
$('#litespeed_gm_status').html('<font class="litespeed-success"><?php esc_html_e( 'Guest Mode passed testing.', 'litespeed-cache' ); ?></font>');
|
||||
}
|
||||
else {
|
||||
$('#litespeed_gm_status').html('<font class="litespeed-danger"><?php esc_html_e( 'Guest Mode failed to test.', 'litespeed-cache' ); ?></font>');
|
||||
}
|
||||
}).fail( function(){
|
||||
$('#litespeed_gm_status').html('<font class="litespeed-danger"><?php esc_html_e( 'Guest Mode failed to test.', 'litespeed-cache' ); ?></font>');
|
||||
});
|
||||
});
|
||||
})(jQuery);
|
||||
</script>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Tuning Settings
|
||||
*
|
||||
* Manages tuning settings for LiteSpeed Cache, including Guest Mode configurations.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
$this->form_action();
|
||||
?>
|
||||
|
||||
<h3 class="litespeed-title-short">
|
||||
<?php esc_html_e( 'Tuning Settings', 'litespeed-cache' ); ?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/general/#tuning-tab' ); ?>
|
||||
</h3>
|
||||
|
||||
<table class="wp-list-table striped litespeed-table"><tbody>
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_GUEST_UAS; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<div class="litespeed-textarea-recommended">
|
||||
<div>
|
||||
<?php $this->build_textarea( $option_id, 30 ); ?>
|
||||
</div>
|
||||
<div>
|
||||
<?php $this->recommended( $option_id ); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Listed User Agents will be considered as Guest Mode visitors.', 'litespeed-cache' ); ?>
|
||||
<?php Doc::one_per_line(); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_GUEST_IPS; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<div class="litespeed-textarea-recommended">
|
||||
<div>
|
||||
<?php $this->build_textarea( $option_id, 50 ); ?>
|
||||
</div>
|
||||
<div>
|
||||
<?php $this->recommended( $option_id ); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Listed IPs will be considered as Guest Mode visitors.', 'litespeed-cache' ); ?>
|
||||
<?php Doc::one_per_line(); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody></table>
|
||||
|
||||
<?php $this->form_end(); ?>
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Image Optimization
|
||||
*
|
||||
* Manages the image optimization interface for LiteSpeed Cache.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
$menu_list = array(
|
||||
'summary' => esc_html__( 'Image Optimization Summary', 'litespeed-cache' ),
|
||||
'settings' => esc_html__( 'Image Optimization Settings', 'litespeed-cache' ),
|
||||
);
|
||||
|
||||
if ( is_network_admin() ) {
|
||||
$menu_list = array(
|
||||
'network_settings' => esc_html__( 'Image Optimization Settings', 'litespeed-cache' ),
|
||||
);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<div class="wrap">
|
||||
<h1 class="litespeed-h1">
|
||||
<?php esc_html_e( 'LiteSpeed Cache Image 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">
|
||||
<h2 class="litespeed-header nav-tab-wrapper">
|
||||
<?php GUI::display_tab_list( $menu_list ); ?>
|
||||
</h2>
|
||||
|
||||
<div class="litespeed-body">
|
||||
<?php
|
||||
foreach ( $menu_list as $menu_key => $val ) {
|
||||
echo '<div data-litespeed-layout="' . esc_attr( $menu_key ) . '">';
|
||||
require LSCWP_DIR . 'tpl/img_optm/' . $menu_key . '.tpl.php';
|
||||
echo '</div>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Image Optimization Network Settings
|
||||
*
|
||||
* Manages network-wide image optimization settings for LiteSpeed Cache.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
$this->form_action( Router::ACTION_SAVE_SETTINGS_NETWORK );
|
||||
?>
|
||||
|
||||
<h3 class="litespeed-title-short">
|
||||
<?php esc_html_e( 'Image Optimization Settings', 'litespeed-cache' ); ?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/imageopt/#image-optimization-settings-tab' ); ?>
|
||||
</h3>
|
||||
|
||||
<table class="wp-list-table striped litespeed-table"><tbody>
|
||||
<?php require LSCWP_DIR . 'tpl/img_optm/settings.media_webp.tpl.php'; ?>
|
||||
|
||||
</tbody></table>
|
||||
|
||||
<?php
|
||||
$this->form_end();
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Image Optimization WebP/AVIF Setting
|
||||
*
|
||||
* Manages the WebP and AVIF optimization settings for LiteSpeed Cache.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_IMG_OPTM_WEBP; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_switch( $option_id, array( esc_html__( 'OFF', 'litespeed-cache' ), 'WebP', 'AVIF' ) ); ?>
|
||||
<?php Doc::maybe_on_by_gm( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Request WebP/AVIF versions of original images when doing optimization.', 'litespeed-cache' ); ?>
|
||||
<?php printf( esc_html__( 'Significantly improve load time by replacing images with their optimized %s versions.', 'litespeed-cache' ), '.webp/.avif' ); ?>
|
||||
<br /><?php Doc::notice_htaccess(); ?>
|
||||
<br /><?php Doc::crawler_affected(); ?>
|
||||
<br />
|
||||
<font class="litespeed-warning">
|
||||
⚠️ <?php printf( esc_html__( '%1$s is a %2$s paid feature.', 'litespeed-cache' ), 'AVIF', 'QUIC.cloud' ); ?></font>
|
||||
<br />
|
||||
<font class="litespeed-warning">
|
||||
⚠️ <?php printf( esc_html__( 'When switching formats, please %1$s or %2$s to apply this new choice to previously optimized images.', 'litespeed-cache' ), esc_html__( 'Destroy All Optimization Data', 'litespeed-cache' ), esc_html__( 'Soft Reset Optimization Counter', 'litespeed-cache' ) ); ?></font>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/imageopt/#soft-reset-optimization-counter' ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -0,0 +1,175 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Image Optimization Settings
|
||||
*
|
||||
* Manages image optimization settings for LiteSpeed Cache.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
$this->form_action();
|
||||
?>
|
||||
|
||||
<h3 class="litespeed-title-short">
|
||||
<?php esc_html_e( 'Image Optimization Settings', 'litespeed-cache' ); ?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/imageopt/#image-optimization-settings-tab' ); ?>
|
||||
</h3>
|
||||
|
||||
<table class="wp-list-table striped litespeed-table">
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_IMG_OPTM_AUTO; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_switch( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Automatically request optimization via cron job.', 'litespeed-cache' ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_IMG_OPTM_ORI; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_switch( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Optimize images and save backups of the originals in the same folder.', 'litespeed-cache' ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_IMG_OPTM_RM_BKUP; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_switch( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Automatically remove the original image backups after fetching optimized images.', 'litespeed-cache' ); ?>
|
||||
|
||||
<br />
|
||||
<font class="litespeed-danger">
|
||||
🚨
|
||||
<?php esc_html_e( 'This is irreversible.', 'litespeed-cache' ); ?>
|
||||
<?php esc_html_e( 'You will be unable to Revert Optimization once the backups are deleted!', 'litespeed-cache' ); ?>
|
||||
</font>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_IMG_OPTM_LOSSLESS; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_switch( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Optimize images using lossless compression.', 'litespeed-cache' ); ?>
|
||||
<?php esc_html_e( 'This can improve quality but may result in larger images than lossy compression will.', 'litespeed-cache' ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php
|
||||
$option_id = Base::O_IMG_OPTM_SIZES_SKIPPED;
|
||||
$image_sizes = Utility::prepare_image_sizes_array(true);
|
||||
$option_value = $this->conf( $option_id );
|
||||
?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php if ( count($image_sizes) > 0 ) : ?>
|
||||
<?php
|
||||
foreach ( $image_sizes as $current_size ) {
|
||||
$checked = false === array_search( $current_size['file_size'], $option_value, true );
|
||||
$this->build_checkbox( $option_id . '[]', esc_html( $current_size['label'] ), $checked, $current_size['file_size'] );
|
||||
}
|
||||
?>
|
||||
<?php else : ?>
|
||||
<p><?php esc_html_e( 'No sizes found.', 'litespeed-cache' ); ?></p>
|
||||
<?php endif; ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Choose which image sizes to optimize.', 'litespeed-cache' ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_IMG_OPTM_EXIF; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_switch( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Preserve EXIF data (copyright, GPS, comments, keywords, etc) when optimizing.', 'litespeed-cache' ); ?>
|
||||
<?php esc_html_e( 'This will increase the size of optimized files.', 'litespeed-cache' ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
if ( ! is_multisite() ) :
|
||||
// webp
|
||||
require LSCWP_DIR . 'tpl/img_optm/settings.media_webp.tpl.php';
|
||||
endif;
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_IMG_OPTM_WEBP_ATTR; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<div class="litespeed-textarea-recommended">
|
||||
<div>
|
||||
<?php $this->build_textarea( $option_id, 40 ); ?>
|
||||
</div>
|
||||
<div>
|
||||
<?php $this->recommended( $option_id ); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Specify which element attributes will be replaced with WebP/AVIF.', 'litespeed-cache' ); ?>
|
||||
<?php esc_html_e( 'Only attributes listed here will be replaced.', 'litespeed-cache' ); ?>
|
||||
<br /><?php printf( esc_html__( 'Use the format %1$s or %2$s (element is optional).', 'litespeed-cache' ), '<code>element.attribute</code>', '<code>.attribute</code>' ); ?>
|
||||
<?php Doc::one_per_line(); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_IMG_OPTM_WEBP_REPLACE_SRCSET; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_switch( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php printf( esc_html__( 'Enable replacement of WebP/AVIF in %s elements that were generated outside of WordPress logic.', 'litespeed-cache' ), '<code>srcset</code>' ); ?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/imageopt/#webpavif-for-extra-srcset' ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php
|
||||
$this->form_end();
|
||||
@@ -0,0 +1,387 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Image Optimization Summary
|
||||
*
|
||||
* Manages the image optimization summary interface for LiteSpeed Cache.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
$closest_server = Cloud::get_summary( 'server.' . Cloud::SVC_IMG_OPTM );
|
||||
$usage_cloud = Cloud::get_summary( 'usage.' . Cloud::SVC_IMG_OPTM );
|
||||
$allowance = Cloud::cls()->allowance( Cloud::SVC_IMG_OPTM );
|
||||
|
||||
$img_optm = Img_Optm::cls();
|
||||
|
||||
$wet_limit = $img_optm->wet_limit();
|
||||
$img_count = $img_optm->img_count();
|
||||
|
||||
$optm_summary = Img_Optm::get_summary();
|
||||
|
||||
list($last_run, $is_running) = $img_optm->cron_running( false );
|
||||
$finished_percentage = 0;
|
||||
if ( $img_count['groups_all'] ) {
|
||||
$finished_percentage = 100 - floor( $img_count['groups_new'] * 100 / $img_count['groups_all'] );
|
||||
}
|
||||
if ( 100 === $finished_percentage && $img_count['groups_new'] ) {
|
||||
$finished_percentage = 99;
|
||||
}
|
||||
|
||||
$unfinished_num = 0;
|
||||
if ( ! empty( $img_count[ 'img.' . Img_Optm::STATUS_REQUESTED ] ) ) {
|
||||
$unfinished_num += $img_count[ 'img.' . Img_Optm::STATUS_REQUESTED ];
|
||||
}
|
||||
if ( ! empty( $img_count[ 'img.' . Img_Optm::STATUS_NOTIFIED ] ) ) {
|
||||
$unfinished_num += $img_count[ 'img.' . Img_Optm::STATUS_NOTIFIED ];
|
||||
}
|
||||
if ( ! empty( $img_count[ 'img.' . Img_Optm::STATUS_ERR_FETCH ] ) ) {
|
||||
$unfinished_num += $img_count[ 'img.' . Img_Optm::STATUS_ERR_FETCH ];
|
||||
}
|
||||
|
||||
$imgoptm_service_hot = $this->cls( 'Cloud' )->service_hot( Cloud::SVC_IMG_OPTM . '-' . Img_Optm::CLOUD_ACTION_NEW_REQ );
|
||||
?>
|
||||
<div class="litespeed-flex-container litespeed-column-with-boxes">
|
||||
<div class="litespeed-width-7-10 litespeed-column-left litespeed-image-optim-summary-wrapper">
|
||||
<div class="litespeed-image-optim-summary">
|
||||
|
||||
<h3>
|
||||
<?php if ( $closest_server ) : ?>
|
||||
<a href="<?php echo esc_url( Utility::build_url( Router::ACTION_CLOUD, Cloud::TYPE_REDETECT_CLOUD, false, null, array( 'svc' => Cloud::SVC_IMG_OPTM ) ) ); ?>" class="litespeed-info-button litespeed-redetect" data-balloon-pos="right" 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' ); ?>"><span class="litespeed-quic-icon"></span> <?php esc_html_e( 'Redetect', 'litespeed-cache' ); ?></a>
|
||||
<?php else : ?>
|
||||
<span class="litespeed-quic-icon"></span> <?php esc_html_e( 'Redetect', 'litespeed-cache' ); ?>
|
||||
<?php endif; ?>
|
||||
<?php esc_html_e( 'Optimize images with our QUIC.cloud server', 'litespeed-cache' ); ?>
|
||||
<a href="https://docs.litespeedtech.com/lscache/lscwp/imageopt/#image-optimization-summary-tab" target="_blank" class="litespeed-right litespeed-learn-more"><?php esc_html_e( 'Learn More', 'litespeed-cache' ); ?></a>
|
||||
</h3>
|
||||
|
||||
<p>
|
||||
<?php printf( esc_html__( 'You can request a maximum of %s images at once.', 'litespeed-cache' ), '<strong>' . intval( $allowance ) . '</strong>' ); ?>
|
||||
</p>
|
||||
|
||||
<?php if ( $wet_limit ) : ?>
|
||||
<p class="litespeed-desc">
|
||||
<?php esc_html_e( 'To make sure our server can communicate with your server without any issues and everything works fine, for the few first requests the number of image groups allowed in a single request is limited.', 'litespeed-cache' ); ?>
|
||||
<?php echo esc_html__( 'Current limit is', 'litespeed-cache' ) . ': <strong>' . esc_html( $wet_limit ) . '</strong>'; ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="litespeed-img-optim-actions">
|
||||
<?php if ( $imgoptm_service_hot ) : ?>
|
||||
<button class="button button-secondary" disabled>
|
||||
<span class="dashicons dashicons-images-alt2"></span> <?php esc_html_e( 'Send Optimization Request', 'litespeed-cache' ); ?>
|
||||
- <?php printf( esc_html__( 'Available after %d second(s)', 'litespeed-cache' ), esc_html( $imgoptm_service_hot ) ); ?>
|
||||
</button>
|
||||
<?php else : ?>
|
||||
<a data-litespeed-onlyonce class="button button-primary"
|
||||
<?php
|
||||
if ( ! empty( $img_count['groups_new'] ) || ! empty( $img_count[ 'group.' . Img_Optm::STATUS_RAW ] ) ) :
|
||||
?>
|
||||
href="<?php echo esc_url( Utility::build_url( Router::ACTION_IMG_OPTM, Img_Optm::TYPE_NEW_REQ ) ); ?>"
|
||||
<?php
|
||||
else :
|
||||
?>
|
||||
href="javascript:;" disabled <?php endif; ?>>
|
||||
<span class="dashicons dashicons-images-alt2"></span> <?php esc_html_e( 'Send Optimization Request', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<a data-litespeed-onlyonce class="button button-secondary" data-balloon-length="large" data-balloon-pos="right" aria-label="<?php esc_html_e( 'Only press the button if the pull cron job is disabled.', 'litespeed-cache' ); ?> <?php esc_html_e( 'Images will be pulled automatically if the cron job is running.', 'litespeed-cache' ); ?>"
|
||||
<?php
|
||||
if ( ! empty( $img_count[ 'img.' . Img_Optm::STATUS_NOTIFIED ] ) && ! $is_running ) :
|
||||
?>
|
||||
href="<?php echo esc_url( Utility::build_url( Router::ACTION_IMG_OPTM, Img_Optm::TYPE_PULL ) ); ?>"
|
||||
<?php
|
||||
else :
|
||||
?>
|
||||
href="javascript:;" disabled <?php endif; ?>>
|
||||
<?php esc_html_e( 'Pull Images', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h3 class="litespeed-title-section">
|
||||
<?php esc_html_e( 'Optimization Status', 'litespeed-cache' ); ?>
|
||||
</h3>
|
||||
|
||||
<div class="litespeed-light-code">
|
||||
|
||||
<?php if ( ! empty( $img_count[ 'group.' . Img_Optm::STATUS_NEW ] ) ) : ?>
|
||||
<p class="litespeed-success">
|
||||
<?php echo esc_html( Lang::img_status( Img_Optm::STATUS_NEW ) ); ?>:
|
||||
<code>
|
||||
<?php echo esc_html( Admin_Display::print_plural( $img_count['group_new'] ) ); ?>
|
||||
</code>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( ! empty( $img_count[ 'group.' . Img_Optm::STATUS_RAW ] ) ) : ?>
|
||||
<p class="litespeed-success">
|
||||
<?php echo esc_html( Lang::img_status( Img_Optm::STATUS_RAW ) ); ?>:
|
||||
<code>
|
||||
<?php echo esc_html( Admin_Display::print_plural( $img_count[ 'group.' . Img_Optm::STATUS_RAW ] ) ); ?>
|
||||
(<?php echo esc_html( Admin_Display::print_plural( $img_count[ 'img.' . Img_Optm::STATUS_RAW ], 'image' ) ); ?>)
|
||||
</code>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( ! empty( $img_count[ 'group.' . Img_Optm::STATUS_REQUESTED ] ) ) : ?>
|
||||
<p class="litespeed-success">
|
||||
<?php echo esc_html( Lang::img_status( Img_Optm::STATUS_REQUESTED ) ); ?>:
|
||||
<code>
|
||||
<?php echo esc_html( Admin_Display::print_plural( $img_count[ 'group.' . Img_Optm::STATUS_REQUESTED ] ) ); ?>
|
||||
(<?php echo esc_html( Admin_Display::print_plural( $img_count[ 'img.' . Img_Optm::STATUS_REQUESTED ], 'image' ) ); ?>)
|
||||
</code>
|
||||
</p>
|
||||
<p class="litespeed-desc">
|
||||
<?php esc_html_e( 'After the QUIC.cloud Image Optimization server finishes optimization, it will notify your site to pull the optimized images.', 'litespeed-cache' ); ?>
|
||||
<?php esc_html_e( 'This process is automatic.', 'litespeed-cache' ); ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( ! empty( $img_count[ 'group.' . Img_Optm::STATUS_NOTIFIED ] ) ) : ?>
|
||||
<p class="litespeed-success">
|
||||
<?php echo esc_html( Lang::img_status( Img_Optm::STATUS_NOTIFIED ) ); ?>:
|
||||
<code>
|
||||
<?php echo esc_html( Admin_Display::print_plural( $img_count[ 'group.' . Img_Optm::STATUS_NOTIFIED ] ) ); ?>
|
||||
(<?php echo esc_html( Admin_Display::print_plural( $img_count[ 'img.' . Img_Optm::STATUS_NOTIFIED ], 'image' ) ); ?>)
|
||||
</code>
|
||||
</p>
|
||||
<?php if ( $last_run ) : ?>
|
||||
<p class="litespeed-desc">
|
||||
<?php printf( esc_html__( 'Last pull initiated by cron at %s.', 'litespeed-cache' ), '<code>' . esc_html( Utility::readable_time( $last_run ) ) . '</code>' ); ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( ! empty( $img_count[ 'group.' . Img_Optm::STATUS_PULLED ] ) ) : ?>
|
||||
<p class="litespeed-success">
|
||||
<?php echo esc_html( Lang::img_status( Img_Optm::STATUS_PULLED ) ); ?>:
|
||||
<code>
|
||||
<?php echo esc_html( Admin_Display::print_plural( $img_count[ 'group.' . Img_Optm::STATUS_PULLED ] ) ); ?>
|
||||
(<?php echo esc_html( Admin_Display::print_plural( $img_count[ 'img.' . Img_Optm::STATUS_PULLED ], 'image' ) ); ?>)
|
||||
</code>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
'<a href="%1$s" class="button button-secondary litespeed-btn-warning" data-balloon-pos="right" aria-label="%2$s" %3$s><span class="dashicons dashicons-editor-removeformatting"></span> %4$s</a>',
|
||||
( $unfinished_num ? esc_url( Utility::build_url( Router::ACTION_IMG_OPTM, Img_Optm::TYPE_CLEAN ) ) : 'javascript:;' ),
|
||||
esc_html__( 'Remove all previous unfinished image optimization requests.', 'litespeed-cache' ),
|
||||
( $unfinished_num ? '' : ' disabled' ),
|
||||
esc_html__( 'Clean Up Unfinished Data', 'litespeed-cache' ) . ( $unfinished_num ? ': ' . esc_html( Admin_Display::print_plural( $unfinished_num, 'image' ) ) : '' )
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
|
||||
<h3 class="litespeed-title-section">
|
||||
<?php esc_html_e( 'Storage Optimization', 'litespeed-cache' ); ?>
|
||||
</h3>
|
||||
|
||||
<p>
|
||||
<?php esc_html_e( 'A backup of each image is saved before it is optimized.', 'litespeed-cache' ); ?>
|
||||
</p>
|
||||
|
||||
<?php if ( ! empty( $optm_summary['bk_summary'] ) ) : ?>
|
||||
<div>
|
||||
<p>
|
||||
<?php echo esc_html__( 'Last calculated', 'litespeed-cache' ) . ': <code>' . esc_html( Utility::readable_time( $optm_summary['bk_summary']['date'] ) ) . '</code>'; ?>
|
||||
</p>
|
||||
<?php if ( $optm_summary['bk_summary']['count'] ) : ?>
|
||||
<p>
|
||||
<?php echo esc_html__( 'Files', 'litespeed-cache' ) . ': <code>' . intval( $optm_summary['bk_summary']['count'] ) . '</code>'; ?>
|
||||
</p>
|
||||
<p>
|
||||
<?php echo esc_html__( 'Total', 'litespeed-cache' ) . ': <code>' . esc_html( Utility::real_size( $optm_summary['bk_summary']['sum'] ) ) . '</code>'; ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div>
|
||||
<a class="button button-secondary" data-balloon-pos="up" aria-label="<?php esc_html_e( 'Calculate Original Image Storage', 'litespeed-cache' ); ?>"
|
||||
<?php
|
||||
if ( $finished_percentage > 0 ) :
|
||||
?>
|
||||
href="<?php echo esc_url( Utility::build_url( Router::ACTION_IMG_OPTM, Img_Optm::TYPE_CALC_BKUP ) ); ?>"
|
||||
<?php
|
||||
else :
|
||||
?>
|
||||
href="javascript:;" disabled <?php endif; ?>>
|
||||
<span class="dashicons dashicons-update"></span> <?php esc_html_e( 'Calculate Backups Disk Space', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h4><?php esc_html_e( 'Image Thumbnail Group Sizes', 'litespeed-cache' ); ?></h4>
|
||||
<div class="litespeed-desc litespeed-left20">
|
||||
<?php
|
||||
foreach ( Media::cls()->get_image_sizes() as $size_title => $size ) {
|
||||
printf(
|
||||
'<div>%1$s ( %2$s x %3$s )</div>',
|
||||
esc_html( $size_title ),
|
||||
$size['width'] ? esc_html( $size['width'] ) . 'px' : '*',
|
||||
$size['height'] ? esc_html( $size['height'] ) . 'px' : '*'
|
||||
);
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr class="litespeed-hr-with-space">
|
||||
<div>
|
||||
<h4><?php esc_html_e( 'Delete all backups of the original images', 'litespeed-cache' ); ?></h4>
|
||||
<div class="notice notice-error litespeed-callout-bg inline">
|
||||
<p>
|
||||
🚨 <?php esc_html_e( 'This is irreversible.', 'litespeed-cache' ); ?>
|
||||
<?php esc_html_e( 'You will be unable to Revert Optimization once the backups are deleted!', 'litespeed-cache' ); ?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ( ! empty( $optm_summary['rmbk_summary'] ) ) : ?>
|
||||
<div>
|
||||
<p>
|
||||
<?php echo esc_html__( 'Last ran', 'litespeed-cache' ) . ': <code>' . esc_html( Utility::readable_time( $optm_summary['rmbk_summary']['date'] ) ) . '</code>'; ?>
|
||||
</p>
|
||||
<p>
|
||||
<?php echo esc_html__( 'Files', 'litespeed-cache' ) . ': <code>' . esc_html( $optm_summary['rmbk_summary']['count'] ) . '</code>'; ?>
|
||||
</p>
|
||||
<p>
|
||||
<?php echo esc_html__( 'Saved', 'litespeed-cache' ) . ': <code>' . esc_html( Utility::real_size( $optm_summary['rmbk_summary']['sum'] ) ) . '</code>'; ?>
|
||||
</p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="litespeed-image-optim-summary-footer">
|
||||
<a href="<?php echo esc_url( Utility::build_url( Router::ACTION_IMG_OPTM, Img_Optm::TYPE_RM_BKUP ) ); ?>" data-litespeed-cfm="<?php esc_html_e( 'Are you sure you want to remove all image backups?', 'litespeed-cache' ); ?>" class="litespeed-link-with-icon litespeed-danger">
|
||||
<span class="dashicons dashicons-trash"></span><?php esc_html_e( 'Remove Original Image Backups', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="litespeed-width-3-10 litespeed-column-right">
|
||||
<div class="postbox litespeed-postbox litespeed-postbox-imgopt-info">
|
||||
<div class="inside">
|
||||
<h3 class="litespeed-title">
|
||||
<?php esc_html_e( 'Image Information', 'litespeed-cache' ); ?>
|
||||
</h3>
|
||||
|
||||
<div class="litespeed-flex-container">
|
||||
<div class="litespeed-icon-vertical-middle">
|
||||
<?php echo wp_kses( GUI::pie( $finished_percentage, 70, true ), GUI::allowed_svg_tags() ); ?>
|
||||
</div>
|
||||
<div>
|
||||
<p>
|
||||
<?php esc_html_e( 'Image groups total', 'litespeed-cache' ); ?>:
|
||||
<?php if ( $img_count['groups_new'] ) : ?>
|
||||
<code><?php echo esc_html( Admin_Display::print_plural( $img_count['groups_new'], 'group' ) ); ?></code>
|
||||
<?php else : ?>
|
||||
<font class="litespeed-congratulate"><?php esc_html_e( 'Congratulations, all gathered!', 'litespeed-cache' ); ?></font>
|
||||
<?php endif; ?>
|
||||
<a href="https://docs.litespeedtech.com/lscache/lscwp/imageopt/#what-is-an-image-group" target="_blank" class="litespeed-desc litespeed-help-btn-icon" data-balloon-pos="up" aria-label="<?php esc_html_e( 'What is a group?', 'litespeed-cache' ); ?>">
|
||||
<span class="dashicons dashicons-editor-help"></span>
|
||||
<span class="screen-reader-text"><?php esc_html_e( 'What is an image group?', 'litespeed-cache' ); ?></span>
|
||||
</a>
|
||||
</p>
|
||||
<p>
|
||||
<?php esc_html_e( 'Current image post id position', 'litespeed-cache' ); ?>: <?php echo ! empty( $optm_summary['next_post_id'] ) ? esc_html( $optm_summary['next_post_id'] ) : '-'; ?><br>
|
||||
<?php esc_html_e( 'Maximum image post id', 'litespeed-cache' ); ?>: <?php echo esc_html( $img_count['max_id'] ); ?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="inside litespeed-postbox-footer litespeed-postbox-footer--compact" style="display: none;">
|
||||
<a href="<?php echo esc_url( Utility::build_url( Router::ACTION_IMG_OPTM, Img_Optm::TYPE_RESCAN ) ); ?>" class="" data-balloon-pos="up" data-balloon-length="large" aria-label="<?php esc_html_e( 'Scan for any new unoptimized image thumbnail sizes and resend necessary image optimization requests.', 'litespeed-cache' ); ?>">
|
||||
<?php esc_html_e( 'Rescan New Thumbnails', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="postbox litespeed-postbox">
|
||||
<div class="inside">
|
||||
<h3 class="litespeed-title">
|
||||
<?php esc_html_e( 'Optimization Summary', 'litespeed-cache' ); ?>
|
||||
</h3>
|
||||
<p>
|
||||
<?php esc_html_e( 'Total Reduction', 'litespeed-cache' ); ?>: <code><?php echo isset( $optm_summary['reduced'] ) ? esc_html( Utility::real_size( $optm_summary['reduced'] ) ) : '-'; ?></code>
|
||||
</p>
|
||||
<p>
|
||||
<?php esc_html_e( 'Images Pulled', 'litespeed-cache' ); ?>: <code><?php echo isset( $optm_summary['img_taken'] ) ? esc_html( $optm_summary['img_taken'] ) : '-'; ?></code>
|
||||
</p>
|
||||
<p>
|
||||
<?php esc_html_e( 'Last Request', 'litespeed-cache' ); ?>: <code><?php echo isset( $optm_summary['last_requested'] ) ? esc_html( Utility::readable_time( $optm_summary['last_requested'] ) ) : '-'; ?></code>
|
||||
</p>
|
||||
<p>
|
||||
<?php esc_html_e( 'Last Pulled', 'litespeed-cache' ); ?>: <code><?php echo isset( $optm_summary['last_pulled'] ) ? esc_html( Utility::readable_time( $optm_summary['last_pulled'] ) ) : '-'; ?></code>
|
||||
<?php
|
||||
if ( isset( $optm_summary['last_pulled_by_cron'] ) && $optm_summary['last_pulled_by_cron'] ) {
|
||||
echo '(Cron)';
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
<div class="inside litespeed-postbox-footer litespeed-postbox-footer--compact litespeed-desc">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: Link tags */
|
||||
esc_html__( 'Results can be checked in %sMedia Library%s.', 'litespeed-cache' ),
|
||||
'<a href="upload.php?mode=list">',
|
||||
'</a>'
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="postbox litespeed-postbox">
|
||||
<div class="inside">
|
||||
<h3 class="litespeed-title"><?php esc_html_e( 'Optimization Tools', 'litespeed-cache' ); ?></h3>
|
||||
|
||||
<p>
|
||||
<?php esc_html_e( 'You can quickly switch between using original (unoptimized versions) and optimized image files. It will affect all images on your website, both regular and webp versions if available.', 'litespeed-cache' ); ?>
|
||||
</p>
|
||||
|
||||
<div class="litespeed-links-group">
|
||||
<span>
|
||||
<a href="<?php echo esc_url( Utility::build_url( Router::ACTION_IMG_OPTM, Img_Optm::TYPE_BATCH_SWITCH_ORI ) ); ?>" class="litespeed-link-with-icon" data-balloon-pos="up" aria-label="<?php esc_html_e( 'Use original images (unoptimized) on your site', 'litespeed-cache' ); ?>">
|
||||
<span class="dashicons dashicons-undo"></span><?php esc_html_e( 'Use Original Files', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
</span><span>
|
||||
<a href="<?php echo esc_url( Utility::build_url( Router::ACTION_IMG_OPTM, Img_Optm::TYPE_BATCH_SWITCH_OPTM ) ); ?>" class="litespeed-link-with-icon litespeed-icon-right" data-balloon-pos="up" aria-label="<?php esc_html_e( 'Switch back to using optimized images on your site', 'litespeed-cache' ); ?>">
|
||||
<?php esc_html_e( 'Use Optimized Files', 'litespeed-cache' ); ?><span class="dashicons dashicons-redo"></span>
|
||||
</a>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="inside litespeed-postbox-footer litespeed-postbox-footer--compact">
|
||||
<p>
|
||||
<a href="<?php echo esc_url( Utility::build_url( Router::ACTION_IMG_OPTM, Img_Optm::TYPE_RESET_COUNTER ) ); ?>" class="litespeed-link-with-icon litespeed-warning">
|
||||
<span class="dashicons dashicons-dismiss"></span><?php esc_html_e( 'Soft Reset Optimization Counter', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
</p>
|
||||
<div class="litespeed-desc">
|
||||
<?php printf( esc_html__( 'This will reset the %1$s. If you changed WebP/AVIF settings and want to generate %2$s for the previously optimized images, use this action.', 'litespeed-cache' ), '<code>' . esc_html__( 'Current image post id position', 'litespeed-cache' ) . '</code>', 'WebP/AVIF' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="inside litespeed-postbox-footer litespeed-postbox-footer--compact">
|
||||
<p>
|
||||
<a href="<?php echo esc_url( Utility::build_url( Router::ACTION_IMG_OPTM, Img_Optm::TYPE_DESTROY ) ); ?>" class="litespeed-link-with-icon litespeed-danger" data-litespeed-cfm="<?php esc_html_e( 'Are you sure to destroy all optimized images?', 'litespeed-cache' ); ?>" id="litespeed-imageopt-destroy">
|
||||
<span class="dashicons dashicons-dismiss"></span><?php esc_html_e( 'Destroy All Optimization Data', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
</p>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Remove all previous image optimization requests/results, revert completed optimizations, and delete all optimization files.', 'litespeed-cache' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Admin Footer
|
||||
*
|
||||
* Customizes the admin footer text for LiteSpeed Cache with links to rate, documentation, support forum, and community.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
$stars = '<span class="wporg-ratings rating-stars"><span class="dashicons dashicons-star-filled" style="color:#ffb900 !important;"></span><span class="dashicons dashicons-star-filled" style="color:#ffb900 !important;"></span><span class="dashicons dashicons-star-filled" style="color:#ffb900 !important;"></span><span class="dashicons dashicons-star-filled" style="color:#ffb900 !important;"></span><span class="dashicons dashicons-star-filled" style="color:#ffb900 !important;"></span></span>';
|
||||
|
||||
$rate_us = '<a href="https://wordpress.org/support/plugin/litespeed-cache/reviews/?filter=5#new-post" rel="noopener noreferrer" target="_blank">' . sprintf( esc_html__( 'Rate %1$s on %2$s', 'litespeed-cache' ), '<strong>' . esc_html__( 'LiteSpeed Cache', 'litespeed-cache' ) . $stars . '</strong>', 'WordPress.org' ) . '</a>';
|
||||
|
||||
$wiki = '<a href="https://docs.litespeedtech.com/lscache/lscwp/" target="_blank">' . esc_html__( 'Read LiteSpeed Documentation', 'litespeed-cache' ) . '</a>';
|
||||
|
||||
$forum = '<a href="https://wordpress.org/support/plugin/litespeed-cache" target="_blank">' . esc_html__( 'Visit LSCWP support forum', 'litespeed-cache' ) . '</a>';
|
||||
|
||||
$community = '<a href="https://litespeedtech.com/slack" target="_blank">' . esc_html__( 'Join LiteSpeed Slack community', 'litespeed-cache' ) . '</a>';
|
||||
|
||||
// Change the footer text
|
||||
if ( ! is_multisite() || is_network_admin() ) {
|
||||
$footer_text = $rate_us . ' | ' . $wiki . ' | ' . $forum . ' | ' . $community;
|
||||
} else {
|
||||
$footer_text = $wiki . ' | ' . $forum . ' | ' . $community;
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Warning Notice
|
||||
*
|
||||
* Displays warnings if LiteSpeed Cache functionality is unavailable due to server or plugin configuration issues.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
$reasons = array();
|
||||
|
||||
if ( ! defined( 'LITESPEED_ALLOWED' ) ) {
|
||||
if ( defined( 'LITESPEED_SERVER_TYPE' ) && LITESPEED_SERVER_TYPE === 'NONE' ) {
|
||||
$reasons[] = array(
|
||||
'title' => esc_html__( 'To use the caching functions you must have a LiteSpeed web server or be using QUIC.cloud CDN.', 'litespeed-cache' ),
|
||||
'link' => 'https://docs.litespeedtech.com/lscache/lscwp/faq/#why-do-the-cache-features-require-a-litespeed-server',
|
||||
);
|
||||
} else {
|
||||
$reasons[] = array(
|
||||
'title' => esc_html__( 'Please enable the LSCache Module at the server level, or ask your hosting provider.', 'litespeed-cache' ),
|
||||
'link' => 'https://docs.litespeedtech.com/lscache/lscwp/#server-level-prerequisites',
|
||||
);
|
||||
}
|
||||
} elseif ( ! defined( 'LITESPEED_ON' ) ) {
|
||||
$reasons[] = array(
|
||||
'title' => esc_html__( 'Please enable LiteSpeed Cache in the plugin settings.', 'litespeed-cache' ),
|
||||
'link' => 'https://docs.litespeedtech.com/lscache/lscwp/cache/#enable-cache',
|
||||
);
|
||||
}
|
||||
|
||||
if ( $reasons ) : ?>
|
||||
<div class="litespeed-callout notice notice-error inline">
|
||||
<h4><?php esc_html_e( 'WARNING', 'litespeed-cache' ); ?></h4>
|
||||
<p>
|
||||
<?php esc_html_e( 'LSCache caching functions on this page are currently unavailable!', 'litespeed-cache' ); ?>
|
||||
</p>
|
||||
<ul class="litespeed-list">
|
||||
<?php foreach ( $reasons as $reason ) : ?>
|
||||
<li>
|
||||
<?php echo esc_html( $reason['title'] ); ?>
|
||||
<a href="<?php echo esc_url( $reason['link'] ); ?>" target="_blank" class="litespeed-learn-more"><?php esc_html_e( 'Learn More', 'litespeed-cache' ); ?></a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Network Primary Site Configuration Warning
|
||||
*
|
||||
* Displays a warning notice on subsite admin pages when the network admin has enforced primary site configurations.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
if ( ! is_multisite() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( get_current_blog_id() === BLOG_ID_CURRENT_SITE ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! $this->network_conf( Base::NETWORK_O_USE_PRIMARY ) ) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<div class="litespeed-callout notice notice-error inline">
|
||||
<h4><?php esc_html_e( 'WARNING', 'litespeed-cache' ); ?></h4>
|
||||
<p>
|
||||
<?php esc_html_e( 'The network admin selected use primary site configs for all subsites.', 'litespeed-cache' ); ?>
|
||||
<?php esc_html_e( 'The following options are selected, but are not editable in this settings page.', 'litespeed-cache' ); ?>
|
||||
</p>
|
||||
</div>
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Upgrade Notice
|
||||
*
|
||||
* Displays a notice informing the user that the LiteSpeed Cache plugin has been upgraded and a page refresh is needed to complete the configuration data upgrade.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
$message = esc_html__( 'LiteSpeed cache plugin upgraded. Please refresh the page to complete the configuration data upgrade.', 'litespeed-cache' );
|
||||
|
||||
echo wp_kses_post( self::build_notice( self::NOTICE_BLUE, $message ) );
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Post Meta Settings
|
||||
*
|
||||
* Renders the post meta settings interface for LiteSpeed Cache, allowing configuration of post-specific options.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
wp_nonce_field( self::POST_NONCE_ACTION, Router::NONCE );
|
||||
|
||||
$pid = get_the_ID();
|
||||
|
||||
foreach ( $this->_postmeta_settings as $key => $label ) {
|
||||
$existing_val = get_post_meta( $pid, $key, true );
|
||||
|
||||
if ( in_array( $key, array( 'litespeed_vpi_list', 'litespeed_vpi_list_mobile' ), true ) ) {
|
||||
if ( is_array( $existing_val ) ) {
|
||||
$existing_val = implode( PHP_EOL, $existing_val );
|
||||
}
|
||||
?>
|
||||
<div style="margin-bottom:10px;">
|
||||
<label for="<?php echo esc_attr( Str::trim_quotes( $key ) ); ?>"><?php echo esc_html( $label ); ?></label>
|
||||
<textarea style="width:100%" rows="5" id="<?php echo esc_attr( Str::trim_quotes( $key ) ); ?>" name="<?php echo esc_attr( Str::trim_quotes( $key ) ); ?>"><?php echo esc_textarea( $existing_val ); ?></textarea>
|
||||
</div>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<div style="display:flex;margin-bottom:10px;align-items: center;gap: 2ch;justify-content: space-between;">
|
||||
<label for="<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $label ); ?></label>
|
||||
<input class="litespeed-tiny-toggle" id="<?php echo esc_attr( Str::trim_quotes( $key ) ); ?>" name="<?php echo esc_attr( Str::trim_quotes( $key ) ); ?>" type="checkbox" value="1" <?php echo $existing_val ? 'checked' : ''; ?> />
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<div style="text-align:right;">
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/metabox/' ); ?>
|
||||
</div>
|
||||
@@ -0,0 +1,140 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Deactivation Modal
|
||||
*
|
||||
* Renders the deactivation modal interface for LiteSpeed Cache, allowing users to send reason of deactivation.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 7.3
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
// Modal data
|
||||
$_title = esc_html__('Deactivate LiteSpeed Cache', 'litespeed');
|
||||
$_id = 'litespeed-modal-deactivate';
|
||||
|
||||
$reasons = array(
|
||||
array(
|
||||
'value' => 'Temporary',
|
||||
'text' => esc_html__('The deactivation is temporary', 'litespeed-cache'),
|
||||
'id' => 'temp',
|
||||
'selected' => true,
|
||||
),
|
||||
array(
|
||||
'value' => 'Performance worse',
|
||||
'text' => esc_html__('Site performance is worse', 'litespeed-cache'),
|
||||
'id' => 'performance',
|
||||
),
|
||||
array(
|
||||
'value' => 'Plugin complicated',
|
||||
'text' => esc_html__('Plugin is too complicated', 'litespeed-cache'),
|
||||
'id' => 'complicated',
|
||||
),
|
||||
array(
|
||||
'value' => 'Other',
|
||||
'text' => esc_html__('Other', 'litespeed-cache'),
|
||||
'id' => 'other',
|
||||
),
|
||||
);
|
||||
?>
|
||||
<div style="display: none">
|
||||
<div id="litespeed-deactivation" class="iziModal">
|
||||
<div id="litespeed-modal-deactivate">
|
||||
<form id="litespeed-deactivation-form" method="post">
|
||||
<p><?php esc_attr_e('Why are you deactivating the plugin?', 'litespeed-cache'); ?></p>
|
||||
<div class="deactivate-reason-wrapper">
|
||||
<?php foreach ($reasons as $reason) : ?>
|
||||
<label for="litespeed-deactivate-reason-<?php esc_attr_e( $reason['id'] ); ?>">
|
||||
<input type="radio" id="litespeed-deactivate-reason-<?php esc_attr_e( $reason['id'] ); ?>" value="<?php esc_attr_e( $reason['value'] ); ?>"
|
||||
<?php isset($reason['selected']) && $reason['selected'] ? ' checked="checked"' : ''; ?> name="litespeed-reason" />
|
||||
<?php esc_html_e( $reason['text'] ); ?>
|
||||
</label>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<div class="deactivate-clear-settings-wrapper">
|
||||
<i style="font-size: 0.9em;">
|
||||
<?php
|
||||
esc_html_e('On uninstall, all plugin settings will be deleted.', 'litespeed-cache');
|
||||
?>
|
||||
</i>
|
||||
<br />
|
||||
<i style="font-size: 0.9em;">
|
||||
|
||||
<?php
|
||||
printf(
|
||||
esc_html__('If you have used Image Optimization, please %sDestroy All Optimization Data%s first. NOTE: this does not remove your optimized images.', 'litespeed-cache'),
|
||||
'<a href="admin.php?page=litespeed-img_optm#litespeed-imageopt-destroy" target="_blank">',
|
||||
'</a>'
|
||||
);
|
||||
?>
|
||||
</i>
|
||||
</div>
|
||||
<div class="deactivate-actions">
|
||||
<input type="submit" id="litespeed-deactivation-form-submit" class="button button-primary" value="<?php esc_attr_e('Deactivate', 'litespeed-cache'); ?>" title="<?php esc_attr_e('Deactivate plugin', 'litespeed-cache'); ?>" />
|
||||
<input type="button" id="litespeed-deactivation-form-cancel" class="button litespeed-btn-warning" value="<?php esc_attr_e('Cancel', 'litespeed-cache'); ?>" title="<?php esc_attr_e('Close popup', 'litespeed-cache'); ?>" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
(function ($) {
|
||||
'use strict';
|
||||
jQuery(document).ready(function () {
|
||||
var lscId = '<?php echo home_url(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>';
|
||||
var modalesc_attr_element = $('#litespeed-deactivation');
|
||||
var deactivateesc_attr_element = $('#deactivate-litespeed-cache');
|
||||
|
||||
if (deactivateesc_attr_element.length > 0 && modalesc_attr_element.length > 0) {
|
||||
// Variables
|
||||
var modal_formElement = $('#litespeed-deactivation-form');
|
||||
|
||||
deactivateesc_attr_element.on('click', function (e) {
|
||||
e.preventDefault();
|
||||
e.stopImmediatePropagation();
|
||||
modal_formElement.attr('action', decodeURI($(this).attr('href')));
|
||||
modalesc_attr_element.iziModal({
|
||||
radius: '.5rem',
|
||||
width: 550,
|
||||
autoOpen: true,
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('submit', '#litespeed-deactivation-form', function (e) {
|
||||
e.preventDefault();
|
||||
$('#litespeed-deactivation-form-submit').attr('disabled', true);
|
||||
var container = $('#litespeed-deactivation-form');
|
||||
|
||||
// Save selected data
|
||||
var data = {
|
||||
id: lscId,
|
||||
siteLink: window.location.hostname,
|
||||
reason: $(container).find('[name=litespeed-reason]:checked').val()
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
url: 'https://wpapi.quic.cloud/survey',
|
||||
dataType: 'json',
|
||||
method: 'POST',
|
||||
cache: false,
|
||||
data: data,
|
||||
success: function (data) {
|
||||
console.log('QC data sent.');
|
||||
},
|
||||
error: function (xhr, error) {
|
||||
console.log('Error sending data to QC.');
|
||||
},
|
||||
});
|
||||
|
||||
$('#litespeed-deactivation-form')[0].submit();
|
||||
});
|
||||
$(document).on('click', '#litespeed-deactivation-form-cancel', function (e) {
|
||||
modalesc_attr_element.iziModal('close');
|
||||
});
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
||||
</script>
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Installation Notice
|
||||
*
|
||||
* Displays a notice informing users that the LiteSpeed Cache plugin was installed by the server admin.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
$buf = sprintf(
|
||||
'<h3>%s</h3>
|
||||
<p>%s</p>
|
||||
<p>%s</p>
|
||||
<p>%s</p>
|
||||
<p>%s</p>
|
||||
<p>%s</p>
|
||||
<ul>
|
||||
<li>%s</li>
|
||||
<li>%s</li>
|
||||
</ul>',
|
||||
esc_html__( 'LiteSpeed Cache plugin is installed!', 'litespeed-cache' ),
|
||||
esc_html__( 'This message indicates that the plugin was installed by the server admin.', 'litespeed-cache' ),
|
||||
esc_html__( 'The LiteSpeed Cache plugin is used to cache pages - a simple way to improve the performance of the site.', 'litespeed-cache' ),
|
||||
esc_html__( 'However, there is no way of knowing all the possible customizations that were implemented.', 'litespeed-cache' ),
|
||||
esc_html__( 'For that reason, please test the site to make sure everything still functions properly.', 'litespeed-cache' ),
|
||||
esc_html__( 'Examples of test cases include:', 'litespeed-cache' ),
|
||||
esc_html__( 'Visit the site while logged out.', 'litespeed-cache' ),
|
||||
esc_html__( 'Create a post, make sure the front page is accurate.', 'litespeed-cache' )
|
||||
);
|
||||
$buf .= sprintf(
|
||||
/* translators: %s: Link tags */
|
||||
esc_html__( 'If there are any questions, the team is always happy to answer any questions on the %ssupport forum%s.', 'litespeed-cache' ),
|
||||
'<a href="https://wordpress.org/support/plugin/litespeed-cache" rel="noopener noreferrer" target="_blank">',
|
||||
'</a>'
|
||||
);
|
||||
$buf .= '<p>' . esc_html__( 'If you would rather not move at litespeed, you can deactivate this plugin.', 'litespeed-cache' ) . '</p>';
|
||||
|
||||
self::add_notice( self::NOTICE_BLUE . ' lscwp-whm-notice', $buf );
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Database Login Cookie Notice
|
||||
*
|
||||
* Displays a notice about mismatched login cookies for LiteSpeed Cache.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined('WPINC') || exit();
|
||||
|
||||
$err =
|
||||
esc_html__('NOTICE: Database login cookie did not match your login cookie.', 'litespeed-cache') .
|
||||
' ' .
|
||||
esc_html__('If the login cookie was recently changed in the settings, please log out and back in.', 'litespeed-cache') .
|
||||
' ' .
|
||||
sprintf(
|
||||
esc_html__('If not, please verify the setting in the %sAdvanced tab%s.', 'litespeed-cache'),
|
||||
"<a href='" . esc_url(admin_url('admin.php?page=litespeed-cache#advanced')) . '">',
|
||||
'</a>'
|
||||
);
|
||||
|
||||
if (LITESPEED_SERVER_TYPE === 'LITESPEED_SERVER_OLS') {
|
||||
$err .= ' ' . esc_html__('If using OpenLiteSpeed, the server must be restarted once for the changes to take effect.', 'litespeed-cache');
|
||||
}
|
||||
|
||||
self::add_notice(self::NOTICE_YELLOW, $err);
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Unexpected Cache Rule Notice
|
||||
*
|
||||
* Displays a warning notice about conflicting cache rules in .htaccess that may cause stale content.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined('WPINC') || exit();
|
||||
|
||||
$err = sprintf(
|
||||
esc_html__(
|
||||
'Unexpected cache rule %2$s found in %1$s file. This rule may cause visitors to see old versions of pages due to the browser caching HTML pages. If you are sure that HTML pages are not being browser cached, this message can be dismissed. (%3$sLearn More%4$s)',
|
||||
'litespeed-cache'
|
||||
),
|
||||
'.htaccess',
|
||||
'<code>ExpiresDefault</code>',
|
||||
'<a href="https://docs.litespeedtech.com/lscache/lscwp/troubleshoot/#browser-displays-stale-content" target="_blank">',
|
||||
'</a>'
|
||||
);
|
||||
|
||||
// Other plugin left cache expired rules in .htaccess which will cause conflicts
|
||||
echo wp_kses_post( self::build_notice(self::NOTICE_YELLOW . ' lscwp-notice-ruleconflict', $err) );
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache OptimaX
|
||||
*
|
||||
* Manages the OptimaX interface for LiteSpeed Cache.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 8.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
$menu_list = array(
|
||||
'summary' => esc_html__( 'OptimaX Summary', 'litespeed-cache' ),
|
||||
'settings' => esc_html__( 'OptimaX Settings', 'litespeed-cache' ),
|
||||
);
|
||||
|
||||
if ( is_network_admin() ) {
|
||||
$menu_list = array(
|
||||
'network_settings' => esc_html__( 'OptimaX Settings', 'litespeed-cache' ),
|
||||
);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<div class="wrap">
|
||||
<h1 class="litespeed-h1">
|
||||
<?php esc_html_e( 'LiteSpeed Cache OptimaX', '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">
|
||||
<h2 class="litespeed-header nav-tab-wrapper">
|
||||
<?php GUI::display_tab_list( $menu_list ); ?>
|
||||
</h2>
|
||||
|
||||
<div class="litespeed-body">
|
||||
<?php
|
||||
foreach ( $menu_list as $menu_key => $val ) {
|
||||
echo '<div data-litespeed-layout="' . esc_attr( $menu_key ) . '">';
|
||||
require LSCWP_DIR . 'tpl/optimax/' . $menu_key . '.tpl.php';
|
||||
echo '</div>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache OptimaX Settings
|
||||
*
|
||||
* Manages OptimaX settings for LiteSpeed Cache.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 8.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
$this->form_action();
|
||||
?>
|
||||
|
||||
<h3 class="litespeed-title-short">
|
||||
<?php esc_html_e( 'OptimaX Settings', 'litespeed-cache' ); ?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/imageopt/#image-optimization-settings-tab' ); ?>
|
||||
</h3>
|
||||
|
||||
<table class="wp-list-table striped litespeed-table">
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_OPTIMAX; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_switch( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Turn on OptimaX. This will automatically request your pages OptimaX result via cron job.', 'litespeed-cache' ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php
|
||||
$this->form_end();
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache OptimaX Summary
|
||||
*
|
||||
* Manages the OX summary interface for LiteSpeed Cache.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 8.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
?>
|
||||
<div class="litespeed-flex-container litespeed-column-with-boxes">
|
||||
<div class="litespeed-width-7-10 litespeed-column-left litespeed-image-optim-summary-wrapper">
|
||||
<div class="litespeed-image-optim-summary">
|
||||
<h3>
|
||||
Coming soon
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="litespeed-width-3-10 litespeed-column-right">
|
||||
<div class="postbox litespeed-postbox litespeed-postbox-imgopt-info">
|
||||
<div class="inside">
|
||||
<h3 class="litespeed-title">
|
||||
Placeholder
|
||||
</h3>
|
||||
|
||||
<div class="litespeed-flex-container">
|
||||
... Placeholder ...
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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><!-- A comment that needs to be here --></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>&_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><noscript></code>' ); ?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/pageopt/#remove-noscript-tags' ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Configuration Presets
|
||||
*
|
||||
* Renders the configuration presets interface for LiteSpeed Cache, including standard presets and import/export functionality.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
$menu_list = array(
|
||||
'standard' => esc_html__( 'Standard Presets', 'litespeed-cache' ),
|
||||
'import_export' => esc_html__( 'Import / Export', 'litespeed-cache' ),
|
||||
);
|
||||
?>
|
||||
|
||||
<div class="wrap">
|
||||
<h1 class="litespeed-h1">
|
||||
<?php esc_html_e( 'LiteSpeed Cache Configuration Presets', '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">
|
||||
<h2 class="litespeed-header nav-tab-wrapper">
|
||||
<?php GUI::display_tab_list( $menu_list ); ?>
|
||||
</h2>
|
||||
|
||||
<div class="litespeed-body">
|
||||
<?php
|
||||
foreach ( $menu_list as $curr_tab => $val ) :
|
||||
?>
|
||||
<div data-litespeed-layout="<?php echo esc_attr( $curr_tab ); ?>">
|
||||
<?php
|
||||
if ( 'import_export' === $curr_tab ) {
|
||||
require LSCWP_DIR . "tpl/toolbox/$curr_tab.tpl.php";
|
||||
} else {
|
||||
require LSCWP_DIR . "tpl/presets/$curr_tab.tpl.php";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
endforeach;
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,198 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Standard Presets
|
||||
*
|
||||
* Renders the standard presets interface for LiteSpeed Cache, allowing users to apply predefined configuration presets.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
$presets = array(
|
||||
'essentials' => array(
|
||||
'title' => esc_html__( 'Essentials', 'litespeed-cache' ),
|
||||
'body' => array(
|
||||
esc_html__( 'Default Cache', 'litespeed-cache' ),
|
||||
esc_html__( 'Higher TTL', 'litespeed-cache' ),
|
||||
esc_html__( 'Browser Cache', 'litespeed-cache' ),
|
||||
),
|
||||
'footer' => array(
|
||||
esc_html__( 'This no-risk preset is appropriate for all websites. Good for new users, simple websites, or cache-oriented development.', 'litespeed-cache' ),
|
||||
esc_html__( 'A QUIC.cloud connection is not required to use this preset. Only basic caching features are enabled.', 'litespeed-cache' ),
|
||||
),
|
||||
),
|
||||
'basic' => array(
|
||||
'title' => esc_html__( 'Basic', 'litespeed-cache' ),
|
||||
'body' => array(
|
||||
esc_html__( 'Everything in Essentials, Plus', 'litespeed-cache' ),
|
||||
esc_html__( 'Image Optimization', 'litespeed-cache' ),
|
||||
esc_html__( 'Mobile Cache', 'litespeed-cache' ),
|
||||
),
|
||||
'footer' => array(
|
||||
esc_html__( 'This low-risk preset introduces basic optimizations for speed and user experience. Appropriate for enthusiastic beginners.', 'litespeed-cache' ),
|
||||
esc_html__( 'A QUIC.cloud connection is required to use this preset. Includes optimizations known to improve site score in page speed measurement tools.', 'litespeed-cache' ),
|
||||
),
|
||||
),
|
||||
'advanced' => array(
|
||||
'title' => esc_html__( 'Advanced (Recommended)', 'litespeed-cache' ),
|
||||
'body' => array(
|
||||
esc_html__( 'Everything in Basic, Plus', 'litespeed-cache' ),
|
||||
esc_html__( 'Guest Mode and Guest Optimization', 'litespeed-cache' ),
|
||||
esc_html__( 'CSS, JS and HTML Minification', 'litespeed-cache' ),
|
||||
esc_html__( 'Font Display Optimization', 'litespeed-cache' ),
|
||||
esc_html__( 'JS Defer for both external and inline JS', 'litespeed-cache' ),
|
||||
esc_html__( 'DNS Prefetch for static files', 'litespeed-cache' ),
|
||||
esc_html__( 'Gravatar Cache', 'litespeed-cache' ),
|
||||
esc_html__( 'Remove Query Strings from Static Files', 'litespeed-cache' ),
|
||||
esc_html__( 'Remove WordPress Emoji', 'litespeed-cache' ),
|
||||
esc_html__( 'Remove Noscript Tags', 'litespeed-cache' ),
|
||||
),
|
||||
'footer' => array(
|
||||
esc_html__( 'This preset is good for most websites, and is unlikely to cause conflicts. Any CSS or JS conflicts may be resolved with Page Optimization > Tuning tools.', 'litespeed-cache' ),
|
||||
esc_html__( 'A QUIC.cloud connection is required to use this preset. Includes many optimizations known to improve page speed scores.', 'litespeed-cache' ),
|
||||
),
|
||||
),
|
||||
'aggressive' => array(
|
||||
'title' => esc_html__( 'Aggressive', 'litespeed-cache' ),
|
||||
'body' => array(
|
||||
esc_html__( 'Everything in Advanced, Plus', 'litespeed-cache' ),
|
||||
esc_html__( 'CSS & JS Combine', 'litespeed-cache' ),
|
||||
esc_html__( 'Asynchronous CSS Loading with Critical CSS', 'litespeed-cache' ),
|
||||
esc_html__( 'Removed Unused CSS for Users', 'litespeed-cache' ),
|
||||
esc_html__( 'Lazy Load for Iframes', 'litespeed-cache' ),
|
||||
),
|
||||
'footer' => array(
|
||||
esc_html__( 'This preset might work out of the box for some websites, but be sure to test! Some CSS or JS exclusions may be necessary in Page Optimization > Tuning.', 'litespeed-cache' ),
|
||||
esc_html__( 'A QUIC.cloud connection is required to use this preset. Includes many optimizations known to improve page speed scores.', 'litespeed-cache' ),
|
||||
),
|
||||
),
|
||||
'extreme' => array(
|
||||
'title' => esc_html__( 'Extreme', 'litespeed-cache' ),
|
||||
'body' => array(
|
||||
esc_html__( 'Everything in Aggressive, Plus', 'litespeed-cache' ),
|
||||
esc_html__( 'Lazy Load for Images', 'litespeed-cache' ),
|
||||
esc_html__( 'Viewport Image Generation', 'litespeed-cache' ),
|
||||
esc_html__( 'JS Delayed', 'litespeed-cache' ),
|
||||
esc_html__( 'Inline JS added to Combine', 'litespeed-cache' ),
|
||||
esc_html__( 'Inline CSS added to Combine', 'litespeed-cache' ),
|
||||
),
|
||||
'footer' => array(
|
||||
esc_html__( 'This preset almost certainly will require testing and exclusions for some CSS, JS and Lazy Loaded images. Pay special attention to logos, or HTML-based slider images.', 'litespeed-cache' ),
|
||||
esc_html__( 'A QUIC.cloud connection is required to use this preset. Enables the maximum level of optimizations for improved page speed scores.', 'litespeed-cache' ),
|
||||
),
|
||||
),
|
||||
);
|
||||
?>
|
||||
|
||||
<h3 class="litespeed-title-short">
|
||||
<?php esc_html_e( 'LiteSpeed Cache Standard Presets', 'litespeed-cache' ); ?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/presets/#standard-tab' ); ?>
|
||||
</h3>
|
||||
|
||||
<p><?php esc_html_e( 'Use an official LiteSpeed-designed Preset to configure your site in one click. Try no-risk caching essentials, extreme optimization, or something in between.', 'litespeed-cache' ); ?></p>
|
||||
|
||||
<div class="litespeed-comparison-cards">
|
||||
<?php
|
||||
foreach ( array_keys( $presets ) as $name ) :
|
||||
$curr_title = $presets[ $name ]['title'];
|
||||
$recommend = 'advanced' === $name;
|
||||
$card_class = $recommend ? 'litespeed-comparison-card-rec' : '';
|
||||
$button_class = $recommend ? 'button-primary' : 'button-secondary';
|
||||
?>
|
||||
<div class="litespeed-comparison-card postbox <?php echo esc_attr( $card_class ); ?>">
|
||||
<div class="litespeed-card-content">
|
||||
<div class="litespeed-card-header">
|
||||
<h3 class="litespeed-h3">
|
||||
<?php echo esc_html( $curr_title ); ?>
|
||||
</h3>
|
||||
</div>
|
||||
<div class="litespeed-card-body">
|
||||
<ul>
|
||||
<?php foreach ( $presets[ $name ]['body'] as $line ) : ?>
|
||||
<li><?php echo esc_html( $line ); ?></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="litespeed-card-footer">
|
||||
<h4><?php esc_html_e( 'Who should use this preset?', 'litespeed-cache' ); ?></h4>
|
||||
<?php foreach ( $presets[ $name ]['footer'] as $line ) : ?>
|
||||
<p><?php echo esc_html( $line ); ?></p>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="litespeed-card-action">
|
||||
<a
|
||||
href="<?php echo esc_url( Utility::build_url( Router::ACTION_PRESET, Preset::TYPE_APPLY, false, null, array( 'preset' => $name ) ) ); ?>"
|
||||
class="button <?php echo esc_attr( $button_class ); ?>"
|
||||
data-litespeed-cfm="<?php echo esc_attr( sprintf( __( 'This will back up your current settings and replace them with the %1$s preset settings. Do you want to continue?', 'litespeed-cache' ), $curr_title ) ); ?>"
|
||||
>
|
||||
<?php esc_html_e( 'Apply Preset', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
$summary = Preset::get_summary();
|
||||
$backups = array();
|
||||
foreach ( Preset::get_backups() as $backup ) {
|
||||
$backup = explode( '-', $backup );
|
||||
if ( empty( $backup[1] ) ) {
|
||||
continue;
|
||||
}
|
||||
$timestamp = $backup[1];
|
||||
$time = trim( Utility::readable_time( $timestamp ) );
|
||||
$name = empty( $backup[3] ) ? null : $backup[3];
|
||||
$curr_title = empty( $presets[ $name ]['title'] ) ? $name : $presets[ $name ]['title'];
|
||||
$curr_title = null === $curr_title ? esc_html__( 'unknown', 'litespeed-cache' ) : $curr_title;
|
||||
$backups[] = array(
|
||||
'timestamp' => $timestamp,
|
||||
'time' => $time,
|
||||
'title' => $curr_title,
|
||||
);
|
||||
}
|
||||
|
||||
if ( ! empty( $summary['preset'] ) || ! empty( $backups ) ) :
|
||||
?>
|
||||
<h3 class="litespeed-title-short">
|
||||
<?php esc_html_e( 'History', 'litespeed-cache' ); ?>
|
||||
</h3>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( ! empty( $summary['preset'] ) ) : ?>
|
||||
<p>
|
||||
<?php
|
||||
$name = strtolower( $summary['preset'] );
|
||||
$time = trim( Utility::readable_time( $summary['preset_timestamp'] ) );
|
||||
if ( 'error' === $name ) {
|
||||
printf( esc_html__( 'Error: Failed to apply the settings %1$s', 'litespeed-cache' ), esc_html( $time ) );
|
||||
} elseif ( 'backup' === $name ) {
|
||||
printf( esc_html__( 'Restored backup settings %1$s', 'litespeed-cache' ), esc_html( $time ) );
|
||||
} else {
|
||||
printf(
|
||||
esc_html__( 'Applied the %1$s preset %2$s', 'litespeed-cache' ),
|
||||
'<strong>' . esc_html( $presets[ $name ]['title'] ) . '</strong>',
|
||||
esc_html( $time )
|
||||
);
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php foreach ( $backups as $backup ) : ?>
|
||||
<p>
|
||||
<?php printf( esc_html__( 'Backup created %1$s before applying the %2$s preset', 'litespeed-cache' ), esc_html( $backup['time'] ), esc_html( $backup['title'] ) ); ?>
|
||||
<a
|
||||
href="<?php echo esc_url( Utility::build_url( Router::ACTION_PRESET, Preset::TYPE_RESTORE, false, null, array( 'timestamp' => $backup['timestamp'] ) ) ); ?>"
|
||||
class="litespeed-left10"
|
||||
data-litespeed-cfm="<?php echo esc_attr( sprintf( __( 'This will restore the backup settings created %1$s before applying the %2$s preset. Any changes made since then will be lost. Do you want to continue?', 'litespeed-cache' ), $backup['time'], $backup['title'] ) ); ?>"
|
||||
>
|
||||
<?php esc_html_e( 'Restore Settings', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
</p>
|
||||
<?php endforeach; ?>
|
||||
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Beta Test
|
||||
*
|
||||
* Renders the beta test interface for LiteSpeed Cache, allowing users to switch plugin versions or test GitHub commits.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
// List of available public versions
|
||||
$v_list = array(
|
||||
'7.6.2',
|
||||
'7.6.1',
|
||||
'7.6',
|
||||
'7.5.0.1',
|
||||
'7.4',
|
||||
'7.3.0.1',
|
||||
'7.3',
|
||||
'7.2',
|
||||
'7.1',
|
||||
'7.0.1',
|
||||
'6.5.4',
|
||||
'5.7.0.1',
|
||||
'4.6',
|
||||
'3.6.4',
|
||||
);
|
||||
?>
|
||||
|
||||
<?php $this->form_action( Router::ACTION_DEBUG2, Debug2::TYPE_BETA_TEST ); ?>
|
||||
|
||||
<h3 class="litespeed-title">
|
||||
<?php esc_html_e( 'Try GitHub Version', 'litespeed-cache' ); ?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/toolbox/#beta-test-tab' ); ?>
|
||||
</h3>
|
||||
|
||||
<?php if ( defined( 'LITESPEED_DISABLE_ALL' ) && LITESPEED_DISABLE_ALL ) : ?>
|
||||
<div class="litespeed-callout notice notice-warning inline">
|
||||
<h4><?php esc_html_e( 'NOTICE:', 'litespeed-cache' ); ?></h4>
|
||||
<p><?php esc_html_e( 'LiteSpeed Cache is disabled. This functionality will not work.', 'litespeed-cache' ); ?></p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Use this section to switch plugin versions. To beta test a GitHub commit, enter the commit URL in the field below.', 'litespeed-cache' ); ?>
|
||||
</div>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Example', 'litespeed-cache' ); ?>: <code>https://github.com/litespeedtech/lscache_wp/commit/example_comment_hash_d3ebec0535aaed5c932c0</code>
|
||||
</div>
|
||||
|
||||
<input type="text" name="<?php echo esc_attr( Debug2::BETA_TEST_URL ); ?>" class="litespeed-input-long" id="litespeed-beta-test" value="">
|
||||
|
||||
<p>
|
||||
<a href="javascript:;" class="button litespeed-btn-success" onclick="document.getElementById('litespeed-beta-test').value='dev';"><?php esc_html_e( 'Use latest GitHub Dev commit', 'litespeed-cache' ); ?></a> <code>dev</code>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<a href="javascript:;" class="button litespeed-btn-success" onclick="document.getElementById('litespeed-beta-test').value='master';"><?php esc_html_e( 'Use latest GitHub Master commit', 'litespeed-cache' ); ?></a> <code>master</code>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<a href="javascript:;" class="button litespeed-btn-success" onclick="document.getElementById('litespeed-beta-test').value='latest';"><?php esc_html_e( 'Use latest WordPress release version', 'litespeed-cache' ); ?></a> <code><?php echo esc_attr( Debug2::BETA_TEST_URL_WP ); ?></code> <?php esc_html_e( 'OR', 'litespeed-cache' ); ?> <code>latest</code>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<?php foreach ( $v_list as $v ) : ?>
|
||||
<a href="javascript:;" class="button <?php echo '3.6.4' === $v ? 'litespeed-btn-danger' : 'litespeed-btn-success'; ?>" onclick="document.getElementById('litespeed-beta-test').value='<?php echo esc_attr( $v ); ?>';"><?php echo esc_html( $v ); ?></a>
|
||||
<?php endforeach; ?>
|
||||
<span class="litespeed-danger">
|
||||
🚨 <?php esc_html_e( 'Downgrade not recommended. May cause fatal error due to refactored code.', 'litespeed-cache' ); ?>
|
||||
</span>
|
||||
</p>
|
||||
|
||||
<div class="litespeed-desc">
|
||||
<?php printf( esc_html__( 'Press the %s button to use the most recent GitHub commit. Master is for release candidate & Dev is for experimental testing.', 'litespeed-cache' ), '<code>' . esc_html__( 'Use latest GitHub Dev/Master commit', 'litespeed-cache' ) . '</code>' ); ?>
|
||||
</div>
|
||||
<div class="litespeed-desc">
|
||||
<?php printf( esc_html__( 'Press the %s button to stop beta testing and go back to the current release from the WordPress Plugin Directory.', 'litespeed-cache' ), '<code>' . esc_html__( 'Use latest WordPress release version', 'litespeed-cache' ) . '</code>' ); ?>
|
||||
</div>
|
||||
|
||||
<p class="litespeed-danger">
|
||||
🚨 <?php printf( esc_html__( 'In order to avoid an upgrade error, you must be using %1$s or later before you can upgrade to %2$s versions.', 'litespeed-cache' ), '<code>v3.6.4</code>', '<code>dev/master/v4+</code>' ); ?>
|
||||
</p>
|
||||
|
||||
<button type="submit" class="button button-primary"><?php esc_html_e( 'Upgrade', 'litespeed-cache' ); ?></button>
|
||||
</form>
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache View .htaccess
|
||||
*
|
||||
* Renders the .htaccess view interface for LiteSpeed Cache, displaying the contents and paths of frontend and backend .htaccess files.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
$content = null;
|
||||
try {
|
||||
$content = Htaccess::cls()->htaccess_read();
|
||||
} catch ( \Exception $e ) {
|
||||
?>
|
||||
<div class="notice notice-error is-dismissible">
|
||||
<p><?php echo wp_kses_post( $e->getMessage() ); ?></p>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
$htaccess_path = Htaccess::get_frontend_htaccess();
|
||||
|
||||
// Check for `ExpiresDefault` in .htaccess when LiteSpeed is enabled
|
||||
if ( defined( 'LITESPEED_ON' ) && $content && stripos( $content, "\nExpiresDefault" ) !== false ) {
|
||||
$is_dismissed = GUI::get_option( self::DB_DISMISS_MSG );
|
||||
if ( self::RULECONFLICT_DISMISSED !== $is_dismissed ) {
|
||||
if ( self::RULECONFLICT_ON !== $is_dismissed ) {
|
||||
GUI::update_option( self::DB_DISMISS_MSG, self::RULECONFLICT_ON );
|
||||
}
|
||||
require_once LSCWP_DIR . 'tpl/inc/show_rule_conflict.php';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<h3 class="litespeed-title">
|
||||
<?php esc_html_e( 'LiteSpeed Cache View .htaccess', 'litespeed-cache' ); ?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/toolbox/#view-htaccess-tab' ); ?>
|
||||
</h3>
|
||||
|
||||
<h3 class="litespeed-title-short">
|
||||
<?php esc_html_e( '.htaccess Path', 'litespeed-cache' ); ?>
|
||||
</h3>
|
||||
|
||||
<table class="wp-list-table striped litespeed-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>
|
||||
<?php esc_html_e( 'Frontend .htaccess Path', 'litespeed-cache' ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<code><?php echo esc_html( $htaccess_path ); ?></code>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Default path is', 'litespeed-cache' ); ?>: <code><?php echo esc_html( Htaccess::get_frontend_htaccess( true ) ); ?></code>
|
||||
<br />
|
||||
<font class="litespeed-success">
|
||||
<?php esc_html_e( 'API', 'litespeed-cache' ); ?>:
|
||||
<?php printf( esc_html__( 'PHP Constant %s is supported.', 'litespeed-cache' ), '<code>LITESPEED_CFG_HTACCESS</code>' ); ?>
|
||||
<?php printf( esc_html__( 'You can use this code %1$s in %2$s to specify the htaccess file path.', 'litespeed-cache' ), '<code>defined("LITESPEED_CFG_HTACCESS") || define("LITESPEED_CFG_HTACCESS", "your path on server");</code>', '<code>wp-config.php</code>' ); ?>
|
||||
</font>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php esc_html_e( 'Backend .htaccess Path', 'litespeed-cache' ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<code><?php echo esc_html( Htaccess::get_backend_htaccess() ); ?></code>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Default path is', 'litespeed-cache' ); ?>: <code><?php echo esc_html( Htaccess::get_backend_htaccess( true ) ); ?></code>
|
||||
<br />
|
||||
<font class="litespeed-success">
|
||||
<?php esc_html_e( 'API', 'litespeed-cache' ); ?>:
|
||||
<?php printf( esc_html__( 'PHP Constant %s is supported.', 'litespeed-cache' ), '<code>LITESPEED_CFG_HTACCESS_BACKEND</code>' ); ?>
|
||||
<?php printf( esc_html__( 'You can use this code %1$s in %2$s to specify the htaccess file path.', 'litespeed-cache' ), '<code>defined("LITESPEED_CFG_HTACCESS_BACKEND") || define("LITESPEED_CFG_HTACCESS_BACKEND", "your path on server");</code>', '<code>wp-config.php</code>' ); ?>
|
||||
</font>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php if ( null !== $content ) : ?>
|
||||
<h3 class="litespeed-title">
|
||||
<?php printf( esc_html__( 'Current %s Contents', 'litespeed-cache' ), '.htaccess' ); ?>
|
||||
</h3>
|
||||
|
||||
<h4><?php echo esc_html( $htaccess_path ); ?></h4>
|
||||
|
||||
<textarea readonly wrap="off" rows="50" class="large-text"><?php echo esc_textarea( $content ); ?></textarea>
|
||||
<?php endif; ?>
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Toolbox
|
||||
*
|
||||
* Renders the toolbox interface for LiteSpeed Cache, providing access to various administrative tools and settings.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
$menu_list = array(
|
||||
'purge' => esc_html__( 'Purge', 'litespeed-cache' ),
|
||||
);
|
||||
|
||||
if ( ! $this->_is_network_admin ) {
|
||||
$menu_list['import_export'] = esc_html__( 'Import / Export', 'litespeed-cache' );
|
||||
}
|
||||
|
||||
if ( ! $this->_is_multisite || $this->_is_network_admin ) {
|
||||
$menu_list['edit_htaccess'] = esc_html__( 'View .htaccess', 'litespeed-cache' );
|
||||
}
|
||||
|
||||
if ( ! $this->_is_network_admin ) {
|
||||
$menu_list['heartbeat'] = esc_html__( 'Heartbeat', 'litespeed-cache' );
|
||||
$menu_list['report'] = esc_html__( 'Report', 'litespeed-cache' );
|
||||
}
|
||||
|
||||
if ( ! $this->_is_multisite || $this->_is_network_admin ) {
|
||||
$menu_list['settings-debug'] = esc_html__( 'Debug Settings', 'litespeed-cache' );
|
||||
$menu_list['log_viewer'] = esc_html__( 'Log View', 'litespeed-cache' );
|
||||
$menu_list['beta_test'] = esc_html__( 'Beta Test', 'litespeed-cache' );
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="wrap">
|
||||
<h1 class="litespeed-h1">
|
||||
<?php esc_html_e( 'LiteSpeed Cache Toolbox', '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">
|
||||
<h2 class="litespeed-header nav-tab-wrapper">
|
||||
<?php GUI::display_tab_list( $menu_list ); ?>
|
||||
</h2>
|
||||
|
||||
<div class="litespeed-body">
|
||||
<?php foreach ( $menu_list as $curr_tab => $val ) : ?>
|
||||
<div data-litespeed-layout="<?php echo esc_attr( $curr_tab ); ?>">
|
||||
<?php require LSCWP_DIR . "tpl/toolbox/$curr_tab.tpl.php"; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Heartbeat Control
|
||||
*
|
||||
* Renders the heartbeat control settings interface for LiteSpeed Cache, allowing configuration of WordPress heartbeat intervals.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
$this->form_action();
|
||||
?>
|
||||
|
||||
<h3 class="litespeed-title-short">
|
||||
<?php esc_html_e( 'Heartbeat Control', 'litespeed-cache' ); ?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/toolbox/#heartbeat-tab' ); ?>
|
||||
</h3>
|
||||
|
||||
<div class="litespeed-callout notice notice-warning inline">
|
||||
<h4><?php esc_html_e( 'NOTICE:', 'litespeed-cache' ); ?></h4>
|
||||
<p>
|
||||
<?php esc_html_e( 'Disable WordPress interval heartbeat to reduce server load.', 'litespeed-cache' ); ?>
|
||||
<span class="litespeed-warning">
|
||||
🚨 <?php esc_html_e( 'Disabling this may cause WordPress tasks triggered by AJAX to stop working.', 'litespeed-cache' ); ?>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<table class="wp-list-table striped litespeed-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_MISC_HEARTBEAT_FRONT; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_switch( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Turn ON to control heartbeat on frontend.', 'litespeed-cache' ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_MISC_HEARTBEAT_FRONT_TTL; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_input( $option_id, 'litespeed-input-short' ); ?> <?php $this->readable_seconds(); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php printf( esc_html__( 'Specify the %s heartbeat interval in seconds.', 'litespeed-cache' ), 'frontend' ); ?>
|
||||
<?php printf( esc_html__( 'WordPress valid interval is %s seconds.', 'litespeed-cache' ), '<code>15</code> - <code>120</code>' ); ?><br />
|
||||
<?php printf( esc_html__( 'Set to %1$s to forbid heartbeat on %2$s.', 'litespeed-cache' ), '<code>0</code>', 'frontend' ); ?><br />
|
||||
<?php $this->recommended( $option_id ); ?>
|
||||
<?php $this->_validate_ttl( $option_id, 15, 120, true ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_MISC_HEARTBEAT_BACK; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_switch( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Turn ON to control heartbeat on backend.', 'litespeed-cache' ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_MISC_HEARTBEAT_BACK_TTL; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_input( $option_id, 'litespeed-input-short' ); ?> <?php $this->readable_seconds(); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php printf( esc_html__( 'Specify the %s heartbeat interval in seconds.', 'litespeed-cache' ), 'backend' ); ?>
|
||||
<?php printf( esc_html__( 'WordPress valid interval is %s seconds.', 'litespeed-cache' ), '<code>15</code> - <code>120</code>' ); ?><br />
|
||||
<?php printf( esc_html__( 'Set to %1$s to forbid heartbeat on %2$s.', 'litespeed-cache' ), '<code>0</code>', 'backend' ); ?><br />
|
||||
<?php $this->recommended( $option_id ); ?>
|
||||
<?php $this->_validate_ttl( $option_id, 15, 120, true ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_MISC_HEARTBEAT_EDITOR; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_switch( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Turn ON to control heartbeat in backend editor.', 'litespeed-cache' ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_MISC_HEARTBEAT_EDITOR_TTL; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_input( $option_id, 'litespeed-input-short' ); ?> <?php $this->readable_seconds(); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php printf( esc_html__( 'Specify the %s heartbeat interval in seconds.', 'litespeed-cache' ), 'backend editor' ); ?>
|
||||
<?php printf( esc_html__( 'WordPress valid interval is %s seconds.', 'litespeed-cache' ), '<code>15</code> - <code>120</code>' ); ?><br />
|
||||
<?php printf( esc_html__( 'Set to %1$s to forbid heartbeat on %2$s.', 'litespeed-cache' ), '<code>0</code>', 'backend editor' ); ?><br />
|
||||
<?php $this->recommended( $option_id ); ?>
|
||||
<?php $this->_validate_ttl( $option_id, 15, 120, true ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php $this->form_end(); ?>
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Import/Export Settings
|
||||
*
|
||||
* Renders the import/export settings interface for LiteSpeed Cache, allowing users to export, import, or reset plugin settings.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
$summary = Import::get_summary();
|
||||
?>
|
||||
|
||||
<h3 class="litespeed-title">
|
||||
<?php esc_html_e( 'Export Settings', 'litespeed-cache' ); ?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/toolbox/#importexport-tab' ); ?>
|
||||
</h3>
|
||||
|
||||
<div>
|
||||
<a href="<?php echo esc_url( Utility::build_url( Router::ACTION_IMPORT, Import::TYPE_EXPORT ) ); ?>" class="button button-primary">
|
||||
<?php esc_html_e( 'Export', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<?php if ( ! empty( $summary['export_file'] ) ) : ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Last exported', 'litespeed-cache' ); ?>: <code><?php echo esc_html( $summary['export_file'] ); ?></code> <?php echo esc_html( Utility::readable_time( $summary['export_time'] ) ); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'This will export all current LiteSpeed Cache settings and save them as a file.', 'litespeed-cache' ); ?>
|
||||
</div>
|
||||
|
||||
<h3 class="litespeed-title">
|
||||
<?php esc_html_e( 'Import Settings', 'litespeed-cache' ); ?>
|
||||
</h3>
|
||||
|
||||
<?php $this->form_action( Router::ACTION_IMPORT, Import::TYPE_IMPORT, true ); ?>
|
||||
<div class="litespeed-div">
|
||||
<input type="file" name="ls_file" class="litespeed-input" />
|
||||
</div>
|
||||
<div class="litespeed-div">
|
||||
<?php submit_button( esc_html__( 'Import', 'litespeed-cache' ), 'button button-primary', 'litespeed-submit' ); ?>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php if ( ! empty( $summary['import_file'] ) ) : ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Last imported', 'litespeed-cache' ); ?>: <code><?php echo esc_html( $summary['import_file'] ); ?></code> <?php echo esc_html( Utility::readable_time( $summary['import_time'] ) ); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'This will import settings from a file and override all current LiteSpeed Cache settings.', 'litespeed-cache' ); ?>
|
||||
</div>
|
||||
|
||||
<h3 class="litespeed-title">
|
||||
<?php esc_html_e( 'Reset All Settings', 'litespeed-cache' ); ?>
|
||||
</h3>
|
||||
|
||||
<div>
|
||||
<p class="litespeed-danger">🚨 <?php esc_html_e( 'This will reset all settings to default settings.', 'litespeed-cache' ); ?></p>
|
||||
</div>
|
||||
<div>
|
||||
<a href="<?php echo esc_url( Utility::build_url( Router::ACTION_IMPORT, Import::TYPE_RESET ) ); ?>" data-litespeed-cfm="<?php echo esc_attr( __( 'Are you sure you want to reset all settings back to the default settings?', 'litespeed-cache' ) ); ?>" class="button litespeed-btn-danger-bg">
|
||||
<?php esc_html_e( 'Reset Settings', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
</div>
|
||||
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Log Viewer
|
||||
*
|
||||
* Renders the log viewer interface for LiteSpeed Cache, displaying debug, purge, and crawler logs with options to copy or clear logs.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 4.7
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
$logs = array(
|
||||
array(
|
||||
'name' => 'debug',
|
||||
'label' => esc_html__( 'Debug Log', 'litespeed-cache' ),
|
||||
'accesskey' => 'A',
|
||||
),
|
||||
array(
|
||||
'name' => 'purge',
|
||||
'label' => esc_html__( 'Purge Log', 'litespeed-cache' ),
|
||||
'accesskey' => 'B',
|
||||
),
|
||||
array(
|
||||
'name' => 'crawler',
|
||||
'label' => esc_html__( 'Crawler Log', 'litespeed-cache' ),
|
||||
'accesskey' => 'C',
|
||||
),
|
||||
);
|
||||
?>
|
||||
|
||||
<h3 class="litespeed-title">
|
||||
<?php esc_html_e( 'LiteSpeed Logs', 'litespeed-cache' ); ?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/toolbox/#log-view-tab' ); ?>
|
||||
</h3>
|
||||
|
||||
<div class="litespeed-log-subnav-wrapper">
|
||||
<?php foreach ( $logs as $log ) : ?>
|
||||
<a href="#<?php echo esc_attr( $log['name'] ); ?>_log" class="button button-secondary" data-litespeed-subtab="<?php echo esc_attr( $log['name'] ); ?>_log" litespeed-accesskey="<?php echo esc_attr( $log['accesskey'] ); ?>">
|
||||
<?php echo esc_html( $log['label'] ); ?>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
<a href="<?php echo esc_url( Utility::build_url( Router::ACTION_DEBUG2, Debug2::TYPE_CLEAR_LOG ) ); ?>" class="button button-primary" litespeed-accesskey="D">
|
||||
<?php esc_html_e( 'Clear Logs', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
foreach ( $logs as $log ) :
|
||||
$file = $this->cls( 'Debug2' )->path( $log['name'] );
|
||||
$lines = File::count_lines( $file );
|
||||
$max_lines = apply_filters( 'litespeed_debug_show_max_lines', 1000 );
|
||||
$start = $lines > $max_lines ? $lines - $max_lines : 0;
|
||||
$lines = File::read( $file, $start );
|
||||
$lines = $lines ? trim( implode( "\n", $lines ) ) : '';
|
||||
|
||||
$log_body_id = 'litespeed-log-' . esc_attr( $log['name'] );
|
||||
?>
|
||||
<div class="litespeed-log-view-wrapper" data-litespeed-sublayout="<?php echo esc_attr( $log['name'] ); ?>_log">
|
||||
<h3 class="litespeed-title">
|
||||
<?php echo esc_html( $log['label'] ); ?>
|
||||
<a href="#<?php echo esc_attr( $log['name'] ); ?>_log" class="button litespeed-info-button litespeed-wrap" onClick="litespeed_copy_to_clipboard('<?php echo esc_js( $log_body_id ); ?>', this)" aria-label="<?php esc_attr_e( 'Click to copy', 'litespeed-cache' ); ?>" data-balloon-pos="down">
|
||||
<?php esc_html_e( 'Copy Log', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
</h3>
|
||||
<div class="litespeed-log-body" id="<?php echo esc_attr( $log_body_id ); ?>">
|
||||
<?php echo nl2br( esc_html( $lines ) ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<a href="<?php echo esc_url( Utility::build_url( Router::ACTION_DEBUG2, Debug2::TYPE_CLEAR_LOG ) ); ?>" class="button button-primary">
|
||||
<?php esc_html_e( 'Clear Logs', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
@@ -0,0 +1,279 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Purge Interface
|
||||
*
|
||||
* Renders the purge interface for LiteSpeed Cache, allowing users to clear various cache types and purge specific content.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
$_panels = array(
|
||||
array(
|
||||
'title' => esc_html__( 'Purge Front Page', 'litespeed-cache' ),
|
||||
'desc' => esc_html__( 'This will Purge Front Page only', 'litespeed-cache' ),
|
||||
'icon' => 'purge-front',
|
||||
'append_url' => Purge::TYPE_PURGE_FRONTPAGE,
|
||||
),
|
||||
array(
|
||||
'title' => esc_html__( 'Purge Pages', 'litespeed-cache' ),
|
||||
'desc' => esc_html__( 'This will Purge Pages only', 'litespeed-cache' ),
|
||||
'icon' => 'purge-pages',
|
||||
'append_url' => Purge::TYPE_PURGE_PAGES,
|
||||
),
|
||||
);
|
||||
|
||||
foreach ( Tag::$error_code_tags as $code ) {
|
||||
$_panels[] = array(
|
||||
'title' => sprintf( esc_html__( 'Purge %s Error', 'litespeed-cache' ), esc_html( $code ) ),
|
||||
'desc' => sprintf( esc_html__( 'Purge %s error pages', 'litespeed-cache' ), esc_html( $code ) ),
|
||||
'icon' => 'purge-' . esc_attr( $code ),
|
||||
'append_url' => Purge::TYPE_PURGE_ERROR . esc_attr( $code ),
|
||||
);
|
||||
}
|
||||
|
||||
$_panels[] = array(
|
||||
'title' => esc_html__( 'Purge All', 'litespeed-cache' ) . ' - LSCache',
|
||||
'desc' => esc_html__( 'Purge the LiteSpeed cache entries created by this plugin', 'litespeed-cache' ),
|
||||
'icon' => 'purge-all',
|
||||
'append_url' => Purge::TYPE_PURGE_ALL_LSCACHE,
|
||||
);
|
||||
|
||||
$_panels[] = array(
|
||||
'title' => esc_html__( 'Purge All', 'litespeed-cache' ) . ' - ' . esc_html__( 'CSS/JS Cache', 'litespeed-cache' ),
|
||||
'desc' => esc_html__( 'This will purge all minified/combined CSS/JS entries only', 'litespeed-cache' ),
|
||||
'icon' => 'purge-cssjs',
|
||||
'append_url' => Purge::TYPE_PURGE_ALL_CSSJS,
|
||||
);
|
||||
|
||||
if ( defined( 'LSCWP_OBJECT_CACHE' ) ) {
|
||||
$_panels[] = array(
|
||||
'title' => esc_html__( 'Purge All', 'litespeed-cache' ) . ' - ' . esc_html__( 'Object Cache', 'litespeed-cache' ),
|
||||
'desc' => esc_html__( 'Purge all the object caches', 'litespeed-cache' ),
|
||||
'icon' => 'purge-object',
|
||||
'append_url' => Purge::TYPE_PURGE_ALL_OBJECT,
|
||||
);
|
||||
}
|
||||
|
||||
if ( Router::opcache_enabled() ) {
|
||||
$_panels[] = array(
|
||||
'title' => esc_html__( 'Purge All', 'litespeed-cache' ) . ' - ' . esc_html__( 'Opcode Cache', 'litespeed-cache' ),
|
||||
'desc' => esc_html__( 'Reset the entire opcode cache', 'litespeed-cache' ),
|
||||
'icon' => 'purge-opcache',
|
||||
'append_url' => Purge::TYPE_PURGE_ALL_OPCACHE,
|
||||
);
|
||||
}
|
||||
|
||||
if ( $this->has_cache_folder( 'ccss' ) ) {
|
||||
$_panels[] = array(
|
||||
'title' => esc_html__( 'Purge All', 'litespeed-cache' ) . ' - ' . esc_html__( 'Critical CSS', 'litespeed-cache' ),
|
||||
'desc' => esc_html__( 'This will delete all generated critical CSS files', 'litespeed-cache' ),
|
||||
'icon' => 'purge-cssjs',
|
||||
'append_url' => Purge::TYPE_PURGE_ALL_CCSS,
|
||||
);
|
||||
}
|
||||
|
||||
if ( $this->has_cache_folder( 'ucss' ) ) {
|
||||
$_panels[] = array(
|
||||
'title' => esc_html__( 'Purge All', 'litespeed-cache' ) . ' - ' . esc_html__( 'Unique CSS', 'litespeed-cache' ),
|
||||
'desc' => esc_html__( 'This will delete all generated unique CSS files', 'litespeed-cache' ),
|
||||
'icon' => 'purge-cssjs',
|
||||
'append_url' => Purge::TYPE_PURGE_ALL_UCSS,
|
||||
);
|
||||
}
|
||||
|
||||
if ( $this->has_cache_folder( 'localres' ) ) {
|
||||
$_panels[] = array(
|
||||
'title' => esc_html__( 'Purge All', 'litespeed-cache' ) . ' - ' . esc_html__( 'Localized Resources', 'litespeed-cache' ),
|
||||
'desc' => esc_html__( 'This will delete all localized resources', 'litespeed-cache' ),
|
||||
'icon' => 'purge-cssjs',
|
||||
'append_url' => Purge::TYPE_PURGE_ALL_LOCALRES,
|
||||
);
|
||||
}
|
||||
|
||||
if ( $this->has_cache_folder( 'lqip' ) ) {
|
||||
$_panels[] = array(
|
||||
'title' => esc_html__( 'Purge All', 'litespeed-cache' ) . ' - ' . esc_html__( 'LQIP Cache', 'litespeed-cache' ),
|
||||
'desc' => esc_html__( 'This will delete all generated image LQIP placeholder files', 'litespeed-cache' ),
|
||||
'icon' => 'purge-front',
|
||||
'append_url' => Purge::TYPE_PURGE_ALL_LQIP,
|
||||
);
|
||||
}
|
||||
|
||||
if ( $this->has_cache_folder( 'vpi' ) ) {
|
||||
$_panels[] = array(
|
||||
'title' => __( 'Purge All', 'litespeed-cache' ) . ' - VPI',
|
||||
'desc' => __( 'This will delete all generated Viewport Images', 'litespeed-cache' ),
|
||||
'icon' => 'purge-front',
|
||||
'append_url' => Purge::TYPE_PURGE_ALL_VPI,
|
||||
);
|
||||
}
|
||||
|
||||
if ( $this->has_cache_folder( 'avatar' ) ) {
|
||||
$_panels[] = array(
|
||||
'title' => esc_html__( 'Purge All', 'litespeed-cache' ) . ' - ' . esc_html__( 'Gravatar Cache', 'litespeed-cache' ),
|
||||
'desc' => esc_html__( 'This will delete all cached Gravatar files', 'litespeed-cache' ),
|
||||
'icon' => 'purge-cssjs',
|
||||
'append_url' => Purge::TYPE_PURGE_ALL_AVATAR,
|
||||
);
|
||||
}
|
||||
|
||||
$_panels[] = array(
|
||||
'title' => esc_html__( 'Purge All', 'litespeed-cache' ),
|
||||
'desc' => esc_html__( 'Purge the cache entries created by this plugin except for Critical CSS & Unique CSS & LQIP caches', 'litespeed-cache' ),
|
||||
'icon' => 'purge-all',
|
||||
'title_cls' => 'litespeed-warning',
|
||||
'newline' => true,
|
||||
'append_url' => Purge::TYPE_PURGE_ALL,
|
||||
);
|
||||
|
||||
if ( ! is_multisite() || is_network_admin() ) {
|
||||
$_panels[] = array(
|
||||
'title' => esc_html__( 'Empty Entire Cache', 'litespeed-cache' ),
|
||||
'desc' => esc_html__( 'Clears all cache entries related to this site, including other web applications.', 'litespeed-cache' ) . ' <b>' . esc_html__( 'This action should only be used if things are cached incorrectly.', 'litespeed-cache' ) . '</b>',
|
||||
'tag' => Core::ACTION_PURGE_EMPTYCACHE,
|
||||
'icon' => 'empty-cache',
|
||||
'title_cls' => 'litespeed-danger',
|
||||
'cfm' => esc_html__( 'This will clear EVERYTHING inside the cache.', 'litespeed-cache' ) . ' ' . esc_html__( 'This may cause heavy load on the server.', 'litespeed-cache' ) . ' ' . esc_html__( 'If only the WordPress site should be purged, use Purge All.', 'litespeed-cache' ),
|
||||
);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<?php require_once LSCWP_DIR . 'tpl/inc/check_cache_disabled.php'; ?>
|
||||
|
||||
<h3 class="litespeed-title">
|
||||
<?php esc_html_e( 'Purge', 'litespeed-cache' ); ?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/toolbox/#purge-tab' ); ?>
|
||||
</h3>
|
||||
|
||||
<div class="litespeed-panel-wrapper litespeed-cards-wrapper">
|
||||
<?php foreach ( $_panels as $panel ) : ?>
|
||||
<?php
|
||||
$action_tag = ! empty( $panel['tag'] ) ? $panel['tag'] : Router::ACTION_PURGE;
|
||||
$append_url = ! empty( $panel['append_url'] ) ? $panel['append_url'] : false;
|
||||
$cfm = ! empty( $panel['cfm'] ) ? Str::trim_quotes( $panel['cfm'] ) : false;
|
||||
?>
|
||||
<?php if ( ! empty( $panel['newline'] ) ) : ?>
|
||||
<div class="litespeed-col-br"></div>
|
||||
<?php endif; ?>
|
||||
<a class="litespeed-panel postbox" href="<?php echo esc_url( Utility::build_url( $action_tag, $append_url ) ); ?>" data-litespeed-cfm="<?php echo esc_attr( $cfm ); ?>">
|
||||
<section class="litespeed-panel-wrapper-icon">
|
||||
<span class="litespeed-panel-icon-<?php echo esc_attr( $panel['icon'] ); ?>"></span>
|
||||
</section>
|
||||
<section class="litespeed-panel-content">
|
||||
<div class="litespeed-h3 <?php echo ! empty( $panel['title_cls'] ) ? esc_attr( $panel['title_cls'] ) : ''; ?>">
|
||||
<?php echo esc_html( $panel['title'] ); ?>
|
||||
</div>
|
||||
<span class="litespeed-panel-para"><?php echo wp_kses_post( $panel['desc'] ); ?></span>
|
||||
</section>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
if ( is_multisite() && is_network_admin() ) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
|
||||
<h3 class="litespeed-title">
|
||||
<?php esc_html_e( 'Purge By...', 'litespeed-cache' ); ?>
|
||||
</h3>
|
||||
<p class="litespeed-description">
|
||||
<?php esc_html_e( 'Select below for "Purge by" options.', 'litespeed-cache' ); ?>
|
||||
<?php Doc::one_per_line(); ?>
|
||||
</p>
|
||||
|
||||
<?php $this->form_action( Core::ACTION_PURGE_BY ); ?>
|
||||
<div class="litespeed-row">
|
||||
<div class="litespeed-switch litespeed-mini litespeed-right20 litespeed-margin-bottom10">
|
||||
<?php $val = Admin_Display::PURGEBY_CAT; ?>
|
||||
<input type="radio" autocomplete="off" name="<?php echo esc_attr( Admin_Display::PURGEBYOPT_SELECT ); ?>" id="purgeby_option_category" value="<?php echo esc_attr( $val ); ?>" checked />
|
||||
<label for="purgeby_option_category"><?php esc_html_e( 'Category', 'litespeed-cache' ); ?></label>
|
||||
|
||||
<?php $val = Admin_Display::PURGEBY_PID; ?>
|
||||
<input type="radio" autocomplete="off" name="<?php echo esc_attr( Admin_Display::PURGEBYOPT_SELECT ); ?>" id="purgeby_option_postid" value="<?php echo esc_attr( $val ); ?>" />
|
||||
<label for="purgeby_option_postid"><?php esc_html_e( 'Post ID', 'litespeed-cache' ); ?></label>
|
||||
|
||||
<?php $val = Admin_Display::PURGEBY_TAG; ?>
|
||||
<input type="radio" autocomplete="off" name="<?php echo esc_attr( Admin_Display::PURGEBYOPT_SELECT ); ?>" id="purgeby_option_tag" value="<?php echo esc_attr( $val ); ?>" />
|
||||
<label for="purgeby_option_tag"><?php esc_html_e( 'Tag', 'litespeed-cache' ); ?></label>
|
||||
|
||||
<?php $val = Admin_Display::PURGEBY_URL; ?>
|
||||
<input type="radio" autocomplete="off" name="<?php echo esc_attr( Admin_Display::PURGEBYOPT_SELECT ); ?>" id="purgeby_option_url" value="<?php echo esc_attr( $val ); ?>" />
|
||||
<label for="purgeby_option_url"><?php esc_html_e( 'URL', 'litespeed-cache' ); ?></label>
|
||||
</div>
|
||||
|
||||
<div class="litespeed-cache-purgeby-text litespeed-desc">
|
||||
<div class="" data-purgeby="<?php echo esc_attr( Admin_Display::PURGEBY_CAT ); ?>">
|
||||
<?php printf( esc_html__( 'Purge pages by category name - e.g. %2$s should be used for the URL %1$s.', 'litespeed-cache' ), '<code>http://example.com/category/category-name/</code>', '<code>category-name</code>' ); ?>
|
||||
</div>
|
||||
<div class="litespeed-hide" data-purgeby="<?php echo esc_attr( Admin_Display::PURGEBY_PID ); ?>">
|
||||
<?php esc_html_e( 'Purge pages by post ID.', 'litespeed-cache' ); ?>
|
||||
</div>
|
||||
<div class="litespeed-hide" data-purgeby="<?php echo esc_attr( Admin_Display::PURGEBY_TAG ); ?>">
|
||||
<?php printf( esc_html__( 'Purge pages by tag name - e.g. %2$s should be used for the URL %1$s.', 'litespeed-cache' ), '<code>http://example.com/tag/tag-name/</code>', '<code>tag-name</code>' ); ?>
|
||||
</div>
|
||||
<div class="litespeed-hide" data-purgeby="<?php echo esc_attr( Admin_Display::PURGEBY_URL ); ?>">
|
||||
<?php esc_html_e( 'Purge pages by relative or full URL.', 'litespeed-cache' ); ?>
|
||||
<?php printf( esc_html__( 'e.g. Use %1$s or %2$s.', 'litespeed-cache' ), '<code>/2016/02/24/hello-world/</code>', '<code>http://example.com/2016/02/24/hello-world/</code>' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
<textarea name="<?php echo esc_attr( Admin_Display::PURGEBYOPT_LIST ); ?>" rows="5" class="litespeed-textarea"></textarea>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<button type="submit" class="button button-primary"><?php esc_html_e( 'Purge List', 'litespeed-cache' ); ?></button>
|
||||
</p>
|
||||
</form>
|
||||
<script>
|
||||
(function ($) {
|
||||
function setCookie(name, value, days) {
|
||||
var expires = "";
|
||||
if (days) {
|
||||
var date = new Date();
|
||||
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
|
||||
expires = "; expires=" + date.toUTCString();
|
||||
}
|
||||
document.cookie = name + "=" + (value || "") + expires + "; path=/; SameSite=Strict";
|
||||
}
|
||||
|
||||
function getCookie(name) {
|
||||
var nameEQ = name + "=";
|
||||
var ca = document.cookie.split(';');
|
||||
for (var i = 0; i < ca.length; i++) {
|
||||
var c = ca[i];
|
||||
while (c.charAt(0) == ' ') {
|
||||
c = c.substring(1, c.length);
|
||||
}
|
||||
if (c.indexOf(nameEQ) == 0) {
|
||||
return c.substring(nameEQ.length, c.length);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
jQuery(document).ready(function () {
|
||||
var savedPurgeBy = getCookie('litespeed_purgeby_option');
|
||||
if (savedPurgeBy) {
|
||||
$('input[name="<?php echo esc_attr( Admin_Display::PURGEBYOPT_SELECT ); ?>"][value="' + savedPurgeBy + '"]').prop('checked', true);
|
||||
$('[data-purgeby]').addClass('litespeed-hide');
|
||||
$('[data-purgeby="' + savedPurgeBy + '"]').removeClass('litespeed-hide');
|
||||
}
|
||||
// Manage page -> purge by
|
||||
$('[name=purgeby]').on('change', function (event) {
|
||||
$('[data-purgeby]').addClass('litespeed-hide');
|
||||
$('[data-purgeby=' + this.value + ']').removeClass('litespeed-hide');
|
||||
setCookie('litespeed_purgeby_option', this.value, 30);
|
||||
});
|
||||
});
|
||||
})(jQuery);
|
||||
</script>
|
||||
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Report Interface
|
||||
*
|
||||
* Renders the report interface for LiteSpeed Cache, allowing users to generate and send environment reports to LiteSpeed Support.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
$_report = Report::cls();
|
||||
$report = $_report->generate_environment_report();
|
||||
|
||||
$env_ref = Report::get_summary();
|
||||
|
||||
// Detect passwordless plugin
|
||||
$dologin_link = '';
|
||||
$has_pswdless_plugin = false;
|
||||
if ( function_exists( 'dologin_gen_link' ) ) {
|
||||
$has_pswdless_plugin = true;
|
||||
if ( ! empty( $_GET['dologin_gen_link'] ) && ! empty( $_GET['litespeed_purge_nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['litespeed_purge_nonce'] ) ), 'litespeed_purge_action' ) ) {
|
||||
unset( $_GET['dologin_gen_link'] );
|
||||
$dologin_link = dologin_gen_link( 'Litespeed Report' );
|
||||
?>
|
||||
<script>
|
||||
window.history.pushState('remove_gen_link', document.title, window.location.href.replace('&dologin_gen_link=1', ''));
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
$install_link = Utility::build_url( Router::ACTION_ACTIVATION, Activation::TYPE_INSTALL_3RD, false, null, array( 'plugin' => 'dologin' ) );
|
||||
|
||||
$btn_title = esc_html__( 'Send to LiteSpeed', 'litespeed-cache' );
|
||||
if ( ! empty( $env_ref['num'] ) ) {
|
||||
$btn_title = esc_html__( 'Regenerate and Send a New Report', 'litespeed-cache' );
|
||||
}
|
||||
?>
|
||||
|
||||
<?php if ( ! $has_pswdless_plugin ) : ?>
|
||||
<div class="litespeed-callout notice notice-warning inline">
|
||||
<h4><?php esc_html_e( 'NOTICE:', 'litespeed-cache' ); ?></h4>
|
||||
<p>
|
||||
<?php printf( esc_html__( 'To generate a passwordless link for LiteSpeed Support Team access, you must install %s.', 'litespeed-cache' ), '<a href="https://wordpress.org/plugins/dologin/" target="_blank">DoLogin Security</a>' ); ?>
|
||||
</p>
|
||||
<p>
|
||||
<a href="<?php echo esc_url( $install_link ); ?>" class="button litespeed-btn litespeed-right20"><?php esc_html_e( 'Install DoLogin Security', 'litespeed-cache' ); ?></a>
|
||||
<a href="<?php echo esc_url( admin_url( 'plugin-install.php?s=dologin+security&tab=search&type=term' ) ); ?>" target="_blank"><?php esc_html_e( 'Go to plugins list', 'litespeed-cache' ); ?></a>
|
||||
</p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<h3 class="litespeed-title">
|
||||
<?php esc_html_e( 'LiteSpeed Report', 'litespeed-cache' ); ?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/toolbox/#report-tab' ); ?>
|
||||
</h3>
|
||||
|
||||
<p><?php esc_html_e( 'Last Report Number', 'litespeed-cache' ); ?>: <b><?php echo ! empty( $env_ref['num'] ) ? '<span id="report_span" style="cursor: pointer;" onClick="litespeed_copy_to_clipboard(\'report_span\', this)" aria-label="' . esc_attr__( 'Click to copy', 'litespeed-cache' ) . '" data-balloon-pos="down" class="litespeed-wrap">' . esc_html( $env_ref['num'] ) . '</span>' : '-'; ?></b></p>
|
||||
<p><?php esc_html_e( 'Last Report Date', 'litespeed-cache' ); ?>: <b><?php echo ! empty( $env_ref['dateline'] ) ? esc_html( gmdate( 'm/d/Y H:i:s', $env_ref['dateline'] ) ) : '-'; ?></b></p>
|
||||
|
||||
<p class="litespeed-desc">
|
||||
<?php esc_html_e( 'The environment report contains detailed information about the WordPress configuration.', 'litespeed-cache' ); ?>
|
||||
<br />
|
||||
<?php esc_html_e( 'If you run into any issues, please refer to the report number in your support message.', 'litespeed-cache' ); ?>
|
||||
</p>
|
||||
|
||||
<?php $this->form_action( Router::ACTION_REPORT, Report::TYPE_SEND_REPORT ); ?>
|
||||
<table class="wp-list-table striped litespeed-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th><?php esc_html_e( 'System Information', 'litespeed-cache' ); ?></th>
|
||||
<td>
|
||||
<textarea id="litespeed-report" rows="20" cols="100" readonly><?php echo esc_textarea( $report ); ?></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th></th>
|
||||
<td>
|
||||
<?php
|
||||
$this->build_checkbox(
|
||||
'attach_php',
|
||||
sprintf(
|
||||
esc_html__( 'Attach PHP info to report. Check this box to insert relevant data from %s.', 'litespeed-cache' ),
|
||||
'<a href="https://www.php.net/manual/en/function.phpinfo.php" target="_blank">phpinfo()</a>'
|
||||
),
|
||||
false
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php esc_html_e( 'Passwordless Link', 'litespeed-cache' ); ?></th>
|
||||
<td>
|
||||
<input type="text" class="litespeed-regular-text" id="litespeed-report-link" name="link" value="<?php echo esc_attr( $dologin_link ); ?>" style="width:500px;" />
|
||||
<?php if ( $has_pswdless_plugin ) : ?>
|
||||
<a href="<?php echo esc_url( wp_nonce_url( admin_url( 'admin.php?page=litespeed-toolbox&dologin_gen_link=1' ), 'litespeed_purge_action', 'litespeed_purge_nonce' ) ); ?>" class="button button-secondary"><?php esc_html_e( 'Generate Link for Current User', 'litespeed-cache' ); ?></a>
|
||||
<?php else : ?>
|
||||
<button type="button" class="button button-secondary" disabled><?php esc_html_e( 'Generate Link for Current User', 'litespeed-cache' ); ?></button>
|
||||
<?php endif; ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'To grant wp-admin access to the LiteSpeed Support Team, please generate a passwordless link for the current logged-in user to be sent with the report.', 'litespeed-cache' ); ?>
|
||||
<?php if ( $dologin_link ) : ?>
|
||||
<br /><strong>🚨 <?php esc_html_e( 'Please do NOT share the above passwordless link with anyone.', 'litespeed-cache' ); ?></strong>
|
||||
<strong>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: Link tags */
|
||||
esc_html__( 'Generated links may be managed under %sSettings%s.', 'litespeed-cache' ),
|
||||
'<a href="' . esc_url( menu_page_url( 'dologin', false ) ) . '#pswdless">',
|
||||
'</a>' );
|
||||
?>
|
||||
</strong>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php esc_html_e( 'Notes', 'litespeed-cache' ); ?></th>
|
||||
<td>
|
||||
<textarea name="notes" rows="10" cols="100"></textarea>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Optional', 'litespeed-cache' ); ?>:
|
||||
<?php esc_html_e( 'provide more information here to assist the LiteSpeed team with debugging.', 'litespeed-cache' ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="litespeed-top20"></div>
|
||||
<button class="button button-primary" type="submit"><?php echo esc_html( $btn_title ); ?></button>
|
||||
<button class="button button-primary litespeed-float-submit" type="submit"><?php echo esc_html( $btn_title ); ?></button>
|
||||
|
||||
<p class="litespeed-top30 litespeed-left10 litespeed-desc">
|
||||
<?php esc_html_e( 'Send this report to LiteSpeed. Refer to this report number when posting in the WordPress support forum.', 'litespeed-cache' ); ?>
|
||||
</p>
|
||||
</form>
|
||||
@@ -0,0 +1,196 @@
|
||||
<?php
|
||||
/**
|
||||
* LiteSpeed Cache Debug Settings Interface
|
||||
*
|
||||
* Renders the debug settings interface for LiteSpeed Cache, allowing users to configure debugging options and view the site with specific settings bypassed.
|
||||
*
|
||||
* @package LiteSpeed
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
namespace LiteSpeed;
|
||||
|
||||
defined( 'WPINC' ) || exit;
|
||||
|
||||
$this->form_action( $this->_is_network_admin ? Router::ACTION_SAVE_SETTINGS_NETWORK : false );
|
||||
?>
|
||||
|
||||
<h3 class="litespeed-title-short">
|
||||
<?php esc_html_e( 'Debug Helpers', 'litespeed-cache' ); ?>
|
||||
</h3>
|
||||
|
||||
<a href="<?php echo esc_url( home_url( '/' ) . '?' . Router::ACTION . '=before_optm' ); ?>" class="button button-success" target="_blank">
|
||||
<?php esc_html_e( 'View Site Before Optimization', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
|
||||
<a href="<?php echo esc_url( home_url( '/' ) . '?' . Router::ACTION . '=' . Core::ACTION_QS_NOCACHE ); ?>" class="button button-success" target="_blank">
|
||||
<?php esc_html_e( 'View Site Before Cache', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
|
||||
|
||||
<?php
|
||||
$temp_disabled_time = $this->conf( Base::DEBUG_TMP_DISABLE );
|
||||
$temp_disabled = Debug2::is_tmp_disable();
|
||||
if ( !$temp_disabled ) {
|
||||
?>
|
||||
<a href="<?php echo wp_kses_post( Utility::build_url(Router::ACTION_TMP_DISABLE, false, false, '_ori') ); ?>" class="button litespeed-btn-danger">
|
||||
<?php esc_html_e( 'Disable All Features for 24 Hours', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
<?php
|
||||
} else {
|
||||
$date = wp_date( get_option('date_format') . ' ' . get_option( 'time_format' ), $temp_disabled_time );
|
||||
?>
|
||||
<a href="<?php echo wp_kses_post( Utility::build_url(Router::ACTION_TMP_DISABLE, false, false, '_ori') ); ?>" class="button litespeed-btn-warning">
|
||||
<?php esc_html_e( 'Remove `Disable All Feature` Flag Now', 'litespeed-cache' ); ?>
|
||||
</a>
|
||||
<div class="litespeed-callout notice notice-warning inline">
|
||||
<h4><?php esc_html_e( 'NOTICE', 'litespeed-cache' ); ?></h4>
|
||||
<p><?php echo wp_kses_post( sprintf ( __( 'LiteSpeed Cache is temporarily disabled until: %s.', 'litespeed-cache' ), '<strong>' . $date . '</strong>' ) ); ?></p>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<h3 class="litespeed-title-short">
|
||||
<?php esc_html_e( 'Debug Settings', 'litespeed-cache' ); ?>
|
||||
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/toolbox/#debug-settings-tab' ); ?>
|
||||
</h3>
|
||||
|
||||
<table class="wp-list-table striped litespeed-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_DEBUG_DISABLE_ALL; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_switch( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'This will disable LSCache and all optimization features for debug purpose.', 'litespeed-cache' ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_DEBUG; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_switch( $option_id, array( esc_html__( 'OFF', 'litespeed-cache' ), esc_html__( 'ON', 'litespeed-cache' ), esc_html__( 'Admin IP Only', 'litespeed-cache' ) ) ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php printf( esc_html__( 'Outputs to a series of files in the %s directory.', 'litespeed-cache' ), '<code>wp-content/litespeed/debug</code>' ); ?>
|
||||
<?php esc_html_e( 'To prevent filling up the disk, this setting should be OFF when everything is working.', 'litespeed-cache' ); ?>
|
||||
<?php esc_html_e( 'The Admin IP option will only output log messages on requests from admin IPs listed below.', 'litespeed-cache' ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_DEBUG_IPS; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_textarea( $option_id, 50 ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Allows listed IPs (one per line) to perform certain actions from their browsers.', 'litespeed-cache' ); ?>
|
||||
<?php esc_html_e( 'Your IP', 'litespeed-cache' ); ?>: <code><?php echo esc_html( Router::get_ip() ); ?></code>
|
||||
<?php $this->_validate_ip( $option_id ); ?>
|
||||
<br />
|
||||
<?php
|
||||
Doc::learn_more(
|
||||
'https://docs.litespeedtech.com/lscache/lscwp/admin/#admin-ip-commands',
|
||||
esc_html__( 'More information about the available commands can be found here.', 'litespeed-cache' )
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_DEBUG_LEVEL; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_switch( $option_id, array( esc_html__( 'Basic', 'litespeed-cache' ), esc_html__( 'Advanced', 'litespeed-cache' ) ) ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Advanced level will log more details.', 'litespeed-cache' ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_DEBUG_FILESIZE; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_input( $option_id, 'litespeed-input-short' ); ?> <?php esc_html_e( 'MB', 'litespeed-cache' ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Specify the maximum size of the log file.', 'litespeed-cache' ); ?>
|
||||
<?php $this->recommended( $option_id ); ?>
|
||||
<?php $this->_validate_ttl( $option_id, 3, 3000 ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_DEBUG_COLLAPSE_QS; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_switch( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Shorten query strings in the debug log to improve readability.', 'litespeed-cache' ); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_DEBUG_INC; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_textarea( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Only log listed pages.', 'litespeed-cache' ); ?>
|
||||
<?php $this->_uri_usage_example(); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_DEBUG_EXC; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_textarea( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Prevent any debug log of listed pages.', 'litespeed-cache' ); ?>
|
||||
<?php $this->_uri_usage_example(); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<?php $option_id = Base::O_DEBUG_EXC_STRINGS; ?>
|
||||
<?php $this->title( $option_id ); ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php $this->build_textarea( $option_id ); ?>
|
||||
<div class="litespeed-desc">
|
||||
<?php esc_html_e( 'Prevent writing log entries that include listed strings.', 'litespeed-cache' ); ?>
|
||||
<?php Doc::one_per_line(); ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php $this->form_end(); ?>
|
||||
Reference in New Issue
Block a user