initial commit

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

View File

@@ -0,0 +1,270 @@
<?php
namespace LiteSpeed;
defined('WPINC') || exit;
$__cdnsetup = Cdn_Setup::cls();
// This will drop QS param `qc_res` `domain_hash` and `token` also
$__cdnsetup->maybe_extract_token();
$cloud_linked = Cloud::get_summary('is_linked');
$setup_summary = Cdn_Setup::get_summary();
$cdn_setup_done_ts = 0;
if (!empty($setup_summary['cdn_setup_done_ts'])) {
$cdn_setup_done_ts = $setup_summary['cdn_setup_done_ts'];
}
$has_setup_token = $__cdnsetup->has_cdn_setup_token();
if (!empty($setup_summary['cdn_setup_ts'])) {
$cdn_setup_ts = $setup_summary['cdn_setup_ts'];
if (!empty($setup_summary['cdn_setup_err'])) {
$cdn_setup_err = $setup_summary['cdn_setup_err'];
}
if ($this->conf(Base::O_QC_NAMESERVERS)) {
$nameservers = explode(',', $this->conf(Base::O_QC_NAMESERVERS));
}
} else {
$cdn_setup_ts = 0;
}
$curr_status = '<span class="litespeed-desc">' . __('Not running', 'litespeed-cache') . '</span>';
$apply_btn_txt = __('Run CDN Setup', 'litespeed-cache');
$apply_btn_type = Cdn_Setup::TYPE_RUN;
$disabled = '';
$dom = parse_url(home_url(), PHP_URL_HOST);
if ($cdn_setup_done_ts) {
$curr_status = '<span class="litespeed-success dashicons dashicons-yes"></span> '
. __('Done', 'litespeed-cache')
. ' <span class="litespeed-desc litespeed-left10">'
. sprintf(__('Completed at %s', 'litespeed-cache'), wp_date(get_option('date_format') . ' ' . get_option('time_format'), $cdn_setup_done_ts))
. '</span>';
$disabled = 'disabled';
} else if (!$has_setup_token) {
$disabled = 'disabled';
} else if (!empty($cdn_setup_err)) {
$curr_status = '<span class="litespeed-warning dashicons dashicons-controls-pause"></span> ' . __('Paused', 'litespeed-cache');
$curr_status_subline = '<p class="litespeed-desc">' . $cdn_setup_err . '</p>';
} else if ($cdn_setup_ts > 0) {
if (isset($nameservers)) {
$curr_status = '<span class="litespeed-primary dashicons dashicons-hourglass"></span> ' . __('Verifying, waiting for nameservers to be updated.', 'litespeed-cache') . ' ' . __('Click the refresh button below to refresh status.', 'litespeed-cache');
if (isset($setup_summary['cdn_verify_msg'])) {
$curr_status_subline = '<p class="litespeed-desc">' . __('Last Verification Result', 'litespeed-cache') . ': ' . $setup_summary['cdn_verify_msg'] . '</p>';
}
} else {
$curr_status = '<span class="litespeed-primary dashicons dashicons-hourglass"></span> ' . __('In Progress', 'litespeed-cache');
$curr_status_subline = '<p class="litespeed-desc">' . __('You will receive an email upon status update.', 'litespeed-cache') . ' ' . __('This process may take several minutes.', 'litespeed-cache') . '</p>';
}
$apply_btn_txt = __('Refresh CDN Setup Status', 'litespeed-cache');
$apply_btn_type = Cdn_Setup::TYPE_STATUS;
}
?>
<h3 class="litespeed-title">
<?php echo __('Auto QUIC.cloud CDN Setup', 'litespeed-cache'); ?>
</h3>
<p>
<?php echo __('This is a three step process for configuring your site to use QUIC.cloud CDN with QUIC.cloud DNS. This setup will perform the following actions', 'litespeed-cache') . ':'; ?>
</p>
<ol>
<li><?php echo __('Set up a QUIC.cloud account.', 'litespeed-cache'); ?></li>
<li><?php echo __('Prepare the site for QUIC.cloud CDN, detect the DNS, and create a DNS Zone.', 'litespeed-cache'); ?></li>
<li><?php echo __('Provide the nameservers necessary to enable the CDN.', 'litespeed-cache'); ?></li>
<li>
<?php echo __('After successful DNS detection, QUIC.cloud will attempt to generate an SSL certificate and enable the CDN.', 'litespeed-cache'); ?>
<?php echo __('This last stage could take 15 to 20 minutes.', 'litespeed-cache'); ?>
<?php echo __('Your site will be available, but browsers may issue a "not secure" warning during this time.', 'litespeed-cache'); ?>
</li>
</ol>
<p>
<?php echo __('After you set your nameservers, QUIC.cloud will detect the change and automatically enable the CDN.', 'litespeed-cache'); ?>
</p>
<p class="litespeed-desc">
<?php echo __('Notes', 'litespeed-cache') . ':'; ?>
</p>
<ul class="litespeed-desc">
<li>
<?php echo __('QUIC.cloud CDN/DNS does not support DNSSEC.', 'litespeed-cache'); ?>
<?php echo __('If you have this enabled for your domain, you must disable DNSSEC to continue.', 'litespeed-cache'); ?>
</li>
<li>
<?php echo __('This setup process will create a DNS zone on QUIC.cloud if one does not currently exist.', 'litespeed-cache'); ?>
<?php printf(
__('If you prefer to use the CNAME setup, please <a %s>set up the CDN manually at QUIC.cloud</a>.', 'litespeed-cache'),
'href="https://quic.cloud/docs/onboarding/" target="_blank" class="litespeed-learn-more"'
); ?>
</li>
<li>
<?php echo __('QUIC.cloud will detect most normal DNS entries.', 'litespeed-cache'); ?>
<?php echo __('If you have custom DNS records, it is possible that they are not detected.', 'litespeed-cache'); ?>
<?php echo __('Visit your QUIC.cloud dashboard after the DNS Zone is set up to confirm your DNS zone.', 'litespeed-cache'); ?>
</li>
</ul>
<h3 class="litespeed-title-section">
<?php echo __('Set up QUIC.cloud Account', 'litespeed-cache'); ?>
</h3>
<?php if ($cdn_setup_done_ts) : ?>
<p>
<?php echo '<span class="litespeed-right10"><span class="litespeed-success dashicons dashicons-yes"></span> ' . __('Account is linked!', 'litespeed-cache') . '</span>'; ?>
<p>
<?php Doc::learn_more(
Cloud::CLOUD_SERVER_DASH . '/dm/' . $dom . '/cdn/',
__('Manage CDN', 'litespeed-cache') . ' <span class="dashicons dashicons-external"></span>',
false,
'litespeed-link-with-icon'
); ?>
<?php Doc::learn_more(
Cloud::CLOUD_SERVER_DASH . '/dns/find/' . $dom,
__('Manage DNS Zone', 'litespeed-cache') . ' <span class="dashicons dashicons-external"></span>',
false,
'litespeed-link-with-icon'
); ?>
</p>
</p>
<?php elseif ($has_setup_token) : ?>
<?php echo '<span class="litespeed-right10"><span class="litespeed-success dashicons dashicons-yes"></span> ' . __('Ready to run CDN setup.', 'litespeed-cache') . '</span>'; ?>
<?php elseif ($cloud_linked) : ?>
<p><?php echo __('Domain key and QUIC.cloud link detected.', 'litespeed-cache'); ?></p>
<div><?php Doc::learn_more(Utility::build_url(Router::ACTION_CDN_SETUP, Cdn_Setup::TYPE_NOLINK), __('Begin QUIC.cloud CDN Setup', 'litespeed-cache'), true, 'button button-primary'); ?></div>
<?php else : ?>
<div><?php Doc::learn_more(Utility::build_url(Router::ACTION_CDN_SETUP, Cdn_Setup::TYPE_LINK), __('Link to QUIC.cloud', 'litespeed-cache'), true, 'button button-primary'); ?></div>
<?php endif; ?>
<h3 class="litespeed-title-section">
<?php echo __('CDN Setup Status', 'litespeed-cache'); ?>
</h3>
<p>
<span class="litespeed-inline"><?php echo $curr_status; ?></span>
</p>
<?php if (isset($curr_status_subline)) { ?>
<?php echo $curr_status_subline; ?>
<?php } ?>
<?php if (!$cdn_setup_done_ts) { ?>
<?php if (isset($setup_summary['cdn_dns_summary'])) { ?>
<h4>
<?php echo __('QUIC.cloud Detected Records Summary', 'litespeed-cache'); ?>
</h4>
<table class="wp-list-table widefat striped litespeed-width-auto litespeed-table-compact">
<thead>
<tr>
<th>
<?php echo __('Record Type', 'litespeed-cache'); ?>
</th>
<th>
<?php echo __('Count', 'litespeed-cache'); ?>
</th>
</tr>
</thead>
<tbody>
<?php foreach ($setup_summary['cdn_dns_summary']['types'] as $type => $cnt) {
echo '<tr><td>' . wp_kses_post($type) . '</td><td>' . wp_kses_post($cnt) . '</td></tr>';
} ?>
</tbody>
</table>
<p>
<?php echo __('Record names found', 'litespeed-cache') . ': ' . wp_kses_post($setup_summary['cdn_dns_summary']['names']); ?>
</p>
<p>
<?php echo __('Is something missing?', 'litespeed-cache'); ?>
<?php Doc::learn_more(
Cloud::CLOUD_SERVER_DASH . '/dns/find/' . $dom,
__('Review DNS records', 'litespeed-cache') . ' <span class="dashicons dashicons-external"></span>',
false,
'litespeed-link-with-icon'
); ?>
</p>
<p>
<?php echo __('Note: For 15 to 20 minutes after setup completes, browsers may issue a "not secure" warning for your site while QUIC.cloud generates your SSL certificate.', 'litespeed-cache'); ?>
</p>
<?php } ?>
<?php } ?>
<?php if (!$cdn_setup_done_ts) { ?>
<div>
<?php Doc::learn_more(($disabled ? '#' : Utility::build_url(Router::ACTION_CDN_SETUP, $apply_btn_type)), $apply_btn_txt, true, 'button button-primary ' . $disabled); ?>
</div>
<h3 class="litespeed-title-section">
<?php echo __('Nameservers', 'litespeed-cache'); ?>
</h3>
<?php if (isset($nameservers)) { ?>
<p>
<?php echo __('Please update your domain registrar to use these custom nameservers:', 'litespeed-cache'); ?>
</p>
<ul>
<?php
foreach ($nameservers as $nameserver) {
echo '<li><strong>' . $nameserver . '</strong></li>';
}
?>
</ul>
<p>
<?php echo __('QUIC.cloud will attempt to verify the DNS update.', 'litespeed-cache'); ?>
<?php echo __('If it does not verify within 24 hours, the CDN setup will mark the verification as failed.', 'litespeed-cache'); ?>
<?php echo __('At that stage, you may re-start the verification process by pressing the Run CDN Setup button.', 'litespeed-cache'); ?>
</p>
<?php } else { ?>
<p>
<?php echo __('This section will automatically populate once nameservers are configured for the site.', 'litespeed-cache'); ?>
</p>
<?php } ?>
<?php } ?>
<?php if ($has_setup_token || $cdn_setup_done_ts) { ?>
<?php $disabled = $cdn_setup_done_ts && !$cloud_linked ? 'disabled' : ''; ?>
<h3 class="litespeed-title-section">
<?php echo __('Action', 'litespeed-cache'); ?>
</h3>
<div>
<p><?php echo __('The following actions are available:', 'litespeed-cache'); ?></p>
<p>
<strong><?php echo __('Reset CDN Setup', 'litespeed-cache') . ': '; ?></strong>
<?php echo __('Resets all LiteSpeed Cache plugin settings related to CDN setup back to the initial state and disables the CDN.', 'litespeed-cache'); ?>
<?php echo __('QUIC.cloud DNS settings are not changed.', 'litespeed-cache'); ?>
<?php echo __('This allows you to try Auto CDN setup again.', 'litespeed-cache'); ?>
<?php if ($cdn_setup_done_ts) : ?>
<br />
<span class="litespeed-desc">
<?php echo __('NOTE', 'litespeed-cache') . ': '; ?>
<?php echo __('This action will not update anything on the QUIC.cloud servers.', 'litespeed-cache'); ?>
</span>
<?php endif; ?>
</p>
<p>
<strong><?php echo __('Delete QUIC.cloud data', 'litespeed-cache') . ': '; ?></strong>
<?php echo __('Resets all LiteSpeed Cache plugin settings related to CDN setup back to the initial state and deletes the DNS Zone, if one exists for the domain.', 'litespeed-cache'); ?>
<?php echo __('This allows you to try Auto CDN setup again, or abandon the setup entirely.', 'litespeed-cache'); ?>
<br />
<span class="litespeed-desc">
<?php echo __('NOTE', 'litespeed-cache') . ': '; ?>
<?php echo __('This action is not available if there is no domain key, the domain is not linked, or the DNS Zone is in active use.', 'litespeed-cache'); ?>
<?php echo __('If you have not yet done so, please replace the QUIC.cloud nameservers at your domain registrar before proceeding. ', 'litespeed-cache'); ?>
</span>
</p>
<div>
<a href="<?php echo Utility::build_url(Router::ACTION_CDN_SETUP, Cdn_Setup::TYPE_RESET); ?>" data-litespeed-cfm="<?php echo __('Are you sure you want to reset CDN Setup?', 'litespeed-cache'); ?>" class="button litespeed-btn-warning">
<?php echo __('Reset CDN Setup', 'litespeed-cache'); ?>
</a>
<a href="<?php echo ($disabled ? '#' : Utility::build_url(Router::ACTION_CDN_SETUP, Cdn_Setup::TYPE_DELETE)); ?>" <?php if (empty($disabled)) : ?> data-litespeed-cfm="<?php echo __('Are you sure you want to delete QUIC.cloud data?', 'litespeed-cache'); ?>" <?php endif; ?> class="button litespeed-btn-danger <?php echo $disabled; ?>">
<?php echo __('Delete QUIC.cloud data', 'litespeed-cache'); ?>
</a>
</div>
</div>
<?php } ?>

