=' ) && version_compare( $old_version, '4.5', '<' ) ) { // We don't use `Jetpack_Options` here since the option is no longer in that class. delete_option( 'jetpack_connection_banner_ab' ); } } /** * 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. * * @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; } 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', 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'; ?>