Make WordPress Core

Changeset 1244


Ignore:
Timestamp:
05/09/2004 02:52:27 AM (20 years ago)
Author:
saxmatt
Message:

Fixes for silly category_base stuff. Now lets it be blank and acts accordingly, more sane.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/options-permalink.php

    r1227 r1244  
    9696      <input name="permalink_structure" type="text" style="width: 98%;" value="<?php echo $permalink_structure; ?>" />
    9797    </p>
    98     <p><?php _e('Enter a path without templates for your categories:') ?> FIXME[THIS WORDING MAKES NO SENSE]</p>
     98    <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>
    9999    <p>
    100100  <input name="category_base" type="text" style="width: 98%;" value="<?php echo $category_base; ?>" />
  • trunk/wp-admin/upgrade-functions.php

    r1242 r1244  
    821821    // Option for category base
    822822    if(!$wpdb->get_var("SELECT option_id FROM $tableoptions WHERE option_name = 'category_base'")) {
    823         $wpdb->query("INSERT INTO $tableoptions (option_name, option_type, option_value, option_admin_level) VALUES ('category_base', 3, '/category', 8)");
     823        $wpdb->query("INSERT INTO $tableoptions (option_name, option_type, option_value, option_admin_level) VALUES ('category_base', 3, '', 8)");
    824824    }
    825825
  • trunk/wp-includes/functions.php

    r1239 r1244  
    332332            if ('siteurl' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value);
    333333            if ('home' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value);
     334            if ('category_base' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value);
    334335
    335336            $all_options->{$option->option_name} = $option->option_value;
     
    12791280    // Code for nice categories and authors, currently not very flexible
    12801281    $front = substr($permalink_structure, 0, strpos($permalink_structure, '%'));
    1281     $catmatch = get_settings( 'category_base' ) . '/';
     1282    if ( '' == get_settings('category_base') )
     1283        $catmatch = $front . 'category/';
     1284    else
     1285        $catmatch = get_settings('category_base') . '/';
    12821286    $catmatch = preg_replace('|^/+|', '', $catmatch);
    12831287   
  • trunk/wp-includes/template-functions-category.php

    r1235 r1244  
    2525        $link = $file.$querystring_start.'cat'.$querystring_equal.$cat_ID;
    2626    } else {
    27         $category_nicename = $cache_categories[$category_id]->cat_name;
    28         $category_nicename = preg_replace( '|[^a-z0-9-]|i', '', $category_nicename );
     27        $category_nicename = $cache_categories[$category_id]->category_nicename;
    2928        // Get any static stuff from the front
    3029        $front = substr($permalink_structure, 0, strpos($permalink_structure, '%'));
     30        if ( '' == get_settings('category_base') ) :
     31            $link = get_settings('home') . $front . 'category/';
     32        else :
    3133         $link = get_settings('home') . get_settings('category_base') . '/';
     34        endif;
    3235        if ($parent=$cache_categories[$category_id]->category_parent) $link .= get_category_parents($parent, FALSE, '/', TRUE);
    3336        $link .= $category_nicename . '/';
Note: See TracChangeset for help on using the changeset viewer.