Make WordPress Core

Ticket #23229: 23229-r23303.diff

File 23229-r23303.diff, 4.5 KB (added by ssmathias, 14 years ago)

Patch against revision 23303 in trunk

  • wp-includes/post.php

     
    31183118                $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";
    31193119                $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_ID, $post_parent ) );
    31203120
    3121                 if ( $post_name_check || in_array( $slug, $feeds ) || preg_match( "@^($wp_rewrite->pagination_base)?\d+$@", $slug )  || apply_filters( 'wp_unique_post_slug_is_bad_hierarchical_slug', false, $slug, $post_type, $post_parent ) ) {
     3121                if ( $post_name_check || in_array( $slug, $feeds ) || preg_match( "@^/$wp_rewrite->pagination_base/\d+$@", $slug )  || apply_filters( 'wp_unique_post_slug_is_bad_hierarchical_slug', false, $slug, $post_type, $post_parent ) ) {
    31223122                        $suffix = 2;
    31233123                        do {
    31243124                                $alt_post_name = substr( $slug, 0, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
  • wp-includes/link-template.php

     
    14481448                        $query_string = '';
    14491449                }
    14501450
    1451                 $request = preg_replace( "|$wp_rewrite->pagination_base/\d+/?$|", '', $request);
     1451                $request = preg_replace( "|/$wp_rewrite->pagination_base/\d+/?$|", '', $request);
    14521452                $request = preg_replace( '|^index\.php|i', '', $request);
    14531453                $request = ltrim($request, '/');
    14541454
    … …  
    14641464                $result = $base . $request . $query_string;
    14651465        }
    14661466
    1467         $result = apply_filters('get_pagenum_link', $result);
     1467        $result = apply_filters('get_pagenum_link', $result, $pagenum);
    14681468
    14691469        if ( $escape )
    14701470                return esc_url( $result );
  • wp-includes/rewrite.php

     
    12321232
    12331233                //$feedregex is identical but with /feed/ added on as well, so URLs like <permalink>/feed/atom
    12341234                //and <permalink>/atom are both possible
    1235                 $feedregex = $this->feed_base . '/' . $feedregex2;
     1235                $feedregex = '/'.$this->feed_base . '/' . $feedregex2;
    12361236
    12371237                //build a regex to match the trackback and page/xx parts of URLs
    1238                 $trackbackregex = 'trackback/?$';
    1239                 $pageregex = $this->pagination_base . '/?([0-9]{1,})/?$';
    1240                 $commentregex = 'comment-page-([0-9]{1,})/?$';
     1238                $trackbackregex = '/trackback/?$';
     1239                $pageregex = '/'.$this->pagination_base . '/?([0-9]{1,})/?$';
     1240                $commentregex = '/comment-page-([0-9]{1,})/?$';
    12411241
    12421242                //build up an array of endpoint regexes to append => queries to append
    12431243                if ( $endpoints ) {
    … …  
    12971297                        $struct = ltrim($struct, '/');
    12981298
    12991299                        //replace tags with regexes
    1300                         $match = str_replace($this->rewritecode, $this->rewritereplace, $struct);
     1300                        $match = untrailingslashit(str_replace($this->rewritecode, $this->rewritereplace, $struct));
    13011301
    13021302                        //make a list of tags, and store how many there are in $num_toks
    13031303                        $num_toks = preg_match_all('/%.+?%/', $struct, $toks);
  • wp-includes/canonical.php

     
    220220
    221221                // paging and feeds
    222222                if ( get_query_var('paged') || is_feed() || get_query_var('cpage') ) {
    223                         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'] ) ) {
     223                        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'] ) ) {
    224224                                // Strip off paging and feed
    225                                 $redirect['path'] = preg_replace("#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?$#", '/', $redirect['path']); // strip off any existing paging
     225                                $redirect['path'] = preg_replace("#/$wp_rewrite->pagination_base/[0-9]+?(/+)?$#", '/', $redirect['path']); // strip off any existing paging
    226226                                $redirect['path'] = preg_replace('#/(comments/?)?(feed|rss2?|rdf|atom)(/+|$)#', '/', $redirect['path']); // strip off feed endings
    227227                                $redirect['path'] = preg_replace('#/comment-page-[0-9]+?(/+)?$#', '/', $redirect['path']); // strip off any existing comment paging
    228228                        }