View File

@@ -0,0 +1,48 @@
<?php
namespace LiteSpeed ;
defined( 'WPINC' ) || exit ;
$menu_list = array(
'settings' => __( 'CDN Settings', 'litespeed-cache' ),
'auto_setup' => __( 'QUIC.cloud CDN Setup', 'litespeed-cache' ),
'manage' => __( 'Manage', 'litespeed-cache' ),
) ;
?>
<div class="wrap">
<h1 class="litespeed-h1">
<?php echo __( 'LiteSpeed Cache CDN', 'litespeed-cache' ) ; ?>
</h1>
<span class="litespeed-desc">
v<?php echo Core::VER ; ?>
</span>
<hr class="wp-header-end">
</div>
<div class="litespeed-wrap">
<h2 class="litespeed-header nav-tab-wrapper">
<?php
$i = 1 ;
foreach ($menu_list as $tab => $val){
$accesskey = $i <= 9 ? "litespeed-accesskey='$i'" : '' ;
echo "<a class='litespeed-tab nav-tab' href='#$tab' data-litespeed-tab='$tab' $accesskey>$val</a>" ;
$i ++ ;
}
?>
</h2>
<div class="litespeed-body">
<?php
// include all tpl for faster UE
foreach ($menu_list as $tab => $val) {
echo "<div data-litespeed-layout='$tab'>" ;
require LSCWP_DIR . "tpl/cdn/$tab.tpl.php" ;
echo "</div>" ;
}
?>
</div>
</div>

