add wp-rocket

This commit is contained in:
nguyen dung
2022-02-18 19:09:35 +07:00
parent 39b8cb3612
commit 3110d00ee7
927 changed files with 271703 additions and 2 deletions

View File

@@ -0,0 +1,25 @@
<?php
/**
* Beacon JS template.
*
* @since 3.6
*
* @param array $data {
* @type string $form_id Beacon form ID.
* @type string $identify Identify data to send to Helpscout.
* @type string $session Session data to send to Helpscout.
* @type string $prefill Prefill data to send to Helpscout.
* }
*/
defined( 'ABSPATH' ) || exit;
?>
<script>!function(e,t,n){function a(){var e=t.getElementsByTagName("script")[0],n=t.createElement("script");n.type="text/javascript",n.async=!0,n.src="https://beacon-v2.helpscout.net",e.parentNode.insertBefore(n,e)}if(e.Beacon=n=function(t,n,a){e.Beacon.readyQueue.push({method:t,options:n,data:a})},n.readyQueue=[],"complete"===t.readyState)return a();e.attachEvent?e.attachEvent("onload",a):e.addEventListener("load",a,!1)}(window,document,window.Beacon||function(){});
window.Beacon('init', '<?php echo esc_js( $data['form_id'] ); ?>')
window.Beacon("identify", <?php echo $data['identify']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>);
window.Beacon("session-data", <?php echo $data['session']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>);
window.Beacon("prefill", <?php echo $data['prefill']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>);
window.addEventListener("hashchange", function () {
window.Beacon("suggest");
}, false);</script>

View File

@@ -0,0 +1,19 @@
<?php
/**
* Action button link template.
*
* @since 3.0
*
* @data array {
* Data to populate the template.
*
* @type string $label Link text.
* @type string $action Action linked to the button.
* @type string $attributes String of attribute=value for the <button> tag, e.g. class, etc.
* }
*/
defined( 'ABSPATH' ) || exit;
?>
<button id="wpr-action-<?php echo esc_attr( $data['action'] ); ?>" <?php echo $data['attributes']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- $data['attributes'] escaped with sanitize_key & esc_attr ?>><?php echo $data['label']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Dynamic content is properly escaped in the view. ?></button>

View File

@@ -0,0 +1,19 @@
<?php
/**
* Action button link template.
*
* @since 3.0
*
* @data array {
* Data to populate the template.
*
* @type string $label Link text.
* @type string $url URL for the href attribute.
* @type string $attributes String of attribute=value for the <a> tag, e.g. class, target, etc.
* }
*/
defined( 'ABSPATH' ) || exit;
?>
<a href="<?php echo esc_url( $data['url'] ); ?>" <?php echo $data['attributes']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- $data['attributes'] escaped with sanitize_key & esc_attr ?>><?php echo $data['label']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Dynamic content is properly escaped in the view. ?></a>

View File

@@ -0,0 +1,41 @@
<?php
/**
* Enable Google Fonts template.
*
* @since 3.7
*/
defined( 'ABSPATH' ) || exit;
?>
<div id="wpr-mobile_cpcss_view" class="wpr-tools">
<div class="wpr-tools-col">
<div class="wpr-title3 wpr-tools-label wpr-icon-stack"><?php esc_html_e( 'Enable Google Font Optimization', 'rocket' ); ?></div>
<div class="wpr-field-description wpr-hide-on-click"><?php esc_html_e( 'Improves font performance and combines multiple font requests to reduce the number of HTTP requests.', 'rocket' ); ?></div>
<div class="wpr-field-description wpr-hide-on-click">
<?php
printf(
// translators: %1$s = opening link tag, %2$s = closing link tag.
esc_html__( 'This is a one-time action and this button will be removed afterwards. %1$sMore info%2$s', 'rocket' ),
'<a href="' . esc_url( $data['beacon']['url'] ) . '" data-beacon-article="' . esc_attr( $data['beacon']['id'] ) . '" target="_blank" rel="noopener noreferrer">',
'</a>'
);
?>
</div>
<div class="wpr-field-description wpr-field wpr-isHidden wpr-show-on-click">
<?php
printf(
// translators: %1$s = opening link tag, %2$s = closing link tag.
esc_html__( 'Google Fonts Optimization is now enabled for your site. %1$sMore info%2$s', 'rocket' ),
'<a href="' . esc_url( $data['beacon']['url'] ) . '" data-beacon-article="' . esc_attr( $data['beacon']['id'] ) . '" target="_blank" rel="noopener noreferrer">',
'</a>'
);
?>
</div>
</div>
<div class="wpr-tools-col">
<button id="wpr-action-rocket_enable_google_fonts" class="wpr-button wpr-button--icon wpr-button--small wpr-button--purple wpr-icon-refresh">
<?php esc_html_e( 'Optimize Google Fonts', 'rocket' ); ?>
</button>
</div>
</div>

View File

@@ -0,0 +1,39 @@
<?php
/**
* Cache lifespan block template.
*
* @since 3.0
*/
defined( 'ABSPATH' ) || exit;
$rocket_purge_interval = get_rocket_option( 'purge_cron_interval', 10 );
$rocket_purge_unit = get_rocket_option( 'purge_cron_unit', 'HOUR_IN_SECONDS' );
?>
<div class="wpr-field--cache">
<div class="wpr-field-description-label">
<?php echo $data['label']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Dynamic content is properly escaped in the view. ?>
</div>
<?php if ( ! empty( $data['description'] ) ) : ?>
<div class="wpr-field-description">
<?php echo $data['description']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Dynamic content is properly escaped in the view. ?>
</div>
<?php endif; ?>
<div class="wpr-field wpr-field--text wpr-field--number">
<div class="wpr-text wpr-text--number">
<label for="purge_cron_interval" class="screen-reader-text"><?php esc_html_e( 'Clear cache after', 'rocket' ); ?></label>
<input type="number" min="0" id="purge_cron_interval" name="wp_rocket_settings[purge_cron_interval]" value="<?php echo esc_attr( $rocket_purge_interval ); ?>">
</div>
</div>
<div class="wpr-field wpr-field--select">
<div class="wpr-select">
<select id="purge_cron_unit" name="wp_rocket_settings[purge_cron_unit]">
<?php foreach ( $data['choices'] as $value => $label ) : // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound ?>
<option value="<?php echo esc_attr( $value ); ?>" <?php selected( $value, $rocket_purge_unit ); ?>><?php echo esc_html( $label ); ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
</div>

View File

@@ -0,0 +1,71 @@
<?php
/**
* Checkbox template.
*
* @since 3.0
*
* @param array $data {
* Checkbox Field arguments.
*
* @type string $id Field identifier.
* @type string $parent Parent field identifier.
* @type string $label Field label.
* @type string $value Field value.
* @type string $description Field description.
* @type string $input_attr Attributes for the input field.
* @type array $warning {
* Warning panel content.
*
* @type string $title Warning title.
* @type string $description Warning description.
* @type string $button_label Warning Button label.
* }
* }
*/
defined( 'ABSPATH' ) || exit;
?>
<?php if ( ! empty( $data['warning'] ) ) : ?>
<div class="wpr-warningContainer">
<?php endif; ?>
<div class="wpr-field wpr-field--checkbox <?php echo esc_attr( $data['container_class'] ); ?>"<?php echo $data['parent']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- $data['parent'] escaped with esc_attr ?>>
<div class="wpr-checkbox">
<input type="checkbox" id="<?php echo esc_attr( $data['id'] ); ?>" class="" name="wp_rocket_settings[<?php echo esc_attr( $data['id'] ); ?>]" value="1" <?php checked( $data['value'], 1 ); ?>
<?php echo $data['input_attr']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Dynamic content is properly escaped in the view. ?>>
<label for="<?php echo esc_attr( $data['id'] ); ?>" class=""><?php echo $data['label']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Dynamic content is properly escaped in the view. ?></label>
</div>
<?php if ( ! empty( $data['description'] ) ) : ?>
<div class="wpr-field-description">
<?php echo $data['description']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Dynamic content is properly escaped in the view. ?>
</div>
<?php endif; ?>
</div>
<?php if ( ! empty( $data['warning'] ) ) : ?>
<div class="wpr-fieldWarning">
<div class="wpr-fieldWarning-title wpr-icon-important">
<?php echo esc_html( $data['warning']['title'] ); ?>
</div>
<?php if ( isset( $data['warning']['description'] ) ) : ?>
<div class="wpr-fieldWarning-description">
<?php echo $data['warning']['description']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Dynamic content is properly escaped in the view. ?>
</div>
<?php endif; ?>
<button class="wpr-button wpr-button--small wpr-button--icon wpr-icon-check"><?php echo esc_html( $data['warning']['button_label'] ); ?></button>
</div>
<?php endif; ?>
<?php if ( ! empty( $data['helper'] ) ) : ?>
<div class="wpr-field-description wpr-field-description-helper wpr-icon-important">
<?php echo $data['helper']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Dynamic content is properly escaped in the view. ?>
</div>
<?php endif; ?>
<?php if ( ! empty( $data['warning'] ) ) : ?>
</div>
<?php endif; ?>
<?php

View File

