Ticket #27631: 27631.2.diff
File 27631.2.diff, 6.4 KB (added by , 10 years ago) |
---|
-
wp-includes/link-template.php
1786 1786 if ( 'newest' == get_option('default_comments_page') ) { 1787 1787 if ( $pagenum != $max_page ) { 1788 1788 if ( $wp_rewrite->using_permalinks() ) 1789 $result = user_trailingslashit( trailingslashit($result) . 'comment-page-' . $pagenum, 'commentpaged');1789 $result = user_trailingslashit( trailingslashit($result) . $wp_rewrite->comments_pagination_base . '/' . $pagenum, 'commentpaged'); 1790 1790 else 1791 1791 $result = add_query_arg( 'cpage', $pagenum, $result ); 1792 1792 } 1793 1793 } elseif ( $pagenum > 1 ) { 1794 1794 if ( $wp_rewrite->using_permalinks() ) 1795 $result = user_trailingslashit( trailingslashit($result) . 'comment-page-' . $pagenum, 'commentpaged');1795 $result = user_trailingslashit( trailingslashit($result) . $wp_rewrite->comments_pagination_base . '/' . $pagenum, 'commentpaged'); 1796 1796 else 1797 1797 $result = add_query_arg( 'cpage', $pagenum, $result ); 1798 1798 } … … 1914 1914 'add_fragment' => '#comments' 1915 1915 ); 1916 1916 if ( $wp_rewrite->using_permalinks() ) 1917 $defaults['base'] = user_trailingslashit(trailingslashit(get_permalink()) . 'comment-page-%#%', 'commentpaged');1917 $defaults['base'] = user_trailingslashit(trailingslashit(get_permalink()) . $wp_rewrite->comments_pagination_base . '/%#%', 'commentpaged'); 1918 1918 1919 1919 $args = wp_parse_args( $args, $defaults ); 1920 1920 $page_links = paginate_links( $args ); -
wp-includes/rewrite.php
509 509 var $pagination_base = 'page'; 510 510 511 511 /** 512 * Comments pagination permalink base. 513 * 514 * @since 3.9.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 ) { … … 1351 1360 $pagematch = $match . $pageregex; 1352 1361 $pagequery = $index . '?' . $query . '&paged=' . $this->preg_index($num_toks + 1); 1353 1362 1354 //create query for /comment-page -xx1363 //create query for /comment-page/xx 1355 1364 $commentmatch = $match . $commentregex; 1356 1365 $commentquery = $index . '?' . $query . '&cpage=' . $this->preg_index($num_toks + 1); 1357 1366 1358 1367 if ( get_option('page_on_front') ) { 1359 //create query for Root /comment-page -xx1368 //create query for Root /comment-page/xx 1360 1369 $rootcommentmatch = $match . $commentregex; 1361 1370 $rootcommentquery = $index . '?' . $query . '&page_id=' . get_option('page_on_front') . '&cpage=' . $this->preg_index($num_toks + 1); 1362 1371 } … … 1382 1391 if ( $paged ) //...and /page/xx ones 1383 1392 $rewrite = array_merge($rewrite, array($pagematch => $pagequery)); 1384 1393 1385 //only on pages with comments add ../comment-page -xx/1394 //only on pages with comments add ../comment-page/xx/ 1386 1395 if ( EP_PAGES & $ep_mask || EP_PERMALINK & $ep_mask ) 1387 1396 $rewrite = array_merge($rewrite, array($commentmatch => $commentquery)); 1388 1397 else if ( EP_ROOT & $ep_mask && get_option('page_on_front') ) -
wp-includes/canonical.php
234 234 235 235 // paging and feeds 236 236 if ( get_query_var('paged') || is_feed() || get_query_var('cpage') ) { 237 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'] ) ) {237 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'] ) ) { 238 238 // Strip off paging and feed 239 239 $redirect['path'] = preg_replace("#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?$#", '/', $redirect['path']); // strip off any existing paging 240 240 $redirect['path'] = preg_replace('#/(comments/?)?(feed|rss2?|rdf|atom)(/+|$)#', '/', $redirect['path']); // strip off feed endings 241 $redirect['path'] = preg_replace('#/ comment-page-[0-9]+?(/+)?$#', '/', $redirect['path']); // strip off any existing comment paging241 $redirect['path'] = preg_replace('#/' . $wp_rewrite->comments_pagination_base . '[-/]?[0-9]+?(/+)?$#', '/', $redirect['path']); // strip off any existing comment paging 242 242 } 243 243 244 244 $addl_path = ''; … … 282 282 } 283 283 284 284 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 ) ) ) { 285 $addl_path = ( !empty( $addl_path ) ? trailingslashit($addl_path) : '' ) . user_trailingslashit( 'comment-page-' . get_query_var('cpage'), 'commentpaged' );285 $addl_path = ( !empty( $addl_path ) ? trailingslashit($addl_path) : '' ) . user_trailingslashit( $wp_rewrite->comments_pagination_base . '/' . get_query_var('cpage'), 'commentpaged' ); 286 286 $redirect['query'] = remove_query_arg( 'cpage', $redirect['query'] ); 287 287 } 288 288 -
wp-includes/comment-template.php
606 606 $args['page'] = ( !empty($in_comment_loop) ) ? get_query_var('cpage') : get_page_of_comment( $comment->comment_ID, $args ); 607 607 608 608 if ( $wp_rewrite->using_permalinks() ) 609 $link = user_trailingslashit( trailingslashit( get_permalink( $comment->comment_post_ID ) ) . 'comment-page-' . $args['page'], 'comment' );609 $link = user_trailingslashit( trailingslashit( get_permalink( $comment->comment_post_ID ) ) . $wp_rewrite->comments_pagination_base . '/' . $args['page'], 'comment' ); 610 610 else 611 611 $link = add_query_arg( 'cpage', $args['page'], get_permalink( $comment->comment_post_ID ) ); 612 612 } else {