Wordpress 4.6
[autoinstalls/wordpress.git] / wp-admin / includes / meta-boxes.php
1 <?php
2
3 // -- Post related Meta Boxes
4
5 /**
6  * Displays post submit form fields.
7  *
8  * @since 2.7.0
9  *
10  * @global string $action
11  *
12  * @param WP_Post  $post Current post object.
13  * @param array    $args {
14  *     Array of arguments for building the post submit meta box.
15  *
16  *     @type string   $id       Meta box 'id' attribute.
17  *     @type string   $title    Meta box title.
18  *     @type callable $callback Meta box display callback.
19  *     @type array    $args     Extra meta box arguments.
20  * }
21  */
22 function post_submit_meta_box( $post, $args = array() ) {
23         global $action;
24
25         $post_type = $post->post_type;
26         $post_type_object = get_post_type_object($post_type);
27         $can_publish = current_user_can($post_type_object->cap->publish_posts);
28 ?>
29 <div class="submitbox" id="submitpost">
30
31 <div id="minor-publishing">
32
33 <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?>
34 <div style="display:none;">
35 <?php submit_button( __( 'Save' ), 'button', 'save' ); ?>
36 </div>
37
38 <div id="minor-publishing-actions">
39 <div id="save-action">
40 <?php if ( 'publish' != $post->post_status && 'future' != $post->post_status && 'pending' != $post->post_status ) { ?>
41 <input <?php if ( 'private' == $post->post_status ) { ?>style="display:none"<?php } ?> type="submit" name="save" id="save-post" value="<?php esc_attr_e('Save Draft'); ?>" class="button" />
42 <span class="spinner"></span>
43 <?php } elseif ( 'pending' == $post->post_status && $can_publish ) { ?>
44 <input type="submit" name="save" id="save-post" value="<?php esc_attr_e('Save as Pending'); ?>" class="button" />
45 <span class="spinner"></span>
46 <?php } ?>
47 </div>
48 <?php if ( is_post_type_viewable( $post_type_object ) ) : ?>
49 <div id="preview-action">
50 <?php
51 $preview_link = esc_url( get_preview_post_link( $post ) );
52 if ( 'publish' == $post->post_status ) {
53         $preview_button = __( 'Preview Changes' );
54 } else {
55         $preview_button = __( 'Preview' );
56 }
57 ?>
58 <a class="preview button" href="<?php echo $preview_link; ?>" target="wp-preview-<?php echo (int) $post->ID; ?>" id="post-preview"><?php echo $preview_button; ?></a>
59 <input type="hidden" name="wp-preview" id="wp-preview" value="" />
60 </div>
61 <?php endif; // public post type ?>
62 <?php
63 /**
64  * Fires before the post time/date setting in the Publish meta box.
65  *
66  * @since 4.4.0
67  *
68  * @param WP_Post $post WP_Post object for the current post.
69  */
70 do_action( 'post_submitbox_minor_actions', $post );
71 ?>
72 <div class="clear"></div>
73 </div><!-- #minor-publishing-actions -->
74
75 <div id="misc-publishing-actions">
76
77 <div class="misc-pub-section misc-pub-post-status"><label for="post_status"><?php _e('Status:') ?></label>
78 <span id="post-status-display">
79 <?php
80 switch ( $post->post_status ) {
81         case 'private':
82                 _e('Privately Published');
83                 break;
84         case 'publish':
85                 _e('Published');
86                 break;
87         case 'future':
88                 _e('Scheduled');
89                 break;
90         case 'pending':
91                 _e('Pending Review');
92                 break;
93         case 'draft':
94         case 'auto-draft':
95                 _e('Draft');
96                 break;
97 }
98 ?>
99 </span>
100 <?php if ( 'publish' == $post->post_status || 'private' == $post->post_status || $can_publish ) { ?>
101 <a href="#post_status" <?php if ( 'private' == $post->post_status ) { ?>style="display:none;" <?php } ?>class="edit-post-status hide-if-no-js"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit status' ); ?></span></a>
102
103 <div id="post-status-select" class="hide-if-js">
104 <input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo esc_attr( ('auto-draft' == $post->post_status ) ? 'draft' : $post->post_status); ?>" />
105 <select name='post_status' id='post_status'>
106 <?php if ( 'publish' == $post->post_status ) : ?>
107 <option<?php selected( $post->post_status, 'publish' ); ?> value='publish'><?php _e('Published') ?></option>
108 <?php elseif ( 'private' == $post->post_status ) : ?>
109 <option<?php selected( $post->post_status, 'private' ); ?> value='publish'><?php _e('Privately Published') ?></option>
110 <?php elseif ( 'future' == $post->post_status ) : ?>
111 <option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Scheduled') ?></option>
112 <?php endif; ?>
113 <option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e('Pending Review') ?></option>
114 <?php if ( 'auto-draft' == $post->post_status ) : ?>
115 <option<?php selected( $post->post_status, 'auto-draft' ); ?> value='draft'><?php _e('Draft') ?></option>
116 <?php else : ?>
117 <option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Draft') ?></option>
118 <?php endif; ?>
119 </select>
120  <a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e('OK'); ?></a>
121  <a href="#post_status" class="cancel-post-status hide-if-no-js button-cancel"><?php _e('Cancel'); ?></a>
122 </div>
123
124 <?php } ?>
125 </div><!-- .misc-pub-section -->
126
127 <div class="misc-pub-section misc-pub-visibility" id="visibility">
128 <?php _e('Visibility:'); ?> <span id="post-visibility-display"><?php
129
130 if ( 'private' == $post->post_status ) {
131         $post->post_password = '';
132         $visibility = 'private';
133         $visibility_trans = __('Private');
134 } elseif ( !empty( $post->post_password ) ) {
135         $visibility = 'password';
136         $visibility_trans = __('Password protected');
137 } elseif ( $post_type == 'post' && is_sticky( $post->ID ) ) {
138         $visibility = 'public';
139         $visibility_trans = __('Public, Sticky');
140 } else {
141         $visibility = 'public';
142         $visibility_trans = __('Public');
143 }
144
145 echo esc_html( $visibility_trans ); ?></span>
146 <?php if ( $can_publish ) { ?>
147 <a href="#visibility" class="edit-visibility hide-if-no-js"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit visibility' ); ?></span></a>
148
149 <div id="post-visibility-select" class="hide-if-js">
150 <input type="hidden" name="hidden_post_password" id="hidden-post-password" value="<?php echo esc_attr($post->post_password); ?>" />
151 <?php if ($post_type == 'post'): ?>
152 <input type="checkbox" style="display:none" name="hidden_post_sticky" id="hidden-post-sticky" value="sticky" <?php checked(is_sticky($post->ID)); ?> />
153 <?php endif; ?>
154 <input type="hidden" name="hidden_post_visibility" id="hidden-post-visibility" value="<?php echo esc_attr( $visibility ); ?>" />
155 <input type="radio" name="visibility" id="visibility-radio-public" value="public" <?php checked( $visibility, 'public' ); ?> /> <label for="visibility-radio-public" class="selectit"><?php _e('Public'); ?></label><br />
156 <?php if ( $post_type == 'post' && current_user_can( 'edit_others_posts' ) ) : ?>
157 <span id="sticky-span"><input id="sticky" name="sticky" type="checkbox" value="sticky" <?php checked( is_sticky( $post->ID ) ); ?> /> <label for="sticky" class="selectit"><?php _e( 'Stick this post to the front page' ); ?></label><br /></span>
158 <?php endif; ?>
159 <input type="radio" name="visibility" id="visibility-radio-password" value="password" <?php checked( $visibility, 'password' ); ?> /> <label for="visibility-radio-password" class="selectit"><?php _e('Password protected'); ?></label><br />
160 <span id="password-span"><label for="post_password"><?php _e('Password:'); ?></label> <input type="text" name="post_password" id="post_password" value="<?php echo esc_attr($post->post_password); ?>"  maxlength="20" /><br /></span>
161 <input type="radio" name="visibility" id="visibility-radio-private" value="private" <?php checked( $visibility, 'private' ); ?> /> <label for="visibility-radio-private" class="selectit"><?php _e('Private'); ?></label><br />
162
163 <p>
164  <a href="#visibility" class="save-post-visibility hide-if-no-js button"><?php _e('OK'); ?></a>
165  <a href="#visibility" class="cancel-post-visibility hide-if-no-js button-cancel"><?php _e('Cancel'); ?></a>
166 </p>
167 </div>
168 <?php } ?>
169
170 </div><!-- .misc-pub-section -->
171
172 <?php
173 /* translators: Publish box date format, see https://secure.php.net/date */
174 $datef = __( 'M j, Y @ H:i' );
175 if ( 0 != $post->ID ) {
176         if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date
177                 $stamp = __('Scheduled for: <b>%1$s</b>');
178         } elseif ( 'publish' == $post->post_status || 'private' == $post->post_status ) { // already published
179                 $stamp = __('Published on: <b>%1$s</b>');
180         } elseif ( '0000-00-00 00:00:00' == $post->post_date_gmt ) { // draft, 1 or more saves, no date specified
181                 $stamp = __('Publish <b>immediately</b>');
182         } elseif ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // draft, 1 or more saves, future date specified
183                 $stamp = __('Schedule for: <b>%1$s</b>');
184         } else { // draft, 1 or more saves, date specified
185                 $stamp = __('Publish on: <b>%1$s</b>');
186         }
187         $date = date_i18n( $datef, strtotime( $post->post_date ) );
188 } else { // draft (no saves, and thus no date specified)
189         $stamp = __('Publish <b>immediately</b>');
190         $date = date_i18n( $datef, strtotime( current_time('mysql') ) );
191 }
192
193 if ( ! empty( $args['args']['revisions_count'] ) ) : ?>
194 <div class="misc-pub-section misc-pub-revisions">
195         <?php printf( __( 'Revisions: %s' ), '<b>' . number_format_i18n( $args['args']['revisions_count'] ) . '</b>' ); ?>
196         <a class="hide-if-no-js" href="<?php echo esc_url( get_edit_post_link( $args['args']['revision_id'] ) ); ?>"><span aria-hidden="true"><?php _ex( 'Browse', 'revisions' ); ?></span> <span class="screen-reader-text"><?php _e( 'Browse revisions' ); ?></span></a>
197 </div>
198 <?php endif;
199
200 if ( $can_publish ) : // Contributors don't get to choose the date of publish ?>
201 <div class="misc-pub-section curtime misc-pub-curtime">
202         <span id="timestamp">
203         <?php printf($stamp, $date); ?></span>
204         <a href="#edit_timestamp" class="edit-timestamp hide-if-no-js"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit date and time' ); ?></span></a>
205         <fieldset id="timestampdiv" class="hide-if-js">
206         <legend class="screen-reader-text"><?php _e( 'Date and time' ); ?></legend>
207         <?php touch_time( ( $action === 'edit' ), 1 ); ?>
208         </fieldset>
209 </div><?php // /misc-pub-section ?>
210 <?php endif; ?>
211
212 <?php
213 /**
214  * Fires after the post time/date setting in the Publish meta box.
215  *
216  * @since 2.9.0
217  * @since 4.4.0 Added the `$post` parameter.
218  *
219  * @param WP_Post $post WP_Post object for the current post.
220  */
221 do_action( 'post_submitbox_misc_actions', $post );
222 ?>
223 </div>
224 <div class="clear"></div>
225 </div>
226
227 <div id="major-publishing-actions">
228 <?php
229 /**
230  * Fires at the beginning of the publishing actions section of the Publish meta box.
231  *
232  * @since 2.7.0
233  */
234 do_action( 'post_submitbox_start' );
235 ?>
236 <div id="delete-action">
237 <?php
238 if ( current_user_can( "delete_post", $post->ID ) ) {
239         if ( !EMPTY_TRASH_DAYS )
240                 $delete_text = __('Delete Permanently');
241         else
242                 $delete_text = __('Move to Trash');
243         ?>
244 <a class="submitdelete deletion" href="<?php echo get_delete_post_link($post->ID); ?>"><?php echo $delete_text; ?></a><?php
245 } ?>
246 </div>
247
248 <div id="publishing-action">
249 <span class="spinner"></span>
250 <?php
251 if ( !in_array( $post->post_status, array('publish', 'future', 'private') ) || 0 == $post->ID ) {
252         if ( $can_publish ) :
253                 if ( !empty($post->post_date_gmt) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : ?>
254                 <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Schedule') ?>" />
255                 <?php submit_button( __( 'Schedule' ), 'primary button-large', 'publish', false ); ?>
256 <?php   else : ?>
257                 <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Publish') ?>" />
258                 <?php submit_button( __( 'Publish' ), 'primary button-large', 'publish', false ); ?>
259 <?php   endif;
260         else : ?>
261                 <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Submit for Review') ?>" />
262                 <?php submit_button( __( 'Submit for Review' ), 'primary button-large', 'publish', false ); ?>
263 <?php
264         endif;
265 } else { ?>
266                 <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Update') ?>" />
267                 <input name="save" type="submit" class="button button-primary button-large" id="publish" value="<?php esc_attr_e( 'Update' ) ?>" />
268 <?php
269 } ?>
270 </div>
271 <div class="clear"></div>
272 </div>
273 </div>
274
275 <?php
276 }
277
278 /**
279  * Display attachment submit form fields.
280  *
281  * @since 3.5.0
282  *
283  * @param object $post
284  */
285 function attachment_submit_meta_box( $post ) {
286 ?>
287 <div class="submitbox" id="submitpost">
288
289 <div id="minor-publishing">
290
291 <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?>
292 <div style="display:none;">
293 <?php submit_button( __( 'Save' ), 'button', 'save' ); ?>
294 </div>
295
296
297 <div id="misc-publishing-actions">
298         <?php
299         /* translators: Publish box date format, see https://secure.php.net/date */
300         $datef = __( 'M j, Y @ H:i' );
301         $stamp = __('Uploaded on: <b>%1$s</b>');
302         $date = date_i18n( $datef, strtotime( $post->post_date ) );
303         ?>
304         <div class="misc-pub-section curtime misc-pub-curtime">
305                 <span id="timestamp"><?php printf($stamp, $date); ?></span>
306         </div><!-- .misc-pub-section -->
307
308         <?php
309         /**
310          * Fires after the 'Uploaded on' section of the Save meta box
311          * in the attachment editing screen.
312          *
313          * @since 3.5.0
314          */
315         do_action( 'attachment_submitbox_misc_actions' );
316         ?>
317 </div><!-- #misc-publishing-actions -->
318 <div class="clear"></div>
319 </div><!-- #minor-publishing -->
320
321 <div id="major-publishing-actions">
322         <div id="delete-action">
323         <?php
324         if ( current_user_can( 'delete_post', $post->ID ) )
325                 if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) {
326                         echo "<a class='submitdelete deletion' href='" . get_delete_post_link( $post->ID ) . "'>" . _x( 'Trash', 'verb' ) . "</a>";
327                 } else {
328                         $delete_ays = ! MEDIA_TRASH ? " onclick='return showNotice.warn();'" : '';
329                         echo  "<a class='submitdelete deletion'$delete_ays href='" . get_delete_post_link( $post->ID, null, true ) . "'>" . __( 'Delete Permanently' ) . "</a>";
330                 }
331         ?>
332         </div>
333
334         <div id="publishing-action">
335                 <span class="spinner"></span>
336                 <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Update') ?>" />
337                 <input name="save" type="submit" class="button-primary button-large" id="publish" value="<?php esc_attr_e( 'Update' ) ?>" />
338         </div>
339         <div class="clear"></div>
340 </div><!-- #major-publishing-actions -->
341
342 </div>
343
344 <?php
345 }
346
347 /**
348  * Display post format form elements.
349  *
350  * @since 3.1.0
351  *
352  * @param WP_Post $post Post object.
353  * @param array   $box {
354  *     Post formats meta box arguments.
355  *
356  *     @type string   $id       Meta box 'id' attribute.
357  *     @type string   $title    Meta box title.
358  *     @type callable $callback Meta box display callback.
359  *     @type array    $args     Extra meta box arguments.
360  * }
361  */
362 function post_format_meta_box( $post, $box ) {
363         if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post->post_type, 'post-formats' ) ) :
364         $post_formats = get_theme_support( 'post-formats' );
365
366         if ( is_array( $post_formats[0] ) ) :
367                 $post_format = get_post_format( $post->ID );
368                 if ( !$post_format )
369                         $post_format = '0';
370                 // Add in the current one if it isn't there yet, in case the current theme doesn't support it
371                 if ( $post_format && !in_array( $post_format, $post_formats[0] ) )
372                         $post_formats[0][] = $post_format;
373         ?>
374         <div id="post-formats-select">
375                 <fieldset>
376                         <legend class="screen-reader-text"><?php _e( 'Post Formats' ); ?></legend>
377                         <input type="radio" name="post_format" class="post-format" id="post-format-0" value="0" <?php checked( $post_format, '0' ); ?> /> <label for="post-format-0" class="post-format-icon post-format-standard"><?php echo get_post_format_string( 'standard' ); ?></label>
378                         <?php foreach ( $post_formats[0] as $format ) : ?>
379                         <br /><input type="radio" name="post_format" class="post-format" id="post-format-<?php echo esc_attr( $format ); ?>" value="<?php echo esc_attr( $format ); ?>" <?php checked( $post_format, $format ); ?> /> <label for="post-format-<?php echo esc_attr( $format ); ?>" class="post-format-icon post-format-<?php echo esc_attr( $format ); ?>"><?php echo esc_html( get_post_format_string( $format ) ); ?></label>
380                         <?php endforeach; ?>
381                 </fieldset>
382         </div>
383         <?php endif; endif;
384 }
385
386 /**
387  * Display post tags form fields.
388  *
389  * @since 2.6.0
390  *
391  * @todo Create taxonomy-agnostic wrapper for this.
392  *
393  * @param WP_Post $post Post object.
394  * @param array   $box {
395  *     Tags meta box arguments.
396  *
397  *     @type string   $id       Meta box 'id' attribute.
398  *     @type string   $title    Meta box title.
399  *     @type callable $callback Meta box display callback.
400  *     @type array    $args {
401  *         Extra meta box arguments.
402  *
403  *         @type string $taxonomy Taxonomy. Default 'post_tag'.
404  *     }
405  * }
406  */
407 function post_tags_meta_box( $post, $box ) {
408         $defaults = array( 'taxonomy' => 'post_tag' );
409         if ( ! isset( $box['args'] ) || ! is_array( $box['args'] ) ) {
410                 $args = array();
411         } else {
412                 $args = $box['args'];
413         }
414         $r = wp_parse_args( $args, $defaults );
415         $tax_name = esc_attr( $r['taxonomy'] );
416         $taxonomy = get_taxonomy( $r['taxonomy'] );
417         $user_can_assign_terms = current_user_can( $taxonomy->cap->assign_terms );
418         $comma = _x( ',', 'tag delimiter' );
419         $terms_to_edit = get_terms_to_edit( $post->ID, $tax_name );
420         if ( ! is_string( $terms_to_edit ) ) {
421                 $terms_to_edit = '';
422         }
423 ?>
424 <div class="tagsdiv" id="<?php echo $tax_name; ?>">
425         <div class="jaxtag">
426         <div class="nojs-tags hide-if-js">
427                 <label for="tax-input-<?php echo $tax_name; ?>"><?php echo $taxonomy->labels->add_or_remove_items; ?></label>
428                 <p><textarea name="<?php echo "tax_input[$tax_name]"; ?>" rows="3" cols="20" class="the-tags" id="tax-input-<?php echo $tax_name; ?>" <?php disabled( ! $user_can_assign_terms ); ?> aria-describedby="new-tag-<?php echo $tax_name; ?>-desc"><?php echo str_replace( ',', $comma . ' ', $terms_to_edit ); // textarea_escaped by esc_attr() ?></textarea></p>
429         </div>
430         <?php if ( $user_can_assign_terms ) : ?>
431         <div class="ajaxtag hide-if-no-js">
432                 <label class="screen-reader-text" for="new-tag-<?php echo $tax_name; ?>"><?php echo $taxonomy->labels->add_new_item; ?></label>
433                 <p><input type="text" id="new-tag-<?php echo $tax_name; ?>" name="newtag[<?php echo $tax_name; ?>]" class="newtag form-input-tip" size="16" autocomplete="off" aria-describedby="new-tag-<?php echo $tax_name; ?>-desc" value="" />
434                 <input type="button" class="button tagadd" value="<?php esc_attr_e('Add'); ?>" /></p>
435         </div>
436         <p class="howto" id="new-tag-<?php echo $tax_name; ?>-desc"><?php echo $taxonomy->labels->separate_items_with_commas; ?></p>
437         <?php endif; ?>
438         </div>
439         <div class="tagchecklist"></div>
440 </div>
441 <?php if ( $user_can_assign_terms ) : ?>
442 <p class="hide-if-no-js"><a href="#titlediv" class="tagcloud-link" id="link-<?php echo $tax_name; ?>"><?php echo $taxonomy->labels->choose_from_most_used; ?></a></p>
443 <?php endif; ?>
444 <?php
445 }
446
447 /**
448  * Display post categories form fields.
449  *
450  * @since 2.6.0
451  *
452  * @todo Create taxonomy-agnostic wrapper for this.
453  *
454  * @param WP_Post $post Post object.
455  * @param array   $box {
456  *     Categories meta box arguments.
457  *
458  *     @type string   $id       Meta box 'id' attribute.
459  *     @type string   $title    Meta box title.
460  *     @type callable $callback Meta box display callback.
461  *     @type array    $args {
462  *         Extra meta box arguments.
463  *
464  *         @type string $taxonomy Taxonomy. Default 'category'.
465  *     }
466  * }
467  */
468 function post_categories_meta_box( $post, $box ) {
469         $defaults = array( 'taxonomy' => 'category' );
470         if ( ! isset( $box['args'] ) || ! is_array( $box['args'] ) ) {
471                 $args = array();
472         } else {
473                 $args = $box['args'];
474         }
475         $r = wp_parse_args( $args, $defaults );
476         $tax_name = esc_attr( $r['taxonomy'] );
477         $taxonomy = get_taxonomy( $r['taxonomy'] );
478         ?>
479         <div id="taxonomy-<?php echo $tax_name; ?>" class="categorydiv">
480                 <ul id="<?php echo $tax_name; ?>-tabs" class="category-tabs">
481                         <li class="tabs"><a href="#<?php echo $tax_name; ?>-all"><?php echo $taxonomy->labels->all_items; ?></a></li>
482                         <li class="hide-if-no-js"><a href="#<?php echo $tax_name; ?>-pop"><?php _e( 'Most Used' ); ?></a></li>
483                 </ul>
484
485                 <div id="<?php echo $tax_name; ?>-pop" class="tabs-panel" style="display: none;">
486                         <ul id="<?php echo $tax_name; ?>checklist-pop" class="categorychecklist form-no-clear" >
487                                 <?php $popular_ids = wp_popular_terms_checklist( $tax_name ); ?>
488                         </ul>
489                 </div>
490
491                 <div id="<?php echo $tax_name; ?>-all" class="tabs-panel">
492                         <?php
493                         $name = ( $tax_name == 'category' ) ? 'post_category' : 'tax_input[' . $tax_name . ']';
494                         echo "<input type='hidden' name='{$name}[]' value='0' />"; // Allows for an empty term set to be sent. 0 is an invalid Term ID and will be ignored by empty() checks.
495                         ?>
496                         <ul id="<?php echo $tax_name; ?>checklist" data-wp-lists="list:<?php echo $tax_name; ?>" class="categorychecklist form-no-clear">
497                                 <?php wp_terms_checklist( $post->ID, array( 'taxonomy' => $tax_name, 'popular_cats' => $popular_ids ) ); ?>
498                         </ul>
499                 </div>
500         <?php if ( current_user_can( $taxonomy->cap->edit_terms ) ) : ?>
501                         <div id="<?php echo $tax_name; ?>-adder" class="wp-hidden-children">
502                                 <a id="<?php echo $tax_name; ?>-add-toggle" href="#<?php echo $tax_name; ?>-add" class="hide-if-no-js taxonomy-add-new">
503                                         <?php
504                                                 /* translators: %s: add new taxonomy label */
505                                                 printf( __( '+ %s' ), $taxonomy->labels->add_new_item );
506                                         ?>
507                                 </a>
508                                 <p id="<?php echo $tax_name; ?>-add" class="category-add wp-hidden-child">
509                                         <label class="screen-reader-text" for="new<?php echo $tax_name; ?>"><?php echo $taxonomy->labels->add_new_item; ?></label>
510                                         <input type="text" name="new<?php echo $tax_name; ?>" id="new<?php echo $tax_name; ?>" class="form-required form-input-tip" value="<?php echo esc_attr( $taxonomy->labels->new_item_name ); ?>" aria-required="true"/>
511                                         <label class="screen-reader-text" for="new<?php echo $tax_name; ?>_parent">
512                                                 <?php echo $taxonomy->labels->parent_item_colon; ?>
513                                         </label>
514                                         <?php
515                                         $parent_dropdown_args = array(
516                                                 'taxonomy'         => $tax_name,
517                                                 'hide_empty'       => 0,
518                                                 'name'             => 'new' . $tax_name . '_parent',
519                                                 'orderby'          => 'name',
520                                                 'hierarchical'     => 1,
521                                                 'show_option_none' => '&mdash; ' . $taxonomy->labels->parent_item . ' &mdash;',
522                                         );
523
524                                         /**
525                                          * Filters the arguments for the taxonomy parent dropdown on the Post Edit page.
526                                          *
527                                          * @since 4.4.0
528                                          *
529                                          * @param array $parent_dropdown_args {
530                                          *     Optional. Array of arguments to generate parent dropdown.
531                                          *
532                                          *     @type string   $taxonomy         Name of the taxonomy to retrieve.
533                                          *     @type bool     $hide_if_empty    True to skip generating markup if no
534                                          *                                      categories are found. Default 0.
535                                          *     @type string   $name             Value for the 'name' attribute
536                                          *                                      of the select element.
537                                          *                                      Default "new{$tax_name}_parent".
538                                          *     @type string   $orderby          Which column to use for ordering
539                                          *                                      terms. Default 'name'.
540                                          *     @type bool|int $hierarchical     Whether to traverse the taxonomy
541                                          *                                      hierarchy. Default 1.
542                                          *     @type string   $show_option_none Text to display for the "none" option.
543                                          *                                      Default "&mdash; {$parent} &mdash;",
544                                          *                                      where `$parent` is 'parent_item'
545                                          *                                      taxonomy label.
546                                          * }
547                                          */
548                                         $parent_dropdown_args = apply_filters( 'post_edit_category_parent_dropdown_args', $parent_dropdown_args );
549
550                                         wp_dropdown_categories( $parent_dropdown_args );
551                                         ?>
552                                         <input type="button" id="<?php echo $tax_name; ?>-add-submit" data-wp-lists="add:<?php echo $tax_name; ?>checklist:<?php echo $tax_name; ?>-add" class="button category-add-submit" value="<?php echo esc_attr( $taxonomy->labels->add_new_item ); ?>" />
553                                         <?php wp_nonce_field( 'add-' . $tax_name, '_ajax_nonce-add-' . $tax_name, false ); ?>
554                                         <span id="<?php echo $tax_name; ?>-ajax-response"></span>
555                                 </p>
556                         </div>
557                 <?php endif; ?>
558         </div>
559         <?php
560 }
561
562 /**
563  * Display post excerpt form fields.
564  *
565  * @since 2.6.0
566  *
567  * @param object $post
568  */
569 function post_excerpt_meta_box($post) {
570 ?>
571 <label class="screen-reader-text" for="excerpt"><?php _e('Excerpt') ?></label><textarea rows="1" cols="40" name="excerpt" id="excerpt"><?php echo $post->post_excerpt; // textarea_escaped ?></textarea>
572 <p><?php
573         printf(
574                 /* translators: %s: Codex URL */
575                 __( 'Excerpts are optional hand-crafted summaries of your content that can be used in your theme. <a href="%s">Learn more about manual excerpts</a>.' ),
576                 __( 'https://codex.wordpress.org/Excerpt' )
577         );
578 ?></p>
579 <?php
580 }
581
582 /**
583  * Display trackback links form fields.
584  *
585  * @since 2.6.0
586  *
587  * @param object $post
588  */
589 function post_trackback_meta_box($post) {
590         $form_trackback = '<input type="text" name="trackback_url" id="trackback_url" class="code" value="' .
591                 esc_attr( str_replace( "\n", ' ', $post->to_ping ) ) . '" aria-describedby="trackback-url-desc" />';
592         if ('' != $post->pinged) {
593                 $pings = '<p>'. __('Already pinged:') . '</p><ul>';
594                 $already_pinged = explode("\n", trim($post->pinged));
595                 foreach ($already_pinged as $pinged_url) {
596                         $pings .= "\n\t<li>" . esc_html($pinged_url) . "</li>";
597                 }
598                 $pings .= '</ul>';
599         }
600
601 ?>
602 <p>
603         <label for="trackback_url"><?php _e( 'Send trackbacks to:' ); ?></label>
604         <?php echo $form_trackback; ?>
605 </p>
606 <p id="trackback-url-desc" class="howto"><?php _e( 'Separate multiple URLs with spaces' ); ?></p>
607 <p><?php
608         printf(
609                 /* translators: %s: Codex URL */
610                 __( 'Trackbacks are a way to notify legacy blog systems that you&#8217;ve linked to them. If you link other WordPress sites, they&#8217;ll be notified automatically using <a href="%s">pingbacks</a>, no other action necessary.' ),
611                 __( 'https://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments' )
612         );
613 ?></p>
614 <?php
615 if ( ! empty($pings) )
616         echo $pings;
617 }
618
619 /**
620  * Display custom fields form fields.
621  *
622  * @since 2.6.0
623  *
624  * @param object $post
625  */
626 function post_custom_meta_box($post) {
627 ?>
628 <div id="postcustomstuff">
629 <div id="ajax-response"></div>
630 <?php
631 $metadata = has_meta($post->ID);
632 foreach ( $metadata as $key => $value ) {
633         if ( is_protected_meta( $metadata[ $key ][ 'meta_key' ], 'post' ) || ! current_user_can( 'edit_post_meta', $post->ID, $metadata[ $key ][ 'meta_key' ] ) )
634                 unset( $metadata[ $key ] );
635 }
636 list_meta( $metadata );
637 meta_form( $post ); ?>
638 </div>
639 <p><?php
640         printf(
641                 /* translators: %s: Codex URL */
642                 __( 'Custom fields can be used to add extra metadata to a post that you can <a href="%s">use in your theme</a>.' ),
643                 __( 'https://codex.wordpress.org/Using_Custom_Fields' )
644         );
645 ?></p>
646 <?php
647 }
648
649 /**
650  * Display comments status form fields.
651  *
652  * @since 2.6.0
653  *
654  * @param object $post
655  */
656 function post_comment_status_meta_box($post) {
657 ?>
658 <input name="advanced_view" type="hidden" value="1" />
659 <p class="meta-options">
660         <label for="comment_status" class="selectit"><input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked($post->comment_status, 'open'); ?> /> <?php _e( 'Allow comments.' ) ?></label><br />
661         <label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked($post->ping_status, 'open'); ?> /> <?php
662                 printf(
663                         /* translators: %s: Codex URL */
664                         __( 'Allow <a href="%s">trackbacks and pingbacks</a> on this page.' ),
665                         __( 'https://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments' ) );
666                 ?></label>
667         <?php
668         /**
669          * Fires at the end of the Discussion meta box on the post editing screen.
670          *
671          * @since 3.1.0
672          *
673          * @param WP_Post $post WP_Post object of the current post.
674          */
675         do_action( 'post_comment_status_meta_box-options', $post );
676         ?>
677 </p>
678 <?php
679 }
680
681 /**
682  * Display comments for post table header
683  *
684  * @since 3.0.0
685  *
686  * @param array $result table header rows
687  * @return array
688  */
689 function post_comment_meta_box_thead($result) {
690         unset($result['cb'], $result['response']);
691         return $result;
692 }
693
694 /**
695  * Display comments for post.
696  *
697  * @since 2.8.0
698  *
699  * @param object $post
700  */
701 function post_comment_meta_box( $post ) {
702         wp_nonce_field( 'get-comments', 'add_comment_nonce', false );
703         ?>
704         <p class="hide-if-no-js" id="add-new-comment"><a class="button" href="#commentstatusdiv" onclick="window.commentReply && commentReply.addcomment(<?php echo $post->ID; ?>);return false;"><?php _e('Add comment'); ?></a></p>
705         <?php
706
707         $total = get_comments( array( 'post_id' => $post->ID, 'number' => 1, 'count' => true ) );
708         $wp_list_table = _get_list_table('WP_Post_Comments_List_Table');
709         $wp_list_table->display( true );
710
711         if ( 1 > $total ) {
712                 echo '<p id="no-comments">' . __('No comments yet.') . '</p>';
713         } else {
714                 $hidden = get_hidden_meta_boxes( get_current_screen() );
715                 if ( ! in_array('commentsdiv', $hidden) ) {
716                         ?>
717                         <script type="text/javascript">jQuery(document).ready(function(){commentsBox.get(<?php echo $total; ?>, 10);});</script>
718                         <?php
719                 }
720
721                 ?>
722                 <p class="hide-if-no-js" id="show-comments"><a href="#commentstatusdiv" onclick="commentsBox.load(<?php echo $total; ?>);return false;"><?php _e('Show comments'); ?></a> <span class="spinner"></span></p>
723                 <?php
724         }
725
726         wp_comment_trashnotice();
727 }
728
729 /**
730  * Display slug form fields.
731  *
732  * @since 2.6.0
733  *
734  * @param object $post
735  */
736 function post_slug_meta_box($post) {
737 /** This filter is documented in wp-admin/edit-tag-form.php */
738 $editable_slug = apply_filters( 'editable_slug', $post->post_name, $post );
739 ?>
740 <label class="screen-reader-text" for="post_name"><?php _e('Slug') ?></label><input name="post_name" type="text" size="13" id="post_name" value="<?php echo esc_attr( $editable_slug ); ?>" />
741 <?php
742 }
743
744 /**
745  * Display form field with list of authors.
746  *
747  * @since 2.6.0
748  *
749  * @global int $user_ID
750  *
751  * @param object $post
752  */
753 function post_author_meta_box($post) {
754         global $user_ID;
755 ?>
756 <label class="screen-reader-text" for="post_author_override"><?php _e('Author'); ?></label>
757 <?php
758         wp_dropdown_users( array(
759                 'who' => 'authors',
760                 'name' => 'post_author_override',
761                 'selected' => empty($post->ID) ? $user_ID : $post->post_author,
762                 'include_selected' => true,
763                 'show' => 'display_name_with_login',
764         ) );
765 }
766
767 /**
768  * Display list of revisions.
769  *
770  * @since 2.6.0
771  *
772  * @param object $post
773  */
774 function post_revisions_meta_box( $post ) {
775         wp_list_post_revisions( $post );
776 }
777
778 // -- Page related Meta Boxes
779
780 /**
781  * Display page attributes form fields.
782  *
783  * @since 2.7.0
784  *
785  * @param object $post
786  */
787 function page_attributes_meta_box($post) {
788         $post_type_object = get_post_type_object($post->post_type);
789         if ( $post_type_object->hierarchical ) {
790                 $dropdown_args = array(
791                         'post_type'        => $post->post_type,
792                         'exclude_tree'     => $post->ID,
793                         'selected'         => $post->post_parent,
794                         'name'             => 'parent_id',
795                         'show_option_none' => __('(no parent)'),
796                         'sort_column'      => 'menu_order, post_title',
797                         'echo'             => 0,
798                 );
799
800                 /**
801                  * Filters the arguments used to generate a Pages drop-down element.
802                  *
803                  * @since 3.3.0
804                  *
805                  * @see wp_dropdown_pages()
806                  *
807                  * @param array   $dropdown_args Array of arguments used to generate the pages drop-down.
808                  * @param WP_Post $post          The current WP_Post object.
809                  */
810                 $dropdown_args = apply_filters( 'page_attributes_dropdown_pages_args', $dropdown_args, $post );
811                 $pages = wp_dropdown_pages( $dropdown_args );
812                 if ( ! empty($pages) ) {
813 ?>
814 <p><strong><?php _e('Parent') ?></strong></p>
815 <label class="screen-reader-text" for="parent_id"><?php _e('Parent') ?></label>
816 <?php echo $pages; ?>
817 <?php
818                 } // end empty pages check
819         } // end hierarchical check.
820         if ( 'page' == $post->post_type && 0 != count( get_page_templates( $post ) ) && get_option( 'page_for_posts' ) != $post->ID ) {
821                 $template = !empty($post->page_template) ? $post->page_template : false;
822                 ?>
823 <p><strong><?php _e('Template') ?></strong><?php
824         /**
825          * Fires immediately after the heading inside the 'Template' section
826          * of the 'Page Attributes' meta box.
827          *
828          * @since 4.4.0
829          *
830          * @param string  $template The template used for the current post.
831          * @param WP_Post $post     The current post.
832          */
833         do_action( 'page_attributes_meta_box_template', $template, $post );
834 ?></p>
835 <label class="screen-reader-text" for="page_template"><?php _e('Page Template') ?></label><select name="page_template" id="page_template">
836 <?php
837 /**
838  * Filters the title of the default page template displayed in the drop-down.
839  *
840  * @since 4.1.0
841  *
842  * @param string $label   The display value for the default page template title.
843  * @param string $context Where the option label is displayed. Possible values
844  *                        include 'meta-box' or 'quick-edit'.
845  */
846 $default_title = apply_filters( 'default_page_template_title',  __( 'Default Template' ), 'meta-box' );
847 ?>
848 <option value="default"><?php echo esc_html( $default_title ); ?></option>
849 <?php page_template_dropdown($template); ?>
850 </select>
851 <?php
852         } ?>
853 <p><strong><?php _e('Order') ?></strong></p>
854 <p><label class="screen-reader-text" for="menu_order"><?php _e('Order') ?></label><input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo esc_attr($post->menu_order) ?>" /></p>
855 <?php if ( 'page' == $post->post_type && get_current_screen()->get_help_tabs() ) { ?>
856 <p><?php _e( 'Need help? Use the Help tab above the screen title.' ); ?></p>
857 <?php
858         }
859 }
860
861 // -- Link related Meta Boxes
862
863 /**
864  * Display link create form fields.
865  *
866  * @since 2.7.0
867  *
868  * @param object $link
869  */
870 function link_submit_meta_box($link) {
871 ?>
872 <div class="submitbox" id="submitlink">
873
874 <div id="minor-publishing">
875
876 <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?>
877 <div style="display:none;">
878 <?php submit_button( __( 'Save' ), 'button', 'save', false ); ?>
879 </div>
880
881 <div id="minor-publishing-actions">
882 <div id="preview-action">
883 <?php if ( !empty($link->link_id) ) { ?>
884         <a class="preview button" href="<?php echo $link->link_url; ?>" target="_blank"><?php _e('Visit Link'); ?></a>
885 <?php } ?>
886 </div>
887 <div class="clear"></div>
888 </div>
889
890 <div id="misc-publishing-actions">
891 <div class="misc-pub-section misc-pub-private">
892         <label for="link_private" class="selectit"><input id="link_private" name="link_visible" type="checkbox" value="N" <?php checked($link->link_visible, 'N'); ?> /> <?php _e('Keep this link private') ?></label>
893 </div>
894 </div>
895
896 </div>
897
898 <div id="major-publishing-actions">
899 <?php
900 /** This action is documented in wp-admin/includes/meta-boxes.php */
901 do_action( 'post_submitbox_start' );
902 ?>
903 <div id="delete-action">
904 <?php
905 if ( !empty($_GET['action']) && 'edit' == $_GET['action'] && current_user_can('manage_links') ) { ?>
906         <a class="submitdelete deletion" href="<?php echo wp_nonce_url("link.php?action=delete&amp;link_id=$link->link_id", 'delete-bookmark_' . $link->link_id); ?>" onclick="if ( confirm('<?php echo esc_js(sprintf(__("You are about to delete this link '%s'\n  'Cancel' to stop, 'OK' to delete."), $link->link_name )); ?>') ) {return true;}return false;"><?php _e('Delete'); ?></a>
907 <?php } ?>
908 </div>
909
910 <div id="publishing-action">
911 <?php if ( !empty($link->link_id) ) { ?>
912         <input name="save" type="submit" class="button-large button-primary" id="publish" value="<?php esc_attr_e( 'Update Link' ) ?>" />
913 <?php } else { ?>
914         <input name="save" type="submit" class="button-large button-primary" id="publish" value="<?php esc_attr_e( 'Add Link' ) ?>" />
915 <?php } ?>
916 </div>
917 <div class="clear"></div>
918 </div>
919 <?php
920 /**
921  * Fires at the end of the Publish box in the Link editing screen.
922  *
923  * @since 2.5.0
924  */
925 do_action( 'submitlink_box' );
926 ?>
927 <div class="clear"></div>
928 </div>
929 <?php
930 }
931
932 /**
933  * Display link categories form fields.
934  *
935  * @since 2.6.0
936  *
937  * @param object $link
938  */
939 function link_categories_meta_box($link) {
940 ?>
941 <div id="taxonomy-linkcategory" class="categorydiv">
942         <ul id="category-tabs" class="category-tabs">
943                 <li class="tabs"><a href="#categories-all"><?php _e( 'All Categories' ); ?></a></li>
944                 <li class="hide-if-no-js"><a href="#categories-pop"><?php _e( 'Most Used' ); ?></a></li>
945         </ul>
946
947         <div id="categories-all" class="tabs-panel">
948                 <ul id="categorychecklist" data-wp-lists="list:category" class="categorychecklist form-no-clear">
949                         <?php
950                         if ( isset($link->link_id) )
951                                 wp_link_category_checklist($link->link_id);
952                         else
953                                 wp_link_category_checklist();
954                         ?>
955                 </ul>
956         </div>
957
958         <div id="categories-pop" class="tabs-panel" style="display: none;">
959                 <ul id="categorychecklist-pop" class="categorychecklist form-no-clear">
960                         <?php wp_popular_terms_checklist('link_category'); ?>
961                 </ul>
962         </div>
963
964         <div id="category-adder" class="wp-hidden-children">
965                 <a id="category-add-toggle" href="#category-add" class="taxonomy-add-new"><?php _e( '+ Add New Category' ); ?></a>
966                 <p id="link-category-add" class="wp-hidden-child">
967                         <label class="screen-reader-text" for="newcat"><?php _e( '+ Add New Category' ); ?></label>
968                         <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php esc_attr_e( 'New category name' ); ?>" aria-required="true" />
969                         <input type="button" id="link-category-add-submit" data-wp-lists="add:categorychecklist:link-category-add" class="button" value="<?php esc_attr_e( 'Add' ); ?>" />
970                         <?php wp_nonce_field( 'add-link-category', '_ajax_nonce', false ); ?>
971                         <span id="category-ajax-response"></span>
972                 </p>
973         </div>
974 </div>
975 <?php
976 }
977
978 /**
979  * Display form fields for changing link target.
980  *
981  * @since 2.6.0
982  *
983  * @param object $link
984  */
985 function link_target_meta_box($link) { ?>
986 <fieldset><legend class="screen-reader-text"><span><?php _e('Target') ?></span></legend>
987 <p><label for="link_target_blank" class="selectit">
988 <input id="link_target_blank" type="radio" name="link_target" value="_blank" <?php echo ( isset( $link->link_target ) && ($link->link_target == '_blank') ? 'checked="checked"' : ''); ?> />
989 <?php _e('<code>_blank</code> &mdash; new window or tab.'); ?></label></p>
990 <p><label for="link_target_top" class="selectit">
991 <input id="link_target_top" type="radio" name="link_target" value="_top" <?php echo ( isset( $link->link_target ) && ($link->link_target == '_top') ? 'checked="checked"' : ''); ?> />
992 <?php _e('<code>_top</code> &mdash; current window or tab, with no frames.'); ?></label></p>
993 <p><label for="link_target_none" class="selectit">
994 <input id="link_target_none" type="radio" name="link_target" value="" <?php echo ( isset( $link->link_target ) && ($link->link_target == '') ? 'checked="checked"' : ''); ?> />
995 <?php _e('<code>_none</code> &mdash; same window or tab.'); ?></label></p>
996 </fieldset>
997 <p><?php _e('Choose the target frame for your link.'); ?></p>
998 <?php
999 }
1000
1001 /**
1002  * Display checked checkboxes attribute for xfn microformat options.
1003  *
1004  * @since 1.0.1
1005  *
1006  * @global object $link
1007  *
1008  * @param string $class
1009  * @param string $value
1010  * @param mixed $deprecated Never used.
1011  */
1012 function xfn_check( $class, $value = '', $deprecated = '' ) {
1013         global $link;
1014
1015         if ( !empty( $deprecated ) )
1016                 _deprecated_argument( __FUNCTION__, '0.0.0' ); // Never implemented
1017
1018         $link_rel = isset( $link->link_rel ) ? $link->link_rel : ''; // In PHP 5.3: $link_rel = $link->link_rel ?: '';
1019         $rels = preg_split('/\s+/', $link_rel);
1020
1021         if ('' != $value && in_array($value, $rels) ) {
1022                 echo ' checked="checked"';
1023         }
1024
1025         if ('' == $value) {
1026                 if ('family' == $class && strpos($link_rel, 'child') === false && strpos($link_rel, 'parent') === false && strpos($link_rel, 'sibling') === false && strpos($link_rel, 'spouse') === false && strpos($link_rel, 'kin') === false) echo ' checked="checked"';
1027                 if ('friendship' == $class && strpos($link_rel, 'friend') === false && strpos($link_rel, 'acquaintance') === false && strpos($link_rel, 'contact') === false) echo ' checked="checked"';
1028                 if ('geographical' == $class && strpos($link_rel, 'co-resident') === false && strpos($link_rel, 'neighbor') === false) echo ' checked="checked"';
1029                 if ('identity' == $class && in_array('me', $rels) ) echo ' checked="checked"';
1030         }
1031 }
1032
1033 /**
1034  * Display xfn form fields.
1035  *
1036  * @since 2.6.0
1037  *
1038  * @param object $link
1039  */
1040 function link_xfn_meta_box($link) {
1041 ?>
1042 <table class="links-table">
1043         <tr>
1044                 <th scope="row"><label for="link_rel"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('rel:') ?></label></th>
1045                 <td><input type="text" name="link_rel" id="link_rel" value="<?php echo ( isset( $link->link_rel ) ? esc_attr($link->link_rel) : ''); ?>" /></td>
1046         </tr>
1047         <tr>
1048                 <th scope="row"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('identity') ?></th>
1049                 <td><fieldset><legend class="screen-reader-text"><span><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('identity') ?></span></legend>
1050                         <label for="me">
1051                         <input type="checkbox" name="identity" value="me" id="me" <?php xfn_check('identity', 'me'); ?> />
1052                         <?php _e('another web address of mine') ?></label>
1053                 </fieldset></td>
1054         </tr>
1055         <tr>
1056                 <th scope="row"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('friendship') ?></th>
1057                 <td><fieldset><legend class="screen-reader-text"><span><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('friendship') ?></span></legend>
1058                         <label for="contact">
1059                         <input class="valinp" type="radio" name="friendship" value="contact" id="contact" <?php xfn_check('friendship', 'contact'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('contact') ?>
1060                         </label>
1061                         <label for="acquaintance">
1062                         <input class="valinp" type="radio" name="friendship" value="acquaintance" id="acquaintance" <?php xfn_check('friendship', 'acquaintance'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('acquaintance') ?>
1063                         </label>
1064                         <label for="friend">
1065                         <input class="valinp" type="radio" name="friendship" value="friend" id="friend" <?php xfn_check('friendship', 'friend'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('friend') ?>
1066                         </label>
1067                         <label for="friendship">
1068                         <input name="friendship" type="radio" class="valinp" value="" id="friendship" <?php xfn_check('friendship'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('none') ?>
1069                         </label>
1070                 </fieldset></td>
1071         </tr>
1072         <tr>
1073                 <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('physical') ?> </th>
1074                 <td><fieldset><legend class="screen-reader-text"><span><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('physical') ?></span></legend>
1075                         <label for="met">
1076                         <input class="valinp" type="checkbox" name="physical" value="met" id="met" <?php xfn_check('physical', 'met'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('met') ?>
1077                         </label>
1078                 </fieldset></td>
1079         </tr>
1080         <tr>
1081                 <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('professional') ?> </th>
1082                 <td><fieldset><legend class="screen-reader-text"><span><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('professional') ?></span></legend>
1083                         <label for="co-worker">
1084                         <input class="valinp" type="checkbox" name="professional" value="co-worker" id="co-worker" <?php xfn_check('professional', 'co-worker'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('co-worker') ?>
1085                         </label>
1086                         <label for="colleague">
1087                         <input class="valinp" type="checkbox" name="professional" value="colleague" id="colleague" <?php xfn_check('professional', 'colleague'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('colleague') ?>
1088                         </label>
1089                 </fieldset></td>
1090         </tr>
1091         <tr>
1092                 <th scope="row"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('geographical') ?></th>
1093                 <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('geographical') ?> </span></legend>
1094                         <label for="co-resident">
1095                         <input class="valinp" type="radio" name="geographical" value="co-resident" id="co-resident" <?php xfn_check('geographical', 'co-resident'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('co-resident') ?>
1096                         </label>
1097                         <label for="neighbor">
1098                         <input class="valinp" type="radio" name="geographical" value="neighbor" id="neighbor" <?php xfn_check('geographical', 'neighbor'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('neighbor') ?>
1099                         </label>
1100                         <label for="geographical">
1101                         <input class="valinp" type="radio" name="geographical" value="" id="geographical" <?php xfn_check('geographical'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('none') ?>
1102                         </label>
1103                 </fieldset></td>
1104         </tr>
1105         <tr>
1106                 <th scope="row"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('family') ?></th>
1107                 <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('family') ?> </span></legend>
1108                         <label for="child">
1109                         <input class="valinp" type="radio" name="family" value="child" id="child" <?php xfn_check('family', 'child'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('child') ?>
1110                         </label>
1111                         <label for="kin">
1112                         <input class="valinp" type="radio" name="family" value="kin" id="kin" <?php xfn_check('family', 'kin'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('kin') ?>
1113                         </label>
1114                         <label for="parent">
1115                         <input class="valinp" type="radio" name="family" value="parent" id="parent" <?php xfn_check('family', 'parent'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('parent') ?>
1116                         </label>
1117                         <label for="sibling">
1118                         <input class="valinp" type="radio" name="family" value="sibling" id="sibling" <?php xfn_check('family', 'sibling'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('sibling') ?>
1119                         </label>
1120                         <label for="spouse">
1121                         <input class="valinp" type="radio" name="family" value="spouse" id="spouse" <?php xfn_check('family', 'spouse'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('spouse') ?>
1122                         </label>
1123                         <label for="family">
1124                         <input class="valinp" type="radio" name="family" value="" id="family" <?php xfn_check('family'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('none') ?>
1125                         </label>
1126                 </fieldset></td>
1127         </tr>
1128         <tr>
1129                 <th scope="row"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('romantic') ?></th>
1130                 <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('romantic') ?> </span></legend>
1131                         <label for="muse">
1132                         <input class="valinp" type="checkbox" name="romantic" value="muse" id="muse" <?php xfn_check('romantic', 'muse'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('muse') ?>
1133                         </label>
1134                         <label for="crush">
1135                         <input class="valinp" type="checkbox" name="romantic" value="crush" id="crush" <?php xfn_check('romantic', 'crush'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('crush') ?>
1136                         </label>
1137                         <label for="date">
1138                         <input class="valinp" type="checkbox" name="romantic" value="date" id="date" <?php xfn_check('romantic', 'date'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('date') ?>
1139                         </label>
1140                         <label for="romantic">
1141                         <input class="valinp" type="checkbox" name="romantic" value="sweetheart" id="romantic" <?php xfn_check('romantic', 'sweetheart'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('sweetheart') ?>
1142                         </label>
1143                 </fieldset></td>
1144         </tr>
1145
1146 </table>
1147 <p><?php _e('If the link is to a person, you can specify your relationship with them using the above form. If you would like to learn more about the idea check out <a href="http://gmpg.org/xfn/">XFN</a>.'); ?></p>
1148 <?php
1149 }
1150
1151 /**
1152  * Display advanced link options form fields.
1153  *
1154  * @since 2.6.0
1155  *
1156  * @param object $link
1157  */
1158 function link_advanced_meta_box($link) {
1159 ?>
1160 <table class="links-table" cellpadding="0">
1161         <tr>
1162                 <th scope="row"><label for="link_image"><?php _e('Image Address') ?></label></th>
1163                 <td><input type="text" name="link_image" class="code" id="link_image" maxlength="255" value="<?php echo ( isset( $link->link_image ) ? esc_attr($link->link_image) : ''); ?>" /></td>
1164         </tr>
1165         <tr>
1166                 <th scope="row"><label for="rss_uri"><?php _e('RSS Address') ?></label></th>
1167                 <td><input name="link_rss" class="code" type="text" id="rss_uri" maxlength="255" value="<?php echo ( isset( $link->link_rss ) ? esc_attr($link->link_rss) : ''); ?>" /></td>
1168         </tr>
1169         <tr>
1170                 <th scope="row"><label for="link_notes"><?php _e('Notes') ?></label></th>
1171                 <td><textarea name="link_notes" id="link_notes" rows="10"><?php echo ( isset( $link->link_notes ) ? $link->link_notes : ''); // textarea_escaped ?></textarea></td>
1172         </tr>
1173         <tr>
1174                 <th scope="row"><label for="link_rating"><?php _e('Rating') ?></label></th>
1175                 <td><select name="link_rating" id="link_rating" size="1">
1176                 <?php
1177                         for ( $r = 0; $r <= 10; $r++ ) {
1178                                 echo '<option value="' . $r . '"';
1179                                 if ( isset($link->link_rating) && $link->link_rating == $r )
1180                                         echo ' selected="selected"';
1181                                 echo('>' . $r . '</option>');
1182                         }
1183                 ?></select>&nbsp;<?php _e('(Leave at 0 for no rating.)') ?>
1184                 </td>
1185         </tr>
1186 </table>
1187 <?php
1188 }
1189
1190 /**
1191  * Display post thumbnail meta box.
1192  *
1193  * @since 2.9.0
1194  *
1195  * @param WP_Post $post A post object.
1196  */
1197 function post_thumbnail_meta_box( $post ) {
1198         $thumbnail_id = get_post_meta( $post->ID, '_thumbnail_id', true );
1199         echo _wp_post_thumbnail_html( $thumbnail_id, $post->ID );
1200 }
1201
1202 /**
1203  * Display fields for ID3 data
1204  *
1205  * @since 3.9.0
1206  *
1207  * @param WP_Post $post A post object.
1208  */
1209 function attachment_id3_data_meta_box( $post ) {
1210         $meta = array();
1211         if ( ! empty( $post->ID ) ) {
1212                 $meta = wp_get_attachment_metadata( $post->ID );
1213         }
1214
1215         foreach ( wp_get_attachment_id3_keys( $post, 'edit' ) as $key => $label ) : ?>
1216         <p>
1217                 <label for="title"><?php echo $label ?></label><br />
1218                 <input type="text" name="id3_<?php echo esc_attr( $key ) ?>" id="id3_<?php echo esc_attr( $key ) ?>" class="large-text" value="<?php
1219                         if ( ! empty( $meta[ $key ] ) ) {
1220                                 echo esc_attr( $meta[ $key ] );
1221                         }
1222                 ?>" />
1223         </p>
1224         <?php
1225         endforeach;
1226 }