After [33961], pass `$comment` to `get_comment_date()` where possible to avoid extra cache/db lookups.

See #33638.


git-svn-id: https://develop.svn.wordpress.org/trunk@34041 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2015-09-11 06:14:04 +00:00
parent 9ab431873c
commit 4a6a7edf55
3 changed files with 5 additions and 5 deletions

View File

@ -195,8 +195,8 @@ if ( $comment->comment_approved != '0' ) { // if not unapproved
printf( __( '<a href="%1$s">%2$s at %3$s</a>' ),
esc_url( get_comment_link( $comment->comment_ID ) ),
/* translators: comment date format. See http://php.net/date */
get_comment_date( __( 'Y/m/d' ) ),
get_comment_date( get_option( 'time_format' ) )
get_comment_date( __( 'Y/m/d' ), $comment ),
get_comment_date( get_option( 'time_format' ), $comment )
);
?>
</td>

View File

@ -271,7 +271,7 @@ class Walker_Comment extends Walker {
<div class="comment-meta commentmetadata"><a href="<?php echo esc_url( get_comment_link( $comment->comment_ID, $args ) ); ?>">
<?php
/* translators: 1: comment date, 2: comment time */
printf( __( '%1$s at %2$s' ), get_comment_date(), get_comment_time() ); ?></a><?php edit_comment_link( __( '(Edit)' ), '&nbsp;&nbsp;', '' );
printf( __( '%1$s at %2$s' ), get_comment_date( '', $comment ), get_comment_time() ); ?></a><?php edit_comment_link( __( '(Edit)' ), '&nbsp;&nbsp;', '' );
?>
</div>
@ -321,7 +321,7 @@ class Walker_Comment extends Walker {
<time datetime="<?php comment_time( 'c' ); ?>">
<?php
/* translators: 1: comment date, 2: comment time */
printf( __( '%1$s at %2$s' ), get_comment_date(), get_comment_time() );
printf( __( '%1$s at %2$s' ), get_comment_date( '', $comment ), get_comment_time() );
?>
</time>
</a>

View File

@ -52,7 +52,7 @@ if ( post_password_required($post) ) { // and it doesn't match the cookie
<?php foreach ($comments as $comment) { ?>
<li id="comment-<?php comment_ID() ?>">
<?php comment_text() ?>
<p><cite><?php comment_type(); ?> <?php printf(__('by %1$s &#8212; %2$s @ <a href="#comment-%3$s">%4$s</a>'), get_comment_author_link( $comment ), get_comment_date(), get_comment_ID(), get_comment_time()); ?></cite></p>
<p><cite><?php comment_type(); ?> <?php printf(__('by %1$s &#8212; %2$s @ <a href="#comment-%3$s">%4$s</a>'), get_comment_author_link( $comment ), get_comment_date( '', $comment ), get_comment_ID(), get_comment_time()); ?></cite></p>
</li>
<?php } // end for each comment ?>