Skip to content

Commit

Permalink
Removing previously deprecated methods
Browse files Browse the repository at this point in the history
  • Loading branch information
bindlegirl committed Jan 15, 2024
1 parent 51d1f29 commit 7876c98
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 235 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: deprecated

Removing old and previously deprecated code.
235 changes: 0 additions & 235 deletions projects/packages/identity-crisis/src/class-identity-crisis.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

namespace Automattic\Jetpack;

use Automattic\Jetpack\Assets\Logo as Jetpack_Logo;
use Automattic\Jetpack\Connection\Manager as Connection_Manager;
use Automattic\Jetpack\Connection\Urls;
use Automattic\Jetpack\IdentityCrisis\Exception;
Expand Down Expand Up @@ -234,25 +233,6 @@ public function add_idc_query_args_to_url( $url ) {
return add_query_arg( $query_args, $url );
}

/**
* Non-admins current screen check.
*
* @param object $current_screen Current screen.
*
* @return null
* @deprecated 0.5.0 Use `@automattic/jetpack-idc` instead.
*/
public function non_admins_current_screen_check( $current_screen ) {
_deprecated_function( __METHOD__, '0.5.0' );

self::$current_screen = $current_screen;
if ( isset( $current_screen->id ) && 'toplevel_page_jetpack' === $current_screen->id ) {
return null;
}

return null;
}

/**
* Renders the admin bar button.
*
Expand Down Expand Up @@ -553,21 +533,6 @@ public static function get_sync_error_idc_option( $response = array() ) {
return $returned_values;
}

/**
* Returns the value of the jetpack_sync_idc_optin filter, or constant.
* If set to true, the site will be put into staging mode.
*
* @return bool
* @since 0.2.0
* @since-jetpack 4.3.2
* @deprecated 0.2.6 Use should_handle_idc()
* @see Automattic\Jetpack\Identity_Crisis::should_handle_idc
*/
public static function sync_idc_optin() {
_deprecated_function( __METHOD__, '0.2.6', 'Automattic\\Jetpack\\Identity_Crisis::should_handle_idc' );
return self::should_handle_idc();
}

/**
* Returns the value of the jetpack_should_handle_idc filter or constant.
* If set to true, the site will be put into staging mode.
Expand Down Expand Up @@ -604,155 +569,6 @@ public static function should_handle_idc() {
return (bool) apply_filters( 'jetpack_should_handle_idc', $default );
}

/**
* Returns the value for the deprecated filter, 'jetpack_sync_idc_optin'. That filter has been replaced with the
* 'jetpack_should_handle_idc' filter.
*
* @since 0.2.6
*
* @param bool $default Whether the site is opted in to IDC mitigation.
*/
public static function legacy_jetpack_sync_idc_optin_filter( $default ) {
/**
* Allows sites to opt in for IDC mitigation which blocks the site from syncing to WordPress.com when the home
* URL or site URL do not match what WordPress.com expects. The default value is either true, or the value of
* JETPACK_SYNC_IDC_OPTIN constant if set.
*
* @param bool $default Whether the site is opted in to IDC mitigation.
*
* @since 0.2.0
* @since-jetpack 4.3.2
* @deprecated 0.2.6 Use jetpack_should_handle_idc
*/
return (bool) apply_filters_deprecated( 'jetpack_sync_idc_optin', array( $default ), '0.2.6', 'jetpack_should_handle_idc' );
}

/**
* Does the current admin page have help tabs?
*
* @return bool
* @deprecated 0.5.0 Use `@automattic/jetpack-idc` instead.
*/
public function admin_page_has_help_tabs() {
_deprecated_function( __METHOD__, '0.5.0' );

if ( ! function_exists( 'get_current_screen' ) ) {
return false;
}

$current_screen = get_current_screen();
$tabs = $current_screen->get_help_tabs();

return ! empty( $tabs );
}

