From 2c6bed050e85deede35c183b09cc1f15660c4529 Mon Sep 17 00:00:00 2001
From: jrfnl <jrfnl@users.noreply.github.com>
Date: Tue, 8 Oct 2019 03:26:47 +0200
Subject: [PATCH] Use the correct function for deprecated hooks

---
 src/wp-admin/edit-tag-form.php                | 18 ++++++++--------
 src/wp-admin/edit-tags.php                    | 12 +++++------
 src/wp-admin/includes/class-wp-screen.php     | 21 ++++++++++++++++---
 .../includes/class-wp-terms-list-table.php    |  4 ++--
 src/wp-admin/includes/image-edit.php          |  8 +++----
 src/wp-admin/includes/media.php               |  2 +-
 src/wp-admin/includes/meta-boxes.php          |  2 +-
 src/wp-includes/class-wp-rewrite.php          |  4 ++--
 src/wp-includes/class-wp-xmlrpc-server.php    |  4 ++--
 src/wp-includes/class-wp.php                  |  7 ++++++-
 src/wp-includes/post.php                      |  4 ++--
 src/wp-includes/taxonomy.php                  |  4 ++--
 src/wp-includes/user.php                      |  2 +-
 src/wp-signup.php                             |  2 +-
 14 files changed, 57 insertions(+), 37 deletions(-)

diff --git a/src/wp-admin/edit-tag-form.php b/src/wp-admin/edit-tag-form.php
index 006c70774d..cf5c80ffa2 100644
--- a/src/wp-admin/edit-tag-form.php
+++ b/src/wp-admin/edit-tag-form.php
@@ -21,7 +21,7 @@ if ( 'category' == $taxonomy ) {
 	 *
 	 * @param WP_Term $tag Current category term object.
 	 */
-	do_action( 'edit_category_form_pre', $tag );
+	do_action_deprecated( 'edit_category_form_pre', array( $tag ), '3.0.0', '{$taxonomy}_pre_edit_form' );
 } elseif ( 'link_category' == $taxonomy ) {
 	/**
 	 * Fires before the Edit Link Category form.
@@ -31,7 +31,7 @@ if ( 'category' == $taxonomy ) {
 	 *
 	 * @param WP_Term $tag Current link category term object.
 	 */
-	do_action( 'edit_link_category_form_pre', $tag );
+	do_action_deprecated( 'edit_link_category_form_pre', array( $tag ), '3.0.0', '{$taxonomy}_pre_edit_form' );
 } else {
 	/**
 	 * Fires before the Edit Tag form.
@@ -41,7 +41,7 @@ if ( 'category' == $taxonomy ) {
 	 *
 	 * @param WP_Term $tag Current tag term object.
 	 */
-	do_action( 'edit_tag_form_pre', $tag );
+	do_action_deprecated( 'edit_tag_form_pre', array( $tag ), '3.0.0', '{$taxonomy}_pre_edit_form' );
 }
 
 /**
@@ -201,7 +201,7 @@ if ( isset( $tag->name ) ) {
 			 *
 			 * @param WP_Term $tag Current category term object.
 			 */
-			do_action( 'edit_category_form_fields', $tag );
+			do_action_deprecated( 'edit_category_form_fields', array( $tag ), '3.0.0', '{$taxonomy}_edit_form_fields' );
 		} elseif ( 'link_category' == $taxonomy ) {
 			/**
 			 * Fires after the Edit Link Category form fields are displayed.
@@ -211,7 +211,7 @@ if ( isset( $tag->name ) ) {
 			 *
 			 * @param WP_Term $tag Current link category term object.
 			 */
-			do_action( 'edit_link_category_form_fields', $tag );
+			do_action_deprecated( 'edit_link_category_form_fields', array( $tag ), '3.0.0', '{$taxonomy}_edit_form_fields' );
 		} else {
 			/**
 			 * Fires after the Edit Tag form fields are displayed.
@@ -221,7 +221,7 @@ if ( isset( $tag->name ) ) {
 			 *
 			 * @param WP_Term $tag Current tag term object.
 			 */
-			do_action( 'edit_tag_form_fields', $tag );
+			do_action_deprecated( 'edit_tag_form_fields', array( $tag ), '3.0.0', '{$taxonomy}_edit_form_fields' );
 		}
 		/**
 		 * Fires after the Edit Term form fields are displayed.
@@ -241,10 +241,10 @@ if ( isset( $tag->name ) ) {
 // Back compat hooks
 if ( 'category' == $taxonomy ) {
 	/** This action is documented in wp-admin/edit-tags.php */
