PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-a.7
Jetpack – WP Security, Backup, Speed, & Growth v16.3-a.7
16.3 16.3-beta 16.3-a.5 16.3-a.7 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 All 508 releases
← All changes | _inc/lib/admin-pages/class-jetpack-redux-state-helper.php +21 -18 16.2 → 16.3-a.7 View file →
@@ -6,9 +6,8 @@
6 6 * @package automattic/jetpack
7 7 */
8 8
9 9 use Automattic\Jetpack\Blaze;
10 -use Automattic\Jetpack\Boost_Speed_Score\Speed_Score_History;
11 10 use Automattic\Jetpack\Connection\Manager as Connection_Manager;
12 11 use Automattic\Jetpack\Connection\Plugin_Storage as Connection_Plugin_Storage;
13 12 use Automattic\Jetpack\Connection\REST_Connector;
14 13 use Automattic\Jetpack\Constants;
@@ -18,11 +17,9 @@
18 17 use Automattic\Jetpack\IP\Utils as IP_Utils;
19 18 use Automattic\Jetpack\Licensing;
20 19 use Automattic\Jetpack\Licensing\Endpoints as Licensing_Endpoints;
21 20 use Automattic\Jetpack\My_Jetpack\Initializer as My_Jetpack_Initializer;
22 -use Automattic\Jetpack\My_Jetpack\Jetpack_Manage;
23 21 use Automattic\Jetpack\Partner;
24 -use Automattic\Jetpack\Partner_Coupon as Jetpack_Partner_Coupon;
25 22 use Automattic\Jetpack\Publicize\Keyring_Helper;
26 23 use Automattic\Jetpack\Stats\Options as Stats_Options;
27 24 use Automattic\Jetpack\Status;
28 25 use Automattic\Jetpack\Status\Host;
@@ -43,8 +40,29 @@
43 40 );
44 41 }
45 42
46 43 /**
44 + * Generate the state for the plugins page: the minimal state plus what the deactivation survey needs.
45 + *
46 + * @since 16.3
47 + *
48 + * @return array
49 + */
50 + public static function get_plugins_page_state() {
51 + $state = self::get_minimal_state();
52 +
53 + $connection = new Connection_Manager();
54 +
55 + $state['pluginDeactivation'] = array(
56 + 'siteId' => (int) Jetpack_Options::get_option( 'id' ),
57 + 'hasConnectedUser' => $connection->has_connected_user(),
58 + 'isCurrentUserConnected' => $connection->is_user_connected(),
59 + );
60 +
61 + return $state;
62 + }
63 +
64 + /**
47 65 * Generate the initial state array to be used by the Redux store.
48 66 */
49 67 public static function get_initial_state() {
50 68 global $is_safari;
@@ -126,10 +144,8 @@
126 144 );
127 145
128 146 $connection_status = array_merge( REST_Connector::connection_status( false ), $connection_status );
129 147
130 - $speed_score_history = new Speed_Score_History( wp_parse_url( get_site_url(), PHP_URL_HOST ) );
131 -
132 148 $block_availability = Jetpack_Gutenberg::get_cached_availability();
133 149
134 150 return array(
135 151 'WP_API_root' => esc_url_raw( rest_url() ),
@@ -135,9 +151,8 @@
135 151 'WP_API_root' => esc_url_raw( rest_url() ),
136 152 'WP_API_nonce' => wp_create_nonce( 'wp_rest' ),
137 153 'registrationNonce' => '', // Not used, keeping it for compatibility reasons, see https://github.com/Automattic/jetpack/pull/42076
138 154 'purchaseToken' => self::get_purchase_token(),
139 - 'partnerCoupon' => Jetpack_Partner_Coupon::get_coupon(),
140 155 'pluginBaseUrl' => plugins_url( '', JETPACK__PLUGIN_FILE ),
141 156 'connectionStatus' => $connection_status,
142 157 'connectedPlugins' => Connection_Plugin_Storage::get_all(),
143 158 'connectUrl' => false == $current_user_data['isConnected'] // phpcs:ignore Universal.Operators.StrictComparisons.LooseEqual
@@ -184,14 +199,12 @@
184 199 'showPromotions' => apply_filters( 'jetpack_show_promotions', true ),
185 200 'plan' => Jetpack_Plan::get(),
186 201 'showBackups' => Jetpack::show_backups_ui(),
187 202 'showScan' => Jetpack::show_scan_ui(),
188 - 'showRecommendations' => Jetpack_Recommendations::is_enabled(),
189 203 /** This filter is documented in my-jetpack/src/class-initializer.php */
190 204 'showMyJetpack' => My_Jetpack_Initializer::should_initialize(),
191 205 'isMultisite' => is_multisite(),
192 206 'dateFormat' => get_option( 'date_format' ),
193 - 'latestBoostSpeedScores' => $speed_score_history->latest(),
194 207 'isSharingBlockAvailable' => isset( $block_availability['sharing-buttons'] )
195 208 && $block_availability['sharing-buttons']['available'],
196 209 'isLikeBlockAvailable' => isset( $block_availability['like'] )
197 210 && $block_availability['like']['available'],
@@ -217,10 +230,8 @@
217 230 'currentIp' => IP_Utils::get_ip(),
218 231 'lastPostUrl' => esc_url( $last_post ),
219 232 'externalServicesConnectUrls' => self::get_external_services_connect_urls(),
220 233 'calypsoEnv' => ( new Host() )->get_calypso_env(),
221 - 'products' => Jetpack::get_products_for_purchase(),
222 - 'recommendationsStep' => Jetpack_Core_Json_Api_Endpoints::get_recommendations_step()['step'],
223 234 'isSafari' => $is_safari || User_Agent_Info::is_opera_desktop(), // @todo Rename isSafari everywhere.
224 235 'doNotUseConnectionIframe' => Constants::is_true( 'JETPACK_SHOULD_NOT_USE_CONNECTION_IFRAME' ),
225 236 'licensing' => array(
226 237 'error' => Licensing::instance()->last_error(),
@@ -227,16 +238,8 @@
227 238 'showLicensingUi' => Licensing::instance()->is_licensing_input_enabled(),
228 239 'userCounts' => Licensing_Endpoints::get_user_license_counts(),
229 240 'activationNoticeDismiss' => Licensing::instance()->get_license_activation_notice_dismiss(),
230 241 ),
231 - 'jetpackManage' => array(
232 - 'isEnabled' => Jetpack_Manage::could_use_jp_manage(),
233 - 'isAgencyAccount' => Jetpack_Manage::is_agency_account(),
234 - ),
235 - 'hasSeenWCConnectionModal' => Jetpack_Options::get_option( 'has_seen_wc_connection_modal', false ),
236 - 'newRecommendations' => Jetpack_Recommendations::get_new_conditional_recommendations(),
237 - // Check if WooCommerce plugin is active (based on https://docs.woocommerce.com/document/create-a-plugin/).
238 - 'isWooCommerceActive' => in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', Jetpack::get_active_plugins() ), true ),
239 242 'useMyJetpackLicensingUI' => My_Jetpack_Initializer::is_licensing_ui_enabled(),
240 243 'isOdysseyStatsEnabled' => Stats_Options::get_option( 'enable_odyssey_stats' ),
241 244 'shouldInitializeBlaze' => Blaze::should_initialize(),
242 245 'isBlazeDashboardEnabled' => Blaze::is_dashboard_enabled(),