PageRenderTime 59ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 1ms

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

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