PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-beta
Jetpack – WP Security, Backup, Speed, & Growth v16.3-beta
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 13.7.2 All 507 releases
← All changes | jetpack_vendor/automattic/jetpack-plugins-installer/src/class-plugins-installer.php +9 -48 13.0.2 → 16.3-beta View file →
@@ -95,10 +95,10 @@
95 95 $error = __( 'There was an error installing your plugin', 'jetpack-plugins-installer' );
96 96 }
97 97
98 98 if ( ! $result ) {
99 - $error_code = $upgrader->skin->get_main_error_code();
100 - $message = $upgrader->skin->get_main_error_message();
99 + $error_code = $skin->get_main_error_code();
100 + $message = $skin->get_main_error_message();
101 101 $error = $message ? $message : __( 'An unknown error occurred during installation', 'jetpack-plugins-installer' );
102 102 }
103 103
104 104 if ( ! empty( $error ) ) {
@@ -188,9 +188,9 @@
188 188
189 189 /**
190 190 * Safely checks if the plugin is active
191 191 *
192 - * @since $next-version$
192 + * @since 0.1.0
193 193 *
194 194 * @param string $plugin_file The plugin file to check.
195 195 * @return bool
196 196 */
@@ -201,9 +201,9 @@
201 201
202 202 /**
203 203 * Safely checks if the plugin is active for network
204 204 *
205 - * @since $next-version$
205 + * @since 0.1.0
206 206 *
207 207 * @param string $plugin_file The plugin file to check.
208 208 * @return bool
209 209 */
@@ -241,54 +241,15 @@
241 241
242 242 /**
243 243 * Determine if the current request is activating a plugin from the plugins page.
244 244 *
245 + * @deprecated 0.4.0
246 + * @see Paths::is_current_request_activating_plugin_from_plugins_screen()
247 + *
245 248 * @param string $plugin Plugin file path to check.
246 249 * @return bool
247 250 */
248 251 public static function is_current_request_activating_plugin_from_plugins_screen( $plugin ) {
249 - // Filter out common async request contexts
250 - if (
251 - wp_doing_ajax() ||
252 - ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ||
253 - ( defined( 'REST_API_REQUEST' ) && REST_API_REQUEST ) ||
254 - ( defined( 'WP_CLI' ) && WP_CLI )
255 - ) {
256 - return false;
257 - }
258 -
259 - if ( isset( $_SERVER['SCRIPT_NAME'] ) ) {
260 - $request_file = esc_url_raw( wp_unslash( $_SERVER['SCRIPT_NAME'] ) );
261 - } elseif ( isset( $_SERVER['REQUEST_URI'] ) ) {
262 - list( $request_file ) = explode( '?', esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
263 - } else {
264 - return false;
265 - }
266 -
267 - // Not the plugins page
268 - if ( strpos( $request_file, 'wp-admin/plugins.php' ) === false ) {
269 - return false;
270 - }
271 -
272 - // Same method to get the action as used by plugins.php
273 - $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
274 - $action = $wp_list_table->current_action();
275 -
276 - // Not a singular activation
277 - // This also means that if the plugin is activated as part of a group ( bulk activation ), this function will return false here.
278 - if ( 'activate' !== $action ) {
279 - return false;
280 - }
281 -
282 - // Check the nonce associated with the plugin activation
283 - // We are not changing any data here, so this is not super necessary, it's just a best practice before using the form data from $_REQUEST.
284 - check_admin_referer( 'activate-plugin_' . $plugin );
285 -
286 - // Not the right plugin
287 - $requested_plugin = isset( $_REQUEST['plugin'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['plugin'] ) ) : null;
288 - if ( $requested_plugin !== $plugin ) {
289 - return false;
290 - }
291 -
292 - return true;
252 + _deprecated_function( __METHOD__, '0.4.0', 'Automattic\\Jetpack\\Paths::is_current_request_activating_plugin_from_plugins_screen()' );
253 + return ( new Paths() )->is_current_request_activating_plugin_from_plugins_screen( $plugin );
293 254 }
294 255 }