Ticket #18084: 18084.2.patch
File 18084.2.patch, 5.3 KB (added by , 10 years ago) |
---|
-
src/wp-includes/canonical.php
254 254 255 255 // paging and feeds 256 256 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'] ) ) { 258 258 // Strip off paging and feed 259 259 $redirect['path'] = preg_replace("#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?$#", '/', $redirect['path']); // strip off any existing paging 260 260 $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 paging261 $redirect['path'] = preg_replace("#/{$wp_rewrite->comments_pagination_base}-[0-9]+?(/+)?$#", '/', $redirect['path']); // strip off any existing comment paging 262 262 } 263 263 264 264 $addl_path = ''; … … 302 302 } 303 303 304 304 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' ); 306 306 $redirect['query'] = remove_query_arg( 'cpage', $redirect['query'] ); 307 307 } 308 308 -
src/wp-includes/comment-template.php
650 650 $args['page'] = ( !empty($in_comment_loop) ) ? get_query_var('cpage') : get_page_of_comment( $comment->comment_ID, $args ); 651 651 652 652 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' ); 654 654 else 655 655 $link = add_query_arg( 'cpage', $args['page'], get_permalink( $comment->comment_post_ID ) ); 656 656 } else { -
src/wp-includes/link-template.php
2397 2397 if ( 'newest' == get_option('default_comments_page') ) { 2398 2398 if ( $pagenum != $max_page ) { 2399 2399 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'); 2401 2401 else 2402 2402 $result = add_query_arg( 'cpage', $pagenum, $result ); 2403 2403 } 2404 2404 } elseif ( $pagenum > 1 ) { 2405 2405 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'); 2407 2407 else 2408 2408 $result = add_query_arg( 'cpage', $pagenum, $result ); 2409 2409 } … … 2546 2546 'add_fragment' => '#comments' 2547 2547 ); 2548 2548 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'); 2550 2550 2551 2551 $args = wp_parse_args( $args, $defaults ); 2552 2552 $page_links = paginate_links( $args ); -
src/wp-includes/rewrite.php
509 509 var $pagination_base = 'page'; 510 510 511 511 /** 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 /** 512 521 * Feed permalink base. 513 522 * 514 523 * @since 1.5.0 … … 1264 1273 //build a regex to match the trackback and page/xx parts of URLs 1265 1274 $trackbackregex = 'trackback/?$'; 1266 1275 $pageregex = $this->pagination_base . '/?([0-9]{1,})/?$'; 1267 $commentregex = 'comment-page-([0-9]{1,})/?$';1276 $commentregex = $this->comments_pagination_base . '-([0-9]{1,})/?$'; 1268 1277 1269 1278 //build up an array of endpoint regexes to append => queries to append 1270 1279 if ( $endpoints ) {