PageRenderTime 63ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-admin/includes/meta-boxes.php

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