wp/wp-admin/includes/meta-boxes.php
changeset 9 177826044cd9
parent 7 cf61fcea0001
child 16 a86126ab1dd4
equal deleted inserted replaced
8:c7c34916027a 9:177826044cd9
    20  * }
    20  * }
    21  */
    21  */
    22 function post_submit_meta_box( $post, $args = array() ) {
    22 function post_submit_meta_box( $post, $args = array() ) {
    23 	global $action;
    23 	global $action;
    24 
    24 
    25 	$post_type = $post->post_type;
    25 	$post_type        = $post->post_type;
    26 	$post_type_object = get_post_type_object($post_type);
    26 	$post_type_object = get_post_type_object( $post_type );
    27 	$can_publish = current_user_can($post_type_object->cap->publish_posts);
    27 	$can_publish      = current_user_can( $post_type_object->cap->publish_posts );
    28 ?>
    28 	?>
    29 <div class="submitbox" id="submitpost">
    29 <div class="submitbox" id="submitpost">
    30 
    30 
    31 <div id="minor-publishing">
    31 <div id="minor-publishing">
    32 
    32 
    33 <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?>
    33 	<?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?>
    34 <div style="display:none;">
    34 <div style="display:none;">
    35 <?php submit_button( __( 'Save' ), '', 'save' ); ?>
    35 	<?php submit_button( __( 'Save' ), '', 'save' ); ?>
    36 </div>
    36 </div>
    37 
    37 
    38 <div id="minor-publishing-actions">
    38 <div id="minor-publishing-actions">
    39 <div id="save-action">
    39 <div id="save-action">
    40 <?php if ( 'publish' != $post->post_status && 'future' != $post->post_status && 'pending' != $post->post_status ) { ?>
    40 	<?php
    41 <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" />
    41 	if ( 'publish' != $post->post_status && 'future' != $post->post_status && 'pending' != $post->post_status ) {
       
    42 		$private_style = '';
       
    43 		if ( 'private' == $post->post_status ) {
       
    44 			$private_style = 'style="display:none"';
       
    45 		}
       
    46 		?>
       
    47 <input <?php echo $private_style; ?> type="submit" name="save" id="save-post" value="<?php esc_attr_e( 'Save Draft' ); ?>" class="button" />
    42 <span class="spinner"></span>
    48 <span class="spinner"></span>
    43 <?php } elseif ( 'pending' == $post->post_status && $can_publish ) { ?>
    49 <?php } elseif ( 'pending' == $post->post_status && $can_publish ) { ?>
    44 <input type="submit" name="save" id="save-post" value="<?php esc_attr_e('Save as Pending'); ?>" class="button" />
    50 <input type="submit" name="save" id="save-post" value="<?php esc_attr_e( 'Save as Pending' ); ?>" class="button" />
    45 <span class="spinner"></span>
    51 <span class="spinner"></span>
    46 <?php } ?>
    52 <?php } ?>
    47 </div>
    53 </div>
    48 <?php if ( is_post_type_viewable( $post_type_object ) ) : ?>
    54 	<?php if ( is_post_type_viewable( $post_type_object ) ) : ?>
    49 <div id="preview-action">
    55 <div id="preview-action">
    50 <?php
    56 		<?php
    51 $preview_link = esc_url( get_preview_post_link( $post ) );
    57 		$preview_link = esc_url( get_preview_post_link( $post ) );
    52 if ( 'publish' == $post->post_status ) {
    58 		if ( 'publish' == $post->post_status ) {
    53 	$preview_button_text = __( 'Preview Changes' );
    59 			$preview_button_text = __( 'Preview Changes' );
    54 } else {
    60 		} else {
    55 	$preview_button_text = __( 'Preview' );
    61 			$preview_button_text = __( 'Preview' );
    56 }
    62 		}
    57 
    63 
    58 $preview_button = sprintf( '%1$s<span class="screen-reader-text"> %2$s</span>',
    64 		$preview_button = sprintf(
    59 	$preview_button_text,
    65 			'%1$s<span class="screen-reader-text"> %2$s</span>',
    60 	/* translators: accessibility text */
    66 			$preview_button_text,
    61 	__( '(opens in a new window)' )
    67 			/* translators: accessibility text */
    62 );
    68 			__( '(opens in a new tab)' )
    63 ?>
    69 		);
       
    70 		?>
    64 <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>
    71 <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>
    65 <input type="hidden" name="wp-preview" id="wp-preview" value="" />
    72 <input type="hidden" name="wp-preview" id="wp-preview" value="" />
    66 </div>
    73 </div>
    67 <?php endif; // public post type ?>
    74 <?php endif; // public post type ?>
    68 <?php
    75 	<?php
    69 /**
    76 	/**
    70  * Fires before the post time/date setting in the Publish meta box.
    77 	 * Fires before the post time/date setting in the Publish meta box.
    71  *
    78 	 *
    72  * @since 4.4.0
    79 	 * @since 4.4.0
    73  *
    80 	 *
    74  * @param WP_Post $post WP_Post object for the current post.
    81 	 * @param WP_Post $post WP_Post object for the current post.
    75  */
    82 	 */
    76 do_action( 'post_submitbox_minor_actions', $post );
    83 	do_action( 'post_submitbox_minor_actions', $post );
    77 ?>
    84 	?>
    78 <div class="clear"></div>
    85 <div class="clear"></div>
    79 </div><!-- #minor-publishing-actions -->
    86 </div><!-- #minor-publishing-actions -->
    80 
    87 
    81 <div id="misc-publishing-actions">
    88 <div id="misc-publishing-actions">
    82 
    89 
    83 <div class="misc-pub-section misc-pub-post-status">
    90 <div class="misc-pub-section misc-pub-post-status">
    84 <?php _e( 'Status:' ) ?> <span id="post-status-display"><?php
    91 	<?php _e( 'Status:' ); ?> <span id="post-status-display">
    85 
    92 			<?php
    86 switch ( $post->post_status ) {
    93 
    87 	case 'private':
    94 			switch ( $post->post_status ) {
    88 		_e('Privately Published');
    95 				case 'private':
    89 		break;
    96 					_e( 'Privately Published' );
    90 	case 'publish':
    97 					break;
    91 		_e('Published');
    98 				case 'publish':
    92 		break;
    99 					_e( 'Published' );
    93 	case 'future':
   100 					break;
    94 		_e('Scheduled');
   101 				case 'future':
    95 		break;
   102 					_e( 'Scheduled' );
    96 	case 'pending':
   103 					break;
    97 		_e('Pending Review');
   104 				case 'pending':
    98 		break;
   105 					_e( 'Pending Review' );
    99 	case 'draft':
   106 					break;
   100 	case 'auto-draft':
   107 				case 'draft':
   101 		_e('Draft');
   108 				case 'auto-draft':
   102 		break;
   109 					_e( 'Draft' );
   103 }
   110 					break;
   104 ?>
   111 			}
       
   112 			?>
   105 </span>
   113 </span>
   106 <?php if ( 'publish' == $post->post_status || 'private' == $post->post_status || $can_publish ) { ?>
   114 	<?php
   107 <a href="#post_status" <?php if ( 'private' == $post->post_status ) { ?>style="display:none;" <?php } ?>class="edit-post-status hide-if-no-js" role="button"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit status' ); ?></span></a>
   115 	if ( 'publish' == $post->post_status || 'private' == $post->post_status || $can_publish ) {
       
   116 		$private_style = '';
       
   117 		if ( 'private' == $post->post_status ) {
       
   118 			$private_style = 'style="display:none"';
       
   119 		}
       
   120 		?>
       
   121 <a href="#post_status" <?php echo $private_style; ?> class="edit-post-status hide-if-no-js" role="button"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit status' ); ?></span></a>
   108 
   122 
   109 <div id="post-status-select" class="hide-if-js">
   123 <div id="post-status-select" class="hide-if-js">
   110 <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); ?>" />
   124 <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 ); ?>" />
   111 <label for="post_status" class="screen-reader-text"><?php _e( 'Set status' ) ?></label>
   125 <label for="post_status" class="screen-reader-text"><?php _e( 'Set status' ); ?></label>
   112 <select name="post_status" id="post_status">
   126 <select name="post_status" id="post_status">
   113 <?php if ( 'publish' == $post->post_status ) : ?>
   127 		<?php if ( 'publish' == $post->post_status ) : ?>
   114 <option<?php selected( $post->post_status, 'publish' ); ?> value='publish'><?php _e('Published') ?></option>
   128 <option<?php selected( $post->post_status, 'publish' ); ?> value='publish'><?php _e( 'Published' ); ?></option>
   115 <?php elseif ( 'private' == $post->post_status ) : ?>
   129 <?php elseif ( 'private' == $post->post_status ) : ?>
   116 <option<?php selected( $post->post_status, 'private' ); ?> value='publish'><?php _e('Privately Published') ?></option>
   130 <option<?php selected( $post->post_status, 'private' ); ?> value='publish'><?php _e( 'Privately Published' ); ?></option>
   117 <?php elseif ( 'future' == $post->post_status ) : ?>
   131 <?php elseif ( 'future' == $post->post_status ) : ?>
   118 <option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Scheduled') ?></option>
   132 <option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e( 'Scheduled' ); ?></option>
   119 <?php endif; ?>
   133 <?php endif; ?>
   120 <option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e('Pending Review') ?></option>
   134 <option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e( 'Pending Review' ); ?></option>
   121 <?php if ( 'auto-draft' == $post->post_status ) : ?>
   135 		<?php if ( 'auto-draft' == $post->post_status ) : ?>
   122 <option<?php selected( $post->post_status, 'auto-draft' ); ?> value='draft'><?php _e('Draft') ?></option>
   136 <option<?php selected( $post->post_status, 'auto-draft' ); ?> value='draft'><?php _e( 'Draft' ); ?></option>
   123 <?php else : ?>
   137 <?php else : ?>
   124 <option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Draft') ?></option>
   138 <option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e( 'Draft' ); ?></option>
   125 <?php endif; ?>
   139 <?php endif; ?>
   126 </select>
   140 </select>
   127  <a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e('OK'); ?></a>
   141 <a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e( 'OK' ); ?></a>
   128  <a href="#post_status" class="cancel-post-status hide-if-no-js button-cancel"><?php _e('Cancel'); ?></a>
   142 <a href="#post_status" class="cancel-post-status hide-if-no-js button-cancel"><?php _e( 'Cancel' ); ?></a>
   129 </div>
   143 </div>
   130 
   144 
   131 <?php } ?>
   145 <?php } ?>
   132 </div><!-- .misc-pub-section -->
   146 </div><!-- .misc-pub-section -->
   133 
   147 
   134 <div class="misc-pub-section misc-pub-visibility" id="visibility">
   148 <div class="misc-pub-section misc-pub-visibility" id="visibility">
   135 <?php _e('Visibility:'); ?> <span id="post-visibility-display"><?php
   149 	<?php _e( 'Visibility:' ); ?> <span id="post-visibility-display">
   136 
   150 							<?php
   137 if ( 'private' == $post->post_status ) {
   151 
   138 	$post->post_password = '';
   152 							if ( 'private' == $post->post_status ) {
   139 	$visibility = 'private';
   153 								$post->post_password = '';
   140 	$visibility_trans = __('Private');
   154 								$visibility          = 'private';
   141 } elseif ( !empty( $post->post_password ) ) {
   155 								$visibility_trans    = __( 'Private' );
   142 	$visibility = 'password';
   156 							} elseif ( ! empty( $post->post_password ) ) {
   143 	$visibility_trans = __('Password protected');
   157 								$visibility       = 'password';
   144 } elseif ( $post_type == 'post' && is_sticky( $post->ID ) ) {
   158 								$visibility_trans = __( 'Password protected' );
   145 	$visibility = 'public';
   159 							} elseif ( $post_type == 'post' && is_sticky( $post->ID ) ) {
   146 	$visibility_trans = __('Public, Sticky');
   160 								$visibility       = 'public';
   147 } else {
   161 								$visibility_trans = __( 'Public, Sticky' );
   148 	$visibility = 'public';
   162 							} else {
   149 	$visibility_trans = __('Public');
   163 								$visibility       = 'public';
   150 }
   164 								$visibility_trans = __( 'Public' );
   151 
   165 							}
   152 echo esc_html( $visibility_trans ); ?></span>
   166 
   153 <?php if ( $can_publish ) { ?>
   167 							echo esc_html( $visibility_trans );
       
   168 							?>
       
   169 </span>
       
   170 	<?php if ( $can_publish ) { ?>
   154 <a href="#visibility" class="edit-visibility hide-if-no-js" role="button"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit visibility' ); ?></span></a>
   171 <a href="#visibility" class="edit-visibility hide-if-no-js" role="button"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit visibility' ); ?></span></a>
   155 
   172 
   156 <div id="post-visibility-select" class="hide-if-js">
   173 <div id="post-visibility-select" class="hide-if-js">
   157 <input type="hidden" name="hidden_post_password" id="hidden-post-password" value="<?php echo esc_attr($post->post_password); ?>" />
   174 <input type="hidden" name="hidden_post_password" id="hidden-post-password" value="<?php echo esc_attr( $post->post_password ); ?>" />
   158 <?php if ($post_type == 'post'): ?>
   175 		<?php if ( $post_type == 'post' ) : ?>
   159 <input type="checkbox" style="display:none" name="hidden_post_sticky" id="hidden-post-sticky" value="sticky" <?php checked(is_sticky($post->ID)); ?> />
   176 <input type="checkbox" style="display:none" name="hidden_post_sticky" id="hidden-post-sticky" value="sticky" <?php checked( is_sticky( $post->ID ) ); ?> />
   160 <?php endif; ?>
   177 <?php endif; ?>
   161 <input type="hidden" name="hidden_post_visibility" id="hidden-post-visibility" value="<?php echo esc_attr( $visibility ); ?>" />
   178 <input type="hidden" name="hidden_post_visibility" id="hidden-post-visibility" value="<?php echo esc_attr( $visibility ); ?>" />
   162 <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 />
   179 <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 />
   163 <?php if ( $post_type == 'post' && current_user_can( 'edit_others_posts' ) ) : ?>
   180 		<?php if ( $post_type == 'post' && current_user_can( 'edit_others_posts' ) ) : ?>
   164 <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>
   181 <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>
   165 <?php endif; ?>
   182 <?php endif; ?>
   166 <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 />
   183 <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 />
   167 <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="255" /><br /></span>
   184 <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="255" /><br /></span>
   168 <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 />
   185 <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 />
   169 
   186 
   170 <p>
   187 <p>
   171  <a href="#visibility" class="save-post-visibility hide-if-no-js button"><?php _e('OK'); ?></a>
   188 	<a href="#visibility" class="save-post-visibility hide-if-no-js button"><?php _e( 'OK' ); ?></a>
   172  <a href="#visibility" class="cancel-post-visibility hide-if-no-js button-cancel"><?php _e('Cancel'); ?></a>
   189 	<a href="#visibility" class="cancel-post-visibility hide-if-no-js button-cancel"><?php _e( 'Cancel' ); ?></a>
   173 </p>
   190 </p>
   174 </div>
   191 </div>
   175 <?php } ?>
   192 <?php } ?>
   176 
   193 
   177 </div><!-- .misc-pub-section -->
   194 </div><!-- .misc-pub-section -->
   178 
   195 
   179 <?php
   196 	<?php
   180 /* translators: Publish box date format, see https://secure.php.net/date */
   197 	/* translators: Publish box date format, see https://secure.php.net/date */
   181 $datef = __( 'M j, Y @ H:i' );
   198 	$datef = __( 'M j, Y @ H:i' );
   182 if ( 0 != $post->ID ) {
   199 	if ( 0 != $post->ID ) {
   183 	if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date
   200 		if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date
   184 		/* translators: Post date information. 1: Date on which the post is currently scheduled to be published */
   201 			/* translators: Post date information. %s: Date on which the post is currently scheduled to be published */
   185 		$stamp = __('Scheduled for: <b>%1$s</b>');
   202 			$stamp = __( 'Scheduled for: <b>%s</b>' );
   186 	} elseif ( 'publish' == $post->post_status || 'private' == $post->post_status ) { // already published
   203 		} elseif ( 'publish' == $post->post_status || 'private' == $post->post_status ) { // already published
   187 		/* translators: Post date information. 1: Date on which the post was published */
   204 			/* translators: Post date information. %s: Date on which the post was published */
   188 		$stamp = __('Published on: <b>%1$s</b>');
   205 			$stamp = __( 'Published on: <b>%s</b>' );
   189 	} elseif ( '0000-00-00 00:00:00' == $post->post_date_gmt ) { // draft, 1 or more saves, no date specified
   206 		} elseif ( '0000-00-00 00:00:00' == $post->post_date_gmt ) { // draft, 1 or more saves, no date specified
   190 		$stamp = __('Publish <b>immediately</b>');
   207 			$stamp = __( 'Publish <b>immediately</b>' );
   191 	} elseif ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // draft, 1 or more saves, future date specified
   208 		} elseif ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // draft, 1 or more saves, future date specified
   192 		/* translators: Post date information. 1: Date on which the post is to be published */
   209 			/* translators: Post date information. %s: Date on which the post is to be published */
   193 		$stamp = __('Schedule for: <b>%1$s</b>');
   210 			$stamp = __( 'Schedule for: <b>%s</b>' );
   194 	} else { // draft, 1 or more saves, date specified
   211 		} else { // draft, 1 or more saves, date specified
   195 		/* translators: Post date information. 1: Date on which the post is to be published */
   212 			/* translators: Post date information. %s: Date on which the post is to be published */
   196 		$stamp = __('Publish on: <b>%1$s</b>');
   213 			$stamp = __( 'Publish on: <b>%s</b>' );
   197 	}
   214 		}
   198 	$date = date_i18n( $datef, strtotime( $post->post_date ) );
   215 		$date = date_i18n( $datef, strtotime( $post->post_date ) );
   199 } else { // draft (no saves, and thus no date specified)
   216 	} else { // draft (no saves, and thus no date specified)
   200 	$stamp = __('Publish <b>immediately</b>');
   217 		$stamp = __( 'Publish <b>immediately</b>' );
   201 	$date = date_i18n( $datef, strtotime( current_time('mysql') ) );
   218 		$date  = date_i18n( $datef, strtotime( current_time( 'mysql' ) ) );
   202 }
   219 	}
   203 
   220 
   204 if ( ! empty( $args['args']['revisions_count'] ) ) : ?>
   221 	if ( ! empty( $args['args']['revisions_count'] ) ) :
       
   222 		?>
   205 <div class="misc-pub-section misc-pub-revisions">
   223 <div class="misc-pub-section misc-pub-revisions">
   206 	<?php
   224 		<?php
   207 		/* translators: Post revisions heading. 1: The number of available revisions */
   225 		/* translators: Post revisions heading. %s: The number of available revisions */
   208 		printf( __( 'Revisions: %s' ), '<b>' . number_format_i18n( $args['args']['revisions_count'] ) . '</b>' );
   226 		printf( __( 'Revisions: %s' ), '<b>' . number_format_i18n( $args['args']['revisions_count'] ) . '</b>' );
   209 	?>
   227 		?>
   210 	<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>
   228 	<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>
   211 </div>
   229 </div>
   212 <?php endif;
   230 		<?php
   213 
   231 endif;
   214 if ( $can_publish ) : // Contributors don't get to choose the date of publish ?>
   232 
       
   233 	if ( $can_publish ) : // Contributors don't get to choose the date of publish
       
   234 		?>
   215 <div class="misc-pub-section curtime misc-pub-curtime">
   235 <div class="misc-pub-section curtime misc-pub-curtime">
   216 	<span id="timestamp">
   236 	<span id="timestamp">
   217 	<?php printf($stamp, $date); ?></span>
   237 		<?php printf( $stamp, $date ); ?></span>
   218 	<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" role="button"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit date and time' ); ?></span></a>
   238 	<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" role="button"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit date and time' ); ?></span></a>
   219 	<fieldset id="timestampdiv" class="hide-if-js">
   239 	<fieldset id="timestampdiv" class="hide-if-js">
   220 	<legend class="screen-reader-text"><?php _e( 'Date and time' ); ?></legend>
   240 	<legend class="screen-reader-text"><?php _e( 'Date and time' ); ?></legend>
   221 	<?php touch_time( ( $action === 'edit' ), 1 ); ?>
   241 		<?php touch_time( ( $action === 'edit' ), 1 ); ?>
   222 	</fieldset>
   242 	</fieldset>
   223 </div><?php // /misc-pub-section ?>
   243 </div><?php // /misc-pub-section ?>
   224 <?php endif; ?>
   244 <?php endif; ?>
   225 
   245 
   226 <?php if ( 'draft' === $post->post_status && get_post_meta( $post->ID, '_customize_changeset_uuid', true ) ) : ?>
   246 	<?php if ( 'draft' === $post->post_status && get_post_meta( $post->ID, '_customize_changeset_uuid', true ) ) : ?>
   227 	<div class="notice notice-info notice-alt inline">
   247 	<div class="notice notice-info notice-alt inline">
   228 		<p>
   248 		<p>
   229 			<?php
   249 			<?php
   230 			echo sprintf(
   250 			echo sprintf(
   231 				/* translators: %s: URL to the Customizer */
   251 				/* translators: %s: URL to the Customizer */
   239 				)
   259 				)
   240 			);
   260 			);
   241 			?>
   261 			?>
   242 		</p>
   262 		</p>
   243 	</div>
   263 	</div>
   244 <?php endif; ?>
   264 	<?php endif; ?>
   245 
   265 
   246 <?php
   266 	<?php
   247 /**
   267 	/**
   248  * Fires after the post time/date setting in the Publish meta box.
   268 	 * Fires after the post time/date setting in the Publish meta box.
   249  *
   269 	 *
   250  * @since 2.9.0
   270 	 * @since 2.9.0
   251  * @since 4.4.0 Added the `$post` parameter.
   271 	 * @since 4.4.0 Added the `$post` parameter.
   252  *
   272 	 *
   253  * @param WP_Post $post WP_Post object for the current post.
   273 	 * @param WP_Post $post WP_Post object for the current post.
   254  */
   274 	 */
   255 do_action( 'post_submitbox_misc_actions', $post );
   275 	do_action( 'post_submitbox_misc_actions', $post );
   256 ?>
   276 	?>
   257 </div>
   277 </div>
   258 <div class="clear"></div>
   278 <div class="clear"></div>
   259 </div>
   279 </div>
   260 
   280 
   261 <div id="major-publishing-actions">
   281 <div id="major-publishing-actions">
   262 <?php
   282 	<?php
   263 /**
   283 	/**
   264  * Fires at the beginning of the publishing actions section of the Publish meta box.
   284 	 * Fires at the beginning of the publishing actions section of the Publish meta box.
   265  *
   285 	 *
   266  * @since 2.7.0
   286 	 * @since 2.7.0
   267  * @since 4.9.0 Added the `$post` parameter.
   287 	 * @since 4.9.0 Added the `$post` parameter.
   268  *
   288 	 *
   269  * @param WP_Post|null $post WP_Post object for the current post on Edit Post screen,
   289 	 * @param WP_Post|null $post WP_Post object for the current post on Edit Post screen,
   270  *                           null on Edit Link screen.
   290 	 *                           null on Edit Link screen.
   271  */
   291 	 */
   272 do_action( 'post_submitbox_start', $post );
   292 	do_action( 'post_submitbox_start', $post );
   273 ?>
   293 	?>
   274 <div id="delete-action">
   294 <div id="delete-action">
   275 <?php
   295 	<?php
   276 if ( current_user_can( "delete_post", $post->ID ) ) {
   296 	if ( current_user_can( 'delete_post', $post->ID ) ) {
   277 	if ( !EMPTY_TRASH_DAYS )
   297 		if ( ! EMPTY_TRASH_DAYS ) {
   278 		$delete_text = __('Delete Permanently');
   298 			$delete_text = __( 'Delete Permanently' );
   279 	else
   299 		} else {
   280 		$delete_text = __('Move to Trash');
   300 			$delete_text = __( 'Move to Trash' );
   281 	?>
   301 		}
   282 <a class="submitdelete deletion" href="<?php echo get_delete_post_link($post->ID); ?>"><?php echo $delete_text; ?></a><?php
   302 		?>
   283 } ?>
   303 <a class="submitdelete deletion" href="<?php echo get_delete_post_link( $post->ID ); ?>"><?php echo $delete_text; ?></a>
       
   304 													<?php
       
   305 	}
       
   306 	?>
   284 </div>
   307 </div>
   285 
   308 
   286 <div id="publishing-action">
   309 <div id="publishing-action">
   287 <span class="spinner"></span>
   310 <span class="spinner"></span>
   288 <?php
   311 	<?php
   289 if ( !in_array( $post->post_status, array('publish', 'future', 'private') ) || 0 == $post->ID ) {
   312 	if ( ! in_array( $post->post_status, array( 'publish', 'future', 'private' ) ) || 0 == $post->ID ) {
   290 	if ( $can_publish ) :
   313 		if ( $can_publish ) :
   291 		if ( !empty($post->post_date_gmt) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : ?>
   314 			if ( ! empty( $post->post_date_gmt ) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) :
       
   315 				?>
   292 		<input name="original_publish" type="hidden" id="original_publish" value="<?php echo esc_attr_x( 'Schedule', 'post action/button label' ); ?>" />
   316 		<input name="original_publish" type="hidden" id="original_publish" value="<?php echo esc_attr_x( 'Schedule', 'post action/button label' ); ?>" />
   293 		<?php submit_button( _x( 'Schedule', 'post action/button label' ), 'primary large', 'publish', false ); ?>
   317 				<?php submit_button( _x( 'Schedule', 'post action/button label' ), 'primary large', 'publish', false ); ?>
   294 <?php	else : ?>
   318 	<?php	else : ?>
   295 		<input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Publish') ?>" />
   319 		<input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e( 'Publish' ); ?>" />
   296 		<?php submit_button( __( 'Publish' ), 'primary large', 'publish', false ); ?>
   320 		<?php submit_button( __( 'Publish' ), 'primary large', 'publish', false ); ?>
   297 <?php	endif;
   321 		<?php
   298 	else : ?>
   322 	endif;
   299 		<input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Submit for Review') ?>" />
   323 	else :
       
   324 		?>
       
   325 		<input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e( 'Submit for Review' ); ?>" />
   300 		<?php submit_button( __( 'Submit for Review' ), 'primary large', 'publish', false ); ?>
   326 		<?php submit_button( __( 'Submit for Review' ), 'primary large', 'publish', false ); ?>
   301 <?php
   327 		<?php
   302 	endif;
   328 		endif;
   303 } else { ?>
   329 	} else {
   304 		<input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Update') ?>" />
   330 		?>
   305 		<input name="save" type="submit" class="button button-primary button-large" id="publish" value="<?php esc_attr_e( 'Update' ) ?>" />
   331 		<input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e( 'Update' ); ?>" />
   306 <?php
   332 		<input name="save" type="submit" class="button button-primary button-large" id="publish" value="<?php esc_attr_e( 'Update' ); ?>" />
   307 } ?>
   333 		<?php
       
   334 	}
       
   335 	?>
   308 </div>
   336 </div>
   309 <div class="clear"></div>
   337 <div class="clear"></div>
   310 </div>
   338 </div>
   311 </div>
   339 </div>
   312 
   340 
   313 <?php
   341 	<?php
   314 }
   342 }
   315 
   343 
   316 /**
   344 /**
   317  * Display attachment submit form fields.
   345  * Display attachment submit form fields.
   318  *
   346  *
   319  * @since 3.5.0
   347  * @since 3.5.0
   320  *
   348  *
   321  * @param object $post
   349  * @param object $post
   322  */
   350  */
   323 function attachment_submit_meta_box( $post ) {
   351 function attachment_submit_meta_box( $post ) {
   324 ?>
   352 	?>
   325 <div class="submitbox" id="submitpost">
   353 <div class="submitbox" id="submitpost">
   326 
   354 
   327 <div id="minor-publishing">
   355 <div id="minor-publishing">
   328 
   356 
   329 <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?>
   357 	<?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?>
   330 <div style="display:none;">
   358 <div style="display:none;">
   331 <?php submit_button( __( 'Save' ), '', 'save' ); ?>
   359 	<?php submit_button( __( 'Save' ), '', 'save' ); ?>
   332 </div>
   360 </div>
   333 
   361 
   334 
   362 
   335 <div id="misc-publishing-actions">
   363 <div id="misc-publishing-actions">
   336 	<div class="misc-pub-section curtime misc-pub-curtime">
   364 	<div class="misc-pub-section curtime misc-pub-curtime">
   337 		<span id="timestamp"><?php
   365 		<span id="timestamp">
       
   366 		<?php
   338 			$date = date_i18n(
   367 			$date = date_i18n(
   339 				/* translators: Publish box date format, see https://secure.php.net/date */
   368 				/* translators: Publish box date format, see https://secure.php.net/date */
   340 				__( 'M j, Y @ H:i' ),
   369 				__( 'M j, Y @ H:i' ),
   341 				strtotime( $post->post_date )
   370 				strtotime( $post->post_date )
   342 			);
   371 			);
   343 			printf(
   372 							printf(
   344 				/* translators: Attachment information. %s: Date the attachment was uploaded */
   373 								/* translators: Attachment information. %s: Date the attachment was uploaded */
   345 				__( 'Uploaded on: %s' ),
   374 								__( 'Uploaded on: %s' ),
   346 				'<b>' . $date . '</b>'
   375 								'<b>' . $date . '</b>'
   347 			);
   376 							);
   348 		?></span>
   377 		?>
       
   378 		</span>
   349 	</div><!-- .misc-pub-section -->
   379 	</div><!-- .misc-pub-section -->
   350 
   380 
   351 	<?php
   381 	<?php
   352 	/**
   382 	/**
   353 	 * Fires after the 'Uploaded on' section of the Save meta box
   383 	 * Fires after the 'Uploaded on' section of the Save meta box
   354 	 * in the attachment editing screen.
   384 	 * in the attachment editing screen.
   355 	 *
   385 	 *
   356 	 * @since 3.5.0
   386 	 * @since 3.5.0
   357 	 * @since 4.9.0 Added the `$post` parameter.
   387 	 * @since 4.9.0 Added the `$post` parameter.
   358 	 *
   388 	 *
   359 	 * @param WP_Post $post WP_Post object for the current attachment. 
   389 	 * @param WP_Post $post WP_Post object for the current attachment.
   360 	 */
   390 	 */
   361 	do_action( 'attachment_submitbox_misc_actions', $post );
   391 	do_action( 'attachment_submitbox_misc_actions', $post );
   362 	?>
   392 	?>
   363 </div><!-- #misc-publishing-actions -->
   393 </div><!-- #misc-publishing-actions -->
   364 <div class="clear"></div>
   394 <div class="clear"></div>
   365 </div><!-- #minor-publishing -->
   395 </div><!-- #minor-publishing -->
   366 
   396 
   367 <div id="major-publishing-actions">
   397 <div id="major-publishing-actions">
   368 	<div id="delete-action">
   398 	<div id="delete-action">
   369 	<?php
   399 	<?php
   370 	if ( current_user_can( 'delete_post', $post->ID ) )
   400 	if ( current_user_can( 'delete_post', $post->ID ) ) {
   371 		if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) {
   401 		if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) {
   372 			echo "<a class='submitdelete deletion' href='" . get_delete_post_link( $post->ID ) . "'>" . _x( 'Trash', 'verb' ) . "</a>";
   402 			echo "<a class='submitdelete deletion' href='" . get_delete_post_link( $post->ID ) . "'>" . __( 'Move to Trash' ) . '</a>';
   373 		} else {
   403 		} else {
   374 			$delete_ays = ! MEDIA_TRASH ? " onclick='return showNotice.warn();'" : '';
   404 			$delete_ays = ! MEDIA_TRASH ? " onclick='return showNotice.warn();'" : '';
   375 			echo  "<a class='submitdelete deletion'$delete_ays href='" . get_delete_post_link( $post->ID, null, true ) . "'>" . __( 'Delete Permanently' ) . "</a>";
   405 			echo  "<a class='submitdelete deletion'$delete_ays href='" . get_delete_post_link( $post->ID, null, true ) . "'>" . __( 'Delete Permanently' ) . '</a>';
   376 		}
   406 		}
       
   407 	}
   377 	?>
   408 	?>
   378 	</div>
   409 	</div>
   379 
   410 
   380 	<div id="publishing-action">
   411 	<div id="publishing-action">
   381 		<span class="spinner"></span>
   412 		<span class="spinner"></span>
   382 		<input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Update') ?>" />
   413 		<input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e( 'Update' ); ?>" />
   383 		<input name="save" type="submit" class="button button-primary button-large" id="publish" value="<?php esc_attr_e( 'Update' ) ?>" />
   414 		<input name="save" type="submit" class="button button-primary button-large" id="publish" value="<?php esc_attr_e( 'Update' ); ?>" />
   384 	</div>
   415 	</div>
   385 	<div class="clear"></div>
   416 	<div class="clear"></div>
   386 </div><!-- #major-publishing-actions -->
   417 </div><!-- #major-publishing-actions -->
   387 
   418 
   388 </div>
   419 </div>
   389 
   420 
   390 <?php
   421 	<?php
   391 }
   422 }
   392 
   423 
   393 /**
   424 /**
   394  * Display post format form elements.
   425  * Display post format form elements.
   395  *
   426  *
   405  *     @type array    $args     Extra meta box arguments.
   436  *     @type array    $args     Extra meta box arguments.
   406  * }
   437  * }
   407  */
   438  */
   408 function post_format_meta_box( $post, $box ) {
   439 function post_format_meta_box( $post, $box ) {
   409 	if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post->post_type, 'post-formats' ) ) :
   440 	if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post->post_type, 'post-formats' ) ) :
   410 	$post_formats = get_theme_support( 'post-formats' );
   441 		$post_formats = get_theme_support( 'post-formats' );
   411 
   442 
   412 	if ( is_array( $post_formats[0] ) ) :
   443 		if ( is_array( $post_formats[0] ) ) :
   413 		$post_format = get_post_format( $post->ID );
   444 			$post_format = get_post_format( $post->ID );
   414 		if ( !$post_format )
   445 			if ( ! $post_format ) {
   415 			$post_format = '0';
   446 				$post_format = '0';
   416 		// Add in the current one if it isn't there yet, in case the current theme doesn't support it
   447 			}
   417 		if ( $post_format && !in_array( $post_format, $post_formats[0] ) )
   448 			// Add in the current one if it isn't there yet, in case the current theme doesn't support it
   418 			$post_formats[0][] = $post_format;
   449 			if ( $post_format && ! in_array( $post_format, $post_formats[0] ) ) {
   419 	?>
   450 				$post_formats[0][] = $post_format;
   420 	<div id="post-formats-select">
   451 			}
       
   452 			?>
       
   453 		<div id="post-formats-select">
   421 		<fieldset>
   454 		<fieldset>
   422 			<legend class="screen-reader-text"><?php _e( 'Post Formats' ); ?></legend>
   455 			<legend class="screen-reader-text"><?php _e( 'Post Formats' ); ?></legend>
   423 			<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>
   456 			<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>
   424 			<?php foreach ( $post_formats[0] as $format ) : ?>
   457 			<?php foreach ( $post_formats[0] as $format ) : ?>
   425 			<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>
   458 			<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>
   426 			<?php endforeach; ?>
   459 			<?php endforeach; ?>
   427 		</fieldset>
   460 		</fieldset>
   428 	</div>
   461 	</div>
   429 	<?php endif; endif;
   462 			<?php
       
   463 	endif;
       
   464 endif;
   430 }
   465 }
   431 
   466 
   432 /**
   467 /**
   433  * Display post tags form fields.
   468  * Display post tags form fields.
   434  *
   469  *
   455 	if ( ! isset( $box['args'] ) || ! is_array( $box['args'] ) ) {
   490 	if ( ! isset( $box['args'] ) || ! is_array( $box['args'] ) ) {
   456 		$args = array();
   491 		$args = array();
   457 	} else {
   492 	} else {
   458 		$args = $box['args'];
   493 		$args = $box['args'];
   459 	}
   494 	}
   460 	$r = wp_parse_args( $args, $defaults );
   495 	$r                     = wp_parse_args( $args, $defaults );
   461 	$tax_name = esc_attr( $r['taxonomy'] );
   496 	$tax_name              = esc_attr( $r['taxonomy'] );
   462 	$taxonomy = get_taxonomy( $r['taxonomy'] );
   497 	$taxonomy              = get_taxonomy( $r['taxonomy'] );
   463 	$user_can_assign_terms = current_user_can( $taxonomy->cap->assign_terms );
   498 	$user_can_assign_terms = current_user_can( $taxonomy->cap->assign_terms );
   464 	$comma = _x( ',', 'tag delimiter' );
   499 	$comma                 = _x( ',', 'tag delimiter' );
   465 	$terms_to_edit = get_terms_to_edit( $post->ID, $tax_name );
   500 	$terms_to_edit         = get_terms_to_edit( $post->ID, $tax_name );
   466 	if ( ! is_string( $terms_to_edit ) ) {
   501 	if ( ! is_string( $terms_to_edit ) ) {
   467 		$terms_to_edit = '';
   502 		$terms_to_edit = '';
   468 	}
   503 	}
   469 ?>
   504 	?>
   470 <div class="tagsdiv" id="<?php echo $tax_name; ?>">
   505 <div class="tagsdiv" id="<?php echo $tax_name; ?>">
   471 	<div class="jaxtag">
   506 	<div class="jaxtag">
   472 	<div class="nojs-tags hide-if-js">
   507 	<div class="nojs-tags hide-if-js">
   473 		<label for="tax-input-<?php echo $tax_name; ?>"><?php echo $taxonomy->labels->add_or_remove_items; ?></label>
   508 		<label for="tax-input-<?php echo $tax_name; ?>"><?php echo $taxonomy->labels->add_or_remove_items; ?></label>
   474 		<p><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 ); ?> aria-describedby="new-tag-<?php echo $tax_name; ?>-desc"><?php echo str_replace( ',', $comma . ' ', $terms_to_edit ); // textarea_escaped by esc_attr() ?></textarea></p>
   509 		<p><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 ); ?> aria-describedby="new-tag-<?php echo $tax_name; ?>-desc"><?php echo str_replace( ',', $comma . ' ', $terms_to_edit ); // textarea_escaped by esc_attr() ?></textarea></p>
   475 	</div>
   510 	</div>
   476  	<?php if ( $user_can_assign_terms ) : ?>
   511 	<?php if ( $user_can_assign_terms ) : ?>
   477 	<div class="ajaxtag hide-if-no-js">
   512 	<div class="ajaxtag hide-if-no-js">
   478 		<label class="screen-reader-text" for="new-tag-<?php echo $tax_name; ?>"><?php echo $taxonomy->labels->add_new_item; ?></label>
   513 		<label class="screen-reader-text" for="new-tag-<?php echo $tax_name; ?>"><?php echo $taxonomy->labels->add_new_item; ?></label>
   479 		<p><input data-wp-taxonomy="<?php echo $tax_name; ?>" type="text" id="new-tag-<?php echo $tax_name; ?>" name="newtag[<?php echo $tax_name; ?>]" class="newtag form-input-tip" size="16" autocomplete="off" aria-describedby="new-tag-<?php echo $tax_name; ?>-desc" value="" />
   514 		<input data-wp-taxonomy="<?php echo $tax_name; ?>" type="text" id="new-tag-<?php echo $tax_name; ?>" name="newtag[<?php echo $tax_name; ?>]" class="newtag form-input-tip" size="16" autocomplete="off" aria-describedby="new-tag-<?php echo $tax_name; ?>-desc" value="" />
   480 		<input type="button" class="button tagadd" value="<?php esc_attr_e('Add'); ?>" /></p>
   515 		<input type="button" class="button tagadd" value="<?php esc_attr_e( 'Add' ); ?>" />
   481 	</div>
   516 	</div>
   482 	<p class="howto" id="new-tag-<?php echo $tax_name; ?>-desc"><?php echo $taxonomy->labels->separate_items_with_commas; ?></p>
   517 	<p class="howto" id="new-tag-<?php echo $tax_name; ?>-desc"><?php echo $taxonomy->labels->separate_items_with_commas; ?></p>
   483 	<?php elseif ( empty( $terms_to_edit ) ): ?>
   518 	<?php elseif ( empty( $terms_to_edit ) ) : ?>
   484 		<p><?php echo $taxonomy->labels->no_terms; ?></p>
   519 		<p><?php echo $taxonomy->labels->no_terms; ?></p>
   485 	<?php endif; ?>
   520 	<?php endif; ?>
   486 	</div>
   521 	</div>
   487 	<ul class="tagchecklist" role="list"></ul>
   522 	<ul class="tagchecklist" role="list"></ul>
   488 </div>
   523 </div>
   489 <?php if ( $user_can_assign_terms ) : ?>
   524 	<?php if ( $user_can_assign_terms ) : ?>
   490 <p class="hide-if-no-js"><button type="button" class="button-link tagcloud-link" id="link-<?php echo $tax_name; ?>" aria-expanded="false"><?php echo $taxonomy->labels->choose_from_most_used; ?></button></p>
   525 <p class="hide-if-no-js"><button type="button" class="button-link tagcloud-link" id="link-<?php echo $tax_name; ?>" aria-expanded="false"><?php echo $taxonomy->labels->choose_from_most_used; ?></button></p>
   491 <?php endif; ?>
   526 <?php endif; ?>
   492 <?php
   527 	<?php
   493 }
   528 }
   494 
   529 
   495 /**
   530 /**
   496  * Display post categories form fields.
   531  * Display post categories form fields.
   497  *
   532  *
   518 	if ( ! isset( $box['args'] ) || ! is_array( $box['args'] ) ) {
   553 	if ( ! isset( $box['args'] ) || ! is_array( $box['args'] ) ) {
   519 		$args = array();
   554 		$args = array();
   520 	} else {
   555 	} else {
   521 		$args = $box['args'];
   556 		$args = $box['args'];
   522 	}
   557 	}
   523 	$r = wp_parse_args( $args, $defaults );
   558 	$r        = wp_parse_args( $args, $defaults );
   524 	$tax_name = esc_attr( $r['taxonomy'] );
   559 	$tax_name = esc_attr( $r['taxonomy'] );
   525 	$taxonomy = get_taxonomy( $r['taxonomy'] );
   560 	$taxonomy = get_taxonomy( $r['taxonomy'] );
   526 	?>
   561 	?>
   527 	<div id="taxonomy-<?php echo $tax_name; ?>" class="categorydiv">
   562 	<div id="taxonomy-<?php echo $tax_name; ?>" class="categorydiv">
   528 		<ul id="<?php echo $tax_name; ?>-tabs" class="category-tabs">
   563 		<ul id="<?php echo $tax_name; ?>-tabs" class="category-tabs">
   540 			<?php
   575 			<?php
   541 			$name = ( $tax_name == 'category' ) ? 'post_category' : 'tax_input[' . $tax_name . ']';
   576 			$name = ( $tax_name == 'category' ) ? 'post_category' : 'tax_input[' . $tax_name . ']';
   542 			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.
   577 			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.
   543 			?>
   578 			?>
   544 			<ul id="<?php echo $tax_name; ?>checklist" data-wp-lists="list:<?php echo $tax_name; ?>" class="categorychecklist form-no-clear">
   579 			<ul id="<?php echo $tax_name; ?>checklist" data-wp-lists="list:<?php echo $tax_name; ?>" class="categorychecklist form-no-clear">
   545 				<?php wp_terms_checklist( $post->ID, array( 'taxonomy' => $tax_name, 'popular_cats' => $popular_ids ) ); ?>
   580 				<?php
       
   581 				wp_terms_checklist(
       
   582 					$post->ID,
       
   583 					array(
       
   584 						'taxonomy'     => $tax_name,
       
   585 						'popular_cats' => $popular_ids,
       
   586 					)
       
   587 				);
       
   588 				?>
   546 			</ul>
   589 			</ul>
   547 		</div>
   590 		</div>
   548 	<?php if ( current_user_can( $taxonomy->cap->edit_terms ) ) : ?>
   591 	<?php if ( current_user_can( $taxonomy->cap->edit_terms ) ) : ?>
   549 			<div id="<?php echo $tax_name; ?>-adder" class="wp-hidden-children">
   592 			<div id="<?php echo $tax_name; ?>-adder" class="wp-hidden-children">
   550 				<a id="<?php echo $tax_name; ?>-add-toggle" href="#<?php echo $tax_name; ?>-add" class="hide-if-no-js taxonomy-add-new">
   593 				<a id="<?php echo $tax_name; ?>-add-toggle" href="#<?php echo $tax_name; ?>-add" class="hide-if-no-js taxonomy-add-new">
   612  *
   655  *
   613  * @since 2.6.0
   656  * @since 2.6.0
   614  *
   657  *
   615  * @param object $post
   658  * @param object $post
   616  */
   659  */
   617 function post_excerpt_meta_box($post) {
   660 function post_excerpt_meta_box( $post ) {
   618 ?>
   661 	?>
   619 <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>
   662 <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>
   620 <p><?php
   663 <p>
       
   664 	<?php
   621 	printf(
   665 	printf(
   622 		/* translators: %s: Codex URL */
   666 		/* translators: %s: Codex URL */
   623 		__( 'Excerpts are optional hand-crafted summaries of your content that can be used in your theme. <a href="%s">Learn more about manual excerpts</a>.' ),
   667 		__( 'Excerpts are optional hand-crafted summaries of your content that can be used in your theme. <a href="%s">Learn more about manual excerpts</a>.' ),
   624 		__( 'https://codex.wordpress.org/Excerpt' )
   668 		__( 'https://codex.wordpress.org/Excerpt' )
   625 	);
   669 	);
   626 ?></p>
   670 	?>
   627 <?php
   671 </p>
       
   672 	<?php
   628 }
   673 }
   629 
   674 
   630 /**
   675 /**
   631  * Display trackback links form fields.
   676  * Display trackback links form fields.
   632  *
   677  *
   633  * @since 2.6.0
   678  * @since 2.6.0
   634  *
   679  *
   635  * @param object $post
   680  * @param object $post
   636  */
   681  */
   637 function post_trackback_meta_box($post) {
   682 function post_trackback_meta_box( $post ) {
   638 	$form_trackback = '<input type="text" name="trackback_url" id="trackback_url" class="code" value="' .
   683 	$form_trackback = '<input type="text" name="trackback_url" id="trackback_url" class="code" value="' .
   639 		esc_attr( str_replace( "\n", ' ', $post->to_ping ) ) . '" aria-describedby="trackback-url-desc" />';
   684 		esc_attr( str_replace( "\n", ' ', $post->to_ping ) ) . '" aria-describedby="trackback-url-desc" />';
   640 	if ('' != $post->pinged) {
   685 	if ( '' != $post->pinged ) {
   641 		$pings = '<p>'. __('Already pinged:') . '</p><ul>';
   686 		$pings          = '<p>' . __( 'Already pinged:' ) . '</p><ul>';
   642 		$already_pinged = explode("\n", trim($post->pinged));
   687 		$already_pinged = explode( "\n", trim( $post->pinged ) );
   643 		foreach ($already_pinged as $pinged_url) {
   688 		foreach ( $already_pinged as $pinged_url ) {
   644 			$pings .= "\n\t<li>" . esc_html($pinged_url) . "</li>";
   689 			$pings .= "\n\t<li>" . esc_html( $pinged_url ) . '</li>';
   645 		}
   690 		}
   646 		$pings .= '</ul>';
   691 		$pings .= '</ul>';
   647 	}
   692 	}
   648 
   693 
   649 ?>
   694 	?>
   650 <p>
   695 <p>
   651 	<label for="trackback_url"><?php _e( 'Send trackbacks to:' ); ?></label>
   696 	<label for="trackback_url"><?php _e( 'Send trackbacks to:' ); ?></label>
   652 	<?php echo $form_trackback; ?>
   697 	<?php echo $form_trackback; ?>
   653 </p>
   698 </p>
   654 <p id="trackback-url-desc" class="howto"><?php _e( 'Separate multiple URLs with spaces' ); ?></p>
   699 <p id="trackback-url-desc" class="howto"><?php _e( 'Separate multiple URLs with spaces' ); ?></p>
   655 <p><?php
   700 <p>
       
   701 	<?php
   656 	printf(
   702 	printf(
   657 		/* translators: %s: Codex URL */
   703 		/* translators: %s: Codex URL */
   658 		__( '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="%s">pingbacks</a>, no other action necessary.' ),
   704 		__( '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="%s">pingbacks</a>, no other action necessary.' ),
   659 		__( 'https://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments' )
   705 		__( 'https://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments' )
   660 	);
   706 	);
   661 ?></p>
   707 	?>
   662 <?php
   708 </p>
   663 if ( ! empty($pings) )
   709 	<?php
   664 	echo $pings;
   710 	if ( ! empty( $pings ) ) {
       
   711 		echo $pings;
       
   712 	}
   665 }
   713 }
   666 
   714 
   667 /**
   715 /**
   668  * Display custom fields form fields.
   716  * Display custom fields form fields.
   669  *
   717  *
   670  * @since 2.6.0
   718  * @since 2.6.0
   671  *
   719  *
   672  * @param object $post
   720  * @param object $post
   673  */
   721  */
   674 function post_custom_meta_box($post) {
   722 function post_custom_meta_box( $post ) {
   675 ?>
   723 	?>
   676 <div id="postcustomstuff">
   724 <div id="postcustomstuff">
   677 <div id="ajax-response"></div>
   725 <div id="ajax-response"></div>
   678 <?php
   726 	<?php
   679 $metadata = has_meta($post->ID);
   727 	$metadata = has_meta( $post->ID );
   680 foreach ( $metadata as $key => $value ) {
   728 	foreach ( $metadata as $key => $value ) {
   681 	if ( is_protected_meta( $metadata[ $key ][ 'meta_key' ], 'post' ) || ! current_user_can( 'edit_post_meta', $post->ID, $metadata[ $key ][ 'meta_key' ] ) )
   729 		if ( is_protected_meta( $metadata[ $key ]['meta_key'], 'post' ) || ! current_user_can( 'edit_post_meta', $post->ID, $metadata[ $key ]['meta_key'] ) ) {
   682 		unset( $metadata[ $key ] );
   730 			unset( $metadata[ $key ] );
   683 }
   731 		}
   684 list_meta( $metadata );
   732 	}
   685 meta_form( $post ); ?>
   733 	list_meta( $metadata );
   686 </div>
   734 	meta_form( $post );
   687 <p><?php
   735 	?>
       
   736 </div>
       
   737 <p>
       
   738 	<?php
   688 	printf(
   739 	printf(
   689 		/* translators: %s: Codex URL */
   740 		/* translators: %s: Codex URL */
   690 		__( 'Custom fields can be used to add extra metadata to a post that you can <a href="%s">use in your theme</a>.' ),
   741 		__( 'Custom fields can be used to add extra metadata to a post that you can <a href="%s">use in your theme</a>.' ),
   691 		__( 'https://codex.wordpress.org/Using_Custom_Fields' )
   742 		__( 'https://codex.wordpress.org/Using_Custom_Fields' )
   692 	);
   743 	);
   693 ?></p>
   744 	?>
   694 <?php
   745 </p>
       
   746 	<?php
   695 }
   747 }
   696 
   748 
   697 /**
   749 /**
   698  * Display comments status form fields.
   750  * Display comments status form fields.
   699  *
   751  *
   700  * @since 2.6.0
   752  * @since 2.6.0
   701  *
   753  *
   702  * @param object $post
   754  * @param object $post
   703  */
   755  */
   704 function post_comment_status_meta_box($post) {
   756 function post_comment_status_meta_box( $post ) {
   705 ?>
   757 	?>
   706 <input name="advanced_view" type="hidden" value="1" />
   758 <input name="advanced_view" type="hidden" value="1" />
   707 <p class="meta-options">
   759 <p class="meta-options">
   708 	<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 />
   760 	<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 />
   709 	<label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked($post->ping_status, 'open'); ?> /> <?php
   761 	<label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked( $post->ping_status, 'open' ); ?> />
       
   762 		<?php
   710 		printf(
   763 		printf(
   711 			/* translators: %s: Codex URL */
   764 			/* translators: %s: Codex URL */
   712 			__( 'Allow <a href="%s">trackbacks and pingbacks</a> on this page' ),
   765 			__( 'Allow <a href="%s">trackbacks and pingbacks</a> on this page' ),
   713 			__( 'https://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments' ) );
   766 			__( 'https://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments' )
   714 		?></label>
   767 		);
       
   768 		?>
       
   769 	</label>
   715 	<?php
   770 	<?php
   716 	/**
   771 	/**
   717 	 * Fires at the end of the Discussion meta box on the post editing screen.
   772 	 * Fires at the end of the Discussion meta box on the post editing screen.
   718 	 *
   773 	 *
   719 	 * @since 3.1.0
   774 	 * @since 3.1.0
   721 	 * @param WP_Post $post WP_Post object of the current post.
   776 	 * @param WP_Post $post WP_Post object of the current post.
   722 	 */
   777 	 */
   723 	do_action( 'post_comment_status_meta_box-options', $post );
   778 	do_action( 'post_comment_status_meta_box-options', $post );
   724 	?>
   779 	?>
   725 </p>
   780 </p>
   726 <?php
   781 	<?php
   727 }
   782 }
   728 
   783 
   729 /**
   784 /**
   730  * Display comments for post table header
   785  * Display comments for post table header
   731  *
   786  *
   732  * @since 3.0.0
   787  * @since 3.0.0
   733  *
   788  *
   734  * @param array $result table header rows
   789  * @param array $result table header rows
   735  * @return array
   790  * @return array
   736  */
   791  */
   737 function post_comment_meta_box_thead($result) {
   792 function post_comment_meta_box_thead( $result ) {
   738 	unset($result['cb'], $result['response']);
   793 	unset( $result['cb'], $result['response'] );
   739 	return $result;
   794 	return $result;
   740 }
   795 }
   741 
   796 
   742 /**
   797 /**
   743  * Display comments for post.
   798  * Display comments for post.
   747  * @param object $post
   802  * @param object $post
   748  */
   803  */
   749 function post_comment_meta_box( $post ) {
   804 function post_comment_meta_box( $post ) {
   750 	wp_nonce_field( 'get-comments', 'add_comment_nonce', false );
   805 	wp_nonce_field( 'get-comments', 'add_comment_nonce', false );
   751 	?>
   806 	?>
   752 	<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>
   807 	<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>
   753 	<?php
   808 	<?php
   754 
   809 
   755 	$total = get_comments( array( 'post_id' => $post->ID, 'number' => 1, 'count' => true ) );
   810 	$total         = get_comments(
   756 	$wp_list_table = _get_list_table('WP_Post_Comments_List_Table');
   811 		array(
       
   812 			'post_id' => $post->ID,
       
   813 			'number'  => 1,
       
   814 			'count'   => true,
       
   815 		)
       
   816 	);
       
   817 	$wp_list_table = _get_list_table( 'WP_Post_Comments_List_Table' );
   757 	$wp_list_table->display( true );
   818 	$wp_list_table->display( true );
   758 
   819 
   759 	if ( 1 > $total ) {
   820 	if ( 1 > $total ) {
   760 		echo '<p id="no-comments">' . __('No comments yet.') . '</p>';
   821 		echo '<p id="no-comments">' . __( 'No comments yet.' ) . '</p>';
   761 	} else {
   822 	} else {
   762 		$hidden = get_hidden_meta_boxes( get_current_screen() );
   823 		$hidden = get_hidden_meta_boxes( get_current_screen() );
   763 		if ( ! in_array('commentsdiv', $hidden) ) {
   824 		if ( ! in_array( 'commentsdiv', $hidden ) ) {
   764 			?>
   825 			?>
   765 			<script type="text/javascript">jQuery(document).ready(function(){commentsBox.get(<?php echo $total; ?>, 10);});</script>
   826 			<script type="text/javascript">jQuery(document).ready(function(){commentsBox.get(<?php echo $total; ?>, 10);});</script>
   766 			<?php
   827 			<?php
   767 		}
   828 		}
   768 
   829 
   769 		?>
   830 		?>
   770 		<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>
   831 		<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>
   771 		<?php
   832 		<?php
   772 	}
   833 	}
   773 
   834 
   774 	wp_comment_trashnotice();
   835 	wp_comment_trashnotice();
   775 }
   836 }
   779  *
   840  *
   780  * @since 2.6.0
   841  * @since 2.6.0
   781  *
   842  *
   782  * @param object $post
   843  * @param object $post
   783  */
   844  */
   784 function post_slug_meta_box($post) {
   845 function post_slug_meta_box( $post ) {
   785 /** This filter is documented in wp-admin/edit-tag-form.php */
   846 	/** This filter is documented in wp-admin/edit-tag-form.php */
   786 $editable_slug = apply_filters( 'editable_slug', $post->post_name, $post );
   847 	$editable_slug = apply_filters( 'editable_slug', $post->post_name, $post );
   787 ?>
   848 	?>
   788 <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 ); ?>" />
   849 <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 ); ?>" />
   789 <?php
   850 	<?php
   790 }
   851 }
   791 
   852 
   792 /**
   853 /**
   793  * Display form field with list of authors.
   854  * Display form field with list of authors.
   794  *
   855  *
   796  *
   857  *
   797  * @global int $user_ID
   858  * @global int $user_ID
   798  *
   859  *
   799  * @param object $post
   860  * @param object $post
   800  */
   861  */
   801 function post_author_meta_box($post) {
   862 function post_author_meta_box( $post ) {
   802 	global $user_ID;
   863 	global $user_ID;
   803 ?>
   864 	?>
   804 <label class="screen-reader-text" for="post_author_override"><?php _e('Author'); ?></label>
   865 <label class="screen-reader-text" for="post_author_override"><?php _e( 'Author' ); ?></label>
   805 <?php
   866 	<?php
   806 	wp_dropdown_users( array(
   867 	wp_dropdown_users(
   807 		'who' => 'authors',
   868 		array(
   808 		'name' => 'post_author_override',
   869 			'who'              => 'authors',
   809 		'selected' => empty($post->ID) ? $user_ID : $post->post_author,
   870 			'name'             => 'post_author_override',
   810 		'include_selected' => true,
   871 			'selected'         => empty( $post->ID ) ? $user_ID : $post->post_author,
   811 		'show' => 'display_name_with_login',
   872 			'include_selected' => true,
   812 	) );
   873 			'show'             => 'display_name_with_login',
       
   874 		)
       
   875 	);
   813 }
   876 }
   814 
   877 
   815 /**
   878 /**
   816  * Display list of revisions.
   879  * Display list of revisions.
   817  *
   880  *
   830  *
   893  *
   831  * @since 2.7.0
   894  * @since 2.7.0
   832  *
   895  *
   833  * @param object $post
   896  * @param object $post
   834  */
   897  */
   835 function page_attributes_meta_box($post) {
   898 function page_attributes_meta_box( $post ) {
   836 	if ( is_post_type_hierarchical( $post->post_type ) ) :
   899 	if ( is_post_type_hierarchical( $post->post_type ) ) :
   837 		$dropdown_args = array(
   900 		$dropdown_args = array(
   838 			'post_type'        => $post->post_type,
   901 			'post_type'        => $post->post_type,
   839 			'exclude_tree'     => $post->ID,
   902 			'exclude_tree'     => $post->ID,
   840 			'selected'         => $post->post_parent,
   903 			'selected'         => $post->post_parent,
   841 			'name'             => 'parent_id',
   904 			'name'             => 'parent_id',
   842 			'show_option_none' => __('(no parent)'),
   905 			'show_option_none' => __( '(no parent)' ),
   843 			'sort_column'      => 'menu_order, post_title',
   906 			'sort_column'      => 'menu_order, post_title',
   844 			'echo'             => 0,
   907 			'echo'             => 0,
   845 		);
   908 		);
   846 
   909 
   847 		/**
   910 		/**
   853 		 *
   916 		 *
   854 		 * @param array   $dropdown_args Array of arguments used to generate the pages drop-down.
   917 		 * @param array   $dropdown_args Array of arguments used to generate the pages drop-down.
   855 		 * @param WP_Post $post          The current post.
   918 		 * @param WP_Post $post          The current post.
   856 		 */
   919 		 */
   857 		$dropdown_args = apply_filters( 'page_attributes_dropdown_pages_args', $dropdown_args, $post );
   920 		$dropdown_args = apply_filters( 'page_attributes_dropdown_pages_args', $dropdown_args, $post );
   858 		$pages = wp_dropdown_pages( $dropdown_args );
   921 		$pages         = wp_dropdown_pages( $dropdown_args );
   859 		if ( ! empty($pages) ) :
   922 		if ( ! empty( $pages ) ) :
   860 ?>
   923 			?>
   861 <p class="post-attributes-label-wrapper"><label class="post-attributes-label" for="parent_id"><?php _e( 'Parent' ); ?></label></p>
   924 <p class="post-attributes-label-wrapper"><label class="post-attributes-label" for="parent_id"><?php _e( 'Parent' ); ?></label></p>
   862 <?php echo $pages; ?>
   925 			<?php echo $pages; ?>
   863 <?php
   926 			<?php
   864 		endif; // end empty pages check
   927 		endif; // end empty pages check
   865 	endif;  // end hierarchical check.
   928 	endif;  // end hierarchical check.
   866 
   929 
   867 	if ( count( get_page_templates( $post ) ) > 0 && get_option( 'page_for_posts' ) != $post->ID ) :
   930 	if ( count( get_page_templates( $post ) ) > 0 && get_option( 'page_for_posts' ) != $post->ID ) :
   868 		$template = ! empty( $post->page_template ) ? $post->page_template : false;
   931 		$template = ! empty( $post->page_template ) ? $post->page_template : false;
   869 		?>
   932 		?>
   870 <p class="post-attributes-label-wrapper"><label class="post-attributes-label" for="page_template"><?php _e( 'Template' ); ?></label><?php
   933 <p class="post-attributes-label-wrapper"><label class="post-attributes-label" for="page_template"><?php _e( 'Template' ); ?></label>
   871 	/**
   934 		<?php
   872 	 * Fires immediately after the label inside the 'Template' section
   935 		/**
   873 	 * of the 'Page Attributes' meta box.
   936 		 * Fires immediately after the label inside the 'Template' section
   874 	 *
   937 		 * of the 'Page Attributes' meta box.
   875 	 * @since 4.4.0
   938 		 *
   876 	 *
   939 		 * @since 4.4.0
   877 	 * @param string  $template The template used for the current post.
   940 		 *
   878 	 * @param WP_Post $post     The current post.
   941 		 * @param string  $template The template used for the current post.
   879 	 */
   942 		 * @param WP_Post $post     The current post.
   880 	do_action( 'page_attributes_meta_box_template', $template, $post );
   943 		 */
   881 ?></p>
   944 		do_action( 'page_attributes_meta_box_template', $template, $post );
       
   945 		?>
       
   946 </p>
   882 <select name="page_template" id="page_template">
   947 <select name="page_template" id="page_template">
   883 <?php
   948 		<?php
   884 /**
   949 		/**
   885  * Filters the title of the default page template displayed in the drop-down.
   950 		 * Filters the title of the default page template displayed in the drop-down.
   886  *
   951 		 *
   887  * @since 4.1.0
   952 		 * @since 4.1.0
   888  *
   953 		 *
   889  * @param string $label   The display value for the default page template title.
   954 		 * @param string $label   The display value for the default page template title.
   890  * @param string $context Where the option label is displayed. Possible values
   955 		 * @param string $context Where the option label is displayed. Possible values
   891  *                        include 'meta-box' or 'quick-edit'.
   956 		 *                        include 'meta-box' or 'quick-edit'.
   892  */
   957 		 */
   893 $default_title = apply_filters( 'default_page_template_title',  __( 'Default Template' ), 'meta-box' );
   958 		$default_title = apply_filters( 'default_page_template_title', __( 'Default Template' ), 'meta-box' );
   894 ?>
   959 		?>
   895 <option value="default"><?php echo esc_html( $default_title ); ?></option>
   960 <option value="default"><?php echo esc_html( $default_title ); ?></option>
   896 <?php page_template_dropdown( $template, $post->post_type ); ?>
   961 		<?php page_template_dropdown( $template, $post->post_type ); ?>
   897 </select>
   962 </select>
   898 <?php endif; ?>
   963 <?php endif; ?>
   899 <?php if ( post_type_supports( $post->post_type, 'page-attributes' ) ) : ?>
   964 	<?php if ( post_type_supports( $post->post_type, 'page-attributes' ) ) : ?>
   900 <p class="post-attributes-label-wrapper"><label class="post-attributes-label" for="menu_order"><?php _e( 'Order' ); ?></label></p>
   965 <p class="post-attributes-label-wrapper"><label class="post-attributes-label" for="menu_order"><?php _e( 'Order' ); ?></label></p>
   901 <input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo esc_attr( $post->menu_order ); ?>" />
   966 <input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo esc_attr( $post->menu_order ); ?>" />
   902 <?php
   967 		<?php
   903 /**
   968 		/**
   904  * Fires before the help hint text in the 'Page Attributes' meta box.
   969 		 * Fires before the help hint text in the 'Page Attributes' meta box.
   905  *
   970 		 *
   906  * @since 4.9.0
   971 		 * @since 4.9.0
   907  *
   972 		 *
   908  * @param WP_Post $post The current post.
   973 		 * @param WP_Post $post The current post.
   909  */
   974 		 */
   910 do_action( 'page_attributes_misc_attributes', $post );
   975 		do_action( 'page_attributes_misc_attributes', $post );
   911 ?>
   976 		?>
   912 <?php if ( 'page' == $post->post_type && get_current_screen()->get_help_tabs() ) : ?>
   977 		<?php if ( 'page' == $post->post_type && get_current_screen()->get_help_tabs() ) : ?>
   913 <p><?php _e( 'Need help? Use the Help tab above the screen title.' ); ?></p>
   978 <p><?php _e( 'Need help? Use the Help tab above the screen title.' ); ?></p>
   914 <?php endif;
   979 			<?php
   915 	endif;
   980 	endif;
       
   981 	endif;
   916 }
   982 }
   917 
   983 
   918 // -- Link related Meta Boxes
   984 // -- Link related Meta Boxes
   919 
   985 
   920 /**
   986 /**
   922  *
   988  *
   923  * @since 2.7.0
   989  * @since 2.7.0
   924  *
   990  *
   925  * @param object $link
   991  * @param object $link
   926  */
   992  */
   927 function link_submit_meta_box($link) {
   993 function link_submit_meta_box( $link ) {
   928 ?>
   994 	?>
   929 <div class="submitbox" id="submitlink">
   995 <div class="submitbox" id="submitlink">
   930 
   996 
   931 <div id="minor-publishing">
   997 <div id="minor-publishing">
   932 
   998 
   933 <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?>
   999 	<?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?>
   934 <div style="display:none;">
  1000 <div style="display:none;">
   935 <?php submit_button( __( 'Save' ), '', 'save', false ); ?>
  1001 	<?php submit_button( __( 'Save' ), '', 'save', false ); ?>
   936 </div>
  1002 </div>
   937 
  1003 
   938 <div id="minor-publishing-actions">
  1004 <div id="minor-publishing-actions">
   939 <div id="preview-action">
  1005 <div id="preview-action">
   940 <?php if ( !empty($link->link_id) ) { ?>
  1006 	<?php if ( ! empty( $link->link_id ) ) { ?>
   941 	<a class="preview button" href="<?php echo $link->link_url; ?>" target="_blank"><?php _e('Visit Link'); ?></a>
  1007 	<a class="preview button" href="<?php echo $link->link_url; ?>" target="_blank"><?php _e( 'Visit Link' ); ?></a>
   942 <?php } ?>
  1008 <?php } ?>
   943 </div>
  1009 </div>
   944 <div class="clear"></div>
  1010 <div class="clear"></div>
   945 </div>
  1011 </div>
   946 
  1012 
   947 <div id="misc-publishing-actions">
  1013 <div id="misc-publishing-actions">
   948 <div class="misc-pub-section misc-pub-private">
  1014 <div class="misc-pub-section misc-pub-private">
   949 	<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>
  1015 	<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>
   950 </div>
  1016 </div>
   951 </div>
  1017 </div>
   952 
  1018 
   953 </div>
  1019 </div>
   954 
  1020 
   955 <div id="major-publishing-actions">
  1021 <div id="major-publishing-actions">
   956 <?php
  1022 	<?php
   957 /** This action is documented in wp-admin/includes/meta-boxes.php */
  1023 	/** This action is documented in wp-admin/includes/meta-boxes.php */
   958 do_action( 'post_submitbox_start', null );
  1024 	do_action( 'post_submitbox_start', null );
   959 ?>
  1025 	?>
   960 <div id="delete-action">
  1026 <div id="delete-action">
   961 <?php
  1027 	<?php
   962 if ( !empty($_GET['action']) && 'edit' == $_GET['action'] && current_user_can('manage_links') ) { ?>
  1028 	if ( ! empty( $_GET['action'] ) && 'edit' == $_GET['action'] && current_user_can( 'manage_links' ) ) {
   963 	<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>
  1029 		?>
       
  1030 	<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>
   964 <?php } ?>
  1031 <?php } ?>
   965 </div>
  1032 </div>
   966 
  1033 
   967 <div id="publishing-action">
  1034 <div id="publishing-action">
   968 <?php if ( !empty($link->link_id) ) { ?>
  1035 	<?php if ( ! empty( $link->link_id ) ) { ?>
   969 	<input name="save" type="submit" class="button button-primary button-large" id="publish" value="<?php esc_attr_e( 'Update Link' ) ?>" />
  1036 	<input name="save" type="submit" class="button button-primary button-large" id="publish" value="<?php esc_attr_e( 'Update Link' ); ?>" />
   970 <?php } else { ?>
  1037 <?php } else { ?>
   971 	<input name="save" type="submit" class="button button-primary button-large" id="publish" value="<?php esc_attr_e( 'Add Link' ) ?>" />
  1038 	<input name="save" type="submit" class="button button-primary button-large" id="publish" value="<?php esc_attr_e( 'Add Link' ); ?>" />
   972 <?php } ?>
  1039 <?php } ?>
   973 </div>
  1040 </div>
   974 <div class="clear"></div>
  1041 <div class="clear"></div>
   975 </div>
  1042 </div>
   976 <?php
  1043 	<?php
   977 /**
  1044 	/**
   978  * Fires at the end of the Publish box in the Link editing screen.
  1045 	 * Fires at the end of the Publish box in the Link editing screen.
   979  *
  1046 	 *
   980  * @since 2.5.0
  1047 	 * @since 2.5.0
   981  */
  1048 	 */
   982 do_action( 'submitlink_box' );
  1049 	do_action( 'submitlink_box' );
   983 ?>
  1050 	?>
   984 <div class="clear"></div>
  1051 <div class="clear"></div>
   985 </div>
  1052 </div>
   986 <?php
  1053 	<?php
   987 }
  1054 }
   988 
  1055 
   989 /**
  1056 /**
   990  * Display link categories form fields.
  1057  * Display link categories form fields.
   991  *
  1058  *
   992  * @since 2.6.0
  1059  * @since 2.6.0
   993  *
  1060  *
   994  * @param object $link
  1061  * @param object $link
   995  */
  1062  */
   996 function link_categories_meta_box($link) {
  1063 function link_categories_meta_box( $link ) {
   997 ?>
  1064 	?>
   998 <div id="taxonomy-linkcategory" class="categorydiv">
  1065 <div id="taxonomy-linkcategory" class="categorydiv">
   999 	<ul id="category-tabs" class="category-tabs">
  1066 	<ul id="category-tabs" class="category-tabs">
  1000 		<li class="tabs"><a href="#categories-all"><?php _e( 'All Categories' ); ?></a></li>
  1067 		<li class="tabs"><a href="#categories-all"><?php _e( 'All Categories' ); ?></a></li>
  1001 		<li class="hide-if-no-js"><a href="#categories-pop"><?php _ex( 'Most Used', 'categories' ); ?></a></li>
  1068 		<li class="hide-if-no-js"><a href="#categories-pop"><?php _ex( 'Most Used', 'categories' ); ?></a></li>
  1002 	</ul>
  1069 	</ul>
  1003 
  1070 
  1004 	<div id="categories-all" class="tabs-panel">
  1071 	<div id="categories-all" class="tabs-panel">
  1005 		<ul id="categorychecklist" data-wp-lists="list:category" class="categorychecklist form-no-clear">
  1072 		<ul id="categorychecklist" data-wp-lists="list:category" class="categorychecklist form-no-clear">
  1006 			<?php
  1073 			<?php
  1007 			if ( isset($link->link_id) )
  1074 			if ( isset( $link->link_id ) ) {
  1008 				wp_link_category_checklist($link->link_id);
  1075 				wp_link_category_checklist( $link->link_id );
  1009 			else
  1076 			} else {
  1010 				wp_link_category_checklist();
  1077 				wp_link_category_checklist();
       
  1078 			}
  1011 			?>
  1079 			?>
  1012 		</ul>
  1080 		</ul>
  1013 	</div>
  1081 	</div>
  1014 
  1082 
  1015 	<div id="categories-pop" class="tabs-panel" style="display: none;">
  1083 	<div id="categories-pop" class="tabs-panel" style="display: none;">
  1016 		<ul id="categorychecklist-pop" class="categorychecklist form-no-clear">
  1084 		<ul id="categorychecklist-pop" class="categorychecklist form-no-clear">
  1017 			<?php wp_popular_terms_checklist('link_category'); ?>
  1085 			<?php wp_popular_terms_checklist( 'link_category' ); ?>
  1018 		</ul>
  1086 		</ul>
  1019 	</div>
  1087 	</div>
  1020 
  1088 
  1021 	<div id="category-adder" class="wp-hidden-children">
  1089 	<div id="category-adder" class="wp-hidden-children">
  1022 		<a id="category-add-toggle" href="#category-add" class="taxonomy-add-new"><?php _e( '+ Add New Category' ); ?></a>
  1090 		<a id="category-add-toggle" href="#category-add" class="taxonomy-add-new"><?php _e( '+ Add New Category' ); ?></a>
  1027 			<?php wp_nonce_field( 'add-link-category', '_ajax_nonce', false ); ?>
  1095 			<?php wp_nonce_field( 'add-link-category', '_ajax_nonce', false ); ?>
  1028 			<span id="category-ajax-response"></span>
  1096 			<span id="category-ajax-response"></span>
  1029 		</p>
  1097 		</p>
  1030 	</div>
  1098 	</div>
  1031 </div>
  1099 </div>
  1032 <?php
  1100 	<?php
  1033 }
  1101 }
  1034 
  1102 
  1035 /**
  1103 /**
  1036  * Display form fields for changing link target.
  1104  * Display form fields for changing link target.
  1037  *
  1105  *
  1038  * @since 2.6.0
  1106  * @since 2.6.0
  1039  *
  1107  *
  1040  * @param object $link
  1108  * @param object $link
  1041  */
  1109  */
  1042 function link_target_meta_box($link) { ?>
  1110 function link_target_meta_box( $link ) {
  1043 <fieldset><legend class="screen-reader-text"><span><?php _e('Target') ?></span></legend>
  1111 
       
  1112 	?>
       
  1113 <fieldset><legend class="screen-reader-text"><span><?php _e( 'Target' ); ?></span></legend>
  1044 <p><label for="link_target_blank" class="selectit">
  1114 <p><label for="link_target_blank" class="selectit">
  1045 <input id="link_target_blank" type="radio" name="link_target" value="_blank" <?php echo ( isset( $link->link_target ) && ($link->link_target == '_blank') ? 'checked="checked"' : ''); ?> />
  1115 <input id="link_target_blank" type="radio" name="link_target" value="_blank" <?php echo ( isset( $link->link_target ) && ( $link->link_target == '_blank' ) ? 'checked="checked"' : '' ); ?> />
  1046 <?php _e('<code>_blank</code> &mdash; new window or tab.'); ?></label></p>
  1116 	<?php _e( '<code>_blank</code> &mdash; new window or tab.' ); ?></label></p>
  1047 <p><label for="link_target_top" class="selectit">
  1117 <p><label for="link_target_top" class="selectit">
  1048 <input id="link_target_top" type="radio" name="link_target" value="_top" <?php echo ( isset( $link->link_target ) && ($link->link_target == '_top') ? 'checked="checked"' : ''); ?> />
  1118 <input id="link_target_top" type="radio" name="link_target" value="_top" <?php echo ( isset( $link->link_target ) && ( $link->link_target == '_top' ) ? 'checked="checked"' : '' ); ?> />
  1049 <?php _e('<code>_top</code> &mdash; current window or tab, with no frames.'); ?></label></p>
  1119 	<?php _e( '<code>_top</code> &mdash; current window or tab, with no frames.' ); ?></label></p>
  1050 <p><label for="link_target_none" class="selectit">
  1120 <p><label for="link_target_none" class="selectit">
  1051 <input id="link_target_none" type="radio" name="link_target" value="" <?php echo ( isset( $link->link_target ) && ($link->link_target == '') ? 'checked="checked"' : ''); ?> />
  1121 <input id="link_target_none" type="radio" name="link_target" value="" <?php echo ( isset( $link->link_target ) && ( $link->link_target == '' ) ? 'checked="checked"' : '' ); ?> />
  1052 <?php _e('<code>_none</code> &mdash; same window or tab.'); ?></label></p>
  1122 	<?php _e( '<code>_none</code> &mdash; same window or tab.' ); ?></label></p>
  1053 </fieldset>
  1123 </fieldset>
  1054 <p><?php _e('Choose the target frame for your link.'); ?></p>
  1124 <p><?php _e( 'Choose the target frame for your link.' ); ?></p>
  1055 <?php
  1125 	<?php
  1056 }
  1126 }
  1057 
  1127 
  1058 /**
  1128 /**
  1059  * Display checked checkboxes attribute for xfn microformat options.
  1129  * Display checked checkboxes attribute for xfn microformat options.
  1060  *
  1130  *
  1072 	if ( ! empty( $deprecated ) ) {
  1142 	if ( ! empty( $deprecated ) ) {
  1073 		_deprecated_argument( __FUNCTION__, '2.5.0' ); // Never implemented
  1143 		_deprecated_argument( __FUNCTION__, '2.5.0' ); // Never implemented
  1074 	}
  1144 	}
  1075 
  1145 
  1076 	$link_rel = isset( $link->link_rel ) ? $link->link_rel : ''; // In PHP 5.3: $link_rel = $link->link_rel ?: '';
  1146 	$link_rel = isset( $link->link_rel ) ? $link->link_rel : ''; // In PHP 5.3: $link_rel = $link->link_rel ?: '';
  1077 	$rels = preg_split('/\s+/', $link_rel);
  1147 	$rels     = preg_split( '/\s+/', $link_rel );
  1078 
  1148 
  1079 	if ('' != $value && in_array($value, $rels) ) {
  1149 	if ( '' != $value && in_array( $value, $rels ) ) {
  1080 		echo ' checked="checked"';
  1150 		echo ' checked="checked"';
  1081 	}
  1151 	}
  1082 
  1152 
  1083 	if ('' == $value) {
  1153 	if ( '' == $value ) {
  1084 		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"';
  1154 		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 ) {
  1085 		if ('friendship' == $class && strpos($link_rel, 'friend') === false && strpos($link_rel, 'acquaintance') === false && strpos($link_rel, 'contact') === false) echo ' checked="checked"';
  1155 			echo ' checked="checked"';
  1086 		if ('geographical' == $class && strpos($link_rel, 'co-resident') === false && strpos($link_rel, 'neighbor') === false) echo ' checked="checked"';
  1156 		}
  1087 		if ('identity' == $class && in_array('me', $rels) ) echo ' checked="checked"';
  1157 		if ( 'friendship' == $class && strpos( $link_rel, 'friend' ) === false && strpos( $link_rel, 'acquaintance' ) === false && strpos( $link_rel, 'contact' ) === false ) {
       
  1158 			echo ' checked="checked"';
       
  1159 		}
       
  1160 		if ( 'geographical' == $class && strpos( $link_rel, 'co-resident' ) === false && strpos( $link_rel, 'neighbor' ) === false ) {
       
  1161 			echo ' checked="checked"';
       
  1162 		}
       
  1163 		if ( 'identity' == $class && in_array( 'me', $rels ) ) {
       
  1164 			echo ' checked="checked"';
       
  1165 		}
  1088 	}
  1166 	}
  1089 }
  1167 }
  1090 
  1168 
  1091 /**
  1169 /**
  1092  * Display xfn form fields.
  1170  * Display xfn form fields.
  1093  *
  1171  *
  1094  * @since 2.6.0
  1172  * @since 2.6.0
  1095  *
  1173  *
  1096  * @param object $link
  1174  * @param object $link
  1097  */
  1175  */
  1098 function link_xfn_meta_box($link) {
  1176 function link_xfn_meta_box( $link ) {
  1099 ?>
  1177 	?>
  1100 <table class="links-table">
  1178 <table class="links-table">
  1101 	<tr>
  1179 	<tr>
  1102 		<th scope="row"><label for="link_rel"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('rel:') ?></label></th>
  1180 		<th scope="row"><label for="link_rel"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'rel:' ); ?></label></th>
  1103 		<td><input type="text" name="link_rel" id="link_rel" value="<?php echo ( isset( $link->link_rel ) ? esc_attr($link->link_rel) : ''); ?>" /></td>
  1181 		<td><input type="text" name="link_rel" id="link_rel" value="<?php echo ( isset( $link->link_rel ) ? esc_attr( $link->link_rel ) : '' ); ?>" /></td>
  1104 	</tr>
  1182 	</tr>
  1105 	<tr>
  1183 	<tr>
  1106 		<th scope="row"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('identity') ?></th>
  1184 		<th scope="row"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'identity' ); ?></th>
  1107 		<td><fieldset><legend class="screen-reader-text"><span><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('identity') ?></span></legend>
  1185 		<td><fieldset><legend class="screen-reader-text"><span><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'identity' ); ?></span></legend>
  1108 			<label for="me">
  1186 			<label for="me">
  1109 			<input type="checkbox" name="identity" value="me" id="me" <?php xfn_check('identity', 'me'); ?> />
  1187 			<input type="checkbox" name="identity" value="me" id="me" <?php xfn_check( 'identity', 'me' ); ?> />
  1110 			<?php _e('another web address of mine') ?></label>
  1188 			<?php _e( 'another web address of mine' ); ?></label>
  1111 		</fieldset></td>
  1189 		</fieldset></td>
  1112 	</tr>
  1190 	</tr>
  1113 	<tr>
  1191 	<tr>
  1114 		<th scope="row"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('friendship') ?></th>
  1192 		<th scope="row"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'friendship' ); ?></th>
  1115 		<td><fieldset><legend class="screen-reader-text"><span><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('friendship') ?></span></legend>
  1193 		<td><fieldset><legend class="screen-reader-text"><span><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'friendship' ); ?></span></legend>
  1116 			<label for="contact">
  1194 			<label for="contact">
  1117 			<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') ?>
  1195 			<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' ); ?>
  1118 			</label>
  1196 			</label>
  1119 			<label for="acquaintance">
  1197 			<label for="acquaintance">
  1120 			<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') ?>
  1198 			<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' ); ?>
  1121 			</label>
  1199 			</label>
  1122 			<label for="friend">
  1200 			<label for="friend">
  1123 			<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') ?>
  1201 			<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' ); ?>
  1124 			</label>
  1202 			</label>
  1125 			<label for="friendship">
  1203 			<label for="friendship">
  1126 			<input name="friendship" type="radio" class="valinp" value="" id="friendship" <?php xfn_check('friendship'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('none') ?>
  1204 			<input name="friendship" type="radio" class="valinp" value="" id="friendship" <?php xfn_check( 'friendship' ); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'none' ); ?>
  1127 			</label>
  1205 			</label>
  1128 		</fieldset></td>
  1206 		</fieldset></td>
  1129 	</tr>
  1207 	</tr>
  1130 	<tr>
  1208 	<tr>
  1131 		<th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('physical') ?> </th>
  1209 		<th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'physical' ); ?> </th>
  1132 		<td><fieldset><legend class="screen-reader-text"><span><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('physical') ?></span></legend>
  1210 		<td><fieldset><legend class="screen-reader-text"><span><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'physical' ); ?></span></legend>
  1133 			<label for="met">
  1211 			<label for="met">
  1134 			<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') ?>
  1212 			<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' ); ?>
  1135 			</label>
  1213 			</label>
  1136 		</fieldset></td>
  1214 		</fieldset></td>
  1137 	</tr>
  1215 	</tr>
  1138 	<tr>
  1216 	<tr>
  1139 		<th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('professional') ?> </th>
  1217 		<th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'professional' ); ?> </th>
  1140 		<td><fieldset><legend class="screen-reader-text"><span><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('professional') ?></span></legend>
  1218 		<td><fieldset><legend class="screen-reader-text"><span><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'professional' ); ?></span></legend>
  1141 			<label for="co-worker">
  1219 			<label for="co-worker">
  1142 			<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') ?>
  1220 			<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' ); ?>
  1143 			</label>
  1221 			</label>
  1144 			<label for="colleague">
  1222 			<label for="colleague">
  1145 			<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') ?>
  1223 			<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' ); ?>
  1146 			</label>
  1224 			</label>
  1147 		</fieldset></td>
  1225 		</fieldset></td>
  1148 	</tr>
  1226 	</tr>
  1149 	<tr>
  1227 	<tr>
  1150 		<th scope="row"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('geographical') ?></th>
  1228 		<th scope="row"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'geographical' ); ?></th>
  1151 		<td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('geographical') ?> </span></legend>
  1229 		<td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'geographical' ); ?> </span></legend>
  1152 			<label for="co-resident">
  1230 			<label for="co-resident">
  1153 			<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') ?>
  1231 			<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' ); ?>
  1154 			</label>
  1232 			</label>
  1155 			<label for="neighbor">
  1233 			<label for="neighbor">
  1156 			<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') ?>
  1234 			<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' ); ?>
  1157 			</label>
  1235 			</label>
  1158 			<label for="geographical">
  1236 			<label for="geographical">
  1159 			<input class="valinp" type="radio" name="geographical" value="" id="geographical" <?php xfn_check('geographical'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('none') ?>
  1237 			<input class="valinp" type="radio" name="geographical" value="" id="geographical" <?php xfn_check( 'geographical' ); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'none' ); ?>
  1160 			</label>
  1238 			</label>
  1161 		</fieldset></td>
  1239 		</fieldset></td>
  1162 	</tr>
  1240 	</tr>
  1163 	<tr>
  1241 	<tr>
  1164 		<th scope="row"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('family') ?></th>
  1242 		<th scope="row"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'family' ); ?></th>
  1165 		<td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('family') ?> </span></legend>
  1243 		<td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'family' ); ?> </span></legend>
  1166 			<label for="child">
  1244 			<label for="child">
  1167 			<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') ?>
  1245 			<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' ); ?>
  1168 			</label>
  1246 			</label>
  1169 			<label for="kin">
  1247 			<label for="kin">
  1170 			<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') ?>
  1248 			<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' ); ?>
  1171 			</label>
  1249 			</label>
  1172 			<label for="parent">
  1250 			<label for="parent">
  1173 			<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') ?>
  1251 			<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' ); ?>
  1174 			</label>
  1252 			</label>
  1175 			<label for="sibling">
  1253 			<label for="sibling">
  1176 			<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') ?>
  1254 			<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' ); ?>
  1177 			</label>
  1255 			</label>
  1178 			<label for="spouse">
  1256 			<label for="spouse">
  1179 			<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') ?>
  1257 			<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' ); ?>
  1180 			</label>
  1258 			</label>
  1181 			<label for="family">
  1259 			<label for="family">
  1182 			<input class="valinp" type="radio" name="family" value="" id="family" <?php xfn_check('family'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('none') ?>
  1260 			<input class="valinp" type="radio" name="family" value="" id="family" <?php xfn_check( 'family' ); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'none' ); ?>
  1183 			</label>
  1261 			</label>
  1184 		</fieldset></td>
  1262 		</fieldset></td>
  1185 	</tr>
  1263 	</tr>
  1186 	<tr>
  1264 	<tr>
  1187 		<th scope="row"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('romantic') ?></th>
  1265 		<th scope="row"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'romantic' ); ?></th>
  1188 		<td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('romantic') ?> </span></legend>
  1266 		<td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'romantic' ); ?> </span></legend>
  1189 			<label for="muse">
  1267 			<label for="muse">
  1190 			<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') ?>
  1268 			<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' ); ?>
  1191 			</label>
  1269 			</label>
  1192 			<label for="crush">
  1270 			<label for="crush">
  1193 			<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') ?>
  1271 			<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' ); ?>
  1194 			</label>
  1272 			</label>
  1195 			<label for="date">
  1273 			<label for="date">
  1196 			<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') ?>
  1274 			<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' ); ?>
  1197 			</label>
  1275 			</label>
  1198 			<label for="romantic">
  1276 			<label for="romantic">
  1199 			<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') ?>
  1277 			<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' ); ?>
  1200 			</label>
  1278 			</label>
  1201 		</fieldset></td>
  1279 		</fieldset></td>
  1202 	</tr>
  1280 	</tr>
  1203 
  1281 
  1204 </table>
  1282 </table>
  1205 <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>
  1283 <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>
  1206 <?php
  1284 	<?php
  1207 }
  1285 }
  1208 
  1286 
  1209 /**
  1287 /**
  1210  * Display advanced link options form fields.
  1288  * Display advanced link options form fields.
  1211  *
  1289  *
  1212  * @since 2.6.0
  1290  * @since 2.6.0
  1213  *
  1291  *
  1214  * @param object $link
  1292  * @param object $link
  1215  */
  1293  */
  1216 function link_advanced_meta_box($link) {
  1294 function link_advanced_meta_box( $link ) {
  1217 ?>
  1295 	?>
  1218 <table class="links-table" cellpadding="0">
  1296 <table class="links-table" cellpadding="0">
  1219 	<tr>
  1297 	<tr>
  1220 		<th scope="row"><label for="link_image"><?php _e('Image Address') ?></label></th>
  1298 		<th scope="row"><label for="link_image"><?php _e( 'Image Address' ); ?></label></th>
  1221 		<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>
  1299 		<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>
  1222 	</tr>
  1300 	</tr>
  1223 	<tr>
  1301 	<tr>
  1224 		<th scope="row"><label for="rss_uri"><?php _e('RSS Address') ?></label></th>
  1302 		<th scope="row"><label for="rss_uri"><?php _e( 'RSS Address' ); ?></label></th>
  1225 		<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>
  1303 		<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>
  1226 	</tr>
  1304 	</tr>
  1227 	<tr>
  1305 	<tr>
  1228 		<th scope="row"><label for="link_notes"><?php _e('Notes') ?></label></th>
  1306 		<th scope="row"><label for="link_notes"><?php _e( 'Notes' ); ?></label></th>
  1229 		<td><textarea name="link_notes" id="link_notes" rows="10"><?php echo ( isset( $link->link_notes ) ? $link->link_notes : ''); // textarea_escaped ?></textarea></td>
  1307 		<td><textarea name="link_notes" id="link_notes" rows="10"><?php echo ( isset( $link->link_notes ) ? $link->link_notes : '' ); // textarea_escaped ?></textarea></td>
  1230 	</tr>
  1308 	</tr>
  1231 	<tr>
  1309 	<tr>
  1232 		<th scope="row"><label for="link_rating"><?php _e('Rating') ?></label></th>
  1310 		<th scope="row"><label for="link_rating"><?php _e( 'Rating' ); ?></label></th>
  1233 		<td><select name="link_rating" id="link_rating" size="1">
  1311 		<td><select name="link_rating" id="link_rating" size="1">
  1234 		<?php
  1312 		<?php
  1235 			for ( $r = 0; $r <= 10; $r++ ) {
  1313 		for ( $r = 0; $r <= 10; $r++ ) {
  1236 				echo '<option value="' . $r . '"';
  1314 			echo '<option value="' . $r . '"';
  1237 				if ( isset($link->link_rating) && $link->link_rating == $r )
  1315 			if ( isset( $link->link_rating ) && $link->link_rating == $r ) {
  1238 					echo ' selected="selected"';
  1316 				echo ' selected="selected"';
  1239 				echo('>' . $r . '</option>');
       
  1240 			}
  1317 			}
  1241 		?></select>&nbsp;<?php _e('(Leave at 0 for no rating.)') ?>
  1318 			echo( '>' . $r . '</option>' );
       
  1319 		}
       
  1320 		?>
       
  1321 		</select>&nbsp;<?php _e( '(Leave at 0 for no rating.)' ); ?>
  1242 		</td>
  1322 		</td>
  1243 	</tr>
  1323 	</tr>
  1244 </table>
  1324 </table>
  1245 <?php
  1325 	<?php
  1246 }
  1326 }
  1247 
  1327 
  1248 /**
  1328 /**
  1249  * Display post thumbnail meta box.
  1329  * Display post thumbnail meta box.
  1250  *
  1330  *
  1268 	$meta = array();
  1348 	$meta = array();
  1269 	if ( ! empty( $post->ID ) ) {
  1349 	if ( ! empty( $post->ID ) ) {
  1270 		$meta = wp_get_attachment_metadata( $post->ID );
  1350 		$meta = wp_get_attachment_metadata( $post->ID );
  1271 	}
  1351 	}
  1272 
  1352 
  1273 	foreach ( wp_get_attachment_id3_keys( $post, 'edit' ) as $key => $label ) : ?>
  1353 	foreach ( wp_get_attachment_id3_keys( $post, 'edit' ) as $key => $label ) :
       
  1354 		$value = '';
       
  1355 		if ( ! empty( $meta[ $key ] ) ) {
       
  1356 			$value = $meta[ $key ];
       
  1357 		}
       
  1358 		?>
  1274 	<p>
  1359 	<p>
  1275 		<label for="title"><?php echo $label ?></label><br />
  1360 		<label for="title"><?php echo $label; ?></label><br />
  1276 		<input type="text" name="id3_<?php echo esc_attr( $key ) ?>" id="id3_<?php echo esc_attr( $key ) ?>" class="large-text" value="<?php
  1361 		<input type="text" name="id3_<?php echo esc_attr( $key ); ?>" id="id3_<?php echo esc_attr( $key ); ?>" class="large-text" value="<?php echo esc_attr( $value ); ?>" />
  1277 			if ( ! empty( $meta[ $key ] ) ) {
       
  1278 				echo esc_attr( $meta[ $key ] );
       
  1279 			}
       
  1280 		?>" />
       
  1281 	</p>
  1362 	</p>
  1282 	<?php
  1363 		<?php
  1283 	endforeach;
  1364 	endforeach;
  1284 }
  1365 }
       
  1366 
       
  1367 /**
       
  1368  * Registers the default post meta boxes, and runs the `do_meta_boxes` actions.
       
  1369  *
       
  1370  * @since 5.0.0
       
  1371  *
       
  1372  * @param WP_Post $post The post object that these meta boxes are being generated for.
       
  1373  */
       
  1374 function register_and_do_post_meta_boxes( $post ) {
       
  1375 	$post_type        = $post->post_type;
       
  1376 	$post_type_object = get_post_type_object( $post_type );
       
  1377 
       
  1378 	$thumbnail_support = current_theme_supports( 'post-thumbnails', $post_type ) && post_type_supports( $post_type, 'thumbnail' );
       
  1379 	if ( ! $thumbnail_support && 'attachment' === $post_type && $post->post_mime_type ) {
       
  1380 		if ( wp_attachment_is( 'audio', $post ) ) {
       
  1381 			$thumbnail_support = post_type_supports( 'attachment:audio', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:audio' );
       
  1382 		} elseif ( wp_attachment_is( 'video', $post ) ) {
       
  1383 			$thumbnail_support = post_type_supports( 'attachment:video', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:video' );
       
  1384 		}
       
  1385 	}
       
  1386 
       
  1387 	$publish_callback_args = array( '__back_compat_meta_box' => true );
       
  1388 	if ( post_type_supports( $post_type, 'revisions' ) && 'auto-draft' != $post->post_status ) {
       
  1389 		$revisions = wp_get_post_revisions( $post->ID );
       
  1390 
       
  1391 		// We should aim to show the revisions meta box only when there are revisions.
       
  1392 		if ( count( $revisions ) > 1 ) {
       
  1393 			reset( $revisions ); // Reset pointer for key()
       
  1394 			$publish_callback_args = array(
       
  1395 				'revisions_count'        => count( $revisions ),
       
  1396 				'revision_id'            => key( $revisions ),
       
  1397 				'__back_compat_meta_box' => true,
       
  1398 			);
       
  1399 			add_meta_box( 'revisionsdiv', __( 'Revisions' ), 'post_revisions_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) );
       
  1400 		}
       
  1401 	}
       
  1402 
       
  1403 	if ( 'attachment' == $post_type ) {
       
  1404 		wp_enqueue_script( 'image-edit' );
       
  1405 		wp_enqueue_style( 'imgareaselect' );
       
  1406 		add_meta_box( 'submitdiv', __( 'Save' ), 'attachment_submit_meta_box', null, 'side', 'core', array( '__back_compat_meta_box' => true ) );
       
  1407 		add_action( 'edit_form_after_title', 'edit_form_image_editor' );
       
  1408 
       
  1409 		if ( wp_attachment_is( 'audio', $post ) ) {
       
  1410 			add_meta_box( 'attachment-id3', __( 'Metadata' ), 'attachment_id3_data_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) );
       
  1411 		}
       
  1412 	} else {
       
  1413 		add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', null, 'side', 'core', $publish_callback_args );
       
  1414 	}
       
  1415 
       
  1416 	if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post_type, 'post-formats' ) ) {
       
  1417 		add_meta_box( 'formatdiv', _x( 'Format', 'post format' ), 'post_format_meta_box', null, 'side', 'core', array( '__back_compat_meta_box' => true ) );
       
  1418 	}
       
  1419 
       
  1420 	// all taxonomies
       
  1421 	foreach ( get_object_taxonomies( $post ) as $tax_name ) {
       
  1422 		$taxonomy = get_taxonomy( $tax_name );
       
  1423 		if ( ! $taxonomy->show_ui || false === $taxonomy->meta_box_cb ) {
       
  1424 			continue;
       
  1425 		}
       
  1426 
       
  1427 		$label = $taxonomy->labels->name;
       
  1428 
       
  1429 		if ( ! is_taxonomy_hierarchical( $tax_name ) ) {
       
  1430 			$tax_meta_box_id = 'tagsdiv-' . $tax_name;
       
  1431 		} else {
       
  1432 			$tax_meta_box_id = $tax_name . 'div';
       
  1433 		}
       
  1434 
       
  1435 		add_meta_box(
       
  1436 			$tax_meta_box_id,
       
  1437 			$label,
       
  1438 			$taxonomy->meta_box_cb,
       
  1439 			null,
       
  1440 			'side',
       
  1441 			'core',
       
  1442 			array(
       
  1443 				'taxonomy'               => $tax_name,
       
  1444 				'__back_compat_meta_box' => true,
       
  1445 			)
       
  1446 		);
       
  1447 	}
       
  1448 
       
  1449 	if ( post_type_supports( $post_type, 'page-attributes' ) || count( get_page_templates( $post ) ) > 0 ) {
       
  1450 		add_meta_box( 'pageparentdiv', $post_type_object->labels->attributes, 'page_attributes_meta_box', null, 'side', 'core', array( '__back_compat_meta_box' => true ) );
       
  1451 	}
       
  1452 
       
  1453 	if ( $thumbnail_support && current_user_can( 'upload_files' ) ) {
       
  1454 		add_meta_box( 'postimagediv', esc_html( $post_type_object->labels->featured_image ), 'post_thumbnail_meta_box', null, 'side', 'low', array( '__back_compat_meta_box' => true ) );
       
  1455 	}
       
  1456 
       
  1457 	if ( post_type_supports( $post_type, 'excerpt' ) ) {
       
  1458 		add_meta_box( 'postexcerpt', __( 'Excerpt' ), 'post_excerpt_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) );
       
  1459 	}
       
  1460 
       
  1461 	if ( post_type_supports( $post_type, 'trackbacks' ) ) {
       
  1462 		add_meta_box( 'trackbacksdiv', __( 'Send Trackbacks' ), 'post_trackback_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) );
       
  1463 	}
       
  1464 
       
  1465 	if ( post_type_supports( $post_type, 'custom-fields' ) ) {
       
  1466 		add_meta_box(
       
  1467 			'postcustom',
       
  1468 			__( 'Custom Fields' ),
       
  1469 			'post_custom_meta_box',
       
  1470 			null,
       
  1471 			'normal',
       
  1472 			'core',
       
  1473 			array(
       
  1474 				'__back_compat_meta_box'             => ! (bool) get_user_meta( get_current_user_id(), 'enable_custom_fields', true ),
       
  1475 				'__block_editor_compatible_meta_box' => true,
       
  1476 			)
       
  1477 		);
       
  1478 	}
       
  1479 
       
  1480 	/**
       
  1481 	 * Fires in the middle of built-in meta box registration.
       
  1482 	 *
       
  1483 	 * @since 2.1.0
       
  1484 	 * @deprecated 3.7.0 Use 'add_meta_boxes' instead.
       
  1485 	 *
       
  1486 	 * @param WP_Post $post Post object.
       
  1487 	 */
       
  1488 	do_action( 'dbx_post_advanced', $post );
       
  1489 
       
  1490 	// Allow the Discussion meta box to show up if the post type supports comments,
       
  1491 	// or if comments or pings are open.
       
  1492 	if ( comments_open( $post ) || pings_open( $post ) || post_type_supports( $post_type, 'comments' ) ) {
       
  1493 		add_meta_box( 'commentstatusdiv', __( 'Discussion' ), 'post_comment_status_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) );
       
  1494 	}
       
  1495 
       
  1496 	$stati = get_post_stati( array( 'public' => true ) );
       
  1497 	if ( empty( $stati ) ) {
       
  1498 		$stati = array( 'publish' );
       
  1499 	}
       
  1500 	$stati[] = 'private';
       
  1501 
       
  1502 	if ( in_array( get_post_status( $post ), $stati ) ) {
       
  1503 		// If the post type support comments, or the post has comments, allow the
       
  1504 		// Comments meta box.
       
  1505 		if ( comments_open( $post ) || pings_open( $post ) || $post->comment_count > 0 || post_type_supports( $post_type, 'comments' ) ) {
       
  1506 			add_meta_box( 'commentsdiv', __( 'Comments' ), 'post_comment_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) );
       
  1507 		}
       
  1508 	}
       
  1509 
       
  1510 	if ( ! ( 'pending' == get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) ) {
       
  1511 		add_meta_box( 'slugdiv', __( 'Slug' ), 'post_slug_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) );
       
  1512 	}
       
  1513 
       
  1514 	if ( post_type_supports( $post_type, 'author' ) && current_user_can( $post_type_object->cap->edit_others_posts ) ) {
       
  1515 		add_meta_box( 'authordiv', __( 'Author' ), 'post_author_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) );
       
  1516 	}
       
  1517 
       
  1518 	/**
       
  1519 	 * Fires after all built-in meta boxes have been added.
       
  1520 	 *
       
  1521 	 * @since 3.0.0
       
  1522 	 *
       
  1523 	 * @param string  $post_type Post type.
       
  1524 	 * @param WP_Post $post      Post object.
       
  1525 	 */
       
  1526 	do_action( 'add_meta_boxes', $post_type, $post );
       
  1527 
       
  1528 	/**
       
  1529 	 * Fires after all built-in meta boxes have been added, contextually for the given post type.
       
  1530 	 *
       
  1531 	 * The dynamic portion of the hook, `$post_type`, refers to the post type of the post.
       
  1532 	 *
       
  1533 	 * @since 3.0.0
       
  1534 	 *
       
  1535 	 * @param WP_Post $post Post object.
       
  1536 	 */
       
  1537 	do_action( "add_meta_boxes_{$post_type}", $post );
       
  1538 
       
  1539 	/**
       
  1540 	 * Fires after meta boxes have been added.
       
  1541 	 *
       
  1542 	 * Fires once for each of the default meta box contexts: normal, advanced, and side.
       
  1543 	 *
       
  1544 	 * @since 3.0.0
       
  1545 	 *
       
  1546 	 * @param string  $post_type Post type of the post.
       
  1547 	 * @param string  $context   string  Meta box context.
       
  1548 	 * @param WP_Post $post      Post object.
       
  1549 	 */
       
  1550 	do_action( 'do_meta_boxes', $post_type, 'normal', $post );
       
  1551 	/** This action is documented in wp-admin/includes/meta-boxes.php */
       
  1552 	do_action( 'do_meta_boxes', $post_type, 'advanced', $post );
       
  1553 	/** This action is documented in wp-admin/includes/meta-boxes.php */
       
  1554 	do_action( 'do_meta_boxes', $post_type, 'side', $post );
       
  1555 }