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