View File

@@ -0,0 +1,80 @@
<?php
namespace LiteSpeed;
defined('WPINC') || exit;
$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) ?: '-';
$curr_status = CDN\Cloudflare::get_option(CDN\Cloudflare::ITEM_STATUS, array());
?>
<h3 class="litespeed-title"><?php echo __('QUIC.cloud', 'litespeed-cache'); ?></h3>
<p><?php echo __('To manage QUIC.cloud options, please visit', 'litespeed-cache'); ?>: <a href="<?php echo Cloud::cls()->qc_link(); ?>" target="_blank"><?php echo Cloud::cls()->qc_link(); ?></a></p>
<h3 class="litespeed-title"><?php echo __('Cloudflare', 'litespeed-cache'); ?></h3>
<?php if (!$cf_on) : ?>
<div class="litespeed-callout notice notice-error inline">
<h4><?php echo __('WARNING', 'litespeed-cache'); ?></h4>
<p>
<?php echo __('To enable the following functionality, turn ON Cloudflare API in CDN Settings.', 'litespeed-cache'); ?>
</p>
</div>
<?php endif; ?>
<p><?php echo __('Cloudflare Domain', 'litespeed-cache'); ?>: <code><?php echo esc_textarea($cf_domain); ?></code></p>
<p><?php echo __('Cloudflare Zone', 'litespeed-cache'); ?>: <code><?php echo esc_textarea($cf_zone); ?></code></p>
<p>
<b><?php echo __('Development Mode', 'litespeed-cache'); ?>:</b>
<a href="<?php echo Utility::build_url(Router::ACTION_CDN_CLOUDFLARE, CDN\Cloudflare::TYPE_SET_DEVMODE_ON); ?>" class="button litespeed-btn-warning">
<?php echo __('Turn ON', 'litespeed-cache'); ?>
</a>
<a href="<?php echo Utility::build_url(Router::ACTION_CDN_CLOUDFLARE, CDN\Cloudflare::TYPE_SET_DEVMODE_OFF); ?>" class="button litespeed-btn-warning">
<?php echo __('Turn OFF', 'litespeed-cache'); ?>
</a>
<a href="<?php echo Utility::build_url(Router::ACTION_CDN_CLOUDFLARE, CDN\Cloudflare::TYPE_GET_DEVMODE); ?>" class="button litespeed-btn-success">
<?php echo __('Check Status', 'litespeed-cache'); ?>
</a>
<?php if ($curr_status) : ?>
<span class="litespeed-desc">
<?php
if (time() >= $curr_status['devmode_expired']) {
$expired_at = date('m/d/Y H:i:s', $curr_status['devmode_expired'] + LITESPEED_TIME_OFFSET);
$curr_status['devmode'] = 'OFF';
echo sprintf(__('Current status is %1$s since %2$s.', 'litespeed-cache'), '<code>' . strtoupper($curr_status['devmode']) . '</code>', '<code>' . $expired_at . '</code>');
} else {
$expired_at = $curr_status['devmode_expired'] - time();
$expired_at = Utility::readable_time($expired_at, 3600 * 3, true);
?>
<?php echo sprintf(__('Current status is %s.', 'litespeed-cache'), '<code>' . strtoupper($curr_status['devmode']) . '</code>'); ?>
<?php echo sprintf(__('Development mode will be automatically turned off in %s.', 'litespeed-cache'), '<code>' . $expired_at . '</code>'); ?>
<?php
}
?>
</span>
<?php endif; ?>
<p class="litespeed-desc">
<?php echo __('Temporarily bypass Cloudflare cache. This allows changes to the origin server to be seen in realtime.', 'litespeed-cache'); ?>
<?php echo __('Development Mode will be turned off automatically after three hours.', 'litespeed-cache'); ?>
<a href="https://support.cloudflare.com/hc/en-us/articles/200168246" target="_blank"><?php echo __('Learn More', 'litespeed-cache'); ?></a>
</p>
</p>
<p>
<b><?php echo __('Cloudflare Cache', 'litespeed-cache'); ?>:</b>
<?php if (!$cf_on) : ?>
<a href="#" class="button button-secondary disabled">
<?php else : ?>
<a href="<?php echo Utility::build_url(Router::ACTION_CDN_CLOUDFLARE, CDN\Cloudflare::TYPE_PURGE_ALL); ?>" class="button litespeed-btn-danger">
<?php endif; ?>
<?php echo __('Purge Everything', 'litespeed-cache'); ?>
</a>
</p>