@@ -0,0 +1,123 @@
<?php
/**
* CNAMES template.
*
* @since 3.0
*/
defined( 'ABSPATH' ) || exit;
$rocket_cnames = get_rocket_option( 'cdn_cnames' );
$rocket_cnames_zone = get_rocket_option( 'cdn_zone' );
?>
<div class="wpr-fieldsContainer-fieldset">
<div class="wpr-field">
<div class="wpr-field-description-label">
<?php echo $data['label']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Dynamic content is properly escaped in the view. ?>
</div>
<?php if ( ! empty( $data['description'] ) ) : ?>
<div class="wpr-field-description">
<?php echo $data['description']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Dynamic content is properly escaped in the view. ?>
</div>
<?php endif; ?>
<div id="wpr-cnames-list">
<?php
if ( $rocket_cnames ) :
foreach ( $rocket_cnames as $key => $url ) : // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
?>
<div class="wpr-multiple">
<div class="wpr-text">
<input type="text" name="wp_rocket_settings[cdn_cnames][<?php echo esc_attr( $key ); ?>]" value="<?php echo esc_attr( $url ); ?>" placeholder="cdn.example.com" />
</div>
<div class="wpr-field-betweenText"><?php esc_html_e( 'reserved for', 'rocket' ); ?></div>
<div class="wpr-select">
<select name="wp_rocket_settings[cdn_zone][<?php echo esc_attr( $key ); ?>]">
<option value="all" <?php selected( $rocket_cnames_zone[ $key ], 'all' ); ?>><?php esc_html_e( 'All files', 'rocket' ); ?></option>
<?php
/**
* Controls the inclusion of images option for the CDN dropdown
*
* @since 2.10.7
* @author Remy Perona
*
* @param bool $allow true to add the option, false otherwise.
*/
if ( apply_filters( 'rocket_allow_cdn_images', true ) ) :
?>
<option value="images" <?php selected( $rocket_cnames_zone[ $key ], 'images' ); ?>><?php esc_html_e( 'Images', 'rocket' ); ?></option>
<?php endif; ?>
<option value="css_and_js" <?php selected( $rocket_cnames_zone[ $key ], 'css_and_js' ); ?>><?php esc_html_e( 'CSS & JavaScript', 'rocket' ); ?></option>
<option value="js" <?php selected( $rocket_cnames_zone[ $key ], 'js' ); ?>><?php esc_html_e( 'JavaScript', 'rocket' ); ?></option>
<option value="css" <?php selected( $rocket_cnames_zone[ $key ], 'css' ); ?>><?php esc_html_e( 'CSS', 'rocket' ); ?></option>
</select>
</div>
<button class="dashicons dashicons-no wpr-multiple-close hide-if-no-js"></button>
</div>
<?php
endforeach;
else :
?>
<div class="wpr-multiple wpr-multiple-default">
<div class="wpr-text">
<input type="text" name="wp_rocket_settings[cdn_cnames][]" placeholder="cdn.example.com" />
</div>
<div class="wpr-field-betweenText"><?php esc_html_e( 'reserved for', 'rocket' ); ?></div>
<div class="wpr-select">
<select name="wp_rocket_settings[cdn_zone][]">
<option value="all"><?php esc_html_e( 'All files', 'rocket' ); ?></option>
<?php
/**
* Controls the inclusion of images option for the CDN dropdown
*
* @since 2.10.7
* @author Remy Perona
*
* @param bool $allow true to add the option, false otherwise.
*/
if ( apply_filters( 'rocket_allow_cdn_images', true ) ) :
?>
<option value="images"><?php esc_html_e( 'Images', 'rocket' ); ?></option>
<?php endif; ?>
<option value="css_and_js"><?php esc_html_e( 'CSS & JavaScript', 'rocket' ); ?></option>
<option value="js"><?php esc_html_e( 'JavaScript', 'rocket' ); ?></option>
<option value="css"><?php esc_html_e( 'CSS', 'rocket' ); ?></option>
</select>
</div>
</div>
<?php endif; ?>
</div>
<div id="wpr-cname-model" class="wpr-isHidden">
<div class="wpr-multiple">
<div class="wpr-text">
<input type="text" name="wp_rocket_settings[cdn_cnames][]" placeholder="cdn.example.com" />
</div>
<div class="wpr-field-betweenText"><?php esc_html_e( 'reserved for', 'rocket' ); ?></div>
<div class="wpr-select">
<select name="wp_rocket_settings[cdn_zone][]">
<option value="all"><?php esc_html_e( 'All files', 'rocket' ); ?></option>
<?php
/**
* Controls the inclusion of images option for the CDN dropdown
*
* @since 2.10.7
* @author Remy Perona
*
* @param bool $allow true to add the option, false otherwise.
*/
if ( apply_filters( 'rocket_allow_cdn_images', true ) ) :
?>
<option value="images"><?php esc_html_e( 'Images', 'rocket' ); ?></option>
<?php endif; ?>
<option value="css_and_js"><?php esc_html_e( 'CSS & JavaScript', 'rocket' ); ?></option>
<option value="js"><?php esc_html_e( 'JavaScript', 'rocket' ); ?></option>
<option value="css"><?php esc_html_e( 'CSS', 'rocket' ); ?></option>
</select>
</div>
<button class="dashicons dashicons-no wpr-multiple-close hide-if-no-js"></button>
</div>
</div>
<button class='wpr-button wpr-button--small wpr-button--purple wpr-button--icon wpr-icon-plus wpr-button--addMulti'>
<?php esc_html_e( 'Add CNAME', 'rocket' ); ?>
</button>
</div>
</div>

View File

@@ -0,0 +1,18 @@
<?php
/**
* Hidden field template.
*
* @since 3.0
*
* @param array $data {
* Field arguments.
*
* @type string $id Field indentifier.
* @type mixed $value Field value.
* }
*/
defined( 'ABSPATH' ) || exit;
?>
<input type="hidden" id="<?php echo esc_attr( $data['id'] ); ?>" name="wp_rocket_settings[<?php echo esc_attr( $data['id'] ); ?>]" value="<?php echo esc_attr( $data['value'] ); ?>">

View File

@@ -0,0 +1,50 @@
<?php
/**
* Import form template.
*
* @since 3.0
*
* @param array $data {
* Import form data.
*
* @type array $upload_dir Array containing data about the upload dir, and an error key and message if needed.
* @type string $size Max upload size in a human readable format.
* @type string $bytes Raw max upload size.
* @type string $action WordPress action associated with the form.
* @type string $submit_text Content for the submit button.
* }
*/
defined( 'ABSPATH' ) || exit;
if ( ! empty( $data['upload_dir']['error'] ) ) {
?>
<div class="error"><p><?php esc_html_e( 'Before you can upload your import file, you will need to fix the following error:', 'rocket' ); ?></p>
<p><strong><?php echo esc_html( $data['upload_dir']['error'] ); ?></strong></p></div>
<?php
} else {
?>
<form action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>" method="POST" enctype="multipart/form-data" class="wpr-tools">
<div class="wpr-tools-col">
<label for="upload" class="wpr-title3 wpr-tools-label wpr-icon-import"><?php esc_html_e( 'Import settings', 'rocket' ); ?></label>
<div class="wpr-upload">
<input type="file" accept=".txt,.json" id="upload" name="import" size="25" />
<small for="upload" class="wpr-field-description">
<?php
// translators: %s is the maximum upload size set on the current server.
printf( esc_html__( 'Choose a file from your computer (maximum size: %s)', 'rocket' ), esc_html( $data['size'] ) );
?>
</small>
</div>
<input type="hidden" name="max_file_size" value="<?php echo esc_attr( $data['bytes'] ); ?>" />
<input type="hidden" name="action" value="<?php echo esc_attr( $data['action'] ); ?>" />
</div>
<div class="wpr-tools-col">
<?php
wp_nonce_field( $data['action'], $data['action'] . '_nonce' );
?>
<button type="submit" class="wpr-button wpr-button--icon wpr-button--small wpr-button--purple wpr-icon-chevron-up" value="<?php echo esc_attr( $data['submit_text'] ); ?>"><?php echo esc_attr( $data['submit_text'] ); ?></button>
</div>
</form>
<?php
}

View File

@@ -0,0 +1,33 @@
<?php
/**
* Number field template.
*
* @since 3.0
*
* @param array $data {
* Checkbox Field arguments.
*
* @type string $id Field identifier.
* @type string $label Field label.
* @type string $container_class Field container class.
* @type string $value Field value.
* @type string $description Field description.
* }
*/
defined( 'ABSPATH' ) || exit;
?>
<div class="wpr-field wpr-field--text wpr-field--number <?php echo esc_attr( $data['container_class'] ); ?>">
<div class="wpr-text wpr-text--number">
<label for="<?php echo esc_attr( $data['id'] ); ?>"><?php echo $data['label']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Dynamic content is properly escaped in the view. ?></label>
<input type="number" id="<?php echo esc_attr( $data['id'] ); ?>" name="wp_rocket_settings[<?php echo esc_attr( $data['id'] ); ?>]" value="<?php echo esc_attr( $data['value'] ); ?>">
</div>
<?php if ( ! empty( $data['description'] ) ) : ?>
<div class="wpr-field-description">
<?php echo $data['description']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Dynamic content is properly escaped in the view. ?>
</div>
<?php endif; ?>
</div>

View File

@@ -0,0 +1,68 @@
<?php
/**
* One-click add-on block template.
*
* @since 3.0
*
* @param array $data {
* Checkbox Field arguments.
*
* @type string $id Field identifier.
* @type string $label Add-on label.
* @type string $title Add-on title.
* @type string $description Add-on description.
* @type string $logo Add-on logo URL.
* @type string $value Field value.
* }
*/
defined( 'ABSPATH' ) || exit;
?>
<fieldset class="wpr-fieldsContainer-fieldset">
<div class="wpr-field">
<div class="wpr-flex">
<h4 class="wpr-title3"><?php echo esc_html( $data['label'] ); ?></h4>
<?php
/**
* Filters the display of the input
*
* @since 3.0
* @author Remy Perona
*
* @param bool $display True to display, false otherwise.
*/
if ( apply_filters( 'rocket_display_input_' . $data['id'], true ) ) :
?>
<div class="wpr-radio wpr-radio--reverse">
<input type="checkbox" id="<?php echo esc_attr( $data['id'] ); ?>" class="" name="wp_rocket_settings[<?php echo esc_attr( $data['id'] ); ?>]" value="1" <?php checked( $data['value'], 1 ); ?>>
<label for="<?php echo esc_attr( $data['id'] ); ?>" class="">
<span data-l10n-active="<?php echo esc_attr_x( 'On', 'Active state of checkbox', 'rocket' ); ?>"
data-l10n-inactive="<?php echo esc_attr_x( 'Off', 'Inactive state of checkbox', 'rocket' ); ?>" class="wpr-radio-ui"></span>
<?php esc_html_e( 'Add-on status', 'rocket' ); ?>
</label>
</div>
<?php endif; ?>
</div>
</div>
<div class="wpr-field wpr-addon">
<div class="wpr-flex">
<div class="wpr-addon-logo">
<img src="<?php echo esc_url( $data['logo']['url'] ); ?>" width="<?php echo esc_attr( $data['logo']['width'] ); ?>" height="<?php echo esc_attr( $data['logo']['height'] ); ?>" alt="">
</div>
<div class="wpr-addon-text">
<?php if ( ! empty( $data['title'] ) ) : ?>
<div class="wpr-addon-title">
<?php echo esc_attr( $data['title'] ); ?>
</div>
<?php endif; ?>
<?php if ( ! empty( $data['description'] ) ) : ?>
<div class="wpr-field-description">
<?php echo $data['description']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Dynamic content is properly escaped in the view. ?>
</div>
<?php endif; ?>
</div>
</div>
</div>
</fieldset>

