--- a/wp/wp-admin/includes/template.php Tue Dec 15 15:52:01 2020 +0100
+++ b/wp/wp-admin/includes/template.php Wed Sep 21 18:19:35 2022 +0200
@@ -25,17 +25,17 @@
*
* @see wp_terms_checklist()
*
- * @param int $post_id Optional. Post to generate a categories checklist for. Default 0.
- * $selected_cats must not be an array. Default 0.
- * @param int $descendants_and_self Optional. ID of the category to output along with its descendants.
- * Default 0.
- * @param int[] $selected_cats Optional. Array of category IDs to mark as checked. Default false.
- * @param int[] $popular_cats Optional. Array of category IDs to receive the "popular-category" class.
- * Default false.
- * @param Walker $walker Optional. Walker object to use to build the output.
- * Default is a Walker_Category_Checklist instance.
- * @param bool $checked_ontop Optional. Whether to move checked items out of the hierarchy and to
- * the top of the list. Default true.
+ * @param int $post_id Optional. Post to generate a categories checklist for. Default 0.
+ * $selected_cats must not be an array. Default 0.
+ * @param int $descendants_and_self Optional. ID of the category to output along with its descendants.
+ * Default 0.
+ * @param int[]|false $selected_cats Optional. Array of category IDs to mark as checked. Default false.
+ * @param int[]|false $popular_cats Optional. Array of category IDs to receive the "popular-category" class.
+ * Default false.
+ * @param Walker $walker Optional. Walker object to use to build the output.
+ * Default is a Walker_Category_Checklist instance.
+ * @param bool $checked_ontop Optional. Whether to move checked items out of the hierarchy and to
+ * the top of the list. Default true.
*/
function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $selected_cats = false, $popular_cats = false, $walker = null, $checked_ontop = true ) {
wp_terms_checklist(
@@ -813,7 +813,7 @@
$cur_hh = current_time( 'H' );
$cur_mn = current_time( 'i' );
- $month = '<label><span class="screen-reader-text">' . __( 'Month' ) . '</span><select ' . ( $multi ? '' : 'id="mm" ' ) . 'name="mm"' . $tab_index_attribute . ">\n";
+ $month = '<label><span class="screen-reader-text">' . __( 'Month' ) . '</span><select class="form-required" ' . ( $multi ? '' : 'id="mm" ' ) . 'name="mm"' . $tab_index_attribute . ">\n";
for ( $i = 1; $i < 13; $i = $i + 1 ) {
$monthnum = zeroise( $i, 2 );
$monthtext = $wp_locale->get_month_abbrev( $wp_locale->get_month( $i ) );
@@ -823,10 +823,10 @@
}
$month .= '</select></label>';
- $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" /></label>';
- $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" /></label>';
- $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" /></label>';
- $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" /></label>';
+ $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>';
+ $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>';
+ $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>';
+ $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>';
echo '<div class="timestamp-wrap">';
/* translators: 1: Month, 2: Day, 3: Year, 4: Hour, 5: Minute. */
@@ -972,7 +972,7 @@
?>
<div class="error"><p><?php _e( 'Before you can upload your import file, you will need to fix the following error:' ); ?></p>
<p><strong><?php echo $upload_dir['error']; ?></strong></p></div>
- <?php
+ <?php
else :
?>
<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' ) ); ?>">
@@ -1014,14 +1014,14 @@
* add_submenu_page() to create a new screen (and hence screen_id),
* make sure your menu slug conforms to the limits of sanitize_key()
* otherwise the 'screen' menu may not correctly render on your page.
- * @param string $context Optional. The context within the screen where the boxes
+ * @param string $context Optional. The context within the screen where the box
* should display. Available contexts vary from screen to
* screen. Post edit screen contexts include 'normal', 'side',
* and 'advanced'. Comments screen contexts include 'normal'
* and 'side'. Menus meta boxes (accordion sections) all use
* the 'side' context. Global default is 'advanced'.
- * @param string $priority Optional. The priority within the context where the boxes
- * should show ('high', 'low'). Default 'default'.
+ * @param string $priority Optional. The priority within the context where the box should show.
+ * Accepts 'high', 'core', 'default', or 'low'. Default 'default'.
* @param array $callback_args Optional. Data that should be set as the $args property
* of the box array (which is the second parameter passed
* to your callback). Default null.
@@ -1148,17 +1148,23 @@
if ( empty( $plugins['classic-editor/classic-editor.php'] ) ) {
if ( current_user_can( 'install_plugins' ) ) {
+ $install_url = wp_nonce_url(
+ self_admin_url( 'plugin-install.php?tab=favorites&user=wordpressdotorg&save=0' ),
+ 'save_wporg_username_' . get_current_user_id()
+ );
+
echo '<p>';
- printf(
- /* translators: %s: A link to install the Classic Editor plugin. */
- __( 'Please install the <a href="%s">Classic Editor plugin</a> to use this meta box.' ),
- esc_url( wp_nonce_url( self_admin_url( 'plugin-install.php?tab=favorites&user=wordpressdotorg&save=0' ), 'save_wporg_username_' . get_current_user_id() ) )
- );
+ /* translators: %s: A link to install the Classic Editor plugin. */
+ printf( __( 'Please install the <a href="%s">Classic Editor plugin</a> to use this meta box.' ), esc_url( $install_url ) );
echo '</p>';
}
} elseif ( is_plugin_inactive( 'classic-editor/classic-editor.php' ) ) {
if ( current_user_can( 'activate_plugins' ) ) {
- $activate_url = wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=classic-editor/classic-editor.php' ), 'activate-plugin_classic-editor/classic-editor.php' );
+ $activate_url = wp_nonce_url(
+ self_admin_url( 'plugins.php?action=activate&plugin=classic-editor/classic-editor.php' ),
+ 'activate-plugin_classic-editor/classic-editor.php'
+ );
+
echo '<p>';
/* translators: %s: A link to activate the Classic Editor plugin. */
printf( __( 'Please activate the <a href="%s">Classic Editor plugin</a> to use this meta box.' ), esc_url( $activate_url ) );
@@ -1321,7 +1327,7 @@
echo '<span aria-hidden="true" class="dashicons dashicons-warning"></span>';
echo '<span class="screen-reader-text">' . __( 'Warning:' ) . ' </span>';
}
- echo "{$box['title']}";
+ echo $box['title'];
echo "</h2>\n";
if ( 'dashboard_browser_nag' !== $box['id'] ) {
@@ -1592,7 +1598,7 @@
*
* Part of the Settings API. Use this to define a settings field that will show
* as part of a settings section inside a settings page. The fields are shown using
- * do_settings_fields() in do_settings-sections()
+ * do_settings_fields() in do_settings_sections().
*
* The $callback argument should be the name of a function that echoes out the
* HTML input tags for this setting field. Use get_option() to retrieve existing
@@ -1797,7 +1803,16 @@
*
* @param string $setting Optional. Slug title of a specific setting whose errors you want.
* @param bool $sanitize Optional. Whether to re-sanitize the setting value before returning errors.
- * @return array Array of settings errors.
+ * @return array {
+ * Array of settings errors.
+ *
+ * @type string $setting Slug title of the setting to which this error applies.
+ * @type string $code Slug-name to identify the error. Used as part of 'id' attribute in HTML output.
+ * @type string $message The formatted message text to display to the user (will be shown inside styled
+ * `<div>` and `<p>` tags).
+ * @type string $type Optional. Message type, controls HTML class. Possible values include 'error',
+ * 'success', 'warning', 'info'. Default 'error'.
+ * }
*/
function get_settings_errors( $setting = '', $sanitize = false ) {
global $wp_settings_errors;
@@ -2016,14 +2031,14 @@
wp_enqueue_style( 'colors' );
?>
<script type="text/javascript">
-addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
+addLoadEvent = function(func){if(typeof jQuery!=='undefined')jQuery(document).ready(func);else if(typeof wpOnload!=='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
function tb_close(){var win=window.dialogArguments||opener||parent||top;win.tb_remove();}
-var ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>',
- pagenow = '<?php echo $current_screen->id; ?>',
- typenow = '<?php echo $current_screen->post_type; ?>',
- adminpage = '<?php echo $admin_body_class; ?>',
- thousandsSeparator = '<?php echo addslashes( $wp_locale->number_format['thousands_sep'] ); ?>',
- decimalPoint = '<?php echo addslashes( $wp_locale->number_format['decimal_point'] ); ?>',
+var ajaxurl = '<?php echo esc_js( admin_url( 'admin-ajax.php', 'relative' ) ); ?>',
+ pagenow = '<?php echo esc_js( $current_screen->id ); ?>',
+ typenow = '<?php echo esc_js( $current_screen->post_type ); ?>',
+ adminpage = '<?php echo esc_js( $admin_body_class ); ?>',
+ thousandsSeparator = '<?php echo esc_js( $wp_locale->number_format['thousands_sep'] ); ?>',
+ decimalPoint = '<?php echo esc_js( $wp_locale->number_format['decimal_point'] ); ?>',
isRtl = <?php echo (int) is_rtl(); ?>;
</script>
<?php
@@ -2106,7 +2121,7 @@
do_action( 'admin_print_footer_scripts' );
?>
</div>
-<script type="text/javascript">if(typeof wpOnload=="function")wpOnload();</script>
+<script type="text/javascript">if(typeof wpOnload==='function')wpOnload();</script>
</body>
</html>
<?php
@@ -2196,16 +2211,16 @@
}
if ( 'page' === get_option( 'show_on_front' ) ) {
- if ( intval( get_option( 'page_on_front' ) ) === $post->ID ) {
+ if ( (int) get_option( 'page_on_front' ) === $post->ID ) {
$post_states['page_on_front'] = _x( 'Front Page', 'page label' );
}
- if ( intval( get_option( 'page_for_posts' ) ) === $post->ID ) {
+ if ( (int) get_option( 'page_for_posts' ) === $post->ID ) {
$post_states['page_for_posts'] = _x( 'Posts Page', 'page label' );
}
}
- if ( intval( get_option( 'wp_page_for_privacy_policy' ) ) === $post->ID ) {
+ if ( (int) get_option( 'wp_page_for_privacy_policy' ) === $post->ID ) {
$post_states['page_for_privacy_policy'] = _x( 'Privacy Policy Page', 'page label' );
}
@@ -2228,10 +2243,45 @@
* Outputs the attachment media states as HTML.
*
* @since 3.2.0
+ * @since 5.6.0 Added the `$echo` parameter and a return value.
*
* @param WP_Post $post The attachment post to retrieve states for.
+ * @param bool $echo Optional. Whether to echo the post states as an HTML string. Default true.
+ * @return string Media states string.
*/
-function _media_states( $post ) {
+function _media_states( $post, $echo = true ) {
+ $media_states = get_media_states( $post );
+ $media_states_string = '';
+
+ if ( ! empty( $media_states ) ) {
+ $state_count = count( $media_states );
+ $i = 0;
+
+ $media_states_string .= ' — ';
+
+ foreach ( $media_states as $state ) {
+ $sep = ( ++$i === $state_count ) ? '' : ', ';
+
+ $media_states_string .= "<span class='post-state'>$state$sep</span>";
+ }
+ }
+
+ if ( $echo ) {
+ echo $media_states_string;
+ }
+
+ return $media_states_string;
+}
+
+/**
+ * Retrieves an array of media states from an attachment.
+ *
+ * @since 5.6.0
+ *
+ * @param WP_Post $post The attachment to retrieve states for.
+ * @return string[] Array of media state labels keyed by their state.
+ */
+function get_media_states( $post ) {
static $header_images;
$media_states = array();
@@ -2261,6 +2311,13 @@
$media_states[] = __( 'Current Header Image' );
}
}
+
+ if ( get_theme_support( 'custom-header', 'video' ) && has_header_video() ) {
+ $mods = get_theme_mods();
+ if ( isset( $mods['header_video'] ) && $post->ID === $mods['header_video'] ) {
+ $media_states[] = __( 'Current Header Video' );
+ }
+ }
}
if ( current_theme_supports( 'custom-background' ) ) {
@@ -2294,20 +2351,7 @@
* 'Background Image', 'Site Icon', 'Logo'.
* @param WP_Post $post The current attachment object.
*/
- $media_states = apply_filters( 'display_media_states', $media_states, $post );
-
- if ( ! empty( $media_states ) ) {
- $state_count = count( $media_states );
- $i = 0;
-
- echo ' — ';
-
- foreach ( $media_states as $state ) {
- $sep = ( ++$i === $state_count ) ? '' : ', ';
-
- echo "<span class='post-state'>$state$sep</span>";
- }
- }
+ return apply_filters( 'display_media_states', $media_states, $post );
}
/**
@@ -2622,11 +2666,31 @@
}
/**
- * Output a notice when editing the page for posts (internal use only).
+ * Outputs a notice when editing the page for posts (internal use only).
*
* @ignore
* @since 4.2.0
*/
function _wp_posts_page_notice() {
- echo '<div class="notice notice-warning inline"><p>' . __( 'You are currently editing the page that shows your latest posts.' ) . '</p></div>';
+ printf(
+ '<div class="notice notice-warning inline"><p>%s</p></div>',
+ __( 'You are currently editing the page that shows your latest posts.' )
+ );
}
+
+/**
+ * Outputs a notice when editing the page for posts in the block editor (internal use only).
+ *
+ * @ignore
+ * @since 5.8.0
+ */
+function _wp_block_editor_posts_page_notice() {
+ wp_add_inline_script(
+ 'wp-notices',
+ sprintf(
+ 'wp.data.dispatch( "core/notices" ).createWarningNotice( "%s", { isDismissible: false } )',
+ __( 'You are currently editing the page that shows your latest posts.' )
+ ),
+ 'after'
+ );
+}