Make WordPress Core

Changeset 31459


Ignore:
Timestamp:
02/14/2015 03:47:02 AM (9 years ago)
Author:
SergeyBiryukov
Message:

Replace hardcoded usage of comment-page with the comment pagination base.

props johnbillion, SergeyBiryukov, webord.
fixes #18084.

Location:
trunk/src/wp-includes
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/canonical.php

    r31168 r31459  
    255255        // paging and feeds
    256256        if ( get_query_var('paged') || is_feed() || get_query_var('cpage') ) {
    257             while ( preg_match( "#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?$#", $redirect['path'] ) || preg_match( '#/(comments/?)?(feed|rss|rdf|atom|rss2)(/+)?$#', $redirect['path'] ) || preg_match( '#/comment-page-[0-9]+(/+)?$#', $redirect['path'] ) ) {
     257            while ( preg_match( "#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?$#", $redirect['path'] ) || preg_match( '#/(comments/?)?(feed|rss|rdf|atom|rss2)(/+)?$#', $redirect['path'] ) || preg_match( "#/{$wp_rewrite->comments_pagination_base}-[0-9]+(/+)?$#", $redirect['path'] ) ) {
    258258                // Strip off paging and feed
    259259                $redirect['path'] = preg_replace("#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?$#", '/', $redirect['path']); // strip off any existing paging
    260260                $redirect['path'] = preg_replace('#/(comments/?)?(feed|rss2?|rdf|atom)(/+|$)#', '/', $redirect['path']); // strip off feed endings
    261                 $redirect['path'] = preg_replace('#/comment-page-[0-9]+?(/+)?$#', '/', $redirect['path']); // strip off any existing comment paging
     261                $redirect['path'] = preg_replace("#/{$wp_rewrite->comments_pagination_base}-[0-9]+?(/+)?$#", '/', $redirect['path']); // strip off any existing comment paging
    262262            }
    263263
     
    303303
    304304            if ( get_option('page_comments') && ( ( 'newest' == get_option('default_comments_page') && get_query_var('cpage') > 0 ) || ( 'newest' != get_option('default_comments_page') && get_query_var('cpage') > 1 ) ) ) {
    305                 $addl_path = ( !empty( $addl_path ) ? trailingslashit($addl_path) : '' ) . user_trailingslashit( 'comment-page-' . get_query_var('cpage'), 'commentpaged' );
     305                $addl_path = ( !empty( $addl_path ) ? trailingslashit($addl_path) : '' ) . user_trailingslashit( $wp_rewrite->comments_pagination_base . '-' . get_query_var('cpage'), 'commentpaged' );
    306306                $redirect['query'] = remove_query_arg( 'cpage', $redirect['query'] );
    307307            }
  • trunk/src/wp-includes/comment-template.php

    r31412 r31459  
    659659
    660660        if ( $wp_rewrite->using_permalinks() )
    661             $link = user_trailingslashit( trailingslashit( get_permalink( $comment->comment_post_ID ) ) . 'comment-page-' . $args['page'], 'comment' );
     661            $link = user_trailingslashit( trailingslashit( get_permalink( $comment->comment_post_ID ) ) . $wp_rewrite->comments_pagination_base . '-' . $args['page'], 'comment' );
    662662        else
    663663            $link = add_query_arg( 'cpage', $args['page'], get_permalink( $comment->comment_post_ID ) );
  • trunk/src/wp-includes/link-template.php

    r31302 r31459  
    24252425        if ( $pagenum != $max_page ) {
    24262426            if ( $wp_rewrite->using_permalinks() )
    2427                 $result = user_trailingslashit( trailingslashit($result) . 'comment-page-' . $pagenum, 'commentpaged');
     2427                $result = user_trailingslashit( trailingslashit($result) . $wp_rewrite->comments_pagination_base . '-' . $pagenum, 'commentpaged');
    24282428            else
    24292429                $result = add_query_arg( 'cpage', $pagenum, $result );
     
    24312431    } elseif ( $pagenum > 1 ) {
    24322432        if ( $wp_rewrite->using_permalinks() )
    2433             $result = user_trailingslashit( trailingslashit($result) . 'comment-page-' . $pagenum, 'commentpaged');
     2433            $result = user_trailingslashit( trailingslashit($result) . $wp_rewrite->comments_pagination_base . '-' . $pagenum, 'commentpaged');
    24342434        else
    24352435            $result = add_query_arg( 'cpage', $pagenum, $result );
     
    25742574    );
    25752575    if ( $wp_rewrite->using_permalinks() )
    2576         $defaults['base'] = user_trailingslashit(trailingslashit(get_permalink()) . 'comment-page-%#%', 'commentpaged');
     2576        $defaults['base'] = user_trailingslashit(trailingslashit(get_permalink()) . $wp_rewrite->comments_pagination_base . '-%#%', 'commentpaged');
    25772577
    25782578    $args = wp_parse_args( $args, $defaults );
  • trunk/src/wp-includes/rewrite.php

    r31126 r31459  
    505505
    506506    /**
     507     * Comments pagination permalink base.
     508     *
     509     * @since 4.2.0
     510     * @access private
     511     * @var string
     512     */
     513    var $comments_pagination_base = 'comment-page';
     514
     515    /**
    507516     * Feed permalink base.
    508517     *
     
    12571266        $trackbackregex = 'trackback/?$';
    12581267        $pageregex = $this->pagination_base . '/?([0-9]{1,})/?$';
    1259         $commentregex = 'comment-page-([0-9]{1,})/?$';
     1268        $commentregex = $this->comments_pagination_base . '-([0-9]{1,})/?$';
    12601269
    12611270        //build up an array of endpoint regexes to append => queries to append
Note: See TracChangeset for help on using the changeset viewer.