wp/wp-admin/includes/meta-boxes.php
changeset 19 3d72ae0968f4
parent 18 be944660c56a
child 21 48c4eec2b7e6
equal deleted inserted replaced
18:be944660c56a 19:3d72ae0968f4
    85 			</div>
    85 			</div>
    86 			<?php
    86 			<?php
    87 		endif;
    87 		endif;
    88 
    88 
    89 		/**
    89 		/**
    90 		 * Fires before the post time/date setting in the Publish meta box.
    90 		 * Fires after the Save Draft (or Save as Pending) and Preview (or Preview Changes) buttons
       
    91 		 * in the Publish meta box.
    91 		 *
    92 		 *
    92 		 * @since 4.4.0
    93 		 * @since 4.4.0
    93 		 *
    94 		 *
    94 		 * @param WP_Post $post WP_Post object for the current post.
    95 		 * @param WP_Post $post WP_Post object for the current post.
    95 		 */
    96 		 */
   284 			<div class="notice notice-info notice-alt inline">
   285 			<div class="notice notice-info notice-alt inline">
   285 				<p>
   286 				<p>
   286 					<?php
   287 					<?php
   287 					printf(
   288 					printf(
   288 						/* translators: %s: URL to the Customizer. */
   289 						/* translators: %s: URL to the Customizer. */
   289 						__( 'This draft comes from your <a href="%s">unpublished customization changes</a>. You can edit, but there&#8217;s no need to publish now. It will be published automatically with those changes.' ),
   290 						__( 'This draft comes from your <a href="%s">unpublished customization changes</a>. You can edit, but there is no need to publish now. It will be published automatically with those changes.' ),
   290 						esc_url(
   291 						esc_url(
   291 							add_query_arg(
   292 							add_query_arg(
   292 								'changeset_uuid',
   293 								'changeset_uuid',
   293 								rawurlencode( get_post_meta( $post_id, '_customize_changeset_uuid', true ) ),
   294 								rawurlencode( get_post_meta( $post_id, '_customize_changeset_uuid', true ) ),
   294 								admin_url( 'customize.php' )
   295 								admin_url( 'customize.php' )
   379 </div>
   380 </div>
   380 	<?php
   381 	<?php
   381 }
   382 }
   382 
   383 
   383 /**
   384 /**
   384  * Display attachment submit form fields.
   385  * Displays attachment submit form fields.
   385  *
   386  *
   386  * @since 3.5.0
   387  * @since 3.5.0
   387  *
   388  *
   388  * @param WP_Post $post
   389  * @param WP_Post $post Current post object.
   389  */
   390  */
   390 function attachment_submit_meta_box( $post ) {
   391 function attachment_submit_meta_box( $post ) {
   391 	?>
   392 	?>
   392 <div class="submitbox" id="submitpost">
   393 <div class="submitbox" id="submitpost">
   393 
   394 
   459 
   460 
   460 	<?php
   461 	<?php
   461 }
   462 }
   462 
   463 
   463 /**
   464 /**
   464  * Display post format form elements.
   465  * Displays post format form elements.
   465  *
   466  *
   466  * @since 3.1.0
   467  * @since 3.1.0
   467  *
   468  *
   468  * @param WP_Post $post Post object.
   469  * @param WP_Post $post Current post object.
   469  * @param array   $box {
   470  * @param array   $box {
   470  *     Post formats meta box arguments.
   471  *     Post formats meta box arguments.
   471  *
   472  *
   472  *     @type string   $id       Meta box 'id' attribute.
   473  *     @type string   $id       Meta box 'id' attribute.
   473  *     @type string   $title    Meta box title.
   474  *     @type string   $title    Meta box title.
   482 		if ( is_array( $post_formats[0] ) ) :
   483 		if ( is_array( $post_formats[0] ) ) :
   483 			$post_format = get_post_format( $post->ID );
   484 			$post_format = get_post_format( $post->ID );
   484 			if ( ! $post_format ) {
   485 			if ( ! $post_format ) {
   485 				$post_format = '0';
   486 				$post_format = '0';
   486 			}
   487 			}
   487 			// Add in the current one if it isn't there yet, in case the current theme doesn't support it.
   488 			// Add in the current one if it isn't there yet, in case the active theme doesn't support it.
   488 			if ( $post_format && ! in_array( $post_format, $post_formats[0], true ) ) {
   489 			if ( $post_format && ! in_array( $post_format, $post_formats[0], true ) ) {
   489 				$post_formats[0][] = $post_format;
   490 				$post_formats[0][] = $post_format;
   490 			}
   491 			}
   491 			?>
   492 			?>
   492 		<div id="post-formats-select">
   493 		<div id="post-formats-select">
   502 	endif;
   503 	endif;
   503 endif;
   504 endif;
   504 }
   505 }
   505 
   506 
   506 /**
   507 /**
   507  * Display post tags form fields.
   508  * Displays post tags form fields.
   508  *
   509  *
   509  * @since 2.6.0
   510  * @since 2.6.0
   510  *
   511  *
   511  * @todo Create taxonomy-agnostic wrapper for this.
   512  * @todo Create taxonomy-agnostic wrapper for this.
   512  *
   513  *
   513  * @param WP_Post $post Post object.
   514  * @param WP_Post $post Current post object.
   514  * @param array   $box {
   515  * @param array   $box {
   515  *     Tags meta box arguments.
   516  *     Tags meta box arguments.
   516  *
   517  *
   517  *     @type string   $id       Meta box 'id' attribute.
   518  *     @type string   $id       Meta box 'id' attribute.
   518  *     @type string   $title    Meta box title.
   519  *     @type string   $title    Meta box title.
   565 <?php endif; ?>
   566 <?php endif; ?>
   566 	<?php
   567 	<?php
   567 }
   568 }
   568 
   569 
   569 /**
   570 /**
   570  * Display post categories form fields.
   571  * Displays post categories form fields.
   571  *
   572  *
   572  * @since 2.6.0
   573  * @since 2.6.0
   573  *
   574  *
   574  * @todo Create taxonomy-agnostic wrapper for this.
   575  * @todo Create taxonomy-agnostic wrapper for this.
   575  *
   576  *
   576  * @param WP_Post $post Post object.
   577  * @param WP_Post $post Current post object.
   577  * @param array   $box {
   578  * @param array   $box {
   578  *     Categories meta box arguments.
   579  *     Categories meta box arguments.
   579  *
   580  *
   580  *     @type string   $id       Meta box 'id' attribute.
   581  *     @type string   $id       Meta box 'id' attribute.
   581  *     @type string   $title    Meta box title.
   582  *     @type string   $title    Meta box title.
   689 	</div>
   690 	</div>
   690 	<?php
   691 	<?php
   691 }
   692 }
   692 
   693 
   693 /**
   694 /**
   694  * Display post excerpt form fields.
   695  * Displays post excerpt form fields.
   695  *
   696  *
   696  * @since 2.6.0
   697  * @since 2.6.0
   697  *
   698  *
   698  * @param WP_Post $post
   699  * @param WP_Post $post Current post object.
   699  */
   700  */
   700 function post_excerpt_meta_box( $post ) {
   701 function post_excerpt_meta_box( $post ) {
   701 	?>
   702 	?>
   702 <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>
   703 <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>
   703 <p>
   704 <p>
   711 </p>
   712 </p>
   712 	<?php
   713 	<?php
   713 }
   714 }
   714 
   715 
   715 /**
   716 /**
   716  * Display trackback links form fields.
   717  * Displays trackback links form fields.
   717  *
   718  *
   718  * @since 2.6.0
   719  * @since 2.6.0
   719  *
   720  *
   720  * @param WP_Post $post
   721  * @param WP_Post $post Current post object.
   721  */
   722  */
   722 function post_trackback_meta_box( $post ) {
   723 function post_trackback_meta_box( $post ) {
   723 	$form_trackback = '<input type="text" name="trackback_url" id="trackback_url" class="code" value="' .
   724 	$form_trackback = '<input type="text" name="trackback_url" id="trackback_url" class="code" value="' .
   724 		esc_attr( str_replace( "\n", ' ', $post->to_ping ) ) . '" aria-describedby="trackback-url-desc" />';
   725 		esc_attr( str_replace( "\n", ' ', $post->to_ping ) ) . '" aria-describedby="trackback-url-desc" />';
   725 
   726 
   752 		echo $pings;
   753 		echo $pings;
   753 	}
   754 	}
   754 }
   755 }
   755 
   756 
   756 /**
   757 /**
   757  * Display custom fields form fields.
   758  * Displays custom fields form fields.
   758  *
   759  *
   759  * @since 2.6.0
   760  * @since 2.6.0
   760  *
   761  *
   761  * @param WP_Post $post
   762  * @param WP_Post $post Current post object.
   762  */
   763  */
   763 function post_custom_meta_box( $post ) {
   764 function post_custom_meta_box( $post ) {
   764 	?>
   765 	?>
   765 <div id="postcustomstuff">
   766 <div id="postcustomstuff">
   766 <div id="ajax-response"></div>
   767 <div id="ajax-response"></div>
   786 </p>
   787 </p>
   787 	<?php
   788 	<?php
   788 }
   789 }
   789 
   790 
   790 /**
   791 /**
   791  * Display comments status form fields.
   792  * Displays comments status form fields.
   792  *
   793  *
   793  * @since 2.6.0
   794  * @since 2.6.0
   794  *
   795  *
   795  * @param WP_Post $post
   796  * @param WP_Post $post Current post object.
   796  */
   797  */
   797 function post_comment_status_meta_box( $post ) {
   798 function post_comment_status_meta_box( $post ) {
   798 	?>
   799 	?>
   799 <input name="advanced_view" type="hidden" value="1" />
   800 <input name="advanced_view" type="hidden" value="1" />
   800 <p class="meta-options">
   801 <p class="meta-options">
   812 	/**
   813 	/**
   813 	 * Fires at the end of the Discussion meta box on the post editing screen.
   814 	 * Fires at the end of the Discussion meta box on the post editing screen.
   814 	 *
   815 	 *
   815 	 * @since 3.1.0
   816 	 * @since 3.1.0
   816 	 *
   817 	 *
   817 	 * @param WP_Post $post WP_Post object of the current post.
   818 	 * @param WP_Post $post WP_Post object for the current post.
   818 	 */
   819 	 */
   819 	do_action( 'post_comment_status_meta_box-options', $post ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
   820 	do_action( 'post_comment_status_meta_box-options', $post ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
   820 	?>
   821 	?>
   821 </p>
   822 </p>
   822 	<?php
   823 	<?php
   823 }
   824 }
   824 
   825 
   825 /**
   826 /**
   826  * Display comments for post table header
   827  * Displays comments for post table header
   827  *
   828  *
   828  * @since 3.0.0
   829  * @since 3.0.0
   829  *
   830  *
   830  * @param array $result table header rows
   831  * @param array $result Table header rows.
   831  * @return array
   832  * @return array
   832  */
   833  */
   833 function post_comment_meta_box_thead( $result ) {
   834 function post_comment_meta_box_thead( $result ) {
   834 	unset( $result['cb'], $result['response'] );
   835 	unset( $result['cb'], $result['response'] );
   835 	return $result;
   836 	return $result;
   836 }
   837 }
   837 
   838 
   838 /**
   839 /**
   839  * Display comments for post.
   840  * Displays comments for post.
   840  *
   841  *
   841  * @since 2.8.0
   842  * @since 2.8.0
   842  *
   843  *
   843  * @param WP_Post $post
   844  * @param WP_Post $post Current post object.
   844  */
   845  */
   845 function post_comment_meta_box( $post ) {
   846 function post_comment_meta_box( $post ) {
   846 	wp_nonce_field( 'get-comments', 'add_comment_nonce', false );
   847 	wp_nonce_field( 'get-comments', 'add_comment_nonce', false );
   847 	?>
   848 	?>
   848 	<p class="hide-if-no-js" id="add-new-comment"><button type="button" class="button" onclick="window.commentReply && commentReply.addcomment(<?php echo $post->ID; ?>);"><?php _e( 'Add Comment' ); ?></button></p>
   849 	<p class="hide-if-no-js" id="add-new-comment"><button type="button" class="button" onclick="window.commentReply && commentReply.addcomment(<?php echo $post->ID; ?>);"><?php _e( 'Add Comment' ); ?></button></p>
   862 		echo '<p id="no-comments">' . __( 'No comments yet.' ) . '</p>';
   863 		echo '<p id="no-comments">' . __( 'No comments yet.' ) . '</p>';
   863 	} else {
   864 	} else {
   864 		$hidden = get_hidden_meta_boxes( get_current_screen() );
   865 		$hidden = get_hidden_meta_boxes( get_current_screen() );
   865 		if ( ! in_array( 'commentsdiv', $hidden, true ) ) {
   866 		if ( ! in_array( 'commentsdiv', $hidden, true ) ) {
   866 			?>
   867 			?>
   867 			<script type="text/javascript">jQuery(document).ready(function(){commentsBox.get(<?php echo $total; ?>, 10);});</script>
   868 			<script type="text/javascript">jQuery(function(){commentsBox.get(<?php echo $total; ?>, 10);});</script>
   868 			<?php
   869 			<?php
   869 		}
   870 		}
   870 
   871 
   871 		?>
   872 		?>
   872 		<p class="hide-if-no-js" id="show-comments"><a href="#commentstatusdiv" onclick="commentsBox.load(<?php echo $total; ?>);return false;"><?php _e( 'Show comments' ); ?></a> <span class="spinner"></span></p>
   873 		<p class="hide-if-no-js" id="show-comments"><a href="#commentstatusdiv" onclick="commentsBox.load(<?php echo $total; ?>);return false;"><?php _e( 'Show comments' ); ?></a> <span class="spinner"></span></p>
   875 
   876 
   876 	wp_comment_trashnotice();
   877 	wp_comment_trashnotice();
   877 }
   878 }
   878 
   879 
   879 /**
   880 /**
   880  * Display slug form fields.
   881  * Displays slug form fields.
   881  *
   882  *
   882  * @since 2.6.0
   883  * @since 2.6.0
   883  *
   884  *
   884  * @param WP_Post $post
   885  * @param WP_Post $post Current post object.
   885  */
   886  */
   886 function post_slug_meta_box( $post ) {
   887 function post_slug_meta_box( $post ) {
   887 	/** This filter is documented in wp-admin/edit-tag-form.php */
   888 	/** This filter is documented in wp-admin/edit-tag-form.php */
   888 	$editable_slug = apply_filters( 'editable_slug', $post->post_name, $post );
   889 	$editable_slug = apply_filters( 'editable_slug', $post->post_name, $post );
   889 	?>
   890 	?>
   890 <label class="screen-reader-text" for="post_name"><?php _e( 'Slug' ); ?></label><input name="post_name" type="text" size="13" id="post_name" value="<?php echo esc_attr( $editable_slug ); ?>" />
   891 <label class="screen-reader-text" for="post_name"><?php _e( 'Slug' ); ?></label><input name="post_name" type="text" size="13" id="post_name" value="<?php echo esc_attr( $editable_slug ); ?>" />
   891 	<?php
   892 	<?php
   892 }
   893 }
   893 
   894 
   894 /**
   895 /**
   895  * Display form field with list of authors.
   896  * Displays form field with list of authors.
   896  *
   897  *
   897  * @since 2.6.0
   898  * @since 2.6.0
   898  *
   899  *
   899  * @global int $user_ID
   900  * @global int $user_ID
   900  *
   901  *
   901  * @param WP_Post $post
   902  * @param WP_Post $post Current post object.
   902  */
   903  */
   903 function post_author_meta_box( $post ) {
   904 function post_author_meta_box( $post ) {
   904 	global $user_ID;
   905 	global $user_ID;
       
   906 
       
   907 	$post_type_object = get_post_type_object( $post->post_type );
   905 	?>
   908 	?>
   906 <label class="screen-reader-text" for="post_author_override"><?php _e( 'Author' ); ?></label>
   909 <label class="screen-reader-text" for="post_author_override"><?php _e( 'Author' ); ?></label>
   907 	<?php
   910 	<?php
   908 	wp_dropdown_users(
   911 	wp_dropdown_users(
   909 		array(
   912 		array(
   910 			'who'              => 'authors',
   913 			'capability'       => array( $post_type_object->cap->edit_posts ),
   911 			'name'             => 'post_author_override',
   914 			'name'             => 'post_author_override',
   912 			'selected'         => empty( $post->ID ) ? $user_ID : $post->post_author,
   915 			'selected'         => empty( $post->ID ) ? $user_ID : $post->post_author,
   913 			'include_selected' => true,
   916 			'include_selected' => true,
   914 			'show'             => 'display_name_with_login',
   917 			'show'             => 'display_name_with_login',
   915 		)
   918 		)
   916 	);
   919 	);
   917 }
   920 }
   918 
   921 
   919 /**
   922 /**
   920  * Display list of revisions.
   923  * Displays list of revisions.
   921  *
   924  *
   922  * @since 2.6.0
   925  * @since 2.6.0
   923  *
   926  *
   924  * @param WP_Post $post
   927  * @param WP_Post $post Current post object.
   925  */
   928  */
   926 function post_revisions_meta_box( $post ) {
   929 function post_revisions_meta_box( $post ) {
   927 	wp_list_post_revisions( $post );
   930 	wp_list_post_revisions( $post );
   928 }
   931 }
   929 
   932 
   930 //
   933 //
   931 // Page-related Meta Boxes.
   934 // Page-related Meta Boxes.
   932 //
   935 //
   933 
   936 
   934 /**
   937 /**
   935  * Display page attributes form fields.
   938  * Displays page attributes form fields.
   936  *
   939  *
   937  * @since 2.7.0
   940  * @since 2.7.0
   938  *
   941  *
   939  * @param WP_Post $post
   942  * @param WP_Post $post Current post object.
   940  */
   943  */
   941 function page_attributes_meta_box( $post ) {
   944 function page_attributes_meta_box( $post ) {
   942 	if ( is_post_type_hierarchical( $post->post_type ) ) :
   945 	if ( is_post_type_hierarchical( $post->post_type ) ) :
   943 		$dropdown_args = array(
   946 		$dropdown_args = array(
   944 			'post_type'        => $post->post_type,
   947 			'post_type'        => $post->post_type,
   979 		 * Fires immediately after the label inside the 'Template' section
   982 		 * Fires immediately after the label inside the 'Template' section
   980 		 * of the 'Page Attributes' meta box.
   983 		 * of the 'Page Attributes' meta box.
   981 		 *
   984 		 *
   982 		 * @since 4.4.0
   985 		 * @since 4.4.0
   983 		 *
   986 		 *
   984 		 * @param string  $template The template used for the current post.
   987 		 * @param string|false $template The template used for the current post.
   985 		 * @param WP_Post $post     The current post.
   988 		 * @param WP_Post      $post     The current post.
   986 		 */
   989 		 */
   987 		do_action( 'page_attributes_meta_box_template', $template, $post );
   990 		do_action( 'page_attributes_meta_box_template', $template, $post );
   988 		?>
   991 		?>
   989 </p>
   992 </p>
   990 <select name="page_template" id="page_template">
   993 <select name="page_template" id="page_template">
  1027 //
  1030 //
  1028 // Link-related Meta Boxes.
  1031 // Link-related Meta Boxes.
  1029 //
  1032 //
  1030 
  1033 
  1031 /**
  1034 /**
  1032  * Display link create form fields.
  1035  * Displays link create form fields.
  1033  *
  1036  *
  1034  * @since 2.7.0
  1037  * @since 2.7.0
  1035  *
  1038  *
  1036  * @param object $link
  1039  * @param object $link Current link object.
  1037  */
  1040  */
  1038 function link_submit_meta_box( $link ) {
  1041 function link_submit_meta_box( $link ) {
  1039 	?>
  1042 	?>
  1040 <div class="submitbox" id="submitlink">
  1043 <div class="submitbox" id="submitlink">
  1041 
  1044 
  1103 </div>
  1106 </div>
  1104 	<?php
  1107 	<?php
  1105 }
  1108 }
  1106 
  1109 
  1107 /**
  1110 /**
  1108  * Display link categories form fields.
  1111  * Displays link categories form fields.
  1109  *
  1112  *
  1110  * @since 2.6.0
  1113  * @since 2.6.0
  1111  *
  1114  *
  1112  * @param object $link
  1115  * @param object $link Current link object.
  1113  */
  1116  */
  1114 function link_categories_meta_box( $link ) {
  1117 function link_categories_meta_box( $link ) {
  1115 	?>
  1118 	?>
  1116 <div id="taxonomy-linkcategory" class="categorydiv">
  1119 <div id="taxonomy-linkcategory" class="categorydiv">
  1117 	<ul id="category-tabs" class="category-tabs">
  1120 	<ul id="category-tabs" class="category-tabs">
  1150 </div>
  1153 </div>
  1151 	<?php
  1154 	<?php
  1152 }
  1155 }
  1153 
  1156 
  1154 /**
  1157 /**
  1155  * Display form fields for changing link target.
  1158  * Displays form fields for changing link target.
  1156  *
  1159  *
  1157  * @since 2.6.0
  1160  * @since 2.6.0
  1158  *
  1161  *
  1159  * @param object $link
  1162  * @param object $link Current link object.
  1160  */
  1163  */
  1161 function link_target_meta_box( $link ) {
  1164 function link_target_meta_box( $link ) {
  1162 
  1165 
  1163 	?>
  1166 	?>
  1164 <fieldset><legend class="screen-reader-text"><span><?php _e( 'Target' ); ?></span></legend>
  1167 <fieldset><legend class="screen-reader-text"><span><?php _e( 'Target' ); ?></span></legend>
  1175 <p><?php _e( 'Choose the target frame for your link.' ); ?></p>
  1178 <p><?php _e( 'Choose the target frame for your link.' ); ?></p>
  1176 	<?php
  1179 	<?php
  1177 }
  1180 }
  1178 
  1181 
  1179 /**
  1182 /**
  1180  * Display checked checkboxes attribute for xfn microformat options.
  1183  * Displays 'checked' checkboxes attribute for XFN microformat options.
  1181  *
  1184  *
  1182  * @since 1.0.1
  1185  * @since 1.0.1
  1183  *
  1186  *
  1184  * @global object $link
  1187  * @global object $link Current link object.
  1185  *
  1188  *
  1186  * @param string $class
  1189  * @param string $xfn_relationship XFN relationship category. Possible values are:
  1187  * @param string $value
  1190  *                                 'friendship', 'physical', 'professional',
  1188  * @param mixed  $deprecated Never used.
  1191  *                                 'geographical', 'family', 'romantic', 'identity'.
  1189  */
  1192  * @param string $xfn_value        Optional. The XFN value to mark as checked
  1190 function xfn_check( $class, $value = '', $deprecated = '' ) {
  1193  *                                 if it matches the current link's relationship.
       
  1194  *                                 Default empty string.
       
  1195  * @param mixed  $deprecated       Deprecated. Not used.
       
  1196  */
       
  1197 function xfn_check( $xfn_relationship, $xfn_value = '', $deprecated = '' ) {
  1191 	global $link;
  1198 	global $link;
  1192 
  1199 
  1193 	if ( ! empty( $deprecated ) ) {
  1200 	if ( ! empty( $deprecated ) ) {
  1194 		_deprecated_argument( __FUNCTION__, '2.5.0' ); // Never implemented.
  1201 		_deprecated_argument( __FUNCTION__, '2.5.0' ); // Never implemented.
  1195 	}
  1202 	}
  1196 
  1203 
  1197 	$link_rel = isset( $link->link_rel ) ? $link->link_rel : ''; // In PHP 5.3: $link_rel = $link->link_rel ?: '';
  1204 	$link_rel  = isset( $link->link_rel ) ? $link->link_rel : ''; // In PHP 5.3: $link_rel = $link->link_rel ?: '';
  1198 	$rels     = preg_split( '/\s+/', $link_rel );
  1205 	$link_rels = preg_split( '/\s+/', $link_rel );
  1199 
  1206 
  1200 	if ( '' !== $value && in_array( $value, $rels, true ) ) {
  1207 	// Mark the specified value as checked if it matches the current link's relationship.
       
  1208 	if ( '' !== $xfn_value && in_array( $xfn_value, $link_rels, true ) ) {
  1201 		echo ' checked="checked"';
  1209 		echo ' checked="checked"';
  1202 	}
  1210 	}
  1203 
  1211 
  1204 	if ( '' === $value ) {
  1212 	if ( '' === $xfn_value ) {
  1205 		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 ) {
  1213 		// Mark the 'none' value as checked if the current link does not match the specified relationship.
       
  1214 		if ( 'family' === $xfn_relationship
       
  1215 			&& ! array_intersect( $link_rels, array( 'child', 'parent', 'sibling', 'spouse', 'kin' ) )
       
  1216 		) {
  1206 			echo ' checked="checked"';
  1217 			echo ' checked="checked"';
  1207 		}
  1218 		}
  1208 		if ( 'friendship' === $class && strpos( $link_rel, 'friend' ) === false && strpos( $link_rel, 'acquaintance' ) === false && strpos( $link_rel, 'contact' ) === false ) {
  1219 
       
  1220 		if ( 'friendship' === $xfn_relationship
       
  1221 			&& ! array_intersect( $link_rels, array( 'friend', 'acquaintance', 'contact' ) )
       
  1222 		) {
  1209 			echo ' checked="checked"';
  1223 			echo ' checked="checked"';
  1210 		}
  1224 		}
  1211 		if ( 'geographical' === $class && strpos( $link_rel, 'co-resident' ) === false && strpos( $link_rel, 'neighbor' ) === false ) {
  1225 
       
  1226 		if ( 'geographical' === $xfn_relationship
       
  1227 			&& ! array_intersect( $link_rels, array( 'co-resident', 'neighbor' ) )
       
  1228 		) {
  1212 			echo ' checked="checked"';
  1229 			echo ' checked="checked"';
  1213 		}
  1230 		}
  1214 		if ( 'identity' === $class && in_array( 'me', $rels, true ) ) {
  1231 
       
  1232 		// Mark the 'me' value as checked if it matches the current link's relationship.
       
  1233 		if ( 'identity' === $xfn_relationship
       
  1234 			&& in_array( 'me', $link_rels, true )
       
  1235 		) {
  1215 			echo ' checked="checked"';
  1236 			echo ' checked="checked"';
  1216 		}
  1237 		}
  1217 	}
  1238 	}
  1218 }
  1239 }
  1219 
  1240 
  1220 /**
  1241 /**
  1221  * Display xfn form fields.
  1242  * Displays XFN form fields.
  1222  *
  1243  *
  1223  * @since 2.6.0
  1244  * @since 2.6.0
  1224  *
  1245  *
  1225  * @param object $link
  1246  * @param object $link Current link object.
  1226  */
  1247  */
  1227 function link_xfn_meta_box( $link ) {
  1248 function link_xfn_meta_box( $link ) {
  1228 	?>
  1249 	?>
  1229 <table class="links-table">
  1250 <table class="links-table">
  1230 	<tr>
  1251 	<tr>
  1334 <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="https://gmpg.org/xfn/">XFN</a>.' ); ?></p>
  1355 <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="https://gmpg.org/xfn/">XFN</a>.' ); ?></p>
  1335 	<?php
  1356 	<?php
  1336 }
  1357 }
  1337 
  1358 
  1338 /**
  1359 /**
  1339  * Display advanced link options form fields.
  1360  * Displays advanced link options form fields.
  1340  *
  1361  *
  1341  * @since 2.6.0
  1362  * @since 2.6.0
  1342  *
  1363  *
  1343  * @param object $link
  1364  * @param object $link Current link object.
  1344  */
  1365  */
  1345 function link_advanced_meta_box( $link ) {
  1366 function link_advanced_meta_box( $link ) {
  1346 	?>
  1367 	?>
  1347 <table class="links-table" cellpadding="0">
  1368 <table class="links-table" cellpadding="0">
  1348 	<tr>
  1369 	<tr>
  1359 	</tr>
  1380 	</tr>
  1360 	<tr>
  1381 	<tr>
  1361 		<th scope="row"><label for="link_rating"><?php _e( 'Rating' ); ?></label></th>
  1382 		<th scope="row"><label for="link_rating"><?php _e( 'Rating' ); ?></label></th>
  1362 		<td><select name="link_rating" id="link_rating" size="1">
  1383 		<td><select name="link_rating" id="link_rating" size="1">
  1363 		<?php
  1384 		<?php
  1364 		for ( $parsed_args = 0; $parsed_args <= 10; $parsed_args++ ) {
  1385 		for ( $rating = 0; $rating <= 10; $rating++ ) {
  1365 			echo '<option value="' . $parsed_args . '"';
  1386 			echo '<option value="' . $rating . '"';
  1366 			if ( isset( $link->link_rating ) && $link->link_rating == $parsed_args ) {
  1387 			if ( isset( $link->link_rating ) && $link->link_rating == $rating ) {
  1367 				echo ' selected="selected"';
  1388 				echo ' selected="selected"';
  1368 			}
  1389 			}
  1369 			echo( '>' . $parsed_args . '</option>' );
  1390 			echo '>' . $rating . '</option>';
  1370 		}
  1391 		}
  1371 		?>
  1392 		?>
  1372 		</select>&nbsp;<?php _e( '(Leave at 0 for no rating.)' ); ?>
  1393 		</select>&nbsp;<?php _e( '(Leave at 0 for no rating.)' ); ?>
  1373 		</td>
  1394 		</td>
  1374 	</tr>
  1395 	</tr>
  1375 </table>
  1396 </table>
  1376 	<?php
  1397 	<?php
  1377 }
  1398 }
  1378 
  1399 
  1379 /**
  1400 /**
  1380  * Display post thumbnail meta box.
  1401  * Displays post thumbnail meta box.
  1381  *
  1402  *
  1382  * @since 2.9.0
  1403  * @since 2.9.0
  1383  *
  1404  *
  1384  * @param WP_Post $post A post object.
  1405  * @param WP_Post $post Current post object.
  1385  */
  1406  */
  1386 function post_thumbnail_meta_box( $post ) {
  1407 function post_thumbnail_meta_box( $post ) {
  1387 	$thumbnail_id = get_post_meta( $post->ID, '_thumbnail_id', true );
  1408 	$thumbnail_id = get_post_meta( $post->ID, '_thumbnail_id', true );
  1388 	echo _wp_post_thumbnail_html( $thumbnail_id, $post->ID );
  1409 	echo _wp_post_thumbnail_html( $thumbnail_id, $post->ID );
  1389 }
  1410 }
  1390 
  1411 
  1391 /**
  1412 /**
  1392  * Display fields for ID3 data
  1413  * Displays fields for ID3 data.
  1393  *
  1414  *
  1394  * @since 3.9.0
  1415  * @since 3.9.0
  1395  *
  1416  *
  1396  * @param WP_Post $post A post object.
  1417  * @param WP_Post $post Current post object.
  1397  */
  1418  */
  1398 function attachment_id3_data_meta_box( $post ) {
  1419 function attachment_id3_data_meta_box( $post ) {
  1399 	$meta = array();
  1420 	$meta = array();
  1400 	if ( ! empty( $post->ID ) ) {
  1421 	if ( ! empty( $post->ID ) ) {
  1401 		$meta = wp_get_attachment_metadata( $post->ID );
  1422 		$meta = wp_get_attachment_metadata( $post->ID );
  1578 	do_action( 'add_meta_boxes', $post_type, $post );
  1599 	do_action( 'add_meta_boxes', $post_type, $post );
  1579 
  1600 
  1580 	/**
  1601 	/**
  1581 	 * Fires after all built-in meta boxes have been added, contextually for the given post type.
  1602 	 * Fires after all built-in meta boxes have been added, contextually for the given post type.
  1582 	 *
  1603 	 *
  1583 	 * The dynamic portion of the hook, `$post_type`, refers to the post type of the post.
  1604 	 * The dynamic portion of the hook name, `$post_type`, refers to the post type of the post.
       
  1605 	 *
       
  1606 	 * Possible hook names include:
       
  1607 	 *
       
  1608 	 *  - `add_meta_boxes_post`
       
  1609 	 *  - `add_meta_boxes_page`
       
  1610 	 *  - `add_meta_boxes_attachment`
  1584 	 *
  1611 	 *
  1585 	 * @since 3.0.0
  1612 	 * @since 3.0.0
  1586 	 *
  1613 	 *
  1587 	 * @param WP_Post $post Post object.
  1614 	 * @param WP_Post $post Post object.
  1588 	 */
  1615 	 */