From c1f75d51ab0f1bffe2ef8358baf7a8d6918a499f Mon Sep 17 00:00:00 2001 From: markjaquith Date: Fri, 21 Nov 2008 17:33:05 +0000 Subject: [PATCH] Comment Page URL fixes by wnorris. fixes #8297 git-svn-id: http://svn.automattic.com/wordpress/trunk@9831 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/canonical.php | 7 ++++--- wp-includes/link-template.php | 10 +++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/wp-includes/canonical.php b/wp-includes/canonical.php index c0e2fda77f..b8731117a0 100644 --- a/wp-includes/canonical.php +++ b/wp-includes/canonical.php @@ -165,10 +165,11 @@ function redirect_canonical($requested_url=null, $do_redirect=true) { $redirect['query'] = remove_query_arg( 'cpage', $redirect['query'] ); } - $paged_redirect['path'] = trailingslashit( preg_replace('|/index.php/?$|', '/', $paged_redirect['path']) ); // strip off trailing /index.php/ + $paged_redirect['path'] = user_trailingslashit( preg_replace('|/index.php/?$|', '/', $paged_redirect['path']) ); // strip off trailing /index.php/ if ( !empty( $addl_path ) && $wp_rewrite->using_index_permalinks() && strpos($paged_redirect['path'], '/index.php/') === false ) - $paged_redirect['path'] .= 'index.php/'; - $paged_redirect['path'] .= $addl_path; + $paged_redirect['path'] = trailingslashit($paged_redirect['path']) . 'index.php/'; + if ( !empty( $addl_path ) ) + $paged_redirect['path'] = trailingslashit($paged_redirect['path']) . $addl_path; $redirect_url = $paged_redirect['scheme'] . '://' . $paged_redirect['host'] . $paged_redirect['path']; $redirect['path'] = $paged_redirect['path']; } diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php index cc7ec280ac..6655d920b5 100644 --- a/wp-includes/link-template.php +++ b/wp-includes/link-template.php @@ -1230,20 +1230,20 @@ function get_comments_pagenum_link( $pagenum = 1, $max_page = 0 ) { $base = trailingslashit( get_bloginfo( 'home' ) ); - $result = $base . $request; + $result = user_trailingslashit($base . $request); if ( 'newest' == get_option('default_comments_page') ) { if ( $pagenum != $max_page ) { if ( $wp_rewrite->using_permalinks() ) - $result = user_trailingslashit( trailingslashit($base . $request) . 'comment-page-' . $pagenum, 'commentpaged'); + $result = user_trailingslashit( trailingslashit($result) . 'comment-page-' . $pagenum, 'commentpaged'); else - $result = add_query_arg( 'cpage', $pagenum, $base . $request ); + $result = add_query_arg( 'cpage', $pagenum, $result ); } } elseif ( $pagenum > 1 ) { if ( $wp_rewrite->using_permalinks() ) - $result = user_trailingslashit( trailingslashit($base . $request) . 'comment-page-' . $pagenum, 'commentpaged'); + $result = user_trailingslashit( trailingslashit($result) . 'comment-page-' . $pagenum, 'commentpaged'); else - $result = add_query_arg( 'cpage', $pagenum, $base . $request ); + $result = add_query_arg( 'cpage', $pagenum, $result ); } $result .= '#comments';