WordPress.org

Make WordPress Core

Changeset 12515


Ignore:
Timestamp:
12/23/2009 03:31:02 PM (10 years ago)
Author:
ryan
Message:

Use array calling style. Props Denis-de-Bernardy. see #6647

Location:
trunk
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/import/opml.php

    r11380 r12515  
    5656<?php _e('Category:') ?> <select name="cat_id" id="cat_id">
    5757<?php
    58 $categories = get_terms('link_category', 'get=all');
     58$categories = get_terms('link_category', array('get' => 'all'));
    5959foreach ($categories as $category) {
    6060?>
  • trunk/wp-admin/import/wordpress.php

    r12513 r12515  
    303303        global $wpdb;
    304304
    305         $cat_names = (array) get_terms('category', 'fields=names');
     305        $cat_names = (array) get_terms('category', array('fields' => 'names'));
    306306
    307307        while ( $c = array_shift($this->categories) ) {
     
    333333        global $wpdb;
    334334
    335         $tag_names = (array) get_terms('post_tag', 'fields=names');
     335        $tag_names = (array) get_terms('post_tag', array('fields' => 'names'));
    336336
    337337        while ( $c = array_shift($this->tags) ) {
  • trunk/wp-admin/import/wp-cat2tag.php

    r11204 r12515  
    4040    function populate_cats() {
    4141
    42         $categories = get_categories('get=all');
     42        $categories = get_categories(array('get' => 'all'));
    4343        foreach ( $categories as $category ) {
    4444            $this->all_categories[] = $category;
     
    5050    function populate_tags() {
    5151
    52         $tags = get_terms( array('post_tag'), 'get=all' );
     52        $tags = get_terms( array('post_tag'), array('get' => 'all') );
    5353        foreach ( $tags as $tag ) {
    5454            $this->all_tags[] = $tag;
  • trunk/wp-admin/includes/bookmark.php

    r11383 r12515  
    103103function wp_get_link_cats( $link_id = 0 ) {
    104104
    105     $cats = wp_get_object_terms( $link_id, 'link_category', 'fields=ids' );
     105    $cats = wp_get_object_terms( $link_id, 'link_category', array('fields' => 'ids') );
    106106
    107107    return array_unique( $cats );
  • trunk/wp-admin/includes/export.php

    r12506 r12515  
    4444$post_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts $where ORDER BY post_date_gmt ASC");
    4545
    46 $categories = (array) get_categories('get=all');
    47 $tags = (array) get_tags('get=all');
     46$categories = (array) get_categories(array('get' => 'all'));
     47$tags = (array) get_tags(array('get' => 'all'));
    4848
    4949$custom_taxonomies = $wp_taxonomies;
     
    7777
    7878while ( $parents = wxr_missing_parents($categories) ) {
    79     $found_parents = get_categories("include=" . join(', ', $parents));
     79    $found_parents = get_categories(array('include' => join(', ', $parents)));
    8080    if ( is_array($found_parents) && count($found_parents) )
    8181        $categories = array_merge($categories, $found_parents);
  • trunk/wp-admin/includes/template.php

    r12493 r12515  
    509509
    510510    if ( $descendants_and_self ) {
    511         $categories = get_categories( "child_of=$descendants_and_self&hierarchical=0&hide_empty=0" );
     511        $categories = get_categories(array('child_of' => $descendants_and_self, 'hierarchical' => 0, 'hide_empty' => 0));
    512512        $self = get_category( $descendants_and_self );
    513513        array_unshift( $categories, $self );
    514514    } else {
    515         $categories = get_categories('get=all');
     515        $categories = get_categories(array('get' => 'all'));
    516516    }
    517517
     
    613613    }
    614614
    615     $categories = get_terms('link_category', 'orderby=count&hide_empty=0');
     615    $categories = get_terms('link_category', array('orderby' => 'count', 'hide_empty' => 0));
    616616
    617617    if ( empty($categories) )
  • trunk/wp-admin/link-manager.php

    r12317 r12515  
    108108
    109109<?php
    110 $categories = get_terms('link_category', "hide_empty=1");
     110$categories = get_terms('link_category', array("hide_empty" => 1));
    111111$select_cat = "<select name=\"cat_id\">\n";
    112112$select_cat .= '<option value="all"'  . (($cat_id == 'all') ? " selected='selected'" : '') . '>' . __('View all Categories') . "</option>\n";
  • trunk/wp-app.php

    r12488 r12515  
    375375
    376376        $categories = "";
    377         $cats = get_categories("hierarchical=0&hide_empty=0");
     377        $cats = get_categories(array('hierarchical' => 0, 'hide_empty' => 0));
    378378        foreach ((array) $cats as $cat) {
    379379            $categories .= "    <category term=\"" . esc_attr($cat->name) .  "\" />\n";
  • trunk/wp-includes/bookmark.php

    r12306 r12515  
    3434        } elseif ( ! $_bookmark = wp_cache_get($bookmark, 'bookmark') ) {
    3535            $_bookmark = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->links WHERE link_id = %d LIMIT 1", $bookmark));
    36             $_bookmark->link_category = array_unique( wp_get_object_terms($_bookmark->link_id, 'link_category', 'fields=ids') );
     36            $_bookmark->link_category = array_unique( wp_get_object_terms($_bookmark->link_id, 'link_category', array('fields' => 'ids')) );
    3737            wp_cache_add($_bookmark->link_id, $_bookmark, 'bookmark');
    3838        }
  • trunk/wp-includes/category.php

    r11031 r12515  
    1616function get_all_category_ids() {
    1717    if ( ! $cat_ids = wp_cache_get( 'all_category_ids', 'category' ) ) {
    18         $cat_ids = get_terms( 'category', 'fields=ids&get=all' );
     18        $cat_ids = get_terms( 'category', array('fields' => 'ids', 'get' => 'all') );
    1919        wp_cache_add( 'all_category_ids', $cat_ids, 'category' );
    2020    }
     
    114114        $full_path .= ( $pathdir != '' ? '/' : '' ) . sanitize_title( $pathdir );
    115115
    116     $categories = get_terms( 'category', "get=all&slug=$leaf_path" );
     116    $categories = get_terms( 'category', array('get' => 'all', 'slug' => $leaf_path) );
    117117
    118118    if ( empty( $categories ) )
  • trunk/wp-includes/deprecated.php

    r12459 r12515  
    987987        $category = '';
    988988
    989     $results = get_bookmarks("category=$category&orderby=$orderby&order=$order&show_updated=$show_updated&limit=$limit");
     989    $results = get_bookmarks(array('category' => $category, 'orderby' => $orderby, 'order' => $order, 'show_updated' => $show_updated, 'limit' => $limit));
    990990
    991991    if ( !$results )
     
    10841084        $direction = '';
    10851085
    1086     $cats = get_categories("type=link&orderby=$order&order=$direction&hierarchical=0");
     1086    $cats = get_categories(array('type' => 'link', 'orderby' => $order, 'order' => $direction, 'hierarchical' => 0));
    10871087
    10881088    // Display each category
  • trunk/wp-includes/link-template.php

    r12513 r12515  
    934934
    935935        if ( $in_same_cat ) {
    936             $cat_array = wp_get_object_terms($post->ID, 'category', 'fields=ids');
     936            $cat_array = wp_get_object_terms($post->ID, 'category', array('fields' => 'ids'));
    937937            $join .= " AND tt.taxonomy = 'category' AND tt.term_id IN (" . implode(',', $cat_array) . ")";
    938938        }
     
    10761076    if ( !empty($in_same_cat) || !empty($excluded_categories) ) {
    10771077        if ( !empty($in_same_cat) ) {
    1078             $cat_array = wp_get_object_terms($post->ID, 'category', 'fields=ids');
     1078            $cat_array = wp_get_object_terms($post->ID, 'category', array('fields' => 'ids'));
    10791079        }
    10801080
  • trunk/wp-includes/post.php

    r12509 r12515  
    18961896    // Update counts for the post's terms.
    18971897    foreach ( (array) get_object_taxonomies('post') as $taxonomy ) {
    1898         $tt_ids = wp_get_object_terms($post_id, $taxonomy, 'fields=tt_ids');
     1898        $tt_ids = wp_get_object_terms($post_id, $taxonomy, array('fields' => 'tt_ids'));
    18991899        wp_update_term_count($tt_ids, $taxonomy);
    19001900    }
  • trunk/wp-includes/taxonomy.php

    r12510 r12515  
    10801080
    10811081    foreach ( (array) $taxonomies as $taxonomy ) {
    1082         $tt_ids = wp_get_object_terms($object_id, $taxonomy, 'fields=tt_ids');
     1082        $tt_ids = wp_get_object_terms($object_id, $taxonomy, array('fields' => 'tt_ids'));
    10831083        $in_tt_ids = "'" . implode("', '", $tt_ids) . "'";
    10841084        do_action( 'delete_term_relationships', $object_id, $tt_ids );
     
    15111511        $values = array();
    15121512        $term_order = 0;
    1513         $final_tt_ids = wp_get_object_terms($object_id, $taxonomy, 'fields=tt_ids');
     1513        $final_tt_ids = wp_get_object_terms($object_id, $taxonomy, array('fields' => 'tt_ids'));
    15141514        foreach ( $tt_ids as $tt_id )
    15151515            if ( in_array($tt_id, $final_tt_ids) )
     
    19591959        return false;
    19601960
    1961     $terms = wp_get_object_terms($ids, $taxonomies, 'fields=all_with_object_id');
     1961    $terms = wp_get_object_terms($ids, $taxonomies, array('fields' => 'all_with_object_id'));
    19621962
    19631963    $object_terms = array();
     
    20302030
    20312031    $children = array();
    2032     $terms = get_terms($taxonomy, 'get=all');
     2032    $terms = get_terms($taxonomy, array('get' => 'all'));
    20332033    foreach ( $terms as $term ) {
    20342034        if ( $term->parent > 0 )
  • trunk/wp-links-opml.php

    r11204 r12515  
    3737
    3838if (empty ($link_cat))
    39     $cats = get_categories("type=link&hierarchical=0");
     39    $cats = get_categories(array('type' => 'link', 'hierarchical' => 0));
    4040else
    41     $cats = get_categories('type=link&hierarchical=0&include='.$link_cat);
     41    $cats = get_categories(array('type' => 'link', 'hierarchical' => 0, 'include' => $link_cat));
    4242
    4343foreach ((array) $cats as $cat) {
     
    4848<?php
    4949
    50     $bookmarks = get_bookmarks("category={$cat->term_id}");
     50    $bookmarks = get_bookmarks(array("category" => $cat->term_id));
    5151    foreach ((array) $bookmarks as $bookmark) {
    5252        $title = esc_attr(apply_filters('link_title', $bookmark->link_name));
  • trunk/xmlrpc.php

    r12303 r12515  
    28072807        $categories_struct = array();
    28082808
    2809         if ( $cats = get_categories('get=all') ) {
     2809        if ( $cats = get_categories(array('get' => 'all')) ) {
    28102810            foreach ( $cats as $cat ) {
    28112811                $struct['categoryId'] = $cat->term_id;
     
    29992999        $categories_struct = array();
    30003000
    3001         if ( $cats = get_categories('hide_empty=0&hierarchical=0') ) {
     3001        if ( $cats = get_categories(array('hide_empty' => 0, 'hierarchical' => 0)) ) {
    30023002            foreach ($cats as $cat) {
    30033003                $struct['categoryId'] = $cat->term_id;
Note: See TracChangeset for help on using the changeset viewer.