add wp-rocket
This commit is contained in:
@@ -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( 'Optimize CSS delivery 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>
|
Reference in New Issue
Block a user