updated plugin Jetpack Protect
version 1.4.2
This commit is contained in:
@ -5,6 +5,39 @@ 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).
|
||||
|
||||
## [1.18.5] - 2023-09-25
|
||||
### Changed
|
||||
- Add 127.0.0.1 into the list of known local domains. [#32898]
|
||||
- WP.com Compatibility: Abort out early checking if Protect is active. WP.com's protection is not site option based. [#33196]
|
||||
|
||||
## [1.18.4] - 2023-09-19
|
||||
|
||||
- Minor internal updates.
|
||||
|
||||
## [1.18.3] - 2023-09-11
|
||||
### Changed
|
||||
- General: remove backwards-compatibility function checks now that the package supports WP 6.2. [#32772]
|
||||
|
||||
## [1.18.2] - 2023-09-04
|
||||
### Fixed
|
||||
- Exclude domains starting with live from known Pantheon staging domains [#32789]
|
||||
|
||||
## [1.18.1] - 2023-08-23
|
||||
### Changed
|
||||
- Updated package dependencies. [#32605]
|
||||
|
||||
## [1.18.0] - 2023-07-18
|
||||
### Added
|
||||
- Transferred 'get_calypso_env()' method from Jetpack plugin. [#31906]
|
||||
|
||||
## [1.17.2] - 2023-06-19
|
||||
### Changed
|
||||
- Use Plans package to detect feature support. [#31213]
|
||||
|
||||
## [1.17.1] - 2023-05-11
|
||||
### Changed
|
||||
- PHP 8.1 compatibility updates [#30517]
|
||||
|
||||
## [1.17.0] - 2023-04-17
|
||||
### Changed
|
||||
- When Jetpack is available, `Modules::get()` no longer translates `module_tags`. Use Jetpack's `jetpack_get_module_i18n_tag()` function if you need translations. [#30067]
|
||||
@ -252,6 +285,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
- Packages: Introduce a status package
|
||||
|
||||
[1.18.5]: https://github.com/Automattic/jetpack-status/compare/v1.18.4...v1.18.5
|
||||
[1.18.4]: https://github.com/Automattic/jetpack-status/compare/v1.18.3...v1.18.4
|
||||
[1.18.3]: https://github.com/Automattic/jetpack-status/compare/v1.18.2...v1.18.3
|
||||
[1.18.2]: https://github.com/Automattic/jetpack-status/compare/v1.18.1...v1.18.2
|
||||
[1.18.1]: https://github.com/Automattic/jetpack-status/compare/v1.18.0...v1.18.1
|
||||
[1.18.0]: https://github.com/Automattic/jetpack-status/compare/v1.17.2...v1.18.0
|
||||
[1.17.2]: https://github.com/Automattic/jetpack-status/compare/v1.17.1...v1.17.2
|
||||
[1.17.1]: https://github.com/Automattic/jetpack-status/compare/v1.17.0...v1.17.1
|
||||
[1.17.0]: https://github.com/Automattic/jetpack-status/compare/v1.16.4...v1.17.0
|
||||
[1.16.4]: https://github.com/Automattic/jetpack-status/compare/v1.16.3...v1.16.4
|
||||
[1.16.3]: https://github.com/Automattic/jetpack-status/compare/v1.16.2...v1.16.3
|
||||
|
@ -4,13 +4,13 @@
|
||||
"type": "jetpack-library",
|
||||
"license": "GPL-2.0-or-later",
|
||||
"require": {
|
||||
"automattic/jetpack-constants": "^1.6.22"
|
||||
"automattic/jetpack-constants": "^1.6.23"
|
||||
},
|
||||
"require-dev": {
|
||||
"brain/monkey": "2.6.1",
|
||||
"yoast/phpunit-polyfills": "1.0.4",
|
||||
"automattic/jetpack-changelogger": "^3.3.2",
|
||||
"automattic/jetpack-ip": "^0.1.2"
|
||||
"yoast/phpunit-polyfills": "1.1.0",
|
||||
"automattic/jetpack-changelogger": "^3.3.10",
|
||||
"automattic/jetpack-ip": "^0.1.6"
|
||||
},
|
||||
"suggest": {
|
||||
"automattic/jetpack-autoloader": "Allow for better interoperability with other plugins that use this package."
|
||||
@ -37,7 +37,7 @@
|
||||
"link-template": "https://github.com/Automattic/jetpack-status/compare/v${old}...v${new}"
|
||||
},
|
||||
"branch-alias": {
|
||||
"dev-trunk": "1.17.x-dev"
|
||||
"dev-trunk": "1.18.x-dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -51,5 +51,4 @@ class Cache {
|
||||
public static function clear() {
|
||||
self::$cache = array();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ class Files {
|
||||
return $files;
|
||||
}
|
||||
|
||||
// phpcs:ignore WordPress.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition
|
||||
// phpcs:ignore Generic.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition
|
||||
while ( false !== $file = readdir( $dir ) ) {
|
||||
if ( '.' === substr( $file, 0, 1 ) || '.php' !== substr( $file, -4 ) ) {
|
||||
continue;
|
||||
|
@ -93,4 +93,30 @@ class Host {
|
||||
$domains[] = 'calypso.localhost';
|
||||
return $domains;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return Calypso environment value; used for developing Jetpack and pairing
|
||||
* it with different Calypso environments, such as localhost.
|
||||
*
|
||||
* @since 1.18.0
|
||||
*
|
||||
* @return string Calypso environment
|
||||
*/
|
||||
public function get_calypso_env() {
|
||||
// phpcs:disable WordPress.Security.NonceVerification.Recommended -- Nonce is not required; only used for changing environments.
|
||||
if ( isset( $_GET['calypso_env'] ) ) {
|
||||
return sanitize_key( $_GET['calypso_env'] );
|
||||
}
|
||||
// phpcs:enable WordPress.Security.NonceVerification.Recommended
|
||||
|
||||
if ( getenv( 'CALYPSO_ENV' ) ) {
|
||||
return sanitize_key( getenv( 'CALYPSO_ENV' ) );
|
||||
}
|
||||
|
||||
if ( defined( 'CALYPSO_ENV' ) && CALYPSO_ENV ) {
|
||||
return sanitize_key( CALYPSO_ENV );
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
@ -7,8 +7,9 @@
|
||||
|
||||
namespace Automattic\Jetpack;
|
||||
|
||||
use Automattic\Jetpack\Constants as Constants;
|
||||
use Automattic\Jetpack\Current_Plan as Jetpack_Plan;
|
||||
use Automattic\Jetpack\IP\Utils as IP_Utils;
|
||||
use Automattic\Jetpack\Status\Host;
|
||||
|
||||
/**
|
||||
* Class Automattic\Jetpack\Modules
|
||||
@ -193,8 +194,11 @@ class Modules {
|
||||
$active = array_diff( $active, array( 'vaultpress' ) );
|
||||
}
|
||||
|
||||
// If protect is active on the main site of a multisite, it should be active on all sites.
|
||||
if ( ! in_array( 'protect', $active, true ) && is_multisite() && get_site_option( 'jetpack_protect_active' ) ) {
|
||||
// If protect is active on the main site of a multisite, it should be active on all sites. Doesn't apply to WP.com.
|
||||
if ( ! in_array( 'protect', $active, true )
|
||||
&& ! ( new Host() )->is_wpcom_simple()
|
||||
&& is_multisite()
|
||||
&& get_site_option( 'jetpack_protect_active' ) ) {
|
||||
$active[] = 'protect';
|
||||
}
|
||||
|
||||
@ -426,7 +430,7 @@ class Modules {
|
||||
}
|
||||
}
|
||||
if ( $deactivated ) {
|
||||
$state->state( 'deactivated_plugins', join( ',', $deactivated ) );
|
||||
$state->state( 'deactivated_plugins', implode( ',', $deactivated ) );
|
||||
wp_safe_redirect( add_query_arg( 'jetpack_restate', 1 ) );
|
||||
exit;
|
||||
}
|
||||
@ -441,7 +445,7 @@ class Modules {
|
||||
}
|
||||
}
|
||||
|
||||
if ( class_exists( 'Jetpack_Plan' ) && ! \Jetpack_Plan::supports( $module ) ) {
|
||||
if ( ! Jetpack_Plan::supports( $module ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -169,9 +169,8 @@ class Status {
|
||||
// Check for localhost and sites using an IP only first.
|
||||
$is_local = $site_url && false === strpos( $site_url, '.' );
|
||||
|
||||
// @todo Remove function_exists when the package has a documented minimum WP version.
|
||||
// Use Core's environment check, if available. Added in 5.5.0 / 5.5.1 (for `local` return value).
|
||||
if ( function_exists( 'wp_get_environment_type' ) && 'local' === wp_get_environment_type() ) {
|
||||
// Use Core's environment check, if available.
|
||||
if ( 'local' === wp_get_environment_type() ) {
|
||||
$is_local = true;
|
||||
}
|
||||
|
||||
@ -184,6 +183,7 @@ class Status {
|
||||
'#\.docksal\.site$#i', // Docksal.
|
||||
'#\.dev\.cc$#i', // ServerPress.
|
||||
'#\.lndo\.site$#i', // Lando.
|
||||
'#^https?://127\.0\.0\.1$#',
|
||||
);
|
||||
|
||||
if ( ! $is_local ) {
|
||||
@ -221,24 +221,26 @@ class Status {
|
||||
return $cached;
|
||||
}
|
||||
|
||||
// @todo Remove function_exists when the package has a documented minimum WP version.
|
||||
// Core's wp_get_environment_type allows for a few specific options. We should default to bowing out gracefully for anything other than production or local.
|
||||
$is_staging = function_exists( 'wp_get_environment_type' ) && ! in_array( wp_get_environment_type(), array( 'production', 'local' ), true );
|
||||
/*
|
||||
* Core's wp_get_environment_type allows for a few specific options.
|
||||
* We should default to bowing out gracefully for anything other than production or local.
|
||||
*/
|
||||
$is_staging = ! in_array( wp_get_environment_type(), array( 'production', 'local' ), true );
|
||||
|
||||
$known_staging = array(
|
||||
'urls' => array(
|
||||
'#\.staging\.wpengine\.com$#i', // WP Engine. This is their legacy staging URL structure. Their new platform does not have a common URL. https://github.com/Automattic/jetpack/issues/21504
|
||||
'#\.staging\.kinsta\.com$#i', // Kinsta.com.
|
||||
'#\.kinsta\.cloud$#i', // Kinsta.com.
|
||||
'#\.stage\.site$#i', // DreamPress.
|
||||
'#\.newspackstaging\.com$#i', // Newspack.
|
||||
'#\.pantheonsite\.io$#i', // Pantheon.
|
||||
'#\.flywheelsites\.com$#i', // Flywheel.
|
||||
'#\.flywheelstaging\.com$#i', // Flywheel.
|
||||
'#\.cloudwaysapps\.com$#i', // Cloudways.
|
||||
'#\.azurewebsites\.net$#i', // Azure.
|
||||
'#\.wpserveur\.net$#i', // WPServeur.
|
||||
'#\-liquidwebsites\.com$#i', // Liquidweb.
|
||||
'#\.staging\.wpengine\.com$#i', // WP Engine. This is their legacy staging URL structure. Their new platform does not have a common URL. https://github.com/Automattic/jetpack/issues/21504
|
||||
'#\.staging\.kinsta\.com$#i', // Kinsta.com.
|
||||
'#\.kinsta\.cloud$#i', // Kinsta.com.
|
||||
'#\.stage\.site$#i', // DreamPress.
|
||||
'#\.newspackstaging\.com$#i', // Newspack.
|
||||
'#^(?!live-)([a-zA-Z0-9-]+)\.pantheonsite\.io$#i', // Pantheon.
|
||||
'#\.flywheelsites\.com$#i', // Flywheel.
|
||||
'#\.flywheelstaging\.com$#i', // Flywheel.
|
||||
'#\.cloudwaysapps\.com$#i', // Cloudways.
|
||||
'#\.azurewebsites\.net$#i', // Azure.
|
||||
'#\.wpserveur\.net$#i', // WPServeur.
|
||||
'#\-liquidwebsites\.com$#i', // Liquidweb.
|
||||
),
|
||||
'constants' => array(
|
||||
'IS_WPE_SNAPSHOT', // WP Engine. This is used on their legacy staging environment. Their new platform does not have a constant. https://github.com/Automattic/jetpack/issues/21504
|
||||
|
@ -40,5 +40,4 @@ class Visitor {
|
||||
|
||||
return ! empty( $_SERVER['REMOTE_ADDR'] ) ? filter_var( wp_unslash( $_SERVER['REMOTE_ADDR'] ) ) : '';
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user