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