Make WordPress Core


Ignore:
Timestamp:
11/05/2008 07:09:20 AM (16 years ago)
Author:
markjaquith
Message:

Massive get_comment_link() performance improvements for posts with a lot of comments. props Viper007Bond. fixes #7956

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/comment-template.php

    r9436 r9522  
    436436 *
    437437 * @param object|string|int $comment Comment to retrieve.
     438 * @param string|int $page The comment's page if known. Optional. Avoids extra database query.
    438439 * @return string The permalink to the current comment
    439440 */
    440 function get_comment_link($comment = null) {
     441function get_comment_link( $comment = null, $page = null ) {
    441442    global $wp_rewrite;
    442443
     
    444445
    445446    if ( get_option('page_comments') ) {
    446         $page = get_page_of_comment( $comment->comment_ID );
     447        $page = ( null !== $page ) ? (int) $page : get_page_of_comment( $comment->comment_ID );
    447448
    448449        if ( $wp_rewrite->using_permalinks() )
     
    11511152<?php endif; ?>
    11521153
    1153         <div class="comment-meta commentmetadata"><a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>"><?php printf(__('%1$s at %2$s'), get_comment_date('F jS, Y'),  get_comment_time()) ?></a><?php edit_comment_link('edit','&nbsp;&nbsp;','') ?></div>
     1154        <div class="comment-meta commentmetadata"><a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID, $page ) ) ?>"><?php printf(__('%1$s at %2$s'), get_comment_date('F jS, Y'),  get_comment_time()) ?></a><?php edit_comment_link('edit','&nbsp;&nbsp;','') ?></div>
    11541155
    11551156        <?php comment_text() ?>
Note: See TracChangeset for help on using the changeset viewer.