Make WordPress Core

Ticket #10948: 10948.3.diff

File 10948.3.diff, 3.1 KB (added by MikeLittle, 11 years ago)

Updated: Still makes comment walker consistent, but doesn't change any function signatures.

  • wp-includes/comment-template.php

     
    15101510                        case 'div':
    15111511                                break;
    15121512                        case 'ol':
    1513                                 echo '<ol class="children">' . "\n";
     1513                                $output .= '<ol class="children">' . "\n";
    15141514                                break;
    15151515                        default:
    15161516                        case 'ul':
    1517                                 echo '<ul class="children">' . "\n";
     1517                                $output .= '<ul class="children">' . "\n";
    15181518                                break;
    15191519                }
    15201520        }
     
    15371537                        case 'div':
    15381538                                break;
    15391539                        case 'ol':
    1540                                 echo "</ol><!-- .children -->\n";
     1540                                $output .= "</ol><!-- .children -->\n";
    15411541                                break;
    15421542                        default:
    15431543                        case 'ul':
    1544                                 echo "</ul><!-- .children -->\n";
     1544                                $output .= "</ul><!-- .children -->\n";
    15451545                                break;
    15461546                }
    15471547        }
     
    16161616                $GLOBALS['comment'] = $comment;
    16171617
    16181618                if ( !empty( $args['callback'] ) ) {
     1619                        ob_start();
    16191620                        call_user_func( $args['callback'], $comment, $args, $depth );
     1621                        $output .= ob_get_clean();
    16201622                        return;
    16211623                }
    16221624
    16231625                if ( ( 'pingback' == $comment->comment_type || 'trackback' == $comment->comment_type ) && $args['short_ping'] ) {
     1626                        ob_start();
    16241627                        $this->ping( $comment, $depth, $args );
     1628                        $output .= ob_get_clean();
    16251629                } elseif ( 'html5' === $args['format'] ) {
     1630                        ob_start();
    16261631                        $this->html5_comment( $comment, $depth, $args );
     1632                        $output .= ob_get_clean();
    16271633                } else {
     1634                        ob_start();
    16281635                        $this->comment( $comment, $depth, $args );
     1636                        $output .= ob_get_clean();
    16291637                }
    16301638        }
    16311639
     
    16431651         */
    16441652        function end_el( &$output, $comment, $depth = 0, $args = array() ) {
    16451653                if ( !empty( $args['end-callback'] ) ) {
     1654                        ob_start();
    16461655                        call_user_func( $args['end-callback'], $comment, $args, $depth );
     1656                        $output .= ob_get_clean();
    16471657                        return;
    16481658                }
    16491659                if ( 'div' == $args['style'] )
    1650                         echo "</div><!-- #comment-## -->\n";
     1660                        $output .= "</div><!-- #comment-## -->\n";
    16511661                else
    1652                         echo "</li><!-- #comment-## -->\n";
     1662                        $output .= "</li><!-- #comment-## -->\n";
    16531663        }
    16541664
    16551665        /**
     
    17941804 *     @type string 'format'            How to format the comments list.
    17951805 *                                      Default 'html5' if the theme supports it. Accepts 'html5', 'xhtml'.
    17961806 *     @type bool   'short_ping'        Whether to output short pings. Default false.
     1807 *     @type bool   'echo'              Whether to echo the output or return it. Default true.
    17971808 * }
    17981809 * @param array $comments Optional. Array of comment objects. @see WP_Query->comments
    17991810 */
     
    18191830                'reverse_children'  => '',
    18201831                'format'            => current_theme_supports( 'html5', 'comment-list' ) ? 'html5' : 'xhtml',
    18211832                'short_ping'        => false,
     1833                'echo'              => true,
    18221834        );
    18231835
    18241836        $r = wp_parse_args( $args, $defaults );
     
    18871899        if ( empty($walker) )
    18881900                $walker = new Walker_Comment;
    18891901
    1890         $walker->paged_walk($_comments, $max_depth, $page, $per_page, $r);
     1902        $output = $walker->paged_walk($_comments, $max_depth, $page, $per_page, $r);
    18911903        $wp_query->max_num_comment_pages = $walker->max_pages;
    18921904
    18931905        $in_comment_loop = false;
     1906
     1907        if ( $r['echo'] )
     1908                echo $output;
     1909        else
     1910                return $output;
    18941911}
    18951912
    18961913/**