Merged in feature/280-dev-dev01 (pull request #21)
auto-patch 280-dev-dev01-2024-01-19T16_41_58 * auto-patch 280-dev-dev01-2024-01-19T16_41_58
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -119,4 +119,19 @@ class Host {
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Return source query param value from the URL if exists in the allowed sources list.
|
||||
*
|
||||
* @return string "source" query param value
|
||||
*/
|
||||
public function get_source_query() {
|
||||
// phpcs:disable WordPress.Security.NonceVerification.Recommended
|
||||
$allowed_sources = array( 'jetpack-manage' );
|
||||
if ( isset( $_GET['source'] ) && in_array( $_GET['source'], $allowed_sources, true ) ) {
|
||||
return sanitize_key( $_GET['source'] );
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,9 +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
|
||||
@@ -194,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';
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -409,5 +411,4 @@ class Status {
|
||||
|
||||
return rtrim( $url, ':' );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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