add wp-rocket
This commit is contained in:
@@ -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>
|
@@ -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
|
123
wp-content/plugins/wp-rocket/views/settings/fields/cnames.php
Normal file
123
wp-content/plugins/wp-rocket/views/settings/fields/cnames.php
Normal 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>
|
@@ -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'] ); ?>">
|
@@ -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
|
||||
}
|
@@ -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>
|
@@ -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>
|
@@ -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>
|
@@ -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>
|
@@ -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>
|
@@ -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>
|
43
wp-content/plugins/wp-rocket/views/settings/fields/text.php
Normal file
43
wp-content/plugins/wp-rocket/views/settings/fields/text.php
Normal 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>
|
@@ -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>
|
Reference in New Issue
Block a user