wpsc_jetpack_boost_install_banner()WPSCache 1.0

Show a Jetpack Boost installation banner (unless dismissed or installed)

No Hooks.

Return

null. Nothing.

Usage

wpsc_jetpack_boost_install_banner();

wpsc_jetpack_boost_install_banner() code WPSCache 1.9.2

<?php
function wpsc_jetpack_boost_install_banner() {
	// Don't show the banner if Boost is installed, or the banner has been dismissed.
	$is_dismissed = '1' === get_user_option( 'wpsc_dismissed_boost_banner' );
	if ( wpsc_is_boost_active() || $is_dismissed ) {
		return;
	}

	$install_url  = wp_nonce_url( admin_url( 'update.php?action=install-plugin&plugin=jetpack-boost' ), 'install-plugin_jetpack-boost' );
	$activate_url = admin_url( 'plugins.php' );
	$is_installed = wpsc_is_boost_installed();
	$button_url   = $is_installed ? $activate_url : $install_url;
	$button_label = $is_installed ? __( 'Activate Jetpack Boost', 'wp-super-cache' ) : __( 'Install Jetpack Boost', 'wp-super-cache' );
	$button_id    = $is_installed ? 'wpsc-activate-boost-button' : 'wpsc-install-boost-button';

	?>
		<div class="wpsc-boost-banner">
			<div class="wpsc-boost-banner-inner">
				<div class="wpsc-boost-banner-content">
					<img style="width:176px" src="<?php echo esc_url( plugin_dir_url( __FILE__ ) . '/assets/jetpack-logo.svg' ); ?>" height="32" />

					<h3>
						<?php esc_html_e( 'Find out how much Super Cache speeds up your site', 'wp-super-cache' ); ?>
					</h3>

					<p id="wpsc-install-invitation">
						<?php
							esc_html_e(
								'Caching is a great start, but there is more to maximize your site speed. Find out how much your cache speeds up your site and make it blazing fast with Jetpack Boost, the easiest WordPress speed optimization plugin developed by Super Cache engineers.',
								'wp-super-cache'
							);
						?>
					</p>

					<div id="wpsc-boost-banner-error" style="display:none; color:red; margin-bottom: 20px;"></div>

					<a href="<?php echo esc_url( $button_url ); ?>" class="button button-primary wpsc-install-action-button" id="<?php echo esc_attr( $button_id ); ?>">
						<div class="spinner" style="display:none; margin-top: 8px"></div>
						<label><?php echo esc_html( $button_label ); ?></label>
					</a>
				</div>

				<div class="wpsc-boost-banner-image-container">
					<img
						src="<?php echo esc_url( plugin_dir_url( __FILE__ ) . '/assets/boost-performance.png' ); ?>"
						title="<?php esc_attr_e( 'Check how your web site performance scores for desktop and mobile.', 'wp-super-cache' ); ?>"
						alt="<?php esc_attr_e( 'An image showing a web site with a photo of a time-lapsed watch face. In the foreground is a graph showing a speed score for mobile and desktop in yellow and green with an overall score of B', 'wp-super-cache' ); ?>"
						srcset="<?php echo esc_url( plugin_dir_url( __FILE__ ) . '/assets/boost-performance.png' ); ?> 650w <?php echo esc_url( plugin_dir_url( __FILE__ ) . '/assets/boost-performance-2x.png' ); ?> 1306w"
						sizes="(max-width: 782px) 654px, 1306px"
					>
				</div>
			</div>

			<span class="wpsc-boost-dismiss dashicons dashicons-dismiss"></span>
		</div>
	<?php
}