WordPress.org

Make WordPress Core


Ignore:
Timestamp:
05/26/2007 06:54:16 PM (15 years ago)
Author:
ryan
Message:

Update cat2tag converter. Some term API tweaks. see #4189

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/taxonomy.php

    r5552 r5553  
    137137
    138138    foreach ( (array) $objects as $object ) {
    139         $terms = get_object_terms($object, $taxonomy, 'get=ids');
     139        $terms = get_object_terms($object, $taxonomy, 'fields=ids');
    140140        if ( 1 == count($terms) && isset($default) )
    141141            $terms = array($default);
     
    320320    $object_ids = ($single_object = !is_array($object_id)) ? array($object_id) : $object_id;
    321321
    322     $defaults = array('orderby' => 'name', 'order' => 'ASC', 'get' => 'everything');
     322    $defaults = array('orderby' => 'name', 'order' => 'ASC', 'fields' => 'all');
    323323    $args = wp_parse_args( $args, $defaults );
    324324    extract($args);
     
    332332    $object_ids = implode(', ', $object_ids);
    333333
    334     if ( 'everything' == $get )
     334    if ( 'all' == $fields )
    335335        $select_this = 't.*';
    336     else if ( 'ids' == $get )
     336    else if ( 'ids' == $fields )
    337337        $select_this = 't.term_id';
    338338
    339339    $query = "SELECT $select_this FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN $wpdb->term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ($taxonomies) AND tr.object_id IN ($object_ids) ORDER BY $orderby $order";
    340340
    341     if ( 'everything' == $get )
     341    if ( 'all' == $fields )
    342342        $taxonomy_data = $wpdb->get_results($query);
    343     else if ( 'ids' == $get )
     343    else if ( 'ids' == $fields )
    344344        $taxonomy_data = $wpdb->get_col($query);
    345345
     
    380380    $defaults = array('orderby' => 'name', 'order' => 'ASC',
    381381        'hide_empty' => true, 'exclude' => '', 'include' => '',
    382         'number' => '', 'get' => 'everything', 'slug' => '', 'parent' => '',
    383         'hierarchical' => true, 'child_of' => 0);
     382        'number' => '', 'fields' => 'all', 'slug' => '', 'parent' => '',
     383        'hierarchical' => true, 'child_of' => 0, 'get' => '');
    384384    $args = wp_parse_args( $args, $defaults );
    385385    $args['number'] = (int) $args['number'];
     
    387387        $args['child_of'] = 0;
    388388        $args['hierarchical'] = false;
    389     } else {
    390         $tax = get_taxonomy($taxonomy);
    391         if ( !$tax['hierarchical'] ) {
    392             $args['child_of'] = 0;
    393             $args['hierarchical'] = false; 
    394         }
     389    } else if ( !is_taxonomy_hierarchical($taxonomies[0]) ) {
     390        $args['child_of'] = 0;
     391        $args['hierarchical'] = false;
     392    }
     393    if ( 'all' == $args['get'] ) {
     394        $args['child_of'] = 0;
     395        $args['hide_empty'] = 0;
     396        $args['hierarchical'] = false;
    395397    }
    396398    extract($args);
     
    464466        $number = '';
    465467
    466     if ( 'everything' == $get )
     468    if ( 'all' == $fields )
    467469        $select_this = 't.*, tt.*';
    468     else if ( 'ids' == $get )
     470    else if ( 'ids' == $fields )
    469471        $select_this = 't.term_id';
    470472
    471473    $query = "SELECT $select_this FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ($in_taxonomies) $where ORDER BY $orderby $order $number";
    472474
    473     if ( 'everything' == $get )
     475    if ( 'all' == $fields )
    474476        $terms = $wpdb->get_results($query);
    475     else if ( 'ids' == $get )
     477    else if ( 'ids' == $fields )
    476478        $terms = $wpdb->get_col($query);
    477479
Note: See TracChangeset for help on using the changeset viewer.