Make WordPress Core

Ticket #10177: 10177.2.diff

File 10177.2.diff, 1.9 KB (added by wonderboymusic, 11 years ago)
  • src/wp-includes/comment-template.php

     
    713713 * @param string $deprecated Not used.
    714714 */
    715715function comments_number( $zero = false, $one = false, $more = false, $deprecated = '' ) {
    716         if ( !empty( $deprecated ) )
     716        if ( ! empty( $deprecated ) ) {
    717717                _deprecated_argument( __FUNCTION__, '1.3' );
     718        }
     719        echo get_comments_number_text( $zero, $one, $more );
     720}
    718721
     722/**
     723 * Display the language string for the number of comments the current post has.
     724 *
     725 * @since 4.0.0
     726 *
     727 * @param string $zero Optional. Text for no comments. Default false.
     728 * @param string $one  Optional. Text for one comment. Default false.
     729 * @param string $more Optional. Text for more than one comment. Default false.
     730 */
     731function get_comments_number_text( $zero = false, $one = false, $more = false ) {
    719732        $number = get_comments_number();
    720733
    721         if ( $number > 1 )
    722                 $output = str_replace('%', number_format_i18n($number), ( false === $more ) ? __('% Comments') : $more);
    723         elseif ( $number == 0 )
    724                 $output = ( false === $zero ) ? __('No Comments') : $zero;
    725         else // must be one
    726                 $output = ( false === $one ) ? __('1 Comment') : $one;
    727 
     734        if ( $number > 1 ) {
     735                $output = str_replace( '%', number_format_i18n( $number ), ( false === $more ) ? __( '% Comments' ) : $more );
     736        } elseif ( $number == 0 ) {
     737                $output = ( false === $zero ) ? __( 'No Comments' ) : $zero;
     738        } else { // must be one
     739                $output = ( false === $one ) ? __( '1 Comment' ) : $one;
     740        }
    728741        /**
    729742         * Filter the comments count for display.
    730743         *
     
    736749         *                       is equal to 0, 1, or 1+.
    737750         * @param int    $number The number of post comments.
    738751         */
    739         echo apply_filters( 'comments_number', $output, $number );
     752        return apply_filters( 'comments_number', $output, $number );
    740753}
    741754
    742755/**