~canonical-sysadmins/wordpress/4.7.2

« back to all changes in this revision

Viewing changes to wp-admin/edit-tag-form.php

  • Committer: Jacek Nykis
  • Date: 2015-01-05 16:17:05 UTC
  • Revision ID: jacek.nykis@canonical.com-20150105161705-w544l1h5mcg7u4w9
Initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
<?php
 
68
/**
 
69
 * Fires inside the Edit Term form tag.
 
70
 *
 
71
 * The dynamic portion of the hook name, $taxonomy, refers to
 
72
 * the taxonomy slug.
 
73
 *
 
74
 * @since 3.7.0
 
75
 */
 
76
?>
 
77
<form name="edittag" id="edittag" method="post" action="edit-tags.php" class="validate"<?php do_action( "{$taxonomy}_term_edit_form_tag" ); ?>>
 
78
<input type="hidden" name="action" value="editedtag" />
 
79
<input type="hidden" name="tag_ID" value="<?php echo esc_attr($tag->term_id) ?>" />
 
80
<input type="hidden" name="taxonomy" value="<?php echo esc_attr($taxonomy) ?>" />
 
81
<?php wp_original_referer_field(true, 'previous'); wp_nonce_field('update-tag_' . $tag_ID); ?>
 
82
        <table class="form-table">
 
83
                <tr class="form-field form-required">
 
84
                        <th scope="row"><label for="name"><?php _ex('Name', 'Taxonomy Name'); ?></label></th>
 
85
                        <td><input name="name" id="name" type="text" value="<?php if ( isset( $tag->name ) ) echo esc_attr($tag->name); ?>" size="40" aria-required="true" />
 
86
                        <p class="description"><?php _e('The name is how it appears on your site.'); ?></p></td>
 
87
                </tr>
 
88
<?php if ( !global_terms_enabled() ) { ?>
 
89
                <tr class="form-field">
 
90
                        <th scope="row"><label for="slug"><?php _ex('Slug', 'Taxonomy Slug'); ?></label></th>
 
91
                        <?php
 
92
                        /**
 
93
                         * Filter the editable term slug.
 
94
                         *
 
95
                         * @since 2.6.0
 
96
                         *
 
97
                         * @param string $slug The current term slug.
 
98
                         */
 
99
                        ?>
 
100
                        <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" />
 
101
                        <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>
 
102
                </tr>
 
103
<?php } ?>
 
104
<?php if ( is_taxonomy_hierarchical($taxonomy) ) : ?>
 
105
                <tr class="form-field">
 
106
                        <th scope="row"><label for="parent"><?php _ex('Parent', 'Taxonomy Parent'); ?></label></th>
 
107
                        <td>
 
108
                                <?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'))); ?>
 
109
                                <?php if ( 'category' == $taxonomy ) : ?>
 
110
                                <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>
 
111
                                <?php endif; ?>
 
112
                        </td>
 
113
                </tr>
 
114
<?php endif; // is_taxonomy_hierarchical() ?>
 
115
                <tr class="form-field">
 
116
                        <th scope="row"><label for="description"><?php _ex('Description', 'Taxonomy Description'); ?></label></th>
 
117
                        <td><textarea name="description" id="description" rows="5" cols="50" class="large-text"><?php echo $tag->description; // textarea_escaped ?></textarea><br />
 
118
                        <span class="description"><?php _e('The description is not prominent by default; however, some themes may show it.'); ?></span></td>
 
119
                </tr>
 
120
                <?php
 
121
                // Back compat hooks
 
122
                if ( 'category' == $taxonomy ) {
 
123
                        /**
 
124
                         * Fires after the Edit Category form fields are displayed.
 
125
                         *
 
126
                         * @since 2.9.0
 
127
                         * @deprecated 3.0.0 Use {$taxonomy}_edit_form_fields instead.
 
128
                         *
 
129
                         * @param object $tag Current category term object.
 
130
                         */
 
131
                        do_action( 'edit_category_form_fields', $tag );
 
132
                } elseif ( 'link_category' == $taxonomy ) {
 
133
                        /**
 
134
                         * Fires after the Edit Link Category form fields are displayed.
 
135
                         *
 
136
                         * @since 2.9.0
 
137
                         * @deprecated 3.0.0 Use {$taxonomy}_edit_form_fields instead.
 
138
                         *
 
139
                         * @param object $tag Current link category term object.
 
140
                         */
 
141
                        do_action( 'edit_link_category_form_fields', $tag );
 
142
                } else {
 
143
                        /**
 
144
                         * Fires after the Edit Tag form fields are displayed.
 
145
                         *
 
146
                         * @since 2.9.0
 
147
                         * @deprecated 3.0.0 Use {$taxonomy}_edit_form_fields instead.
 
148
                         *
 
149
                         * @param object $tag Current tag term object.
 
150
                         */
 
151
                        do_action( 'edit_tag_form_fields', $tag );
 
152
                }
 
153
                /**
 
154
                 * Fires after the Edit Term form fields are displayed.
 
155
                 *
 
156
                 * The dynamic portion of the hook name, $taxonomy, refers to
 
157
                 * the taxonomy slug.
 
158
                 *
 
159
                 * @since 3.0.0
 
160
                 *
 
161
                 * @param object $tag      Current taxonomy term object.
 
162
                 * @param string $taxonomy Current taxonomy slug.
 
163
                 */
 
164
                do_action( "{$taxonomy}_edit_form_fields", $tag, $taxonomy );
 
165
                ?>
 
166
        </table>
 
167
<?php
 
168
// Back compat hooks
 
169
if ( 'category' == $taxonomy ) {
 
170
        /** This action is documented in wp-admin/edit-tags.php */
 
171
        do_action( 'edit_category_form', $tag );
 
172
} elseif ( 'link_category' == $taxonomy ) {
 
173
        /** This action is documented in wp-admin/edit-tags.php */
 
174
        do_action( 'edit_link_category_form', $tag );
 
175
} else {
 
176
        /**
 
177
         * Fires at the end of the Edit Term form.
 
178
         *
 
179
         * @since 2.5.0
 
180
         * @deprecated 3.0.0 Use {$taxonomy}_edit_form instead.
 
181
         *
 
182
         * @param object $tag Current taxonomy term object.
 
183
         */
 
184
        do_action( 'edit_tag_form', $tag );
 
185
}
 
186
/**
 
187
 * Fires at the end of the Edit Term form for all taxonomies.
 
188
 *
 
189
 * The dynamic portion of the hook name, $taxonomy, refers to the taxonomy slug.
 
190
 *
 
191
 * @since 3.0.0
 
192
 *
 
193
 * @param object $tag      Current taxonomy term object.
 
194
 * @param string $taxonomy Current taxonomy slug.
 
195
 */
 
196
do_action( "{$taxonomy}_edit_form", $tag, $taxonomy );
 
197
 
 
198
submit_button( __('Update') );
 
199
?>
 
200
</form>
 
201
</div>
 
202
<script type="text/javascript">
 
203
try{document.forms.edittag.name.focus();}catch(e){}
 
204
</script>