Fixes for silly category_base stuff. Now lets it be blank and acts accordingly, more sane.
git-svn-id: https://develop.svn.wordpress.org/trunk@1244 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
cd127d0c45
commit
4a58f4f523
@ -95,7 +95,7 @@ if ($_POST['submit']) {
|
||||
<p>
|
||||
<input name="permalink_structure" type="text" style="width: 98%;" value="<?php echo $permalink_structure; ?>" />
|
||||
</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>
|
||||
<input name="category_base" type="text" style="width: 98%;" value="<?php echo $category_base; ?>" />
|
||||
</p>
|
||||
|
@ -820,7 +820,7 @@ function upgrade_110() {
|
||||
|
||||
// Option for 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
|
||||
|
@ -331,6 +331,7 @@ function get_alloptions() {
|
||||
// never underestimate the ingenuity of the fools :)"
|
||||
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 ('category_base' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $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
|
||||
$front = substr($permalink_structure, 0, strpos($permalink_structure, '%'));
|
||||
if ( '' == get_settings('category_base') )
|
||||
$catmatch = $front . 'category/';
|
||||
else
|
||||
$catmatch = get_settings('category_base') . '/';
|
||||
$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');
|
||||
$link = $file.$querystring_start.'cat'.$querystring_equal.$cat_ID;
|
||||
} else {
|
||||
$category_nicename = $cache_categories[$category_id]->cat_name;
|
||||
$category_nicename = preg_replace( '|[^a-z0-9-]|i', '', $category_nicename );
|
||||
$category_nicename = $cache_categories[$category_id]->category_nicename;
|
||||
// Get any static stuff from the front
|
||||
$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') . '/';
|
||||
endif;
|
||||
if ($parent=$cache_categories[$category_id]->category_parent) $link .= get_category_parents($parent, FALSE, '/', TRUE);
|
||||
$link .= $category_nicename . '/';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user