Changeset 4041 for trunk/wp-admin/admin-functions.php
- Timestamp:
- 07/25/2006 06:36:10 AM (20 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/admin-functions.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-functions.php
r4035 r4041 685 685 // Dandy new recursive multiple category stuff. 686 686 function cat_rows($parent = 0, $level = 0, $categories = 0) { 687 global $wpdb, $class;688 689 687 if (!$categories) 690 688 $categories = get_categories('hide_empty=0'); … … 693 691 foreach ($categories as $category) { 694 692 if ($category->category_parent == $parent) { 695 $category->cat_name = wp_specialchars($category->cat_name,'double'); 696 $pad = str_repeat('— ', $level); 697 if ( current_user_can('manage_categories') ) { 698 $edit = "<a href='categories.php?action=edit&cat_ID=$category->cat_ID' class='edit'>".__('Edit')."</a></td>"; 699 $default_cat_id = get_option('default_category'); 700 $default_link_cat_id = get_option('default_link_category'); 701 702 if ( ($category->cat_ID != $default_cat_id) && ($category->cat_ID != $default_link_cat_id) ) 703 $edit .= "<td><a href='" . wp_nonce_url("categories.php?action=delete&cat_ID=$category->cat_ID", 'delete-category_' . $category->cat_ID ) . "' onclick=\"return deleteSomething( 'cat', $category->cat_ID, '" . sprintf(__("You are about to delete the category "%s".\\nAll of its posts will go into the default category of "%s"\\nAll of its bookmarks will go into the default category of "%s".\\n"OK" to delete, "Cancel" to stop."), js_escape($category->cat_name), js_escape(get_catname($default_cat_id)), js_escape(get_catname($default_link_cat_id))) . "' );\" class='delete'>".__('Delete')."</a>"; 704 else 705 $edit .= "<td style='text-align:center'>".__("Default"); 706 } 707 else 708 $edit = ''; 709 710 $class = ('alternate' == $class) ? '' : 'alternate'; 711 712 $category->category_count = number_format( $category->category_count ); 713 $category->link_count = number_format( $category->link_count ); 714 echo "<tr id='cat-$category->cat_ID' class='$class'><th scope='row'>$category->cat_ID</th><td>$pad $category->cat_name</td> 715 <td>$category->category_description</td> 716 <td align='center'>$category->category_count</td> 717 <td align='center'>$category->link_count</td> 718 <td>$edit</td> 719 </tr>"; 693 echo "\t" . _cat_row( $category, $level ); 720 694 cat_rows($category->cat_ID, $level +1, $categories); 721 695 } … … 724 698 return false; 725 699 } 700 } 701 702 function _cat_row( $category, $level, $name_override = false ) { 703 global $class; 704 705 $pad = str_repeat('— ', $level); 706 if ( current_user_can('manage_categories') ) { 707 $edit = "<a href='categories.php?action=edit&cat_ID=$category->cat_ID' class='edit'>".__('Edit')."</a></td>"; 708 $default_cat_id = get_option('default_category'); 709 $default_link_cat_id = get_option('default_link_category'); 710 711 if ( ($category->cat_ID != $default_cat_id) && ($category->cat_ID != $default_link_cat_id) ) 712 $edit .= "<td><a href='" . wp_nonce_url("categories.php?action=delete&cat_ID=$category->cat_ID", 'delete-category_' . $category->cat_ID ) . "' onclick=\"return deleteSomething( 'cat', $category->cat_ID, '" . sprintf(__("You are about to delete the category "%s".\\nAll of its posts will go into the default category of "%s"\\nAll of its bookmarks will go into the default category of "%s".\\n"OK" to delete, "Cancel" to stop."), js_escape($category->cat_name), js_escape(get_catname($default_cat_id)), js_escape(get_catname($default_link_cat_id))) . "' );\" class='delete'>".__('Delete')."</a>"; 713 else 714 $edit .= "<td style='text-align:center'>".__("Default"); 715 } else 716 $edit = ''; 717 718 $class = ( ( defined('DOING_AJAX') && DOING_AJAX ) || " class='alternate'" == $class ) ? '' : " class='alternate'"; 719 720 $category->category_count = number_format( $category->category_count ); 721 $category->link_count = number_format( $category->link_count ); 722 return "<tr id='cat-$category->cat_ID'$class> 723 <th scope='row'>$category->cat_ID</th> 724 <td>" . ( $name_override ? $name_override : $pad . ' ' . $category->cat_name ) . "</td> 725 <td>$category->category_description</td> 726 <td align='center'>$category->category_count</td> 727 <td align='center'>$category->link_count</td> 728 <td>$edit</td>\n\t</tr>\n"; 726 729 } 727 730
Note: See TracChangeset
for help on using the changeset viewer.