From 5ebed51846cfc25cec4b09f43dd8a2e78e8da72e Mon Sep 17 00:00:00 2001 From: ryan Date: Mon, 25 Jun 2007 21:34:06 +0000 Subject: [PATCH] Eliminate cat select. Use API. git-svn-id: http://svn.automattic.com/wordpress/trunk@5758 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- xmlrpc.php | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/xmlrpc.php b/xmlrpc.php index 6e5f63ec46..3a5c315208 100644 --- a/xmlrpc.php +++ b/xmlrpc.php @@ -1479,15 +1479,14 @@ class wp_xmlrpc_server extends IXR_Server { $categories_struct = array(); - // FIXME: can we avoid using direct SQL there? - if ($cats = $wpdb->get_results("SELECT cat_ID,cat_name,category_parent FROM $wpdb->categories", ARRAY_A)) { - foreach ($cats as $cat) { - $struct['categoryId'] = $cat['cat_ID']; - $struct['parentId'] = $cat['category_parent']; - $struct['description'] = $cat['cat_name']; - $struct['categoryName'] = $cat['cat_name']; - $struct['htmlUrl'] = wp_specialchars(get_category_link($cat['cat_ID'])); - $struct['rssUrl'] = wp_specialchars(get_category_rss_link(false, $cat['cat_ID'], $cat['cat_name'])); + if ( $cats = get_categories('get=all') ) { + foreach ( $cats as $cat ) { + $struct['categoryId'] = $cat->term_id; + $struct['parentId'] = $cat->parent; + $struct['description'] = $cat->name; + $struct['categoryName'] = $cat->name; + $struct['htmlUrl'] = wp_specialchars(get_category_link($cat->term_id)); + $struct['rssUrl'] = wp_specialchars(get_category_rss_link(false, $cat->term_id, $cat->name)); $categories_struct[] = $struct; }