PageRenderTime 43ms CodeModel.GetById 13ms RepoModel.GetById 1ms app.codeStats 0ms

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

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