=' ) && version_compare( $old_version, '5.3', '<' ) ) { delete_option( 'jetpack_connection_banner_ab' ); } } /** * Checks whether the connection banner A/B test should be ran. * * @since 5.3.0 * * @param null $now * * @return bool */ static function check_ab_test_not_expired( $now = null ) { // Get the current timestamp in GMT $now = empty( $now ) ? current_time( 'timestamp', 1 ) : $now; // Arguments are hour, minute, second, month, day, year. So, we are getting the timestamp for GMT timestamp // for the October 5th, 2017. $expiration = gmmktime( 0, 0, 0, 10, 5, 2017 ); return $expiration >= $now; } /** * Gets the value for which connection banner to show, and initializes if not set. * * @since 5.3.0 * * @return int */ static function get_random_connection_banner_value() { $random_connection_banner = get_option( 'jetpack_connection_banner_ab' ); if ( ! $random_connection_banner ) { $random_connection_banner = mt_rand( 1, 2 ); update_option( 'jetpack_connection_banner_ab', $random_connection_banner ); } return $random_connection_banner; } /** * Given a string for the the banner was added, and an int that represents the slide to * a URL for, this function returns a connection URL with a from parameter that will * support split testing. * * @param string $jp_version_banner_added A short version of when the banner was added. Ex. 44 * @param string|int $slide_num The index of the slide, 1-indexed. * @return string */ function build_connect_url_for_slide( $jp_version_banner_added, $slide_num ) { global $current_screen; $url = Jetpack::init()->build_connect_url( true, false, sprintf( 'banner-%s-slide-%s-%s', $jp_version_banner_added, $slide_num, $current_screen->base ) ); return add_query_arg( 'auth_approved', 'true', $url ); } /** * Will initialize hooks to display the new (as of 4.4) connection banner if the current user can * connect Jetpack, if Jetpack has not been deactivated, and if the current page is the plugins page. * * This method should not be called if the site is connected to WordPress.com or if the site is in development mode. * * @since 4.4.0 * @since 4.5.0 Made the new (as of 4.4) connection banner display to everyone by default. * @since 5.3.0 Running another split test between 4.4 banner and a new one in 5.3. * * @param $current_screen */ function maybe_initialize_hooks( $current_screen ) { // Kill if banner has been dismissed if ( Jetpack_Options::get_option( 'dismissed_connection_banner' ) ) { return; } // Don't show the connect notice anywhere but the plugins.php after activating if ( 'plugins' !== $current_screen->base && 'dashboard' !== $current_screen->base ) { return; } if ( ! current_user_can( 'jetpack_connect' ) ) { return; } if ( self::check_ab_test_not_expired() && 2 == self::get_random_connection_banner_value() ) { add_action( 'admin_notices', array( $this, 'render_banner_b' ) ); } else { add_action( 'admin_notices', array( $this, 'render_banner' ) ); } add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_banner_scripts' ) ); add_action( 'admin_print_styles', array( Jetpack::init(), 'admin_banner_styles' ) ); if ( Jetpack::state( 'network_nag' ) ) { add_action( 'network_admin_notices', array( $this, 'network_connect_notice' ) ); } // Only fires immediately after plugin activation if ( get_transient( 'activated_jetpack' ) ) { add_action( 'admin_notices', array( $this, 'render_connect_prompt_full_screen' ) ); delete_transient( 'activated_jetpack' ); } } /** * Enqueues JavaScript for new connection banner. * * @since 4.4.0 */ function enqueue_banner_scripts() { wp_enqueue_script( 'jetpack-connection-banner-js', Jetpack::get_file_url_for_environment( '_inc/build/jetpack-connection-banner.min.js', '_inc/jetpack-connection-banner.js' ), array( 'jquery' ), JETPACK__VERSION, true ); wp_localize_script( 'jetpack-connection-banner-js', 'jp_banner', array( 'ajax_url' => admin_url( 'admin-ajax.php' ), 'connectionBannerNonce' => wp_create_nonce( 'jp-connection-banner-nonce' ), ) ); } /** * Renders the new connection banner as of 4.4.0. * * @since 4.4.0 */ function render_banner() { ?>
<?php
					esc_attr_e(
						'Jetpack help personnel',
						'jetpack'
				); ?>

Jetpack is activated! Each site on your network must be connected individually by an admin on that site.', 'jetpack' ), array( 'strong' => array() ) ); ?>