X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/959f97d8ecd5c1668103a3e41c795486b944bc68..4f4e083f6f77639c41e2b1ddb200de8e34301cee:/wp-admin/categories.php diff --git a/wp-admin/categories.php b/wp-admin/categories.php index 945da0c6..8d26b9e1 100644 --- a/wp-admin/categories.php +++ b/wp-admin/categories.php @@ -1,12 +1,19 @@ %s category: this is the default one"), $cat_name)); wp_delete_category($cat_ID); - wp_redirect('categories.php?message=2'); + wp_safe_redirect( add_query_arg( 'message', 2, wp_get_referer() ) ); exit; break; @@ -53,7 +60,7 @@ case 'bulk-delete': wp_die( __('You are not allowed to delete categories.') ); foreach ( (array) $_GET['delete'] as $cat_ID ) { - $cat_name = get_catname($cat_ID); + $cat_name = get_cat_name($cat_ID); // Don't delete the default cats. if ( $cat_ID == get_option('default_category') ) @@ -62,15 +69,14 @@ case 'bulk-delete': wp_delete_category($cat_ID); } - $sendback = wp_get_referer(); - $sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback); - - wp_redirect($sendback); + wp_safe_redirect( wp_get_referer() ); exit(); break; case 'edit': + $title = __('Edit Category'); + require_once ('admin-header.php'); $cat_ID = (int) $_GET['cat_ID']; $category = get_category_to_edit($cat_ID); @@ -85,23 +91,32 @@ case 'editedcat': if ( !current_user_can('manage_categories') ) wp_die(__('Cheatin’ uh?')); + $location = 'categories.php'; + if ( $referer = wp_get_original_referer() ) { + if ( false !== strpos($referer, 'categories.php') ) + $location = $referer; + } + if ( wp_update_category($_POST) ) - wp_redirect('categories.php?message=3'); + $location = add_query_arg('message', 3, $location); else - wp_redirect('categories.php?message=5'); + $location = add_query_arg('message', 5, $location); + + wp_redirect($location); exit; break; default: -if ( !empty($_GET['_wp_http_referer']) ) { - wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']))); +if ( isset($_GET['_wp_http_referer']) && ! 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'); +wp_enqueue_script('admin-categories'); +if ( current_user_can('manage_categories') ) + wp_enqueue_script('inline-edit-tax'); require_once ('admin-header.php'); @@ -112,73 +127,177 @@ $messages[4] = __('Category not added.'); $messages[5] = __('Category not updated.'); ?> - -

+
+ +

' . __('Search results for “%s”') . '', esc_html( stripslashes($_GET['s']) ) ); ?> +

+ + +

-
-
- -

add new)'), '#addcat') ?>

- -

- - -

- - + +

- +

+
+ +
+
+
-
- + 0, 'search' => $_GET['s']))); +else + $num_cats = wp_count_terms('category'); + +$page_links = paginate_links( array( + 'base' => add_query_arg( 'pagenum', '%#%' ), + 'format' => '', + 'prev_text' => __('«'), + 'next_text' => __('»'), + 'total' => ceil($num_cats / $cats_per_page), + 'current' => $pagenum +)); + +if ( $page_links ) + echo "
$page_links
"; +?> + +
+ +

-
+
- +
- - - - + + + + + + + +
-
-
+$page_links
"; +?> + +
+ + +
-
+
- -
-

Note:
Deleting a category does not delete the posts in that category. Instead, posts that were only assigned to the deleted category are set to the category %s.'), apply_filters('the_category', get_catname(get_option('default_category')))) ?>

+ + +
+

Note:
Deleting a category does not delete the posts in that category. Instead, posts that were only assigned to the deleted category are set to the category %s.'), apply_filters('the_category', get_cat_name(get_option('default_category')))) ?>

category to tag converter.'), 'admin.php?import=wp-cat2tag') ?>

- +
+
+ +
+
- + +parent = 0; do_action('add_category_form_pre', $category); ?> + +
+

+
+
+ + + +
+ + +

+
+ +
+ + +

+
+ +
+ + 0, 'name' => 'category_parent', 'orderby' => 'name', 'selected' => $category->parent, 'hierarchical' => true, 'show_option_none' => __('None'))); ?> +

+
+ +
+ + +

+
+ +

+ +
+ + + +
+
+ +
+