WordPress.org

Make WordPress Core

Changeset 5534


Ignore:
Timestamp:
05/23/2007 10:11:02 PM (15 years ago)
Author:
ryan
Message:

No more TAXONOMY bit fiels. see #4189

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-db.php

    r5533 r5534  
    163163    if ( $id = category_exists($cat_name) )
    164164        return $id;
    165     $cat_array = array('cat_name' => $cat_name, 'type' => TAXONOMY_CATEGORY);
    166 
    167     if ( $id = category_object_exists($cat_name) ) {
    168         $category = get_category($id);
    169         $cat_array['type'] = $category->type | $cat_array['type'];
    170         $cat_array['cat_ID'] = $id;
    171         return wp_update_category($cat_array);
    172     } else {
    173         return wp_insert_category($cat_array);
    174     }
     165
     166    return wp_insert_category( array('cat_name' => $cat_name) );
    175167}
    176168
     
    191183}
    192184
    193 function category_object_exists($cat_name) {
    194     global $wpdb;
    195     if (!$category_nicename = sanitize_title($cat_name))
    196         return 0;
    197 
    198     return (int) $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE category_nicename = '$category_nicename'");
    199 }
    200 
    201185function category_exists($cat_name) {
    202     global $wpdb;
    203     if (!$category_nicename = sanitize_title($cat_name))
    204         return 0;
    205 
    206     return (int) $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE category_nicename = '$category_nicename' AND ( type & " . TAXONOMY_CATEGORY .  " != 0 )");
     186    return is_term($cat_name, 'category');
    207187}
    208188
     
    215195        return $id;
    216196
    217     $tag_id = wp_insert_term($tag_name, 'post_tag');   
     197    return wp_insert_term($tag_name, 'post_tag');   
    218198}
    219199
  • trunk/wp-includes/category.php

    r5529 r5534  
    11<?php
    2 
    3 define('TAXONOMY_CATEGORY', 1);
    4 define('TAXONOMY_TAG', 2);
    52
    63function get_all_category_ids() {
Note: See TracChangeset for help on using the changeset viewer.