Skip to content
Browse files

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
  • Loading branch information...
1 parent 0b517ae commit cedfa0181b317cfdecc59eba65527d9360ce0713 ryan committed
View
2 wp-admin/import/opml.php
@@ -55,7 +55,7 @@ function dispatch() {
<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
-$categories = get_terms('link_category', 'get=all');
+$categories = get_terms('link_category', array('get' => 'all'));
foreach ($categories as $category) {
?>
<option value="<?php echo $category->term_id; ?>"><?php echo esc_html(apply_filters('link_category', $category->name)); ?></option>
View
4 wp-admin/import/wordpress.php
@@ -302,7 +302,7 @@ function checkauthor($author) {
function process_categories() {
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) ) {
$cat_name = trim($this->get_tag( $c, 'wp:cat_name' ));
@@ -332,7 +332,7 @@ function process_categories() {
function process_tags() {
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) ) {
$tag_name = trim($this->get_tag( $c, 'wp:tag_name' ));
View
4 wp-admin/import/wp-cat2tag.php
@@ -39,7 +39,7 @@ function footer() {
function populate_cats() {
- $categories = get_categories('get=all');
+ $categories = get_categories(array('get' => 'all'));
foreach ( $categories as $category ) {
$this->all_categories[] = $category;
if ( is_term( $category->slug, 'post_tag' ) )
@@ -49,7 +49,7 @@ function populate_cats() {
function populate_tags() {
- $tags = get_terms( array('post_tag'), 'get=all' );
+ $tags = get_terms( array('post_tag'), array('get' => 'all') );
foreach ( $tags as $tag ) {
$this->all_tags[] = $tag;
if ( is_term( $tag->slug, 'category' ) )
View
2 wp-admin/includes/bookmark.php
@@ -102,7 +102,7 @@ function wp_delete_link( $link_id ) {
*/
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 );
}
View
6 wp-admin/includes/export.php
@@ -43,8 +43,8 @@ function export_wp($author='') {
// 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");
-$categories = (array) get_categories('get=all');
-$tags = (array) get_tags('get=all');
+$categories = (array) get_categories(array('get' => 'all'));
+$tags = (array) get_tags(array('get' => 'all'));
$custom_taxonomies = $wp_taxonomies;
unset($custom_taxonomies['category']);
@@ -76,7 +76,7 @@ function 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) )
$categories = array_merge($categories, $found_parents);
else
View
6 wp-admin/includes/template.php
@@ -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 ) );
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 );
array_unshift( $categories, $self );
} else {
- $categories = get_categories('get=all');
+ $categories = get_categories(array('get' => 'all'));
}
if ( $checked_ontop ) {
@@ -612,7 +612,7 @@ function wp_link_category_checklist( $link_id = 0 ) {
$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) )
return;
View
2 wp-admin/link-manager.php
@@ -107,7 +107,7 @@
<input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
<?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 .= '<option value="all"' . (($cat_id == 'all') ? " selected='selected'" : '') . '>' . __('View all Categories') . "</option>\n";
foreach ((array) $categories as $cat)
View
2 wp-app.php
@@ -374,7 +374,7 @@ function get_categories_xml() {
$home = esc_attr(get_bloginfo_rss('home'));
$categories = "";
- $cats = get_categories("hierarchical=0&hide_empty=0");
+ $cats = get_categories(array('hierarchical' => 0, 'hide_empty' => 0));
foreach ((array) $cats as $cat) {
$categories .= " <category term=\"" . esc_attr($cat->name) . "\" />\n";
}
View
2 wp-includes/bookmark.php
@@ -33,7 +33,7 @@ function get_bookmark($bookmark, $output = OBJECT, $filter = 'raw') {
$_bookmark = & $GLOBALS['link'];
} 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->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');
}
}
View
4 wp-includes/category.php
@@ -15,7 +15,7 @@
*/
function get_all_category_ids() {
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' );
}
@@ -113,7 +113,7 @@ function get_category_by_path( $category_path, $full_match = true, $output = OBJ
foreach ( (array) $category_paths as $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 ) )
return null;
View
4 wp-includes/deprecated.php
@@ -986,7 +986,7 @@ function get_links($category = -1, $before = '', $after = '<br />', $between = '
if ( $category == -1 ) //get_bookmarks uses '' to signify all categories
$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 )
return;
@@ -1083,7 +1083,7 @@ function get_links_list($order = 'name', $deprecated = '') {
if ( !isset($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
if ( $cats ) {
View
4 wp-includes/link-template.php
@@ -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";
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) . ")";
}
@@ -1075,7 +1075,7 @@ function get_boundary_post($in_same_cat = false, $excluded_categories = '', $sta
$excluded_categories = array();
if ( !empty($in_same_cat) || !empty($excluded_categories) ) {
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) ) {
View
2 wp-includes/post.php
@@ -1895,7 +1895,7 @@ function wp_publish_post($post_id) {
// Update counts for the post's terms.
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);
}
View
8 wp-includes/taxonomy.php
@@ -1079,7 +1079,7 @@ function wp_delete_object_term_relationships( $object_id, $taxonomies ) {
$taxonomies = array($taxonomies);
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) . "'";
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) );
@@ -1510,7 +1510,7 @@ function wp_set_object_terms($object_id, $terms, $taxonomy, $append = false) {
if ( ! $append && isset($t->sort) && $t->sort ) {
$values = array();
$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 )
if ( in_array($tt_id, $final_tt_ids) )
$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 ) )
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();
foreach ( (array) $terms as $term )
@@ -2029,7 +2029,7 @@ function _get_term_hierarchy($taxonomy) {
return $children;
$children = array();
- $terms = get_terms($taxonomy, 'get=all');
+ $terms = get_terms($taxonomy, array('get' => 'all'));
foreach ( $terms as $term ) {
if ( $term->parent > 0 )
$children[$term->parent][] = $term->term_id;
View
6 wp-links-opml.php
@@ -36,9 +36,9 @@
<?php
if (empty ($link_cat))
- $cats = get_categories("type=link&hierarchical=0");
+ $cats = get_categories(array('type' => 'link', 'hierarchical' => 0));
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) {
$catname = apply_filters('link_category', $cat->name);
@@ -47,7 +47,7 @@
<outline type="category" title="<?php echo esc_attr($catname); ?>">
<?php
- $bookmarks = get_bookmarks("category={$cat->term_id}");
+ $bookmarks = get_bookmarks(array("category" => $cat->term_id));
foreach ((array) $bookmarks as $bookmark) {
$title = esc_attr(apply_filters('link_title', $bookmark->link_name));
?>
View
4 xmlrpc.php
@@ -2806,7 +2806,7 @@ function mw_getCategories($args) {
$categories_struct = array();
- if ( $cats = get_categories('get=all') ) {
+ if ( $cats = get_categories(array('get' => 'all')) ) {
foreach ( $cats as $cat ) {
$struct['categoryId'] = $cat->term_id;
$struct['parentId'] = $cat->parent;
@@ -2998,7 +2998,7 @@ function mt_getCategoryList($args) {
$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) {
$struct['categoryId'] = $cat->term_id;
$struct['categoryName'] = $cat->name;

0 comments on commit cedfa01

Please sign in to comment.
Something went wrong with that request. Please try again.