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