Make WordPress Core

Changeset 28435


Ignore:
Timestamp:
05/15/2014 05:47:21 PM (12 years ago)
Author:
wonderboymusic
Message:

Eliminate use of extract() in wp_generate_tag_cloud().

See #22400.

File:
1 edited

Legend:

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

    r28434 r28435  
    686686
    687687        $args = wp_parse_args( $args, $defaults );
    688         extract( $args, EXTR_SKIP );
    689 
    690         $return = ( 'array' === $format ) ? array() : '';
     688
     689        $return = ( 'array' === $args['format'] ) ? array() : '';
    691690
    692691        if ( empty( $tags ) ) {
    … …  
    730729                unset( $tags_sorted );
    731730        } else {
    732                 if ( 'RAND' === $order ) {
     731                if ( 'RAND' === $args['order'] ) {
    733732                        shuffle( $tags );
    734733                } else {
    735734                        // SQL cannot save you; this is a second (potentially different) sort on a subset of data.
    736                         if ( 'name' === $orderby ) {
     735                        if ( 'name' === $args['orderby'] ) {
    737736                                uasort( $tags, '_wp_object_name_sort_cb' );
    738737                        } else {
    … …  
    740739                        }
    741740
    742                         if ( 'DESC' === $order ) {
     741                        if ( 'DESC' === $args['order'] ) {
    743742                                $tags = array_reverse( $tags, true );
    744743                        }
    … …  
    746745        }
    747746
    748         if ( $number > 0 )
    749                 $tags = array_slice($tags, 0, $number);
     747        if ( $args['number'] > 0 )
     748                $tags = array_slice( $tags, 0, $args['number'] );
    750749
    751750        $counts = array();
    … …  
    753752        foreach ( (array) $tags as $key => $tag ) {
    754753                $real_counts[ $key ] = $tag->count;
    755                 $counts[ $key ] = $topic_count_scale_callback($tag->count);
     754                $counts[ $key ] = call_user_func( $args['topic_count_scale_callback'], $tag->count );
    756755        }
    757756
    … …  
    760759        if ( $spread <= 0 )
    761760                $spread = 1;
    762         $font_spread = $largest - $smallest;
     761        $font_spread = $args['largest'] - $args['smallest'];
    763762        if ( $font_spread < 0 )
    764763                $font_spread = 1;
    … …  
    777776                        $title_attribute = sprintf( translate_nooped_plural( $translate_nooped_plural, $real_count ), number_format_i18n( $real_count ) );
    778777                } else {
    779                         $title_attribute = call_user_func( $topic_count_text_callback, $real_count, $tag, $args );
     778                        $title_attribute = call_user_func( $args['topic_count_text_callback'], $real_count, $tag, $args );
    780779                }
    781780
    782781                $a[] = "<a href='$tag_link' class='tag-link-$tag_id' title='" . esc_attr( $title_attribute ) . "' style='font-size: " .
    783                         str_replace( ',', '.', ( $smallest + ( ( $count - $min_count ) * $font_step ) ) )
    784                         . "$unit;'>$tag_name</a>";
    785         }
    786 
    787         switch ( $format ) :
     782                        str_replace( ',', '.', ( $args['smallest'] + ( ( $count - $min_count ) * $font_step ) ) )
     783                        . $args['unit'] . ";'>$tag_name</a>";
     784        }
     785
     786        switch ( $args['format'] ) :
    788787        case 'array' :
    789788                $return =& $a;
    … …  
    795794                break;
    796795        default :
    797                 $return = join( $separator, $a );
     796                $return = join( $args['separator'], $a );
    798797                break;
    799798        endswitch;
    800799
    801         if ( $filter ) {
     800        if ( $args['filter'] ) {
    802801                /**
    803802                 * Filter the generated output of a tag cloud.
Note: See TracChangeset for help on using the changeset viewer.