Make WordPress Core

Changeset 32531


Ignore:
Timestamp:
05/21/2015 09:04:32 PM (9 years ago)
Author:
wonderboymusic
Message:

In category-template.php:

  • Clarify/add some return docs.
  • In walk_category_tree() and walk_category_dropdown_tree(), make behavior consistent and don't pass $walker by-reference - it is no longer necessary to do that with object instances.

See #32444.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/category-template.php

    r32484 r32531  
    480480 *
    481481 * @param string|array $args Optional. Override default arguments.
    482  * @return false|null|string HTML content only if 'echo' argument is 0.
     482 * @return false|string HTML content only if 'echo' argument is 0.
    483483 */
    484484function wp_list_categories( $args = '' ) {
     
    630630 *
    631631 * @param array|string|null $args Optional. Override default arguments.
    632  * @return null|false Generated tag cloud, only if no failures and 'array' is set for the 'format' argument.
     632 * @return null|array Generated tag cloud, only if no failures and 'array' is set for the 'format' argument.
     633 *                    Otherwise, this function outputs the tag cloud.
    633634 */
    634635function wp_tag_cloud( $args = '' ) {
     
    651652            $link = get_term_link( intval($tag->term_id), $tag->taxonomy );
    652653        if ( is_wp_error( $link ) )
    653             return false;
     654            return;
    654655
    655656        $tags[ $key ]->link = $link;
     
    678679 * Default topic count scaling for tag links
    679680 *
    680  * @param integer $count number of posts with that tag
    681  * @return integer scaled count
     681 * @param int $count number of posts with that tag
     682 * @return int scaled count
    682683 */
    683684function default_topic_count_scale( $count ) {
     
    869870 * @since 3.1.0
    870871 * @access private
     872 * @return int
    871873 */
    872874function _wp_object_name_sort_cb( $a, $b ) {
     
    879881 * @since 3.1.0
    880882 * @access private
     883 * @return bool
    881884 */
    882885function _wp_object_count_sort_cb( $a, $b ) {
     
    894897 * @since 2.1.0
    895898 * @see Walker_Category::walk() for parameters and return description.
     899 * @return string
    896900 */
    897901function walk_category_tree() {
     
    903907        $walker = $args[2]['walker'];
    904908    }
    905     return call_user_func_array(array( &$walker, 'walk' ), $args );
     909    return call_user_func_array( array( $walker, 'walk' ), $args );
    906910}
    907911
     
    912916 * @since 2.1.0
    913917 * @see Walker_CategoryDropdown::walk() for parameters and return description.
     918 * @return string
    914919 */
    915920function walk_category_dropdown_tree() {
    916921    $args = func_get_args();
    917922    // the user's options are the third parameter
    918     if ( empty($args[2]['walker']) || !is_a($args[2]['walker'], 'Walker') )
     923    if ( empty( $args[2]['walker'] ) || ! ( $args[2]['walker'] instanceof Walker ) ) {
    919924        $walker = new Walker_CategoryDropdown;
    920     else
     925    } else {
    921926        $walker = $args[2]['walker'];
    922 
    923     return call_user_func_array(array( &$walker, 'walk' ), $args );
     927    }
     928    return call_user_func_array( array( $walker, 'walk' ), $args );
    924929}
    925930
     
    12151220 *
    12161221 * @param int $id Post ID.
    1217  * @return array|bool Array of tag objects on success, false on failure.
     1222 * @return array|false|WP_Error Array of tag objects on success, false on failure.
    12181223 */
    12191224function get_the_tags( $id = 0 ) {
     
    12401245 * @param string $after Optional. After tags.
    12411246 * @param int $id Optional. Post ID. Defaults to the current post.
    1242  * @return string|bool|WP_Error A list of tags on success, false if there are no terms, WP_Error on failure.
     1247 * @return string|false|WP_Error A list of tags on success, false if there are no terms, WP_Error on failure.
    12431248 */
    12441249function get_the_tag_list( $before = '', $sep = '', $after = '', $id = 0 ) {
     
    13131318 * @param int|object $post Post ID or object.
    13141319 * @param string $taxonomy Taxonomy name.
    1315  * @return array|bool|WP_Error Array of term objects on success, false if there are no terms
    1316  *                             or the post does not exist, WP_Error on failure.
     1320 * @return array|false|WP_Error Array of term objects on success, false if there are no terms
     1321 *                              or the post does not exist, WP_Error on failure.
    13171322 */
    13181323function get_the_terms( $post, $taxonomy ) {
     
    13531358 * @param string $sep Optional. Separate items using this.
    13541359 * @param string $after Optional. After list.
    1355  * @return string|bool|WP_Error A list of terms on success, false if there are no terms, WP_Error on failure.
     1360 * @return string|false|WP_Error A list of terms on success, false if there are no terms, WP_Error on failure.
    13561361 */
    13571362function get_the_term_list( $id, $taxonomy, $before = '', $sep = '', $after = '' ) {
Note: See TracChangeset for help on using the changeset viewer.