Commit inicial powerservice
This commit is contained in:
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
|
||||
use WP_Rocket\Buffer\Cache;
|
||||
use WP_Rocket\Buffer\Config;
|
||||
use WP_Rocket\Buffer\Tests;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
define( 'WP_ROCKET_ADVANCED_CACHE', true );
|
||||
|
||||
$rocket_path = '{{WP_ROCKET_PATH}}';
|
||||
$rocket_config_path = '{{WP_ROCKET_CONFIG_PATH}}';
|
||||
$rocket_cache_path = '{{WP_ROCKET_CACHE_PATH}}';
|
||||
|
||||
if (
|
||||
version_compare( phpversion(), '{{WP_ROCKET_PHP_VERSION}}', '<' )
|
||||
|| ! file_exists( $rocket_path )
|
||||
|| ! file_exists( $rocket_config_path )
|
||||
|| ! file_exists( $rocket_cache_path )
|
||||
) {
|
||||
define( 'WP_ROCKET_ADVANCED_CACHE_PROBLEM', true );
|
||||
return;
|
||||
}
|
||||
|
||||
'{{MOBILE_CACHE}}';
|
||||
if ( file_exists( '{{WP_ROCKET_PATH}}inc/classes/dependencies/mobiledetect/mobiledetectlib/Mobile_Detect.php' ) && ! class_exists( 'WP_Rocket_Mobile_Detect' ) ) {
|
||||
include_once '{{WP_ROCKET_PATH}}inc/classes/dependencies/mobiledetect/mobiledetectlib/Mobile_Detect.php';
|
||||
}
|
||||
'{{/MOBILE_CACHE}}';
|
||||
|
||||
spl_autoload_register(
|
||||
function ( $class ) use ( $rocket_path ) { // phpcs:ignore Universal.NamingConventions.NoReservedKeywordParameterNames.classFound
|
||||
$rocket_classes = [
|
||||
'WP_Rocket\\Buffer\\Abstract_Buffer' => [ $rocket_path . 'inc/classes/Buffer/class-abstract-buffer.php' ],
|
||||
'WP_Rocket\\Buffer\\Cache' => [ $rocket_path . 'inc/classes/Buffer/class-cache.php' ],
|
||||
'WP_Rocket\\Buffer\\Tests' => [ $rocket_path . 'inc/classes/Buffer/class-tests.php' ],
|
||||
'WP_Rocket\\Buffer\\Config' => [ $rocket_path . 'inc/classes/Buffer/class-config.php' ],
|
||||
'WP_Rocket\\Logger\\HTMLFormatter' => [
|
||||
$rocket_path . 'inc/Logger/HTMLFormatter.php',
|
||||
$rocket_path . 'inc/classes/logger/class-html-formatter.php',
|
||||
],
|
||||
'WP_Rocket\\Logger\\Logger' => [
|
||||
$rocket_path . 'inc/Logger/Logger.php',
|
||||
$rocket_path . 'inc/classes/logger/class-logger.php',
|
||||
],
|
||||
'WP_Rocket\\Logger\\StreamHandler' => [
|
||||
$rocket_path . 'inc/Logger/StreamHandler.php',
|
||||
$rocket_path . 'inc/classes/logger/class-stream-handler.php',
|
||||
],
|
||||
'WP_Rocket\\Traits\\Memoize' => [ $rocket_path . 'inc/classes/traits/trait-memoize.php' ],
|
||||
];
|
||||
|
||||
if ( isset( $rocket_classes[ $class ] ) ) {
|
||||
$file_options = $rocket_classes[ $class ];
|
||||
$file = '';
|
||||
|
||||
foreach ( $file_options as $file_option ) {
|
||||
if ( file_exists( $file_option ) ) {
|
||||
$file = $file_option;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} elseif ( strpos( $class, 'WP_Rocket\\Dependencies\\Monolog\\' ) === 0 ) {
|
||||
$class = str_replace( 'WP_Rocket\\Dependencies\\Monolog\\', '', $class );
|
||||
|
||||
$file = $rocket_path . 'inc/Dependencies/Monolog/' . str_replace( '\\', '/', $class ) . '.php';
|
||||
if ( ! file_exists( $file ) ) {
|
||||
$file = $rocket_path . 'vendor/monolog/monolog/src/' . str_replace( '\\', '/', $class ) . '.php';
|
||||
}
|
||||
} elseif ( strpos( $class, 'WP_Rocket\\Dependencies\\Psr\\Log\\' ) === 0 ) {
|
||||
$class = str_replace( 'WP_Rocket\\Dependencies\\Psr\\Log\\', '', $class );
|
||||
|
||||
$file = $rocket_path . 'inc/Dependencies/Psr/Log/' . str_replace( '\\', '/', $class ) . '.php';
|
||||
if ( ! file_exists( $file ) ) {
|
||||
$file = $rocket_path . 'vendor/psr/log/' . str_replace( '\\', '/', $class ) . '.php';
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( file_exists( $file ) ) {
|
||||
require $file;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
if ( ! class_exists( '\WP_Rocket\Buffer\Cache' ) ) {
|
||||
if ( ! defined( 'DONOTROCKETOPTIMIZE' ) ) {
|
||||
define( 'DONOTROCKETOPTIMIZE', true ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedConstantFound
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
$rocket_config_class = new Config(
|
||||
[
|
||||
'config_dir_path' => $rocket_config_path,
|
||||
]
|
||||
);
|
||||
|
||||
( new Cache(
|
||||
new Tests(
|
||||
$rocket_config_class
|
||||
),
|
||||
$rocket_config_class,
|
||||
[
|
||||
'cache_dir_path' => $rocket_cache_path,
|
||||
]
|
||||
) )->maybe_init_process();
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* Activate CPCSS mobile template.
|
||||
*
|
||||
* @since 3.6
|
||||
*/
|
||||
|
||||
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( 'Load CSS asynchronously for mobile', 'rocket' ); ?></div>
|
||||
<div class="wpr-field-description wpr-hide-on-click"><?php esc_html_e( 'Your website currently uses the same Critical Path CSS for both desktop and mobile.', 'rocket' ); ?></div>
|
||||
<div class="wpr-field-description wpr-hide-on-click"><?php esc_html_e( 'Click the button to enable mobile-specific CPCSS for your site.', '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__( 'Your site is now using mobile-specific critical path CSS. %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_mobile_cpcss" class="wpr-button wpr-button--icon wpr-button--small wpr-button--purple wpr-icon-refresh">
|
||||
<?php esc_html_e( 'Generate Mobile Specific CPCSS', 'rocket' ); ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Critical path CSS section in WP Rocket metabox.
|
||||
*
|
||||
* @since 3.6
|
||||
*
|
||||
* @data array {
|
||||
* Data to populate the template.
|
||||
*
|
||||
* @type string $disabled_description Description to explain why the buttons are disabled.
|
||||
* }
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
$rocket_disabled_description = empty( $data['disabled_description'] );
|
||||
?>
|
||||
<div class="inside">
|
||||
<h3><?php esc_html_e( 'Critical Path CSS', 'rocket' ); ?></h3>
|
||||
<div id="rocket-metabox-cpcss-content">
|
||||
<?php do_action( 'rocket_metabox_cpcss_content' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div id="cpcss_response_notice" class="components-notice is-notice is-warning<?php echo $rocket_disabled_description ? ' hidden' : ''; ?>">
|
||||
<div class="components-notice__content">
|
||||
<?php if ( ! $rocket_disabled_description ) : ?>
|
||||
<p><?php echo esc_html( $data['disabled_description'] ); ?></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/**
|
||||
* Critical path CSS generate template.
|
||||
*
|
||||
* @since 3.6
|
||||
*
|
||||
* @data array {
|
||||
* Data to populate the template.
|
||||
*
|
||||
* @type string $beacon Helpscout documentation link.
|
||||
* @type bool $disabled True if button should be disabled, false otherwise.
|
||||
* }
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
$rocket_cpcss_exists = empty( $data['cpcss_exists'] );
|
||||
?>
|
||||
<p class="cpcss_generate <?php echo ! $rocket_cpcss_exists ? 'hidden' : ''; ?>">
|
||||
<?php
|
||||
printf(
|
||||
// translators: %1$s = opening link tag, %2$s = closing link tag.
|
||||
esc_html__( 'Generate specific Critical Path CSS for this post. %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>'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<p class="cpcss_regenerate <?php echo $rocket_cpcss_exists ? 'hidden' : ''; ?>">
|
||||
<?php
|
||||
printf(
|
||||
// translators: %1$s = opening link tag, %2$s = closing link tag.
|
||||
esc_html__( 'This post uses specific Critical Path CSS. %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>'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<div class="components-panel__row cpcss_generate cpcss_regenerate">
|
||||
<button id="rocket-generate-post-cpss" class="button components-button is-secondary" <?php disabled( $data['disabled'] ); ?>>
|
||||
<span style="display: none;" class="spinner"></span>
|
||||
<span class="rocket-generate-post-cpss-btn-txt">
|
||||
<?php
|
||||
if ( ! $rocket_cpcss_exists ) {
|
||||
esc_html_e( 'Regenerate specific CPCSS', 'rocket' );
|
||||
} else {
|
||||
esc_html_e( 'Generate Specific CPCSS', 'rocket' );
|
||||
}
|
||||
?>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="components-panel__row cpcss_regenerate <?php echo $rocket_cpcss_exists ? 'hidden' : ''; ?>">
|
||||
<button id="rocket-delete-post-cpss" class="button components-button is-secondary" <?php disabled( $data['disabled'] ); ?>>
|
||||
<span>
|
||||
<?php esc_html_e( 'Revert back to the default CPCSS', 'rocket' ); ?>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
/**
|
||||
* Deactivation intent form template.
|
||||
*
|
||||
* @since 3.0
|
||||
*
|
||||
* $data array {
|
||||
* Data to populate the form.
|
||||
*
|
||||
* @type string $form_action URL to submit the deactivation form.
|
||||
* }
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
?>
|
||||
<div class="wpr-modal" id="wpr-deactivation-modal" aria-hidden="true">
|
||||
<div class="wpr-modal-overlay" tabindex="-1" data-micromodal-close>
|
||||
<div class="wpr-modal-container" role="dialog" aria-modal="true" aria-labelledby="wpr-deactivation-modal-title" >
|
||||
<header class="wpr-modal-header">
|
||||
<h2 class="wpr-modal-title" id="wpr-deactivation-modal-title"><?php esc_html_e( 'Facing an issue?', 'rocket' ); ?></h2>
|
||||
</header>
|
||||
<div>
|
||||
<p><?php esc_html_e( 'It is not always necessary to deactivate WP Rocket when facing any issues. Most of them can be fixed by deactivating only some options.', 'rocket' ); ?></p>
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
// translators: %1$s = opening strong tag, %2$s = closing strong tag.
|
||||
esc_html__( 'Our advice? Instead of deactivating WP Rocket, use our %1$sSafe Mode%2$s to quickly disable LazyLoad, File Optimization, and CDN options. Then check to see if your issue is resolved.', 'rocket' ),
|
||||
'<strong>',
|
||||
'</strong>'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<p><strong><?php esc_html_e( 'Do you want to use our Safe Mode to troubleshoot WP Rocket?', 'rocket' ); ?></strong></p>
|
||||
<form id="wpr-deactivation-intent-form" method="post" action="
|
||||
<?php
|
||||
echo esc_attr( $data['form_action'] );
|
||||
?>
|
||||
">
|
||||
<input name="rest_auth_nonce" type="hidden" value="
|
||||
<?php
|
||||
echo esc_attr(
|
||||
wp_create_nonce( 'wp_rest' )
|
||||
);
|
||||
?>
|
||||
" />
|
||||
<ul>
|
||||
<li>
|
||||
<input type="radio" id="safe_mode" value="safe_mode" name="mode" checked />
|
||||
<label for="safe_mode">
|
||||
<?php
|
||||
printf(
|
||||
// translators: %1$s = opening strong tag, %2$s = closing strong tag.
|
||||
esc_html__( 'Yes, apply "%1$sSafe Mode%2$s"', 'rocket' ),
|
||||
'<strong>',
|
||||
'</strong>'
|
||||
);
|
||||
?>
|
||||
</label>
|
||||
</li>
|
||||
<li class="wpr-sub-list">
|
||||
<input type="checkbox" id="export_settings" name="export_settings" checked="checked" />
|
||||
<label for="export_settings">
|
||||
<?php
|
||||
printf(
|
||||
// translators: %1$s = opening strong tag, %2$s = closing strong tag.
|
||||
esc_html__( 'and export WP Rocket settings %1$s(Recommended as current settings will be deleted)%2$s', 'rocket' ),
|
||||
'<strong>',
|
||||
'</strong>'
|
||||
);
|
||||
?>
|
||||
</label>
|
||||
</li>
|
||||
<li>
|
||||
<input type="radio" id="deactivate" value="deactivate" name="mode" /><label for="deactivate"><?php esc_html_e( 'No, deactivate and snooze this message for', 'rocket' ); ?></label>
|
||||
<select name="snooze">
|
||||
<option value="1"><?php esc_html_e( '1 day', 'rocket' ); ?></option>
|
||||
<option value="7"><?php esc_html_e( '7 days', 'rocket' ); ?></option>
|
||||
<option value="30"><?php esc_html_e( '30 days', 'rocket' ); ?></option>
|
||||
<option value="0"><?php esc_html_e( 'Forever', 'rocket' ); ?></option>
|
||||
</select>
|
||||
</li>
|
||||
</ul>
|
||||
<?php wp_nonce_field( 'rocket_deactivation' ); ?>
|
||||
<div class="wpr-modal-footer">
|
||||
<button aria-label="Close modal" class="wpr-modal-button wpr-modal-cancel" data-micromodal-close><?php esc_html_e( 'Cancel', 'rocket' ); ?></button>
|
||||
<input type="submit" class="wpr-modal-button wpr-modal-confirm" value="<?php esc_attr_e( 'Confirm', 'rocket' ); ?>" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* Post edit metabox options.
|
||||
*
|
||||
* @data array {
|
||||
* Data to populate the template.
|
||||
*
|
||||
* @type bool $excluded_url Whether the current URL is excluded from cache or not.
|
||||
* @type array $fields Array of arrays to populate the fields.
|
||||
* }
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
wp_nonce_field( 'rocket_box_option', '_rocketnonce', false, true );
|
||||
?>
|
||||
|
||||
<div class="misc-pub-section">
|
||||
<input name="rocket_post_nocache" id="rocket_post_nocache" type="checkbox" title="<?php esc_html_e( 'Never cache this page', 'rocket' ); ?>" <?php checked( $data['excluded_url'], true ); ?>><label for="rocket_post_nocache"><?php esc_html_e( 'Never cache this page', 'rocket' ); ?></label>
|
||||
</div>
|
||||
|
||||
<div class="misc-pub-section">
|
||||
<p><?php esc_html_e( 'Activate these options on this post:', 'rocket' ); ?></p>
|
||||
<?php
|
||||
foreach ( $data['fields'] as $rocket_field ) {
|
||||
?>
|
||||
<input name="rocket_post_exclude_hidden[<?php echo esc_attr( $rocket_field['id'] ); ?>]" type="hidden" value="on">
|
||||
<input name="rocket_post_exclude[<?php echo esc_attr( $rocket_field['id'] ); ?>]" id="rocket_post_exclude_<?php echo esc_attr( $rocket_field['id'] ); ?>" type="checkbox"<?php echo $rocket_field['title']; ?><?php echo $rocket_field['checked']; ?><?php echo $rocket_field['disabled']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Dynamic content is properly escaped in the view. ?>>
|
||||
<label for="rocket_post_exclude_<?php echo esc_attr( $rocket_field['id'] ); ?>"<?php echo $rocket_field['title']; ?><?php echo $rocket_field['class']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Dynamic content is properly escaped in the view. ?>><?php echo esc_html( $rocket_field['label'] ); ?></label><br>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<p class="rkt-note">
|
||||
<?php
|
||||
// translators: %1$s = opening strong tag, %2$s = closing strong tag.
|
||||
printf( esc_html__( '%1$sNote:%2$s None of these options will be applied if this post has been excluded from cache in the global cache settings.', 'rocket' ), '<strong>', '</strong>' );
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* Fires after WP Rocket’s metabox.
|
||||
*
|
||||
* @since 3.6
|
||||
*/
|
||||
do_action( 'rocket_after_options_metabox' );
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* Plugins renewal notice template.
|
||||
*
|
||||
* @since 3.14
|
||||
*
|
||||
* $data array {
|
||||
* Data to populate the template.
|
||||
*
|
||||
* @type string $version Next major release version.
|
||||
* @type string $renew_url Renewal URL.
|
||||
* @type string $release_url Major release announcement URL.
|
||||
* }
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
?>
|
||||
|
||||
<tr class="plugin-update-tr active" id="wp-rocket-update">
|
||||
<td class="plugin-update colspanchange" colspan="4">
|
||||
<div class="wp-rocket-update inline notice">
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
// translators: %1$s = <strong>, %2$s = plugin version, %3$s = </strong>, %4$s = <a>, %5$s = </a>, %6$s = <a>.
|
||||
esc_html__( ' %1$sWP Rocket %2$s%3$s is available. %4$sLearn more%5$s about the updates and enhancements of this major version. You need an active license to use them on your website, don’t miss out! %6$sRenew Now%5$s', 'rocket' ),
|
||||
'<strong>',
|
||||
esc_html( $data['version'] ),
|
||||
'</strong>',
|
||||
'<a href="' . esc_url( $data['release_url'] ) . '" rel="noopener" target="_blank">',
|
||||
'</a>',
|
||||
'<a href="' . esc_url( $data['renew_url'] ) . '" rel="noopener" target="_blank">'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -0,0 +1,27 @@
|
||||
<?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.
|
||||
* @type string $config Config 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.Beacon("config", <?php echo $data['config']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>);
|
||||
window.addEventListener("hashchange", function () {
|
||||
window.Beacon("suggest");
|
||||
}, false);</script>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* Dynamic lists update template.
|
||||
*
|
||||
* @since 3.11.4
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
?>
|
||||
|
||||
<div class="wpr-tools">
|
||||
<div class="wpr-tools-col">
|
||||
<div class="wpr-title3 wpr-tools-label wpr-icon-export"><?php esc_html_e( 'Update Inclusion and Exclusion Lists', 'rocket' ); ?></div>
|
||||
<div class="wpr-field-description">
|
||||
<?php
|
||||
printf(
|
||||
// translators: %1$s = opening link tag, %2$s = closing link tag.
|
||||
esc_html__( 'Compatibility lists are downloaded automatically every week. Click the button if you want to update them manually. %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 id="wpr-update-exclusion-msg" class="wpr-field-description"></div>
|
||||
</div>
|
||||
<div class="wpr-tools-col">
|
||||
<button id="wpr-update-exclusion-list" class="wpr-button wpr-button--icon wpr-button--small wpr-button--purple wpr-icon-refresh">
|
||||
<?php esc_html_e( 'Update lists', 'rocket' ); ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -0,0 +1,247 @@
|
||||
<?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 automatically 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 id="wpr-congratulations-notice" 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>
|
||||
<?php if ( $data['customer_data']['is_from_one_dot_com'] ) : ?>
|
||||
<span>
|
||||
<?php esc_html_e( 'with', 'rocket' ); ?>
|
||||
<img src="<?php echo esc_url( rocket_get_constant( 'WP_ROCKET_ASSETS_IMG_URL' ) . 'one-com-logo.svg' ); ?>" width="80" alt="One.com">
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
<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' => (bool) get_rocket_option( 'manual_preload', false ) ? __( 'Clear and preload cache', 'rocket' ) : __( 'Clear cache', 'rocket' ),
|
||||
'parameters' => [
|
||||
'type' => 'all',
|
||||
],
|
||||
'attributes' => [
|
||||
'class' => 'wpr-button wpr-button--icon wpr-button--small wpr-icon-trash',
|
||||
],
|
||||
]
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ( 'local' !== wp_get_environment_type() && 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; ?>
|
||||
|
||||
<?php if ( 'local' !== wp_get_environment_type() && get_rocket_option( 'remove_unused_css' ) && current_user_can( 'rocket_remove_unused_css' ) ) : ?>
|
||||
<div class="wpr-field">
|
||||
<h4 class="wpr-title3"><?php esc_html_e( 'Remove Used CSS Cache', 'rocket' ); ?></h4>
|
||||
<?php
|
||||
$this->render_action_button(
|
||||
'link',
|
||||
'rocket_clear_usedcss',
|
||||
[
|
||||
'label' => __( 'Clear Used CSS', 'rocket' ),
|
||||
'attributes' => [
|
||||
'class' => 'wpr-button wpr-button--icon wpr-button--small wpr-icon-trash',
|
||||
],
|
||||
]
|
||||
);
|
||||
?>
|
||||
</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>
|
||||
<?php if ( ! rocket_get_constant( 'WP_ROCKET_WHITE_LABEL_ACCOUNT' ) ) { ?>
|
||||
<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',
|
||||
'target' => '_blank',
|
||||
],
|
||||
]
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="wpr-Page-col wpr-Page-col--fixed">
|
||||
<?php $this->render_part( 'documentation' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -0,0 +1,68 @@
|
||||
<?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' ),
|
||||
'803tlui8oi' => __( 'How Preloading Works', 'rocket' ),
|
||||
],
|
||||
],
|
||||
[
|
||||
'title' => __( 'Passing the Core Web vitals', 'rocket' ),
|
||||
'tutorials' => [
|
||||
'fj7gs031q6' => __( 'How to improve LCP with WP Rocket', 'rocket' ),
|
||||
'krqb7ckugp' => __( 'How to improve FID with WP Rocket', 'rocket' ),
|
||||
'5wrdzcmj90' => __( 'How to improve CLS with WP Rocket', 'rocket' ),
|
||||
],
|
||||
],
|
||||
[
|
||||
'title' => __( 'Troubleshooting', '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' => __( '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%"> </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>
|
||||
@@ -0,0 +1,105 @@
|
||||
<?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()
|
||||
&&
|
||||
! rocket_get_constant( 'WP_ROCKET_WHITE_LABEL_ACCOUNT' )
|
||||
) {
|
||||
$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="On"
|
||||
data-l10n-inactive="Off" 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-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
|
||||
// translators: %1$s = <strong>, %2$s = </strong>.
|
||||
printf( esc_html__( 'Below is a detailed view of all data WP Rocket will collect %1$sif granted permission.%2$s', 'rocket' ), '<strong>', '</strong>' );
|
||||
?>
|
||||
</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 wpr-rocket-analytics-cta<?php echo get_rocket_option( 'analytics_enabled' ) ? ' wpr-isHidden' : ''; ?>"><?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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -0,0 +1,38 @@
|
||||
<?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 website’s 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>
|
||||
<a href="<?php echo esc_url( 'https://wp-rocket.me/blog/how-to-test-wordpress-site-performance-measure-speed-results/?utm_source=wp_plugin&utm_medium=wp_rocket' ); ?>" target="_blank" rel="noopener" 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( 'Learn about optimal WP Rocket settings for mobile.', 'rocket' ); ?></p>
|
||||
<?php
|
||||
$rocket_mobile_doc_url = false !== strpos( get_locale(), 'fr' )
|
||||
? 'https://fr.docs.wp-rocket.me/article/1432-comment-ameliorer-score-mobile-pagespeed/?utm_source=wp_plugin&utm_medium=wp_rocket'
|
||||
: 'https://docs.wp-rocket.me/article/1402-how-to-improve-your-mobile-pagespeed-score/?utm_source=wp_plugin&utm_medium=wp_rocket'
|
||||
?>
|
||||
<a href="<?php echo esc_url( $rocket_mobile_doc_url ); ?>" 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( 'Test and Improve Google Core Web Vitals for WordPress.', 'rocket' ); ?></p>
|
||||
<a href="<?php echo esc_url( 'https://wp-rocket.me/google-core-web-vitals-wordpress/?utm_source=wp_plugin&utm_medium=wp_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' );
|
||||
@@ -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>
|
||||
@@ -0,0 +1,54 @@
|
||||
<?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'] ) ) : ?>
|
||||
<?php if ( is_array( $data['helper'] ) ) : ?>
|
||||
<?php foreach ( $data['helper'] as $rocket_helper ) : ?>
|
||||
<div class="wpr-fieldsContainer-helper wpr-icon-important">
|
||||
<?php echo $rocket_helper; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Dynamic content is properly escaped in the view. ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php else : ?>
|
||||
<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; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
@@ -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'] );
|
||||
Reference in New Issue
Block a user