wp/wp-admin/includes/template.php
changeset 21 48c4eec2b7e6
parent 19 3d72ae0968f4
child 22 8c2e4d02f4ef
equal deleted inserted replaced
20:7b1b88e27a20 21:48c4eec2b7e6
   102 	$params = apply_filters( 'wp_terms_checklist_args', $args, $post_id );
   102 	$params = apply_filters( 'wp_terms_checklist_args', $args, $post_id );
   103 
   103 
   104 	$parsed_args = wp_parse_args( $params, $defaults );
   104 	$parsed_args = wp_parse_args( $params, $defaults );
   105 
   105 
   106 	if ( empty( $parsed_args['walker'] ) || ! ( $parsed_args['walker'] instanceof Walker ) ) {
   106 	if ( empty( $parsed_args['walker'] ) || ! ( $parsed_args['walker'] instanceof Walker ) ) {
   107 		$walker = new Walker_Category_Checklist;
   107 		$walker = new Walker_Category_Checklist();
   108 	} else {
   108 	} else {
   109 		$walker = $parsed_args['walker'];
   109 		$walker = $parsed_args['walker'];
   110 	}
   110 	}
   111 
   111 
   112 	$taxonomy             = $parsed_args['taxonomy'];
   112 	$taxonomy             = $parsed_args['taxonomy'];
   163 	}
   163 	}
   164 
   164 
   165 	$output = '';
   165 	$output = '';
   166 
   166 
   167 	if ( $parsed_args['checked_ontop'] ) {
   167 	if ( $parsed_args['checked_ontop'] ) {
   168 		// Post-process $categories rather than adding an exclude to the get_terms() query
   168 		/*
   169 		// to keep the query the same across all posts (for any query cache).
   169 		 * Post-process $categories rather than adding an exclude to the get_terms() query
       
   170 		 * to keep the query the same across all posts (for any query cache).
       
   171 		 */
   170 		$checked_categories = array();
   172 		$checked_categories = array();
   171 		$keys               = array_keys( $categories );
   173 		$keys               = array_keys( $categories );
   172 
   174 
   173 		foreach ( $keys as $k ) {
   175 		foreach ( $keys as $k ) {
   174 			if ( in_array( $categories[ $k ]->term_id, $args['selected_cats'], true ) ) {
   176 			if ( in_array( $categories[ $k ]->term_id, $args['selected_cats'], true ) ) {
   258 /**
   260 /**
   259  * Outputs a link category checklist element.
   261  * Outputs a link category checklist element.
   260  *
   262  *
   261  * @since 2.5.1
   263  * @since 2.5.1
   262  *
   264  *
   263  * @param int $link_id
   265  * @param int $link_id Optional. The link ID. Default 0.
   264  */
   266  */
   265 function wp_link_category_checklist( $link_id = 0 ) {
   267 function wp_link_category_checklist( $link_id = 0 ) {
   266 	$default = 1;
   268 	$default = 1;
   267 
   269 
   268 	$checked_categories = array();
   270 	$checked_categories = array();
   400  *
   402  *
   401  * @since 2.7.0
   403  * @since 2.7.0
   402  *
   404  *
   403  * @global WP_List_Table $wp_list_table
   405  * @global WP_List_Table $wp_list_table
   404  *
   406  *
   405  * @param int    $position
   407  * @param int    $position  Optional. The value of the 'position' input field. Default 1.
   406  * @param bool   $checkbox
   408  * @param bool   $checkbox  Optional. The value of the 'checkbox' input field. Default false.
   407  * @param string $mode
   409  * @param string $mode      Optional. If set to 'single', will use WP_Post_Comments_List_Table,
   408  * @param bool   $table_row
   410  *                          otherwise WP_Comments_List_Table. Default 'single'.
       
   411  * @param bool   $table_row Optional. Whether to use a table instead of a div element. Default true.
   409  */
   412  */
   410 function wp_comment_reply( $position = 1, $checkbox = false, $mode = 'single', $table_row = true ) {
   413 function wp_comment_reply( $position = 1, $checkbox = false, $mode = 'single', $table_row = true ) {
   411 	global $wp_list_table;
   414 	global $wp_list_table;
   412 	/**
   415 	/**
   413 	 * Filters the in-line comment reply-to form output in the Comments
   416 	 * Filters the in-line comment reply-to form output in the Comments
   456 <?php endif; ?>
   459 <?php endif; ?>
   457 	<fieldset class="comment-reply">
   460 	<fieldset class="comment-reply">
   458 	<legend>
   461 	<legend>
   459 		<span class="hidden" id="editlegend"><?php _e( 'Edit Comment' ); ?></span>
   462 		<span class="hidden" id="editlegend"><?php _e( 'Edit Comment' ); ?></span>
   460 		<span class="hidden" id="replyhead"><?php _e( 'Reply to Comment' ); ?></span>
   463 		<span class="hidden" id="replyhead"><?php _e( 'Reply to Comment' ); ?></span>
   461 		<span class="hidden" id="addhead"><?php _e( 'Add new Comment' ); ?></span>
   464 		<span class="hidden" id="addhead"><?php _e( 'Add New Comment' ); ?></span>
   462 	</legend>
   465 	</legend>
   463 
   466 
   464 	<div id="replycontainer">
   467 	<div id="replycontainer">
   465 	<label for="replycontent" class="screen-reader-text"><?php _e( 'Comment' ); ?></label>
   468 	<label for="replycontent" class="screen-reader-text">
       
   469 		<?php
       
   470 		/* translators: Hidden accessibility text. */
       
   471 		_e( 'Comment' );
       
   472 		?>
       
   473 	</label>
   466 	<?php
   474 	<?php
   467 	$quicktags_settings = array( 'buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,close' );
   475 	$quicktags_settings = array( 'buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,close' );
   468 	wp_editor(
   476 	wp_editor(
   469 		'',
   477 		'',
   470 		'replycontent',
   478 		'replycontent',
   502 				<span id="replybtn" style="display: none;"><?php _e( 'Submit Reply' ); ?></span>
   510 				<span id="replybtn" style="display: none;"><?php _e( 'Submit Reply' ); ?></span>
   503 			</button>
   511 			</button>
   504 			<button type="button" class="cancel button"><?php _e( 'Cancel' ); ?></button>
   512 			<button type="button" class="cancel button"><?php _e( 'Cancel' ); ?></button>
   505 			<span class="waiting spinner"></span>
   513 			<span class="waiting spinner"></span>
   506 		</p>
   514 		</p>
   507 		<div class="notice notice-error notice-alt inline hidden">
   515 		<?php
   508 			<p class="error"></p>
   516 		wp_admin_notice(
   509 		</div>
   517 			'<p class="error"></p>',
       
   518 			array(
       
   519 				'type'               => 'error',
       
   520 				'additional_classes' => array( 'notice-alt', 'inline', 'hidden' ),
       
   521 				'paragraph_wrap'     => false,
       
   522 			)
       
   523 		);
       
   524 		?>
   510 	</div>
   525 	</div>
   511 
   526 
   512 	<input type="hidden" name="action" id="action" value="" />
   527 	<input type="hidden" name="action" id="action" value="" />
   513 	<input type="hidden" name="comment_ID" id="comment_ID" value="" />
   528 	<input type="hidden" name="comment_ID" id="comment_ID" value="" />
   514 	<input type="hidden" name="comment_post_ID" id="comment_post_ID" value="" />
   529 	<input type="hidden" name="comment_post_ID" id="comment_post_ID" value="" />
   563 /**
   578 /**
   564  * Outputs a post's public meta data in the Custom Fields meta box.
   579  * Outputs a post's public meta data in the Custom Fields meta box.
   565  *
   580  *
   566  * @since 1.2.0
   581  * @since 1.2.0
   567  *
   582  *
   568  * @param array $meta
   583  * @param array[] $meta An array of meta data arrays keyed on 'meta_key' and 'meta_value'.
   569  */
   584  */
   570 function list_meta( $meta ) {
   585 function list_meta( $meta ) {
   571 	// Exit if no meta.
   586 	// Exit if no meta.
   572 	if ( ! $meta ) {
   587 	if ( ! $meta ) {
   573 		echo '
   588 		echo '
   607 /**
   622 /**
   608  * Outputs a single row of public meta data in the Custom Fields meta box.
   623  * Outputs a single row of public meta data in the Custom Fields meta box.
   609  *
   624  *
   610  * @since 2.5.0
   625  * @since 2.5.0
   611  *
   626  *
   612  * @param array $entry
   627  * @param array $entry An array of meta data keyed on 'meta_key' and 'meta_value'.
   613  * @param int   $count
   628  * @param int   $count Reference to the row number.
   614  * @return string
   629  * @return string A single row of public meta data.
   615  */
   630  */
   616 function _list_meta_row( $entry, &$count ) {
   631 function _list_meta_row( $entry, &$count ) {
   617 	static $update_nonce = '';
   632 	static $update_nonce = '';
   618 
   633 
   619 	if ( is_protected_meta( $entry['meta_key'], 'post' ) ) {
   634 	if ( is_protected_meta( $entry['meta_key'], 'post' ) ) {
   623 	if ( ! $update_nonce ) {
   638 	if ( ! $update_nonce ) {
   624 		$update_nonce = wp_create_nonce( 'add-meta' );
   639 		$update_nonce = wp_create_nonce( 'add-meta' );
   625 	}
   640 	}
   626 
   641 
   627 	$r = '';
   642 	$r = '';
   628 	++ $count;
   643 	++$count;
   629 
   644 
   630 	if ( is_serialized( $entry['meta_value'] ) ) {
   645 	if ( is_serialized( $entry['meta_value'] ) ) {
   631 		if ( is_serialized_string( $entry['meta_value'] ) ) {
   646 		if ( is_serialized_string( $entry['meta_value'] ) ) {
   632 			// This is a serialized string, so we should display it.
   647 			// This is a serialized string, so we should display it.
   633 			$entry['meta_value'] = maybe_unserialize( $entry['meta_value'] );
   648 			$entry['meta_value'] = maybe_unserialize( $entry['meta_value'] );
   643 	$entry['meta_id']    = (int) $entry['meta_id'];
   658 	$entry['meta_id']    = (int) $entry['meta_id'];
   644 
   659 
   645 	$delete_nonce = wp_create_nonce( 'delete-meta_' . $entry['meta_id'] );
   660 	$delete_nonce = wp_create_nonce( 'delete-meta_' . $entry['meta_id'] );
   646 
   661 
   647 	$r .= "\n\t<tr id='meta-{$entry['meta_id']}'>";
   662 	$r .= "\n\t<tr id='meta-{$entry['meta_id']}'>";
   648 	$r .= "\n\t\t<td class='left'><label class='screen-reader-text' for='meta-{$entry['meta_id']}-key'>" . __( 'Key' ) . "</label><input name='meta[{$entry['meta_id']}][key]' id='meta-{$entry['meta_id']}-key' type='text' size='20' value='{$entry['meta_key']}' />";
   663 	$r .= "\n\t\t<td class='left'><label class='screen-reader-text' for='meta-{$entry['meta_id']}-key'>" .
       
   664 		/* translators: Hidden accessibility text. */
       
   665 		__( 'Key' ) .
       
   666 	"</label><input name='meta[{$entry['meta_id']}][key]' id='meta-{$entry['meta_id']}-key' type='text' size='20' value='{$entry['meta_key']}' />";
   649 
   667 
   650 	$r .= "\n\t\t<div class='submit'>";
   668 	$r .= "\n\t\t<div class='submit'>";
   651 	$r .= get_submit_button( __( 'Delete' ), 'deletemeta small', "deletemeta[{$entry['meta_id']}]", false, array( 'data-wp-lists' => "delete:the-list:meta-{$entry['meta_id']}::_ajax_nonce=$delete_nonce" ) );
   669 	$r .= get_submit_button( __( 'Delete' ), 'deletemeta small', "deletemeta[{$entry['meta_id']}]", false, array( 'data-wp-lists' => "delete:the-list:meta-{$entry['meta_id']}::_ajax_nonce=$delete_nonce" ) );
   652 	$r .= "\n\t\t";
   670 	$r .= "\n\t\t";
   653 	$r .= get_submit_button( __( 'Update' ), 'updatemeta small', "meta-{$entry['meta_id']}-submit", false, array( 'data-wp-lists' => "add:the-list:meta-{$entry['meta_id']}::_ajax_nonce-add-meta=$update_nonce" ) );
   671 	$r .= get_submit_button( __( 'Update' ), 'updatemeta small', "meta-{$entry['meta_id']}-submit", false, array( 'data-wp-lists' => "add:the-list:meta-{$entry['meta_id']}::_ajax_nonce-add-meta=$update_nonce" ) );
   654 	$r .= '</div>';
   672 	$r .= '</div>';
   655 	$r .= wp_nonce_field( 'change-meta', '_ajax_nonce', false, false );
   673 	$r .= wp_nonce_field( 'change-meta', '_ajax_nonce', false, false );
   656 	$r .= '</td>';
   674 	$r .= '</td>';
   657 
   675 
   658 	$r .= "\n\t\t<td><label class='screen-reader-text' for='meta-{$entry['meta_id']}-value'>" . __( 'Value' ) . "</label><textarea name='meta[{$entry['meta_id']}][value]' id='meta-{$entry['meta_id']}-value' rows='2' cols='30'>{$entry['meta_value']}</textarea></td>\n\t</tr>";
   676 	$r .= "\n\t\t<td><label class='screen-reader-text' for='meta-{$entry['meta_id']}-value'>" .
       
   677 		/* translators: Hidden accessibility text. */
       
   678 		__( 'Value' ) .
       
   679 	"</label><textarea name='meta[{$entry['meta_id']}][value]' id='meta-{$entry['meta_id']}-value' rows='2' cols='30'>{$entry['meta_value']}</textarea></td>\n\t</tr>";
   659 	return $r;
   680 	return $r;
   660 }
   681 }
   661 
   682 
   662 /**
   683 /**
   663  * Prints the form in the Custom Fields meta box.
   684  * Prints the form in the Custom Fields meta box.
   710 		);
   731 		);
   711 	}
   732 	}
   712 
   733 
   713 	if ( $keys ) {
   734 	if ( $keys ) {
   714 		natcasesort( $keys );
   735 		natcasesort( $keys );
   715 		$meta_key_input_id = 'metakeyselect';
       
   716 	} else {
       
   717 		$meta_key_input_id = 'metakeyinput';
       
   718 	}
   736 	}
   719 	?>
   737 	?>
   720 <p><strong><?php _e( 'Add New Custom Field:' ); ?></strong></p>
   738 <p><strong><?php _e( 'Add New Custom Field:' ); ?></strong></p>
   721 <table id="newmeta">
   739 <table id="newmeta">
   722 <thead>
   740 <thead>
   723 <tr>
   741 <tr>
   724 <th class="left"><label for="<?php echo $meta_key_input_id; ?>"><?php _ex( 'Name', 'meta name' ); ?></label></th>
   742 <th class="left"><label for="metakeyselect"><?php _ex( 'Name', 'meta name' ); ?></label></th>
   725 <th><label for="metavalue"><?php _e( 'Value' ); ?></label></th>
   743 <th><label for="metavalue"><?php _e( 'Value' ); ?></label></th>
   726 </tr>
   744 </tr>
   727 </thead>
   745 </thead>
   728 
   746 
   729 <tbody>
   747 <tbody>
   739 			}
   757 			}
   740 			echo "\n<option value='" . esc_attr( $key ) . "'>" . esc_html( $key ) . '</option>';
   758 			echo "\n<option value='" . esc_attr( $key ) . "'>" . esc_html( $key ) . '</option>';
   741 		}
   759 		}
   742 		?>
   760 		?>
   743 </select>
   761 </select>
   744 <input class="hide-if-js" type="text" id="metakeyinput" name="metakeyinput" value="" />
   762 <input class="hidden" type="text" id="metakeyinput" name="metakeyinput" value="" aria-label="<?php _e( 'New custom field name' ); ?>" />
   745 <a href="#postcustomstuff" class="hide-if-no-js" onclick="jQuery('#metakeyinput, #metakeyselect, #enternew, #cancelnew').toggle();return false;">
   763 <button type="button" id="newmeta-button" class="button button-small hide-if-no-js" onclick="jQuery('#metakeyinput, #metakeyselect, #enternew, #cancelnew').toggleClass('hidden');jQuery('#metakeyinput, #metakeyselect').filter(':visible').trigger('focus');">
   746 <span id="enternew"><?php _e( 'Enter new' ); ?></span>
   764 <span id="enternew"><?php _e( 'Enter new' ); ?></span>
   747 <span id="cancelnew" class="hidden"><?php _e( 'Cancel' ); ?></span></a>
   765 <span id="cancelnew" class="hidden"><?php _e( 'Cancel' ); ?></span></button>
   748 <?php } else { ?>
   766 <?php } else { ?>
   749 <input type="text" id="metakeyinput" name="metakeyinput" value="" />
   767 <input type="text" id="metakeyinput" name="metakeyinput" value="" />
   750 <?php } ?>
   768 <?php } ?>
   751 </td>
   769 </td>
   752 <td><textarea id="metavalue" name="metavalue" rows="2" cols="25"></textarea></td>
   770 <td><textarea id="metavalue" name="metavalue" rows="2" cols="25"></textarea>
       
   771 	<?php wp_nonce_field( 'add-meta', '_ajax_nonce-add-meta', false ); ?>
       
   772 </td>
   753 </tr>
   773 </tr>
   754 
   774 </tbody>
   755 <tr><td colspan="2">
   775 </table>
   756 <div class="submit">
   776 <div class="submit add-custom-field">
   757 	<?php
   777 	<?php
   758 	submit_button(
   778 	submit_button(
   759 		__( 'Add Custom Field' ),
   779 		__( 'Add Custom Field' ),
   760 		'',
   780 		'',
   761 		'addmeta',
   781 		'addmeta',
   765 			'data-wp-lists' => 'add:the-list:newmeta',
   785 			'data-wp-lists' => 'add:the-list:newmeta',
   766 		)
   786 		)
   767 	);
   787 	);
   768 	?>
   788 	?>
   769 </div>
   789 </div>
   770 	<?php wp_nonce_field( 'add-meta', '_ajax_nonce-add-meta', false ); ?>
       
   771 </td></tr>
       
   772 </tbody>
       
   773 </table>
       
   774 	<?php
   790 	<?php
   775 
       
   776 }
   791 }
   777 
   792 
   778 /**
   793 /**
   779  * Prints out HTML form date elements for editing post or comment publish date.
   794  * Prints out HTML form date elements for editing post or comment publish date.
   780  *
   795  *
   817 	$cur_mm = current_time( 'm' );
   832 	$cur_mm = current_time( 'm' );
   818 	$cur_aa = current_time( 'Y' );
   833 	$cur_aa = current_time( 'Y' );
   819 	$cur_hh = current_time( 'H' );
   834 	$cur_hh = current_time( 'H' );
   820 	$cur_mn = current_time( 'i' );
   835 	$cur_mn = current_time( 'i' );
   821 
   836 
   822 	$month = '<label><span class="screen-reader-text">' . __( 'Month' ) . '</span><select class="form-required" ' . ( $multi ? '' : 'id="mm" ' ) . 'name="mm"' . $tab_index_attribute . ">\n";
   837 	$month = '<label><span class="screen-reader-text">' .
       
   838 		/* translators: Hidden accessibility text. */
       
   839 		__( 'Month' ) .
       
   840 	'</span><select class="form-required" ' . ( $multi ? '' : 'id="mm" ' ) . 'name="mm"' . $tab_index_attribute . ">\n";
   823 	for ( $i = 1; $i < 13; $i = $i + 1 ) {
   841 	for ( $i = 1; $i < 13; $i = $i + 1 ) {
   824 		$monthnum  = zeroise( $i, 2 );
   842 		$monthnum  = zeroise( $i, 2 );
   825 		$monthtext = $wp_locale->get_month_abbrev( $wp_locale->get_month( $i ) );
   843 		$monthtext = $wp_locale->get_month_abbrev( $wp_locale->get_month( $i ) );
   826 		$month    .= "\t\t\t" . '<option value="' . $monthnum . '" data-text="' . $monthtext . '" ' . selected( $monthnum, $mm, false ) . '>';
   844 		$month    .= "\t\t\t" . '<option value="' . $monthnum . '" data-text="' . $monthtext . '" ' . selected( $monthnum, $mm, false ) . '>';
   827 		/* translators: 1: Month number (01, 02, etc.), 2: Month abbreviation. */
   845 		/* translators: 1: Month number (01, 02, etc.), 2: Month abbreviation. */
   828 		$month .= sprintf( __( '%1$s-%2$s' ), $monthnum, $monthtext ) . "</option>\n";
   846 		$month .= sprintf( __( '%1$s-%2$s' ), $monthnum, $monthtext ) . "</option>\n";
   829 	}
   847 	}
   830 	$month .= '</select></label>';
   848 	$month .= '</select></label>';
   831 
   849 
   832 	$day    = '<label><span class="screen-reader-text">' . __( 'Day' ) . '</span><input type="text" ' . ( $multi ? '' : 'id="jj" ' ) . 'name="jj" value="' . $jj . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" class="form-required" /></label>';
   850 	$day = '<label><span class="screen-reader-text">' .
   833 	$year   = '<label><span class="screen-reader-text">' . __( 'Year' ) . '</span><input type="text" ' . ( $multi ? '' : 'id="aa" ' ) . 'name="aa" value="' . $aa . '" size="4" maxlength="4"' . $tab_index_attribute . ' autocomplete="off" class="form-required" /></label>';
   851 		/* translators: Hidden accessibility text. */
   834 	$hour   = '<label><span class="screen-reader-text">' . __( 'Hour' ) . '</span><input type="text" ' . ( $multi ? '' : 'id="hh" ' ) . 'name="hh" value="' . $hh . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" class="form-required" /></label>';
   852 		__( 'Day' ) .
   835 	$minute = '<label><span class="screen-reader-text">' . __( 'Minute' ) . '</span><input type="text" ' . ( $multi ? '' : 'id="mn" ' ) . 'name="mn" value="' . $mn . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" class="form-required" /></label>';
   853 	'</span><input type="text" ' . ( $multi ? '' : 'id="jj" ' ) . 'name="jj" value="' . $jj . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" class="form-required" /></label>';
       
   854 	$year = '<label><span class="screen-reader-text">' .
       
   855 		/* translators: Hidden accessibility text. */
       
   856 		__( 'Year' ) .
       
   857 	'</span><input type="text" ' . ( $multi ? '' : 'id="aa" ' ) . 'name="aa" value="' . $aa . '" size="4" maxlength="4"' . $tab_index_attribute . ' autocomplete="off" class="form-required" /></label>';
       
   858 	$hour = '<label><span class="screen-reader-text">' .
       
   859 		/* translators: Hidden accessibility text. */
       
   860 		__( 'Hour' ) .
       
   861 	'</span><input type="text" ' . ( $multi ? '' : 'id="hh" ' ) . 'name="hh" value="' . $hh . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" class="form-required" /></label>';
       
   862 	$minute = '<label><span class="screen-reader-text">' .
       
   863 		/* translators: Hidden accessibility text. */
       
   864 		__( 'Minute' ) .
       
   865 	'</span><input type="text" ' . ( $multi ? '' : 'id="mn" ' ) . 'name="mn" value="' . $mn . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" class="form-required" /></label>';
   836 
   866 
   837 	echo '<div class="timestamp-wrap">';
   867 	echo '<div class="timestamp-wrap">';
   838 	/* translators: 1: Month, 2: Day, 3: Year, 4: Hour, 5: Minute. */
   868 	/* translators: 1: Month, 2: Day, 3: Year, 4: Hour, 5: Minute. */
   839 	printf( __( '%1$s %2$s, %3$s at %4$s:%5$s' ), $month, $day, $year, $hour, $minute );
   869 	printf( __( '%1$s %2$s, %3$s at %4$s:%5$s' ), $month, $day, $year, $hour, $minute );
   840 
   870 
   875  *
   905  *
   876  * @since 1.5.0
   906  * @since 1.5.0
   877  * @since 4.7.0 Added the `$post_type` parameter.
   907  * @since 4.7.0 Added the `$post_type` parameter.
   878  *
   908  *
   879  * @param string $default_template Optional. The template file name. Default empty.
   909  * @param string $default_template Optional. The template file name. Default empty.
   880  * @param string $post_type        Optional. Post type to get templates for. Default 'post'.
   910  * @param string $post_type        Optional. Post type to get templates for. Default 'page'.
   881  */
   911  */
   882 function page_template_dropdown( $default_template = '', $post_type = 'page' ) {
   912 function page_template_dropdown( $default_template = '', $post_type = 'page' ) {
   883 	$templates = get_page_templates( null, $post_type );
   913 	$templates = get_page_templates( null, $post_type );
   884 
   914 
   885 	ksort( $templates );
   915 	ksort( $templates );
   897  * @since 4.4.0 `$post` argument was added.
   927  * @since 4.4.0 `$post` argument was added.
   898  *
   928  *
   899  * @global wpdb $wpdb WordPress database abstraction object.
   929  * @global wpdb $wpdb WordPress database abstraction object.
   900  *
   930  *
   901  * @param int         $default_page Optional. The default page ID to be pre-selected. Default 0.
   931  * @param int         $default_page Optional. The default page ID to be pre-selected. Default 0.
   902  * @param int         $parent       Optional. The parent page ID. Default 0.
   932  * @param int         $parent_page  Optional. The parent page ID. Default 0.
   903  * @param int         $level        Optional. Page depth level. Default 0.
   933  * @param int         $level        Optional. Page depth level. Default 0.
   904  * @param int|WP_Post $post         Post ID or WP_Post object.
   934  * @param int|WP_Post $post         Post ID or WP_Post object.
   905  * @return void|false Void on success, false if the page has no children.
   935  * @return void|false Void on success, false if the page has no children.
   906  */
   936  */
   907 function parent_dropdown( $default_page = 0, $parent = 0, $level = 0, $post = null ) {
   937 function parent_dropdown( $default_page = 0, $parent_page = 0, $level = 0, $post = null ) {
   908 	global $wpdb;
   938 	global $wpdb;
   909 
   939 
   910 	$post  = get_post( $post );
   940 	$post  = get_post( $post );
   911 	$items = $wpdb->get_results( $wpdb->prepare( "SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' ORDER BY menu_order", $parent ) );
   941 	$items = $wpdb->get_results(
       
   942 		$wpdb->prepare(
       
   943 			"SELECT ID, post_parent, post_title
       
   944 			FROM $wpdb->posts
       
   945 			WHERE post_parent = %d AND post_type = 'page'
       
   946 			ORDER BY menu_order",
       
   947 			$parent_page
       
   948 		)
       
   949 	);
   912 
   950 
   913 	if ( $items ) {
   951 	if ( $items ) {
   914 		foreach ( $items as $item ) {
   952 		foreach ( $items as $item ) {
   915 			// A page cannot be its own parent.
   953 			// A page cannot be its own parent.
   916 			if ( $post && $post->ID && (int) $item->ID === $post->ID ) {
   954 			if ( $post && $post->ID && (int) $item->ID === $post->ID ) {
   952 
   990 
   953 	echo $r;
   991 	echo $r;
   954 }
   992 }
   955 
   993 
   956 /**
   994 /**
   957  * Outputs the form used by the importers to accept the data to be imported
   995  * Outputs the form used by the importers to accept the data to be imported.
   958  *
   996  *
   959  * @since 2.0.0
   997  * @since 2.0.0
   960  *
   998  *
   961  * @param string $action The action attribute for the form.
   999  * @param string $action The action attribute for the form.
   962  */
  1000  */
   973 	 */
  1011 	 */
   974 	$bytes      = apply_filters( 'import_upload_size_limit', wp_max_upload_size() );
  1012 	$bytes      = apply_filters( 'import_upload_size_limit', wp_max_upload_size() );
   975 	$size       = size_format( $bytes );
  1013 	$size       = size_format( $bytes );
   976 	$upload_dir = wp_upload_dir();
  1014 	$upload_dir = wp_upload_dir();
   977 	if ( ! empty( $upload_dir['error'] ) ) :
  1015 	if ( ! empty( $upload_dir['error'] ) ) :
   978 		?>
  1016 		$upload_directory_error  = '<p>' . __( 'Before you can upload your import file, you will need to fix the following error:' ) . '</p>';
   979 		<div class="error"><p><?php _e( 'Before you can upload your import file, you will need to fix the following error:' ); ?></p>
  1017 		$upload_directory_error .= '<p><strong>' . $upload_dir['error'] . '</strong></p>';
   980 		<p><strong><?php echo $upload_dir['error']; ?></strong></p></div>
  1018 		wp_admin_notice(
   981 		<?php
  1019 			$upload_directory_error,
       
  1020 			array(
       
  1021 				'additional_classes' => array( 'error' ),
       
  1022 				'paragraph_wrap'     => false,
       
  1023 			)
       
  1024 		);
   982 	else :
  1025 	else :
   983 		?>
  1026 		?>
   984 <form enctype="multipart/form-data" id="import-upload-form" method="post" class="wp-upload-form" action="<?php echo esc_url( wp_nonce_url( $action, 'import-upload' ) ); ?>">
  1027 <form enctype="multipart/form-data" id="import-upload-form" method="post" class="wp-upload-form" action="<?php echo esc_url( wp_nonce_url( $action, 'import-upload' ) ); ?>">
   985 <p>
  1028 <p>
   986 		<?php
  1029 		<?php
  1005  * Adds a meta box to one or more screens.
  1048  * Adds a meta box to one or more screens.
  1006  *
  1049  *
  1007  * @since 2.5.0
  1050  * @since 2.5.0
  1008  * @since 4.4.0 The `$screen` parameter now accepts an array of screen IDs.
  1051  * @since 4.4.0 The `$screen` parameter now accepts an array of screen IDs.
  1009  *
  1052  *
  1010  * @global array $wp_meta_boxes
  1053  * @global array $wp_meta_boxes Global meta box state.
  1011  *
  1054  *
  1012  * @param string                 $id            Meta box ID (used in the 'id' attribute for the meta box).
  1055  * @param string                 $id            Meta box ID (used in the 'id' attribute for the meta box).
  1013  * @param string                 $title         Title of the meta box.
  1056  * @param string                 $title         Title of the meta box.
  1014  * @param callable               $callback      Function that fills the box with the desired content.
  1057  * @param callable               $callback      Function that fills the box with the desired content.
  1015  *                                              The function should echo its output.
  1058  *                                              The function should echo its output.
  1203  */
  1246  */
  1204 function _get_plugin_from_callback( $callback ) {
  1247 function _get_plugin_from_callback( $callback ) {
  1205 	try {
  1248 	try {
  1206 		if ( is_array( $callback ) ) {
  1249 		if ( is_array( $callback ) ) {
  1207 			$reflection = new ReflectionMethod( $callback[0], $callback[1] );
  1250 			$reflection = new ReflectionMethod( $callback[0], $callback[1] );
  1208 		} elseif ( is_string( $callback ) && false !== strpos( $callback, '::' ) ) {
  1251 		} elseif ( is_string( $callback ) && str_contains( $callback, '::' ) ) {
  1209 			$reflection = new ReflectionMethod( $callback );
  1252 			$reflection = new ReflectionMethod( $callback );
  1210 		} else {
  1253 		} else {
  1211 			$reflection = new ReflectionFunction( $callback );
  1254 			$reflection = new ReflectionFunction( $callback );
  1212 		}
  1255 		}
  1213 	} catch ( ReflectionException $exception ) {
  1256 	} catch ( ReflectionException $exception ) {
  1220 
  1263 
  1221 		// Only show errors if the meta box was registered by a plugin.
  1264 		// Only show errors if the meta box was registered by a plugin.
  1222 		$filename   = wp_normalize_path( $reflection->getFileName() );
  1265 		$filename   = wp_normalize_path( $reflection->getFileName() );
  1223 		$plugin_dir = wp_normalize_path( WP_PLUGIN_DIR );
  1266 		$plugin_dir = wp_normalize_path( WP_PLUGIN_DIR );
  1224 
  1267 
  1225 		if ( strpos( $filename, $plugin_dir ) === 0 ) {
  1268 		if ( str_starts_with( $filename, $plugin_dir ) ) {
  1226 			$filename = str_replace( $plugin_dir, '', $filename );
  1269 			$filename = str_replace( $plugin_dir, '', $filename );
  1227 			$filename = preg_replace( '|^/([^/]*/).*$|', '\\1', $filename );
  1270 			$filename = preg_replace( '|^/([^/]*/).*$|', '\\1', $filename );
  1228 
  1271 
  1229 			$plugins = get_plugins();
  1272 			$plugins = get_plugins();
  1230 
  1273 
  1231 			foreach ( $plugins as $name => $plugin ) {
  1274 			foreach ( $plugins as $name => $plugin ) {
  1232 				if ( strpos( $name, $filename ) === 0 ) {
  1275 				if ( str_starts_with( $name, $filename ) ) {
  1233 					return $plugin;
  1276 					return $plugin;
  1234 				}
  1277 				}
  1235 			}
  1278 			}
  1236 		}
  1279 		}
  1237 	}
  1280 	}
  1242 /**
  1285 /**
  1243  * Meta-Box template function.
  1286  * Meta-Box template function.
  1244  *
  1287  *
  1245  * @since 2.5.0
  1288  * @since 2.5.0
  1246  *
  1289  *
  1247  * @global array $wp_meta_boxes
  1290  * @global array $wp_meta_boxes Global meta box state.
  1248  *
  1291  *
  1249  * @param string|WP_Screen $screen      The screen identifier. If you have used add_menu_page() or
  1292  * @param string|WP_Screen $screen      The screen identifier. If you have used add_menu_page() or
  1250  *                                      add_submenu_page() to create a new screen (and hence screen_id)
  1293  *                                      add_submenu_page() to create a new screen (and hence screen_id)
  1251  *                                      make sure your menu slug conforms to the limits of sanitize_key()
  1294  *                                      make sure your menu slug conforms to the limits of sanitize_key()
  1252  *                                      otherwise the 'screen' menu may not correctly render on your page.
  1295  *                                      otherwise the 'screen' menu may not correctly render on your page.
  1270 
  1313 
  1271 	$hidden = get_hidden_meta_boxes( $screen );
  1314 	$hidden = get_hidden_meta_boxes( $screen );
  1272 
  1315 
  1273 	printf( '<div id="%s-sortables" class="meta-box-sortables">', esc_attr( $context ) );
  1316 	printf( '<div id="%s-sortables" class="meta-box-sortables">', esc_attr( $context ) );
  1274 
  1317 
  1275 	// Grab the ones the user has manually sorted.
  1318 	/*
  1276 	// Pull them out of their previous context/priority and into the one the user chose.
  1319 	 * Grab the ones the user has manually sorted.
       
  1320 	 * Pull them out of their previous context/priority and into the one the user chose.
       
  1321 	 */
  1277 	$sorted = get_user_option( "meta-box-order_$page" );
  1322 	$sorted = get_user_option( "meta-box-order_$page" );
  1278 
  1323 
  1279 	if ( ! $already_sorted && $sorted ) {
  1324 	if ( ! $already_sorted && $sorted ) {
  1280 		foreach ( $sorted as $box_context => $ids ) {
  1325 		foreach ( $sorted as $box_context => $ids ) {
  1281 			foreach ( explode( ',', $ids ) as $id ) {
  1326 			foreach ( explode( ',', $ids ) as $id ) {
  1320 							$block_compatible = $block_compatible || (bool) $box['args']['__back_compat_meta_box'];
  1365 							$block_compatible = $block_compatible || (bool) $box['args']['__back_compat_meta_box'];
  1321 							unset( $box['args']['__back_compat_meta_box'] );
  1366 							unset( $box['args']['__back_compat_meta_box'] );
  1322 						}
  1367 						}
  1323 					}
  1368 					}
  1324 
  1369 
  1325 					$i++;
  1370 					++$i;
  1326 					// get_hidden_meta_boxes() doesn't apply in the block editor.
  1371 					// get_hidden_meta_boxes() doesn't apply in the block editor.
  1327 					$hidden_class = ( ! $screen->is_block_editor() && in_array( $box['id'], $hidden, true ) ) ? ' hide-if-js' : '';
  1372 					$hidden_class = ( ! $screen->is_block_editor() && in_array( $box['id'], $hidden, true ) ) ? ' hide-if-js' : '';
  1328 					echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes( $box['id'], $page ) . $hidden_class . '" ' . '>' . "\n";
  1373 					echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes( $box['id'], $page ) . $hidden_class . '" ' . '>' . "\n";
  1329 
  1374 
  1330 					echo '<div class="postbox-header">';
  1375 					echo '<div class="postbox-header">';
  1331 					echo '<h2 class="hndle">';
  1376 					echo '<h2 class="hndle">';
  1332 					if ( 'dashboard_php_nag' === $box['id'] ) {
  1377 					if ( 'dashboard_php_nag' === $box['id'] ) {
  1333 						echo '<span aria-hidden="true" class="dashicons dashicons-warning"></span>';
  1378 						echo '<span aria-hidden="true" class="dashicons dashicons-warning"></span>';
  1334 						echo '<span class="screen-reader-text">' . __( 'Warning:' ) . ' </span>';
  1379 						echo '<span class="screen-reader-text">' .
       
  1380 							/* translators: Hidden accessibility text. */
       
  1381 							__( 'Warning:' ) .
       
  1382 						' </span>';
  1335 					}
  1383 					}
  1336 					echo $box['title'];
  1384 					echo $box['title'];
  1337 					echo "</h2>\n";
  1385 					echo "</h2>\n";
  1338 
  1386 
  1339 					if ( 'dashboard_browser_nag' !== $box['id'] ) {
  1387 					if ( 'dashboard_browser_nag' !== $box['id'] ) {
  1346 						}
  1394 						}
  1347 
  1395 
  1348 						echo '<div class="handle-actions hide-if-no-js">';
  1396 						echo '<div class="handle-actions hide-if-no-js">';
  1349 
  1397 
  1350 						echo '<button type="button" class="handle-order-higher" aria-disabled="false" aria-describedby="' . $box['id'] . '-handle-order-higher-description">';
  1398 						echo '<button type="button" class="handle-order-higher" aria-disabled="false" aria-describedby="' . $box['id'] . '-handle-order-higher-description">';
  1351 						echo '<span class="screen-reader-text">' . __( 'Move up' ) . '</span>';
  1399 						echo '<span class="screen-reader-text">' .
       
  1400 							/* translators: Hidden accessibility text. */
       
  1401 							__( 'Move up' ) .
       
  1402 						'</span>';
  1352 						echo '<span class="order-higher-indicator" aria-hidden="true"></span>';
  1403 						echo '<span class="order-higher-indicator" aria-hidden="true"></span>';
  1353 						echo '</button>';
  1404 						echo '</button>';
  1354 						echo '<span class="hidden" id="' . $box['id'] . '-handle-order-higher-description">' . sprintf(
  1405 						echo '<span class="hidden" id="' . $box['id'] . '-handle-order-higher-description">' . sprintf(
  1355 							/* translators: %s: Meta box title. */
  1406 							/* translators: %s: Meta box title. */
  1356 							__( 'Move %s box up' ),
  1407 							__( 'Move %s box up' ),
  1357 							$widget_title
  1408 							$widget_title
  1358 						) . '</span>';
  1409 						) . '</span>';
  1359 
  1410 
  1360 						echo '<button type="button" class="handle-order-lower" aria-disabled="false" aria-describedby="' . $box['id'] . '-handle-order-lower-description">';
  1411 						echo '<button type="button" class="handle-order-lower" aria-disabled="false" aria-describedby="' . $box['id'] . '-handle-order-lower-description">';
  1361 						echo '<span class="screen-reader-text">' . __( 'Move down' ) . '</span>';
  1412 						echo '<span class="screen-reader-text">' .
       
  1413 							/* translators: Hidden accessibility text. */
       
  1414 							__( 'Move down' ) .
       
  1415 						'</span>';
  1362 						echo '<span class="order-lower-indicator" aria-hidden="true"></span>';
  1416 						echo '<span class="order-lower-indicator" aria-hidden="true"></span>';
  1363 						echo '</button>';
  1417 						echo '</button>';
  1364 						echo '<span class="hidden" id="' . $box['id'] . '-handle-order-lower-description">' . sprintf(
  1418 						echo '<span class="hidden" id="' . $box['id'] . '-handle-order-lower-description">' . sprintf(
  1365 							/* translators: %s: Meta box title. */
  1419 							/* translators: %s: Meta box title. */
  1366 							__( 'Move %s box down' ),
  1420 							__( 'Move %s box down' ),
  1367 							$widget_title
  1421 							$widget_title
  1368 						) . '</span>';
  1422 						) . '</span>';
  1369 
  1423 
  1370 						echo '<button type="button" class="handlediv" aria-expanded="true">';
  1424 						echo '<button type="button" class="handlediv" aria-expanded="true">';
  1371 						echo '<span class="screen-reader-text">' . sprintf(
  1425 						echo '<span class="screen-reader-text">' . sprintf(
  1372 							/* translators: %s: Meta box title. */
  1426 							/* translators: %s: Hidden accessibility text. Meta box title. */
  1373 							__( 'Toggle panel: %s' ),
  1427 							__( 'Toggle panel: %s' ),
  1374 							$widget_title
  1428 							$widget_title
  1375 						) . '</span>';
  1429 						) . '</span>';
  1376 						echo '<span class="toggle-indicator" aria-hidden="true"></span>';
  1430 						echo '<span class="toggle-indicator" aria-hidden="true"></span>';
  1377 						echo '</button>';
  1431 						echo '</button>';
  1383 					echo '<div class="inside">' . "\n";
  1437 					echo '<div class="inside">' . "\n";
  1384 
  1438 
  1385 					if ( WP_DEBUG && ! $block_compatible && 'edit' === $screen->parent_base && ! $screen->is_block_editor() && ! isset( $_GET['meta-box-loader'] ) ) {
  1439 					if ( WP_DEBUG && ! $block_compatible && 'edit' === $screen->parent_base && ! $screen->is_block_editor() && ! isset( $_GET['meta-box-loader'] ) ) {
  1386 						$plugin = _get_plugin_from_callback( $box['callback'] );
  1440 						$plugin = _get_plugin_from_callback( $box['callback'] );
  1387 						if ( $plugin ) {
  1441 						if ( $plugin ) {
  1388 							?>
  1442 							$meta_box_not_compatible_message = sprintf(
  1389 							<div class="error inline">
  1443 								/* translators: %s: The name of the plugin that generated this meta box. */
  1390 								<p>
  1444 								__( 'This meta box, from the %s plugin, is not compatible with the block editor.' ),
  1391 									<?php
  1445 								"<strong>{$plugin['Name']}</strong>"
  1392 										/* translators: %s: The name of the plugin that generated this meta box. */
  1446 							);
  1393 										printf( __( 'This meta box, from the %s plugin, is not compatible with the block editor.' ), "<strong>{$plugin['Name']}</strong>" );
  1447 							wp_admin_notice(
  1394 									?>
  1448 								$meta_box_not_compatible_message,
  1395 								</p>
  1449 								array(
  1396 							</div>
  1450 									'additional_classes' => array( 'error', 'inline' ),
  1397 							<?php
  1451 								)
       
  1452 							);
  1398 						}
  1453 						}
  1399 					}
  1454 					}
  1400 
  1455 
  1401 					call_user_func( $box['callback'], $data_object, $box );
  1456 					call_user_func( $box['callback'], $data_object, $box );
  1402 					echo "</div>\n";
  1457 					echo "</div>\n";
  1407 	}
  1462 	}
  1408 
  1463 
  1409 	echo '</div>';
  1464 	echo '</div>';
  1410 
  1465 
  1411 	return $i;
  1466 	return $i;
  1412 
       
  1413 }
  1467 }
  1414 
  1468 
  1415 /**
  1469 /**
  1416  * Removes a meta box from one or more screens.
  1470  * Removes a meta box from one or more screens.
  1417  *
  1471  *
  1418  * @since 2.6.0
  1472  * @since 2.6.0
  1419  * @since 4.4.0 The `$screen` parameter now accepts an array of screen IDs.
  1473  * @since 4.4.0 The `$screen` parameter now accepts an array of screen IDs.
  1420  *
  1474  *
  1421  * @global array $wp_meta_boxes
  1475  * @global array $wp_meta_boxes Global meta box state.
  1422  *
  1476  *
  1423  * @param string                 $id      Meta box ID (used in the 'id' attribute for the meta box).
  1477  * @param string                 $id      Meta box ID (used in the 'id' attribute for the meta box).
  1424  * @param string|array|WP_Screen $screen  The screen or screens on which the meta box is shown (such as a
  1478  * @param string|array|WP_Screen $screen  The screen or screens on which the meta box is shown (such as a
  1425  *                                        post type, 'link', or 'comment'). Accepts a single screen ID,
  1479  *                                        post type, 'link', or 'comment'). Accepts a single screen ID,
  1426  *                                        WP_Screen object, or array of screen IDs.
  1480  *                                        WP_Screen object, or array of screen IDs.
  1507 				foreach ( $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) {
  1561 				foreach ( $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) {
  1508 					if ( false === $box || ! $box['title'] ) {
  1562 					if ( false === $box || ! $box['title'] ) {
  1509 						continue;
  1563 						continue;
  1510 					}
  1564 					}
  1511 
  1565 
  1512 					$i++;
  1566 					++$i;
  1513 					$hidden_class = in_array( $box['id'], $hidden, true ) ? 'hide-if-js' : '';
  1567 					$hidden_class = in_array( $box['id'], $hidden, true ) ? 'hide-if-js' : '';
  1514 
  1568 
  1515 					$open_class = '';
  1569 					$open_class = '';
  1516 					if ( ! $first_open && empty( $hidden_class ) ) {
  1570 					if ( ! $first_open && empty( $hidden_class ) ) {
  1517 						$first_open = true;
  1571 						$first_open = true;
  1519 					}
  1573 					}
  1520 					?>
  1574 					?>
  1521 					<li class="control-section accordion-section <?php echo $hidden_class; ?> <?php echo $open_class; ?> <?php echo esc_attr( $box['id'] ); ?>" id="<?php echo esc_attr( $box['id'] ); ?>">
  1575 					<li class="control-section accordion-section <?php echo $hidden_class; ?> <?php echo $open_class; ?> <?php echo esc_attr( $box['id'] ); ?>" id="<?php echo esc_attr( $box['id'] ); ?>">
  1522 						<h3 class="accordion-section-title hndle" tabindex="0">
  1576 						<h3 class="accordion-section-title hndle" tabindex="0">
  1523 							<?php echo esc_html( $box['title'] ); ?>
  1577 							<?php echo esc_html( $box['title'] ); ?>
  1524 							<span class="screen-reader-text"><?php _e( 'Press return or enter to open this section' ); ?></span>
  1578 							<span class="screen-reader-text">
       
  1579 								<?php
       
  1580 								/* translators: Hidden accessibility text. */
       
  1581 								_e( 'Press return or enter to open this section' );
       
  1582 								?>
       
  1583 							</span>
  1525 						</h3>
  1584 						</h3>
  1526 						<div class="accordion-section-content <?php postbox_classes( $box['id'], $page ); ?>">
  1585 						<div class="accordion-section-content <?php postbox_classes( $box['id'], $page ); ?>">
  1527 							<div class="inside">
  1586 							<div class="inside">
  1528 								<?php call_user_func( $box['callback'], $data_object, $box ); ?>
  1587 								<?php call_user_func( $box['callback'], $data_object, $box ); ?>
  1529 							</div><!-- .inside -->
  1588 							</div><!-- .inside -->
  1551  * The $callback argument should be the name of a function that echoes out any
  1610  * The $callback argument should be the name of a function that echoes out any
  1552  * content you want to show at the top of the settings section before the actual
  1611  * content you want to show at the top of the settings section before the actual
  1553  * fields. It can output nothing if you want.
  1612  * fields. It can output nothing if you want.
  1554  *
  1613  *
  1555  * @since 2.7.0
  1614  * @since 2.7.0
       
  1615  * @since 6.1.0 Added an `$args` parameter for the section's HTML wrapper and class name.
  1556  *
  1616  *
  1557  * @global array $wp_settings_sections Storage array of all settings sections added to admin pages.
  1617  * @global array $wp_settings_sections Storage array of all settings sections added to admin pages.
  1558  *
  1618  *
  1559  * @param string   $id       Slug-name to identify the section. Used in the 'id' attribute of tags.
  1619  * @param string   $id       Slug-name to identify the section. Used in the 'id' attribute of tags.
  1560  * @param string   $title    Formatted title of the section. Shown as the heading for the section.
  1620  * @param string   $title    Formatted title of the section. Shown as the heading for the section.
  1561  * @param callable $callback Function that echos out any content at the top of the section (between heading and fields).
  1621  * @param callable $callback Function that echos out any content at the top of the section (between heading and fields).
  1562  * @param string   $page     The slug-name of the settings page on which to show the section. Built-in pages include
  1622  * @param string   $page     The slug-name of the settings page on which to show the section. Built-in pages include
  1563  *                           'general', 'reading', 'writing', 'discussion', 'media', etc. Create your own using
  1623  *                           'general', 'reading', 'writing', 'discussion', 'media', etc. Create your own using
  1564  *                           add_options_page();
  1624  *                           add_options_page();
  1565  */
  1625  * @param array    $args     {
  1566 function add_settings_section( $id, $title, $callback, $page ) {
  1626  *     Arguments used to create the settings section.
       
  1627  *
       
  1628  *     @type string $before_section HTML content to prepend to the section's HTML output.
       
  1629  *                                  Receives the section's class name as `%s`. Default empty.
       
  1630  *     @type string $after_section  HTML content to append to the section's HTML output. Default empty.
       
  1631  *     @type string $section_class  The class name to use for the section. Default empty.
       
  1632  * }
       
  1633  */
       
  1634 function add_settings_section( $id, $title, $callback, $page, $args = array() ) {
  1567 	global $wp_settings_sections;
  1635 	global $wp_settings_sections;
       
  1636 
       
  1637 	$defaults = array(
       
  1638 		'id'             => $id,
       
  1639 		'title'          => $title,
       
  1640 		'callback'       => $callback,
       
  1641 		'before_section' => '',
       
  1642 		'after_section'  => '',
       
  1643 		'section_class'  => '',
       
  1644 	);
       
  1645 
       
  1646 	$section = wp_parse_args( $args, $defaults );
  1568 
  1647 
  1569 	if ( 'misc' === $page ) {
  1648 	if ( 'misc' === $page ) {
  1570 		_deprecated_argument(
  1649 		_deprecated_argument(
  1571 			__FUNCTION__,
  1650 			__FUNCTION__,
  1572 			'3.0.0',
  1651 			'3.0.0',
  1590 			)
  1669 			)
  1591 		);
  1670 		);
  1592 		$page = 'reading';
  1671 		$page = 'reading';
  1593 	}
  1672 	}
  1594 
  1673 
  1595 	$wp_settings_sections[ $page ][ $id ] = array(
  1674 	$wp_settings_sections[ $page ][ $id ] = $section;
  1596 		'id'       => $id,
       
  1597 		'title'    => $title,
       
  1598 		'callback' => $callback,
       
  1599 	);
       
  1600 }
  1675 }
  1601 
  1676 
  1602 /**
  1677 /**
  1603  * Adds a new field to a section of a settings page.
  1678  * Adds a new field to a section of a settings page.
  1604  *
  1679  *
  1623  * @param string   $page     The slug-name of the settings page on which to show the section
  1698  * @param string   $page     The slug-name of the settings page on which to show the section
  1624  *                           (general, reading, writing, ...).
  1699  *                           (general, reading, writing, ...).
  1625  * @param string   $section  Optional. The slug-name of the section of the settings page
  1700  * @param string   $section  Optional. The slug-name of the section of the settings page
  1626  *                           in which to show the box. Default 'default'.
  1701  *                           in which to show the box. Default 'default'.
  1627  * @param array    $args {
  1702  * @param array    $args {
  1628  *     Optional. Extra arguments used when outputting the field.
  1703  *     Optional. Extra arguments that get passed to the callback function.
  1629  *
  1704  *
  1630  *     @type string $label_for When supplied, the setting title will be wrapped
  1705  *     @type string $label_for When supplied, the setting title will be wrapped
  1631  *                             in a `<label>` element, its `for` attribute populated
  1706  *                             in a `<label>` element, its `for` attribute populated
  1632  *                             with this value.
  1707  *                             with this value.
  1633  *     @type string $class     CSS Class to be added to the `<tr>` element when the
  1708  *     @type string $class     CSS Class to be added to the `<tr>` element when the
  1670 		'args'     => $args,
  1745 		'args'     => $args,
  1671 	);
  1746 	);
  1672 }
  1747 }
  1673 
  1748 
  1674 /**
  1749 /**
  1675  * Prints out all settings sections added to a particular settings page
  1750  * Prints out all settings sections added to a particular settings page.
  1676  *
  1751  *
  1677  * Part of the Settings API. Use this in a settings page callback function
  1752  * Part of the Settings API. Use this in a settings page callback function
  1678  * to output all the sections and fields that were added to that $page with
  1753  * to output all the sections and fields that were added to that $page with
  1679  * add_settings_section() and add_settings_field()
  1754  * add_settings_section() and add_settings_field()
  1680  *
  1755  *
  1690 	if ( ! isset( $wp_settings_sections[ $page ] ) ) {
  1765 	if ( ! isset( $wp_settings_sections[ $page ] ) ) {
  1691 		return;
  1766 		return;
  1692 	}
  1767 	}
  1693 
  1768 
  1694 	foreach ( (array) $wp_settings_sections[ $page ] as $section ) {
  1769 	foreach ( (array) $wp_settings_sections[ $page ] as $section ) {
       
  1770 		if ( '' !== $section['before_section'] ) {
       
  1771 			if ( '' !== $section['section_class'] ) {
       
  1772 				echo wp_kses_post( sprintf( $section['before_section'], esc_attr( $section['section_class'] ) ) );
       
  1773 			} else {
       
  1774 				echo wp_kses_post( $section['before_section'] );
       
  1775 			}
       
  1776 		}
       
  1777 
  1695 		if ( $section['title'] ) {
  1778 		if ( $section['title'] ) {
  1696 			echo "<h2>{$section['title']}</h2>\n";
  1779 			echo "<h2>{$section['title']}</h2>\n";
  1697 		}
  1780 		}
  1698 
  1781 
  1699 		if ( $section['callback'] ) {
  1782 		if ( $section['callback'] ) {
  1704 			continue;
  1787 			continue;
  1705 		}
  1788 		}
  1706 		echo '<table class="form-table" role="presentation">';
  1789 		echo '<table class="form-table" role="presentation">';
  1707 		do_settings_fields( $page, $section['id'] );
  1790 		do_settings_fields( $page, $section['id'] );
  1708 		echo '</table>';
  1791 		echo '</table>';
       
  1792 
       
  1793 		if ( '' !== $section['after_section'] ) {
       
  1794 			echo wp_kses_post( $section['after_section'] );
       
  1795 		}
  1709 	}
  1796 	}
  1710 }
  1797 }
  1711 
  1798 
  1712 /**
  1799 /**
  1713  * Prints out the settings fields for a particular settings section.
  1800  * Prints out the settings fields for a particular settings section.
  1766  * page is first accessed.
  1853  * page is first accessed.
  1767  *
  1854  *
  1768  * @since 3.0.0
  1855  * @since 3.0.0
  1769  * @since 5.3.0 Added `warning` and `info` as possible values for `$type`.
  1856  * @since 5.3.0 Added `warning` and `info` as possible values for `$type`.
  1770  *
  1857  *
  1771  * @global array $wp_settings_errors Storage array of errors registered during this pageload
  1858  * @global array[] $wp_settings_errors Storage array of errors registered during this pageload
  1772  *
  1859  *
  1773  * @param string $setting Slug title of the setting to which this error applies.
  1860  * @param string $setting Slug title of the setting to which this error applies.
  1774  * @param string $code    Slug-name to identify the error. Used as part of 'id' attribute in HTML output.
  1861  * @param string $code    Slug-name to identify the error. Used as part of 'id' attribute in HTML output.
  1775  * @param string $message The formatted message text to display to the user (will be shown inside styled
  1862  * @param string $message The formatted message text to display to the user (will be shown inside styled
  1776  *                        `<div>` and `<p>` tags).
  1863  *                        `<div>` and `<p>` tags).
  1803  * hasn't submitted data (i.e. when they first load an options page, or in the {@see 'admin_notices'}
  1890  * hasn't submitted data (i.e. when they first load an options page, or in the {@see 'admin_notices'}
  1804  * action hook).
  1891  * action hook).
  1805  *
  1892  *
  1806  * @since 3.0.0
  1893  * @since 3.0.0
  1807  *
  1894  *
  1808  * @global array $wp_settings_errors Storage array of errors registered during this pageload
  1895  * @global array[] $wp_settings_errors Storage array of errors registered during this pageload
  1809  *
  1896  *
  1810  * @param string $setting  Optional. Slug title of a specific setting whose errors you want.
  1897  * @param string $setting  Optional. Slug title of a specific setting whose errors you want.
  1811  * @param bool   $sanitize Optional. Whether to re-sanitize the setting value before returning errors.
  1898  * @param bool   $sanitize Optional. Whether to re-sanitize the setting value before returning errors.
  1812  * @return array {
  1899  * @return array[] {
  1813  *     Array of settings errors.
  1900  *     Array of settings error arrays.
  1814  *
  1901  *
  1815  *     @type string $setting Slug title of the setting to which this error applies.
  1902  *     @type array ...$0 {
  1816  *     @type string $code    Slug-name to identify the error. Used as part of 'id' attribute in HTML output.
  1903  *         Associative array of setting error data.
  1817  *     @type string $message The formatted message text to display to the user (will be shown inside styled
  1904  *
  1818  *                           `<div>` and `<p>` tags).
  1905  *         @type string $setting Slug title of the setting to which this error applies.
  1819  *     @type string $type    Optional. Message type, controls HTML class. Possible values include 'error',
  1906  *         @type string $code    Slug-name to identify the error. Used as part of 'id' attribute in HTML output.
  1820  *                           'success', 'warning', 'info'. Default 'error'.
  1907  *         @type string $message The formatted message text to display to the user (will be shown inside styled
       
  1908  *                               `<div>` and `<p>` tags).
       
  1909  *         @type string $type    Optional. Message type, controls HTML class. Possible values include 'error',
       
  1910  *                               'success', 'warning', 'info'. Default 'error'.
       
  1911  *     }
  1821  * }
  1912  * }
  1822  */
  1913  */
  1823 function get_settings_errors( $setting = '', $sanitize = false ) {
  1914 function get_settings_errors( $setting = '', $sanitize = false ) {
  1824 	global $wp_settings_errors;
  1915 	global $wp_settings_errors;
  1825 
  1916 
  1931 /**
  2022 /**
  1932  * Outputs the modal window used for attaching media to posts or pages in the media-listing screen.
  2023  * Outputs the modal window used for attaching media to posts or pages in the media-listing screen.
  1933  *
  2024  *
  1934  * @since 2.7.0
  2025  * @since 2.7.0
  1935  *
  2026  *
  1936  * @param string $found_action
  2027  * @param string $found_action Optional. The value of the 'found_action' input field. Default empty string.
  1937  */
  2028  */
  1938 function find_posts_div( $found_action = '' ) {
  2029 function find_posts_div( $found_action = '' ) {
  1939 	?>
  2030 	?>
  1940 	<div id="find-posts" class="find-box" style="display: none;">
  2031 	<div id="find-posts" class="find-box" style="display: none;">
  1941 		<div id="find-posts-head" class="find-box-head">
  2032 		<div id="find-posts-head" class="find-box-head">
  1942 			<?php _e( 'Attach to existing content' ); ?>
  2033 			<?php _e( 'Attach to existing content' ); ?>
  1943 			<button type="button" id="find-posts-close"><span class="screen-reader-text"><?php _e( 'Close media attachment panel' ); ?></span></button>
  2034 			<button type="button" id="find-posts-close"><span class="screen-reader-text">
       
  2035 				<?php
       
  2036 				/* translators: Hidden accessibility text. */
       
  2037 				_e( 'Close media attachment panel' );
       
  2038 				?>
       
  2039 			</span></button>
  1944 		</div>
  2040 		</div>
  1945 		<div class="find-box-inside">
  2041 		<div class="find-box-inside">
  1946 			<div class="find-box-search">
  2042 			<div class="find-box-search">
  1947 				<?php if ( $found_action ) { ?>
  2043 				<?php if ( $found_action ) { ?>
  1948 					<input type="hidden" name="found_action" value="<?php echo esc_attr( $found_action ); ?>" />
  2044 					<input type="hidden" name="found_action" value="<?php echo esc_attr( $found_action ); ?>" />
  1949 				<?php } ?>
  2045 				<?php } ?>
  1950 				<input type="hidden" name="affected" id="affected" value="" />
  2046 				<input type="hidden" name="affected" id="affected" value="" />
  1951 				<?php wp_nonce_field( 'find-posts', '_ajax_nonce', false ); ?>
  2047 				<?php wp_nonce_field( 'find-posts', '_ajax_nonce', false ); ?>
  1952 				<label class="screen-reader-text" for="find-posts-input"><?php _e( 'Search' ); ?></label>
  2048 				<label class="screen-reader-text" for="find-posts-input">
       
  2049 					<?php
       
  2050 					/* translators: Hidden accessibility text. */
       
  2051 					_e( 'Search' );
       
  2052 					?>
       
  2053 				</label>
  1953 				<input type="text" id="find-posts-input" name="ps" value="" />
  2054 				<input type="text" id="find-posts-input" name="ps" value="" />
  1954 				<span class="spinner"></span>
  2055 				<span class="spinner"></span>
  1955 				<input type="button" id="find-posts-search" value="<?php esc_attr_e( 'Search' ); ?>" class="button" />
  2056 				<input type="button" id="find-posts-search" value="<?php esc_attr_e( 'Search' ); ?>" class="button" />
  1956 				<div class="clear"></div>
  2057 				<div class="clear"></div>
  1957 			</div>
  2058 			</div>
  2015  *
  2116  *
  2016  * @since 2.7.0
  2117  * @since 2.7.0
  2017  *
  2118  *
  2018  * @global string    $hook_suffix
  2119  * @global string    $hook_suffix
  2019  * @global string    $admin_body_class
  2120  * @global string    $admin_body_class
       
  2121  * @global string    $body_id
  2020  * @global WP_Locale $wp_locale        WordPress date and time locale object.
  2122  * @global WP_Locale $wp_locale        WordPress date and time locale object.
  2021  *
  2123  *
  2022  * @param string $title      Optional. Title of the Iframe page. Default empty.
  2124  * @param string $title      Optional. Title of the Iframe page. Default empty.
  2023  * @param bool   $deprecated Not used.
  2125  * @param bool   $deprecated Not used.
  2024  */
  2126  */
  2025 function iframe_header( $title = '', $deprecated = false ) {
  2127 function iframe_header( $title = '', $deprecated = false ) {
       
  2128 	global $hook_suffix, $admin_body_class, $body_id, $wp_locale;
       
  2129 
  2026 	show_admin_bar( false );
  2130 	show_admin_bar( false );
  2027 	global $hook_suffix, $admin_body_class, $wp_locale;
  2131 
  2028 	$admin_body_class = preg_replace( '/[^a-z0-9_-]+/i', '-', $hook_suffix );
  2132 	$admin_body_class = preg_replace( '/[^a-z0-9_-]+/i', '-', $hook_suffix );
  2029 
  2133 
  2030 	$current_screen = get_current_screen();
  2134 	$current_screen = get_current_screen();
  2031 
  2135 
  2032 	header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );
  2136 	header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );
  2076 	}
  2180 	}
  2077 
  2181 
  2078 	?>
  2182 	?>
  2079 </head>
  2183 </head>
  2080 	<?php
  2184 	<?php
  2081 	/**
  2185 	$admin_body_id = isset( $body_id ) ? 'id="' . $body_id . '" ' : '';
  2082 	 * @global string $body_id
       
  2083 	 */
       
  2084 	$admin_body_id = isset( $GLOBALS['body_id'] ) ? 'id="' . $GLOBALS['body_id'] . '" ' : '';
       
  2085 
  2186 
  2086 	/** This filter is documented in wp-admin/admin-header.php */
  2187 	/** This filter is documented in wp-admin/admin-header.php */
  2087 	$admin_body_classes = apply_filters( 'admin_body_class', '' );
  2188 	$admin_body_classes = apply_filters( 'admin_body_class', '' );
  2088 	$admin_body_classes = ltrim( $admin_body_classes . ' ' . $admin_body_class );
  2189 	$admin_body_classes = ltrim( $admin_body_classes . ' ' . $admin_body_class );
  2089 	?>
  2190 	?>
  2090 <body <?php echo $admin_body_id; ?>class="wp-admin wp-core-ui no-js iframe <?php echo $admin_body_classes; ?>">
  2191 <body <?php echo $admin_body_id; ?>class="wp-admin wp-core-ui no-js iframe <?php echo esc_attr( $admin_body_classes ); ?>">
  2091 <script type="text/javascript">
  2192 <script type="text/javascript">
  2092 (function(){
  2193 (function(){
  2093 var c = document.body.className;
  2194 var c = document.body.className;
  2094 c = c.replace(/no-js/, 'js');
  2195 c = c.replace(/no-js/, 'js');
  2095 document.body.className = c;
  2196 document.body.className = c;
  2158 		$post_states_string .= ' &mdash; ';
  2259 		$post_states_string .= ' &mdash; ';
  2159 
  2260 
  2160 		foreach ( $post_states as $state ) {
  2261 		foreach ( $post_states as $state ) {
  2161 			++$i;
  2262 			++$i;
  2162 
  2263 
  2163 			$sep = ( $i < $state_count ) ? ', ' : '';
  2264 			$separator = ( $i < $state_count ) ? ', ' : '';
  2164 
  2265 
  2165 			$post_states_string .= "<span class='post-state'>$state$sep</span>";
  2266 			$post_states_string .= "<span class='post-state'>{$state}{$separator}</span>";
  2166 		}
  2267 		}
  2167 	}
  2268 	}
  2168 
  2269 
  2169 	if ( $display ) {
  2270 	if ( $display ) {
  2170 		echo $post_states_string;
  2271 		echo $post_states_string;
  2272 		$media_states_string .= ' &mdash; ';
  2373 		$media_states_string .= ' &mdash; ';
  2273 
  2374 
  2274 		foreach ( $media_states as $state ) {
  2375 		foreach ( $media_states as $state ) {
  2275 			++$i;
  2376 			++$i;
  2276 
  2377 
  2277 			$sep = ( $i < $state_count ) ? ', ' : '';
  2378 			$separator = ( $i < $state_count ) ? ', ' : '';
  2278 
  2379 
  2279 			$media_states_string .= "<span class='post-state'>$state$sep</span>";
  2380 			$media_states_string .= "<span class='post-state'>{$state}{$separator}</span>";
  2280 		}
  2381 		}
  2281 	}
  2382 	}
  2282 
  2383 
  2283 	if ( $display ) {
  2384 	if ( $display ) {
  2284 		echo $media_states_string;
  2385 		echo $media_states_string;
  2437  *
  2538  *
  2438  * @since 3.1.0
  2539  * @since 3.1.0
  2439  *
  2540  *
  2440  * @see get_submit_button()
  2541  * @see get_submit_button()
  2441  *
  2542  *
  2442  * @param string       $text             The text of the button (defaults to 'Save Changes')
  2543  * @param string       $text             Optional. The text of the button. Defaults to 'Save Changes'.
  2443  * @param string       $type             Optional. The type and CSS class(es) of the button. Core values
  2544  * @param string       $type             Optional. The type and CSS class(es) of the button. Core values
  2444  *                                       include 'primary', 'small', and 'large'. Default 'primary'.
  2545  *                                       include 'primary', 'small', and 'large'. Default 'primary'.
  2445  * @param string       $name             The HTML name of the submit button. Defaults to "submit". If no
  2546  * @param string       $name             Optional. The HTML name of the submit button. If no `id` attribute
  2446  *                                       id attribute is given in $other_attributes below, $name will be
  2547  *                                       is given in the `$other_attributes` parameter, `$name` will be used
  2447  *                                       used as the button's id.
  2548  *                                       as the button's `id`. Default 'submit'.
  2448  * @param bool         $wrap             True if the output button should be wrapped in a paragraph tag,
  2549  * @param bool         $wrap             Optional. True if the output button should be wrapped in a paragraph tag,
  2449  *                                       false otherwise. Defaults to true.
  2550  *                                       false otherwise. Default true.
  2450  * @param array|string $other_attributes Other attributes that should be output with the button, mapping
  2551  * @param array|string $other_attributes Optional. Other attributes that should be output with the button,
  2451  *                                       attributes to their values, such as setting tabindex to 1, etc.
  2552  *                                       mapping attributes to their values, e.g. `array( 'id' => 'search-submit' )`.
  2452  *                                       These key/value attribute pairs will be output as attribute="value",
  2553  *                                       These key/value attribute pairs will be output as `attribute="value"`,
  2453  *                                       where attribute is the key. Other attributes can also be provided
  2554  *                                       where attribute is the key. Attributes can also be provided as a string,
  2454  *                                       as a string such as 'tabindex="1"', though the array format is
  2555  *                                       e.g. `id="search-submit"`, though the array format is generally preferred.
  2455  *                                       preferred. Default null.
  2556  *                                       Default empty string.
  2456  */
  2557  */
  2457 function submit_button( $text = null, $type = 'primary', $name = 'submit', $wrap = true, $other_attributes = null ) {
  2558 function submit_button( $text = '', $type = 'primary', $name = 'submit', $wrap = true, $other_attributes = '' ) {
  2458 	echo get_submit_button( $text, $type, $name, $wrap, $other_attributes );
  2559 	echo get_submit_button( $text, $type, $name, $wrap, $other_attributes );
  2459 }
  2560 }
  2460 
  2561 
  2461 /**
  2562 /**
  2462  * Returns a submit button, with provided text and appropriate class.
  2563  * Returns a submit button, with provided text and appropriate class.
  2463  *
  2564  *
  2464  * @since 3.1.0
  2565  * @since 3.1.0
  2465  *
  2566  *
  2466  * @param string       $text             Optional. The text of the button. Default 'Save Changes'.
  2567  * @param string       $text             Optional. The text of the button. Defaults to 'Save Changes'.
  2467  * @param string       $type             Optional. The type and CSS class(es) of the button. Core values
  2568  * @param string       $type             Optional. The type and CSS class(es) of the button. Core values
  2468  *                                       include 'primary', 'small', and 'large'. Default 'primary large'.
  2569  *                                       include 'primary', 'small', and 'large'. Default 'primary large'.
  2469  * @param string       $name             Optional. The HTML name of the submit button. Defaults to "submit".
  2570  * @param string       $name             Optional. The HTML name of the submit button. If no `id` attribute
  2470  *                                       If no id attribute is given in $other_attributes below, `$name` will
  2571  *                                       is given in the `$other_attributes` parameter, `$name` will be used
  2471  *                                       be used as the button's id. Default 'submit'.
  2572  *                                       as the button's `id`. Default 'submit'.
  2472  * @param bool         $wrap             Optional. True if the output button should be wrapped in a paragraph
  2573  * @param bool         $wrap             Optional. True if the output button should be wrapped in a paragraph tag,
  2473  *                                       tag, false otherwise. Default true.
  2574  *                                       false otherwise. Default true.
  2474  * @param array|string $other_attributes Optional. Other attributes that should be output with the button,
  2575  * @param array|string $other_attributes Optional. Other attributes that should be output with the button,
  2475  *                                       mapping attributes to their values, such as `array( 'tabindex' => '1' )`.
  2576  *                                       mapping attributes to their values, e.g. `array( 'id' => 'search-submit' )`.
  2476  *                                       These attributes will be output as `attribute="value"`, such as
  2577  *                                       These key/value attribute pairs will be output as `attribute="value"`,
  2477  *                                       `tabindex="1"`. Other attributes can also be provided as a string such
  2578  *                                       where attribute is the key. Attributes can also be provided as a string,
  2478  *                                       as `tabindex="1"`, though the array format is typically cleaner.
  2579  *                                       e.g. `id="search-submit"`, though the array format is generally preferred.
  2479  *                                       Default empty.
  2580  *                                       Default empty string.
  2480  * @return string Submit button HTML.
  2581  * @return string Submit button HTML.
  2481  */
  2582  */
  2482 function get_submit_button( $text = '', $type = 'primary large', $name = 'submit', $wrap = true, $other_attributes = '' ) {
  2583 function get_submit_button( $text = '', $type = 'primary large', $name = 'submit', $wrap = true, $other_attributes = '' ) {
  2483 	if ( ! is_array( $type ) ) {
  2584 	if ( ! is_array( $type ) ) {
  2484 		$type = explode( ' ', $type );
  2585 		$type = explode( ' ', $type );
  2529 
  2630 
  2530 	return $button;
  2631 	return $button;
  2531 }
  2632 }
  2532 
  2633 
  2533 /**
  2634 /**
       
  2635  * Prints out the beginning of the admin HTML header.
       
  2636  *
  2534  * @global bool $is_IE
  2637  * @global bool $is_IE
  2535  */
  2638  */
  2536 function _wp_admin_html_begin() {
  2639 function _wp_admin_html_begin() {
  2537 	global $is_IE;
  2640 	global $is_IE;
  2538 
  2641 
  2590 
  2693 
  2591 	return WP_Screen::get( $hook_name );
  2694 	return WP_Screen::get( $hook_name );
  2592 }
  2695 }
  2593 
  2696 
  2594 /**
  2697 /**
  2595  * Output the HTML for restoring the post data from DOM storage
  2698  * Outputs the HTML for restoring the post data from DOM storage
  2596  *
  2699  *
  2597  * @since 3.6.0
  2700  * @since 3.6.0
  2598  * @access private
  2701  * @access private
  2599  */
  2702  */
  2600 function _local_storage_notice() {
  2703 function _local_storage_notice() {
  2601 	?>
  2704 	$local_storage_message  = '<p class="local-restore">';
  2602 	<div id="local-storage-notice" class="hidden notice is-dismissible">
  2705 	$local_storage_message .= __( 'The backup of this post in your browser is different from the version below.' );
  2603 	<p class="local-restore">
  2706 	$local_storage_message .= '<button type="button" class="button restore-backup">' . __( 'Restore the backup' ) . '</button></p>';
  2604 		<?php _e( 'The backup of this post in your browser is different from the version below.' ); ?>
  2707 	$local_storage_message .= '<p class="help">';
  2605 		<button type="button" class="button restore-backup"><?php _e( 'Restore the backup' ); ?></button>
  2708 	$local_storage_message .= __( 'This will replace the current editor content with the last backup version. You can use undo and redo in the editor to get the old content back or to return to the restored version.' );
  2606 	</p>
  2709 	$local_storage_message .= '</p>';
  2607 	<p class="help">
  2710 
  2608 		<?php _e( 'This will replace the current editor content with the last backup version. You can use undo and redo in the editor to get the old content back or to return to the restored version.' ); ?>
  2711 	wp_admin_notice(
  2609 	</p>
  2712 		$local_storage_message,
  2610 	</div>
  2713 		array(
  2611 	<?php
  2714 			'id'                 => 'local-storage-notice',
       
  2715 			'additional_classes' => array( 'hidden' ),
       
  2716 			'dismissible'        => true,
       
  2717 			'paragraph_wrap'     => false,
       
  2718 		)
       
  2719 	);
  2612 }
  2720 }
  2613 
  2721 
  2614 /**
  2722 /**
  2615  * Outputs a HTML element with a star rating for a given rating.
  2723  * Outputs a HTML element with a star rating for a given rating.
  2616  *
  2724  *
  2655 	$full_stars  = floor( $rating );
  2763 	$full_stars  = floor( $rating );
  2656 	$half_stars  = ceil( $rating - $full_stars );
  2764 	$half_stars  = ceil( $rating - $full_stars );
  2657 	$empty_stars = 5 - $full_stars - $half_stars;
  2765 	$empty_stars = 5 - $full_stars - $half_stars;
  2658 
  2766 
  2659 	if ( $parsed_args['number'] ) {
  2767 	if ( $parsed_args['number'] ) {
  2660 		/* translators: 1: The rating, 2: The number of ratings. */
  2768 		/* translators: Hidden accessibility text. 1: The rating, 2: The number of ratings. */
  2661 		$format = _n( '%1$s rating based on %2$s rating', '%1$s rating based on %2$s ratings', $parsed_args['number'] );
  2769 		$format = _n( '%1$s rating based on %2$s rating', '%1$s rating based on %2$s ratings', $parsed_args['number'] );
  2662 		$title  = sprintf( $format, number_format_i18n( $rating, 1 ), number_format_i18n( $parsed_args['number'] ) );
  2770 		$title  = sprintf( $format, number_format_i18n( $rating, 1 ), number_format_i18n( $parsed_args['number'] ) );
  2663 	} else {
  2771 	} else {
  2664 		/* translators: %s: The rating. */
  2772 		/* translators: Hidden accessibility text. %s: The rating. */
  2665 		$title = sprintf( __( '%s rating' ), number_format_i18n( $rating, 1 ) );
  2773 		$title = sprintf( __( '%s rating' ), number_format_i18n( $rating, 1 ) );
  2666 	}
  2774 	}
  2667 
  2775 
  2668 	$output  = '<div class="star-rating">';
  2776 	$output  = '<div class="star-rating">';
  2669 	$output .= '<span class="screen-reader-text">' . $title . '</span>';
  2777 	$output .= '<span class="screen-reader-text">' . $title . '</span>';
  2684  *
  2792  *
  2685  * @ignore
  2793  * @ignore
  2686  * @since 4.2.0
  2794  * @since 4.2.0
  2687  */
  2795  */
  2688 function _wp_posts_page_notice() {
  2796 function _wp_posts_page_notice() {
  2689 	printf(
  2797 	wp_admin_notice(
  2690 		'<div class="notice notice-warning inline"><p>%s</p></div>',
  2798 		__( 'You are currently editing the page that shows your latest posts.' ),
  2691 		__( 'You are currently editing the page that shows your latest posts.' )
  2799 		array(
       
  2800 			'type'               => 'warning',
       
  2801 			'additional_classes' => array( 'inline' ),
       
  2802 		)
  2692 	);
  2803 	);
  2693 }
  2804 }
  2694 
  2805 
  2695 /**
  2806 /**
  2696  * Outputs a notice when editing the page for posts in the block editor (internal use only).
  2807  * Outputs a notice when editing the page for posts in the block editor (internal use only).