summaryrefslogtreecommitdiffstats
path: root/wp-inst/wp-admin/admin-functions.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2005-07-25 08:05:45 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2005-07-25 08:05:45 +0000
commit6a0fae2afb9614d0e85ea1838611c77922b752ae (patch)
tree72bf1cc1fc6e0745b94ee5164bcccc24063817a5 /wp-inst/wp-admin/admin-functions.php
parent741bb24c7abd93a832797dca5159457912a55901 (diff)
downloadwordpress-mu-6a0fae2afb9614d0e85ea1838611c77922b752ae.tar.gz
wordpress-mu-6a0fae2afb9614d0e85ea1838611c77922b752ae.tar.xz
wordpress-mu-6a0fae2afb9614d0e85ea1838611c77922b752ae.zip
Merge changes from WP Core.
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@73 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-inst/wp-admin/admin-functions.php')
-rw-r--r--wp-inst/wp-admin/admin-functions.php40
1 files changed, 5 insertions, 35 deletions
diff --git a/wp-inst/wp-admin/admin-functions.php b/wp-inst/wp-admin/admin-functions.php
index 8d90e60..c0d8a9e 100644
--- a/wp-inst/wp-admin/admin-functions.php
+++ b/wp-inst/wp-admin/admin-functions.php
@@ -365,38 +365,9 @@ function checked($checked, $current) {
if ($checked == $current) echo ' checked="checked"';
}
-function return_categories_list( $parent = 0, $sortbyname = FALSE )
-{
- /*
- * This function returns an list of all categories
- * that have $parent as their parent
- * if no parent is specified we will assume top level caegories
- * are required.
- */
- global $wpdb;
-
- // select sort order
- $sort = "cat_id";
- if( TRUE == $sortbyname )
- {
- $sort = "cat_name";
- }
-
- // First query the database
- $cats_tmp = $wpdb->get_results("SELECT cat_ID FROM $wpdb->categories WHERE category_parent = $parent ORDER BY $sort");
-
- // Now strip this down to a simple array of IDs
- $cats = array();
- if( count($cats_tmp) > 0 )
- {
- foreach( $cats_tmp as $cat )
- {
- $cats[] = $cat->cat_ID;
- }
- }
-
- // Return the list of categories
- return $cats;
+function return_categories_list( $parent = 0 ) {
+ global $wpdb;
+ return $wpdb->get_col("SELECT cat_ID FROM $wpdb->categories WHERE category_parent = $parent ORDER BY category_count DESC");
}
function get_nested_categories($default = 0, $parent = 0) {
@@ -419,11 +390,10 @@ function get_nested_categories($default = 0, $parent = 0) {
$checked_categories[] = $default;
}
- $cats = return_categories_list($parent, TRUE);
+ $cats = return_categories_list($parent);
$result = array();
- foreach($cats as $cat)
- {
+ foreach($cats as $cat) {
$result[$cat]['children'] = get_nested_categories($default, $cat);
$result[$cat]['cat_ID'] = $cat;
$result[$cat]['checked'] = in_array($cat, $checked_categories);