View File

@@ -0,0 +1,239 @@
<?php
namespace LiteSpeed;
defined( 'WPINC' ) || exit;
$home_url = home_url( '/' );
$parsed = parse_url( $home_url );
$home_url = str_replace( $parsed[ 'scheme' ] . ':', '', $home_url );
$cdn_url = 'https://cdn.' . substr( $home_url, 2 );
$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 echo __( '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 $id = Base::O_CDN_QUIC; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_switch( $id ); ?>
<div class="litespeed-desc">
<?php echo sprintf( __( 'Enable %s CDN API functionality.', 'litespeed-cache' ), 'QUIC.cloud' ); ?>
<?php Doc::learn_more( 'https://quic.cloud/docs/cdn/getting-started/verify-quic-cloud-cdn-is-working/#check-lscache-wordpress-plugin' ); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $id = Base::O_CDN; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_switch( $id ); ?>
<div class="litespeed-desc">
<?php echo sprintf( __( 'Turn this setting %1$s if you are using a traditional Content Delivery Network (CDN) or a subdomain for static content with QUIC.cloud CDN.', 'litespeed-cache' ), '<code>' . __( 'ON', 'litespeed-cache' ) . '</code>' ); ?>
<?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/cdn/#use-cdn-mapping' ); ?>
</div>
<div class="litespeed-desc">
<?php echo sprintf( __( 'NOTE: QUIC.cloud CDN and Cloudflare do not use CDN Mapping. If you are are only using QUIC.cloud or Cloudflare, leave this setting %1$s.', 'litespeed-cache' ), '<code>' . __( '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 json_encode( $cdn_mapping ); ?> } />,
document.getElementById( 'litespeed_cdn_mapping_div' )
);
</script>
<div class="litespeed-warning">
<?php echo __( 'NOTE', 'litespeed-cache' ); ?>:
<?php echo __( '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 echo sprintf( __( 'Serve all image files through the CDN. This will affect all attachments, HTML %s tags, and CSS %s attributes.', 'litespeed-cache' ), '<code>&lt;img</code>', '<code>url()</code>' ); ?>
<br />
<b><?php $this->title( Base::CDN_MAPPING_INC_CSS ); ?></b>:
<?php echo __( '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 echo __( '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 echo __( 'Static file type links to be replaced by CDN links.', 'litespeed-cache' ); ?>
<?php Doc::one_per_line(); ?>
<?php echo sprintf( __( 'This will affect all tags containing attributes: %s %s %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', __( 'Default value', 'litespeed-cache' ) ); ?>
<br />
<?php echo sprintf( __( 'If you turn any of the above settings OFF, please remove the related file types from the %s box.', 'litespeed-cache' ), '<b>' . __( '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 $id = Base::O_CDN_ATTR; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<div class="litespeed-textarea-recommended">
<div>
<?php $this->build_textarea( $id, 40 ); ?>
</div>
<div>
<?php $this->recommended( $id ); ?>
</div>
</div>
<div class="litespeed-desc">
<?php echo __( 'Specify which HTML element attributes will be replaced with CDN Mapping.', 'litespeed-cache' ); ?>
<?php echo __( 'Only attributes listed here will be replaced.', 'litespeed-cache' ); ?>
<br /><?php echo sprintf( __( '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 $id = Base::O_CDN_ORI; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_textarea( $id ); ?>
<div class="litespeed-desc">
<?php echo sprintf( __( 'Site URL to be served through the CDN. Beginning with %1$s. For example, %2$s.', 'litespeed-cache' ), '<code>//</code>', '<code>' . $home_url . '</code>' ); ?>
<br /><?php echo sprintf( __( '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 $id = Base::O_CDN_ORI_DIR; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<div class="litespeed-textarea-recommended">
<div>
<?php $this->build_textarea( $id, 40 ); ?>
</div>
<div>
<?php $this->recommended( $id ); ?>
</div>
</div>
<div class="litespeed-desc">
<?php echo __( '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 $id = Base::O_CDN_EXC; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_textarea( $id ); ?>
<div class="litespeed-desc">
<?php echo __( 'Paths containing these strings will not be served from the CDN.', 'litespeed-cache' ); ?>
<?php Doc::one_per_line(); ?>
</div>
</td>
</tr>
<tr>
<th>
<?php $id = Base::O_CDN_CLOUDFLARE; ?>
<?php $this->title( $id ); ?>
</th>
<td>
<?php $this->build_switch( $id ); ?>
<div class="litespeed-desc">
<?php echo sprintf( __( 'Use %s API functionality.', 'litespeed-cache' ), 'Cloudflare' ); ?>
<?php echo sprintf( __( 'This can be managed from %1$s%2$s tab.', 'litespeed-cache' ), '<b>' . __( 'CDN', 'litespeed-cache' ) . '</b> -&gt; <b>', __( 'Manage', 'litespeed-cache' ) .'</b>' ); ?>
</div>
<div class="litespeed-block">
<div class='litespeed-col'>
<label class="litespeed-form-label"><?php echo __( 'Global API Key / API Token', 'litespeed-cache' ); ?></label>
<?php $this->build_input( Base::O_CDN_CLOUDFLARE_KEY ); ?>
<div class="litespeed-desc">
<?php echo sprintf( __( 'Your API key / token is used to access %s APIs.', 'litespeed-cache' ), 'Cloudflare' ); ?>
<?php echo sprintf( __( 'Get it from <a %1$s>%2$s</a>.', 'litespeed-cache' ), 'href="https://dash.cloudflare.com/profile/api-tokens" target="_blank"', 'Cloudflare' ); ?>
<?php echo sprintf( __( '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 echo __( 'Email Address', 'litespeed-cache' ); ?></label>
<?php $this->build_input( Base::O_CDN_CLOUDFLARE_EMAIL ); ?>
<div class="litespeed-desc">
<?php echo sprintf( __( 'Your Email address on %s.', 'litespeed-cache' ), 'Cloudflare' ); ?>
<?php echo sprintf( __( 'Optional when API token used.', 'litespeed-cache' ) ); ?>
</div>
</div>
<div class='litespeed-col'>
<label class="litespeed-form-label"><?php echo __( '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 echo __( 'You can just type part of the domain.', 'litespeed-cache' ); ?>
<?php echo __( 'Once saved, it will be matched with the current list and completed automatically.', 'litespeed-cache' ); ?>
</div>
</div>
</div>
</td>
</tr>
</tbody></table>
<?php
$this->form_end();