diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php index 2260e9f56..8322d1b55 100644 --- a/wp-admin/admin-functions.php +++ b/wp-admin/admin-functions.php @@ -638,6 +638,50 @@ function dropdown_categories($default = 0) { write_nested_categories(get_nested_categories($default)); } +function return_link_categories_list($parent = 0) { + global $wpdb; + return $wpdb->get_col("SELECT cat_ID FROM $wpdb->categories WHERE category_parent = $parent AND link_count > 0"); +} + +function get_nested_link_categories( $default = 0, $parent = 0 ) { + global $post_ID, $link_id, $mode, $wpdb; + + if ($link_id) { + $checked_categories = $wpdb->get_col(" + SELECT category_id + FROM $wpdb->categories, $wpdb->link2cat + WHERE $wpdb->link2cat.category_id = cat_ID AND $wpdb->link2cat.link_id = '$link_id' + "); + + if (count($checked_categories) == 0) { + // No selected categories, strange + $checked_categories[] = $default; + } + } else { + $checked_categories[] = $default; + } + + $cats = return_link_categories_list($parent); + $result = array (); + + if (is_array($cats)) { + foreach ($cats as $cat) { + $result[$cat]['children'] = get_nested_link_categories($default, $cat); + $result[$cat]['cat_ID'] = $cat; + $result[$cat]['checked'] = in_array($cat, $checked_categories); + $result[$cat]['cat_name'] = get_the_category_by_ID($cat); + } + } + + usort($result, 'sort_cats'); + + return $result; +} + +function dropdown_link_categories($default = 0) { + write_nested_categories(get_nested_link_categories($default)); +} + // Dandy new recursive multiple category stuff. function cat_rows($parent = 0, $level = 0, $categories = 0) { global $wpdb, $class; @@ -771,11 +815,6 @@ function wp_dropdown_cats($currentcat = 0, $currentparent = 0, $parent = 0, $lev } } -function return_link_categories_list($parent = 0) { - global $wpdb; - return $wpdb->get_col("SELECT cat_ID FROM $wpdb->categories WHERE category_parent = $parent ORDER BY link_count DESC"); -} - function wp_create_thumbnail($file, $max_side, $effect = '') { // 1 = GIF, 2 = JPEG, 3 = PNG diff --git a/wp-admin/admin-header.php b/wp-admin/admin-header.php index ee0c28644..f8322b129 100644 --- a/wp-admin/admin-header.php +++ b/wp-admin/admin-header.php @@ -30,7 +30,7 @@ function addLoadEvent(func) {if ( typeof wpOnload!='function'){wpOnload=func;}el -

%s.'), $user_identity) ?> [, ]

+

%s.'), $user_identity) ?> [, ]

-

+

diff --git a/wp-admin/edit-link-form.php b/wp-admin/edit-link-form.php index b65482644..996d056e2 100644 --- a/wp-admin/edit-link-form.php +++ b/wp-admin/edit-link-form.php @@ -1,12 +1,12 @@ '; $nonce_action = 'update-bookmark_' . $link_id; } else { - $heading = __('Create Bookmark'); - $submit_text = __('Add Bookmark »'); + $heading = __('Add Link'); + $submit_text = __('Add Link »'); $form = '