WordPress.org

Make WordPress Core

Ticket #6647: 6647.2.diff

File 6647.2.diff, 13.5 KB (added by Denis-de-Bernardy, 6 years ago)
  • wp-includes/category.php

     
    1515 */ 
    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        } 
    2121 
     
    113113        foreach ( (array) $category_paths as $pathdir ) 
    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 ) ) 
    119119                return null; 
  • wp-includes/taxonomy.php

     
    10761076                $taxonomies = array($taxonomies); 
    10771077 
    10781078        foreach ( (array) $taxonomies as $taxonomy ) { 
    1079                 $tt_ids = wp_get_object_terms($object_id, $taxonomy, 'fields=tt_ids'); 
     1079                $tt_ids = wp_get_object_terms($object_id, $taxonomy, array('fields' => 'tt_ids')); 
    10801080                $in_tt_ids = "'" . implode("', '", $tt_ids) . "'"; 
    10811081                $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->term_relationships WHERE object_id = %d AND term_taxonomy_id IN ($in_tt_ids)", $object_id) ); 
    10821082                wp_update_term_count($tt_ids, $taxonomy); 
     
    14921492        if ( ! $append && isset($t->sort) && $t->sort ) { 
    14931493                $values = array(); 
    14941494                $term_order = 0; 
    1495                 $final_tt_ids = wp_get_object_terms($object_id, $taxonomy, 'fields=tt_ids'); 
     1495                $final_tt_ids = wp_get_object_terms($object_id, $taxonomy, array('fields' => 'tt_ids')); 
    14961496                foreach ( $tt_ids as $tt_id ) 
    14971497                        if ( in_array($tt_id, $final_tt_ids) ) 
    14981498                                $values[] = $wpdb->prepare( "(%d, %d, %d)", $object_id, $tt_id, ++$term_order); 
     
    19311931        if ( empty( $ids ) ) 
    19321932                return false; 
    19331933 
    1934         $terms = wp_get_object_terms($ids, $taxonomies, 'fields=all_with_object_id'); 
     1934        $terms = wp_get_object_terms($ids, $taxonomies, array('fields' => 'all_with_object_id')); 
    19351935 
    19361936        $object_terms = array(); 
    19371937        foreach ( (array) $terms as $term ) 
     
    20022002                return $children; 
    20032003 
    20042004        $children = array(); 
    2005         $terms = get_terms($taxonomy, 'get=all'); 
     2005        $terms = get_terms($taxonomy, array('get' => 'all')); 
    20062006        foreach ( $terms as $term ) { 
    20072007                if ( $term->parent > 0 ) 
    20082008                        $children[$term->parent][] = $term->term_id; 
  • wp-includes/post.php

     
    16841684 
    16851685        // Update counts for the post's terms. 
    16861686        foreach ( (array) get_object_taxonomies('post') as $taxonomy ) { 
    1687                 $tt_ids = wp_get_object_terms($post_id, $taxonomy, 'fields=tt_ids'); 
     1687                $tt_ids = wp_get_object_terms($post_id, $taxonomy, array('fields' => 'tt_ids')); 
    16881688                wp_update_term_count($tt_ids, $taxonomy); 
    16891689        } 
    16901690 
  • wp-includes/bookmark.php

     
    3333                        $_bookmark = & $GLOBALS['link']; 
    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                } 
    3939        } 
  • wp-includes/link-template.php

     
    876876                $join = " INNER JOIN $wpdb->term_relationships AS tr ON p.ID = tr.object_id INNER JOIN $wpdb->term_taxonomy tt ON tr.term_taxonomy_id = tt.term_taxonomy_id"; 
    877877 
    878878                if ( $in_same_cat ) { 
    879                         $cat_array = wp_get_object_terms($post->ID, 'category', 'fields=ids'); 
     879                        $cat_array = wp_get_object_terms($post->ID, 'category', array('fields' => 'ids')); 
    880880                        $join .= " AND tt.taxonomy = 'category' AND tt.term_id IN (" . implode(',', $cat_array) . ")"; 
    881881                } 
    882882 
     
    10181018        $excluded_categories = array(); 
    10191019        if ( !empty($in_same_cat) || !empty($excluded_categories) ) { 
    10201020                if ( !empty($in_same_cat) ) { 
    1021                         $cat_array = wp_get_object_terms($post->ID, 'category', 'fields=ids'); 
     1021                        $cat_array = wp_get_object_terms($post->ID, 'category', array('fields' => 'ids')); 
    10221022                } 
    10231023 
    10241024                if ( !empty($excluded_categories) ) { 
  • wp-includes/deprecated.php

     
    986986        if ( $category == -1 ) //get_bookmarks uses '' to signify all categories 
    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 ) 
    992992                return; 
     
    10831083        if ( !isset($direction) ) 
    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 
    10891089        if ( $cats ) { 
  • wp-app.php

     
    395395                $home = esc_attr(get_bloginfo_rss('home')); 
    396396 
    397397                $categories = ""; 
    398                 $cats = get_categories("hierarchical=0&hide_empty=0"); 
     398                $cats = get_categories(array('hierarchical' => 0, 'hide_empty' => 0)); 
    399399                foreach ((array) $cats as $cat) { 
    400400                        $categories .= "    <category term=\"" . esc_attr($cat->name) .  "\" />\n"; 
    401401} 
  • xmlrpc.php

     
    27832783 
    27842784                $categories_struct = array(); 
    27852785 
    2786                 if ( $cats = get_categories('get=all') ) { 
     2786                if ( $cats = get_categories(array('get' => 'all') ) { 
    27872787                        foreach ( $cats as $cat ) { 
    27882788                                $struct['categoryId'] = $cat->term_id; 
    27892789                                $struct['parentId'] = $cat->parent; 
     
    29702970 
    29712971                $categories_struct = array(); 
    29722972 
    2973                 if ( $cats = get_categories('hide_empty=0&hierarchical=0') ) { 
     2973                if ( $cats = get_categories(array('hide_empty' => 0, 'hierarchical' => 0)) ) { 
    29742974                        foreach ($cats as $cat) { 
    29752975                                $struct['categoryId'] = $cat->term_id; 
    29762976                                $struct['categoryName'] = $cat->name; 
  • wp-links-opml.php

     
    3636<?php 
    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) { 
    4444        $catname = apply_filters('link_category', $cat->name); 
     
    4747<outline type="category" title="<?php echo esc_attr($catname); ?>"> 
    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)); 
    5353?> 
  • wp-admin/includes/bookmark.php

     
    102102 */ 
    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 ); 
    108108} 
  • wp-admin/includes/template.php

     
    508508                $args['popular_cats'] = get_terms( 'category', array( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) ); 
    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 
    518518        // Post process $categories rather than adding an exclude to the get_terms() query to keep the query the same across all posts (for any query cache) 
     
    607607                $checked_categories[] = $default; 
    608608        } 
    609609 
    610         $categories = get_terms('link_category', 'orderby=count&hide_empty=0'); 
     610        $categories = get_terms('link_category', array('orderby' => 'count', 'hide_empty' => 0)); 
    611611 
    612612        if ( empty($categories) ) 
    613613                return; 
  • wp-admin/includes/export.php

     
    4343// grab a snapshot of post IDs, just in case it changes during the export 
    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/** 
    5050 * {@internal Missing Short Description}} 
     
    6969} 
    7070 
    7171while ( $parents = wxr_missing_parents($categories) ) { 
    72         $found_parents = get_categories("include=" . join(', ', $parents)); 
     72        $found_parents = get_categories(array('include' => join(', ', $parents))); 
    7373        if ( is_array($found_parents) && count($found_parents) ) 
    7474                $categories = array_merge($categories, $found_parents); 
    7575        else 
  • wp-admin/import/opml.php

     
    5555<p style="clear: both; margin-top: 1em;"><label for="cat_id"><?php _e('Now select a category you want to put these links in.') ?></label><br /> 
    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?> 
    6161<option value="<?php echo $category->term_id; ?>"><?php echo esc_html(apply_filters('link_category', $category->name)); ?></option> 
  • wp-admin/import/wp-cat2tag.php

     
    3939 
    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; 
    4545                        if ( is_term( $category->slug, 'post_tag' ) ) 
     
    4949 
    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; 
    5555                        if ( is_term( $tag->slug, 'category' ) ) 
  • wp-admin/import/wordpress.php

     
    290290        function process_categories() { 
    291291                global $wpdb; 
    292292 
    293                 $cat_names = (array) get_terms('category', 'fields=names'); 
     293                $cat_names = (array) get_terms('category', array('fields' => 'names')); 
    294294 
    295295                while ( $c = array_shift($this->categories) ) { 
    296296                        $cat_name = trim($this->get_tag( $c, 'wp:cat_name' )); 
     
    320320        function process_tags() { 
    321321                global $wpdb; 
    322322 
    323                 $tag_names = (array) get_terms('post_tag', 'fields=names'); 
     323                $tag_names = (array) get_terms('post_tag', array('fields' => 'names')); 
    324324 
    325325                while ( $c = array_shift($this->tags) ) { 
    326326                        $tag_name = trim($this->get_tag( $c, 'wp:tag_name' )); 
  • wp-admin/link-manager.php

     
    106106<input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" /> 
    107107 
    108108<?php 
    109 $categories = get_terms('link_category', "hide_empty=1"); 
     109$categories = get_terms('link_category', array("hide_empty" => 1)); 
    110110$select_cat = "<select name=\"cat_id\">\n"; 
    111111$select_cat .= '<option value="all"'  . (($cat_id == 'all') ? " selected='selected'" : '') . '>' . __('View all Categories') . "</option>\n"; 
    112112foreach ((array) $categories as $cat)