updated plugin Jetpack Protect
version 3.0.2
This commit is contained in:
@ -5,6 +5,46 @@ 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).
|
||||
|
||||
## [4.0.1] - 2024-09-06
|
||||
### Removed
|
||||
- Removed usage of _deprecated_function when deprecating Status::is_onboarding [#39272]
|
||||
|
||||
## [4.0.0] - 2024-09-05
|
||||
### Deprecated
|
||||
- Deprecated Jetpack Onboarding system. [#39229]
|
||||
|
||||
## [3.3.4] - 2024-08-23
|
||||
### Changed
|
||||
- Updated package dependencies. [#39004]
|
||||
|
||||
## [3.3.3] - 2024-08-19
|
||||
### Changed
|
||||
- Internal updates.
|
||||
|
||||
## [3.3.2] - 2024-06-24
|
||||
### Changed
|
||||
- Internal updates.
|
||||
|
||||
## [3.3.1] - 2024-06-21
|
||||
### Added
|
||||
- Check for active modules among the unavailable ones. [#37358]
|
||||
|
||||
## [3.3.0] - 2024-06-10
|
||||
### Deprecated
|
||||
- Deprecated is_staging_site [#37023]
|
||||
|
||||
## [3.2.3] - 2024-06-03
|
||||
### Removed
|
||||
- Remove the Identity Crisis dev dependency. [#37654]
|
||||
|
||||
## [3.2.2] - 2024-05-29
|
||||
### Changed
|
||||
- Phab baseline file update. [#36968]
|
||||
|
||||
## [3.2.1] - 2024-05-28
|
||||
### Changed
|
||||
- Internal updates.
|
||||
|
||||
## [3.2.0] - 2024-05-22
|
||||
### Deprecated
|
||||
- Jetpack: Deprecated Errors class. [#37451]
|
||||
@ -357,6 +397,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
- Packages: Introduce a status package
|
||||
|
||||
[4.0.1]: https://github.com/Automattic/jetpack-status/compare/v4.0.0...v4.0.1
|
||||
[4.0.0]: https://github.com/Automattic/jetpack-status/compare/v3.3.4...v4.0.0
|
||||
[3.3.4]: https://github.com/Automattic/jetpack-status/compare/v3.3.3...v3.3.4
|
||||
[3.3.3]: https://github.com/Automattic/jetpack-status/compare/v3.3.2...v3.3.3
|
||||
[3.3.2]: https://github.com/Automattic/jetpack-status/compare/v3.3.1...v3.3.2
|
||||
[3.3.1]: https://github.com/Automattic/jetpack-status/compare/v3.3.0...v3.3.1
|
||||
[3.3.0]: https://github.com/Automattic/jetpack-status/compare/v3.2.3...v3.3.0
|
||||
[3.2.3]: https://github.com/Automattic/jetpack-status/compare/v3.2.2...v3.2.3
|
||||
[3.2.2]: https://github.com/Automattic/jetpack-status/compare/v3.2.1...v3.2.2
|
||||
[3.2.1]: https://github.com/Automattic/jetpack-status/compare/v3.2.0...v3.2.1
|
||||
[3.2.0]: https://github.com/Automattic/jetpack-status/compare/v3.1.0...v3.2.0
|
||||
[3.1.0]: https://github.com/Automattic/jetpack-status/compare/v3.0.3...v3.1.0
|
||||
[3.0.3]: https://github.com/Automattic/jetpack-status/compare/v3.0.2...v3.0.3
|
||||
|
@ -5,16 +5,15 @@
|
||||
"license": "GPL-2.0-or-later",
|
||||
"require": {
|
||||
"php": ">=7.0",
|
||||
"automattic/jetpack-constants": "^2.0.2"
|
||||
"automattic/jetpack-constants": "^2.0.4"
|
||||
},
|
||||
"require-dev": {
|
||||
"brain/monkey": "2.6.1",
|
||||
"yoast/phpunit-polyfills": "1.1.0",
|
||||
"automattic/jetpack-changelogger": "^4.2.4",
|
||||
"yoast/phpunit-polyfills": "^1.1.1",
|
||||
"automattic/jetpack-changelogger": "^4.2.6",
|
||||
"automattic/jetpack-connection": "@dev",
|
||||
"automattic/jetpack-identity-crisis": "@dev",
|
||||
"automattic/jetpack-plans": "@dev",
|
||||
"automattic/jetpack-ip": "^0.2.2"
|
||||
"automattic/jetpack-ip": "^0.2.3"
|
||||
},
|
||||
"suggest": {
|
||||
"automattic/jetpack-autoloader": "Allow for better interoperability with other plugins that use this package."
|
||||
@ -41,12 +40,11 @@
|
||||
"link-template": "https://github.com/Automattic/jetpack-status/compare/v${old}...v${new}"
|
||||
},
|
||||
"branch-alias": {
|
||||
"dev-trunk": "3.2.x-dev"
|
||||
"dev-trunk": "4.0.x-dev"
|
||||
},
|
||||
"dependencies": {
|
||||
"test-only": [
|
||||
"packages/connection",
|
||||
"packages/identity-crisis",
|
||||
"packages/plans"
|
||||
]
|
||||
}
|
||||
|
@ -31,12 +31,14 @@ class Errors {
|
||||
static $display_errors, $error_reporting;
|
||||
|
||||
if ( $catch ) {
|
||||
// Force error reporting and output, store original values.
|
||||
$display_errors = @ini_set( 'display_errors', 1 );
|
||||
$error_reporting = @error_reporting( E_ALL );
|
||||
if ( class_exists( 'Jetpack' ) ) {
|
||||
add_action( 'shutdown', array( 'Jetpack', 'catch_errors_on_shutdown' ), 0 );
|
||||
}
|
||||
} else {
|
||||
// Restore the original values for error reporting and output.
|
||||
@ini_set( 'display_errors', $display_errors );
|
||||
@error_reporting( $error_reporting );
|
||||
if ( class_exists( 'Jetpack' ) ) {
|
||||
|
@ -22,14 +22,16 @@ class Modules {
|
||||
* Check whether or not a Jetpack module is active.
|
||||
*
|
||||
* @param string $module The slug of a Jetpack module.
|
||||
* @param bool $available_only Whether to only check among available modules.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function is_active( $module ) {
|
||||
public function is_active( $module, $available_only = true ) {
|
||||
if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return in_array( $module, self::get_active(), true );
|
||||
return in_array( $module, self::get_active( $available_only ), true );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -184,8 +186,12 @@ class Modules {
|
||||
|
||||
/**
|
||||
* Get a list of activated modules as an array of module slugs.
|
||||
*
|
||||
* @param bool $available_only Filter out the unavailable (deleted) modules.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get_active() {
|
||||
public function get_active( $available_only = true ) {
|
||||
$active = \Jetpack_Options::get_option( 'active_modules' );
|
||||
|
||||
if ( ! is_array( $active ) ) {
|
||||
@ -206,9 +212,11 @@ class Modules {
|
||||
$active[] = 'protect';
|
||||
}
|
||||
|
||||
// If it's not available, it shouldn't be active.
|
||||
// We don't delete it from the options though, as it will be active again when a plugin gets reactivated.
|
||||
$active = array_intersect( $active, $this->get_available() );
|
||||
if ( $available_only ) {
|
||||
// If it's not available, it shouldn't be active.
|
||||
// We don't delete it from the options though, as it will be active again when a plugin gets reactivated.
|
||||
$active = array_intersect( $active, $this->get_available() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow filtering of the active modules.
|
||||
@ -409,7 +417,7 @@ class Modules {
|
||||
$state = new CookieState();
|
||||
|
||||
if ( ! \Jetpack::is_connection_ready() ) {
|
||||
if ( ! $status->is_offline_mode() && ! $status->is_onboarding() ) {
|
||||
if ( ! $status->is_offline_mode() ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -171,11 +171,12 @@ class Status {
|
||||
/**
|
||||
* If is a staging site.
|
||||
*
|
||||
* @todo Add IDC detection to a package.
|
||||
* @deprecated since 3.3.0
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function is_staging_site() {
|
||||
_deprecated_function( __FUNCTION__, '3.3.0', 'in_safe_mode' );
|
||||
$cached = Cache::get( 'is_staging_site' );
|
||||
if ( null !== $cached ) {
|
||||
return $cached;
|
||||
@ -261,12 +262,72 @@ class Status {
|
||||
return $is_staging;
|
||||
}
|
||||
|
||||
/**
|
||||
* If the site is in safe mode.
|
||||
*
|
||||
* @since 3.3.0
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function in_safe_mode() {
|
||||
$cached = Cache::get( 'in_safe_mode' );
|
||||
if ( null !== $cached ) {
|
||||
return $cached;
|
||||
}
|
||||
$in_safe_mode = false;
|
||||
if ( method_exists( 'Automattic\\Jetpack\\Identity_Crisis', 'validate_sync_error_idc_option' ) && \Automattic\Jetpack\Identity_Crisis::validate_sync_error_idc_option() ) {
|
||||
$in_safe_mode = true;
|
||||
}
|
||||
/**
|
||||
* Filters in_safe_mode check.
|
||||
*
|
||||
* @since 3.3.0
|
||||
*
|
||||
* @param bool $in_safe_mode If the current site is in safe mode.
|
||||
*/
|
||||
$in_safe_mode = apply_filters( 'jetpack_is_in_safe_mode', $in_safe_mode );
|
||||
|
||||
Cache::set( 'in_safe_mode', $in_safe_mode );
|
||||
return $in_safe_mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* If the site is a development/staging site.
|
||||
* This is a new version of is_staging_site added to separate safe mode from the legacy staging mode.
|
||||
* This method checks for core WP_ENVIRONMENT_TYPE setting
|
||||
* Using the jetpack_is_development_site filter.
|
||||
*
|
||||
* @since 3.3.0
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function is_development_site() {
|
||||
$cached = Cache::get( 'is_development_site' );
|
||||
if ( null !== $cached ) {
|
||||
return $cached;
|
||||
}
|
||||
$is_dev_site = ! in_array( wp_get_environment_type(), array( 'production', 'local' ), true );
|
||||
/**
|
||||
* Filters is_development_site check.
|
||||
*
|
||||
* @since 3.3.0
|
||||
*
|
||||
* @param bool $is_dev_site If the current site is a staging or dev site.
|
||||
*/
|
||||
$is_dev_site = apply_filters( 'jetpack_is_development_site', $is_dev_site );
|
||||
|
||||
Cache::set( 'is_development_site', $is_dev_site );
|
||||
return $is_dev_site;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the site is currently onboarding or not.
|
||||
* A site is considered as being onboarded if it currently has an onboarding token.
|
||||
*
|
||||
* @since-jetpack 5.8
|
||||
*
|
||||
* @deprecated since 4.0.0
|
||||
*
|
||||
* @access public
|
||||
* @static
|
||||
*
|
||||
|
Reference in New Issue
Block a user