Make WordPress Core


Ignore:
Timestamp:
03/03/2014 04:20:12 PM (10 years ago)
Author:
markjaquith
Message:

Eliminate some of our last remaining create_function() instances

  • Moved some into private function callbacks
  • Eliminated some that weren't necessary anymore

props obenland, markjaquith, nacin. fixes #14424

File:
1 edited

Legend:

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

    r27329 r27373  
    623623
    624624    if ( !isset( $args['topic_count_text_callback'] ) && isset( $args['single_text'] ) && isset( $args['multiple_text'] ) ) {
    625         $body = 'return sprintf (
    626             _n(' . var_export($args['single_text'], true) . ', ' . var_export($args['multiple_text'], true) . ', $count),
    627             number_format_i18n( $count ));';
    628         $args['topic_count_text_callback'] = create_function('$count', $body);
     625        $args['topic_count_text_callback'] = '_plugin_topic_count';
    629626    }
    630627
     
    724721function _wp_object_count_sort_cb( $a, $b ) {
    725722    return ( $a->count > $b->count );
     723}
     724
     725/**
     726 * Default text for tooltip for tag links
     727 *
     728 * @since 3.9.0
     729 * @access private
     730 *
     731 * @param integer $count Number of posts with that tag.
     732 * @param object  $tag   Tag object.
     733 * @param array   $args  Arguments for the tag cloud.
     734 * @return string Text for the tooltip of a tag link.
     735 */
     736function _plugin_topic_count( $count, $tag, $args ) {
     737    return sprintf( 1 == $count? $args['single_text'] : $args['multiple_text'], number_format_i18n( $count ) );
    726738}
    727739
Note: See TracChangeset for help on using the changeset viewer.