Make WordPress Core

Changeset 46684


Ignore:
Timestamp:
11/09/2019 12:57:27 PM (7 years ago)
Author:
SergeyBiryukov
Message:

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

Props jrf.
See #48255.

Location:
trunk/src
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/edit-tag-form.php

    r45674 r46684  
    2222         * @param WP_Term $tag Current category term object.
    2323         */
    24         do_action( 'edit_category_form_pre', $tag );
     24        do_action_deprecated( 'edit_category_form_pre', array( $tag ), '3.0.0', '{$taxonomy}_pre_edit_form' );
    2525} elseif ( 'link_category' == $taxonomy ) {
    2626        /**
     
    3232         * @param WP_Term $tag Current link category term object.
    3333         */
    34         do_action( 'edit_link_category_form_pre', $tag );
     34        do_action_deprecated( 'edit_link_category_form_pre', array( $tag ), '3.0.0', '{$taxonomy}_pre_edit_form' );
    3535} else {
    3636        /**
     
    4242         * @param WP_Term $tag Current tag term object.
    4343         */
    44         do_action( 'edit_tag_form_pre', $tag );
     44        do_action_deprecated( 'edit_tag_form_pre', array( $tag ), '3.0.0', '{$taxonomy}_pre_edit_form' );
    4545}
    4646
     
    202202                         * @param WP_Term $tag Current category term object.
    203203                         */
    204                         do_action( 'edit_category_form_fields', $tag );
     204                        do_action_deprecated( 'edit_category_form_fields', array( $tag ), '3.0.0', '{$taxonomy}_edit_form_fields' );
    205205                } elseif ( 'link_category' == $taxonomy ) {
    206206                        /**
     
    212212                         * @param WP_Term $tag Current link category term object.
    213213                         */
    214                         do_action( 'edit_link_category_form_fields', $tag );
     214                        do_action_deprecated( 'edit_link_category_form_fields', array( $tag ), '3.0.0', '{$taxonomy}_edit_form_fields' );
    215215                } else {
    216216                        /**
     
    222222                         * @param WP_Term $tag Current tag term object.
    223223                         */
    224                         do_action( 'edit_tag_form_fields', $tag );
     224                        do_action_deprecated( 'edit_tag_form_fields', array( $tag ), '3.0.0', '{$taxonomy}_edit_form_fields' );
    225225                }
    226226                /**
     
    242242if ( 'category' == $taxonomy ) {
    243243        /** This action is documented in wp-admin/edit-tags.php */
    244         do_action( 'edit_category_form', $tag );
     244        do_action_deprecated( 'edit_category_form', array( $tag ), '3.0.0', '{$taxonomy}_add_form' );
    245245} elseif ( 'link_category' == $taxonomy ) {
    246246        /** This action is documented in wp-admin/edit-tags.php */
    247         do_action( 'edit_link_category_form', $tag );
     247        do_action_deprecated( 'edit_link_category_form', array( $tag ), '3.0.0', '{$taxonomy}_add_form' );
    248248} else {
    249249        /**
     
    255255         * @param WP_Term $tag Current taxonomy term object.
    256256         */
    257         do_action( 'edit_tag_form', $tag );
     257        do_action_deprecated( 'edit_tag_form', array( $tag ), '3.0.0', '{$taxonomy}_edit_form' );
    258258}
    259259/**
  • trunk/src/wp-admin/edit-tags.php

    r45932 r46684  
    379379                 * @param object $arg Optional arguments cast to an object.
    380380                 */
    381                 do_action( 'add_category_form_pre', (object) array( 'parent' => 0 ) );
     381                do_action_deprecated( 'add_category_form_pre', array( (object) array( 'parent' => 0 ) ), '3.0.0', '{$taxonomy}_pre_add_form' );
    382382        } elseif ( 'link_category' == $taxonomy ) {
    383383                /**
     
    389389                 * @param object $arg Optional arguments cast to an object.
    390390                 */
    391                 do_action( 'add_link_category_form_pre', (object) array( 'parent' => 0 ) );
     391                do_action_deprecated( 'add_link_category_form_pre', array( (object) array( 'parent' => 0 ) ), '3.0.0', '{$taxonomy}_pre_add_form' );
    392392        } else {
    393393                /**
     
    399399                 * @param string $taxonomy The taxonomy slug.
    400400                 */
    401                 do_action( 'add_tag_form_pre', $taxonomy );
     401                do_action_deprecated( 'add_tag_form_pre', array( $taxonomy ), '3.0.0', '{$taxonomy}_pre_add_form' );
    402402        }
    403403
     
    535535                 * @param object $arg Optional arguments cast to an object.
    536536                 */
    537                 do_action( 'edit_category_form', (object) array( 'parent' => 0 ) );
     537                do_action_deprecated( 'edit_category_form', array( (object) array( 'parent' => 0 ) ), '3.0.0', '{$taxonomy}_add_form' );
    538538        } elseif ( 'link_category' == $taxonomy ) {
    539539                /**
     
    545545                 * @param object $arg Optional arguments cast to an object.
    546546                 */
    547                 do_action( 'edit_link_category_form', (object) array( 'parent' => 0 ) );
     547                do_action_deprecated( 'edit_link_category_form', array( (object) array( 'parent' => 0 ) ), '3.0.0', '{$taxonomy}_add_form' );
    548548        } else {
    549549                /**
     
    555555                 * @param string $taxonomy The taxonomy slug.
    556556                 */
    557                 do_action( 'add_tag_form', $taxonomy );
     557                do_action_deprecated( 'add_tag_form', array( $taxonomy ), '3.0.0', '{$taxonomy}_add_form' );
    558558        }
    559559
  • trunk/src/wp-admin/includes/class-wp-screen.php

    r46591 r46684  
    797797                 * @param WP_Screen $this            Current WP_Screen instance.
    798798                 */
    799                 self::$_old_compat_help = apply_filters( 'contextual_help_list', self::$_old_compat_help, $this );
     799                self::$_old_compat_help = apply_filters_deprecated(
     800                        'contextual_help_list',
     801                        array( self::$_old_compat_help, $this ),
     802                        '3.3.0',
     803                        'get_current_screen()->add_help_tab(), get_current_screen()->remove_help_tab()'
     804                );
    800805
    801806                $old_help = isset( self::$_old_compat_help[ $this->id ] ) ? self::$_old_compat_help[ $this->id ] : '';
     
    812817                 * @param WP_Screen $this      Current WP_Screen instance.
    813818                 */
    814                 $old_help = apply_filters( 'contextual_help', $old_help, $this->id, $this );
     819                $old_help = apply_filters_deprecated(
     820                        'contextual_help',
     821                        array( $old_help, $this->id, $this ),
     822                        '3.3.0',
     823                        'get_current_screen()->add_help_tab(), get_current_screen()->remove_help_tab()'
     824                );
    815825
    816826                // Default help only if there is no old-style block of text and no new-style help tabs.
     
    826836                         * @param string $old_help_default Default contextual help text.
    827837                         */
    828                         $default_help = apply_filters( 'default_contextual_help', '' );
     838                        $default_help = apply_filters_deprecated(
     839                                'default_contextual_help',
     840                                array( '' ),
     841                                '3.3.0',
     842                                'get_current_screen()->add_help_tab(), get_current_screen()->remove_help_tab()'
     843                        );
    829844                        if ( $default_help ) {
    830845                                $old_help = '<p>' . $default_help . '</p>';
  • trunk/src/wp-admin/includes/class-wp-terms-list-table.php

    r45932 r46684  
    9898                         * @param int $tags_per_page Number of tags to be displayed. Default 20.
    9999                         */
    100                         $tags_per_page = apply_filters( 'tagsperpage', $tags_per_page );
     100                        $tags_per_page = apply_filters_deprecated( 'tagsperpage', array( $tags_per_page ), '2.8.0', 'edit_tags_per_page' );
    101101                } elseif ( 'category' === $this->screen->taxonomy ) {
    102102                        /**
     
    509509                 * @param WP_Term  $tag     Term object.
    510510                 */
    511                 $actions = apply_filters( 'tag_row_actions', $actions, $tag );
     511                $actions = apply_filters_deprecated( 'tag_row_actions', array( $actions, $tag ), '3.0.0', '{$taxonomy}_row_actions' );
    512512
    513513                /**
  • trunk/src/wp-admin/includes/image-edit.php

    r46359 r46684  
    293293                 * @param int      $attachment_id The attachment post ID.
    294294                 */
    295                 $image = apply_filters( 'image_save_pre', $image, $attachment_id );
     295                $image = apply_filters_deprecated( 'image_save_pre', array( $image, $attachment_id ), '3.5.0', 'image_editor_save_pre' );
    296296
    297297                switch ( $mime_type ) {
     
    354354
    355355                /** This filter is documented in wp-admin/includes/image-edit.php */
    356                 $image = apply_filters( 'image_save_pre', $image, $post_id );
     356                $image = apply_filters_deprecated( 'image_save_pre', array( $image, $post_id ), '3.5.0', 'image_editor_save_pre' );;
    357357
    358358                /**
     
    371371                 * @param int             $post_id   Post ID.
    372372                 */
    373                 $saved = apply_filters( 'wp_save_image_file', null, $filename, $image, $mime_type, $post_id );
     373                $saved = apply_filters_deprecated( 'wp_save_image_file', array( null, $filename, $image, $mime_type, $post_id ), '3.5.0', 'wp_save_image_editor_file' );
    374374
    375375                if ( null !== $saved ) {
     
    571571                 * @param array    $changes Array of change operations.
    572572                 */
    573                 $image = apply_filters( 'image_edit_before_change', $image, $changes );
     573                $image = apply_filters_deprecated( 'image_edit_before_change', array( $image, $changes ), '3.5.0', 'wp_image_editor_before_change' );
    574574        }
    575575
  • trunk/src/wp-admin/includes/media.php

    r46596 r46684  
    655655         * @param string $string Media buttons context. Default empty.
    656656         */
    657         $legacy_filter = apply_filters( 'media_buttons_context', '' );
     657        $legacy_filter = apply_filters_deprecated( 'media_buttons_context', array( '' ), '3.5.0', 'media_buttons' );
    658658
    659659        if ( $legacy_filter ) {
  • trunk/src/wp-admin/includes/meta-boxes.php

    r46085 r46684  
    15091509         * @param WP_Post $post Post object.
    15101510         */
    1511         do_action( 'dbx_post_advanced', $post );
     1511        do_action_deprecated( 'dbx_post_advanced', array( $post ), '3.7.0', 'add_meta_boxes' );
    15121512
    15131513        // Allow the Discussion meta box to show up if the post type supports comments,
  • trunk/src/wp-includes/class-wp-rewrite.php

    r46661 r46684  
    14121412                                 * @param string[] $rules Array of rewrite rules generated for tags, keyed by their regex pattern.
    14131413                                 */
    1414                                 $rules = apply_filters( 'tag_rewrite_rules', $rules );
     1414                                $rules = apply_filters_deprecated( 'tag_rewrite_rules', array( $rules ), '3.1.0', 'post_tag_rewrite_rules' );
    14151415                        }
    14161416
     
    15611561                 * @param string $rules mod_rewrite Rewrite rules formatted for .htaccess.
    15621562                 */
    1563                 return apply_filters( 'rewrite_rules', $rules );
     1563                return apply_filters_deprecated( 'rewrite_rules', array( $rules ), '1.5.0', 'mod_rewrite_rules' );
    15641564        }
    15651565
  • trunk/src/wp-includes/class-wp-xmlrpc-server.php

    r46596 r46684  
    236236                 * option was deprecated in 3.5.0. Use the 'xmlrpc_enabled' hook instead.
    237237                 */
    238                 $enabled = apply_filters( 'pre_option_enable_xmlrpc', false );
     238                $enabled = apply_filters_deprecated( 'pre_option_enable_xmlrpc', array( false ), '3.5.0', 'xmlrpc_enabled' );
    239239                if ( false === $enabled ) {
    240                         $enabled = apply_filters( 'option_enable_xmlrpc', true );
     240                        $enabled = apply_filters_deprecated( 'option_enable_xmlrpc', array( true ), '3.5.0', 'xmlrpc_enabled' );
    241241                }
    242242
  • trunk/src/wp-includes/class-wp.php

    r46474 r46684  
    547547                         * @param string $query_string The query string to modify.
    548548                         */
    549                         $this->query_string = apply_filters( 'query_string', $this->query_string );
     549                        $this->query_string = apply_filters_deprecated(
     550                                'query_string',
     551                                array( $this->query_string ),
     552                                '2.1.0',
     553                                'query_vars, request'
     554                        );
    550555                        parse_str( $this->query_string, $this->query_vars );
    551556                }
  • trunk/src/wp-includes/post.php

    r46660 r46684  
    63336333                 * @param string $cap Capability.
    63346334                 */
    6335                 $cap = apply_filters( 'pub_priv_sql_capability', '' );
     6335                $cap = apply_filters_deprecated( 'pub_priv_sql_capability', array( '' ), '3.2.0' );
    63366336                if ( ! $cap ) {
    63376337                        $cap = current_user_can( $post_type_obj->cap->read_private_posts );
     
    67426742                 * @param int $post_id Post ID.
    67436743                 */
    6744                 do_action( 'private_to_published', $post->ID );
     6744                do_action_deprecated( 'private_to_published', array( $post->ID ), '2.3.0', 'private_to_publish' );
    67456745        }
    67466746
  • trunk/src/wp-includes/taxonomy.php

    r46660 r46684  
    42504250                 * @param int    $term_id  Term ID.
    42514251                 */
    4252                 $termlink = apply_filters( 'tag_link', $termlink, $term->term_id );
     4252                $termlink = apply_filters_deprecated( 'tag_link', array( $termlink, $term->term_id ), '2.5.0', 'term_link' );
    42534253        } elseif ( 'category' === $taxonomy ) {
    42544254
     
    42624262                 * @param int    $term_id  Term ID.
    42634263                 */
    4264                 $termlink = apply_filters( 'category_link', $termlink, $term->term_id );
     4264                $termlink = apply_filters_deprecated( 'category_link', array( $termlink, $term->term_id ), '2.5.0', 'term_link' );
    42654265        }
    42664266
  • trunk/src/wp-includes/user.php

    r46660 r46684  
    22782278         * @param string $user_login The user login name.
    22792279         */
    2280         do_action( 'retreive_password', $user->user_login );
     2280        do_action_deprecated( 'retreive_password', array( $user->user_login ), '1.5.1', 'retrieve_password' );
    22812281
    22822282        /**
  • trunk/src/wp-signup.php

    r45932 r46684  
    458458         * @param array $blog_meta_defaults An array of default blog meta variables.
    459459         */
    460         $meta_defaults = apply_filters( 'signup_create_blog_meta', $blog_meta_defaults );
     460        $meta_defaults = apply_filters_deprecated( 'signup_create_blog_meta', array( $blog_meta_defaults ), '3.0.0', 'add_signup_meta' );
    461461
    462462        /**
Note: See TracChangeset for help on using the changeset viewer.