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

git-svn-id: http://svn.automattic.com/wordpress/trunk@12515 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2009-12-23 15:31:02 +00:00
parent 0b517ae013
commit cedfa0181b
16 changed files with 31 additions and 31 deletions

View File

@ -55,7 +55,7 @@ switch ($step) {
<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 /> <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 />
<?php _e('Category:') ?> <select name="cat_id" id="cat_id"> <?php _e('Category:') ?> <select name="cat_id" id="cat_id">
<?php <?php
$categories = get_terms('link_category', 'get=all'); $categories = get_terms('link_category', array('get' => 'all'));
foreach ($categories as $category) { foreach ($categories as $category) {
?> ?>
<option value="<?php echo $category->term_id; ?>"><?php echo esc_html(apply_filters('link_category', $category->name)); ?></option> <option value="<?php echo $category->term_id; ?>"><?php echo esc_html(apply_filters('link_category', $category->name)); ?></option>

View File

@ -302,7 +302,7 @@ class WP_Import {
function process_categories() { function process_categories() {
global $wpdb; global $wpdb;
$cat_names = (array) get_terms('category', 'fields=names'); $cat_names = (array) get_terms('category', array('fields' => 'names'));
while ( $c = array_shift($this->categories) ) { while ( $c = array_shift($this->categories) ) {
$cat_name = trim($this->get_tag( $c, 'wp:cat_name' )); $cat_name = trim($this->get_tag( $c, 'wp:cat_name' ));
@ -332,7 +332,7 @@ class WP_Import {
function process_tags() { function process_tags() {
global $wpdb; global $wpdb;
$tag_names = (array) get_terms('post_tag', 'fields=names'); $tag_names = (array) get_terms('post_tag', array('fields' => 'names'));
while ( $c = array_shift($this->tags) ) { while ( $c = array_shift($this->tags) ) {
$tag_name = trim($this->get_tag( $c, 'wp:tag_name' )); $tag_name = trim($this->get_tag( $c, 'wp:tag_name' ));

View File

@ -39,7 +39,7 @@ class WP_Categories_to_Tags {
function populate_cats() { function populate_cats() {
$categories = get_categories('get=all'); $categories = get_categories(array('get' => 'all'));
foreach ( $categories as $category ) { foreach ( $categories as $category ) {
$this->all_categories[] = $category; $this->all_categories[] = $category;
if ( is_term( $category->slug, 'post_tag' ) ) if ( is_term( $category->slug, 'post_tag' ) )
@ -49,7 +49,7 @@ class WP_Categories_to_Tags {
function populate_tags() { function populate_tags() {
$tags = get_terms( array('post_tag'), 'get=all' ); $tags = get_terms( array('post_tag'), array('get' => 'all') );
foreach ( $tags as $tag ) { foreach ( $tags as $tag ) {
$this->all_tags[] = $tag; $this->all_tags[] = $tag;
if ( is_term( $tag->slug, 'category' ) ) if ( is_term( $tag->slug, 'category' ) )

View File

@ -102,7 +102,7 @@ function wp_delete_link( $link_id ) {
*/ */
function wp_get_link_cats( $link_id = 0 ) { function wp_get_link_cats( $link_id = 0 ) {
$cats = wp_get_object_terms( $link_id, 'link_category', 'fields=ids' ); $cats = wp_get_object_terms( $link_id, 'link_category', array('fields' => 'ids') );
return array_unique( $cats ); return array_unique( $cats );
} }

View File

@ -43,8 +43,8 @@ if ( $author and $author != 'all' ) {
// grab a snapshot of post IDs, just in case it changes during the export // grab a snapshot of post IDs, just in case it changes during the export
$post_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts $where ORDER BY post_date_gmt ASC"); $post_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts $where ORDER BY post_date_gmt ASC");
$categories = (array) get_categories('get=all'); $categories = (array) get_categories(array('get' => 'all'));
$tags = (array) get_tags('get=all'); $tags = (array) get_tags(array('get' => 'all'));
$custom_taxonomies = $wp_taxonomies; $custom_taxonomies = $wp_taxonomies;
unset($custom_taxonomies['category']); unset($custom_taxonomies['category']);
@ -76,7 +76,7 @@ function wxr_missing_parents($categories) {
} }
while ( $parents = wxr_missing_parents($categories) ) { while ( $parents = wxr_missing_parents($categories) ) {
$found_parents = get_categories("include=" . join(', ', $parents)); $found_parents = get_categories(array('include' => join(', ', $parents)));
if ( is_array($found_parents) && count($found_parents) ) if ( is_array($found_parents) && count($found_parents) )
$categories = array_merge($categories, $found_parents); $categories = array_merge($categories, $found_parents);
else else

View File

@ -508,11 +508,11 @@ function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $select
$args['popular_cats'] = get_terms( 'category', array( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) ); $args['popular_cats'] = get_terms( 'category', array( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) );
if ( $descendants_and_self ) { if ( $descendants_and_self ) {
$categories = get_categories( "child_of=$descendants_and_self&hierarchical=0&hide_empty=0" ); $categories = get_categories(array('child_of' => $descendants_and_self, 'hierarchical' => 0, 'hide_empty' => 0));
$self = get_category( $descendants_and_self ); $self = get_category( $descendants_and_self );
array_unshift( $categories, $self ); array_unshift( $categories, $self );
} else { } else {
$categories = get_categories('get=all'); $categories = get_categories(array('get' => 'all'));
} }
if ( $checked_ontop ) { if ( $checked_ontop ) {
@ -612,7 +612,7 @@ function wp_link_category_checklist( $link_id = 0 ) {
$checked_categories[] = $default; $checked_categories[] = $default;
} }
$categories = get_terms('link_category', 'orderby=count&hide_empty=0'); $categories = get_terms('link_category', array('orderby' => 'count', 'hide_empty' => 0));
if ( empty($categories) ) if ( empty($categories) )
return; return;

View File

@ -107,7 +107,7 @@ if ( isset($_GET['deleted']) ) {
<input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" /> <input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
<?php <?php
$categories = get_terms('link_category', "hide_empty=1"); $categories = get_terms('link_category', array("hide_empty" => 1));
$select_cat = "<select name=\"cat_id\">\n"; $select_cat = "<select name=\"cat_id\">\n";
$select_cat .= '<option value="all"' . (($cat_id == 'all') ? " selected='selected'" : '') . '>' . __('View all Categories') . "</option>\n"; $select_cat .= '<option value="all"' . (($cat_id == 'all') ? " selected='selected'" : '') . '>' . __('View all Categories') . "</option>\n";
foreach ((array) $categories as $cat) foreach ((array) $categories as $cat)

View File

@ -374,7 +374,7 @@ EOD;
$home = esc_attr(get_bloginfo_rss('home')); $home = esc_attr(get_bloginfo_rss('home'));
$categories = ""; $categories = "";
$cats = get_categories("hierarchical=0&hide_empty=0"); $cats = get_categories(array('hierarchical' => 0, 'hide_empty' => 0));
foreach ((array) $cats as $cat) { foreach ((array) $cats as $cat) {
$categories .= " <category term=\"" . esc_attr($cat->name) . "\" />\n"; $categories .= " <category term=\"" . esc_attr($cat->name) . "\" />\n";
} }

View File

@ -33,7 +33,7 @@ function get_bookmark($bookmark, $output = OBJECT, $filter = 'raw') {
$_bookmark = & $GLOBALS['link']; $_bookmark = & $GLOBALS['link'];
} elseif ( ! $_bookmark = wp_cache_get($bookmark, 'bookmark') ) { } elseif ( ! $_bookmark = wp_cache_get($bookmark, 'bookmark') ) {
$_bookmark = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->links WHERE link_id = %d LIMIT 1", $bookmark)); $_bookmark = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->links WHERE link_id = %d LIMIT 1", $bookmark));
$_bookmark->link_category = array_unique( wp_get_object_terms($_bookmark->link_id, 'link_category', 'fields=ids') ); $_bookmark->link_category = array_unique( wp_get_object_terms($_bookmark->link_id, 'link_category', array('fields' => 'ids')) );
wp_cache_add($_bookmark->link_id, $_bookmark, 'bookmark'); wp_cache_add($_bookmark->link_id, $_bookmark, 'bookmark');
} }
} }

View File

@ -15,7 +15,7 @@
*/ */
function get_all_category_ids() { function get_all_category_ids() {
if ( ! $cat_ids = wp_cache_get( 'all_category_ids', 'category' ) ) { if ( ! $cat_ids = wp_cache_get( 'all_category_ids', 'category' ) ) {
$cat_ids = get_terms( 'category', 'fields=ids&get=all' ); $cat_ids = get_terms( 'category', array('fields' => 'ids', 'get' => 'all') );
wp_cache_add( 'all_category_ids', $cat_ids, 'category' ); wp_cache_add( 'all_category_ids', $cat_ids, 'category' );
} }
@ -113,7 +113,7 @@ function get_category_by_path( $category_path, $full_match = true, $output = OBJ
foreach ( (array) $category_paths as $pathdir ) foreach ( (array) $category_paths as $pathdir )
$full_path .= ( $pathdir != '' ? '/' : '' ) . sanitize_title( $pathdir ); $full_path .= ( $pathdir != '' ? '/' : '' ) . sanitize_title( $pathdir );
$categories = get_terms( 'category', "get=all&slug=$leaf_path" ); $categories = get_terms( 'category', array('get' => 'all', 'slug' => $leaf_path) );
if ( empty( $categories ) ) if ( empty( $categories ) )
return null; return null;

View File

@ -986,7 +986,7 @@ function get_links($category = -1, $before = '', $after = '<br />', $between = '
if ( $category == -1 ) //get_bookmarks uses '' to signify all categories if ( $category == -1 ) //get_bookmarks uses '' to signify all categories
$category = ''; $category = '';
$results = get_bookmarks("category=$category&orderby=$orderby&order=$order&show_updated=$show_updated&limit=$limit"); $results = get_bookmarks(array('category' => $category, 'orderby' => $orderby, 'order' => $order, 'show_updated' => $show_updated, 'limit' => $limit));
if ( !$results ) if ( !$results )
return; return;
@ -1083,7 +1083,7 @@ function get_links_list($order = 'name', $deprecated = '') {
if ( !isset($direction) ) if ( !isset($direction) )
$direction = ''; $direction = '';
$cats = get_categories("type=link&orderby=$order&order=$direction&hierarchical=0"); $cats = get_categories(array('type' => 'link', 'orderby' => $order, 'order' => $direction, 'hierarchical' => 0));
// Display each category // Display each category
if ( $cats ) { if ( $cats ) {

View File

@ -933,7 +933,7 @@ function get_adjacent_post($in_same_cat = false, $excluded_categories = '', $pre
$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"; $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";
if ( $in_same_cat ) { if ( $in_same_cat ) {
$cat_array = wp_get_object_terms($post->ID, 'category', 'fields=ids'); $cat_array = wp_get_object_terms($post->ID, 'category', array('fields' => 'ids'));
$join .= " AND tt.taxonomy = 'category' AND tt.term_id IN (" . implode(',', $cat_array) . ")"; $join .= " AND tt.taxonomy = 'category' AND tt.term_id IN (" . implode(',', $cat_array) . ")";
} }
@ -1075,7 +1075,7 @@ function get_boundary_post($in_same_cat = false, $excluded_categories = '', $sta
$excluded_categories = array(); $excluded_categories = array();
if ( !empty($in_same_cat) || !empty($excluded_categories) ) { if ( !empty($in_same_cat) || !empty($excluded_categories) ) {
if ( !empty($in_same_cat) ) { if ( !empty($in_same_cat) ) {
$cat_array = wp_get_object_terms($post->ID, 'category', 'fields=ids'); $cat_array = wp_get_object_terms($post->ID, 'category', array('fields' => 'ids'));
} }
if ( !empty($excluded_categories) ) { if ( !empty($excluded_categories) ) {

View File

@ -1895,7 +1895,7 @@ function wp_publish_post($post_id) {
// Update counts for the post's terms. // Update counts for the post's terms.
foreach ( (array) get_object_taxonomies('post') as $taxonomy ) { foreach ( (array) get_object_taxonomies('post') as $taxonomy ) {
$tt_ids = wp_get_object_terms($post_id, $taxonomy, 'fields=tt_ids'); $tt_ids = wp_get_object_terms($post_id, $taxonomy, array('fields' => 'tt_ids'));
wp_update_term_count($tt_ids, $taxonomy); wp_update_term_count($tt_ids, $taxonomy);
} }

View File

@ -1079,7 +1079,7 @@ function wp_delete_object_term_relationships( $object_id, $taxonomies ) {
$taxonomies = array($taxonomies); $taxonomies = array($taxonomies);
foreach ( (array) $taxonomies as $taxonomy ) { foreach ( (array) $taxonomies as $taxonomy ) {
$tt_ids = wp_get_object_terms($object_id, $taxonomy, 'fields=tt_ids'); $tt_ids = wp_get_object_terms($object_id, $taxonomy, array('fields' => 'tt_ids'));
$in_tt_ids = "'" . implode("', '", $tt_ids) . "'"; $in_tt_ids = "'" . implode("', '", $tt_ids) . "'";
do_action( 'delete_term_relationships', $object_id, $tt_ids ); do_action( 'delete_term_relationships', $object_id, $tt_ids );
$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->term_relationships WHERE object_id = %d AND term_taxonomy_id IN ($in_tt_ids)", $object_id) ); $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->term_relationships WHERE object_id = %d AND term_taxonomy_id IN ($in_tt_ids)", $object_id) );
@ -1510,7 +1510,7 @@ function wp_set_object_terms($object_id, $terms, $taxonomy, $append = false) {
if ( ! $append && isset($t->sort) && $t->sort ) { if ( ! $append && isset($t->sort) && $t->sort ) {
$values = array(); $values = array();
$term_order = 0; $term_order = 0;
$final_tt_ids = wp_get_object_terms($object_id, $taxonomy, 'fields=tt_ids'); $final_tt_ids = wp_get_object_terms($object_id, $taxonomy, array('fields' => 'tt_ids'));
foreach ( $tt_ids as $tt_id ) foreach ( $tt_ids as $tt_id )
if ( in_array($tt_id, $final_tt_ids) ) if ( in_array($tt_id, $final_tt_ids) )
$values[] = $wpdb->prepare( "(%d, %d, %d)", $object_id, $tt_id, ++$term_order); $values[] = $wpdb->prepare( "(%d, %d, %d)", $object_id, $tt_id, ++$term_order);
@ -1958,7 +1958,7 @@ function update_object_term_cache($object_ids, $object_type) {
if ( empty( $ids ) ) if ( empty( $ids ) )
return false; return false;
$terms = wp_get_object_terms($ids, $taxonomies, 'fields=all_with_object_id'); $terms = wp_get_object_terms($ids, $taxonomies, array('fields' => 'all_with_object_id'));
$object_terms = array(); $object_terms = array();
foreach ( (array) $terms as $term ) foreach ( (array) $terms as $term )
@ -2029,7 +2029,7 @@ function _get_term_hierarchy($taxonomy) {
return $children; return $children;
$children = array(); $children = array();
$terms = get_terms($taxonomy, 'get=all'); $terms = get_terms($taxonomy, array('get' => 'all'));
foreach ( $terms as $term ) { foreach ( $terms as $term ) {
if ( $term->parent > 0 ) if ( $term->parent > 0 )
$children[$term->parent][] = $term->term_id; $children[$term->parent][] = $term->term_id;

View File

@ -36,9 +36,9 @@ if ((empty ($link_cat)) || ($link_cat == 'all') || ($link_cat == '0')) {
<?php <?php
if (empty ($link_cat)) if (empty ($link_cat))
$cats = get_categories("type=link&hierarchical=0"); $cats = get_categories(array('type' => 'link', 'hierarchical' => 0));
else else
$cats = get_categories('type=link&hierarchical=0&include='.$link_cat); $cats = get_categories(array('type' => 'link', 'hierarchical' => 0, 'include' => $link_cat));
foreach ((array) $cats as $cat) { foreach ((array) $cats as $cat) {
$catname = apply_filters('link_category', $cat->name); $catname = apply_filters('link_category', $cat->name);
@ -47,7 +47,7 @@ foreach ((array) $cats as $cat) {
<outline type="category" title="<?php echo esc_attr($catname); ?>"> <outline type="category" title="<?php echo esc_attr($catname); ?>">
<?php <?php
$bookmarks = get_bookmarks("category={$cat->term_id}"); $bookmarks = get_bookmarks(array("category" => $cat->term_id));
foreach ((array) $bookmarks as $bookmark) { foreach ((array) $bookmarks as $bookmark) {
$title = esc_attr(apply_filters('link_title', $bookmark->link_name)); $title = esc_attr(apply_filters('link_title', $bookmark->link_name));
?> ?>

View File

@ -2806,7 +2806,7 @@ class wp_xmlrpc_server extends IXR_Server {
$categories_struct = array(); $categories_struct = array();
if ( $cats = get_categories('get=all') ) { if ( $cats = get_categories(array('get' => 'all')) ) {
foreach ( $cats as $cat ) { foreach ( $cats as $cat ) {
$struct['categoryId'] = $cat->term_id; $struct['categoryId'] = $cat->term_id;
$struct['parentId'] = $cat->parent; $struct['parentId'] = $cat->parent;
@ -2998,7 +2998,7 @@ class wp_xmlrpc_server extends IXR_Server {
$categories_struct = array(); $categories_struct = array();
if ( $cats = get_categories('hide_empty=0&hierarchical=0') ) { if ( $cats = get_categories(array('hide_empty' => 0, 'hierarchical' => 0)) ) {
foreach ($cats as $cat) { foreach ($cats as $cat) {
$struct['categoryId'] = $cat->term_id; $struct['categoryId'] = $cat->term_id;
$struct['categoryName'] = $cat->name; $struct['categoryName'] = $cat->name;