web/wp-admin/edit-link-categories.php
branchwordpress
changeset 132 4d4862461b8d
parent 109 03b0d1493584
equal deleted inserted replaced
131:a4642baaf829 132:4d4862461b8d
    16 
    16 
    17 	if ( !current_user_can('manage_categories') )
    17 	if ( !current_user_can('manage_categories') )
    18 		wp_die(__('Cheatin’ uh?'));
    18 		wp_die(__('Cheatin’ uh?'));
    19 
    19 
    20 	if ( 'delete' == $doaction ) {
    20 	if ( 'delete' == $doaction ) {
    21 		foreach( (array) $_GET['delete'] as $cat_ID ) {
    21 		$cats = (array) $_GET['delete'];
    22 			$cat_name = get_term_field('name', $cat_ID, 'link_category');
    22 		$default_cat_id = get_option('default_link_category');
    23 			$default_cat_id = get_option('default_link_category');
    23 
    24 
    24 		foreach( $cats as $cat_ID ) {
       
    25 			$cat_ID = (int) $cat_ID;
    25 			// Don't delete the default cats.
    26 			// Don't delete the default cats.
    26 			if ( $cat_ID == $default_cat_id )
    27 			if ( $cat_ID == $default_cat_id )
    27 				wp_die(sprintf(__("Can&#8217;t delete the <strong>%s</strong> category: this is the default one"), $cat_name));
    28 				wp_die( sprintf( __("Can&#8217;t delete the <strong>%s</strong> category: this is the default one"), get_term_field('name', $cat_ID, 'link_category') ) );
    28 
    29 
    29 			wp_delete_term($cat_ID, 'link_category', array('default' => $default_cat_id));
    30 			wp_delete_term($cat_ID, 'link_category', array('default' => $default_cat_id));
    30 		}
    31 		}
    31 
    32 
    32 		$location = 'edit-link-categories.php';
    33 		$location = 'edit-link-categories.php';
   207 </div>
   208 </div>
   208 
   209 
   209 <div class="form-field">
   210 <div class="form-field">
   210 	<label for="description"><?php _e('Description (optional)') ?></label>
   211 	<label for="description"><?php _e('Description (optional)') ?></label>
   211 	<textarea name="description" id="description" rows="5" cols="40"></textarea>
   212 	<textarea name="description" id="description" rows="5" cols="40"></textarea>
       
   213 	<p><?php _e('The description is not prominent by default; however, some themes may show it.'); ?></p>
   212 </div>
   214 </div>
   213 
   215 
   214 <p class="submit"><input type="submit" class="button" name="submit" value="<?php esc_attr_e('Add Category'); ?>" /></p>
   216 <p class="submit"><input type="submit" class="button" name="submit" value="<?php esc_attr_e('Add Category'); ?>" /></p>
   215 <?php do_action('edit_link_category_form', $category); ?>
   217 <?php do_action('edit_link_category_form', $category); ?>
   216 </form>
   218 </form>