-	do_action( 'edit_category_form', $tag );
+	do_action_deprecated( 'edit_category_form', array( $tag ), '3.0.0', '{$taxonomy}_add_form' );
 } elseif ( 'link_category' == $taxonomy ) {
 	/** This action is documented in wp-admin/edit-tags.php */
-	do_action( 'edit_link_category_form', $tag );
+	do_action_deprecated( 'edit_link_category_form', array( $tag ), '3.0.0', '{$taxonomy}_add_form' );
 } else {
 	/**
 	 * Fires at the end of the Edit Term form.
@@ -254,7 +254,7 @@ if ( 'category' == $taxonomy ) {
 	 *
 	 * @param WP_Term $tag Current taxonomy term object.
 	 */
-	do_action( 'edit_tag_form', $tag );
+	do_action_deprecated( 'edit_tag_form', array( $tag ), '3.0.0', '{$taxonomy}_edit_form' );
 }
 /**
  * Fires at the end of the Edit Term form for all taxonomies.
diff --git a/src/wp-admin/edit-tags.php b/src/wp-admin/edit-tags.php
index 80ab3ffdd8..d2cda2c633 100644
--- a/src/wp-admin/edit-tags.php
+++ b/src/wp-admin/edit-tags.php
@@ -378,7 +378,7 @@ if ( $can_edit_terms ) {
 		 *
 		 * @param object $arg Optional arguments cast to an object.
 		 */
-		do_action( 'add_category_form_pre', (object) array( 'parent' => 0 ) );
+		do_action_deprecated( 'add_category_form_pre', array( (object) array( 'parent' => 0 ) ), '3.0.0', '{$taxonomy}_pre_add_form' );
 	} elseif ( 'link_category' == $taxonomy ) {
 		/**
 		 * Fires before the link category form.
@@ -388,7 +388,7 @@ if ( $can_edit_terms ) {
 		 *
 		 * @param object $arg Optional arguments cast to an object.
 		 */
-		do_action( 'add_link_category_form_pre', (object) array( 'parent' => 0 ) );
+		do_action_deprecated( 'add_link_category_form_pre', array( (object) array( 'parent' => 0 ) ), '3.0.0', '{$taxonomy}_pre_add_form' );
 	} else {
 		/**
 		 * Fires before the Add Tag form.
@@ -398,7 +398,7 @@ if ( $can_edit_terms ) {
 		 *
 		 * @param string $taxonomy The taxonomy slug.
 		 */
-		do_action( 'add_tag_form_pre', $taxonomy );
+		do_action_deprecated( 'add_tag_form_pre', array( $taxonomy ), '3.0.0', '{$taxonomy}_pre_add_form' );
 	}
 
 	/**
@@ -534,7 +534,7 @@ if ( $can_edit_terms ) {
 		 *
 		 * @param object $arg Optional arguments cast to an object.
 		 */
-		do_action( 'edit_category_form', (object) array( 'parent' => 0 ) );
+		do_action_deprecated( 'edit_category_form', array( (object) array( 'parent' => 0 ) ), '3.0.0', '{$taxonomy}_add_form' );
 	} elseif ( 'link_category' == $taxonomy ) {
 		/**
 		 * Fires at the end of the Edit Link form.
@@ -544,7 +544,7 @@ if ( $can_edit_terms ) {
 		 *
 		 * @param object $arg Optional arguments cast to an object.
 		 */
-		do_action( 'edit_link_category_form', (object) array( 'parent' => 0 ) );
+		do_action_deprecated( 'edit_link_category_form', array( (object) array( 'parent' => 0 ) ), '3.0.0', '{$taxonomy}_add_form' );
 	} else {
 		/**
 		 * Fires at the end of the Add Tag form.
@@ -554,7 +554,7 @@ if ( $can_edit_terms ) {
 		 *
 		 * @param string $taxonomy The taxonomy slug.
 		 */
-		do_action( 'add_tag_form', $taxonomy );
+		do_action_deprecated( 'add_tag_form', array( $taxonomy ), '3.0.0', '{$taxonomy}_add_form' );
 	}
 
 	/**
diff --git a/src/wp-admin/includes/class-wp-screen.php b/src/wp-admin/includes/class-wp-screen.php
index 41b20a1024..8d9a4fa072 100644
--- a/src/wp-admin/includes/class-wp-screen.php
+++ b/src/wp-admin/includes/class-wp-screen.php
@@ -775,7 +775,12 @@ final class WP_Screen {
 		 * @param array     $old_compat_help Old contextual help.
 		 * @param WP_Screen $this            Current WP_Screen instance.
 		 */
