@@ -1222,21 +1196,23 @@ function do_accordion_sections( $screen, $context, $object ) {
*
* @global $wp_settings_sections Storage array of all settings sections added to admin pages
*
- * @param string $id Slug-name to identify the section. Used in the 'id' attribute of tags.
- * @param string $title Formatted title of the section. Shown as the heading for the section.
- * @param string $callback Function that echos out any content at the top of the section (between heading and fields).
- * @param string $page The slug-name of the settings page on which to show the section. Built-in pages include 'general', 'reading', 'writing', 'discussion', 'media', etc. Create your own using add_options_page();
+ * @param string $id Slug-name to identify the section. Used in the 'id' attribute of tags.
+ * @param string $title Formatted title of the section. Shown as the heading for the section.
+ * @param callable $callback Function that echos out any content at the top of the section (between heading and fields).
+ * @param string $page The slug-name of the settings page on which to show the section. Built-in pages include
+ * 'general', 'reading', 'writing', 'discussion', 'media', etc. Create your own using
+ * add_options_page();
*/
function add_settings_section($id, $title, $callback, $page) {
global $wp_settings_sections;
if ( 'misc' == $page ) {
- _deprecated_argument( __FUNCTION__, '3.0', sprintf( __( 'The "%s" options group has been removed. Use another settings group.' ), 'misc' ) );
+ _deprecated_argument( __FUNCTION__, '3.0.0', sprintf( __( 'The "%s" options group has been removed. Use another settings group.' ), 'misc' ) );
$page = 'general';
}
if ( 'privacy' == $page ) {
- _deprecated_argument( __FUNCTION__, '3.5', sprintf( __( 'The "%s" options group has been removed. Use another settings group.' ), 'privacy' ) );
+ _deprecated_argument( __FUNCTION__, '3.5.0', sprintf( __( 'The "%s" options group has been removed. Use another settings group.' ), 'privacy' ) );
$page = 'reading';
}
@@ -1259,16 +1235,16 @@ function add_settings_section($id, $title, $callback, $page) {
*
* @global $wp_settings_fields Storage array of settings fields and info about their pages/sections
*
- * @param string $id Slug-name to identify the field. Used in the 'id' attribute of tags.
- * @param string $title Formatted title of the field. Shown as the label for the field
- * during output.
- * @param string $callback Function that fills the field with the desired form inputs. The
- * function should echo its output.
- * @param string $page The slug-name of the settings page on which to show the section
- * (general, reading, writing, ...).
- * @param string $section Optional. The slug-name of the section of the settings page
- * in which to show the box. Default 'default'.
- * @param array $args {
+ * @param string $id Slug-name to identify the field. Used in the 'id' attribute of tags.
+ * @param string $title Formatted title of the field. Shown as the label for the field
+ * during output.
+ * @param callable $callback Function that fills the field with the desired form inputs. The
+ * function should echo its output.
+ * @param string $page The slug-name of the settings page on which to show the section
+ * (general, reading, writing, ...).
+ * @param string $section Optional. The slug-name of the section of the settings page
+ * in which to show the box. Default 'default'.
+ * @param array $args {
* Optional. Extra arguments used when outputting the field.
*
* @type string $label_for When supplied, the setting title will be wrapped
@@ -1282,12 +1258,12 @@ function add_settings_field($id, $title, $callback, $page, $section = 'default',
global $wp_settings_fields;
if ( 'misc' == $page ) {
- _deprecated_argument( __FUNCTION__, '3.0', __( 'The miscellaneous options group has been removed. Use another settings group.' ) );
+ _deprecated_argument( __FUNCTION__, '3.0.0', __( 'The miscellaneous options group has been removed. Use another settings group.' ) );
$page = 'general';
}
if ( 'privacy' == $page ) {
- _deprecated_argument( __FUNCTION__, '3.5', __( 'The privacy options group has been removed. Use another settings group.' ) );
+ _deprecated_argument( __FUNCTION__, '3.5.0', __( 'The privacy options group has been removed. Use another settings group.' ) );
$page = 'reading';
}
@@ -1305,7 +1281,7 @@ function add_settings_field($id, $title, $callback, $page, $section = 'default',
* @global $wp_settings_fields Storage array of settings fields and info about their pages/sections
* @since 2.7.0
*
- * @param string $page The slug name of the page whos settings sections you want to output
+ * @param string $page The slug name of the page whose settings sections you want to output
*/
function do_settings_sections( $page ) {
global $wp_settings_sections, $wp_settings_fields;
@@ -1315,7 +1291,7 @@ function do_settings_sections( $page ) {
foreach ( (array) $wp_settings_sections[$page] as $section ) {
if ( $section['title'] )
- echo "
{$section['title']}
\n";
+ echo "
{$section['title']}
\n";
if ( $section['callback'] )
call_user_func( $section['callback'], $section );
@@ -1417,7 +1393,8 @@ function add_settings_error( $setting, $code, $message, $type = 'error' ) {
*
* Use the $sanitize argument to manually re-sanitize the option before returning errors.
* This is useful if you have errors or notices you want to show even when the user
- * hasn't submitted data (i.e. when they first load an options page, or in admin_notices action hook)
+ * hasn't submitted data (i.e. when they first load an options page, or in the {@see 'admin_notices'}
+ * action hook).
*
* @since 3.0.0
*
@@ -1462,16 +1439,16 @@ function get_settings_errors( $setting = '', $sanitize = false ) {
}
/**
- * Display settings errors registered by {@see add_settings_error()}.
+ * Display settings errors registered by add_settings_error().
*
* Part of the Settings API. Outputs a div for each error retrieved by
- * {@see get_settings_errors()}.
+ * get_settings_errors().
*
* This is called automatically after a settings page based on the
* Settings API is submitted. Errors should be added during the validation
- * callback function for a setting defined in {@see register_setting()}
+ * callback function for a setting defined in register_setting().
*
- * The $sanitize option is passed into {@see get_settings_errors()} and will
+ * The $sanitize option is passed into get_settings_errors() and will
* re-run the setting sanitization
* on its current value.
*
@@ -1485,7 +1462,8 @@ function get_settings_errors( $setting = '', $sanitize = false ) {
*
* @param string $setting Optional slug title of a specific setting who's errors you want.
* @param bool $sanitize Whether to re-sanitize the setting value before returning errors.
- * @param bool $hide_on_update If set to true errors will not be shown if the settings page has already been submitted.
+ * @param bool $hide_on_update If set to true errors will not be shown if the settings page has
+ * already been submitted.
*/
function settings_errors( $setting = '', $sanitize = false, $hide_on_update = false ) {
@@ -1509,7 +1487,7 @@ function settings_errors( $setting = '', $sanitize = false, $hide_on_update = fa
}
/**
- * {@internal Missing Short Description}}
+ * Outputs the modal window used for attaching media to posts or pages in the media-listing screen.
*
* @since 2.7.0
*
@@ -1519,8 +1497,8 @@ function find_posts_div($found_action = '') {
?>
@@ -1538,7 +1516,7 @@ function find_posts_div($found_action = '') {
@@ -1546,10 +1524,9 @@ function find_posts_div($found_action = '') {
}
/**
- * Display the post password.
+ * Displays the post password.
*
- * The password is passed through {@link esc_attr()} to ensure that it
- * is safe for placing in an html attribute.
+ * The password is passed through esc_attr() to ensure that it is safe for placing in an html attribute.
*
* @since 2.7.0
*/
@@ -1578,10 +1555,10 @@ function _draft_or_post_title( $post = 0 ) {
}
/**
- * Display the search query.
+ * Displays the search query.
*
- * A simple wrapper to display the "s" parameter in a GET URI. This function
- * should only be used when {@link the_search_query()} cannot.
+ * A simple wrapper to display the "s" parameter in a `GET` URI. This function
+ * should only be used when the_search_query() cannot.
*
* @since 2.7.0
*/
@@ -1648,7 +1625,7 @@ do_action( "admin_head-$hook_suffix" );
/** This action is documented in wp-admin/admin-header.php */
do_action( 'admin_head' );
-$admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) );
+$admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_user_locale() ) ) );
if ( is_rtl() )
$admin_body_class .= ' rtl';
@@ -1685,11 +1662,19 @@ function iframe_footer() {
* but run the hooks anyway since they output JavaScript
* or other needed content.
*/
- ?>
+
+ /**
+ * @global string $hook_suffix
+ */
+ global $hook_suffix;
+ ?>
post_status && 'draft' != $post_status )
$post_states['draft'] = __('Draft');
if ( 'pending' == $post->post_status && 'pending' != $post_status )
- /* translators: post state */
- $post_states['pending'] = _x('Pending', 'post state');
+ $post_states['pending'] = _x('Pending', 'post status');
if ( is_sticky($post->ID) )
$post_states['sticky'] = __('Sticky');
@@ -1728,28 +1712,30 @@ function _post_states($post) {
$post_states['scheduled'] = __( 'Scheduled' );
}
- if ( get_option( 'page_on_front' ) == $post->ID ) {
- $post_states['page_on_front'] = __( 'Front Page' );
- }
+ if ( 'page' === get_option( 'show_on_front' ) ) {
+ if ( intval( get_option( 'page_on_front' ) ) === $post->ID ) {
+ $post_states['page_on_front'] = __( 'Front Page' );
+ }
- if ( get_option( 'page_for_posts' ) == $post->ID ) {
- $post_states['page_for_posts'] = __( 'Posts Page' );
+ if ( intval( get_option( 'page_for_posts' ) ) === $post->ID ) {
+ $post_states['page_for_posts'] = __( 'Posts Page' );
+ }
}
/**
- * Filter the default post display states used in the posts list table.
+ * Filters the default post display states used in the posts list table.
*
* @since 2.8.0
*
- * @param array $post_states An array of post display states.
- * @param int $post The post ID.
+ * @param array $post_states An array of post display states.
+ * @param WP_Post $post The current post object.
*/
$post_states = apply_filters( 'display_post_states', $post_states, $post );
if ( ! empty($post_states) ) {
$state_count = count($post_states);
$i = 0;
- echo ' - ';
+ echo ' — ';
foreach ( $post_states as $state ) {
++$i;
( $i == $state_count ) ? $sep = '' : $sep = ', ';
@@ -1769,34 +1755,63 @@ function _media_states( $post ) {
if ( current_theme_supports( 'custom-header') ) {
$meta_header = get_post_meta($post->ID, '_wp_attachment_is_custom_header', true );
- if ( ! empty( $meta_header ) && $meta_header == $stylesheet )
- $media_states[] = __( 'Header Image' );
+
+ if ( is_random_header_image() ) {
+ $header_images = wp_list_pluck( get_uploaded_header_images(), 'attachment_id' );
+
+ if ( $meta_header == $stylesheet && in_array( $post->ID, $header_images ) ) {
+ $media_states[] = __( 'Header Image' );
+ }
+ } else {
+ $header_image = get_header_image();
+
+ // Display "Header Image" if the image was ever used as a header image
+ if ( ! empty( $meta_header ) && $meta_header == $stylesheet && $header_image !== wp_get_attachment_url( $post->ID ) ) {
+ $media_states[] = __( 'Header Image' );
+ }
+
+ // Display "Current Header Image" if the image is currently the header image
+ if ( $header_image && $header_image == wp_get_attachment_url( $post->ID ) ) {
+ $media_states[] = __( 'Current Header Image' );
+ }
+ }
}
if ( current_theme_supports( 'custom-background') ) {
$meta_background = get_post_meta($post->ID, '_wp_attachment_is_custom_background', true );
- if ( ! empty( $meta_background ) && $meta_background == $stylesheet )
+
+ if ( ! empty( $meta_background ) && $meta_background == $stylesheet ) {
$media_states[] = __( 'Background Image' );
+
+ $background_image = get_background_image();
+ if ( $background_image && $background_image == wp_get_attachment_url( $post->ID ) ) {
+ $media_states[] = __( 'Current Background Image' );
+ }
+ }
}
if ( $post->ID == get_option( 'site_icon' ) ) {
$media_states[] = __( 'Site Icon' );
}
+ if ( $post->ID == get_theme_mod( 'site_logo' ) ) {
+ $media_states[] = __( 'Logo' );
+ }
+
/**
- * Filter the default media display states for items in the Media list table.
+ * Filters the default media display states for items in the Media list table.
*
* @since 3.2.0
*
* @param array $media_states An array of media states. Default 'Header Image',
- * 'Background Image', 'Site Icon'.
+ * 'Background Image', 'Site Icon', 'Logo'.
*/
$media_states = apply_filters( 'display_media_states', $media_states );
if ( ! empty( $media_states ) ) {
$state_count = count( $media_states );
$i = 0;
- echo ' - ';
+ echo ' — ';
foreach ( $media_states as $state ) {
++$i;
( $i == $state_count ) ? $sep = '' : $sep = ', ';
@@ -1818,6 +1833,7 @@ function _media_states( $post ) {
function compression_test() {
?>
- '_invalid', 'base' => '_are_belong_to_us' );
}
@@ -2176,14 +2037,13 @@ function convert_to_screen( $hook_name ) {
*/
function _local_storage_notice() {
?>
-
+
0,
- 'type' => 'rating',
+ 'type' => 'rating',
'number' => 0,
+ 'echo' => true,
);
$r = wp_parse_args( $args, $defaults );
@@ -2237,12 +2102,18 @@ function wp_star_rating( $args = array() ) {
$title = sprintf( __( '%s rating' ), number_format_i18n( $rating, 1 ) );
}
- echo '
';
- echo '
' . $title . '';
- echo str_repeat( '
', $full_stars );
- echo str_repeat( '
', $half_stars );
- echo str_repeat( '
', $empty_stars);
- echo '
';
+ $output = '
';
+ $output .= '
' . $title . '';
+ $output .= str_repeat( '
', $full_stars );
+ $output .= str_repeat( '
', $half_stars );
+ $output .= str_repeat( '
', $empty_stars );
+ $output .= '
';
+
+ if ( $r['echo'] ) {
+ echo $output;
+ }
+
+ return $output;
}
/**