View File

@@ -0,0 +1,61 @@
<?php
/**
* Rocket add-on block template.
*
* @since 3.0
*
* @param array $data {
* Checkbox Field arguments.
*
* @type string $id Field identifier.
* @type string $label Add-on label.
* @type string $title Add-on title.
* @type string $description Add-on description.
* @type string $logo Add-on logo.
* @type string $value Field value.
* }
*/
defined( 'ABSPATH' ) || exit;
$rocket_settings_page = ! empty( $data['settings_page'] ) ? $data['settings_page'] : '';
?>
<fieldset class="wpr-fieldsContainer-fieldset">
<div class="wpr-field">
<div class="wpr-flex">
<h4 class="wpr-title3"><?php echo esc_html( $data['label'] ); ?></h4>
<div class="wpr-radio wpr-radio--reverse">
<input type="checkbox" id="<?php echo esc_attr( $data['id'] ); ?>" class="" name="wp_rocket_settings[<?php echo esc_attr( $data['id'] ); ?>]" value="1" <?php checked( $data['value'], 1 ); ?>>
<label for="<?php echo esc_attr( $data['id'] ); ?>" class="">
<span data-l10n-active="<?php echo esc_attr_x( 'On', 'Active state of checkbox', 'rocket' ); ?>"
data-l10n-inactive="<?php echo esc_attr_x( 'Off', 'Inactive state of checkbox', 'rocket' ); ?>" class="wpr-radio-ui"></span>
<?php esc_html_e( 'Add-on status', 'rocket' ); ?>
</label>
</div>
</div>
</div>
<div class="wpr-field wpr-addon">
<div class="wpr-flex">
<div class="wpr-addon-logo">
<img src="<?php echo esc_url( $data['logo']['url'] ); ?>" width="<?php echo esc_attr( $data['logo']['width'] ); ?>" height="<?php echo esc_attr( $data['logo']['height'] ); ?>" alt="">
</div>
<div class="wpr-addon-text">
<?php if ( ! empty( $data['title'] ) ) : ?>
<div class="wpr-addon-title">
<?php echo esc_attr( $data['title'] ); ?>
</div>
<?php endif; ?>
<?php if ( ! empty( $data['description'] ) ) : ?>
<div class="wpr-field-description">
<?php echo $data['description']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Dynamic content is properly escaped in the view. ?>
</div>
<?php endif; ?>
<?php if ( $rocket_settings_page ) : ?>
<a href="#<?php echo esc_attr( $rocket_settings_page ); ?>" class="wpr-button wpr-button--small wpr-button--icon wpr-button--purple wpr-icon-chevron-right wpr-toggle-button wpr-<?php echo esc_attr( $rocket_settings_page ); ?>ToggleButton"><?php esc_html_e( 'Modify options', 'rocket' ); ?></a>
<?php endif; ?>
</div>
</div>
</div>
</fieldset>

View File

@@ -0,0 +1,79 @@
<?php
/**
* RocketCDN template.
*
* @since 3.5
*/
defined( 'ABSPATH' ) || exit;
$rocket_cnames = get_rocket_option( 'cdn_cnames' );
$rocket_cnames_zone = get_rocket_option( 'cdn_zone' );
?>
<div class="wpr-fieldsContainer-fieldset">
<div class="wpr-field">
<div class="wpr-field-description-label">
<?php echo $data['label']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Dynamic content is properly escaped in the view. ?>
</div>
<?php if ( ! empty( $data['description'] ) ) : ?>
<div class="wpr-field-description">
<?php echo $data['description']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Dynamic content is properly escaped in the view. ?>
</div>
<?php endif; ?>
<div id="wpr-cnames-list">
<?php
if ( $rocket_cnames ) :
foreach ( $rocket_cnames as $key => $url ) : // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
?>
<div class="wpr-text">
<label for="cdn_cnames_<?php echo esc_attr( $key ); ?>" class="screen-reader-text"><?php esc_html_e( 'CDN CNAME', 'rocket' ); ?></label>
<input type="text" id="cdn_cnames_<?php echo esc_attr( $key ); ?>" name="wp_rocket_settings[cdn_cnames][<?php echo esc_attr( $key ); ?>]" value="<?php echo esc_attr( $url ); ?>" placeholder="cdn.example.com" />
<input type="hidden" name="wp_rocket_settings[cdn_zone][<?php echo esc_attr( $key ); ?>]" value="<?php echo esc_attr( $rocket_cnames_zone[ $key ] ); ?>" />
<?php if ( ! empty( $data['helper'] ) ) : ?>
<div class="wpr-field-description wpr-field-description-helper">
<?php echo $data['helper']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Dynamic content is properly escaped in the view. ?>
</div>
<?php endif; ?>
</div>
<?php endforeach; ?>
<?php else : ?>
<div class="wpr-text">
<label for="cdn_cnames" class="screen-reader-text"><?php esc_html_e( 'CDN CNAME', 'rocket' ); ?></label>
<input type="text" id="cdn_cnames" name="wp_rocket_settings[cdn_cnames][]" value="" placeholder="xxxxxx.rocketcdn.me" />
<input type="hidden" name="wp_rocket_settings[cdn_zone][]" value="all" />
<?php if ( ! empty( $data['helper'] ) ) : ?>
<div class="wpr-field-description wpr-field-description-helper">
<?php echo $data['helper']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Dynamic content is properly escaped in the view. ?>
</div>
<?php endif; ?>
</div>
<?php endif; ?>
</div>
</div>
</div>
<div class="wpr-optionHeader">
<h3 class="wpr-title2"><?php esc_html_e( 'Purge RocketCDN cache', 'rocket' ); ?></h3>
</div>
<div class="wpr-fieldsContainer">
<div class="wpr-fieldsContainer-description">
<?php
printf(
// translators: %s is a "Learn more" link.
esc_html__( 'Purges RocketCDN cached resources for your website. %s', 'rocket' ),
'<a href="' . esc_url( $data['beacon']['url'] ) . '" data-beacon-article="' . esc_attr( $data['beacon']['id'] ) . '" rel="noopener noreferrer" target="_blank">' . esc_html__( 'Learn more', 'rocket' ) . '</a>'
);
?>
</div><br>
<?php
$this->render_action_button(
'link',
'rocket_purge_rocketcdn',
[
'label' => __( 'Clear all RocketCDN cache files', 'rocket' ),
'attributes' => [
'class' => 'wpr-button wpr-button--icon wpr-button--small wpr-button--purple wpr-icon-trash',
],
]
);
?>
</div>

View File

@@ -0,0 +1,43 @@
<?php
/**
* Select field template.
*
* @since 3.0
*
* @param array $data {
* Checkbox Field arguments.
*
* @type string $id Field identifier.
* @type string $label Field label.
* @type string $container_class Field container class.
* @type string $value Field value.
* @type string $description Field description.
* @type array $choices {
* Option choices.
*
* @type string $value Option value.
* @type string $label Option label.
* }
* }
*/
defined( 'ABSPATH' ) || exit;
?>
<div class="wpr-field wpr-field--select <?php echo esc_attr( $data['container_class'] ); ?>"<?php echo $data['parent']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- $data['parent'] escaped with esc_attr. ?>>
<div class="wpr-select">
<select id="<?php echo esc_attr( $data['id'] ); ?>" name="wp_rocket_settings[<?php echo esc_attr( $data['id'] ); ?>]">
<?php foreach ( $data['choices'] as $value => $label ) : // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound ?>
<option value="<?php echo esc_attr( $value ); ?>" <?php selected( $value, $data['value'] ); ?>><?php echo esc_html( $label ); ?></option>
<?php endforeach; ?>
</select>
<label for="<?php echo esc_attr( $data['id'] ); ?>"><?php echo esc_html( $data['label'] ); ?></label>
</div>
<?php if ( ! empty( $data['description'] ) ) : ?>
<div class="wpr-field-description">
<?php echo $data['description']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Dynamic content is properly escaped in the view. ?>
</div>
<?php endif; ?>
</div>

View File

@@ -0,0 +1,36 @@
<?php
/**
* Sliding checkbox template.
*
* @since 3.0
*
* @param array $data {
* Checkbox Field arguments.
*
* @type string $id Field identifier.
* @type string $label Field label.
* @type string $value Field value.
* @type string $description Field description.
* }
*/
defined( 'ABSPATH' ) || exit;
?>
<div class="wpr-field wpr-field--radio <?php echo esc_attr( $data['container_class'] ); ?>">
<div class="wpr-radio">
<input type="checkbox" id="<?php echo esc_attr( $data['id'] ); ?>" class="" name="wp_rocket_settings[<?php echo esc_attr( $data['id'] ); ?>]" value="1" <?php checked( $data['value'], 1 ); ?>>
<label for="<?php echo esc_attr( $data['id'] ); ?>" class="">
<span data-l10n-active="<?php echo esc_attr_x( 'On', 'Active state of checkbox', 'rocket' ); ?>"
data-l10n-inactive="<?php echo esc_attr_x( 'Off', 'Inactive state of checkbox', 'rocket' ); ?>" class="wpr-radio-ui"></span>
<?php echo esc_html( $data['label'] ); ?>
</label>
</div>
<?php if ( ! empty( $data['description'] ) ) : ?>
<div class="wpr-field-description">
<?php echo $data['description']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Dynamic content is properly escaped in the view. ?>
</div>
<?php endif; ?>
</div>

View File

