Fixes for silly category_base stuff. Now lets it be blank and acts accordingly, more sane.
git-svn-id: http://svn.automattic.com/wordpress/trunk@1244 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
d086da27e7
commit
4915acfefd
|
@ -95,7 +95,7 @@ if ($_POST['submit']) {
|
||||||
<p>
|
<p>
|
||||||
<input name="permalink_structure" type="text" style="width: 98%;" value="<?php echo $permalink_structure; ?>" />
|
<input name="permalink_structure" type="text" style="width: 98%;" value="<?php echo $permalink_structure; ?>" />
|
||||||
</p>
|
</p>
|
||||||
<p><?php _e('Enter a path without templates for your categories:') ?> FIXME[THIS WORDING MAKES NO SENSE]</p>
|
<p><?php _e('If you like, you may enter a custom prefix for your category URIs here. For example, <code>/taxonomy/categorias</code> would make your category links like <code>http://example.org/taxonomy/categorias/general/</code>. If you leave this blank the default will be used.') ?></p>
|
||||||
<p>
|
<p>
|
||||||
<input name="category_base" type="text" style="width: 98%;" value="<?php echo $category_base; ?>" />
|
<input name="category_base" type="text" style="width: 98%;" value="<?php echo $category_base; ?>" />
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -820,7 +820,7 @@ function upgrade_110() {
|
||||||
|
|
||||||
// Option for category base
|
// Option for category base
|
||||||
if(!$wpdb->get_var("SELECT option_id FROM $tableoptions WHERE option_name = 'category_base'")) {
|
if(!$wpdb->get_var("SELECT option_id FROM $tableoptions WHERE option_name = 'category_base'")) {
|
||||||
$wpdb->query("INSERT INTO $tableoptions (option_name, option_type, option_value, option_admin_level) VALUES ('category_base', 3, '/category', 8)");
|
$wpdb->query("INSERT INTO $tableoptions (option_name, option_type, option_value, option_admin_level) VALUES ('category_base', 3, '', 8)");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete unused options
|
// Delete unused options
|
||||||
|
|
|
@ -331,6 +331,7 @@ function get_alloptions() {
|
||||||
// never underestimate the ingenuity of the fools :)"
|
// never underestimate the ingenuity of the fools :)"
|
||||||
if ('siteurl' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value);
|
if ('siteurl' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value);
|
||||||
if ('home' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value);
|
if ('home' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value);
|
||||||
|
if ('category_base' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value);
|
||||||
|
|
||||||
$all_options->{$option->option_name} = $option->option_value;
|
$all_options->{$option->option_name} = $option->option_value;
|
||||||
}
|
}
|
||||||
|
@ -1278,6 +1279,9 @@ function rewrite_rules($matches = '', $permalink_structure = '') {
|
||||||
|
|
||||||
// Code for nice categories and authors, currently not very flexible
|
// Code for nice categories and authors, currently not very flexible
|
||||||
$front = substr($permalink_structure, 0, strpos($permalink_structure, '%'));
|
$front = substr($permalink_structure, 0, strpos($permalink_structure, '%'));
|
||||||
|
if ( '' == get_settings('category_base') )
|
||||||
|
$catmatch = $front . 'category/';
|
||||||
|
else
|
||||||
$catmatch = get_settings('category_base') . '/';
|
$catmatch = get_settings('category_base') . '/';
|
||||||
$catmatch = preg_replace('|^/+|', '', $catmatch);
|
$catmatch = preg_replace('|^/+|', '', $catmatch);
|
||||||
|
|
||||||
|
|
|
@ -24,11 +24,14 @@ function get_category_link($echo = false, $category_id, $category_nicename) {
|
||||||
$file = get_settings('home') . '/' . get_settings('blogfilename');
|
$file = get_settings('home') . '/' . get_settings('blogfilename');
|
||||||
$link = $file.$querystring_start.'cat'.$querystring_equal.$cat_ID;
|
$link = $file.$querystring_start.'cat'.$querystring_equal.$cat_ID;
|
||||||
} else {
|
} else {
|
||||||
$category_nicename = $cache_categories[$category_id]->cat_name;
|
$category_nicename = $cache_categories[$category_id]->category_nicename;
|
||||||
$category_nicename = preg_replace( '|[^a-z0-9-]|i', '', $category_nicename );
|
|
||||||
// Get any static stuff from the front
|
// Get any static stuff from the front
|
||||||
$front = substr($permalink_structure, 0, strpos($permalink_structure, '%'));
|
$front = substr($permalink_structure, 0, strpos($permalink_structure, '%'));
|
||||||
|
if ( '' == get_settings('category_base') ) :
|
||||||
|
$link = get_settings('home') . $front . 'category/';
|
||||||
|
else :
|
||||||
$link = get_settings('home') . get_settings('category_base') . '/';
|
$link = get_settings('home') . get_settings('category_base') . '/';
|
||||||
|
endif;
|
||||||
if ($parent=$cache_categories[$category_id]->category_parent) $link .= get_category_parents($parent, FALSE, '/', TRUE);
|
if ($parent=$cache_categories[$category_id]->category_parent) $link .= get_category_parents($parent, FALSE, '/', TRUE);
|
||||||
$link .= $category_nicename . '/';
|
$link .= $category_nicename . '/';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue