WordPress.org

Make WordPress Core

Ticket #14856: comment_text args param.diff

File comment_text args param.diff, 2.1 KB (added by simonwheatley, 4 years ago)

Now with less error_log calls

  • wp-includes/comment-template.php

     
    593593 * @uses $comment 
    594594 * 
    595595 * @param int $comment_ID The ID of the comment for which to get the text. Optional. 
     596 * @param array $args Formatting options passed into, for example, wp_list_comments. Optional. 
    596597 * @return string The comment content 
    597598 */ 
    598 function get_comment_text( $comment_ID = 0 ) { 
     599function get_comment_text( $comment_ID = 0, $args = null ) { 
    599600        $comment = get_comment( $comment_ID ); 
    600         return apply_filters('get_comment_text', $comment->comment_content); 
     601        return apply_filters('get_comment_text', $comment->comment_content, $comment->comment_ID, $args); 
    601602} 
    602603 
    603604/** 
     
    609610 * 
    610611 * @param int $comment_ID The ID of the comment for which to print the text. Optional. 
    611612 */ 
    612 function comment_text( $comment_ID = 0 ) { 
    613         echo apply_filters('comment_text', get_comment_text() ); 
     613function comment_text( $comment_ID = 0, $args = null ) { 
     614        if ( ! $comment_ID ) 
     615                $comment_ID = get_comment_ID(); 
     616        echo apply_filters('comment_text', get_comment_text( $comment_ID, $args ), $comment_ID, $args ); 
    614617} 
    615618 
    616619/** 
     
    13221325         * @param string $output Passed by reference. Used to append additional content. 
    13231326         * @param object $comment Comment data object. 
    13241327         * @param int $depth Depth of comment in reference to parents. 
     1328         * @param array $args Formatting options 
    13251329         * @param array $args 
    13261330         */ 
    13271331        function start_el(&$output, $comment, $depth, $args) { 
     
    13641368                        ?> 
    13651369                </div> 
    13661370 
    1367                 <?php comment_text() ?> 
     1371                <?php comment_text( null, array_merge( $args, array('add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth'])) ) ?> 
    13681372 
    13691373                <div class="reply"> 
    1370                 <?php comment_reply_link(array_merge( $args, array('add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth']))) ?> 
     1374                        <?php comment_reply_link(array_merge( $args, array('add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth']))) ?> 
    13711375                </div> 
    13721376                <?php if ( 'div' != $args['style'] ) : ?> 
    13731377                </div>