-		self::$_old_compat_help = apply_filters( 'contextual_help_list', self::$_old_compat_help, $this );
+		self::$_old_compat_help = apply_filters_deprecated(
+			'contextual_help_list',
+			array( self::$_old_compat_help, $this ),
+			'3.3.0',
+			'get_current_screen()->add_help_tab() or get_current_screen()->remove_help_tab()'
+		);
 
 		$old_help = isset( self::$_old_compat_help[ $this->id ] ) ? self::$_old_compat_help[ $this->id ] : '';
 
@@ -790,7 +795,12 @@ final class WP_Screen {
 		 * @param string    $screen_id Screen ID.
 		 * @param WP_Screen $this      Current WP_Screen instance.
 		 */
-		$old_help = apply_filters( 'contextual_help', $old_help, $this->id, $this );
+		$old_help = apply_filters_deprecated(
+			'contextual_help',
+			array( $old_help, $this->id, $this ),
+			'3.3.0',
+			'get_current_screen()->add_help_tab() or get_current_screen()->remove_help_tab()'
+		);
 
 		// Default help only if there is no old-style block of text and no new-style help tabs.
 		if ( empty( $old_help ) && ! $this->get_help_tabs() ) {
@@ -804,7 +814,12 @@ final class WP_Screen {
 			 *
 			 * @param string $old_help_default Default contextual help text.
 			 */
-			$default_help = apply_filters( 'default_contextual_help', '' );
+			$default_help = apply_filters_deprecated(
+				'default_contextual_help',
+				array( '' ),
+				'3.3.0',
+				'get_current_screen()->add_help_tab() or get_current_screen()->remove_help_tab()'
+			);
 			if ( $default_help ) {
 				$old_help = '<p>' . $default_help . '</p>';
 			}
diff --git a/src/wp-admin/includes/class-wp-terms-list-table.php b/src/wp-admin/includes/class-wp-terms-list-table.php
index 33ef9fa8d6..a537311d40 100644
--- a/src/wp-admin/includes/class-wp-terms-list-table.php
+++ b/src/wp-admin/includes/class-wp-terms-list-table.php
@@ -97,7 +97,7 @@ class WP_Terms_List_Table extends WP_List_Table {
 			 *
 			 * @param int $tags_per_page Number of tags to be displayed. Default 20.
 			 */
-			$tags_per_page = apply_filters( 'tagsperpage', $tags_per_page );
+			$tags_per_page = apply_filters_deprecated( 'tagsperpage', array( $tags_per_page ), '2.8.0', 'edit_tags_per_page' );
 		} elseif ( 'category' === $this->screen->taxonomy ) {
 			/**
 			 * Filters the number of terms displayed per page for the Categories list table.
@@ -508,7 +508,7 @@ class WP_Terms_List_Table extends WP_List_Table {
 		 *                          'Edit', 'Quick Edit', 'Delete', and 'View'.
 		 * @param WP_Term  $tag     Term object.
 		 */
-		$actions = apply_filters( 'tag_row_actions', $actions, $tag );
+		$actions = apply_filters_deprecated( 'tag_row_actions', array( $actions, $tag ), '3.0.0', '{$taxonomy}_row_actions' );
 
 		/**
 		 * Filters the action links displayed for each term in the terms list table.
diff --git a/src/wp-admin/includes/image-edit.php b/src/wp-admin/includes/image-edit.php
index 3d038f8391..519100acc3 100644
--- a/src/wp-admin/includes/image-edit.php
+++ b/src/wp-admin/includes/image-edit.php
@@ -292,7 +292,7 @@ function wp_stream_image( $image, $mime_type, $attachment_id ) {
 		 * @param resource $image         Image resource to be streamed.
 		 * @param int      $attachment_id The attachment post ID.
 		 */
-		$image = apply_filters( 'image_save_pre', $image, $attachment_id );
+		$image = apply_filters_deprecated( 'image_save_pre', array( $image, $attachment_id ), '3.5.0', 'image_editor_save_pre' );
 
 		switch ( $mime_type ) {
 			case 'image/jpeg':
@@ -353,7 +353,7 @@ function wp_save_image_file( $filename, $image, $mime_type, $post_id ) {
 		_deprecated_argument( __FUNCTION__, '3.5.0', sprintf( __( '%1$s needs to be a %2$s object.' ), '$image', 'WP_Image_Editor' ) );
 
 		/** This filter is documented in wp-admin/includes/image-edit.php */
-		$image = apply_filters( 'image_save_pre', $image, $post_id );
+		$image = apply_filters_deprecated( 'image_save_pre', array( $image, $post_id ), '3.5.0', 'image_editor_save_pre' );;
 
 		/**
 		 * Filters whether to skip saving the image file.
@@ -370,7 +370,7 @@ function wp_save_image_file( $filename, $image, $mime_type, $post_id ) {
 		 * @param string          $mime_type Image mime type.
 		 * @param int             $post_id   Post ID.
 		 */
-		$saved = apply_filters( 'wp_save_image_file', null, $filename, $image, $mime_type, $post_id );
+		$saved = apply_filters_deprecated( 'wp_save_image_file', array( null, $filename, $image, $mime_type, $post_id ), '3.5.0', 'wp_save_image_editor_file' );
 
 		if ( null !== $saved ) {
 			return $saved;
@@ -570,7 +570,7 @@ function image_edit_apply_changes( $image, $changes ) {
 		 * @param resource $image   GD image resource.
 		 * @param array    $changes Array of change operations.
 		 */
-		$image = apply_filters( 'image_edit_before_change', $image, $changes );
+		$image = apply_filters_deprecated( 'image_edit_before_change', array( $image, $changes ), '3.5.0', 'wp_image_editor_before_change' );
 	}
 
 	foreach ( $changes as $operation ) {
diff --git a/src/wp-admin/includes/media.php b/src/wp-admin/includes/media.php
index b9e9acc99d..9838019ce4 100644
--- a/src/wp-admin/includes/media.php
+++ b/src/wp-admin/includes/media.php
@@ -652,7 +652,7 @@ function media_buttons( $editor_id = 'content' ) {
 	 *
 	 * @param string $string Media buttons context. Default empty.
 	 */
-	$legacy_filter = apply_filters( 'media_buttons_context', '' );
+	$legacy_filter = apply_filters_deprecated( 'media_buttons_context', array( '' ), '3.5.0', 'media_buttons' );
 
 	if ( $legacy_filter ) {
 		// #WP22559. Close <a> if a plugin started by closing <a> to open their own <a> tag.
diff --git a/src/wp-admin/includes/meta-boxes.php b/src/wp-admin/includes/meta-boxes.php
index 7c5d72570c..4cf7378501 100644
--- a/src/wp-admin/includes/meta-boxes.php
+++ b/src/wp-admin/includes/meta-boxes.php
@@ -1508,7 +1508,7 @@ function register_and_do_post_meta_boxes( $post ) {
 	 *
 	 * @param WP_Post $post Post object.
 	 */
-	do_action( 'dbx_post_advanced', $post );
+	do_action_deprecated( 'dbx_post_advanced', array( $post ), '3.7.0', 'add_meta_boxes' );
 
 	// Allow the Discussion meta box to show up if the post type supports comments,
 	// or if comments or pings are open.
diff --git a/src/wp-includes/class-wp-rewrite.php b/src/wp-includes/class-wp-rewrite.php
index bc96c083dc..f73617e066 100644
--- a/src/wp-includes/class-wp-rewrite.php
+++ b/src/wp-includes/class-wp-rewrite.php
@@ -1411,7 +1411,7 @@ class WP_Rewrite {
 				 *
 				 * @param array $rules The rewrite rules generated for tags.
 				 */
-				$rules = apply_filters( 'tag_rewrite_rules', $rules );
+				$rules = apply_filters_deprecated( 'tag_rewrite_rules', array( $rules ), '3.1.0', 'post_tag_rewrite_rules' );
 			}
 
 			$this->extra_rules_top = array_merge( $this->extra_rules_top, $rules );
@@ -1560,7 +1560,7 @@ class WP_Rewrite {
 		 *
 		 * @param string $rules mod_rewrite Rewrite rules formatted for .htaccess.
 		 */
-		return apply_filters( 'rewrite_rules', $rules );
+		return apply_filters_deprecated( 'rewrite_rules', array( $rules ), '1.5.0', 'mod_rewrite_rules' );
 	}
 
 	/**
diff --git a/src/wp-includes/class-wp-xmlrpc-server.php b/src/wp-includes/class-wp-xmlrpc-server.php
index abef0329ef..377efd0463 100644
--- a/src/wp-includes/class-wp-xmlrpc-server.php
+++ b/src/wp-includes/class-wp-xmlrpc-server.php
@@ -235,9 +235,9 @@ class wp_xmlrpc_server extends IXR_Server {
 		 * Respect old get_option() filters left for back-compat when the 'enable_xmlrpc'
 		 * option was deprecated in 3.5.0. Use the 'xmlrpc_enabled' hook instead.
 		 */
-		$enabled = apply_filters( 'pre_option_enable_xmlrpc', false );
+		$enabled = apply_filters_deprecated( 'pre_option_enable_xmlrpc', array( false ), '3.5.0', 'xmlrpc_enabled' );
 		if ( false === $enabled ) {
-			$enabled = apply_filters( 'option_enable_xmlrpc', true );
+			$enabled = apply_filters_deprecated( 'option_enable_xmlrpc', array( true ), '3.5.0', 'xmlrpc_enabled' );
 		}
 
 		/**
diff --git a/src/wp-includes/class-wp.php b/src/wp-includes/class-wp.php
index 59f1a90dbb..0772426773 100644
--- a/src/wp-includes/class-wp.php
+++ b/src/wp-includes/class-wp.php
@@ -546,7 +546,12 @@ class WP {
 			 *
 			 * @param string $query_string The query string to modify.
 			 */
-			$this->query_string = apply_filters( 'query_string', $this->query_string );
+			$this->query_string = apply_filters_deprecated(
+				'query_string',
+				array( $this->query_string ),
+				'2.1.0',
+				'query_vars or request'
+			);
 			parse_str( $this->query_string, $this->query_vars );
 		}
 	}
diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php
index eb98238d5e..2a598fc2fb 100644
--- a/src/wp-includes/post.php
+++ b/src/wp-includes/post.php
@@ -6325,7 +6325,7 @@ function get_posts_by_author_sql( $post_type, $full = true, $post_author = null,
 		 *
 		 * @param string $cap Capability.
 		 */
-		$cap = apply_filters( 'pub_priv_sql_capability', '' );
+		$cap = apply_filters_deprecated( 'pub_priv_sql_capability', array( '' ), '3.2.0' );
 		if ( ! $cap ) {
 			$cap = current_user_can( $post_type_obj->cap->read_private_posts );
 		}
@@ -6734,7 +6734,7 @@ function _transition_post_status( $new_status, $old_status, $post ) {
 		 *
 		 * @param int $post_id Post ID.
 		 */
-		do_action( 'private_to_published', $post->ID );
+		do_action_deprecated( 'private_to_published', array( $post->ID ), '2.3.0', 'private_to_publish' );
 	}
 
 	// If published posts changed clear the lastpostmodified cache.
diff --git a/src/wp-includes/taxonomy.php b/src/wp-includes/taxonomy.php
index 4631a534dd..e861d921f5 100644
--- a/src/wp-includes/taxonomy.php
+++ b/src/wp-includes/taxonomy.php
@@ -4249,7 +4249,7 @@ function get_term_link( $term, $taxonomy = '' ) {
 		 * @param string $termlink Tag link URL.
 		 * @param int    $term_id  Term ID.
 		 */
-		$termlink = apply_filters( 'tag_link', $termlink, $term->term_id );
+		$termlink = apply_filters_deprecated( 'tag_link', array( $termlink, $term->term_id ), '2.5.0', 'term_link' );
 	} elseif ( 'category' === $taxonomy ) {
 
 		/**
@@ -4261,7 +4261,7 @@ function get_term_link( $term, $taxonomy = '' ) {
 		 * @param string $termlink Category link URL.
 		 * @param int    $term_id  Term ID.
 		 */
-		$termlink = apply_filters( 'category_link', $termlink, $term->term_id );
+		$termlink = apply_filters_deprecated( 'category_link', array( $termlink, $term->term_id ), '2.5.0', 'term_link' );
 	}
 
 	/**
diff --git a/src/wp-includes/user.php b/src/wp-includes/user.php
index 505048e57a..6c3a5fe85d 100644
--- a/src/wp-includes/user.php
+++ b/src/wp-includes/user.php
@@ -2272,7 +2272,7 @@ function get_password_reset_key( $user ) {
 	 *
 	 * @param string $user_login The user login name.
 	 */
-	do_action( 'retreive_password', $user->user_login );
+	do_action_deprecated( 'retreive_password', array( $user->user_login ), '1.5.1', 'retrieve_password' );
 
 	/**
 	 * Fires before a new password is retrieved.
diff --git a/src/wp-signup.php b/src/wp-signup.php
index 8457c7059e..fc38eac6c9 100644
--- a/src/wp-signup.php
+++ b/src/wp-signup.php
@@ -457,7 +457,7 @@ function validate_another_blog_signup() {
 	 *
 	 * @param array $blog_meta_defaults An array of default blog meta variables.
 	 */
-	$meta_defaults = apply_filters( 'signup_create_blog_meta', $blog_meta_defaults );
+	$meta_defaults = apply_filters_deprecated( 'signup_create_blog_meta', array( $blog_meta_defaults ), '3.0.0', 'add_signup_meta' );
 
 	/**
 	 * Filters the new default site meta variables.
-- 
2.23.0.windows.1

