Coding Standards: Consistently use do_action_deprecated() and apply_filters_deprecated() for deprecated hooks.

Props jrf.
See #48255.

git-svn-id: https://develop.svn.wordpress.org/trunk@46684 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2019-11-09 12:57:27 +00:00
parent 243d1a2e38
commit ae2ebb8b18
14 changed files with 57 additions and 37 deletions

View File

@@ -796,7 +796,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(), get_current_screen()->remove_help_tab()'
);
$old_help = isset( self::$_old_compat_help[ $this->id ] ) ? self::$_old_compat_help[ $this->id ] : '';
@@ -811,7 +816,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(), 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() ) {
@@ -825,7 +835,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(), get_current_screen()->remove_help_tab()'
);
if ( $default_help ) {
$old_help = '<p>' . $default_help . '</p>';
}

View File

@@ -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.

View File

@@ -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 ) {

View File

@@ -654,7 +654,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.

View File

@@ -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.