Changeset 34492
- Timestamp:
- 09/24/2015 02:03:05 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/canonical.php
r34446 r34492 147 147 $redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'page', 'feed', 'p', 'page_id', 'attachment_id', 'pagename', 'name', 'post_type' ), $redirect_url ); 148 148 } 149 } 150 151 if ( get_query_var( 'page' ) && $wp_query->post && 152 false !== strpos( $wp_query->post->post_content, '<!--nextpage-->' ) ) { 153 $redirect['path'] = rtrim( $redirect['path'], (int) get_query_var( 'page' ) . '/' ); 154 $redirect['query'] = remove_query_arg( 'page', $redirect['query'] ); 155 $redirect_url = get_permalink( $wp_query->post->ID ); 149 156 } 150 157 … … 561 568 if ( get_query_var( 'feed' ) ) 562 569 return get_post_comments_feed_link( $post_id, get_query_var( 'feed' ) ); 563 elseif ( get_query_var( 'page' ) )570 elseif ( get_query_var( 'page' ) && 1 < get_query_var( 'page' ) ) 564 571 return trailingslashit( get_permalink( $post_id ) ) . user_trailingslashit( get_query_var( 'page' ), 'single_paged' ); 565 572 else -
trunk/src/wp-includes/class-wp-rewrite.php
r33751 r34492 1072 1072 $sub2 .= '?$'; 1073 1073 1074 //post pagination, e.g. <permalink>/2/ 1075 $match = $match . '(/[0-9]+)?/?$'; 1074 // Post pagination, e.g. <permalink>/2/ 1075 // Previously: '(/[0-9]+)?/?$', which produced '/2' for page. 1076 // When cast to int, returned 0. 1077 $match = $match . '(?:/([0-9]+))?/?$'; 1076 1078 $query = $index . '?' . $query . '&page=' . $this->preg_index($num_toks + 1); 1077 1079 } else { //not matching a permalink so this is a lot simpler -
trunk/src/wp-includes/class-wp.php
r34476 r34492 588 588 */ 589 589 public function handle_404() { 590 global $wp_query ;590 global $wp_query, $wp; 591 591 592 592 // If we've already issued a 404, bail. … … 597 597 if ( is_admin() || is_robots() || $wp_query->posts ) { 598 598 599 // Only set X-Pingback for single posts.599 $success = true; 600 600 if ( is_singular() ) { 601 601 $p = clone $wp_query->post; 602 // Only set X-Pingback for single posts that allow pings. 602 603 if ( $p && pings_open( $p ) ) { 603 604 @header( 'X-Pingback: ' . get_bloginfo( 'pingback_url' ) ); 604 605 } 605 } 606 607 status_header( 200 ); 608 return; 606 607 // check for paged content that exceeds the max number of pages 608 $next = '<!--nextpage-->'; 609 if ( $p && false !== strpos( $p->post_content, $next ) && ! empty( $wp->query_vars['page'] ) ) { 610 $page = trim( $wp->query_vars['page'], '/' ); 611 $success = (int) $page <= ( substr_count( $p->post_content, $next ) + 1 ); 612 } 613 } 614 615 if ( $success ) { 616 status_header( 200 ); 617 return; 618 } 609 619 } 610 620 -
trunk/src/wp-includes/rewrite-functions.php
r33751 r34492 257 257 $maybe_page = $query_vars['day']; 258 258 } 259 // Bug found in #11694 - 'page' was returning '/4' 260 $maybe_page = (int) trim( $maybe_page, '/' ); 259 261 260 262 $post_page_count = substr_count( $post->post_content, '<!--nextpage-->' ) + 1; -
trunk/tests/phpunit/tests/canonical.php
r34234 r34492 97 97 array( '/post-format-test-au/', '/2008/06/02/post-format-test-audio/'), 98 98 99 array( '/2008/09/03/images-test/3/', array( 'url' => '/2008/09/03/images-test/3/', 'qv' => array( 'name' => 'images-test', 'year' => '2008', 'monthnum' => '09', 'day' => '03', 'page' => ' /3' ) ) ), // page = /3 ?!99 array( '/2008/09/03/images-test/3/', array( 'url' => '/2008/09/03/images-test/3/', 'qv' => array( 'name' => 'images-test', 'year' => '2008', 'monthnum' => '09', 'day' => '03', 'page' => '3' ) ) ), 100 100 array( '/2008/09/03/images-test/?page=3', '/2008/09/03/images-test/3/' ), 101 101 array( '/2008/09/03/images-te?page=3', '/2008/09/03/images-test/3/' ),
Note: See TracChangeset
for help on using the changeset viewer.