Make WordPress Core

Ticket #8297: comment-pages.diff

File comment-pages.diff, 2.5 KB (added by wnorris, 16 years ago)

fix trailing slash with "index.php/"

  • wp-includes/link-template.php

     
    12301230
    12311231        $base = trailingslashit( get_bloginfo( 'home' ) );
    12321232
    1233         $result = $base . $request;
     1233        $result = user_trailingslashit($base . $request);
    12341234       
    12351235        if ( 'newest' == get_option('default_comments_page') ) {
    12361236                if ( $pagenum != $max_page ) {
    12371237                        if ( $wp_rewrite->using_permalinks() )
    1238                                 $result = user_trailingslashit( trailingslashit($base . $request) . 'comment-page-' . $pagenum, 'commentpaged');
     1238                                $result = user_trailingslashit( trailingslashit($result) . 'comment-page-' . $pagenum, 'commentpaged');
    12391239                        else
    1240                                 $result = add_query_arg( 'cpage', $pagenum, $base . $request );
     1240                                $result = add_query_arg( 'cpage', $pagenum, $result );
    12411241                }
    12421242        } elseif ( $pagenum > 1 ) {
    12431243                if ( $wp_rewrite->using_permalinks() )
    1244                         $result = user_trailingslashit( trailingslashit($base . $request) . 'comment-page-' . $pagenum, 'commentpaged');
     1244                        $result = user_trailingslashit( trailingslashit($result) . 'comment-page-' . $pagenum, 'commentpaged');
    12451245                else
    1246                         $result = add_query_arg( 'cpage', $pagenum, $base . $request );
     1246                        $result = add_query_arg( 'cpage', $pagenum, $result );
    12471247        }
    12481248
    12491249        $result .= '#comments';
  • wp-includes/canonical.php

     
    165165                                $redirect['query'] = remove_query_arg( 'cpage', $redirect['query'] );
    166166                        }
    167167
    168                         $paged_redirect['path'] = trailingslashit( preg_replace('|/index.php/?$|', '/', $paged_redirect['path']) ); // strip off trailing /index.php/
     168                        $paged_redirect['path'] = user_trailingslashit( preg_replace('|/index.php/?$|', '/', $paged_redirect['path']) ); // strip off trailing /index.php/
    169169                        if ( !empty( $addl_path ) && $wp_rewrite->using_index_permalinks() && strpos($paged_redirect['path'], '/index.php/') === false )
    170                                 $paged_redirect['path'] .= 'index.php/';
    171                         $paged_redirect['path'] .= $addl_path;
     170                                $paged_redirect['path'] = trailingslashit($paged_redirect['path']) . 'index.php/';
     171                        if ( !empty( $addl_path ) )
     172                                $paged_redirect['path'] = trailingslashit($paged_redirect['path']) . $addl_path;
    172173                        $redirect_url = $paged_redirect['scheme'] . '://' . $paged_redirect['host'] . $paged_redirect['path'];
    173174                        $redirect['path'] = $paged_redirect['path'];
    174175                }