Changeset 3999 for trunk/wp-admin/admin-functions.php
- Timestamp:
- 07/06/2006 04:27:45 AM (20 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/admin-functions.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-functions.php
r3985 r3999 637 637 function dropdown_categories($default = 0) { 638 638 write_nested_categories(get_nested_categories($default)); 639 } 640 641 function return_link_categories_list($parent = 0) { 642 global $wpdb; 643 return $wpdb->get_col("SELECT cat_ID FROM $wpdb->categories WHERE category_parent = $parent AND link_count > 0"); 644 } 645 646 function get_nested_link_categories( $default = 0, $parent = 0 ) { 647 global $post_ID, $link_id, $mode, $wpdb; 648 649 if ($link_id) { 650 $checked_categories = $wpdb->get_col(" 651 SELECT category_id 652 FROM $wpdb->categories, $wpdb->link2cat 653 WHERE $wpdb->link2cat.category_id = cat_ID AND $wpdb->link2cat.link_id = '$link_id' 654 "); 655 656 if (count($checked_categories) == 0) { 657 // No selected categories, strange 658 $checked_categories[] = $default; 659 } 660 } else { 661 $checked_categories[] = $default; 662 } 663 664 $cats = return_link_categories_list($parent); 665 $result = array (); 666 667 if (is_array($cats)) { 668 foreach ($cats as $cat) { 669 $result[$cat]['children'] = get_nested_link_categories($default, $cat); 670 $result[$cat]['cat_ID'] = $cat; 671 $result[$cat]['checked'] = in_array($cat, $checked_categories); 672 $result[$cat]['cat_name'] = get_the_category_by_ID($cat); 673 } 674 } 675 676 usort($result, 'sort_cats'); 677 678 return $result; 679 } 680 681 function dropdown_link_categories($default = 0) { 682 write_nested_categories(get_nested_link_categories($default)); 639 683 } 640 684 … … 770 814 return false; 771 815 } 772 }773 774 function return_link_categories_list($parent = 0) {775 global $wpdb;776 return $wpdb->get_col("SELECT cat_ID FROM $wpdb->categories WHERE category_parent = $parent ORDER BY link_count DESC");777 816 } 778 817
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)