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

See #33638.

Built from https://develop.svn.wordpress.org/trunk@34042


git-svn-id: http://core.svn.wordpress.org/trunk@34010 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2015-09-11 06:21:25 +00:00
parent c3f642bea9
commit db4f22bfb5
8 changed files with 12 additions and 12 deletions

View File

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

View File

@ -69,7 +69,7 @@ if ( !defined('ABSPATH') )
<div id="minor-publishing-actions">
<div id="preview-action">
<a class="preview button" href="<?php echo get_comment_link(); ?>" target="_blank"><?php _e('View Comment'); ?></a>
<a class="preview button" href="<?php echo get_comment_link( $comment ); ?>" target="_blank"><?php _e('View Comment'); ?></a>
</div>
<div class="clear"></div>
</div>
@ -120,7 +120,7 @@ if ( current_user_can( 'edit_post', $post_id ) ) {
if ( $comment->comment_parent ) :
$parent = get_comment( $comment->comment_parent );
if ( $parent ) :
$parent_link = esc_url( get_comment_link( $comment->comment_parent ) );
$parent_link = esc_url( get_comment_link( $comment ) );
$name = get_comment_author( $parent );
?>
<div class="misc-pub-section misc-pub-reply-to">

View File

@ -151,7 +151,7 @@ $comment = get_comment( $comment_id );
*/
do_action( 'set_comment_cookies', $comment, $user );
$location = empty($_POST['redirect_to']) ? get_comment_link($comment_id) : $_POST['redirect_to'] . '#comment-' . $comment_id;
$location = empty($_POST['redirect_to']) ? get_comment_link( $comment ) : $_POST['redirect_to'] . '#comment-' . $comment_id;
/**
* Filter the location URI to send the commenter after posting.

View File

@ -229,7 +229,7 @@ class Walker_Comment extends Walker {
?>
<<?php echo $tag; ?> id="comment-<?php comment_ID(); ?>" <?php comment_class( '', $comment ); ?>>
<div class="comment-body">
<?php _e( 'Pingback:' ); ?> <?php comment_author_link(); ?> <?php edit_comment_link( __( 'Edit' ), '<span class="edit-link">', '</span>' ); ?>
<?php _e( 'Pingback:' ); ?> <?php comment_author_link( $comment ); ?> <?php edit_comment_link( __( 'Edit' ), '<span class="edit-link">', '</span>' ); ?>
</div>
<?php
}
@ -268,7 +268,7 @@ class Walker_Comment extends Walker {
<br />
<?php endif; ?>
<div class="comment-meta commentmetadata"><a href="<?php echo esc_url( get_comment_link( $comment->comment_ID, $args ) ); ?>">
<div class="comment-meta commentmetadata"><a href="<?php echo esc_url( get_comment_link( $comment, $args ) ); ?>">
<?php
/* translators: 1: comment date, 2: comment time */
printf( __( '%1$s at %2$s' ), get_comment_date( '', $comment ), get_comment_time() ); ?></a><?php edit_comment_link( __( '(Edit)' ), '&nbsp;&nbsp;', '' );
@ -317,7 +317,7 @@ class Walker_Comment extends Walker {
</div><!-- .comment-author -->
<div class="comment-metadata">
<a href="<?php echo esc_url( get_comment_link( $comment->comment_ID, $args ) ); ?>">
<a href="<?php echo esc_url( get_comment_link( $comment, $args ) ); ?>">
<time datetime="<?php comment_time( 'c' ); ?>">
<?php
/* translators: 1: comment date, 2: comment time */

View File

@ -1285,7 +1285,7 @@ function get_delete_post_link( $id = 0, $deprecated = '', $force_delete = false
*
* @since 2.3.0
*
* @param int $comment_id Optional. Comment ID.
* @param int|WP_Comment $comment_id Optional. Comment ID or WP_Comment object.
* @return string|void The edit comment link URL for the given comment.
*/
function get_edit_comment_link( $comment_id = 0 ) {
@ -1326,7 +1326,7 @@ function edit_comment_link( $text = null, $before = '', $after = '' ) {
$text = __( 'Edit This' );
}
$link = '<a class="comment-edit-link" href="' . get_edit_comment_link( $comment->comment_ID ) . '">' . $text . '</a>';
$link = '<a class="comment-edit-link" href="' . get_edit_comment_link( $comment ) . '">' . $text . '</a>';
/**
* Filter the comment edit link anchor tag.

View File

@ -1472,7 +1472,7 @@ function wp_notify_postauthor( $comment_id, $deprecated = null ) {
break;
}
$notify_message .= get_permalink($comment->comment_post_ID) . "#comments\r\n\r\n";
$notify_message .= sprintf( __('Permalink: %s'), get_comment_link( $comment_id ) ) . "\r\n";
$notify_message .= sprintf( __('Permalink: %s'), get_comment_link( $comment ) ) . "\r\n";
if ( user_can( $post->post_author, 'edit_comment', $comment_id ) ) {
if ( EMPTY_TRASH_DAYS )

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.4-alpha-34041';
$wp_version = '4.4-alpha-34042';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

View File

@ -111,7 +111,7 @@ class WP_Widget_Recent_Comments extends WP_Widget {
/* translators: comments widget: 1: comment author, 2: post link */
$output .= sprintf( _x( '%1$s on %2$s', 'widgets' ),
'<span class="comment-author-link">' . get_comment_author_link( $comment ) . '</span>',
'<a href="' . esc_url( get_comment_link( $comment->comment_ID ) ) . '">' . get_the_title( $comment->comment_post_ID ) . '</a>'
'<a href="' . esc_url( get_comment_link( $comment ) ) . '">' . get_the_title( $comment->comment_post_ID ) . '</a>'
);
$output .= '</li>';
}