WordPress.org

Make WordPress Core

Ticket #7956: 7956.patch

File 7956.patch, 3.7 KB (added by Viper007Bond, 5 years ago)

Not finished, see comments

  • wp-includes/canonical.php

     
    249249        if ( $compare_original !== $compare_redirect ) { 
    250250                $redirect_url = $redirect['scheme'] . '://' . $redirect['host']; 
    251251                if ( !empty($redirect['port']) ) 
    252                         $redirect_url .= ':' . $redirect['port']; 
     252                        $redirect_url .= ':' . $redirect['port']; 
    253253                $redirect_url .= $redirect['path']; 
    254254                if ( !empty($redirect['query']) ) 
    255255                        $redirect_url .= '?' . $redirect['query']; 
    256256        } 
    257257 
    258258        if ( !$redirect_url || $redirect_url == $requested_url ) 
    259                 return false; 
     259                return false; 
    260260 
    261261        // Note that you can use the "redirect_canonical" filter to cancel a canonical redirect for whatever reason by returning FALSE 
    262262        $redirect_url = apply_filters('redirect_canonical', $redirect_url, $requested_url); 
    263263 
    264264        if ( !$redirect_url || $redirect_url == $requested_url ) // yes, again -- in case the filter aborted the request 
    265                 return false; 
     265                return false; 
    266266 
    267267        if ( $do_redirect ) { 
    268268                // protect against chained redirects 
  • wp-includes/comment-template.php

     
    412412 */ 
    413413function get_comment_link($comment = null) { 
    414414        $comment = get_comment($comment); 
    415         return get_permalink( $comment->comment_post_ID ) . '#comment-' . $comment->comment_ID; 
     415        return add_query_arg( 'gotocom', $comment->comment_ID, get_permalink( $comment->comment_post_ID ) ); 
    416416} 
    417417 
    418418/** 
     
    10851085                <br /> 
    10861086<?php endif; ?> 
    10871087 
    1088                 <div class="comment-meta commentmetadata"><a href="#comment-<?php comment_ID() ?>" title=""><?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> 
     1088                <div class="comment-meta commentmetadata"><a rel="nofollow" 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> 
    10891089 
    10901090                <?php echo apply_filters('comment_text', get_comment_text()) ?> 
    10911091 
  • wp-includes/comment.php

     
    520520} 
    521521 
    522522/** 
     523 * Calculate what page number a comment will appear on for comment paging. 
     524 * 
     525 * @since 2.7.0 
     526 * 
     527 * @param int $comment_ID Comment ID. 
     528 * @param int $per_page Optional comments per page. 
     529 * @return int|null Comment page number or null on error. 
     530 */ 
     531function get_page_of_comment( $comment_ID, $per_page = null ) { 
     532        if ( !$comment = get_comment( $comment_ID ) ) 
     533                return; 
     534 
     535        if ( !get_option('page_comments') ) 
     536                return 1; 
     537 
     538        $comments = array_reverse( get_comments( $comment->comment_post_ID ) ); 
     539 
     540        if ( null === $per_page ) 
     541                $per_page = get_option('comments_per_page'); 
     542 
     543        // Find this comment's top level parent 
     544        while ( 0 != $comment->comment_parent ) 
     545                $comment = get_comment( $comment->comment_parent ); 
     546 
     547        // Start going through the comments until we find what page number the above top level comment is on 
     548        $page = 1; 
     549        $comthispage = 0; 
     550        foreach ( $comments as $com ) { 
     551                if ( 0 != $com->comment_parent ) 
     552                        continue; 
     553 
     554                if ( $com->comment_ID == $comment->comment_ID ) 
     555                        return $page; 
     556 
     557                $comthispage++; 
     558 
     559                if ( $comthispage >= $per_page ) { 
     560                        $page++; 
     561                        $comthispage = 0; 
     562                } 
     563        } 
     564} 
     565 
     566/** 
    523567 * Does comment contain blacklisted characters or words. 
    524568 * 
    525569 * @since 1.5.0