From 71f955dc843952e2a25515ef888050644d607c79 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Wed, 9 Sep 2015 03:00:24 +0000 Subject: [PATCH] In `WP_Comments_List_Table`, favor passing `WP_Comment` instances instead of `$comment_ID` to template functions. This allows us to bypass unnecessary cache lookups and simply pass the object through when it is set. See #33638. Built from https://develop.svn.wordpress.org/trunk@33964 git-svn-id: http://core.svn.wordpress.org/trunk@33933 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- .../includes/class-wp-comments-list-table.php | 26 +++++++++---------- wp-includes/comment-functions.php | 2 +- wp-includes/version.php | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/wp-admin/includes/class-wp-comments-list-table.php b/wp-admin/includes/class-wp-comments-list-table.php index a2120a9e64..e8082bbb16 100644 --- a/wp-admin/includes/class-wp-comments-list-table.php +++ b/wp-admin/includes/class-wp-comments-list-table.php @@ -442,11 +442,11 @@ class WP_Comments_List_Table extends WP_List_Table { public function single_row( $comment ) { global $post; - $the_comment_class = wp_get_comment_status( $comment->comment_ID ); + $the_comment_class = wp_get_comment_status( $comment ); if ( ! $the_comment_class ) { $the_comment_class = ''; } - $the_comment_class = join( ' ', get_comment_class( $the_comment_class, $comment->comment_ID, $comment->comment_post_ID ) ); + $the_comment_class = join( ' ', get_comment_class( $the_comment_class, $comment, $comment->comment_post_ID ) ); $post = get_post( $comment->comment_post_ID ); @@ -479,7 +479,7 @@ class WP_Comments_List_Table extends WP_List_Table { return; } - $the_comment_status = wp_get_comment_status( $comment->comment_ID ); + $the_comment_status = wp_get_comment_status( $comment ); $out = ''; @@ -588,7 +588,7 @@ class WP_Comments_List_Table extends WP_List_Table { * @param object $comment */ public function column_comment( $comment ) { - $comment_url = esc_url( get_comment_link( $comment->comment_ID ) ); + $comment_url = esc_url( get_comment_link( $comment ) ); echo '
'; $this->column_author( $comment ); @@ -598,19 +598,19 @@ class WP_Comments_List_Table extends WP_List_Table { /* translators: 2: comment date, 3: comment time */ printf( __( 'Submitted on %2$s at %3$s' ), $comment_url, /* translators: comment date format. See http://php.net/date */ - get_comment_date( __( 'Y/m/d' ), $comment->comment_ID ), - get_comment_date( get_option( 'time_format' ), $comment->comment_ID ) + get_comment_date( __( 'Y/m/d' ), $comment ), + get_comment_date( get_option( 'time_format' ), $comment ) ); if ( $comment->comment_parent ) { $parent = get_comment( $comment->comment_parent ); - $parent_link = esc_url( get_comment_link( $comment->comment_parent ) ); - $name = get_comment_author( $parent->comment_ID ); + $parent_link = esc_url( get_comment_link( $parent ) ); + $name = get_comment_author( $parent ); printf( ' | '.__( 'In reply to %2$s.' ), $parent_link, $name ); } echo '
'; - comment_text( $comment->comment_ID ); + comment_text( $comment ); if ( $this->user_can ) { ?>