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