From 3170e3f6ee565bd5cc721cd1ebea56a205cd4d09 Mon Sep 17 00:00:00 2001 From: markjaquith Date: Thu, 17 Jul 2008 19:41:48 +0000 Subject: [PATCH] Better solution for #4536. Slashless normalization of tag/category bases. fixes #7306 for trunk. see #4536 git-svn-id: http://svn.automattic.com/wordpress/trunk@8365 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/options-permalink.php | 4 ++-- wp-includes/rewrite.php | 20 ++++++++++---------- wp-includes/version.php | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/wp-admin/options-permalink.php b/wp-admin/options-permalink.php index 8ce51a7d2..b2d05d369 100644 --- a/wp-admin/options-permalink.php +++ b/wp-admin/options-permalink.php @@ -163,9 +163,9 @@ $structures = array(

-

URLs here. For example, using /topics/ as your category base would make your category links like http://example.org/topics/uncategorized/. If you leave these blank the defaults will be used.') ?>

+

URLs here. For example, using topics as your category base would make your category links like http://example.org/topics/uncategorized/. If you leave these blank the defaults will be used.') ?>

-

URLs here. For example, using /topics/ as your category base would make your category links like http://example.org/index.php/topics/uncategorized/. If you leave these blank the defaults will be used.') ?>

+

URLs here. For example, using topics as your category base would make your category links like http://example.org/index.php/topics/uncategorized/. If you leave these blank the defaults will be used.') ?>

diff --git a/wp-includes/rewrite.php b/wp-includes/rewrite.php index 8a13a335f..6e6c47dc1 100644 --- a/wp-includes/rewrite.php +++ b/wp-includes/rewrite.php @@ -67,8 +67,10 @@ function add_rewrite_endpoint($name, $places) { * @author Mark Jaquith */ function _wp_filter_taxonomy_base( $base ) { - if ( !empty( $base ) ) - $base = preg_replace( '|^/index\.php/|', '/', $base ); + if ( !empty( $base ) ) { + $base = preg_replace( '|^/index\.php/|', '', $base ); + $base = trim( $base, '/' ); + } return $base; } @@ -445,9 +447,8 @@ class WP_Rewrite { } if (empty($this->category_base)) - $this->category_structure = $this->front . 'category/'; - else - $this->category_structure = $this->category_base . '/'; + $this->category_base = 'category'; + $this->category_structure = trailingslashit( $this->front . $this->category_base ); $this->category_structure .= '%category%'; @@ -465,9 +466,8 @@ class WP_Rewrite { } if (empty($this->tag_base)) - $this->tag_structure = $this->front . 'tag/'; - else - $this->tag_structure = $this->tag_base . '/'; + $this->tag_base = 'tag'; + $this->tag_structure = trailingslashit( $this->front . $this->tag_base ); $this->tag_structure .= '%tag%'; @@ -993,8 +993,8 @@ class WP_Rewrite { if ($this->using_index_permalinks()) { $this->root = $this->index . '/'; } - $this->category_base = ( ( $this->using_index_permalinks() ) ? '/' . $this->index : '' ) . get_option( 'category_base' ); - $this->tag_base = ( ( $this->using_index_permalinks() ) ? '/' . $this->index : '' ) . get_option( 'tag_base' ); + $this->category_base = get_option( 'category_base' ); + $this->tag_base = get_option( 'tag_base' ); unset($this->category_structure); unset($this->author_structure); unset($this->date_structure); diff --git a/wp-includes/version.php b/wp-includes/version.php index df2007909..06eb3317d 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -15,6 +15,6 @@ $wp_version = '2.7-bleeding'; * * @global int $wp_db_version */ -$wp_db_version = 8201; +$wp_db_version = 8202; ?>