Changeset 15582
- Timestamp:
- 09/07/2010 01:18:42 AM (13 years ago)
- Location:
- trunk/wp-includes
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/canonical.php
r15462 r15582 192 192 $redirect_url = $requested_url; 193 193 $paged_redirect = @parse_url($redirect_url); 194 while ( preg_match( '#/page/?[0-9]+?(/+)?$#', $paged_redirect['path'] ) || preg_match( '#/(comments/?)?(feed|rss|rdf|atom|rss2)(/+)?$#', $paged_redirect['path'] ) || preg_match( '#/comment-page-[0-9]+(/+)?$#', $paged_redirect['path'] ) ) {194 while ( preg_match( "#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?$#", $paged_redirect['path'] ) || preg_match( '#/(comments/?)?(feed|rss|rdf|atom|rss2)(/+)?$#', $paged_redirect['path'] ) || preg_match( '#/comment-page-[0-9]+(/+)?$#', $paged_redirect['path'] ) ) { 195 195 // Strip off paging and feed 196 $paged_redirect['path'] = preg_replace( '#/page/?[0-9]+?(/+)?$#', '/', $paged_redirect['path']); // strip off any existing paging196 $paged_redirect['path'] = preg_replace("#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?$#", '/', $paged_redirect['path']); // strip off any existing paging 197 197 $paged_redirect['path'] = preg_replace('#/(comments/?)?(feed|rss2?|rdf|atom)(/+|$)#', '/', $paged_redirect['path']); // strip off feed endings 198 198 $paged_redirect['path'] = preg_replace('#/comment-page-[0-9]+?(/+)?$#', '/', $paged_redirect['path']); // strip off any existing comment paging … … 213 213 if ( !is_feed() ) { 214 214 if ( $paged > 1 && !is_single() ) { 215 $addl_path = ( !empty( $addl_path ) ? trailingslashit($addl_path) : '' ) . user_trailingslashit(" page/$paged", 'paged');215 $addl_path = ( !empty( $addl_path ) ? trailingslashit($addl_path) : '' ) . user_trailingslashit("$wp_rewrite->pagination_base/$paged", 'paged'); 216 216 } elseif ( !is_single() ) { 217 217 $addl_path = !empty( $addl_path ) ? trailingslashit($addl_path) : ''; -
trunk/wp-includes/link-template.php
r15563 r15582 1412 1412 } 1413 1413 1414 $request = preg_replace( '|page/\d+/?$|', '', $request);1414 $request = preg_replace( "|$wp_rewrite->pagination_base/\d+/?$|", '', $request); 1415 1415 $request = preg_replace( '|^index\.php|', '', $request); 1416 1416 $request = ltrim($request, '/'); … … 1422 1422 1423 1423 if ( $pagenum > 1 ) { 1424 $request = ( ( !empty( $request ) ) ? trailingslashit( $request ) : $request ) . user_trailingslashit( 'page/'. $pagenum, 'paged' );1424 $request = ( ( !empty( $request ) ) ? trailingslashit( $request ) : $request ) . user_trailingslashit( $wp_rewrite->pagination_base . "/" . $pagenum, 'paged' ); 1425 1425 } 1426 1426 -
trunk/wp-includes/post-template.php
r15549 r15582 576 576 extract( $r, EXTR_SKIP ); 577 577 578 global $p ost, $page, $numpages, $multipage, $more, $pagenow;578 global $page, $numpages, $multipage, $more, $pagenow; 579 579 580 580 $output = ''; … … 586 586 $output .= ' '; 587 587 if ( ($i != $page) || ((!$more) && ($page==1)) ) { 588 if ( 1 == $i ) { 589 $output .= '<a href="' . get_permalink() . '">'; 590 } else { 591 if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) ) 592 $output .= '<a href="' . add_query_arg('page', $i, get_permalink()) . '">'; 593 elseif ( 'page' == get_option('show_on_front') && get_option('page_on_front') == $post->ID ) 594 $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit('page/' . $i, 'single_paged'). '">'; 595 else 596 $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">'; 597 } 598 588 $output .= _wp_link_page($i); 599 589 } 600 $output .= $link_before; 601 $output .= $j; 602 $output .= $link_after; 590 $output .= $link_before . $j . $link_after; 603 591 if ( ($i != $page) || ((!$more) && ($page==1)) ) 604 592 $output .= '</a>'; … … 610 598 $i = $page - 1; 611 599 if ( $i && $more ) { 612 if ( 1 == $i ) { 613 $output .= '<a href="' . get_permalink() . '">'; 614 } else { 615 if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) ) 616 $output .= '<a href="' . add_query_arg('page', $i, get_permalink()) . '">'; 617 elseif ( 'page' == get_option('show_on_front') && get_option('page_on_front') == $post->ID ) 618 $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit('page/' . $i, 'single_paged'). '">'; 619 else 620 $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">'; 621 } 600 $output .= _wp_link_page($i); 622 601 $output .= $link_before. $previouspagelink . $link_after . '</a>'; 623 602 } 624 603 $i = $page + 1; 625 604 if ( $i <= $numpages && $more ) { 626 if ( 1 == $i ) { 627 $output .= '<a href="' . get_permalink() . '">'; 628 } else { 629 if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) ) 630 $output .= '<a href="' . add_query_arg('page', $i, get_permalink()) . '">'; 631 elseif ( 'page' == get_option('show_on_front') && get_option('page_on_front') == $post->ID ) 632 $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit('page/' . $i, 'single_paged'). '">'; 633 else 634 $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">'; 635 } 605 $output .= _wp_link_page($i); 636 606 $output .= $link_before. $nextpagelink . $link_after . '</a>'; 637 607 } … … 647 617 } 648 618 619 function _wp_link_page( $i ) { 620 global $post, $wp_rewrite; 621 622 if ( 1 == $i ) { 623 $url .= get_permalink(); 624 } else { 625 if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) ) 626 $url = add_query_arg( 'page', $i, get_permalink() ); 627 elseif ( 'page' == get_option('show_on_front') && get_option('page_on_front') == $post->ID ) 628 $url = trailingslashit(get_permalink()) . user_trailingslashit("$wp_rewrite->pagination_base/" . $i, 'single_paged'); 629 else 630 $url .= trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged'); 631 } 632 633 return '<a href="' . $url . '">'; 634 } 649 635 650 636 // -
trunk/wp-includes/post.php
r15564 r15582 2551 2551 $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_ID, $post_parent ) ); 2552 2552 2553 if ( $post_name_check || in_array( $slug, $feeds ) || preg_match( '@^(page)?\d+$@', $slug ) ) {2553 if ( $post_name_check || in_array( $slug, $feeds ) || preg_match( "@^($wp_rewrite->pagination_base)?\d+$@", $slug ) ) { 2554 2554 $suffix = 2; 2555 2555 do { -
trunk/wp-includes/rewrite.php
r15109 r15582 479 479 */ 480 480 var $comments_base = 'comments'; 481 482 /** 483 * Pagination permalink base. 484 * 485 * @since 3.1.0 486 * @access private 487 * @var string 488 */ 489 var $pagination_base = 'page'; 481 490 482 491 /** … … 1280 1289 //build a regex to match the trackback and page/xx parts of URLs 1281 1290 $trackbackregex = 'trackback/?$'; 1282 $pageregex = 'page/?([0-9]{1,})/?$';1291 $pageregex = $this->pagination_base . '/?([0-9]{1,})/?$'; 1283 1292 $commentregex = 'comment-page-([0-9]{1,})/?$'; 1284 1293
Note: See TracChangeset
for help on using the changeset viewer.