Make WordPress Core

Changeset 34042


Ignore:
Timestamp:
09/11/2015 06:20:56 AM (11 years ago)
Author:
wonderboymusic
Message:

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

See #33638.

Location:
trunk/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/comment.php

    r34041 r34042  
    194194                /* translators: 2: comment date, 3: comment time */
    195195                printf( __( '<a href="%1$s">%2$s at %3$s</a>' ),
    196                         esc_url( get_comment_link( $comment->comment_ID ) ),
     196                        esc_url( get_comment_link( $comment ) ),
    197197                        /* translators: comment date format. See http://php.net/date */
    198198                        get_comment_date( __( 'Y/m/d' ), $comment ),
  • trunk/src/wp-admin/edit-form-comment.php

    r34039 r34042  
    7070<div id="minor-publishing-actions">
    7171<div id="preview-action">
    72 <a class="preview button" href="<?php echo get_comment_link(); ?>" target="_blank"><?php _e('View Comment'); ?></a>
     72<a class="preview button" href="<?php echo get_comment_link( $comment ); ?>" target="_blank"><?php _e('View Comment'); ?></a>
    7373</div>
    7474<div class="clear"></div>
     
    121121        $parent      = get_comment( $comment->comment_parent );
    122122        if ( $parent ) :
    123                 $parent_link = esc_url( get_comment_link( $comment->comment_parent ) );
     123                $parent_link = esc_url( get_comment_link( $comment ) );
    124124                $name        = get_comment_author( $parent );
    125125        ?>
  • trunk/src/wp-comments-post.php

    r33891 r34042  
    152152do_action( 'set_comment_cookies', $comment, $user );
    153153
    154 $location = empty($_POST['redirect_to']) ? get_comment_link($comment_id) : $_POST['redirect_to'] . '#comment-' . $comment_id;
     154$location = empty($_POST['redirect_to']) ? get_comment_link( $comment ) : $_POST['redirect_to'] . '#comment-' . $comment_id;
    155155
    156156/**
  • trunk/src/wp-includes/class-walker-comment.php

    r34041 r34042  
    230230                <<?php echo $tag; ?> id="comment-<?php comment_ID(); ?>" <?php comment_class( '', $comment ); ?>>
    231231                        <div class="comment-body">
    232                                 <?php _e( 'Pingback:' ); ?> <?php comment_author_link(); ?> <?php edit_comment_link( __( 'Edit' ), '<span class="edit-link">', '</span>' ); ?>
     232                                <?php _e( 'Pingback:' ); ?> <?php comment_author_link( $comment ); ?> <?php edit_comment_link( __( 'Edit' ), '<span class="edit-link">', '</span>' ); ?>
    233233                        </div>
    234234<?php
     
    269269                <?php endif; ?>
    270270
    271                 <div class="comment-meta commentmetadata"><a href="<?php echo esc_url( get_comment_link( $comment->comment_ID, $args ) ); ?>">
     271                <div class="comment-meta commentmetadata"><a href="<?php echo esc_url( get_comment_link( $comment, $args ) ); ?>">
    272272                        <?php
    273273                                /* translators: 1: comment date, 2: comment time */
     
    318318
    319319                                        <div class="comment-metadata">
    320                                                 <a href="<?php echo esc_url( get_comment_link( $comment->comment_ID, $args ) ); ?>">
     320                                                <a href="<?php echo esc_url( get_comment_link( $comment, $args ) ); ?>">
    321321                                                        <time datetime="<?php comment_time( 'c' ); ?>">
    322322                                                                <?php
  • trunk/src/wp-includes/link-template.php

    r33968 r34042  
    12861286 * @since 2.3.0
    12871287 *
    1288  * @param int $comment_id Optional. Comment ID.
     1288 * @param int|WP_Comment $comment_id Optional. Comment ID or WP_Comment object.
    12891289 * @return string|void The edit comment link URL for the given comment.
    12901290 */
     
    13271327        }
    13281328
    1329         $link = '<a class="comment-edit-link" href="' . get_edit_comment_link( $comment->comment_ID ) . '">' . $text . '</a>';
     1329        $link = '<a class="comment-edit-link" href="' . get_edit_comment_link( $comment ) . '">' . $text . '</a>';
    13301330
    13311331        /**
  • trunk/src/wp-includes/pluggable.php

    r34038 r34042  
    14731473        }
    14741474        $notify_message .= get_permalink($comment->comment_post_ID) . "#comments\r\n\r\n";
    1475         $notify_message .= sprintf( __('Permalink: %s'), get_comment_link( $comment_id ) ) . "\r\n";
     1475        $notify_message .= sprintf( __('Permalink: %s'), get_comment_link( $comment ) ) . "\r\n";
    14761476
    14771477        if ( user_can( $post->post_author, 'edit_comment', $comment_id ) ) {
  • trunk/src/wp-includes/widgets/class-wp-widget-recent-comments.php

    r34039 r34042  
    112112                                $output .= sprintf( _x( '%1$s on %2$s', 'widgets' ),
    113113                                        '<span class="comment-author-link">' . get_comment_author_link( $comment ) . '</span>',
    114                                         '<a href="' . esc_url( get_comment_link( $comment->comment_ID ) ) . '">' . get_the_title( $comment->comment_post_ID ) . '</a>'
     114                                        '<a href="' . esc_url( get_comment_link( $comment ) ) . '">' . get_the_title( $comment->comment_post_ID ) . '</a>'
    115115                                );
    116116                                $output .= '</li>';
Note: See TracChangeset for help on using the changeset viewer.