diff options
author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2008-04-04 16:44:15 +0000 |
---|---|---|
committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2008-04-04 16:44:15 +0000 |
commit | 7740e89de3e1bc0cc636120e3ca8ab9e97e4d3cc (patch) | |
tree | c6fd23b598f3994eddb18cb1c0f2e8d95ff054fa /wp-admin/categories.php | |
parent | f650f48c048bfbbb2ae702b6425d87e39358d748 (diff) | |
download | wordpress-mu-7740e89de3e1bc0cc636120e3ca8ab9e97e4d3cc.tar.gz wordpress-mu-7740e89de3e1bc0cc636120e3ca8ab9e97e4d3cc.tar.xz wordpress-mu-7740e89de3e1bc0cc636120e3ca8ab9e97e4d3cc.zip |
Merged with WordPress 2.5, unstable, only for testing
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1218 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-admin/categories.php')
-rw-r--r-- | wp-admin/categories.php | 77 |
1 files changed, 67 insertions, 10 deletions
diff --git a/wp-admin/categories.php b/wp-admin/categories.php index 59ff4eb..945da0c 100644 --- a/wp-admin/categories.php +++ b/wp-admin/categories.php @@ -6,6 +6,9 @@ $parent_file = 'edit.php'; wp_reset_vars(array('action', 'cat')); +if ( isset($_GET['deleteit']) && isset($_GET['delete']) ) + $action = 'bulk-delete'; + switch($action) { case 'addcat': @@ -36,9 +39,6 @@ case 'delete': if ( $cat_ID == get_option('default_category') ) wp_die(sprintf(__("Can’t delete the <strong>%s</strong> category: this is the default one"), $cat_name)); - if ( $cat_ID == get_option('default_link_category') ) - wp_die(sprintf(__("Can’t delete the <strong>%s</strong> category: this is the default one for links"), $cat_name)); - wp_delete_category($cat_ID); wp_redirect('categories.php?message=2'); @@ -46,6 +46,29 @@ case 'delete': break; +case 'bulk-delete': + check_admin_referer('bulk-categories'); + + if ( !current_user_can('manage_categories') ) + wp_die( __('You are not allowed to delete categories.') ); + + foreach ( (array) $_GET['delete'] as $cat_ID ) { + $cat_name = get_catname($cat_ID); + + // Don't delete the default cats. + if ( $cat_ID == get_option('default_category') ) + wp_die(sprintf(__("Can’t delete the <strong>%s</strong> category: this is the default one"), $cat_name)); + + wp_delete_category($cat_ID); + } + + $sendback = wp_get_referer(); + $sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback); + + wp_redirect($sendback); + exit(); + +break; case 'edit': require_once ('admin-header.php'); @@ -72,7 +95,14 @@ break; default: +if ( !empty($_GET['_wp_http_referer']) ) { + wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']))); + exit; +} + wp_enqueue_script( 'admin-categories' ); +wp_enqueue_script('admin-forms'); + require_once ('admin-header.php'); $messages[1] = __('Category added.'); @@ -84,30 +114,57 @@ $messages[5] = __('Category not updated.'); <?php if (isset($_GET['message'])) : ?> <div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div> -<?php endif; ?> +<?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']); +endif; ?> <div class="wrap"> +<form id="posts-filter" action="" method="get"> <?php if ( current_user_can('manage_categories') ) : ?> - <h2><?php printf(__('Categories (<a href="%s">add new</a>)'), '#addcat') ?> </h2> + <h2><?php printf(__('Manage Categories (<a href="%s">add new</a>)'), '#addcat') ?> </h2> <?php else : ?> - <h2><?php _e('Categories') ?> </h2> + <h2><?php _e('Manage Categories') ?> </h2> <?php endif; ?> + +<p id="post-search"> + <input type="text" id="post-search-input" name="s" value="<?php echo attribute_escape(stripslashes($_GET['s'])); ?>" /> + <input type="submit" value="<?php _e( 'Search Categories' ); ?>" class="button" /> +</p> + +<br class="clear" /> + +<div class="tablenav"> + +<div class="alignleft"> +<input type="submit" value="<?php _e('Delete'); ?>" name="deleteit" class="button-secondary delete" /> +<?php wp_nonce_field('bulk-categories'); ?> +</div> + +<br class="clear" /> +</div> + +<br class="clear" /> + <table class="widefat"> <thead> <tr> - <th scope="col" style="text-align: center"><?php _e('ID') ?></th> + <th scope="col" class="check-column"><input type="checkbox" onclick="checkAll(document.getElementById('posts-filter'));" /></th> <th scope="col"><?php _e('Name') ?></th> <th scope="col"><?php _e('Description') ?></th> - <th scope="col" width="90" style="text-align: center"><?php _e('Posts') ?></th> - <th colspan="2" style="text-align: center"><?php _e('Action') ?></th> + <th scope="col" class="num"><?php _e('Posts') ?></th> </tr> </thead> - <tbody id="the-list"> + <tbody id="the-list" class="list:cat"> <?php cat_rows(); ?> </tbody> </table> +</form> + +<div class="tablenav"> +<br class="clear" /> +</div> +<br class="clear" /> </div> |