--- a/wp/wp-admin/includes/dashboard.php Thu Sep 29 08:06:27 2022 +0200
+++ b/wp/wp-admin/includes/dashboard.php Fri Sep 05 18:40:08 2025 +0200
@@ -20,17 +20,18 @@
function wp_dashboard_setup() {
global $wp_registered_widgets, $wp_registered_widget_controls, $wp_dashboard_control_callbacks;
- $wp_dashboard_control_callbacks = array();
- $screen = get_current_screen();
+ $screen = get_current_screen();
/* Register Widgets and Controls */
+ $wp_dashboard_control_callbacks = array();
- $response = wp_check_browser_version();
+ // Browser version
+ $check_browser = wp_check_browser_version();
- if ( $response && $response['upgrade'] ) {
+ if ( $check_browser && $check_browser['upgrade'] ) {
add_filter( 'postbox_classes_dashboard_dashboard_browser_nag', 'dashboard_browser_nag_class' );
- if ( $response['insecure'] ) {
+ if ( $check_browser['insecure'] ) {
wp_add_dashboard_widget( 'dashboard_browser_nag', __( 'You are using an insecure browser!' ), 'wp_dashboard_browser_nag' );
} else {
wp_add_dashboard_widget( 'dashboard_browser_nag', __( 'Your browser is out of date!' ), 'wp_dashboard_browser_nag' );
@@ -38,14 +39,19 @@
}
// PHP Version.
- $response = wp_check_php_version();
+ $check_php = wp_check_php_version();
+
+ if ( $check_php && current_user_can( 'update_php' ) ) {
+ // If "not acceptable" the widget will be shown.
+ if ( isset( $check_php['is_acceptable'] ) && ! $check_php['is_acceptable'] ) {
+ add_filter( 'postbox_classes_dashboard_dashboard_php_nag', 'dashboard_php_nag_class' );
- if ( $response && isset( $response['is_acceptable'] ) && ! $response['is_acceptable']
- && current_user_can( 'update_php' )
- ) {
- add_filter( 'postbox_classes_dashboard_dashboard_php_nag', 'dashboard_php_nag_class' );
-
- wp_add_dashboard_widget( 'dashboard_php_nag', __( 'PHP Update Recommended' ), 'wp_dashboard_php_nag' );
+ if ( $check_php['is_lower_than_future_minimum'] ) {
+ wp_add_dashboard_widget( 'dashboard_php_nag', __( 'PHP Update Required' ), 'wp_dashboard_php_nag' );
+ } else {
+ wp_add_dashboard_widget( 'dashboard_php_nag', __( 'PHP Update Recommended' ), 'wp_dashboard_php_nag' );
+ }
+ }
}
// Site Health.
@@ -278,7 +284,6 @@
<?php
wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
-
}
//
@@ -486,7 +491,12 @@
<form action="<?php echo esc_url( network_admin_url( 'users.php' ) ); ?>" method="get">
<p>
- <label class="screen-reader-text" for="search-users"><?php _e( 'Search Users' ); ?></label>
+ <label class="screen-reader-text" for="search-users">
+ <?php
+ /* translators: Hidden accessibility text. */
+ _e( 'Search Users' );
+ ?>
+ </label>
<input type="search" name="s" value="" size="30" autocomplete="off" id="search-users" />
<?php submit_button( __( 'Search Users' ), '', false, false, array( 'id' => 'submit_users' ) ); ?>
</p>
@@ -494,7 +504,12 @@
<form action="<?php echo esc_url( network_admin_url( 'sites.php' ) ); ?>" method="get">
<p>
- <label class="screen-reader-text" for="search-sites"><?php _e( 'Search Sites' ); ?></label>
+ <label class="screen-reader-text" for="search-sites">
+ <?php
+ /* translators: Hidden accessibility text. */
+ _e( 'Search Sites' );
+ ?>
+ </label>
<input type="search" name="s" value="" size="30" autocomplete="off" id="search-sites" />
<?php submit_button( __( 'Search Sites' ), '', false, false, array( 'id' => 'submit_sites' ) ); ?>
</p>
@@ -516,7 +531,7 @@
}
/**
- * The Quick Draft widget display and creation of drafts.
+ * Displays the Quick Draft widget.
*
* @since 3.8.0
*
@@ -558,9 +573,16 @@
<form name="post" action="<?php echo esc_url( admin_url( 'post.php' ) ); ?>" method="post" id="quick-press" class="initial-form hide-if-no-js">
- <?php if ( $error_msg ) : ?>
- <div class="error"><?php echo $error_msg; ?></div>
- <?php endif; ?>
+ <?php
+ if ( $error_msg ) {
+ wp_admin_notice(
+ $error_msg,
+ array(
+ 'additional_classes' => array( 'error' ),
+ )
+ );
+ }
+ ?>
<div class="input-text-wrap" id="title-wrap">
<label for="title">
@@ -799,9 +821,9 @@
if ( ( ( 'approve' === $action || 'unapprove' === $action ) && 2 === $i )
|| 1 === $i
) {
- $sep = '';
+ $separator = '';
} else {
- $sep = ' | ';
+ $separator = ' | ';
}
// Reply and quickedit need a hide-if-no-js span.
@@ -813,7 +835,7 @@
$action .= ' hidden';
}
- $actions_string .= "<span class='$action'>$sep$link</span>";
+ $actions_string .= "<span class='$action'>{$separator}{$link}</span>";
}
}
?>
@@ -904,7 +926,9 @@
}
/**
- * Callback function for Activity widget.
+ * Outputs the Activity widget.
+ *
+ * Callback function for {@see 'dashboard_activity'}.
*
* @since 3.8.0
*/
@@ -966,7 +990,7 @@
'order' => $args['order'],
'posts_per_page' => (int) $args['max'],
'no_found_rows' => true,
- 'cache_results' => false,
+ 'cache_results' => true,
'perm' => ( 'future' === $args['status'] ) ? 'editable' : 'readable',
);
@@ -1064,7 +1088,11 @@
}
foreach ( $possible as $comment ) {
- if ( ! current_user_can( 'read_post', $comment->comment_post_ID ) ) {
+ if ( ! current_user_can( 'edit_post', $comment->comment_post_ID )
+ && ( post_password_required( $comment->comment_post_ID )
+ || ! current_user_can( 'read_post', $comment->comment_post_ID ) )
+ ) {
+ // The user has no access to the post and thus cannot see the comments.
continue;
}
@@ -1090,7 +1118,10 @@
echo '</ul>';
if ( current_user_can( 'edit_posts' ) ) {
- echo '<h3 class="screen-reader-text">' . __( 'View more comments' ) . '</h3>';
+ echo '<h3 class="screen-reader-text">' .
+ /* translators: Hidden accessibility text. */
+ __( 'View more comments' ) .
+ '</h3>';
_get_list_table( 'WP_Comments_List_Table' )->views();
}
@@ -1137,8 +1168,15 @@
* @return bool True on success, false on failure.
*/
function wp_dashboard_cached_rss_widget( $widget_id, $callback, $check_urls = array(), ...$args ) {
- $loading = '<p class="widget-loading hide-if-no-js">' . __( 'Loading…' ) . '</p><div class="hide-if-js notice notice-error inline"><p>' . __( 'This widget requires JavaScript.' ) . '</p></div>';
$doing_ajax = wp_doing_ajax();
+ $loading = '<p class="widget-loading hide-if-no-js">' . __( 'Loading…' ) . '</p>';
+ $loading .= wp_get_admin_notice(
+ __( 'This widget requires JavaScript.' ),
+ array(
+ 'type' => 'error',
+ 'additional_classes' => array( 'inline', 'hide-if-js' ),
+ )
+ );
if ( empty( $check_urls ) ) {
$widgets = get_option( 'dashboard_widget_options' );
@@ -1208,10 +1246,9 @@
}
/**
- * The RSS dashboard widget control.
+ * Sets up the RSS dashboard widget control and $args to be used as input to wp_widget_rss_form().
*
- * Sets up $args to be used as input to wp_widget_rss_form(). Handles POST data
- * from RSS-type widgets.
+ * Handles POST data from RSS-type widgets.
*
* @since 2.5.0
*
@@ -1278,10 +1315,10 @@
<p class="community-events-footer">
<?php
printf(
- '<a href="%1$s" target="_blank">%2$s <span class="screen-reader-text">%3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a>',
+ '<a href="%1$s" target="_blank">%2$s <span class="screen-reader-text"> %3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a>',
'https://make.wordpress.org/community/meetups-landing-page',
__( 'Meetups' ),
- /* translators: Accessibility text. */
+ /* translators: Hidden accessibility text. */
__( '(opens in a new tab)' )
);
?>
@@ -1290,10 +1327,10 @@
<?php
printf(
- '<a href="%1$s" target="_blank">%2$s <span class="screen-reader-text">%3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a>',
+ '<a href="%1$s" target="_blank">%2$s <span class="screen-reader-text"> %3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a>',
'https://central.wordcamp.org/schedule/',
__( 'WordCamps' ),
- /* translators: Accessibility text. */
+ /* translators: Hidden accessibility text. */
__( '(opens in a new tab)' )
);
?>
@@ -1302,11 +1339,11 @@
<?php
printf(
- '<a href="%1$s" target="_blank">%2$s <span class="screen-reader-text">%3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a>',
+ '<a href="%1$s" target="_blank">%2$s <span class="screen-reader-text"> %3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a>',
/* translators: If a Rosetta site exists (e.g. https://es.wordpress.org/news/), then use that. Otherwise, leave untranslated. */
esc_url( _x( 'https://wordpress.org/news/', 'Events and News dashboard widget' ) ),
__( 'News' ),
- /* translators: Accessibility text. */
+ /* translators: Hidden accessibility text. */
__( '(opens in a new tab)' )
);
?>
@@ -1321,25 +1358,19 @@
* @since 4.8.0
*/
function wp_print_community_events_markup() {
- ?>
-
- <div class="community-events-errors notice notice-error inline hide-if-js">
- <p class="hide-if-js">
- <?php _e( 'This widget requires JavaScript.' ); ?>
- </p>
+ $community_events_notice = '<p class="hide-if-js">' . ( 'This widget requires JavaScript.' ) . '</p>';
+ $community_events_notice .= '<p class="community-events-error-occurred" aria-hidden="true">' . __( 'An error occurred. Please try again.' ) . '</p>';
+ $community_events_notice .= '<p class="community-events-could-not-locate" aria-hidden="true"></p>';
- <p class="community-events-error-occurred" aria-hidden="true">
- <?php _e( 'An error occurred. Please try again.' ); ?>
- </p>
+ wp_admin_notice(
+ $community_events_notice,
+ array(
+ 'type' => 'error',
+ 'additional_classes' => array( 'community-events-errors', 'inline', 'hide-if-js' ),
+ 'paragraph_wrap' => false,
+ )
+ );
- <p class="community-events-could-not-locate" aria-hidden="true"></p>
- </div>
-
- <div class="community-events-loading hide-if-no-js">
- <?php _e( 'Loading…' ); ?>
- </div>
-
- <?php
/*
* Hide the main element when the page first loads, because the content
* won't be ready until wp.communityEvents.renderEventsTemplate() has run.
@@ -1427,6 +1458,15 @@
<div class="dashicons event-icon" aria-hidden="true"></div>
<div class="event-info-inner">
<a class="event-title" href="{{ event.url }}">{{ event.title }}</a>
+ <# if ( event.type ) {
+ const titleCaseEventType = event.type.replace(
+ /\w\S*/g,
+ function ( type ) { return type.charAt(0).toUpperCase() + type.substr(1).toLowerCase(); }
+ );
+ #>
+ {{ 'wordcamp' === event.type ? 'WordCamp' : titleCaseEventType }}
+ <span class="ce-separator"></span>
+ <# } #>
<span class="event-city">{{ event.location.location }}</span>
</div>
</div>
@@ -1532,7 +1572,11 @@
*
* @param string $link The widget's secondary link URL.
*/
- 'link' => apply_filters( 'dashboard_secondary_link', __( 'https://planet.wordpress.org/' ) ),
+ 'link' => apply_filters(
+ 'dashboard_secondary_link',
+ /* translators: Link to the Planet website of the locale. */
+ __( 'https://planet.wordpress.org/' )
+ ),
/**
* Filters the secondary feed URL for the 'WordPress Events and News' dashboard widget.
@@ -1541,7 +1585,11 @@
*
* @param string $url The widget's secondary feed URL.
*/
- 'url' => apply_filters( 'dashboard_secondary_feed', __( 'https://planet.wordpress.org/feed/' ) ),
+ 'url' => apply_filters(
+ 'dashboard_secondary_feed',
+ /* translators: Link to the Planet feed of the locale. */
+ __( 'https://planet.wordpress.org/feed/' )
+ ),
/**
* Filters the secondary link title for the 'WordPress Events and News' dashboard widget.
@@ -1628,9 +1676,10 @@
number_format_i18n( $quota )
);
printf(
- '<a href="%1$s">%2$s <span class="screen-reader-text">(%3$s)</span></a>',
+ '<a href="%1$s">%2$s<span class="screen-reader-text"> (%3$s)</span></a>',
esc_url( admin_url( 'upload.php' ) ),
$text,
+ /* translators: Hidden accessibility text. */
__( 'Manage Uploads' )
);
?>
@@ -1643,9 +1692,10 @@
$percentused
);
printf(
- '<a href="%1$s" class="musublink">%2$s <span class="screen-reader-text">(%3$s)</span></a>',
+ '<a href="%1$s" class="musublink">%2$s<span class="screen-reader-text"> (%3$s)</span></a>',
esc_url( admin_url( 'upload.php' ) ),
$text,
+ /* translators: Hidden accessibility text. */
__( 'Manage Uploads' )
);
?>
@@ -1729,7 +1779,7 @@
*
* @param string $notice The notice content.
* @param array|false $response An array containing web browser information, or
- * false on failure. See `wp_check_browser_version()`.
+ * false on failure. See wp_check_browser_version().
*/
echo apply_filters( 'browse-happy-notice', $notice, $response ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
}
@@ -1825,39 +1875,58 @@
}
if ( isset( $response['is_secure'] ) && ! $response['is_secure'] ) {
- $msg = sprintf(
+ // The `is_secure` array key name doesn't actually imply this is a secure version of PHP. It only means it receives security updates.
+
+ if ( $response['is_lower_than_future_minimum'] ) {
+ $message = sprintf(
+ /* translators: %s: The server PHP version. */
+ __( 'Your site is running on an outdated version of PHP (%s), which does not receive security updates and soon will not be supported by WordPress. Ensure that PHP is updated on your server as soon as possible. Otherwise you will not be able to upgrade WordPress.' ),
+ PHP_VERSION
+ );
+ } else {
+ $message = sprintf(
+ /* translators: %s: The server PHP version. */
+ __( 'Your site is running on an outdated version of PHP (%s), which does not receive security updates. It should be updated.' ),
+ PHP_VERSION
+ );
+ }
+ } elseif ( $response['is_lower_than_future_minimum'] ) {
+ $message = sprintf(
/* translators: %s: The server PHP version. */
- __( 'Your site is running an insecure version of PHP (%s), which should be updated.' ),
+ __( 'Your site is running on an outdated version of PHP (%s), which soon will not be supported by WordPress. Ensure that PHP is updated on your server as soon as possible. Otherwise you will not be able to upgrade WordPress.' ),
PHP_VERSION
);
} else {
- $msg = sprintf(
+ $message = sprintf(
/* translators: %s: The server PHP version. */
- __( 'Your site is running an outdated version of PHP (%s), which should be updated.' ),
+ __( 'Your site is running on an outdated version of PHP (%s), which should be updated.' ),
PHP_VERSION
);
}
?>
- <p><?php echo $msg; ?></p>
+ <p class="bigger-bolder-text"><?php echo $message; ?></p>
- <h3><?php _e( 'What is PHP and how does it affect my site?' ); ?></h3>
+ <p><?php _e( 'What is PHP and how does it affect my site?' ); ?></p>
<p>
+ <?php _e( 'PHP is one of the programming languages used to build WordPress. Newer versions of PHP receive regular security updates and may increase your site’s performance.' ); ?>
<?php
- printf(
- /* translators: %s: The minimum recommended PHP version. */
- __( 'PHP is the programming language used to build and maintain WordPress. Newer versions of PHP are created with increased performance in mind, so you may see a positive effect on your site’s performance. The minimum recommended version of PHP is %s.' ),
- $response ? $response['recommended_version'] : ''
- );
+ if ( ! empty( $response['recommended_version'] ) ) {
+ printf(
+ /* translators: %s: The minimum recommended PHP version. */
+ __( 'The minimum recommended version of PHP is %s.' ),
+ $response['recommended_version']
+ );
+ }
?>
</p>
<p class="button-container">
<?php
printf(
- '<a class="button button-primary" href="%1$s" target="_blank" rel="noopener">%2$s <span class="screen-reader-text">%3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a>',
+ '<a class="button button-primary" href="%1$s" target="_blank" rel="noopener">%2$s<span class="screen-reader-text"> %3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a>',
esc_url( wp_get_update_php_url() ),
__( 'Learn more about updating PHP' ),
- /* translators: Accessibility text. */
+ /* translators: Hidden accessibility text. */
__( '(opens in a new tab)' )
);
?>
@@ -1879,8 +1948,14 @@
function dashboard_php_nag_class( $classes ) {
$response = wp_check_php_version();
- if ( $response && isset( $response['is_secure'] ) && ! $response['is_secure'] ) {
- $classes[] = 'php-insecure';
+ if ( ! $response ) {
+ return $classes;
+ }
+
+ if ( isset( $response['is_secure'] ) && ! $response['is_secure'] ) {
+ $classes[] = 'php-no-security-updates';
+ } elseif ( $response['is_lower_than_future_minimum'] ) {
+ $classes[] = 'php-version-lower-than-future-minimum';
}
return $classes;
@@ -1913,7 +1988,7 @@
<div class="health-check-widget">
<div class="health-check-widget-title-section site-health-progress-wrapper loading hide-if-no-js">
<div class="site-health-progress">
- <svg role="img" aria-hidden="true" focusable="false" width="100%" height="100%" viewBox="0 0 200 200" version="1.1" xmlns="http://www.w3.org/2000/svg">
+ <svg aria-hidden="true" focusable="false" width="100%" height="100%" viewBox="0 0 200 200" version="1.1" xmlns="http://www.w3.org/2000/svg">
<circle r="90" cx="100" cy="100" fill="transparent" stroke-dasharray="565.48" stroke-dashoffset="0"></circle>
<circle id="bar" r="90" cx="100" cy="100" fill="transparent" stroke-dasharray="565.48" stroke-dashoffset="0"></circle>
</svg>
@@ -1977,7 +2052,9 @@
}
/**
- * Empty function usable by plugins to output empty dashboard widget (to be populated later by JS).
+ * Outputs empty dashboard widget to be populated by JS later.
+ *
+ * Usable by plugins.
*
* @since 2.5.0
*/
@@ -1997,7 +2074,7 @@
<div class="welcome-panel-content">
<div class="welcome-panel-header">
<div class="welcome-panel-header-image">
- <?php echo file_get_contents( dirname( __DIR__ ) . '/images/about-header-about.svg' ); ?>
+ <?php echo file_get_contents( dirname( __DIR__ ) . '/images/dashboard-background.svg' ); ?>
</div>
<h2><?php _e( 'Welcome to WordPress!' ); ?></h2>
<p>
@@ -2011,7 +2088,10 @@
</div>
<div class="welcome-panel-column-container">
<div class="welcome-panel-column">
- <div class="welcome-panel-icon-pages"></div>
+ <svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false">
+ <rect width="48" height="48" rx="4" fill="#1E1E1E"/>
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M32.0668 17.0854L28.8221 13.9454L18.2008 24.671L16.8983 29.0827L21.4257 27.8309L32.0668 17.0854ZM16 32.75H24V31.25H16V32.75Z" fill="white"/>
+ </svg>
<div class="welcome-panel-column-content">
<h3><?php _e( 'Author rich content with blocks and patterns' ); ?></h3>
<p><?php _e( 'Block patterns are pre-configured block layouts. Use them to get inspired or create new pages in a flash.' ); ?></p>
@@ -2019,7 +2099,10 @@
</div>
</div>
<div class="welcome-panel-column">
- <div class="welcome-panel-icon-layout"></div>
+ <svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false">
+ <rect width="48" height="48" rx="4" fill="#1E1E1E"/>
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M18 16h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H18a2 2 0 0 1-2-2V18a2 2 0 0 1 2-2zm12 1.5H18a.5.5 0 0 0-.5.5v3h13v-3a.5.5 0 0 0-.5-.5zm.5 5H22v8h8a.5.5 0 0 0 .5-.5v-7.5zm-10 0h-3V30a.5.5 0 0 0 .5.5h2.5v-8z" fill="#fff"/>
+ </svg>
<div class="welcome-panel-column-content">
<?php if ( $is_block_theme ) : ?>
<h3><?php _e( 'Customize your entire site with block themes' ); ?></h3>
@@ -2035,16 +2118,19 @@
</div>
</div>
<div class="welcome-panel-column">
- <div class="welcome-panel-icon-styles"></div>
+ <svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false">
+ <rect width="48" height="48" rx="4" fill="#1E1E1E"/>
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M31 24a7 7 0 0 1-7 7V17a7 7 0 0 1 7 7zm-7-8a8 8 0 1 1 0 16 8 8 0 0 1 0-16z" fill="#fff"/>
+ </svg>
<div class="welcome-panel-column-content">
<?php if ( $is_block_theme ) : ?>
<h3><?php _e( 'Switch up your site’s look & feel with Styles' ); ?></h3>
<p><?php _e( 'Tweak your site, or give it a whole new look! Get creative — how about a new color palette or font?' ); ?></p>
- <a href="<?php echo esc_url( admin_url( 'site-editor.php?styles=open' ) ); ?>"><?php _e( 'Edit styles' ); ?></a>
+ <a href="<?php echo esc_url( admin_url( '/site-editor.php?path=%2Fwp_global_styles' ) ); ?>"><?php _e( 'Edit styles' ); ?></a>
<?php else : ?>
<h3><?php _e( 'Discover a new way to build your site.' ); ?></h3>
<p><?php _e( 'There is a new kind of WordPress theme, called a block theme, that lets you build the site you’ve always wanted — with blocks and styles.' ); ?></p>
- <a href="<?php echo esc_url( __( 'https://wordpress.org/support/article/block-themes/' ) ); ?>"><?php _e( 'Learn about block themes' ); ?></a>
+ <a href="<?php echo esc_url( __( 'https://wordpress.org/documentation/article/block-themes/' ) ); ?>"><?php _e( 'Learn about block themes' ); ?></a>
<?php endif; ?>
</div>
</div>