updated plugin Jetpack Protect
version 2.2.0
This commit is contained in:
@ -5,6 +5,22 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [0.4.0] - 2024-05-20
|
||||
### Deprecated
|
||||
- Extract the 'is_current_request_activating_plugin_from_plugins_screen' method into Status package. [#37430]
|
||||
|
||||
## [0.3.5] - 2024-05-06
|
||||
### Changed
|
||||
- Internal updates.
|
||||
|
||||
## [0.3.4] - 2024-04-08
|
||||
### Changed
|
||||
- Internal updates.
|
||||
|
||||
## [0.3.3] - 2024-03-25
|
||||
### Changed
|
||||
- Internal updates.
|
||||
|
||||
## [0.3.2] - 2024-03-14
|
||||
### Changed
|
||||
- Internal updates.
|
||||
@ -70,6 +86,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
### Fixed
|
||||
- Fix method logic
|
||||
|
||||
[0.4.0]: https://github.com/Automattic/jetpack-plugins-installer/compare/v0.3.5...v0.4.0
|
||||
[0.3.5]: https://github.com/Automattic/jetpack-plugins-installer/compare/v0.3.4...v0.3.5
|
||||
[0.3.4]: https://github.com/Automattic/jetpack-plugins-installer/compare/v0.3.3...v0.3.4
|
||||
[0.3.3]: https://github.com/Automattic/jetpack-plugins-installer/compare/v0.3.2...v0.3.3
|
||||
[0.3.2]: https://github.com/Automattic/jetpack-plugins-installer/compare/v0.3.1...v0.3.2
|
||||
[0.3.1]: https://github.com/Automattic/jetpack-plugins-installer/compare/v0.3.0...v0.3.1
|
||||
[0.3.0]: https://github.com/Automattic/jetpack-plugins-installer/compare/v0.2.6...v0.3.0
|
||||
|
@ -5,11 +5,12 @@
|
||||
"license": "GPL-2.0-or-later",
|
||||
"require": {
|
||||
"php": ">=7.0",
|
||||
"automattic/jetpack-a8c-mc-stats": "^2.0.1"
|
||||
"automattic/jetpack-a8c-mc-stats": "^2.0.1",
|
||||
"automattic/jetpack-status": "^3.1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"yoast/phpunit-polyfills": "1.1.0",
|
||||
"automattic/jetpack-changelogger": "^4.1.1"
|
||||
"automattic/jetpack-changelogger": "^4.2.4"
|
||||
},
|
||||
"suggest": {
|
||||
"automattic/jetpack-autoloader": "Allow for better interoperability with other plugins that use this package."
|
||||
@ -31,7 +32,7 @@
|
||||
"prefer-stable": true,
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-trunk": "0.3.x-dev"
|
||||
"dev-trunk": "0.4.x-dev"
|
||||
},
|
||||
"mirror-repo": "Automattic/jetpack-plugins-installer",
|
||||
"changelogger": {
|
||||
|
@ -8,6 +8,8 @@
|
||||
namespace Automattic\Jetpack;
|
||||
|
||||
use Automatic_Upgrader_Skin;
|
||||
use WP_Error;
|
||||
use WP_Upgrader;
|
||||
|
||||
/**
|
||||
* Include required files from wp-admin.
|
||||
@ -54,7 +56,7 @@ class Automatic_Install_Skin extends Automatic_Upgrader_Skin {
|
||||
/**
|
||||
* Overwrites the error function
|
||||
*
|
||||
* @param \WP_Error|mixed $error The error object.
|
||||
* @param WP_Error|mixed $error The error object.
|
||||
*/
|
||||
public function error( $error ) {
|
||||
if ( is_wp_error( $error ) ) {
|
||||
|
@ -96,8 +96,8 @@ class Plugins_Installer {
|
||||
}
|
||||
|
||||
if ( ! $result ) {
|
||||
$error_code = $upgrader->skin->get_main_error_code();
|
||||
$message = $upgrader->skin->get_main_error_message();
|
||||
$error_code = $skin->get_main_error_code();
|
||||
$message = $skin->get_main_error_message();
|
||||
$error = $message ? $message : __( 'An unknown error occurred during installation', 'jetpack-plugins-installer' );
|
||||
}
|
||||
|
||||
@ -242,53 +242,14 @@ class Plugins_Installer {
|
||||
/**
|
||||
* Determine if the current request is activating a plugin from the plugins page.
|
||||
*
|
||||
* @deprecated 0.4.0
|
||||
* @see Paths::is_current_request_activating_plugin_from_plugins_screen()
|
||||
*
|
||||
* @param string $plugin Plugin file path to check.
|
||||
* @return bool
|
||||
*/
|
||||
public static function is_current_request_activating_plugin_from_plugins_screen( $plugin ) {
|
||||
// Filter out common async request contexts
|
||||
if (
|
||||
wp_doing_ajax() ||
|
||||
( defined( 'REST_REQUEST' ) && REST_REQUEST ) ||
|
||||
( defined( 'REST_API_REQUEST' ) && REST_API_REQUEST ) ||
|
||||
( defined( 'WP_CLI' ) && WP_CLI )
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( isset( $_SERVER['SCRIPT_NAME'] ) ) {
|
||||
$request_file = esc_url_raw( wp_unslash( $_SERVER['SCRIPT_NAME'] ) );
|
||||
} elseif ( isset( $_SERVER['REQUEST_URI'] ) ) {
|
||||
list( $request_file ) = explode( '?', esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Not the plugins page
|
||||
if ( strpos( $request_file, 'wp-admin/plugins.php' ) === false ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Same method to get the action as used by plugins.php
|
||||
$wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
|
||||
$action = $wp_list_table->current_action();
|
||||
|
||||
// Not a singular activation
|
||||
// This also means that if the plugin is activated as part of a group ( bulk activation ), this function will return false here.
|
||||
if ( 'activate' !== $action ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check the nonce associated with the plugin activation
|
||||
// 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.
|
||||
check_admin_referer( 'activate-plugin_' . $plugin );
|
||||
|
||||
// Not the right plugin
|
||||
$requested_plugin = isset( $_REQUEST['plugin'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['plugin'] ) ) : null;
|
||||
if ( $requested_plugin !== $plugin ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
_deprecated_function( __METHOD__, '0.4.0', 'Automattic\\Jetpack\\Paths::is_current_request_activating_plugin_from_plugins_screen()' );
|
||||
return ( new Paths() )->is_current_request_activating_plugin_from_plugins_screen( $plugin );
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user