Changeset 3570 for trunk/wp-admin/admin-functions.php
- Timestamp:
- 02/27/2006 04:57:30 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-functions.php
r3564 r3570 477 477 $link->link_notes = wp_specialchars($link->link_notes); 478 478 $link->link_rss = wp_specialchars($link->link_rss); 479 $link->post_category = $link->link_category; 479 480 480 481 return $link; … … 492 493 $link->link_name = ''; 493 494 495 $link->link_visible = 'Y'; 496 494 497 return $link; 495 498 } … … 508 511 $_POST['link_image'] = wp_specialchars($_POST['link_image']); 509 512 $_POST['link_rss'] = wp_specialchars($_POST['link_rss']); 510 $auto_toggle = get_autotoggle($_POST['link_category']); 511 512 // if we are in an auto toggle category and this one is visible then we 513 // need to make the others invisible before we add this new one. 514 // FIXME Add category toggle func. 515 //if (($auto_toggle == 'Y') && ($link_visible == 'Y')) { 516 // $wpdb->query("UPDATE $wpdb->links set link_visible = 'N' WHERE link_category = $link_category"); 517 //} 513 $_POST['link_category'] = $_POST['post_category']; 518 514 519 515 if ( !empty($link_id) ) { … … 555 551 556 552 function get_nested_categories($default = 0, $parent = 0) { 557 global $post_ID, $ mode, $wpdb;553 global $post_ID, $link_id, $mode, $wpdb; 558 554 559 555 if ($post_ID) { … … 568 564 $checked_categories[] = $default; 569 565 } 570 566 } else if ($link_id) { 567 $checked_categories = $wpdb->get_col(" 568 SELECT category_id 569 FROM $wpdb->categories, $wpdb->link2cat 570 WHERE $wpdb->link2cat.category_id = cat_ID AND $wpdb->link2cat.link_id = '$link_id' 571 "); 572 573 if (count($checked_categories) == 0) { 574 // No selected categories, strange 575 $checked_categories[] = $default; 576 } 571 577 } else { 572 578 $checked_categories[] = $default; … … 621 627 $edit = "<a href='categories.php?action=edit&cat_ID=$category->cat_ID' class='edit'>".__('Edit')."</a></td>"; 622 628 $default_cat_id = get_option('default_category'); 623 624 if ($category->cat_ID != $default_cat_id) 625 $edit .= "<td><a href='categories.php?action=delete&cat_ID=$category->cat_ID' onclick=\"return deleteSomething( 'cat', $category->cat_ID, '".sprintf(__("You are about to delete the category "%s". All of its posts will go to the default category.\\n"OK" to delete, "Cancel" to stop."), wp_specialchars($category->cat_name, 1))."' );\" class='delete'>".__('Delete')."</a>"; 629 $default_link_cat_id = get_option('default_link_category'); 630 631 if ( ($category->cat_ID != $default_cat_id) && ($category->cat_ID != $default_link_cat_id) ) 632 $edit .= "<td><a href='categories.php?action=delete&cat_ID=$category->cat_ID' onclick=\"return deleteSomething( 'cat', $category->cat_ID, '".sprintf(__("You are about to delete the category "%s". All of its posts and bookmarks will go to the default categories.\\n"OK" to delete, "Cancel" to stop."), wp_specialchars($category->cat_name, 1))."' );\" class='delete'>".__('Delete')."</a>"; 626 633 else 627 634 $edit .= "<td style='text-align:center'>".__("Default"); … … 634 641 <td>$category->category_description</td> 635 642 <td>$category->category_count</td> 643 <td>$category->link_count</td> 636 644 <td>$edit</td> 637 645 </tr>"; … … 688 696 foreach ($categories as $category) { 689 697 if ($currentcat != $category->cat_ID && $parent == $category->category_parent) { 690 $count = $wpdb->get_var("SELECT COUNT(post_id) FROM $wpdb->post2cat WHERE category_id = $category->cat_ID");691 698 $pad = str_repeat('– ', $level); 692 699 $category->cat_name = wp_specialchars($category->cat_name); … … 703 710 } 704 711 705 function link_category_dropdown($fieldname, $selected= 0) {712 function return_link_categories_list($parent = 0) { 706 713 global $wpdb; 707 708 $results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $wpdb->linkcategories ORDER BY cat_id"); 709 echo "\n<select name='$fieldname' size='1'>\n"; 710 foreach ($results as $row) { 711 echo "\n\t<option value='$row->cat_id'"; 712 if ($row->cat_id == $selected) 713 echo " selected='selected'"; 714 echo ">$row->cat_id : " . wp_specialchars($row->cat_name); 715 if ($row->auto_toggle == 'Y') 716 echo ' (auto toggle)'; 717 echo "</option>"; 718 } 719 echo "\n</select>\n"; 714 return $wpdb->get_col("SELECT cat_ID FROM $wpdb->categories WHERE category_parent = $parent ORDER BY link_count DESC LIMIT 100"); 720 715 } 721 716
Note: See TracChangeset
for help on using the changeset viewer.