Changeset 8682 for trunk/wp-admin/edit-link-categories.php
- Timestamp:
- 08/20/2008 04:06:36 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/edit-link-categories.php
r8656 r8682 10 10 require_once('admin.php'); 11 11 12 // Handle bulk deletes13 if ( isset($_GET[' deleteit']) && isset($_GET['delete']) ) {12 // Handle bulk actions 13 if ( isset($_GET['action']) && isset($_GET['delete']) ) { 14 14 check_admin_referer('bulk-link-categories'); 15 15 16 16 if ( !current_user_can('manage_categories') ) 17 17 wp_die(__('Cheatin’ uh?')); 18 19 if ( $_GET['action'] == 'delete' ) { 20 foreach( (array) $_GET['delete'] as $cat_ID ) { 21 $cat_name = get_term_field('name', $cat_ID, 'link_category'); 22 $default_cat_id = get_option('default_link_category'); 18 23 19 foreach( (array) $_GET['delete'] as $cat_ID ) {20 $cat_name = get_term_field('name', $cat_ID, 'link_category');21 $default_cat_id = get_option('default_link_category');24 // Don't delete the default cats. 25 if ( $cat_ID == $default_cat_id ) 26 wp_die(sprintf(__("Can’t delete the <strong>%s</strong> category: this is the default one"), $cat_name)); 22 27 23 // Don't delete the default cats. 24 if ( $cat_ID == $default_cat_id ) 25 wp_die(sprintf(__("Can’t delete the <strong>%s</strong> category: this is the default one"), $cat_name)); 28 wp_delete_term($cat_ID, 'link_category', array('default' => $default_cat_id)); 29 } 26 30 27 wp_delete_term($cat_ID, 'link_category', array('default' => $default_cat_id)); 31 $location = 'edit-link-categories.php'; 32 if ( $referer = wp_get_referer() ) { 33 if ( false !== strpos($referer, 'edit-link-categories.php') ) 34 $location = $referer; 35 } 36 37 $location = add_query_arg('message', 6, $location); 38 wp_redirect($location); 39 exit(); 28 40 } 29 30 $location = 'edit-link-categories.php';31 if ( $referer = wp_get_referer() ) {32 if ( false !== strpos($referer, 'edit-link-categories.php') )33 $location = $referer;34 }35 36 $location = add_query_arg('message', 6, $location);37 wp_redirect($location);38 exit();39 41 } elseif ( !empty($_GET['_wp_http_referer']) ) { 40 42 wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']))); … … 43 45 44 46 $title = __('Link Categories'); 45 $parent_file = 'edit.php';46 47 47 48 wp_enqueue_script( 'admin-categories' ); … … 65 66 66 67 <form id="posts-filter" action="" method="get"> 67 <?php if ( current_user_can('manage_categories') ) : ?> 68 <h2><?php printf(__('Manage Link Categories (<a href="%s">add new</a>)'), '#addcat') ?> </h2> 69 <?php else : ?> 70 <h2><?php _e('Manage Link Categories') ?> </h2> 71 <?php endif; ?> 68 <h2><?php printf( current_user_can('manage_categories') ? __('Link Categories (<a href="%s">Add New</a>)') : __('Manage Tags'), '#addcat' ); ?></h2> 72 69 73 70 <p id="post-search"> … … 100 97 101 98 <div class="alignleft"> 102 <input type="submit" value="<?php _e('Delete'); ?>" name="deleteit" class="button-secondary delete" /> 99 <select name="action"> 100 <option value="" selected><?php _e('Actions'); ?></option> 101 <option value="delete"><?php _e('Delete'); ?></option> 102 </select> 103 <input type="submit" value="<?php _e('Apply'); ?>" name="doaction" class="button-secondary action" /> 103 104 <?php wp_nonce_field('bulk-link-categories'); ?> 104 105 </div>
Note: See TracChangeset
for help on using the changeset viewer.