@@ -0,0 +1,43 @@
<?php
/**
* Text template.
*
* @since 3.0
*
* @param array $data {
* Checkbox Field arguments.
*
* @type string $id Field identifier.
* @type string $parent Parent field identifier.
* @type string $label Field label.
* @type string $container_class Field container class.
* @type string $value Field value.
* @type string $description Field description.
* @type string $input_attr Attributes for the input field.
* }
*/
defined( 'ABSPATH' ) || exit;
?>
<div class="wpr-field wpr-field--text <?php echo esc_attr( $data['container_class'] ); ?>">
<div class="wpr-text">
<?php if ( ! empty( $data['description'] ) ) : ?>
<div class="wpr-flex">
<label for="<?php echo esc_attr( $data['id'] ); ?>"><?php echo esc_html( $data['label'] ); ?></label>
<div class="wpr-field-description">
<?php echo $data['description']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Dynamic content is properly escaped in the view. ?>
</div>
</div>
<?php else : ?>
<label for="<?php echo esc_attr( $data['id'] ); ?>"><?php echo esc_html( $data['label'] ); ?></label>
<?php endif; ?>
<input type="text" id="<?php echo esc_attr( $data['id'] ); ?>" class="" name="wp_rocket_settings[<?php echo esc_attr( $data['id'] ); ?>]" value="<?php echo esc_attr( $data['value'] ); ?>"<?php echo $data['input_attr']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Dynamic content is properly escaped in the view. ?>>
<?php if ( ! empty( $data['helper'] ) ) : ?>
<div class="wpr-field-description wpr-field-description-helper">
<?php echo $data['helper']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Dynamic content is properly escaped in the view. ?>
</div>
<?php endif; ?>
</div>
</div>

View File

@@ -0,0 +1,50 @@
<?php
/**
* Textarea field template.
*
* @since 3.0
*
* @param array $data {
* Checkbox Field arguments.
*
* @type string $id Field identifier.
* @type string $label Field label.
* @type string $value Field value.
* @type string $description Field description.
* @type string $helper Field helper text.
* @type string $placeholder Field placeholder.
* }
*/
defined( 'ABSPATH' ) || exit;
?>
<div class="wpr-field wpr-field--textarea <?php echo esc_attr( $data['container_class'] ); ?>"<?php echo $data['parent']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- $data['parent'] escaped with esc_attr. ?>>
<?php if ( ! empty( $data['label'] ) ) : ?>
<label for="<?php echo esc_attr( $data['id'] ); ?>" class="wpr-field-description-label"><?php echo $data['label']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- $data['label'] escaped with esc_attr. ?></label>
<?php endif; ?>
<?php if ( ! empty( $data['description'] ) ) : ?>
<div class="wpr-field-description">
<?php echo $data['description']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Dynamic content is properly escaped in the view. ?>
</div>
<?php endif; ?>
<div class="wpr-textarea">
<textarea id="<?php echo esc_attr( $data['id'] ); ?>" name="wp_rocket_settings[<?php echo esc_attr( $data['id'] ); ?>]" placeholder="<?php echo esc_attr( $data['placeholder'] ); ?>"><?php echo esc_textarea( $data['value'] ); ?></textarea>
</div>
<?php if ( ! empty( $data['helper'] ) ) : ?>
<div class="wpr-field-description wpr-field-description-helper">
<?php echo $data['helper']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Dynamic content is properly escaped in the view. ?>
</div>
<?php endif; ?>
<?php
/**
* Fires after the display of a textarea field on WP Rocket settings page
*
* The dynamic portion of the name corresponds to the field ID
*
* @since 3.7
*/
do_action( "rocket_after_textarea_field_{$data['id']}" );
?>
</div>

View File

@@ -0,0 +1,30 @@
<?php
/**
* Menu template.
*
* @since 3.0
*
* @param array $data {
* Array of page sections arrays.
*
* @type string $id Menu item identifier.
* @type string $title Menu item title.
* @type string $menu_description Menu item summary.
* @type string $class Class(es) to apply to the menu item.
* }
*/
defined( 'ABSPATH' ) || exit;
?>
<?php
if ( rocket_valid_key() ) {
foreach ( $data as $section ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
?>
<a href="#<?php echo esc_attr( $section['id'] ); ?>" id="wpr-nav-<?php echo esc_attr( $section['id'] ); ?>" class="wpr-menuItem <?php echo esc_attr( $section['class'] ); ?>">
<div class="wpr-menuItem-title"><?php echo esc_html( $section['title'] ); ?></div>
<div class="wpr-menuItem-description"><?php echo esc_html( $section['menu_description'] ); ?></div>
</a>
<?php
}
}

View File

@@ -0,0 +1,24 @@
<?php
/**
* Addons section template.
*
* @since 3.0
*
* @param array {
* Section arguments.
*
* @type string $id Page section identifier.
* @type string $title Page section title.
* }
*/
defined( 'ABSPATH' ) || exit;
?>
<div id="<?php echo esc_attr( $data['id'] ); ?>" class="wpr-Page">
<div class="wpr-sectionHeader">
<h2 class="wpr-title1 wpr-icon-addons"><?php echo esc_html( $data['title'] ); ?></h2>
</div>
<?php $this->render_settings_sections( $data['id'] ); ?>
</div>

View File

@@ -0,0 +1,24 @@
<?php
/**
* Advanced cache section template.
*
* @since 3.0
*
* @param array {
* Section arguments.
*
* @type string $id Page section identifier.
* @type string $title Page section title.
* }
*/
defined( 'ABSPATH' ) || exit;
?>
<div id="<?php echo esc_attr( $data['id'] ); ?>" class="wpr-Page">
<div class="wpr-sectionHeader">
<h2 class="wpr-title1 wpr-icon-rules"><?php echo esc_html( $data['title'] ); ?></h2>
</div>
<?php $this->render_settings_sections( $data['id'] ); ?>
</div>

View File

@@ -0,0 +1,24 @@
<?php
/**
* Cache section template.
*
* @since 3.0
*
* @param array {
* Section arguments.
*
* @type string $id Page section identifier.
* @type string $title Page section title.
* }
*/
defined( 'ABSPATH' ) || exit;
?>
<div id="<?php echo esc_attr( $data['id'] ); ?>" class="wpr-Page">
<div class="wpr-sectionHeader">
<h2 class="wpr-title1 wpr-icon-files"><?php echo esc_html( $data['title'] ); ?></h2>
</div>
<?php $this->render_settings_sections( $data['id'] ); ?>
</div>

View File

@@ -0,0 +1,54 @@
<?php
/**
* Cloudflare section template.
*
* @since 3.0
*
* @param array {
* Section arguments.
*
* @type string $id Page section identifier.
* @type string $title Page section title.
* }
*/
defined( 'ABSPATH' ) || exit;
?>
<div id="<?php echo esc_attr( $data['id'] ); ?>" class="wpr-Page">
<div class="wpr-sectionHeader">
<h2 class="wpr-title1">
<img src="<?php echo esc_url( WP_ROCKET_ASSETS_IMG_URL . 'logo-cloudflare.svg' ); ?>" width="246" height="35" alt="Logo Cloudflare">
</h2>
</div>
<?php $this->render_settings_sections( $data['id'] ); ?>
<div class="wpr-optionHeader">
<h3 class="wpr-title2"><?php esc_html_e( 'Cloudflare Cache', 'rocket' ); ?></h3>
</div>
<?php if ( current_user_can( 'rocket_purge_cloudflare_cache' ) ) : ?>
<div class="wpr-fieldsContainer">
<div class="wpr-fieldsContainer-description">
<?php
printf(
// translators: %s is a "Learn more" link.
esc_html__( 'Purges cached resources for your website. %s', 'rocket' ),
'<a href="' . esc_url( __( 'https://support.cloudflare.com/hc/en-us/articles/200169246', 'rocket' ) ) . '" target="_blank">' . esc_html__( 'Learn more', 'rocket' ) . '</a>'
);
?>
</div><br>
<?php
$this->render_action_button(
'link',
'rocket_purge_cloudflare',
[
'label' => __( 'Clear all Cloudflare cache files', 'rocket' ),
'attributes' => [
'class' => 'wpr-button wpr-button--icon wpr-button--small wpr-button--purple wpr-icon-trash',
],
]
);
?>
</div>
<?php endif; ?>
</div>

View File

