Ticket #12507: pagination_base.5.diff
File pagination_base.5.diff, 7.7 KB (added by , 15 years ago) |
---|
-
wp-includes/post-template.php
573 573 $r = apply_filters( 'wp_link_pages_args', $r ); 574 574 extract( $r, EXTR_SKIP ); 575 575 576 global $p ost, $page, $numpages, $multipage, $more, $pagenow;576 global $page, $numpages, $multipage, $more, $pagenow; 577 577 578 578 $output = ''; 579 579 if ( $multipage ) { … … 583 583 $j = str_replace('%',$i,$pagelink); 584 584 $output .= ' '; 585 585 if ( ($i != $page) || ((!$more) && ($page==1)) ) { 586 if ( 1 == $i ) { 587 $output .= '<a href="' . get_permalink() . '">'; 588 } else { 589 if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) ) 590 $output .= '<a href="' . add_query_arg('page', $i, get_permalink()) . '">'; 591 elseif ( 'page' == get_option('show_on_front') && get_option('page_on_front') == $post->ID ) 592 $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit('page/' . $i, 'single_paged'). '">'; 593 else 594 $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">'; 595 } 596 586 $output .= _wp_link_page($i); 597 587 } 598 $output .= $link_before; 599 $output .= $j; 600 $output .= $link_after; 588 $output .= $link_before . $j . $link_after; 601 589 if ( ($i != $page) || ((!$more) && ($page==1)) ) 602 590 $output .= '</a>'; 603 591 } … … 607 595 $output .= $before; 608 596 $i = $page - 1; 609 597 if ( $i && $more ) { 610 if ( 1 == $i ) { 611 $output .= '<a href="' . get_permalink() . '">'; 612 } else { 613 if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) ) 614 $output .= '<a href="' . add_query_arg('page', $i, get_permalink()) . '">'; 615 elseif ( 'page' == get_option('show_on_front') && get_option('page_on_front') == $post->ID ) 616 $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit('page/' . $i, 'single_paged'). '">'; 617 else 618 $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">'; 619 } 598 $output .= _wp_link_page($i); 620 599 $output .= $link_before. $previouspagelink . $link_after . '</a>'; 621 600 } 622 601 $i = $page + 1; 623 602 if ( $i <= $numpages && $more ) { 624 if ( 1 == $i ) { 625 $output .= '<a href="' . get_permalink() . '">'; 626 } else { 627 if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) ) 628 $output .= '<a href="' . add_query_arg('page', $i, get_permalink()) . '">'; 629 elseif ( 'page' == get_option('show_on_front') && get_option('page_on_front') == $post->ID ) 630 $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit('page/' . $i, 'single_paged'). '">'; 631 else 632 $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">'; 633 } 603 $output .= _wp_link_page($i); 634 604 $output .= $link_before. $nextpagelink . $link_after . '</a>'; 635 605 } 636 606 $output .= $after; … … 644 614 return $output; 645 615 } 646 616 617 function _wp_link_page($i) { 618 global $post, $wp_rewrite; 647 619 620 $r = ''; 621 622 if ( 1 == $i ) { 623 $r .= '<a href="' . get_permalink() . '">'; 624 } else { 625 if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) ) 626 $r .= '<a href="' . add_query_arg('page', $i, get_permalink()) . '">'; 627 elseif ( 'page' == get_option('show_on_front') && get_option('page_on_front') == $post->ID ) 628 $r .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit("$wp_rewrite->pagination_base/" . $i, 'single_paged'). '">'; 629 else 630 $r .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">'; 631 } 632 633 return $r; 634 } 635 648 636 // 649 637 // Post-meta: Custom per-post fields. 650 638 // -
wp-includes/post.php
2417 2417 $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type IN ( '" . implode( "', '", esc_sql( $hierarchical_post_types ) ) . "' ) AND ID != %d AND post_parent = %d LIMIT 1"; 2418 2418 $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_ID, $post_parent ) ); 2419 2419 2420 if ( $post_name_check || in_array( $slug, $feeds ) || preg_match( '@^(page)?\d+$@', $slug ) ) {2420 if ( $post_name_check || in_array( $slug, $feeds ) || preg_match( "@^($wp_rewrite->pagination_base)?\d+$@", $slug ) ) { 2421 2421 $suffix = 2; 2422 2422 do { 2423 2423 $alt_post_name = substr( $slug, 0, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix"; … … 4585 4585 4586 4586 add_filter('the_preview', '_set_preview'); 4587 4587 } 4588 } 4589 No newline at end of file 4588 } -
wp-includes/link-template.php
1387 1387 $query_string = ''; 1388 1388 } 1389 1389 1390 $request = preg_replace( '|page/\d+/?$|', '', $request);1390 $request = preg_replace( "|$wp_rewrite->pagination_base/\d+/?$|", '', $request); 1391 1391 $request = preg_replace( '|^index\.php|', '', $request); 1392 1392 $request = ltrim($request, '/'); 1393 1393 … … 1397 1397 $base .= 'index.php/'; 1398 1398 1399 1399 if ( $pagenum > 1 ) { 1400 $request = ( ( !empty( $request ) ) ? trailingslashit( $request ) : $request ) . user_trailingslashit( 'page/'. $pagenum, 'paged' );1400 $request = ( ( !empty( $request ) ) ? trailingslashit( $request ) : $request ) . user_trailingslashit( $wp_rewrite->pagination_base . "/" . $pagenum, 'paged' ); 1401 1401 } 1402 1402 1403 1403 $result = $base . $request . $query_string; -
wp-includes/rewrite.php
480 480 var $comments_base = 'comments'; 481 481 482 482 /** 483 * Pagination permalink base. 484 * 485 * @since 3.1.0 486 * @access private 487 * @var string 488 */ 489 var $pagination_base = 'page'; 490 491 /** 483 492 * Feed permalink base. 484 493 * 485 494 * @since 1.5.0 … … 1279 1288 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 1285 1294 //build up an array of endpoint regexes to append => queries to append -
wp-includes/canonical.php
178 178 $paged_redirect = @parse_url($redirect_url); 179 179 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'] ) ) { 180 180 // Strip off paging and feed 181 $paged_redirect['path'] = preg_replace( '#/page/?[0-9]+?(/+)?$#', '/', $paged_redirect['path']); // strip off any existing paging181 $paged_redirect['path'] = preg_replace("#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?$#", '/', $paged_redirect['path']); // strip off any existing paging 182 182 $paged_redirect['path'] = preg_replace('#/(comments/?)?(feed|rss2?|rdf|atom)(/+|$)#', '/', $paged_redirect['path']); // strip off feed endings 183 183 $paged_redirect['path'] = preg_replace('#/comment-page-[0-9]+?(/+)?$#', '/', $paged_redirect['path']); // strip off any existing comment paging 184 184 }