| @@ -12,17 +12,22 @@ | ||
| 12 | 12 | |
| 13 | 13 | use Automattic\Jetpack\Plugins_Installer; |
| 14 | 14 | |
| 15 | 15 | if ( ! defined( 'ABSPATH' ) ) { |
| 16 | - exit; | |
| 16 | + exit( 0 ); | |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | const PLUGIN_SLUG = 'jetpack-boost'; |
| 20 | 20 | const PLUGIN_FILE = 'jetpack-boost/jetpack-boost.php'; |
| 21 | 21 | |
| 22 | -add_action( 'admin_notices', __NAMESPACE__ . '\error_notice' ); | |
| 23 | -add_action( 'admin_init', __NAMESPACE__ . '\try_install' ); | |
| 22 | +if ( isset( $_GET['jetpack-boost-install-error'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 23 | + add_action( 'admin_notices', __NAMESPACE__ . '\error_notice' ); | |
| 24 | +} | |
| 24 | 25 | |
| 26 | +if ( isset( $_GET['jetpack-boost-action'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 27 | + add_action( 'admin_init', __NAMESPACE__ . '\try_install' ); | |
| 28 | +} | |
| 29 | + | |
| 25 | 30 | /** |
| 26 | 31 | * Verify the intent to install Jetpack Boost, and kick off installation. |
| 27 | 32 | * |
| 28 | 33 | * This works in tandem with a JITM set up in the JITM package. |
| @@ -59,9 +64,9 @@ | ||
| 59 | 64 | } |
| 60 | 65 | |
| 61 | 66 | wp_safe_redirect( $redirect ); |
| 62 | 67 | |
| 63 | - exit; | |
| 68 | + exit( 0 ); | |
| 64 | 69 | } |
| 65 | 70 | |
| 66 | 71 | /** |
| 67 | 72 | * Install and activate the Jetpack Boost plugin. |
| @@ -96,11 +101,12 @@ | ||
| 96 | 101 | function error_notice() { |
| 97 | 102 | if ( empty( $_GET['jetpack-boost-install-error'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
| 98 | 103 | return; |
| 99 | 104 | } |
| 100 | - | |
| 101 | - ?> | |
| 102 | - <div class="notice notice-error is-dismissible"> | |
| 103 | - <p><?php esc_html_e( 'There was an error installing Jetpack Boost. Please try again.', 'jetpack' ); ?></p> | |
| 104 | - </div> | |
| 105 | - <?php | |
| 105 | + wp_admin_notice( | |
| 106 | + esc_html__( 'There was an error installing Jetpack Boost. Please try again.', 'jetpack' ), | |
| 107 | + array( | |
| 108 | + 'type' => 'error', | |
| 109 | + 'dismissible' => true, | |
| 110 | + ) | |
| 111 | + ); | |
| 106 | 112 | } |