updated plugin Jetpack Protect
version 1.3.0
This commit is contained in:
@ -5,7 +5,7 @@
|
||||
* @package automattic/jetpack-status
|
||||
*/
|
||||
|
||||
// phpcs:disable WordPress.PHP.IniSet.display_errors_Blacklisted
|
||||
// phpcs:disable WordPress.PHP.IniSet.display_errors_Disallowed
|
||||
// phpcs:disable WordPress.PHP.NoSilencedErrors.Discouraged
|
||||
// phpcs:disable WordPress.PHP.DevelopmentFunctions.prevent_path_disclosure_error_reporting
|
||||
// phpcs:disable WordPress.PHP.DiscouragedPHPFunctions.runtime_configuration_error_reporting
|
||||
|
@ -416,11 +416,17 @@ class Modules {
|
||||
|
||||
// Check and see if the old plugin is active.
|
||||
if ( isset( $jetpack->plugins_to_deactivate[ $module ] ) ) {
|
||||
// Deactivate the old plugin.
|
||||
if ( \Jetpack_Client_Server::deactivate_plugin( $jetpack->plugins_to_deactivate[ $module ][0], $jetpack->plugins_to_deactivate[ $module ][1] ) ) {
|
||||
// If we deactivated the old plugin, remembere that with ::state() and redirect back to this page to activate the module
|
||||
// We can't activate the module on this page load since the newly deactivated old plugin is still loaded on this page load.
|
||||
$state->state( 'deactivated_plugins', $module );
|
||||
// Deactivate the old plugins.
|
||||
$deactivated = array();
|
||||
foreach ( $jetpack->plugins_to_deactivate[ $module ] as $idx => $deactivate_me ) {
|
||||
if ( \Jetpack_Client_Server::deactivate_plugin( $deactivate_me[0], $deactivate_me[1] ) ) {
|
||||
// If we deactivated the old plugin, remembere that with ::state() and redirect back to this page to activate the module
|
||||
// We can't activate the module on this page load since the newly deactivated old plugin is still loaded on this page load.
|
||||
$deactivated[] = "$module:$idx";
|
||||
}
|
||||
}
|
||||
if ( $deactivated ) {
|
||||
$state->state( 'deactivated_plugins', join( ',', $deactivated ) );
|
||||
wp_safe_redirect( add_query_arg( 'jetpack_restate', 1 ) );
|
||||
exit;
|
||||
}
|
||||
|
@ -314,6 +314,63 @@ class Status {
|
||||
return \Jetpack_Options::get_option( 'onboarding' ) !== false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the site is currently private or not.
|
||||
* On WordPress.com and WoA, sites can be marked as private
|
||||
*
|
||||
* @since 1.16.0
|
||||
*
|
||||
* @return bool True if the site is private.
|
||||
*/
|
||||
public function is_private_site() {
|
||||
$ret = Cache::get( 'is_private_site' );
|
||||
if ( null === $ret ) {
|
||||
$is_private_site = '-1' === get_option( 'blog_public' );
|
||||
|
||||
/**
|
||||
* Filters the is_private_site check.
|
||||
*
|
||||
* @since 1.16.1
|
||||
*
|
||||
* @param bool $is_private_site True if the site is private.
|
||||
*/
|
||||
$is_private_site = apply_filters( 'jetpack_is_private_site', $is_private_site );
|
||||
|
||||
Cache::set( 'is_private_site', $is_private_site );
|
||||
return $is_private_site;
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the site is currently unlaunched or not.
|
||||
* On WordPress.com and WoA, sites can be marked as "coming soon", aka unlaunched
|
||||
*
|
||||
* @since 1.16.0
|
||||
*
|
||||
* @return bool True if the site is not launched.
|
||||
*/
|
||||
public function is_coming_soon() {
|
||||
$ret = Cache::get( 'is_coming_soon' );
|
||||
if ( null === $ret ) {
|
||||
$is_coming_soon = (bool) ( function_exists( 'site_is_coming_soon' ) && \site_is_coming_soon() )
|
||||
|| get_option( 'wpcom_public_coming_soon' );
|
||||
|
||||
/**
|
||||
* Filters the is_coming_soon check.
|
||||
*
|
||||
* @since 1.16.1
|
||||
*
|
||||
* @param bool $is_coming_soon True if the site is coming soon (i.e. unlaunched).
|
||||
*/
|
||||
$is_coming_soon = apply_filters( 'jetpack_is_coming_soon', $is_coming_soon );
|
||||
|
||||
Cache::set( 'is_coming_soon', $is_coming_soon );
|
||||
return $is_coming_soon;
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the site slug suffix to be used as part of Calypso URLs.
|
||||
*
|
||||
|
Reference in New Issue
Block a user