wpsc_jetpack_boost_notice()WPSCache 1.0

Display an admin notice to install Jetpack Boost.

No Hooks.

Return

null. Nothing (null).

Usage

wpsc_jetpack_boost_notice();

wpsc_jetpack_boost_notice() code WPSCache 1.12.4

<?php
function wpsc_jetpack_boost_notice() {
	if ( ! isset( $_GET['page'] ) || $_GET['page'] !== 'wpsupercache' ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
		return;
	}

	// hide the admin notice if Jetpack Boost Cache is already used.
	if ( 'BOOST' === wpsc_identify_advanced_cache() ) {
		return;
	}

	// Don't show the banner if the banner has been dismissed.
	$is_dismissed = '1' === get_user_option( 'wpsc_dismissed_boost_admin_notice' );
	if ( $is_dismissed ) {
		return;
	}

	// Don't show the admin notice if Jetpack Boost is too old.
	if ( ! wpsc_is_boost_current() ) {
		return;
	}

	// Don't show the banner if Super Cache is using features that Boost doesn't support.
	if ( ! wpsc_is_boost_compatible() ) {
		return;
	}

	$config       = wpsc_get_boost_migration_config();
	$button_url   = $config['is_installed'] ? $config['activate_url'] : $config['install_url'];
	$button_class = $config['is_installed'] ? 'wpsc-activate-boost-button' : 'wpsc-install-boost-button';

	?>
	<div id="wpsc-notice-boost-migrate" class="notice boost-notice notice-success is-dismissible">
	<h3>
		<?php esc_html_e( 'Migrate to Jetpack Boost', 'wp-super-cache' ); ?>
	</h3>
	<p>
		<?php esc_html_e( 'Your WP Super Cache setup is compatible with Boost\'s new caching feature. Continue to cache as you currently do and enhance your site\'s speed using our highly-rated performance solutions.', 'wp-super-cache' ); ?>
	</p>

	<p>
		<div class="wpsc-boost-migration-error" style="display:none; color:red; margin-bottom: 20px;"></div>
		<a data-source='notice' class='wpsc-boost-migration-button button button-primary <?php echo esc_attr( $button_class ); ?>' href="<?php echo esc_url( $button_url ); ?>">
			<div class="spinner" style="display:none; margin-top: 8px"></div>
			<label><?php esc_html_e( 'Migrate now', 'wp-super-cache' ); ?></label>
		</a>
	</p>
	</div>
	<?php
}