~canonical-sysadmins/wordpress/3.9.x

« back to all changes in this revision

Viewing changes to wp-admin/categories.php

  • Committer: Chris Jones
  • Date: 2010-01-19 13:17:33 UTC
  • Revision ID: cmsj@tenshu.net-20100119131733-rf31jv9k1v0xzo2h
[CJ] Import wordpress 2.9.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
break;
35
35
 
36
36
case 'delete':
 
37
        if ( !isset( $_GET['cat_ID'] ) ) {
 
38
                wp_redirect('categories.php');
 
39
                exit;
 
40
        }
 
41
 
37
42
        $cat_ID = (int) $_GET['cat_ID'];
38
43
        check_admin_referer('delete-category_' .  $cat_ID);
39
44
 
40
45
        if ( !current_user_can('manage_categories') )
41
46
                wp_die(__('Cheatin’ uh?'));
42
47
 
43
 
        $cat_name = get_cat_name($cat_ID);
44
 
 
45
48
        // Don't delete the default cats.
46
49
        if ( $cat_ID == get_option('default_category') )
47
 
                wp_die(sprintf(__("Can&#8217;t delete the <strong>%s</strong> category: this is the default one"), $cat_name));
 
50
                wp_die( sprintf( __("Can&#8217;t delete the <strong>%s</strong> category: this is the default one"), get_cat_name($cat_ID) ) );
48
51
 
49
52
        wp_delete_category($cat_ID);
50
53
 
59
62
        if ( !current_user_can('manage_categories') )
60
63
                wp_die( __('You are not allowed to delete categories.') );
61
64
 
62
 
        foreach ( (array) $_GET['delete'] as $cat_ID ) {
63
 
                $cat_name = get_cat_name($cat_ID);
 
65
        $cats = (array) $_GET['delete'];
 
66
        $default_cat = get_option('default_category');
 
67
        foreach ( $cats as $cat_ID ) {
 
68
                $cat_ID = (int) $cat_ID;
64
69
 
65
 
                // Don't delete the default cats.
66
 
                if ( $cat_ID == get_option('default_category') )
67
 
                        wp_die(sprintf(__("Can&#8217;t delete the <strong>%s</strong> category: this is the default one"), $cat_name));
 
70
                // Don't delete the default cat.
 
71
                if ( $cat_ID == $default_cat )
 
72
                        wp_die( sprintf( __("Can&#8217;t delete the <strong>%s</strong> category: this is the default one"), get_cat_name($cat_ID) ) );
68
73
 
69
74
                wp_delete_category($cat_ID);
70
75
        }
71
76
 
72
77
        wp_safe_redirect( wp_get_referer() );
73
 
        exit();
 
78
        exit;
74
79
 
75
80
break;
76
81
case 'edit':
161
166
if ( empty($pagenum) )
162
167
        $pagenum = 1;
163
168
 
164
 
$cats_per_page = get_user_option('categories_per_page');
165
 
if ( empty($cats_per_page) )
 
169
$cats_per_page = (int) get_user_option( 'categories_per_page', 0, false );
 
170
if ( empty( $cats_per_page ) || $cats_per_page < 1 )
166
171
        $cats_per_page = 20;
167
 
$cats_per_page = apply_filters('edit_categories_per_page', $cats_per_page);
 
172
$cats_per_page = apply_filters( 'edit_categories_per_page', $cats_per_page );
168
173
 
169
174
if ( !empty($_GET['s']) )
170
175
        $num_cats = count(get_categories(array('hide_empty' => 0, 'search' => $_GET['s'])));
280
285
<div class="form-field">
281
286
        <label for="category_description"><?php _e('Description') ?></label>
282
287
        <textarea name="category_description" id="category_description" rows="5" cols="40"></textarea>
283
 
    <p><?php _e('The description is not prominent by default, however some themes may show it.'); ?></p>
 
288
    <p><?php _e('The description is not prominent by default; however, some themes may show it.'); ?></p>
284
289
</div>
285
290
 
286
291
<p class="submit"><input type="submit" class="button" name="submit" value="<?php esc_attr_e('Add Category'); ?>" /></p>