@@ -0,0 +1,263 @@
<?php
/**
* Dashboard section template.
*
* @since 3.0
*
* @param array {
* Section arguments.
*
* @type string $id Page section identifier.
* @type string $title Page section title.
* @type array $faq {
* Items to populate the FAQ section.
*
* @type string $id Documentation item ID.
* @type string $url Documentation item URL.
* @type string $title Documentation item title.
* }
* @type object $customer_data WP Rocket customer data.
* }
*/
defined( 'ABSPATH' ) || exit;
?>
<div id="<?php echo esc_attr( $data['id'] ); ?>" class="wpr-Page">
<div class="wpr-sectionHeader">
<h2 class="wpr-title1 wpr-icon-home"><?php echo esc_html( $data['title'] ); ?></h2>
</div>
<?php
$rocket_boxes = get_user_meta( get_current_user_id(), 'rocket_boxes', true );
if ( ! in_array( 'rocket_activation_notice', (array) $rocket_boxes, true ) ) :
?>
<div class="wpr-notice">
<div class="wpr-notice-container">
<div class="wpr-notice-supTitle"><?php esc_html_e( 'Congratulations!', 'rocket' ); ?></div>
<h2 class="wpr-notice-title">
<?php esc_html_e( 'WP Rocket is now activated and already working for you.', 'rocket' ); ?>
<br>
<?php esc_html_e( 'Your website should be loading faster now!', 'rocket' ); ?>
</h2>
<div class="wpr-notice-description"><?php esc_html_e( 'To guarantee fast websites, WP Rocket applies 80% of web performance best practices.', 'rocket' ); ?><br> <?php esc_html_e( 'We also enable options that provide immediate benefits to your website.', 'rocket' ); ?></div>
<div class="wpr-notice-continue"><?php esc_html_e( 'Continue to the options to further optimize your site!', 'rocket' ); ?></div>
<a class="wpr-notice-close wpr-icon-close rocket-dismiss" href="<?php echo esc_url( wp_nonce_url( admin_url( 'admin-post.php?action=rocket_ignore&box=rocket_activation_notice' ), 'rocket_ignore_rocket_activation_notice' ) ); ?>"><span class="screen-reader-text"><?php esc_html_e( 'Dismiss this notice.', 'rocket' ); ?></span></a>
</div>
</div>
<?php endif; ?>
<?php
/**
* Fires before displaying the dashboard tab content
*
* @since 3.7.4
*/
do_action( 'rocket_before_dashboard_content' );
?>
<div class="wpr-Page-row">
<div class="wpr-Page-col">
<?php if ( ! defined( 'WP_ROCKET_WHITE_LABEL_ACCOUNT' ) || ! WP_ROCKET_WHITE_LABEL_ACCOUNT ) : ?>
<div class="wpr-optionHeader">
<h3 class="wpr-title2"><?php esc_html_e( 'My Account', 'rocket' ); ?></h3>
<?php
$this->render_action_button(
'button',
'refresh_account',
[
'label' => __( 'Refresh info', 'rocket' ),
'attributes' => [
'class' => 'wpr-infoAction wpr-icon-refresh',
],
]
);
?>
</div>
<div class="wpr-field wpr-field-account">
<div class="wpr-flex">
<div class="wpr-infoAccount-License">
<span class="wpr-title3"><?php esc_html_e( 'License', 'rocket' ); ?></span>
<span class="wpr-infoAccount wpr-isValid" id="wpr-account-data">
<?php echo esc_html( $data['customer_data']['license_type'] ); ?>
</span><br>
<?php
/**
* Fires when displaying the license information
*
* @since 3.7.3
*/
do_action( 'rocket_dashboard_license_info' );
?>
<p>
<span class="wpr-title3"><?php esc_html_e( 'Expiration Date', 'rocket' ); ?></span>
<span class="wpr-infoAccount <?php echo esc_attr( $data['customer_data']['license_class'] ); ?>" id="wpr-expiration-data"><?php echo esc_html( $data['customer_data']['license_expiration'] ); ?></span>
</p>
</div>
<div>
<?php
$this->render_action_button(
'link',
'view_account',
[
'label' => __( 'View my account', 'rocket' ),
'attributes' => [
'target' => '_blank',
'class' => 'wpr-button wpr-button--icon wpr-button--small wpr-button--purple wpr-icon-user',
],
]
);
?>
</div>
</div>
</div>
<?php endif; ?>
<?php
/**
* Fires after the account data section on the WP Rocket settings dashboard
*
* @since 3.5
*/
do_action( 'rocket_dashboard_after_account_data' );
?>
<?php
$this->render_settings_sections( $data['id'] );
?>
</div>
<div class="wpr-Page-col wpr-Page-col--fixed">
<div class="wpr-optionHeader">
<h3 class="wpr-title2"><?php esc_html_e( 'Quick Actions', 'rocket' ); ?></h3>
</div>
<div class="wpr-fieldsContainer">
<fieldset class="wpr-fieldsContainer-fieldset">
<?php if ( current_user_can( 'rocket_purge_cache' ) ) : ?>
<div class="wpr-field">
<h4 class="wpr-title3"><?php esc_html_e( 'Remove all cached files', 'rocket' ); ?></h4>
<?php
$this->render_action_button(
'link',
'purge_cache',
[
'label' => __( 'Clear cache', 'rocket' ),
'parameters' => [
'type' => 'all',
],
'attributes' => [
'class' => 'wpr-button wpr-button--icon wpr-button--small wpr-icon-trash',
],
]
);
?>
</div>
<?php endif; ?>
<?php if ( get_rocket_option( 'manual_preload' ) && current_user_can( 'rocket_preload_cache' ) ) : ?>
<div class="wpr-field">
<h4 class="wpr-title3"><?php esc_html_e( 'Start cache preloading', 'rocket' ); ?></h4>
<?php
$this->render_action_button(
'link',
'preload',
[
'label' => __( 'Preload cache', 'rocket' ),
'attributes' => [
'class' => 'wpr-button wpr-button--icon wpr-button--small wpr-icon-refresh',
],
]
);
?>
</div>
<?php endif; ?>
<?php
$opcache_enabled = filter_var( ini_get( 'opcache.enable' ), FILTER_VALIDATE_BOOLEAN ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
$restrict_api = ini_get( 'opcache.restrict_api' ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
$can_restrict_api = true; // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
if ( $restrict_api && strpos( __FILE__, $restrict_api ) !== 0 ) {
$can_restrict_api = false; // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
}
if ( function_exists( 'opcache_reset' ) && $opcache_enabled && current_user_can( 'rocket_purge_opcache' ) && $can_restrict_api ) :
?>
<div class="wpr-field">
<h4 class="wpr-title3"><?php esc_html_e( 'Purge OPCache content', 'rocket' ); ?></h4>
<?php
$this->render_action_button(
'link',
'rocket_purge_opcache',
[
'label' => __( 'Purge OPCache', 'rocket' ),
'attributes' => [
'class' => 'wpr-button wpr-button--icon wpr-button--small wpr-icon-trash',
],
]
);
?>
</div>
<?php endif; ?>
<?php if ( get_rocket_option( 'async_css' ) && apply_filters( 'do_rocket_critical_css_generation', true ) && current_user_can( 'rocket_regenerate_critical_css' ) ) : // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound ?>
<div class="wpr-field">
<h4 class="wpr-title3"><?php esc_html_e( 'Regenerate Critical CSS', 'rocket' ); ?></h4>
<?php
$this->render_action_button(
'link',
'rocket_generate_critical_css',
[
'label' => __( 'Regenerate Critical CSS', 'rocket' ),
'attributes' => [
'class' => 'wpr-button wpr-button--icon wpr-button--small wpr-icon-refresh',
],
]
);
?>
</div>
<?php endif; ?>
</fieldset>
</div>
</div>
</div>
<div class="wpr-Page-row">
<div class="wpr-Page-col">
<?php $this->render_part( 'getting-started' ); ?>
<div class="wpr-optionHeader">
<h3 class="wpr-title2"><?php esc_html_e( 'Frequently Asked Questions', 'rocket' ); ?></h3>
</div>
<div class="wpr-fieldsContainer-fieldset">
<div class="wpr-field">
<ul class="wpr-field-list">
<?php foreach ( $data['faq'] as $rocket_faq_item ) : ?>
<li class="wpr-icon-information"><a href="<?php echo esc_url( $rocket_faq_item['url'] ); ?>" data-beacon-article="<?php echo esc_attr( $rocket_faq_item['id'] ); ?>" target="_blank"><?php echo esc_html( $rocket_faq_item['title'] ); ?></a></li>
<?php endforeach; ?>
</ul>
</div>
<div class="wpr-field">
<div class="wpr-flex wpr-flex--egal">
<div>
<h3 class="wpr-title2"><?php esc_html_e( 'Still cannot find a solution?', 'rocket' ); ?></h3>
<p class="wpr-field-description"><?php esc_html_e( 'Submit a ticket and get help from our friendly and knowledgeable Rocketeers.', 'rocket' ); ?></p>
</div>
<div>
<?php
$this->render_action_button(
'link',
'ask_support',
[
'label' => __( 'Ask support', 'rocket' ),
'attributes' => [
'class' => 'wpr-button wpr-button--icon wpr-button--small wpr-button--blue wpr-icon-help wpr-js-askSupport',
'target' => '_blank',
],
]
);
?>
</div>
</div>
</div>
</div>
</div>
<div class="wpr-Page-col wpr-Page-col--fixed">
<?php $this->render_part( 'documentation' ); ?>
</div>
</div>
</div>

View File

@@ -0,0 +1,29 @@
<?php
/**
* Database section template.
*
* @since 3.0
*
* @param array {
* Section arguments.
*
* @type string $id Page section identifier.
* @type string $title Page section title.
* }
*/
defined( 'ABSPATH' ) || exit;
?>
<div id="<?php echo esc_attr( $data['id'] ); ?>" class="wpr-Page">
<div class="wpr-sectionHeader">
<h2 class="wpr-title1 wpr-icon-database"><?php echo esc_html( $data['title'] ); ?></h2>
</div>
<?php $this->render_settings_sections( $data['id'] ); ?>
<div class="wpr-fieldsContainer-helper wpr-icon-important">
<?php esc_html_e( 'Backup your database before you run a cleanup!', 'rocket' ); ?>
<p><?php esc_html_e( 'Once a database optimization has been performed, there is no way to undo it.', 'rocket' ); ?></p>
</div>
<input type="submit" class="wpr-button" name="wp_rocket_settings[submit_optimize]" value="<?php esc_attr_e( 'Save Changes and Optimize', 'rocket' ); ?>">
</div>

View File

@@ -0,0 +1,24 @@
<?php
/**
* CSS & Javascript section template.
*
* @since 3.0
*
* @param array {
* Section arguments.
*
* @type string $id Page section identifier.
* @type string $title Page section title.
* }
*/
defined( 'ABSPATH' ) || exit;
?>
<div id="<?php echo esc_attr( $data['id'] ); ?>" class="wpr-Page">
<div class="wpr-sectionHeader">
<h2 class="wpr-title1 wpr-icon-stack"><?php echo esc_html( $data['title'] ); ?></h2>
</div>
<?php $this->render_settings_sections( $data['id'] ); ?>
</div>

View File

@@ -0,0 +1,25 @@
<?php
/**
* Heartbeat section template.
*
* @since 3.2
* @author Grégory Viguier
*
* @param array {
* Section arguments.
*
* @type string $id Page section identifier.
* @type string $title Page section title.
* }
*/
defined( 'ABSPATH' ) || exit;
?>
<div id="<?php echo esc_attr( $data['id'] ); ?>" class="wpr-Page">
<div class="wpr-sectionHeader">
<h2 class="wpr-title1 wpr-icon-heartbeat-hover"><?php echo esc_html( $data['title'] ); ?></h2>
</div>
<?php $this->render_settings_sections( $data['id'] ); ?>
</div>

View File

@@ -0,0 +1,49 @@
<?php
/**
* Imagify section template.
*
* @since 3.2
*/
defined( 'ABSPATH' ) || exit;
?>
<div id="imagify" class="wpr-Page">
<div class="wpr-sectionHeader">
<h2 class="wpr-title1 wpr-icon-imagify-hover"><?php esc_html_e( 'Image Optimization', 'rocket' ); ?></h2>
</div>
<div class="wpr-imagify">
<div class="wpr-imagify-description">
<p>
<?php
// Translators: %1$s = <strong>, %2$s = </strong>, %3$s = <span class="imagify-name">, %4$s = </span>.
printf( esc_html__( '%1$sWP ROCKET%2$s created %3$sIMAGIFY%4$s %1$sfor best-in-class image optimization.%2$s', 'rocket' ), '<strong>', '</strong>', '<span class="wpr-imagify-name">', '</span>' );
?>
</p>
<p><?php esc_html_e( 'Compress image to make your website faster, all while maintaining image quality.', 'rocket' ); ?></p>
<p class="wpr-imagify-more"><?php esc_html_e( 'More on Imagify:', 'rocket' ); ?></p>
<ul>
<li><a href="https://wordpress.org/plugins/imagify/" target="_blank" rel="noopener noreferrer"><?php esc_html_e( 'Imagify Plugin Page', 'rocket' ); ?></a></li>
<li><a href="https://imagify.io/?utm_source=wp_plugin&utm_medium=wp-rocket&utm_campaign=partnership" target="_blank" rel="noopener noreferrer"><?php esc_html_e( 'Imagify Website', 'rocket' ); ?></a></li>
<li><a href="https://www.imagely.com/image-optimization-plugin-comparison/" target="_blank" rel="noopener noreferrer"><?php esc_html_e( 'Review of Image Compression Plugins', 'rocket' ); ?></a></li>
</ul>
<?php
if ( ! \Imagify_Partner::is_imagify_activated() ) {
$imagify = new \Imagify_Partner( 'wp-rocket' ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
if ( \Imagify_Partner::is_imagify_installed() ) {
$button_text = __( 'Activate Imagify', 'rocket' ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
} else {
$button_text = __( 'Install Imagify', 'rocket' ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
}
echo '<a class="button-primary" href="' . esc_url( $imagify->get_post_install_url() ) . '">' . esc_html( $button_text ) . '</a>';
}
?>
</div>
<div class="wpr-imagify-screenshot">
<img src="https://wp-rocket.me/wp-content/uploads/1/imagify.jpg?ver=<?php echo esc_attr( time() ); ?>" alt="" width="613" height="394">
</div>
</div>
</div>

View File

@@ -0,0 +1,61 @@
<?php
/**
* License section template.
*
* @since 3.0
*
* @param array {
* Section arguments.
*
* @type string $id Page section identifier.
* @type string $title Page section title.
* }
*/
defined( 'ABSPATH' ) || exit;
?>
<div class="wpr-sectionHeader">
<h2 id="<?php echo esc_attr( $data['id'] ); ?>" class="wpr-title1 wpr-icon-important"><?php echo esc_html( $data['title'] ); ?></h2>
<div class="wpr-sectionHeader-title wpr-title3">
<?php esc_html_e( 'WP Rocket was not able to automatically validate your license.', 'rocket' ); ?>
</div>
<div class="wpr-sectionHeader-description">
<?php
// translators: %1$s = tutorial URL, %2$s = support URL.
printf(
// translators: %1$s = tutorial URL, %2$s = support URL.
esc_html__( 'Follow this %1$s, or contact %2$s to get the engine started.', 'rocket' ),
sprintf(
// translators: %1$s = <a href=", %2$s = tutorial href, %3$s = " target="_blank">, %4$s = </a>.
esc_html__( '%1$s%2$s%3$stutorial%4$s', 'rocket' ),
'<a href="',
esc_url( __( 'https://docs.wp-rocket.me/article/100-resolving-problems-with-license-validation/?utm_source=wp_plugin&utm_medium=wp_rocket', 'rocket' ) ),
'" target="_blank">',
'</a>'
),
sprintf(
// translators: %1$s = <a href=", %2$s = support href, %3$s = " target="_blank">, %4$s = </a>.
esc_html__( '%1$s%2$s%3$ssupport%4$s', 'rocket' ),
'<a href="',
rocket_get_external_url( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Dynamic content is properly escaped in the view.
'support',
[
'utm_source' => 'wp_plugin',
'utm_medium' => 'wp_rocket',
]
),
'" target="_blank">',
'</a>'
)
);
?>
</div>
</div><br>
<div class="wpr-fieldsContainer">
<div class="wpr-fieldsContainer-fieldset wpr-fieldsContainer-fieldset--split">
<?php $this->render_settings_sections( $data['id'] ); ?>
</div>
</div>

View File

@@ -0,0 +1,24 @@
<?php
/**
* Media section template.
*
* @since 3.0
*
* @param array {
* Section arguments.
*
* @type string $id Page section identifier.
* @type string $title Page section title.
* }
*/
defined( 'ABSPATH' ) || exit;
?>
<div id="<?php echo esc_attr( $data['id'] ); ?>" class="wpr-Page">
<div class="wpr-sectionHeader">
<h2 class="wpr-title1 wpr-icon-media"><?php echo esc_html( $data['title'] ); ?></h2>
</div>
<?php $this->render_settings_sections( $data['id'] ); ?>
</div>

View File

@@ -0,0 +1,40 @@
<?php
/**
* CDN section template.
*
* @since 3.0
*
* @param array {
* Section arguments.
*
* @type string $id Page section identifier.
* @type string $title Page section title.
* }
*/
defined( 'ABSPATH' ) || exit;
?>
<div id="<?php echo esc_attr( $data['id'] ); ?>" class="wpr-Page">
<div class="wpr-sectionHeader">
<h2 class="wpr-title1 wpr-icon-cdn"><?php echo esc_html( $data['title'] ); ?></h2>
</div>
<?php
/**
* Fires before displaying CDN sections on WP Rocket settings page
*
* @since 3.5
*/
do_action( 'rocket_before_cdn_sections' );
?>
<?php $this->render_settings_sections( $data['id'] ); ?>
<?php
/**
* Fires after displaying CDN sections on WP Rocket settings page
*
* @since 3.5
*/
do_action( 'rocket_after_cdn_sections' );
?>
</div>

View File

@@ -0,0 +1,24 @@
<?php
/**
* Preload section template.
*
* @since 3.0
*
* @param array {
* Section arguments.
*
* @type string $id Page section identifier.
* @type string $title Page section title.
* }
*/
defined( 'ABSPATH' ) || exit;
?>
<div id="<?php echo esc_attr( $data['id'] ); ?>" class="wpr-Page">
<div class="wpr-sectionHeader">
<h2 class="wpr-title1 wpr-icon-refresh"><?php echo esc_html( $data['title'] ); ?></h2>
</div>
<?php $this->render_settings_sections( $data['id'] ); ?>
</div>

View File

@@ -0,0 +1,55 @@
<?php
/**
* Sucuri Cache section template.
*
* @since 3.2
* @author Grégory Viguier
*
* @param array {
* Section arguments.
*
* @type string $id Page section identifier.
* @type string $title Page section title.
* }
*/
defined( 'ABSPATH' ) || exit;
?>
<div id="<?php echo esc_attr( $data['id'] ); ?>" class="wpr-Page">
<div class="wpr-sectionHeader">
<h2 class="wpr-title1">
<img src="<?php echo esc_url( WP_ROCKET_ASSETS_IMG_URL . 'logo-sucuri.png' ); ?>" width="99" height="35" alt="<?php echo esc_attr( $data['title'] ); ?>">
</h2>
</div>
<?php $this->render_settings_sections( $data['id'] ); ?>
<?php if ( current_user_can( 'rocket_purge_sucuri_cache' ) ) : ?>
<div class="wpr-optionHeader">
<h3 class="wpr-title2"><?php echo esc_html( $data['title'] ); ?></h3>
</div>
<div class="wpr-fieldsContainer">
<div class="wpr-fieldsContainer-description">
<?php
printf(
// translators: %s is a "Learn more" link.
esc_html__( 'Purges cached resources for your website. %s', 'rocket' ),
'<a href="https://kb.sucuri.net/firewall/Performance/clearing-cache" target="_blank">' . esc_html__( 'Learn more', 'rocket' ) . '</a>'
);
?>
</div><br>
<?php
$this->render_action_button(
'link',
'rocket_purge_sucuri',
[
'label' => __( 'Clear all Sucuri cache files', 'rocket' ),
'attributes' => [
'class' => 'wpr-button wpr-button--icon wpr-button--small wpr-button--purple wpr-icon-trash',
],
]
);
?>
</div>
<?php endif; ?>
</div>

View File

@@ -0,0 +1,119 @@
<?php
/**
* Import page section template.
*
* @since 3.0
*/
use WP_Rocket\Logger\Logger;
defined( 'ABSPATH' ) || exit;
// Debug mode.
$rocket_log_description = '';
if ( rocket_direct_filesystem()->exists( Logger::get_log_file_path() ) ) {
$rocket_stats = Logger::get_log_file_stats();
if ( ! is_wp_error( $rocket_stats ) ) {
// translators: %1$s = formatted file size, %2$s = formatted number of entries (don't use %2$d).
$rocket_log_description .= sprintf( esc_html__( 'Files size: %1$s. Number of entries: %2$s.', 'rocket' ), '<strong>' . esc_html( $rocket_stats['bytes'] ) . '</strong>', '<strong>' . esc_html( $rocket_stats['entries'] ) . '</strong>' );
// translators: %1$s = opening <a> tag, %2$s = closing </a> tag.
$rocket_log_description .= '<br/>' . sprintf( esc_html__( '%1$sDownload the file%2$s.', 'rocket' ), '<a href="' . esc_url( wp_nonce_url( admin_url( 'admin-post.php?action=rocket_download_debug_file' ), 'download_debug_file' ) ) . '">', '</a>' );
// translators: %1$s = opening <a> tag, %2$s = closing </a> tag.
$rocket_log_description .= ' - ' . sprintf( esc_html__( '%1$sDelete the file%2$s.', 'rocket' ), '<a href="' . esc_url( wp_nonce_url( admin_url( 'admin-post.php?action=rocket_delete_debug_file' ), 'delete_debug_file' ) ) . '">', '</a>' );
}
}
?>
<div id="tools" class="wpr-Page">
<div class="wpr-sectionHeader">
<h2 class="wpr-title1 wpr-icon-tools"><?php esc_html_e( 'Tools', 'rocket' ); ?></h2>
</div>
<div class="wpr-tools">
<div class="wpr-tools-col">
<div class="wpr-title3 wpr-tools-label wpr-icon-export"><?php esc_html_e( 'Export settings', 'rocket' ); ?></div>
<div class="wpr-field-description"><?php esc_html_e( 'Download a backup file of your settings', 'rocket' ); ?></div>
</div>
<div class="wpr-tools-col">
<?php
$this->render_action_button(
'link',
'rocket_export',
[
'label' => __( 'Download settings', 'rocket' ),
'attributes' => [
'class' => 'wpr-button wpr-button--icon wpr-button--small wpr-button--purple wpr-icon-chevron-down',
],
]
);
?>
</div>
</div>
<?php $this->render_import_form(); ?>
<div class="wpr-tools">
<div class="wpr-tools-col">
<div class="wpr-title3 wpr-tools-label wpr-icon-rollback"><?php esc_html_e( 'Rollback', 'rocket' ); ?></div>
<div class="wpr-field-description">
<?php
// translators: %s = WP Rocket version number.
printf( esc_html__( 'Has version %s caused an issue on your website?', 'rocket' ), esc_html( WP_ROCKET_VERSION ) );
?>
<br><br>
<?php
// translators: %s = <br>.
printf( esc_html__( 'You can rollback to the previous major version here.%sThen send us a support request.', 'rocket' ), '<br/>' );
?>
</div>
</div>
<div class="wpr-tools-col">
<?php
$this->render_action_button(
'link',
'rocket_rollback',
[
// translators: %s = WP Rocket previous version.
'label' => sprintf( __( 'Reinstall version %s', 'rocket' ), WP_ROCKET_LASTVERSION ),
'attributes' => [
'class' => 'wpr-button wpr-button--icon wpr-button--small wpr-button--red wpr-icon-refresh',
],
]
);
?>
</div>
</div>
<?php
/**
* Fires after the Settings Tools page content
*
* @since 3.6
*/
do_action( 'rocket_settings_tools_content' );
?>
<!-- Temporary hide the option. The logger can still be activated by adding the following to the wp-config.php file: define( 'WP_ROCKET_DEBUG', true );
<div class="wpr-tools">
<div class="wpr-tools-col wpr-radio">
<div class="wpr-title3 wpr-tools-label">
<input id="debug_enabled" name="wp_rocket_settings[debug_enabled]" value="1"<?php checked( true, Logger::debug_enabled() ); ?> type="checkbox">
<label for="debug_enabled">
<span data-l10n-active="On" data-l10n-inactive="Off" class="wpr-radio-ui"></span>
<?php esc_html_e( 'Debug mode', 'rocket' ); ?>
</label>
</div>
<div class="wpr-field-description">
<?php esc_html_e( 'Create a debug log file.', 'rocket' ); ?>
</div>
</div>
<div class="wpr-tools-col">
<?php echo $rocket_log_description; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Dynamic content is properly escaped in the view. ?>
</div>
</div>
-->
</div>

View File

@@ -0,0 +1,65 @@
<?php
/**
* Tutorials section template.
*
* @since 3.4
*/
defined( 'ABSPATH' ) || exit;
$rocket_tutorials = [
[
'title' => __( 'Getting Started', 'rocket' ),
'tutorials' => [
'7seqacq2ol' => __( 'Getting Started with WP Rocket', 'rocket' ),
'fj42vucf99' => __( 'Finding the Best Settings for Your Site', 'rocket' ),
'z1qxl7s2zn' => __( 'How to Check if WP Rocket is Caching Your Site', 'rocket' ),
'j042jylrre' => __( 'How to Measure the Speed of Your Site', 'rocket' ),
],
],
[
'title' => __( 'File Optimization', 'rocket' ),
'tutorials' => [
'frwm2xrksl' => __( 'Troubleshooting Display Issues with File Optimization', 'rocket' ),
'95z0cb0yxb' => __( 'How to Find the Right JavaScript to Exclude', 'rocket' ),
'9m1zg8p5wc' => __( 'How External Content Slows Your Site', 'rocket' ),
],
],
[
'title' => __( 'Preload', 'rocket' ),
'tutorials' => [
'803tlui8oi' => __( 'How Preloading Works', 'rocket' ),
],
],
[
'title' => __( 'Add-ons', 'rocket' ),
'tutorials' => [
'09kolaz9o0' => __( 'Set Up the Cloudflare Add-on', 'rocket' ),
],
],
];
?>
<div id="tutorials" class="wpr-Page">
<div class="wpr-sectionHeader">
<h2 class="wpr-title1 wpr-icon-tutorial-hover"><?php esc_html_e( 'Tutorials', 'rocket' ); ?></h2>
</div>
<div class="wpr-Page-row">
<div class="wpr-Page-col">
<?php foreach ( $rocket_tutorials as $section ) : // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound ?>
<div class="wpr-optionHeader">
<h3 class="wpr-title2"><?php echo esc_html( $section['title'] ); ?></h3>
</div>
<div class="wpr-field wpr-tutorials-section">
<?php foreach ( $section['tutorials'] as $rocket_tutorial_id => $rocket_tutorial_title ) : ?>
<div class="wpr-tutorial-item">
<?php // phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedScript ?>
<script src="https://fast.wistia.com/embed/medias/<?php echo esc_attr( $rocket_tutorial_id ); ?>.jsonp" async></script><div class="wistia_responsive_padding" style="padding:56.25% 0 0 0;position:relative;"><div class="wistia_responsive_wrapper" style="height:100%;left:0;position:absolute;top:0;width:100%;"><span class="wistia_embed wistia_async_<?php echo esc_attr( $rocket_tutorial_id ); ?> popover=true popoverAnimateThumbnail=true videoFoam=true" style="display:inline-block;height:100%;position:relative;width:100%">&nbsp;</span></div></div>
<h4 class="wpr-fieldsContainer-description"><?php echo esc_html( $rocket_tutorial_title ); ?></h4>
</div>
<?php endforeach; ?>
</div>
<?php endforeach; ?>
</div>
</div>
</div>

View File

@@ -0,0 +1,114 @@
<?php
/**
* Settings page template.
*
* @since 3.0
*
* @param array $data {
* @type string $slug WP Rocket slug.
* }
*/
defined( 'ABSPATH' ) || exit;
settings_errors( $data['slug'] ); ?>
<div class="wpr-wrap wrap">
<h1 class="screen-reader-text"><?php esc_html_e( 'WP Rocket Settings', 'rocket' ); ?></h1>
<div class="wpr-body">
<header class="wpr-Header">
<div class="wpr-Header-logo">
<img src="<?php echo esc_url( WP_ROCKET_ASSETS_IMG_URL . 'logo-wprocket-dark.svg' ); ?>" width="163" height="44" alt="Logo WP Rocket" class="wpr-Header-logo-desktop">
<img src="<?php echo esc_url( WP_ROCKET_ASSETS_IMG_URL . 'picto-wprocket-dark.svg' ); ?>" width="28" height="50" alt="Logo WP Rocket" class="wpr-Header-logo-mobile">
</div>
<div class="wpr-Header-nav">
<?php $this->render_navigation(); ?>
</div>
<div class="wpr-Header-footer">
<?php
// translators: %s = Plugin version number.
echo esc_html( sprintf( __( 'version %s', 'rocket' ), rocket_get_constant( 'WP_ROCKET_VERSION' ) ) );
?>
</div>
</header>
<section class="wpr-Content">
<form action="options.php" method="POST" id="<?php echo esc_attr( $data['slug'] ); ?>_options">
<?php settings_fields( $data['slug'] ); ?>
<?php $this->render_form_sections(); ?>
<?php $this->render_hidden_fields(); ?>
<input type="submit" class="wpr-button" id="wpr-options-submit" value="<?php echo esc_attr( $data['btn_submit_text'] ); ?>">
</form>
<?php
if ( rocket_valid_key() ) {
if ( ! \Imagify_Partner::has_imagify_api_key() ) {
$this->render_imagify_section();
}
$this->render_tools_section();
$this->render_tutorials_section();
?>
<div class="wpr-Content-tips">
<div class="wpr-radio wpr-radio--reverse wpr-radio--tips">
<input type="checkbox" class="wpr-js-tips" id="wpr-js-tips" value="1" checked>
<label for="wpr-js-tips">
<span data-l10n-active="<?php echo esc_attr_x( 'On', 'Active state of checkbox', 'rocket' ); ?>"
data-l10n-inactive="<?php echo esc_attr_x( 'Off', 'Inactive state of checkbox', 'rocket' ); ?>" class="wpr-radio-ui"></span>
<?php esc_html_e( 'Show Sidebar', 'rocket' ); ?></label>
</div>
</div>
<?php
}
?>
</section>
<aside class="wpr-Sidebar">
<?php $this->render_part( 'sidebar' ); ?>
</aside>
</div>
<div class="wpr-Popin wpr-Popin-Beta">
<div class="wpr-Popin-header">
<h2 class="wpr-title1"><?php esc_html_e( 'Rocket Tester', 'rocket' ); ?></h2>
<button class="wpr-Popin-close wpr-Popin-Beta-close wpr-icon-close"></button>
</div>
<div class="wpr-Popin-content">
<p><?php esc_html_e( 'Thanks for choosing to participate in the WP Rocket beta program!', 'rocket' ); ?></p>
<p><?php esc_html_e( 'A beta version is usually one that has new features and improvements, but we want to test it a little more before full launch.', 'rocket' ); ?></p>
<p><?php esc_html_e( 'Wed love it if you took our beta versions for a ride, but please keep in mind that it might be less stable than our other releases. Dont worry, you can switch back to a full release version at any time.', 'rocket' ); ?></p>
<p><?php esc_html_e( 'Your mission: please send all feedback about our beta versions, including bug reports, to support@wp-rocket.me', 'rocket' ); ?></p>
<div class="wpr-Popin-flex">
<p><?php esc_html_e( 'If you dont want to join the beta program, simply close this window.', 'rocket' ); ?></p>
<div>
<button class="wpr-button wpr-button--small wpr-button--icon wpr-icon-check wpr-button--blue"><?php esc_html_e( 'Activate Rocket Tester', 'rocket' ); ?></button>
</div>
</div>
</div>
</div>
<div class="wpr-Popin wpr-Popin-Analytics">
<div class="wpr-Popin-header">
<h2 class="wpr-title1"><?php esc_html_e( 'Rocket Analytics', 'rocket' ); ?></h2>
<button class="wpr-Popin-close wpr-Popin-Analytics-close wpr-icon-close"></button>
</div>
<div class="wpr-Popin-content">
<p><?php esc_html_e( 'Below is a detailed view of all data WP Rocket will collect <strong>if granted permission.</strong>', 'rocket' ); ?></p>
<?php echo rocket_data_collection_preview_table(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Dynamic content is properly escaped in the view. ?>
<div class="wpr-Popin-flex">
<p><?php esc_html_e( 'WP Rocket will never transmit any domain names or email addresses (except for license validation), IP addresses, or third-party API keys.', 'rocket' ); ?></p>
<div>
<button class="wpr-button wpr-button--small wpr-button--icon wpr-icon-check wpr-button--blue"><?php esc_html_e( 'Activate Rocket analytics', 'rocket' ); ?></button>
</div>
</div>
</div>
</div>
<div class="wpr-Popin-overlay"></div>
<?php
/**
* Fires after the Settings page content
*
* @since 3.5
* @author Remy Perona
*/
do_action( 'rocket_settings_page_footer' );
?>
</div>

View File

@@ -0,0 +1,31 @@
<?php
/**
* Documentation block template.
*
* @since 3.0
*/
defined( 'ABSPATH' ) || exit;
?>
<div class="wpr-documentation">
<i class="wpr-icon-book"></i>
<h3 class="wpr-title2"><?php esc_html_e( 'Documentation', 'rocket' ); ?></h3>
<p><?php esc_html_e( 'It is a great starting point to fix some of the most common issues.', 'rocket' ); ?></p>
<?php
$this->render_action_button(
'link',
'documentation',
[
'label' => __( 'Read the documentation', 'rocket' ),
'attributes' => [
'target' => '_blank',
'class' => 'wpr-button wpr-button--small wpr-button--blueDark',
],
]
);
?>
</div>

View File

@@ -0,0 +1,29 @@
<?php
/**
* Getting Started block template.
*
* @since 3.4
*/
defined( 'ABSPATH' ) || exit;
$rocket_tutorials = [
'7seqacq2ol' => __( 'What WP Rocket Does For You By Default', 'rocket' ),
'fj42vucf99' => __( 'Finding the Best Settings for Your Site', 'rocket' ),
'z1qxl7s2zn' => __( 'How to Check if WP Rocket is Caching Your Site', 'rocket' ),
'j042jylrre' => __( 'How to Measure the Speed of Your Site', 'rocket' ),
];
?>
<div class="wpr-optionHeader">
<h3 class="wpr-title2"><?php esc_html_e( 'Getting Started', 'rocket' ); ?></h3>
</div>
<div class="wpr-fieldsContainer-fieldset">
<div class="wpr-field">
<ul class="wpr-field-list">
<?php foreach ( $rocket_tutorials as $rocket_tutorial_id => $rocket_tutorial_title ) : ?>
<?php // phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedScript ?>
<li class="wpr-icon-tutorial-alt"><script src="https://fast.wistia.com/embed/medias/<?php echo esc_attr( $rocket_tutorial_id ); ?>.jsonp" async></script><span class="wpr-tutorial-link wistia_embed wistia_async_<?php echo esc_attr( $rocket_tutorial_id ); ?> popover=true popoverContent=link" style="display:inline;position:relative"><?php echo esc_html( $rocket_tutorial_title ); ?></span></li>
<?php endforeach; ?>
</ul>
</div>
</div>

View File

@@ -0,0 +1,34 @@
<?php
/**
* Sidebar template.
*
* @since 3.0
*/
defined( 'ABSPATH' ) || exit;
?>
<h3 class="wpr-Sidebar-title wpr-title2"><?php esc_html_e( 'How to correctly measure your websites loading time', 'rocket' ); ?></h3>
<div class="wpr-Sidebar-notice">
<p><?php esc_html_e( 'Check our tutorial and learn how to measure the speed of your site.', 'rocket' ); ?></p>
<?php // phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedScript ?>
<script src="https://fast.wistia.com/embed/medias/j042jylrre.jsonp" async></script><img src="<?php echo esc_url( WP_ROCKET_ASSETS_IMG_URL . 'play-alt.svg' ); ?>" width="10" height="10" alt=""> <span class="wpr-tutorial-link wpr-Sidebar-notice-link wistia_embed wistia_async_j042jylrre popover=true popoverContent=link" style="display:inline;position:relative"><?php esc_html_e( 'Watch the video', 'rocket' ); ?></span>
</div>
<div class="wpr-Sidebar-notice">
<p><?php esc_html_e( 'Learn how to use best practices to correctly measure your site\'s performance.', 'rocket' ); ?></p>
<a href="<?php echo esc_url( __( 'https://wp-rocket.me/blog/correctly-measure-websites-page-load-time/?utm_source=wp_plugin&utm_medium=wp_rocket', 'rocket' ) ); ?>" target="_blank" class="wpr-Sidebar-notice-link"><?php esc_html_e( 'Read our guide', 'rocket' ); ?></a>
</div>
<div class="wpr-Sidebar-notice">
<p><?php esc_html_e( 'Why Google PageSpeed grade should not matter', 'rocket' ); ?></p>
<a href="<?php echo esc_url( __( 'https://wp-rocket.me/blog/the-truth-about-google-pagespeed-insights/?utm_source=wp_plugin&utm_medium=wp_rocket', 'rocket' ) ); ?>" target="_blank" class="wpr-Sidebar-notice-link"><?php esc_html_e( 'Read more', 'rocket' ); ?></a>
</div>
<?php if ( ! get_rocket_option( 'cache_logged_user', 0 ) ) : ?>
<div class="wpr-Sidebar-info">
<i class="wpr-icon-information2"></i>
<h4><?php esc_html_e( 'You have not activated logged-in user cache.', 'rocket' ); ?></h4>
<p><?php esc_html_e( 'Use a private browser to check your website\'s speed and visual appearance.', 'rocket' ); ?></p>
</div>
<?php endif; ?>
<?php
$this->render_part( 'documentation' );

View File

@@ -0,0 +1,33 @@
<?php
/**
* Settings fields container template.
*
* @since 3.0
*
* @param array $data {
* Fields container data.
*
* @type string $id Section identifier.
* @type string $title Section title.
* @type string $description Section description.
* @type string $page Page section identifier.
* }
*/
defined( 'ABSPATH' ) || exit;
?>
<div class="wpr-optionHeader">
<h3 class="wpr-title2"><?php echo esc_html( $data['title'] ); ?></h3>
<?php if ( ! empty( $data['help'] ) ) : ?>
<button data-beacon-id="<?php echo esc_attr( $data['help'] ); ?>" class="wpr-infoAction wpr-infoAction--help wpr-icon-help"><?php esc_html_e( 'Need Help?', 'rocket' ); ?></button>
<?php endif; ?>
</div>
<div class="wpr-fieldsContainer">
<div class="wpr-fieldsContainer-description">
<?php echo esc_html( $data['description'] ); ?>
</div>
<?php $this->render_settings_fields( $data['page'], $data['id'] ); ?>
</div>

View File

@@ -0,0 +1,46 @@
<?php
/**
* Settings fields container template.
*
* @since 3.0
*
* @param array $data {
* Fields container data.
*
* @type string $id Section identifier.
* @type string $title Section title.
* @type string $description Section description.
* @type string $class Section classes.
* @type string $helper Section helper text.
* @type string $help Data to pass to beacon.
* @type string $page Page section identifier.
* }
*/
defined( 'ABSPATH' ) || exit;
?>
<div class="wpr-optionHeader <?php echo esc_attr( $data['class'] ); ?>">
<h3 class="wpr-title2"><?php echo esc_html( $data['title'] ); ?></h3>
<?php if ( ! empty( $data['help'] ) ) : ?>
<a href="<?php echo esc_url( $data['help']['url'] ); ?>" data-beacon-id="<?php echo esc_attr( $data['help']['id'] ); ?>" class="wpr-infoAction wpr-infoAction--help wpr-icon-help" target="_blank"><?php esc_html_e( 'Need Help?', 'rocket' ); ?></a>
<?php endif; ?>
</div>
<div class="wpr-fieldsContainer <?php echo esc_attr( $data['class'] ); ?>">
<div class="wpr-fieldsContainer-description">
<?php echo $data['description']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Dynamic content is properly escaped in the view. ?>
</div>
<fieldset class="wpr-fieldsContainer-fieldset">
<?php $this->render_settings_fields( $data['page'], $data['id'] ); ?>
</fieldset>
<?php if ( ! empty( $data['helper'] ) ) : ?>
<div class="wpr-fieldsContainer-helper wpr-icon-important">
<?php echo $data['helper']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Dynamic content is properly escaped in the view. ?>
</div>
<?php endif; ?>
</div>

View File

@@ -0,0 +1,23 @@
<?php
/**
* Settings fields wrapper template.
*
* @since 3.0
*
* @param array $data {
* Fields container data.
*
* @type string $id Section identifier.
* @type string $title Section title.
* @type string $description Section description.
* @type string $help Data to pass to beacon.
* @type string $page Page section identifier.
* }
*/
defined( 'ABSPATH' ) || exit;
?>
<?php echo esc_html( $data['title'] ); ?>
<?php
$this->render_settings_fields( $data['page'], $data['id'] );