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/woocommerce-services.php +16 -18 12.0.3 → 16.3-a.1 View file →
@@ -2,9 +2,9 @@
2 2
3 3 use Automattic\Jetpack\Plugins_Installer;
4 4
5 5 if ( ! defined( 'ABSPATH' ) ) {
6 - exit;
6 + exit( 0 );
7 7 }
8 8
9 9 /**
10 10 * Installs and activates the WooCommerce Services plugin.
@@ -41,10 +41,15 @@
41 41 * Constructor
42 42 */
43 43 public function __construct() {
44 44 add_action( 'jetpack_loaded', array( $this, 'on_jetpack_loaded' ) );
45 - add_action( 'admin_init', array( $this, 'add_error_notice' ) );
46 - add_action( 'admin_init', array( $this, 'try_install' ) );
45 + if ( ! empty( $_GET['wc-services-install-error'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
46 + add_action( 'admin_notices', array( $this, 'error_notice' ) );
47 + }
48 +
49 + if ( isset( $_GET['wc-services-action'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
50 + add_action( 'admin_init', array( $this, 'try_install' ) );
51 + }
47 52 }
48 53
49 54 /**
50 55 * Runs on Jetpack being ready to load its packages.
@@ -98,29 +103,22 @@
98 103 }
99 104
100 105 wp_safe_redirect( $redirect );
101 106
102 - exit;
107 + exit( 0 );
103 108 }
104 109
105 110 /**
106 - * Set up installation error admin notice.
107 - */
108 - public function add_error_notice() {
109 - if ( ! empty( $_GET['wc-services-install-error'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
110 - add_action( 'admin_notices', array( $this, 'error_notice' ) );
111 - }
112 - }
113 -
114 - /**
115 111 * Notify the user that the installation of WooCommerce Services failed.
116 112 */
117 113 public function error_notice() {
118 - ?>
119 - <div class="notice notice-error is-dismissible">
120 - <p><?php esc_html_e( 'There was an error installing WooCommerce Services.', 'jetpack' ); ?></p>
121 - </div>
122 - <?php
114 + wp_admin_notice(
115 + esc_html__( 'There was an error installing WooCommerce Services.', 'jetpack' ),
116 + array(
117 + 'type' => 'error',
118 + 'dismissible' => true,
119 + )
120 + );
123 121 }
124 122
125 123 /**
126 124 * Download and install the WooCommerce Services plugin.