wpsc_jetpack_boost_install_banner()WPSCache 1.0

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

Хуков нет.

Возвращает

null. Ничего (null).

Использование

wpsc_jetpack_boost_install_banner();

Код wpsc_jetpack_boost_install_banner() WPSCache 1.12.0

<?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';
	$plugin_url   = plugin_dir_url( __FILE__ );

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

					<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_url . '/assets/boost-install-card-main.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 space shuttle. In the foreground are two graphs in yellow and green', 'wp-super-cache' ); ?>"
						srcset="<?php echo esc_url( $plugin_url . '/assets/boost-install-card-main.png' ); ?> 352w <?php echo esc_url( $plugin_url . '/assets/boost-install-card-main-2x.png' ); ?> 730w"
						sizes="(max-width: 782px) 352px, 730px"
					>
				</div>
			</div>

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