= $now; } /** * Gets the value for which connection banner to show, and initializes if not set. * * @since 4.4.0 * * @return int */ static function get_random_connection_banner_value() { $random_connection_banner = Jetpack_Options::get_option( 'connection_banner_ab' ); if ( ! $random_connection_banner ) { $random_connection_banner = mt_rand( 1, 2 ); Jetpack_Options::update_option( 'connection_banner_ab', $random_connection_banner ); } return $random_connection_banner; } /** * Will initialize hooks to display the new and legacy connection banners 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 * * @param $current_screen */ function maybe_initialize_hooks( $current_screen ) { // Don't show the connect notice anywhere but the plugins.php after activating if ( 'plugins' !== $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' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_banner_scripts' ) ); } else { add_action( 'admin_notices', array( $this, 'render_legacy_banner' ) ); } 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' ) ); } } /** * Enqueues JavaScript for new connection banner. * * @since 4.4.0 */ function enqueue_banner_scripts() { wp_enqueue_script( 'jetpack-connection-banner-js', plugins_url( '_inc/jetpack-connection-banner.js', JETPACK__PLUGIN_FILE ), array( 'jquery' ), JETPACK__VERSION, true ); } /** * Returns a URL that will dismiss allow the current user to dismiss the connection banner. * * @since 4.4.0 * * @return string */ function get_dismiss_and_deactivate_url() { return wp_nonce_url( Jetpack::admin_url( '?page=jetpack&jetpack-notice=dismiss' ), 'jetpack-deactivate' ); } /** * Renders the legacy connection banner. */ function render_legacy_banner() { $legacy_banner_from = self::check_ab_test_not_expired() ? 'banner-legacy' : 'banner'; ?>

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