]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-admin/edit-category-form.php
Wordpress 2.8.4
[autoinstalls/wordpress.git] / wp-admin / edit-category-form.php
1 <?php
2 /**
3  * Edit category form for inclusion in administration panels.
4  *
5  * @package WordPress
6  * @subpackage Administration
7  */
8
9 // don't load directly
10 if ( !defined('ABSPATH') )
11         die('-1');
12
13 if ( !current_user_can('manage_categories') )
14         wp_die(__('You do not have sufficient permissions to edit categories for this blog.'));
15
16 /**
17  * @var object
18  */
19 if ( ! isset( $category ) )
20         $category = (object) array();
21
22 /**
23  * @ignore
24  * @since 2.7
25  * @internal Used to prevent errors in page when no category is being edited.
26  *
27  * @param object $category
28  */
29 function _fill_empty_category(&$category) {
30         if ( ! isset( $category->name ) )
31                 $category->name = '';
32
33         if ( ! isset( $category->slug ) )
34                 $category->slug = '';
35
36         if ( ! isset( $category->parent ) )
37                 $category->parent = '';
38
39         if ( ! isset( $category->description ) )
40                 $category->description = '';
41 }
42
43 do_action('edit_category_form_pre', $category);
44
45 _fill_empty_category($category);
46 ?>
47
48 <div class="wrap">
49 <?php screen_icon(); ?>
50 <h2><?php _e('Edit Category'); ?></h2>
51 <div id="ajax-response"></div>
52 <form name="editcat" id="editcat" method="post" action="categories.php" class="validate">
53 <input type="hidden" name="action" value="editedcat" />
54 <input type="hidden" name="cat_ID" value="<?php echo esc_attr($category->term_id) ?>" />
55 <?php wp_original_referer_field(true, 'previous'); wp_nonce_field('update-category_' . $cat_ID); ?>
56         <table class="form-table">
57                 <tr class="form-field form-required">
58                         <th scope="row" valign="top"><label for="cat_name"><?php _e('Category Name') ?></label></th>
59                         <td><input name="cat_name" id="cat_name" type="text" value="<?php echo esc_attr($category->name); ?>" size="40" aria-required="true" /><br />
60             <span class="description"><?php _e('The name is used to identify the category almost everywhere, for example under the post or in the category widget.'); ?></span></td>
61                 </tr>
62                 <tr class="form-field">
63                         <th scope="row" valign="top"><label for="category_nicename"><?php _e('Category Slug') ?></label></th>
64                         <td><input name="category_nicename" id="category_nicename" type="text" value="<?php echo esc_attr(apply_filters('editable_slug', $category->slug)); ?>" size="40" /><br />
65             <span class="description"><?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></span></td>
66                 </tr>
67                 <tr class="form-field">
68                         <th scope="row" valign="top"><label for="category_parent"><?php _e('Category Parent') ?></label></th>
69                         <td>
70                                 <?php wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'category_parent', 'orderby' => 'name', 'selected' => $category->parent, 'hierarchical' => true, 'show_option_none' => __('None'))); ?><br />
71                 <span class="description"><?php _e('Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have children categories for Bebop and Big Band. Totally optional.'); ?></span>
72                         </td>
73                 </tr>
74                 <tr class="form-field">
75                         <th scope="row" valign="top"><label for="category_description"><?php _e('Description') ?></label></th>
76                         <td><textarea name="category_description" id="category_description" rows="5" cols="50" style="width: 97%;"><?php echo esc_html($category->description); ?></textarea><br />
77             <span class="description"><?php _e('The description is not prominent by default, however some themes may show it.'); ?></span></td>
78                 </tr>
79                 <?php do_action('edit_category_form_fields', $category); ?>
80         </table>
81 <p class="submit"><input type="submit" class="button-primary" name="submit" value="<?php esc_attr_e('Update Category'); ?>" /></p>
82 <?php do_action('edit_category_form', $category); ?>
83 </form>
84 </div>