This commit is contained in:
2026-10-06 18:51:23 -06:00
parent 8424dacd03
commit e2c26b7f21
4223 changed files with 737986 additions and 53 deletions
@@ -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,103 @@
<?php
/**
* Select field template.
*
* @param array $data {
* Radio buttons 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 $items Exclusion list.
* @type array $items Exclusion list.
* @type array $wp_rocket_scripts Script exclusion list.
* @type array $wp_rocket_themes Theme exclusion list.
* @type array $wp_rocket_plugins Plugin exclusion list.
* @type array $wp_rocket_textarea Textarea exclusion list.
* @type array $wp_rocket_select_exclusions Selected exclusion list values.
* @type array $wp_rocket_state Currently exclusion list.
* @type array $options {
* Option options.
*
* @type string $description Option value.
* @type string $label Option label.
* @type array $sub_fields fields to show when option is selected.
* }
* }
* @since 3.10
*/
defined( 'ABSPATH' ) || exit;
?>
<div id='<?php echo esc_attr( $data['id'] ); ?>' class="wpr-field wpr-multiple-select wpr-field--categorizedmultiselect <?php echo esc_attr( $data['container_class'] ); ?>" data-default="<?php echo ( ! empty( $data['default'] ) ? 'wpr-radio-' . esc_attr( $data['default'] ) : '' ); ?>" <?php echo $data['parent']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- $data['parent'] escaped with esc_attr. ?>>
<div class="wpr-field-description-label"><?php echo esc_attr( $data['label'] ); ?></div>
<div class="wpr-field-description">
<p>
<?php
echo esc_html( $data['description'] );
?>
</p>
<?php if ( ! empty( $data['sub_description'] ) ) { ?>
<p>
<?php
echo esc_html( $data['sub_description'] );
?>
</p>
<?php } ?>
</div>
<?php
foreach ( $data['items'] as $rocket_item_key => $rocket_item ) {
if ( empty( $rocket_item['items'] ) ) {
continue;
}
?>
<div class="wpr-list<?php echo 'scripts' === $rocket_item_key ? ' open' : ''; ?>">
<div class="wpr-list-header">
<div class="wpr-checkbox">
<input class="wpr-main-checkbox" type="checkbox" />
<label>
<?php if ( ! empty( $rocket_item['dashicon-class'] ) ) { ?>
<span class="dashicons dashicons-<?php echo esc_html( $rocket_item['dashicon-class'] ); ?>"></span>
<?php } ?>
<span class="wpr-multiple-select-title">
<?php echo esc_html( $rocket_item['title'] ); ?>
</span>
</label>
</div>
<div class="wpr-list-header-arrow">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" height="100%" width="100%"><path d="M233.4 105.4c12.5-12.5 32.8-12.5 45.3 0l192 192c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L256 173.3 86.6 342.6c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3l192-192z"/></svg>
</div>
</div>
<div class="wpr-list-body">
<ul>
<?php
foreach ( $rocket_item['items'] as $rocket_oneitem ) {
?>
<li>
<div class="wpr-checkbox">
<input type="checkbox" name="wp_rocket_settings[<?php echo esc_attr( $data['id'] ); ?>][]"
value='<?php echo esc_attr( $rocket_oneitem['id'] ); ?>'
<?php echo checked( in_array( $rocket_oneitem['id'], $data['selected'], true ) ); ?> />
<label>
<?php if ( ! empty( $rocket_oneitem['icon'] ) ) { ?>
<img src="<?php echo esc_url( $rocket_oneitem['icon'] ); ?>"/>
<?php } ?>
<?php echo esc_attr( $rocket_oneitem['title'] ); ?>
</label>
</div>
</li>
<?php
}
?>
</ul>
</div>
</div>
<?php
}
unset( $rocket_item_key, $rocket_item, $rocket_oneitem );
?>
</div>
@@ -0,0 +1,80 @@
<?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;
/**
* Fires after displaying the checkbox field on the settings page
*
* @since 3.9
*
* @param string $id ID of the field.
*/
do_action( 'rocket_after_settings_checkbox', $data['id'] );
@@ -0,0 +1,136 @@
<?php
/**
* CNAMES template.
*
* @since 3.0
*/
defined( 'ABSPATH' ) || exit;
$rocket_cnames = get_rocket_option( 'cdn_cnames' );
$rocket_cnames_zone = get_rocket_option( 'cdn_zone' );
/**
* Filters the fields to be disabled for the CDN section.
*
* @since 3.12.1
*
* @param bool $alter Input should be altered.
*/
$rocket_disable_input_alt = apply_filters( 'rocket_disable_cdn_option_change', false );
?>
<div class="wpr-fieldsContainer-fieldset">
<div class="wpr-field <?php echo $rocket_disable_input_alt ? 'wpr-isDisabled' : ''; ?>">
<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" <?php echo $rocket_disable_input_alt ? 'disabled' : ''; ?> />
</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 ); ?>]" <?php echo $rocket_disable_input_alt ? 'disabled' : ''; ?> >
<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>
<?php if ( ! $rocket_disable_input_alt ) : ?>
<button class="dashicons dashicons-no wpr-multiple-close hide-if-no-js"></button>
<?php endif ?>
</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>
<?php if ( ! $rocket_disable_input_alt ) : ?>
<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>
<?php endif ?>
</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,70 @@
<?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="add-on-container <?php echo esc_attr( $data['container_class'] ); ?>">
<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 ); ?> <?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="">
<span data-l10n-active="On" data-l10n-inactive="Off" 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>
</div>
</fieldset>
@@ -0,0 +1,77 @@
<?php
/**
* Select field template.
*
* @since 3.10
*
* @param array $data {
* Radio buttons 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 $options {
* Option options.
*
* @type string $description Option value.
* @type string $label Option label.
* @type array $sub_fields fields to show when option is selected.
* }
* }
*/
defined( 'ABSPATH' ) || exit;
?>
<div id = '<?php echo esc_attr( $data['id'] ); ?>' class="wpr-field wpr-radio-buttons <?php echo esc_attr( $data['container_class'] ); ?>" data-default="<?php echo ( ! empty( $data['default'] ) ? 'wpr-radio-' . esc_attr( $data['default'] ) : '' ); ?>" <?php echo $data['parent']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- $data['parent'] escaped with esc_attr. ?>>
<div class="wpr-radio-buttons-container">
<?php foreach ( $data['options'] as $value => $option ) : // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound ?>
<button id ="wpr-radio-<?php echo esc_attr( $value ); ?>" class="wpr-button wpr-button--gray <?php echo ( $value === $data['value'] ? 'radio-active' : '' ); ?> <?php echo ( ! empty( $option['warning'] ) ? 'has-warning' : '' ); ?>"
data-value="<?php echo esc_attr( $value ); ?>"
<?php echo ( ! empty( $option['disabled'] ) ? 'disabled=' . esc_attr( $option['disabled'] ) : '' ); ?>
>
<?php echo esc_html( $option['label'] ); ?>
</button>
<?php endforeach; ?>
</div>
<?php foreach ( $data['options'] as $value => $option ) : // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound ?>
<?php if ( ! empty( $option['warning'] ) ) : ?>
<div class="wpr-fieldWarning wpr-radio-warning" data-parent="wpr-radio-<?php echo esc_attr( $value ); ?>">
<div class="wpr-fieldWarning-title wpr-icon-important">
<?php echo esc_html( $option['warning']['title'] ); ?>
</div>
<?php if ( isset( $option['warning']['description'] ) ) : ?>
<div class="wpr-fieldWarning-description">
<?php echo $option['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( $option['warning']['button_label'] ); ?></button>
</div>
<?php endif; ?>
<div class="wpr-extra-fields-container wpr-field--children no-space <?php echo ( $value === $data['value'] ? 'wpr-isOpen' : '' ); ?>" data-parent="wpr-radio-<?php echo esc_attr( $value ); ?>">
<div class="wpr-field-description">
<?php if ( ! empty( $option['description'] ) ) : ?>
<div class="wpr-field-description ">
<?php echo $option['description']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Dynamic content is properly escaped in the view. ?>
</div>
<?php endif; ?>
</div>
<?php
do_action(
'rocket_after_settings_radio_options',
[
'option_id' => $value,
'sub_fields' => $option['sub_fields'],
]
);
?>
</div>
<?php endforeach; ?>
</div>
@@ -0,0 +1,77 @@
<?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>
<?php
$rocket_default = true;
// This filter is documented in one-click-addon.php.
$rocket_display = apply_filters( 'rocket_display_input_' . $data['id'], $rocket_default );
if ( ! is_bool( $rocket_display ) ) {
$rocket_display = $rocket_default;
}
if ( $rocket_display ) :
?>
<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 ); ?> <?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="">
<span data-l10n-active="On" data-l10n-inactive="Off" 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; ?>
<?php if ( ! empty( $data['helper'] ) ) : ?>
<div class="wpr-field-helper">
<?php echo $data['helper']; // 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="On"
data-l10n-inactive="Off" 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>
@@ -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>