PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-a.1
Jetpack – WP Security, Backup, Speed, & Growth v16.3-a.1
16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 13.9.2 14.0.1 All 504 releases
← All changes | 3rd-party/jetpack-backup.php +19 -18 12.0.3 → 16.3-a.1 View file →
@@ -12,27 +12,30 @@
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-backup';
20 20 const PLUGIN_FILE = 'jetpack-backup/jetpack-backup.php';
21 21
22 -add_action( 'admin_notices', __NAMESPACE__ . '\error_notice' );
23 -add_action( 'admin_init', __NAMESPACE__ . '\try_install' );
22 +if ( isset( $_GET['jetpack-backup-install-error'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
23 + add_action( 'admin_notices', __NAMESPACE__ . '\error_notice' );
24 +}
24 25
26 +if ( isset( $_GET['jetpack-backup-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 Backup, and kick off installation.
27 32 *
28 33 * This works in tandem with a JITM set up in the JITM package.
34 + *
35 + * @return never
29 36 */
30 37 function try_install() {
31 - if ( ! isset( $_GET['jetpack-backup-action'] ) ) {
32 - return;
33 - }
34 -
35 38 check_admin_referer( 'jetpack-backup-install' );
36 39
37 40 $result = false;
38 41 // If the plugin install fails, redirect to plugin install page pre-populated with jetpack-backup search term.
@@ -39,9 +42,9 @@
39 42 $redirect_on_error = admin_url( 'plugin-install.php?s=jetpack-backup&tab=search&type=term' );
40 43
41 44 // Attempt to install and activate the plugin.
42 45 if ( current_user_can( 'activate_plugins' ) ) {
43 - switch ( $_GET['jetpack-backup-action'] ) {
46 + switch ( $_GET['jetpack-backup-action'] ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated -- Function only hooked if set.
44 47 case 'install':
45 48 $result = install_and_activate();
46 49 break;
47 50 case 'activate':
@@ -59,9 +62,9 @@
59 62 }
60 63
61 64 wp_safe_redirect( $redirect );
62 65
63 - exit;
66 + exit( 0 );
64 67 }
65 68
66 69 /**
67 70 * Install and activate the Jetpack Backup plugin.
@@ -93,14 +96,12 @@
93 96 /**
94 97 * Notify the user that the installation of Jetpack Backup failed.
95 98 */
96 99 function error_notice() {
97 - if ( empty( $_GET['jetpack-backup-install-error'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
98 - return;
99 - }
100 -
101 - ?>
102 - <div class="notice notice-error is-dismissible">
103 - <p><?php esc_html_e( 'There was an error installing Jetpack Backup. Please try again.', 'jetpack' ); ?></p>
104 - </div>
105 - <?php
100 + wp_admin_notice(
101 + esc_html__( 'There was an error installing Jetpack Backup. Please try again.', 'jetpack' ),
102 + array(
103 + 'type' => 'error',
104 + 'dismissible' => true,
105 + )
106 + );
106 107 }