| [ Index ] |
WordPress Source Cross Reference |
[Summary view] [Print] [Text view]
1 <?php 2 require_once ('admin.php'); 3 4 $title = __('Categories'); 5 $parent_file = 'edit.php'; 6 7 wp_reset_vars(array('action', 'cat')); 8 9 switch($action) { 10 11 case 'addcat': 12 13 check_admin_referer('add-category'); 14 15 if ( !current_user_can('manage_categories') ) 16 wp_die(__('Cheatin’ uh?')); 17 18 wp_insert_category($_POST); 19 20 wp_redirect('categories.php?message=1#addcat'); 21 break; 22 23 case 'delete': 24 $cat_ID = (int) $_GET['cat_ID']; 25 check_admin_referer('delete-category_' . $cat_ID); 26 27 if ( !current_user_can('manage_categories') ) 28 wp_die(__('Cheatin’ uh?')); 29 30 $cat_name = get_catname($cat_ID); 31 32 // Don't delete the default cats. 33 if ( $cat_ID == get_option('default_category') ) 34 wp_die(sprintf(__("Can't delete the <strong>%s</strong> category: this is the default one"), $cat_name)); 35 36 if ( $cat_ID == get_option('default_link_category') ) 37 wp_die(sprintf(__("Can't delete the <strong>%s</strong> category: this is the default one for bookmarks"), $cat_name)); 38 39 wp_delete_category($cat_ID); 40 41 wp_redirect('categories.php?message=2'); 42 43 break; 44 45 case 'edit': 46 47 require_once ('admin-header.php'); 48 $cat_ID = (int) $_GET['cat_ID']; 49 $category = get_category_to_edit($cat_ID); 50 include ('edit-category-form.php'); 51 52 break; 53 54 case 'editedcat': 55 $cat_ID = (int) $_POST['cat_ID']; 56 check_admin_referer('update-category_' . $cat_ID); 57 58 if ( !current_user_can('manage_categories') ) 59 wp_die(__('Cheatin’ uh?')); 60 61 wp_update_category($_POST); 62 63 wp_redirect('categories.php?message=3'); 64 break; 65 66 default: 67 68 wp_enqueue_script( 'admin-categories' ); 69 require_once ('admin-header.php'); 70 71 $messages[1] = __('Category added.'); 72 $messages[2] = __('Category deleted.'); 73 $messages[3] = __('Category updated.'); 74 ?> 75 76 <?php if (isset($_GET['message'])) : ?> 77 <div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div> 78 <?php endif; ?> 79 80 <div class="wrap"> 81 <?php if ( current_user_can('manage_categories') ) : ?> 82 <h2><?php printf(__('Categories (<a href="%s">add new</a>)'), '#addcat') ?> </h2> 83 <?php else : ?> 84 <h2><?php _e('Categories') ?> </h2> 85 <?php endif; ?> 86 <table class="widefat"> 87 <thead> 88 <tr> 89 <th scope="col"><?php _e('ID') ?></th> 90 <th scope="col" style="text-align: left"><?php _e('Name') ?></th> 91 <th scope="col" style="text-align: left"><?php _e('Description') ?></th> 92 <th scope="col" width="90"><?php _e('Posts') ?></th> 93 <th scope="col" width="90"><?php _e('Bookmarks') ?></th> 94 <th colspan="2"><?php _e('Action') ?></th> 95 </tr> 96 </thead> 97 <tbody id="the-list"> 98 <?php 99 cat_rows(); 100 ?> 101 </tbody> 102 </table> 103 104 </div> 105 106 <?php if ( current_user_can('manage_categories') ) : ?> 107 <div class="wrap"> 108 <p><?php printf(__('<strong>Note:</strong><br />Deleting a category does not delete the posts and bookmarks in that category. Instead, posts in the deleted category are set to the category <strong>%s</strong> and bookmarks are set to <strong>%s</strong>.'), get_catname(get_option('default_category')), get_catname(get_option('default_link_category'))) ?></p> 109 </div> 110 111 <?php include ('edit-category-form.php'); ?> 112 <?php endif; ?> 113 114 <?php 115 break; 116 } 117 118 include ('admin-footer.php'); 119 120 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Sat Jul 15 11:57:04 2006 | Courtesy of Taragana |