/**
* Renders the non-admin IDC notice.
*
* @return void
* @deprecated 0.5.0 Use `@automattic/jetpack-idc` instead.
*/
public function display_non_admin_idc_notice() {
_deprecated_function( __METHOD__, '0.5.0' );

$classes = 'jp-idc-notice inline is-non-admin notice notice-warning';
if ( isset( self::$current_screen ) && 'toplevel_page_jetpack' !== self::$current_screen->id ) {
$classes .= ' is-dismissible';
}

if ( $this->admin_page_has_help_tabs() ) {
$classes .= ' has-help-tabs';
}
?>

<div class="<?php echo esc_attr( $classes ); ?>">
<?php $this->render_notice_header(); ?>
<div class="jp-idc-notice__content-header">
<h3 class="jp-idc-notice__content-header__lead">
<?php echo $this->get_non_admin_notice_text(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</h3>

<p class="jp-idc-notice__content-header__explanation">
<?php echo $this->get_non_admin_contact_admin_text(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</p>
</div>
</div>
<?php
}

/**
* First "step" of the IDC mitigation. Will provide some messaging and two options/buttons.
* "Confirm Staging" - Dismiss the notice and continue on with our lives in staging mode.
* "Fix Jetpack Connection" - Will disconnect the site and start the mitigation...
*
* @return void
* @deprecated 0.5.0 Use `@automattic/jetpack-idc` instead.
*/
public function display_idc_notice() {
_deprecated_function( __METHOD__, '0.5.0' );

$classes = 'jp-idc-notice inline notice notice-warning';
if ( $this->admin_page_has_help_tabs() ) {
$classes .= ' has-help-tabs';
}
?>
<div class="<?php echo esc_attr( $classes ); ?>">
<?php $this->render_notice_header(); ?>
<?php $this->render_notice_first_step(); ?>
<?php $this->render_notice_second_step(); ?>
</div>
<?php
}

/**
* Enqueue CSS for the admin bar.
*
* @return void
* @deprecated 0.5.0 Use `@automattic/jetpack-idc` instead.
*/
public function enqueue_admin_bar_css() {
_deprecated_function( __METHOD__, '0.5.0' );
}

/**
* Enqueue scripts for the notice.
*
* @return void
* @deprecated 0.5.0 Use `@automattic/jetpack-idc` instead.
*/
public function enqueue_idc_notice_files() {
_deprecated_function( __METHOD__, '0.5.0' );

// Register and Enqueue jp-tracks-functions.
Tracking::register_tracks_functions_scripts( true );
}

/**
* Renders the notice header.
*
* @return void
* @deprecated 0.5.0 Use `@automattic/jetpack-idc` instead.
*/
public function render_notice_header() {
_deprecated_function( __METHOD__, '0.5.0' );

?>
<div class="jp-idc-notice__header">
<div class="jp-idc-notice__header__emblem">
<?php
$jetpack_logo = new Jetpack_Logo();
echo $jetpack_logo->get_jp_emblem(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
?>
</div>
<p class="jp-idc-notice__header__text">
<?php esc_html_e( 'Jetpack Safe Mode', 'jetpack-idc' ); ?>
</p>
</div>

<div class="jp-idc-notice__separator"></div>
<?php
}

/**
* Is a container for the error notices.
* Will be shown/controlled by jQuery in idc-notice.js.
Expand Down Expand Up @@ -1161,57 +977,6 @@ public function get_unsure_prompt() {
return apply_filters( 'jetpack_idc_unsure_prompt', $html );
}

/**
* Returns the non-admin notice text.
*
* @return string
* @deprecated 0.5.0 Use `@automattic/jetpack-idc` instead.
*/
public function get_non_admin_notice_text() {
_deprecated_function( __METHOD__, '0.5.0' );

$html = wp_kses(
sprintf(
/* translators: %s: Safe mode docs URL. */
__( 'Jetpack has been placed into Safe Mode. Learn more about <a href="%1$s">Safe Mode</a>.', 'jetpack-idc' ),
esc_url( self::get_safe_mod_doc_url() )
),
array( 'a' => array( 'href' => array() ) )
);

/**
* Allows overriding of the default text that is displayed to non-admin on the Jetpack admin page.
*
* @param string $html The HTML to be displayed.
*
* @since 0.2.0
* @since-jetpack 4.4.0
*/
return apply_filters( 'jetpack_idc_non_admin_notice_text', $html );
}

/**
* Returns the non-admin contact admin text.
*
* @return string
* @deprecated 0.5.0 Use `@automattic/jetpack-idc` instead.
*/
public function get_non_admin_contact_admin_text() {
_deprecated_function( __METHOD__, '0.5.0' );

$string = esc_html__( 'An administrator of this site can take Jetpack out of Safe Mode.', 'jetpack-idc' );

/**
* Allows overriding of the default text that is displayed to non-admins prompting them to contact an admin.
*
* @param string $string The string to be displayed.
*
* @since 0.2.0
* @since-jetpack 4.4.0
*/
return apply_filters( 'jetpack_idc_non_admin_contact_admin_text', $string );
}

/**
* Whether the site is undergoing identity crisis.
*
Expand Down

0 comments on commit 7876c98

Please sign in to comment.