WordPress.org

Make WordPress Core

Ticket #18084: 18084.2.patch

File 18084.2.patch, 5.3 KB (added by johnbillion, 6 years ago)
  • src/wp-includes/canonical.php

     
    254254
    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
    264264                        $addl_path = '';
     
    302302                        }
    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                        }
    308308
  • src/wp-includes/comment-template.php

     
    650650                        $args['page'] = ( !empty($in_comment_loop) ) ? get_query_var('cpage') : get_page_of_comment( $comment->comment_ID, $args );
    651651
    652652                if ( $wp_rewrite->using_permalinks() )
    653                         $link = user_trailingslashit( trailingslashit( get_permalink( $comment->comment_post_ID ) ) . 'comment-page-' . $args['page'], 'comment' );
     653                        $link = user_trailingslashit( trailingslashit( get_permalink( $comment->comment_post_ID ) ) . $wp_rewrite->comments_pagination_base . '-' . $args['page'], 'comment' );
    654654                else
    655655                        $link = add_query_arg( 'cpage', $args['page'], get_permalink( $comment->comment_post_ID ) );
    656656        } else {
  • src/wp-includes/link-template.php

     
    23972397        if ( 'newest' == get_option('default_comments_page') ) {
    23982398                if ( $pagenum != $max_page ) {
    23992399                        if ( $wp_rewrite->using_permalinks() )
    2400                                 $result = user_trailingslashit( trailingslashit($result) . 'comment-page-' . $pagenum, 'commentpaged');
     2400                                $result = user_trailingslashit( trailingslashit($result) . $wp_rewrite->comments_pagination_base . '-' . $pagenum, 'commentpaged');
    24012401                        else
    24022402                                $result = add_query_arg( 'cpage', $pagenum, $result );
    24032403                }
    24042404        } elseif ( $pagenum > 1 ) {
    24052405                if ( $wp_rewrite->using_permalinks() )
    2406                         $result = user_trailingslashit( trailingslashit($result) . 'comment-page-' . $pagenum, 'commentpaged');
     2406                        $result = user_trailingslashit( trailingslashit($result) . $wp_rewrite->comments_pagination_base . '-' . $pagenum, 'commentpaged');
    24072407                else
    24082408                        $result = add_query_arg( 'cpage', $pagenum, $result );
    24092409        }
     
    25462546                'add_fragment' => '#comments'
    25472547        );
    25482548        if ( $wp_rewrite->using_permalinks() )
    2549                 $defaults['base'] = user_trailingslashit(trailingslashit(get_permalink()) . 'comment-page-%#%', 'commentpaged');
     2549                $defaults['base'] = user_trailingslashit(trailingslashit(get_permalink()) . $wp_rewrite->comments_pagination_base . '-%#%', 'commentpaged');
    25502550
    25512551        $args = wp_parse_args( $args, $defaults );
    25522552        $page_links = paginate_links( $args );
  • src/wp-includes/rewrite.php

     
    509509        var $pagination_base = 'page';
    510510
    511511        /**
     512         * Comments pagination permalink base.
     513         *
     514         * @since 4.1.0
     515         * @access private
     516         * @var string
     517         */
     518        var $comments_pagination_base = 'comment-page';
     519
     520        /**
    512521         * Feed permalink base.
    513522         *
    514523         * @since 1.5.0
     
    12641273                //build a regex to match the trackback and page/xx parts of URLs
    12651274                $trackbackregex = 'trackback/?$';
    12661275                $pageregex = $this->pagination_base . '/?([0-9]{1,})/?$';
    1267                 $commentregex = 'comment-page-([0-9]{1,})/?$';
     1276                $commentregex = $this->comments_pagination_base . '-([0-9]{1,})/?$';
    12681277
    12691278                //build up an array of endpoint regexes to append => queries to append
    12701279                if ( $endpoints ) {