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
This commit is contained in:
markjaquith 2008-07-17 19:41:48 +00:00
parent fe9866dc79
commit 3170e3f6ee
3 changed files with 13 additions and 13 deletions

View File

@ -163,9 +163,9 @@ $structures = array(
<h3><?php _e('Optional'); ?></h3>
<?php if ($is_apache) : ?>
<p><?php _e('If you like, you may enter custom structures for your category and tag <abbr title="Universal Resource Locator">URL</abbr>s here. For example, using <code>/topics/</code> as your category base would make your category links like <code>http://example.org/topics/uncategorized/</code>. If you leave these blank the defaults will be used.') ?></p>
<p><?php _e('If you like, you may enter custom structures for your category and tag <abbr title="Universal Resource Locator">URL</abbr>s here. For example, using <code>topics</code> as your category base would make your category links like <code>http://example.org/topics/uncategorized/</code>. If you leave these blank the defaults will be used.') ?></p>
<?php else : ?>
<p><?php _e('If you like, you may enter custom structures for your category and tag <abbr title="Universal Resource Locator">URL</abbr>s here. For example, using <code>/topics/</code> as your category base would make your category links like <code>http://example.org/index.php/topics/uncategorized/</code>. If you leave these blank the defaults will be used.') ?></p>
<p><?php _e('If you like, you may enter custom structures for your category and tag <abbr title="Universal Resource Locator">URL</abbr>s here. For example, using <code>topics</code> as your category base would make your category links like <code>http://example.org/index.php/topics/uncategorized/</code>. If you leave these blank the defaults will be used.') ?></p>
<?php endif; ?>
<table class="form-table">

View File

@ -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);

View File

@ -15,6 +15,6 @@ $wp_version = '2.7-bleeding';
*
* @global int $wp_db_version
*/
$wp_db_version = 8201;
$wp_db_version = 8202;
?>