X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/11be8dc178e77d0b46189bbd8e33a216a9b90942..9c40b4d36daed9e28e48a5fe9205c32557195a4b:/wp-admin/categories.php diff --git a/wp-admin/categories.php b/wp-admin/categories.php index e7042480..8d26b9e1 100644 --- a/wp-admin/categories.php +++ b/wp-admin/categories.php @@ -25,11 +25,11 @@ case 'addcat': if ( !current_user_can('manage_categories') ) wp_die(__('Cheatin’ uh?')); - if( wp_insert_category($_POST ) ) { - wp_redirect('categories.php?message=1#addcat'); - } else { - wp_redirect('categories.php?message=4#addcat'); - } + if ( wp_insert_category($_POST ) ) + wp_safe_redirect( add_query_arg( 'message', 1, wp_get_referer() ) . '#addcat' ); + else + wp_safe_redirect( add_query_arg( 'message', 4, wp_get_referer() ) . '#addcat' ); + exit; break; @@ -40,15 +40,15 @@ case 'delete': if ( !current_user_can('manage_categories') ) wp_die(__('Cheatin’ uh?')); - $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') ) + if ( $cat_ID == get_option('default_category') ) wp_die(sprintf(__("Can’t delete the %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; @@ -60,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') ) @@ -69,9 +69,7 @@ case 'bulk-delete': wp_delete_category($cat_ID); } - $sendback = wp_get_referer(); - - wp_redirect($sendback); + wp_safe_redirect( wp_get_referer() ); exit(); break; @@ -131,9 +129,9 @@ $messages[5] = __('Category not updated.');
-

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


@@ -162,15 +160,23 @@ endif; ?> $pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 0; if ( empty($pagenum) ) $pagenum = 1; -if( ! isset( $catsperpage ) || $catsperpage < 0 ) - $catsperpage = 20; + +$cats_per_page = get_user_option('categories_per_page'); +if ( empty($cats_per_page) ) + $cats_per_page = 20; +$cats_per_page = apply_filters('edit_categories_per_page', $cats_per_page); + +if ( !empty($_GET['s']) ) + $num_cats = count(get_categories(array('hide_empty' => 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(wp_count_terms('category') / $catsperpage), + 'total' => ceil($num_cats / $cats_per_page), 'current' => $pagenum )); @@ -183,7 +189,7 @@ if ( $page_links ) - +
@@ -207,7 +213,7 @@ if ( $page_links ) @@ -223,7 +229,7 @@ if ( $page_links ) - + @@ -233,7 +239,7 @@ if ( $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') ?>

@@ -277,7 +283,7 @@ if ( $page_links )

-

+

@@ -289,21 +295,6 @@ if ( $page_links ) - -