Deprecate major plugin notices.

This commit is contained in:
Peter Fabian 2021-01-22 11:58:40 +01:00
parent 2123b6369e
commit d2d20314ab
3 changed files with 13 additions and 20 deletions

View File

@ -99,9 +99,11 @@ class WC_Plugin_Updates {
/**
* Get the inline warning notice for major version updates.
*
* @deprecated 4.9.2
* @return string
*/
protected function get_extensions_inline_warning_major() {
wc_deprecated_function( 'WC_Plugin_Updates::get_extensions_inline_warning_major', '4.9.2', '' );
$upgrade_type = 'major';
$plugins = $this->major_untested_plugins;
$version_parts = explode( '.', $this->new_version );
@ -122,9 +124,11 @@ class WC_Plugin_Updates {
/**
* Get the warning notice for the modal window.
*
* @deprecated 4.9.2
* @return string
*/
protected function get_extensions_modal_warning() {
wc_deprecated_function( 'WC_Plugin_Updates::get_extensions_modal_warning', '4.9.2', '' );
$version_parts = explode( '.', $this->new_version );
$new_version = $version_parts[0] . '.0';
$plugins = $this->major_untested_plugins;

View File

@ -42,14 +42,8 @@ class WC_Plugins_Screen_Updates extends WC_Plugin_Updates {
* @param stdClass $response Plugin update response.
*/
public function in_plugin_update_message( $args, $response ) {
$version_type = Constants::get_constant( 'WC_SSR_PLUGIN_UPDATE_RELEASE_VERSION_TYPE' );
if ( ! is_string( $version_type ) ) {
$version_type = 'none';
}
$this->new_version = $response->new_version;
$this->upgrade_notice = $this->get_upgrade_notice( $response->new_version );
$this->major_untested_plugins = $this->get_untested_plugins( $response->new_version, $version_type );
$current_version_parts = explode( '.', Constants::get_constant( 'WC_VERSION' ) );
$new_version_parts = explode( '.', $this->new_version );
@ -59,15 +53,6 @@ class WC_Plugins_Screen_Updates extends WC_Plugin_Updates {
return;
}
if ( ! empty( $this->major_untested_plugins ) ) {
$this->upgrade_notice .= $this->get_extensions_inline_warning_major();
}
if ( ! empty( $this->major_untested_plugins ) ) {
$this->upgrade_notice .= $this->get_extensions_modal_warning();
add_action( 'admin_print_footer_scripts', array( $this, 'plugin_screen_modal_js' ) );
}
echo apply_filters( 'woocommerce_in_plugin_update_message', $this->upgrade_notice ? '</p>' . wp_kses_post( $this->upgrade_notice ) . '<p class="dummy">' : '' ); // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
}
@ -136,8 +121,11 @@ class WC_Plugins_Screen_Updates extends WC_Plugin_Updates {
/**
* JS for the modal window on the plugins screen.
*
* @deprecated 4.9.2
*/
public function plugin_screen_modal_js() {
wc_deprecated_function( 'WC_Plugins_Screen_Updates::plugin_screen_modal_js', '4.9.2', '' );
?>
<script>
( function( $ ) {

View File

@ -28,8 +28,11 @@ class WC_Updates_Screen_Updates extends WC_Plugin_Updates {
/**
* Show a warning message on the upgrades screen if the user tries to upgrade and has untested plugins.
*
* @deprecated 4.9.2
*/
public function update_screen_modal() {
wc_deprecated_function( 'WC_Updates_Screen_Updates::update_screen_modal', '4.9.2', '' );
$updateable_plugins = get_plugin_updates();
if ( empty( $updateable_plugins['woocommerce/woocommerce.php'] )
|| empty( $updateable_plugins['woocommerce/woocommerce.php']->update )
@ -39,17 +42,15 @@ class WC_Updates_Screen_Updates extends WC_Plugin_Updates {
$this->new_version = wc_clean( $updateable_plugins['woocommerce/woocommerce.php']->update->new_version );
$this->major_untested_plugins = $this->get_untested_plugins( $this->new_version, 'major' );
if ( ! empty( $this->major_untested_plugins ) ) {
echo $this->get_extensions_modal_warning(); // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
$this->update_screen_modal_js();
}
}
/**
* JS for the modal window on the updates screen.
*
* @deprecated 4.9.2
*/
protected function update_screen_modal_js() {
wc_deprecated_function( 'WC_Updates_Screen_Updates::update_screen_modal_js', '4.9.2', '' );
?>
<script>
( function( $ ) {