Projects : mp-wp : mp-wp_genesis
1 | <?php |
2 | /** |
3 | * Edit link category form for inclusion in administration panels. |
4 | * |
5 | * @package WordPress |
6 | * @subpackage Administration |
7 | */ |
8 | |
9 | /** |
10 | * @var object |
11 | */ |
12 | if ( ! isset( $category ) ) |
13 | $category = (object) array(); |
14 | |
15 | if ( ! empty($cat_ID) ) { |
16 | /** |
17 | * @var string |
18 | */ |
19 | $heading = '<h2>' . __('Edit Link Category') . '</h2>'; |
20 | $submit_text = __('Update Category'); |
21 | $form = '<form name="editcat" id="editcat" method="post" action="link-category.php" class="validate">'; |
22 | $action = 'editedcat'; |
23 | $nonce_action = 'update-link-category_' . $cat_ID; |
24 | do_action('edit_link_category_form_pre', $category); |
25 | } else { |
26 | $heading = '<h2>' . __('Add Link Category') . '</h2>'; |
27 | $submit_text = __('Add Category'); |
28 | $form = '<form name="addcat" id="addcat" class="add:the-list: validate" method="post" action="link-category.php">'; |
29 | $action = 'addcat'; |
30 | $nonce_action = 'add-link-category'; |
31 | do_action('add_link_category_form_pre', $category); |
32 | } |
33 | |
34 | /** |
35 | * @ignore |
36 | * @since 2.7 |
37 | * @internal Used to prevent errors in page when no category is being edited. |
38 | * |
39 | * @param object $category |
40 | */ |
41 | function _fill_empty_link_category(&$category) { |
42 | if ( ! isset( $category->name ) ) |
43 | $category->name = ''; |
44 | |
45 | if ( ! isset( $category->slug ) ) |
46 | $category->slug = ''; |
47 | |
48 | if ( ! isset( $category->description ) ) |
49 | $category->description = ''; |
50 | } |
51 | |
52 | _fill_empty_link_category($category); |
53 | ?> |
54 | |
55 | <div class="wrap"> |
56 | <?php screen_icon(); ?> |
57 | <?php echo $heading ?> |
58 | <div id="ajax-response"></div> |
59 | <?php echo $form ?> |
60 | <input type="hidden" name="action" value="<?php echo $action ?>" /> |
61 | <input type="hidden" name="cat_ID" value="<?php echo $category->term_id ?>" /> |
62 | <?php wp_original_referer_field(true, 'previous'); wp_nonce_field($nonce_action); ?> |
63 | <table class="form-table"> |
64 | <tr class="form-field form-required"> |
65 | <th scope="row" valign="top"><label for="name"><?php _e('Category name') ?></label></th> |
66 | <td><input name="name" id="name" type="text" value="<?php echo $category->name; ?>" size="40" aria-required="true" /></td> |
67 | </tr> |
68 | <tr class="form-field"> |
69 | <th scope="row" valign="top"><label for="slug"><?php _e('Category slug') ?></label></th> |
70 | <td><input name="slug" id="slug" type="text" value="<?php echo attribute_escape(apply_filters('editable_slug', $category->slug)); ?>" size="40" /><br /> |
71 | <?php _e('The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></td> |
72 | </tr> |
73 | <tr class="form-field"> |
74 | <th scope="row" valign="top"><label for="description"><?php _e('Description (optional)') ?></label></th> |
75 | <td><textarea name="description" id="description" rows="5" cols="50" style="width: 97%;"><?php echo $category->description; ?></textarea></td> |
76 | </tr> |
77 | </table> |
78 | <p class="submit"><input type="submit" class="button-primary" name="submit" value="<?php echo $submit_text ?>" /></p> |
79 | <?php do_action('edit_link_category_form', $category); ?> |
80 | </form> |
81 | </div> |