]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-admin/edit-tag-form.php
WordPress 4.1.1
[autoinstalls/wordpress.git] / wp-admin / edit-tag-form.php
1 <?php
2 /**
3  * Edit tag 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 ( empty($tag_ID) ) { ?>
14         <div id="message" class="updated"><p><strong><?php _e( 'You did not select an item for editing.' ); ?></strong></p></div>
15 <?php
16         return;
17 }
18
19 // Back compat hooks
20 if ( 'category' == $taxonomy ) {
21         /**
22          * Fires before the Edit Category form.
23          *
24          * @since 2.1.0
25          * @deprecated 3.0.0 Use {$taxonomy}_pre_edit_form instead.
26          *
27          * @param object $tag Current category term object.
28          */
29         do_action( 'edit_category_form_pre', $tag );
30 } elseif ( 'link_category' == $taxonomy ) {
31         /**
32          * Fires before the Edit Link Category form.
33          *
34          * @since 2.3.0
35          * @deprecated 3.0.0 Use {$taxonomy}_pre_edit_form instead.
36          *
37          * @param object $tag Current link category term object.
38          */
39         do_action( 'edit_link_category_form_pre', $tag );
40 } else {
41         /**
42          * Fires before the Edit Tag form.
43          *
44          * @since 2.5.0
45          * @deprecated 3.0.0 Use {$taxonomy}_pre_edit_form instead.
46          *
47          * @param object $tag Current tag term object.
48          */
49         do_action( 'edit_tag_form_pre', $tag );
50 }
51 /**
52  * Fires before the Edit Term form for all taxonomies.
53  *
54  * The dynamic portion of the hook name, `$taxonomy`, refers to
55  * the taxonomy slug.
56  *
57  * @since 3.0.0
58  *
59  * @param object $tag      Current taxonomy term object.
60  * @param string $taxonomy Current $taxonomy slug.
61  */
62 do_action( "{$taxonomy}_pre_edit_form", $tag, $taxonomy ); ?>
63
64 <div class="wrap">
65 <h2><?php echo $tax->labels->edit_item; ?></h2>
66 <div id="ajax-response"></div>
67 <form name="edittag" id="edittag" method="post" action="edit-tags.php" class="validate"
68 <?php
69 /**
70  * Fires inside the Edit Term form tag.
71  *
72  * The dynamic portion of the hook name, `$taxonomy`, refers to
73  * the taxonomy slug.
74  *
75  * @since 3.7.0
76  */
77 do_action( "{$taxonomy}_term_edit_form_tag" );
78 ?>>
79 <input type="hidden" name="action" value="editedtag" />
80 <input type="hidden" name="tag_ID" value="<?php echo esc_attr($tag->term_id) ?>" />
81 <input type="hidden" name="taxonomy" value="<?php echo esc_attr($taxonomy) ?>" />
82 <?php wp_original_referer_field(true, 'previous'); wp_nonce_field('update-tag_' . $tag_ID); ?>
83         <table class="form-table">
84                 <tr class="form-field form-required term-name-wrap">
85                         <th scope="row"><label for="name"><?php _ex( 'Name', 'term name' ); ?></label></th>
86                         <td><input name="name" id="name" type="text" value="<?php if ( isset( $tag->name ) ) echo esc_attr($tag->name); ?>" size="40" aria-required="true" />
87                         <p class="description"><?php _e('The name is how it appears on your site.'); ?></p></td>
88                 </tr>
89 <?php if ( !global_terms_enabled() ) { ?>
90                 <tr class="form-field term-slug-wrap">
91                         <th scope="row"><label for="slug"><?php _e( 'Slug' ); ?></label></th>
92                         <?php
93                         /**
94                          * Filter the editable term slug.
95                          *
96                          * @since 2.6.0
97                          *
98                          * @param string $slug The current term slug.
99                          */
100                         ?>
101                         <td><input name="slug" id="slug" type="text" value="<?php if ( isset( $tag->slug ) ) echo esc_attr( apply_filters( 'editable_slug', $tag->slug ) ); ?>" size="40" />
102                         <p 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.'); ?></p></td>
103                 </tr>
104 <?php } ?>
105 <?php if ( is_taxonomy_hierarchical($taxonomy) ) : ?>
106                 <tr class="form-field term-parent-wrap">
107                         <th scope="row"><label for="parent"><?php _ex( 'Parent', 'term parent' ); ?></label></th>
108                         <td>
109                                 <?php wp_dropdown_categories(array('hide_empty' => 0, 'hide_if_empty' => false, 'name' => 'parent', 'orderby' => 'name', 'taxonomy' => $taxonomy, 'selected' => $tag->parent, 'exclude_tree' => $tag->term_id, 'hierarchical' => true, 'show_option_none' => __('None'))); ?>
110                                 <?php if ( 'category' == $taxonomy ) : ?>
111                                 <p 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.'); ?></p>
112                                 <?php endif; ?>
113                         </td>
114                 </tr>
115 <?php endif; // is_taxonomy_hierarchical() ?>
116                 <tr class="form-field term-description-wrap">
117                         <th scope="row"><label for="description"><?php _e( 'Description' ); ?></label></th>
118                         <td><textarea name="description" id="description" rows="5" cols="50" class="large-text"><?php echo $tag->description; // textarea_escaped ?></textarea>
119                         <p class="description"><?php _e('The description is not prominent by default; however, some themes may show it.'); ?></p></td>
120                 </tr>
121                 <?php
122                 // Back compat hooks
123                 if ( 'category' == $taxonomy ) {
124                         /**
125                          * Fires after the Edit Category form fields are displayed.
126                          *
127                          * @since 2.9.0
128                          * @deprecated 3.0.0 Use {$taxonomy}_edit_form_fields instead.
129                          *
130                          * @param object $tag Current category term object.
131                          */
132                         do_action( 'edit_category_form_fields', $tag );
133                 } elseif ( 'link_category' == $taxonomy ) {
134                         /**
135                          * Fires after the Edit Link Category form fields are displayed.
136                          *
137                          * @since 2.9.0
138                          * @deprecated 3.0.0 Use {$taxonomy}_edit_form_fields instead.
139                          *
140                          * @param object $tag Current link category term object.
141                          */
142                         do_action( 'edit_link_category_form_fields', $tag );
143                 } else {
144                         /**
145                          * Fires after the Edit Tag form fields are displayed.
146                          *
147                          * @since 2.9.0
148                          * @deprecated 3.0.0 Use {$taxonomy}_edit_form_fields instead.
149                          *
150                          * @param object $tag Current tag term object.
151                          */
152                         do_action( 'edit_tag_form_fields', $tag );
153                 }
154                 /**
155                  * Fires after the Edit Term form fields are displayed.
156                  *
157                  * The dynamic portion of the hook name, `$taxonomy`, refers to
158                  * the taxonomy slug.
159                  *
160                  * @since 3.0.0
161                  *
162                  * @param object $tag      Current taxonomy term object.
163                  * @param string $taxonomy Current taxonomy slug.
164                  */
165                 do_action( "{$taxonomy}_edit_form_fields", $tag, $taxonomy );
166                 ?>
167         </table>
168 <?php
169 // Back compat hooks
170 if ( 'category' == $taxonomy ) {
171         /** This action is documented in wp-admin/edit-tags.php */
172         do_action( 'edit_category_form', $tag );
173 } elseif ( 'link_category' == $taxonomy ) {
174         /** This action is documented in wp-admin/edit-tags.php */
175         do_action( 'edit_link_category_form', $tag );
176 } else {
177         /**
178          * Fires at the end of the Edit Term form.
179          *
180          * @since 2.5.0
181          * @deprecated 3.0.0 Use {$taxonomy}_edit_form instead.
182          *
183          * @param object $tag Current taxonomy term object.
184          */
185         do_action( 'edit_tag_form', $tag );
186 }
187 /**
188  * Fires at the end of the Edit Term form for all taxonomies.
189  *
190  * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
191  *
192  * @since 3.0.0
193  *
194  * @param object $tag      Current taxonomy term object.
195  * @param string $taxonomy Current taxonomy slug.
196  */
197 do_action( "{$taxonomy}_edit_form", $tag, $taxonomy );
198
199 submit_button( __('Update') );
200 ?>
201 </form>
202 </div>
203
204 <?php if ( ! wp_is_mobile() ) : ?>
205 <script type="text/javascript">
206 try{document.forms.edittag.name.focus();}catch(e){}
207 </script>
208 <?php endif;