WordPress.org

Make WordPress Core

Ticket #50225: 50225.2.diff

File 50225.2.diff, 9.6 KB (added by audrasjb, 7 months ago)

DocBlock changes

  • src/wp-admin/includes/class-wp-terms-list-table.php

    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 5dd29d5ce1..e26ea4b5d3 100644
    a b class WP_Terms_List_Table extends WP_List_Table { 
    404404
    405405                $uri = wp_doing_ajax() ? wp_get_referer() : $_SERVER['REQUEST_URI'];
    406406
    407                 $edit_link = get_edit_term_link( $tag->term_id, $taxonomy, $this->screen->post_type );
     407                $edit_link = get_edit_term_link( $tag, $taxonomy, $this->screen->post_type );
    408408
    409409                if ( $edit_link ) {
    410410                        $edit_link = add_query_arg(
    class WP_Terms_List_Table extends WP_List_Table { 
    470470                $edit_link = add_query_arg(
    471471                        'wp_http_referer',
    472472                        urlencode( wp_unslash( $uri ) ),
    473                         get_edit_term_link( $tag->term_id, $taxonomy, $this->screen->post_type )
     473                        get_edit_term_link( $tag, $taxonomy, $this->screen->post_type )
    474474                );
    475475
    476476                $actions = array();
  • src/wp-includes/category-template.php

    diff --git a/src/wp-includes/category-template.php b/src/wp-includes/category-template.php
    index 5af7173a9d..a46d710676 100644
    a b function wp_tag_cloud( $args = '' ) { 
    737737
    738738        foreach ( $tags as $key => $tag ) {
    739739                if ( 'edit' === $args['link'] ) {
    740                         $link = get_edit_term_link( $tag->term_id, $tag->taxonomy, $args['post_type'] );
     740                        $link = get_edit_term_link( $tag, $tag->taxonomy, $args['post_type'] );
    741741                } else {
    742                         $link = get_term_link( (int) $tag->term_id, $tag->taxonomy );
     742                        $link = get_term_link( $tag, $tag->taxonomy );
    743743                }
    744744
    745745                if ( is_wp_error( $link ) ) {
  • src/wp-includes/class-walker-category.php

    diff --git a/src/wp-includes/class-walker-category.php b/src/wp-includes/class-walker-category.php
    index 94ebc58db2..a8c9bbb80e 100644
    a b class Walker_Category extends Walker { 
    158158                                $link .= '(';
    159159                        }
    160160
    161                         $link .= '<a href="' . esc_url( get_term_feed_link( $category->term_id, $category->taxonomy, $args['feed_type'] ) ) . '"';
     161                        $link .= '<a href="' . esc_url( get_term_feed_link( $category, $category->taxonomy, $args['feed_type'] ) ) . '"';
    162162
    163163                        if ( empty( $args['feed'] ) ) {
    164164                                /* translators: %s: Category name. */
  • src/wp-includes/link-template.php

    diff --git a/src/wp-includes/link-template.php b/src/wp-includes/link-template.php
    index 9554de3d2f..b0a43239cb 100644
    a b function get_feed_link( $feed = '' ) { 
    690690
    691691        $permalink = $wp_rewrite->get_feed_permastruct();
    692692
    693         if ( $permalink ) {
     693        if ( '' !== $permalink ) {
    694694                if ( false !== strpos( $feed, 'comments_' ) ) {
    695695                        $feed      = str_replace( 'comments_', '', $feed );
    696696                        $permalink = $wp_rewrite->get_comment_feed_permastruct();
    function get_author_feed_link( $author_id, $feed = '' ) { 
    898898 *
    899899 * @since 2.5.0
    900900 *
    901  * @param int    $cat_id Category ID.
    902  * @param string $feed  Optional. Feed type. Possible values include 'rss2', 'atom'.
    903  *                       Default is the value of get_default_feed().
     901 * @param int|WP_Term|object $cat  The ID or term object whose feed link will be retrieved.
     902 * @param string             $feed Optional. Feed type. Possible values include 'rss2', 'atom'.
     903 *                                 Default is the value of get_default_feed().
    904904 * @return string Link to the feed for the category specified by $cat_id.
    905905 */
    906 function get_category_feed_link( $cat_id, $feed = '' ) {
    907         return get_term_feed_link( $cat_id, 'category', $feed );
     906function get_category_feed_link( $cat, $feed = '' ) {
     907        return get_term_feed_link( $cat, 'category', $feed );
    908908}
    909909
    910910/**
    function get_category_feed_link( $cat_id, $feed = '' ) { 
    915915 *
    916916 * @since 3.0.0
    917917 *
    918  * @param int    $term_id  Term ID.
    919  * @param string $taxonomy Optional. Taxonomy of `$term_id`. Default 'category'.
    920  * @param string $feed     Optional. Feed type. Possible values include 'rss2', 'atom'.
    921  *                         Default is the value of get_default_feed().
     918 * @param int|WP_Term|object $term     The ID or term object whose feed link will be retrieved.
     919 * @param string             $taxonomy Optional. Taxonomy of `$term_id`.
     920 *                                     Defaults to 'category' if term ID or non WP_Term object is passed.
     921 * @param string             $feed     Optional. Feed type. Possible values include 'rss2', 'atom'.
     922 *                                     Default is the value of get_default_feed().
    922923 * @return string|false Link to the feed for the term specified by $term_id and $taxonomy.
    923924 */
    924 function get_term_feed_link( $term_id, $taxonomy = 'category', $feed = '' ) {
    925         $term_id = (int) $term_id;
     925function get_term_feed_link( $term, $taxonomy = '', $feed = '' ) {
     926        if ( ! is_object( $term ) ) {
     927                $term     = (int) $term;
     928                $taxonomy = 'category';
     929        } elseif ( ! $term instanceof WP_Term ) {
     930                $taxonomy = $term->taxonomy;
     931        }
    926932
    927         $term = get_term( $term_id, $taxonomy );
     933        $term = get_term( $term, $taxonomy );
    928934
    929935        if ( empty( $term ) || is_wp_error( $term ) ) {
    930936                return false;
    function get_term_feed_link( $term_id, $taxonomy = 'category', $feed = '' ) { 
    938944
    939945        if ( ! $permalink_structure ) {
    940946                if ( 'category' === $taxonomy ) {
    941                         $link = home_url( "?feed=$feed&amp;cat=$term_id" );
     947                        $link = home_url( "?feed=$feed&amp;cat=$term->term_id" );
    942948                } elseif ( 'post_tag' === $taxonomy ) {
    943949                        $link = home_url( "?feed=$feed&amp;tag=$term->slug" );
    944950                } else {
    function get_term_feed_link( $term_id, $taxonomy = 'category', $feed = '' ) { 
    946952                        $link = home_url( "?feed=$feed&amp;$t->query_var=$term->slug" );
    947953                }
    948954        } else {
    949                 $link = get_term_link( $term_id, $term->taxonomy );
     955                $link = get_term_link( $term, $term->taxonomy );
    950956                if ( get_default_feed() == $feed ) {
    951957                        $feed_link = 'feed';
    952958                } else {
    function get_term_feed_link( $term_id, $taxonomy = 'category', $feed = '' ) { 
    9971003 *
    9981004 * @since 2.3.0
    9991005 *
    1000  * @param int    $tag_id Tag ID.
    1001  * @param string $feed  Optional. Feed type. Possible values include 'rss2', 'atom'.
    1002  *                       Default is the value of get_default_feed().
    1003  * @return string The feed permalink for the given tag.
     1006 * @param int|WP_Term|object $tag  The ID or term object whose feed link will be retrieved.
     1007 * @param string             $feed Optional. Feed type. Possible values include 'rss2', 'atom'.
     1008 *                                 Default is the value of get_default_feed().
     1009 * @return string                  The feed permalink for the given tag.
    10041010 */
    1005 function get_tag_feed_link( $tag_id, $feed = '' ) {
    1006         return get_term_feed_link( $tag_id, 'post_tag', $feed );
     1011function get_tag_feed_link( $tag, $feed = '' ) {
     1012        return get_term_feed_link( $tag, 'post_tag', $feed );
    10071013}
    10081014
    10091015/**
    function get_tag_feed_link( $tag_id, $feed = '' ) { 
    10111017 *
    10121018 * @since 2.7.0
    10131019 *
    1014  * @param int    $tag_id   Tag ID.
    1015  * @param string $taxonomy Optional. Taxonomy slug. Default 'post_tag'.
     1020 * @param int|WP_Term|object $tag      The ID or term object whose edit link will be retrieved.
     1021 * @param string             $taxonomy Optional. Taxonomy slug. Default 'post_tag'.
    10161022 * @return string The edit tag link URL for the given tag.
    10171023 */
    1018 function get_edit_tag_link( $tag_id, $taxonomy = 'post_tag' ) {
     1024function get_edit_tag_link( $tag, $taxonomy = 'post_tag' ) {
    10191025        /**
    10201026         * Filters the edit link for a tag (or term in another taxonomy).
    10211027         *
    function get_edit_tag_link( $tag_id, $taxonomy = 'post_tag' ) { 
    10231029         *
    10241030         * @param string $link The term edit link.
    10251031         */
    1026         return apply_filters( 'get_edit_tag_link', get_edit_term_link( $tag_id, $taxonomy ) );
     1032        return apply_filters( 'get_edit_tag_link', get_edit_term_link( $tag, $taxonomy ) );
    10271033}
    10281034
    10291035/**
    function edit_tag_link( $link = '', $before = '', $after = '', $tag = null ) { 
    10561062 * @since 3.1.0
    10571063 * @since 4.5.0 The `$taxonomy` parameter was made optional.
    10581064 *
    1059  * @param int    $term_id     Term ID.
    1060  * @param string $taxonomy    Optional. Taxonomy. Defaults to the taxonomy of the term identified
    1061  *                            by `$term_id`.
    1062  * @param string $object_type Optional. The object type. Used to highlight the proper post type
    1063  *                            menu on the linked page. Defaults to the first object_type associated
    1064  *                            with the taxonomy.
     1065 * @param int|WP_Term|object $term        The ID or term object whose edit link will be retrieved.
     1066 * @param string             $taxonomy    Optional. Taxonomy. Defaults to the taxonomy of the term identified
     1067 *                                        by `$term`.
     1068 * @param string             $object_type Optional. The object type. Used to highlight the proper post type
     1069 *                                        menu on the linked page. Defaults to the first object_type associated
     1070 *                                        with the taxonomy.
    10651071 * @return string|null The edit term link URL for the given term, or null on failure.
    10661072 */
    1067 function get_edit_term_link( $term_id, $taxonomy = '', $object_type = '' ) {
    1068         $term = get_term( $term_id, $taxonomy );
     1073function get_edit_term_link( $term, $taxonomy = '', $object_type = '' ) {
     1074        $term = get_term( $term, $taxonomy );
    10691075        if ( ! $term || is_wp_error( $term ) ) {
    10701076                return;
    10711077        }
    function get_edit_term_link( $term_id, $taxonomy = '', $object_type = '' ) { 
    11021108         * @param string $taxonomy    Taxonomy name.
    11031109         * @param string $object_type The object type (eg. the post type).
    11041110         */
    1105         return apply_filters( 'get_edit_term_link', $location, $term_id, $taxonomy, $object_type );
     1111        return apply_filters( 'get_edit_term_link', $location, $term, $taxonomy, $object_type );
    11061112}
    11071113
    11081114/**