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/creative-mail.php +22 -19 12.0.3 → 16.3-a.1 View file →
@@ -12,36 +12,41 @@
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 = 'creative-mail-by-constant-contact';
20 20 const PLUGIN_FILE = 'creative-mail-by-constant-contact/creative-mail-plugin.php';
21 21
22 -add_action( 'admin_notices', __NAMESPACE__ . '\error_notice' );
23 -add_action( 'admin_init', __NAMESPACE__ . '\try_install' );
24 22 add_action( 'jetpack_activated_plugin', __NAMESPACE__ . '\configure_plugin', 10, 2 );
25 23
24 +// Check for the JITM action.
25 +if ( isset( $_GET['creative-mail-action'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
26 + add_action( 'admin_init', __NAMESPACE__ . '\try_install' );
27 +}
28 +
29 +if ( ! empty( $_GET['creative-mail-install-error'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
30 + add_action( 'admin_notices', __NAMESPACE__ . '\error_notice' );
31 +}
32 +
26 33 /**
27 34 * Verify the intent to install Creative Mail, and kick off installation.
28 35 *
29 36 * This works in tandem with a JITM set up in the JITM package.
37 + *
38 + * @return never
30 39 */
31 40 function try_install() {
32 - if ( ! isset( $_GET['creative-mail-action'] ) ) {
33 - return;
34 - }
35 -
36 41 check_admin_referer( 'creative-mail-install' );
37 42
38 43 $result = false;
39 - $redirect = admin_url( 'edit.php?post_type=feedback' );
44 + $redirect = admin_url( 'admin.php?page=jetpack-forms-admin' );
40 45
41 46 // Attempt to install and activate the plugin.
42 47 if ( current_user_can( 'activate_plugins' ) ) {
43 - switch ( $_GET['creative-mail-action'] ) {
48 + switch ( $_GET['creative-mail-action'] ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated -- Function only hooked if set.
44 49 case 'install':
45 50 $result = install_and_activate();
46 51 break;
47 52 case 'activate':
@@ -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 Creative Mail plugin.
@@ -93,17 +98,15 @@
93 98 /**
94 99 * Notify the user that the installation of Creative Mail failed.
95 100 */
96 101 function error_notice() {
97 - if ( empty( $_GET['creative-mail-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 Creative Mail.', 'jetpack' ); ?></p>
104 - </div>
105 - <?php
102 + wp_admin_notice(
103 + esc_html__( 'There was an error installing Creative Mail.', 'jetpack' ),
104 + array(
105 + 'type' => 'error',
106 + 'dismissible' => true,
107 + )
108 + );
106 109 }
107 110
108 111 /**
109 112 * Set some options when first activating the plugin via Jetpack.