diff --git a/wp-admin/authorize-application.php b/wp-admin/authorize-application.php index 1eabb96335..8d931f4666 100644 --- a/wp-admin/authorize-application.php +++ b/wp-admin/authorize-application.php @@ -137,9 +137,16 @@ require_once ABSPATH . 'wp-admin/admin-header.php';

- -

get_error_message(); ?>

- + get_error_message(), + array( + 'type' => 'error', + ) + ); + } + ?>

@@ -194,24 +201,25 @@ require_once ABSPATH . 'wp-admin/admin-header.php'; } ?> - -
-

- - -

-

-
+ + + +

+

' . __( 'Be sure to save this in a safe location. You will not be able to retrieve it.' ) . '

'; + $args = array( + 'type' => 'success', + 'additional_classes' => array( 'notice-alt', 'below-h2' ), + 'paragraph_wrap' => false, + ); + wp_admin_notice( $message, $args ); - -
diff --git a/wp-admin/comment.php b/wp-admin/comment.php index ccb72c0910..349a32a43e 100644 --- a/wp-admin/comment.php +++ b/wp-admin/comment.php @@ -161,11 +161,23 @@ switch ( $action ) { break; } if ( $message ) { - echo '

' . $message . '

'; + wp_admin_notice( + $message, + array( + 'type' => 'info', + 'id' => 'message', + ) + ); } } + wp_admin_notice( + '' . __( 'Caution:' ) . ' ' . $caution_msg, + array( + 'type' => 'warning', + 'id' => 'message', + ) + ); ?> -

diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php index 12344df3ba..fd3bfb2165 100644 --- a/wp-admin/edit-form-advanced.php +++ b/wp-admin/edit-form-advanced.php @@ -440,12 +440,29 @@ if ( isset( $post_new_file ) && current_user_can( $post_type_object->cap->create
- -

- - -

- +' . $notice . '

', + array( + 'type' => 'warning', + 'id' => 'notice', + 'paragraph_wrap' => false, + ) + ); +endif; +if ( $message ) : + wp_admin_notice( + $message, + array( + 'type' => 'success', + 'dismissible' => true, + 'id' => 'message', + 'additional_classes' => array( 'updated' ), + ) + ); +endif; +?> diff --git a/wp-admin/edit-tag-form.php b/wp-admin/edit-tag-form.php index 494c15547b..8126f84556 100644 --- a/wp-admin/edit-tag-form.php +++ b/wp-admin/edit-tag-form.php @@ -79,16 +79,18 @@ do_action( "{$taxonomy}_pre_edit_form", $tag, $taxonomy ); ?> $class = ( isset( $msg ) && 5 === $msg ) ? 'error' : 'success'; if ( $message ) { - ?> - - ' . $message . '

'; + if ( $wp_http_referer ) { + $message .= '

' . esc_html( $tax->labels->back_to_items ) . '

'; + } + wp_admin_notice( + $message, + array( + 'type' => $class, + 'id' => 'message', + 'paragraph_wrap' => false, + ) + ); } ?> diff --git a/wp-admin/index.php b/wp-admin/index.php index 7278cfbf37..de5cc21b8f 100644 --- a/wp-admin/index.php +++ b/wp-admin/index.php @@ -154,20 +154,21 @@ require_once ABSPATH . 'wp-admin/admin-header.php'; // Only show the dashboard notice if it's been less than a minute since the message was postponed. if ( $time_passed < MINUTE_IN_SECONDS ) : - ?> -
-

- -

-
- - + $message = sprintf( + /* translators: %s: Human-readable time interval. */ + __( 'The admin email verification page will reappear after %s.' ), + human_time_diff( time() + $remind_interval ) + ); + wp_admin_notice( + $message, + array( + 'type' => 'success', + 'dismissible' => true, + ) + ); + endif; + endif; + ?> -
-

-
+ 'error', + 'additional_classes' => array( 'hide-if-js' ), + ) +); +?>

diff --git a/wp-admin/options-reading.php b/wp-admin/options-reading.php index 0bd1667b74..c2ee28d518 100644 --- a/wp-admin/options-reading.php +++ b/wp-admin/options-reading.php @@ -144,12 +144,28 @@ else : ?> - -

Warning: these pages should not be the same!' ); ?>

- - -

Warning: these pages should not be the same as your Privacy Policy page!' ); ?>

- + Warning: these pages should not be the same!' ), + array( + 'type' => 'warning', + 'id' => 'front-page-warning', + 'additional_classes' => array( 'inline' ), + ) + ); + endif; + if ( get_option( 'wp_page_for_privacy_policy' ) === get_option( 'page_for_posts' ) || get_option( 'wp_page_for_privacy_policy' ) === get_option( 'page_on_front' ) ) : + wp_admin_notice( + __( 'Warning: these pages should not be the same as your Privacy Policy page!' ), + array( + 'type' => 'warning', + 'id' => 'privacy-policy-page-warning', + 'additional_classes' => array( 'inline' ), + ) + ); + endif; + ?>
diff --git a/wp-admin/options.php b/wp-admin/options.php index df872f4731..a8c7497ed8 100644 --- a/wp-admin/options.php +++ b/wp-admin/options.php @@ -359,10 +359,14 @@ require_once ABSPATH . 'wp-admin/admin-header.php';

-
-

-
- + ' . __( 'Warning:' ) . ' ' . __( 'This page allows direct access to your site settings. You can break things here. Please be cautious!' ), + array( + 'type' => 'warning', + ) + ); + ?> diff --git a/wp-admin/plugin-editor.php b/wp-admin/plugin-editor.php index 1b0b714c32..fce25ea75c 100644 --- a/wp-admin/plugin-editor.php +++ b/wp-admin/plugin-editor.php @@ -182,16 +182,29 @@ $content = esc_textarea( $content );

- -
-

-
- -
-

-
get_error_message() ? $edit_error->get_error_message() : $edit_error->get_error_code() ); ?>
-
- + array( 'updated', 'is-dismissible' ), + 'id' => 'message', + ) + ); +elseif ( is_wp_error( $edit_error ) ) : + $error = esc_html( $edit_error->get_error_message() ? $edit_error->get_error_message() : $edit_error->get_error_code() ); + $message = '

' . __( 'There was an error while trying to update the file. You may need to fix something and try updating again.' ) . '

+
' . $error . '
'; + wp_admin_notice( + $message, + array( + 'type' => 'error', + 'id' => 'message', + 'paragraph_wrap' => false, + ) + ); +endif; +?>
@@ -280,11 +293,17 @@ $content = esc_textarea( $content );
- -
-

Warning: Making changes to active plugins is not recommended.' ); ?>

-
- + Warning: Making changes to active plugins is not recommended.' ), + array( + 'type' => 'warning', + 'additional_classes' => array( 'inline', 'active-plugin-edit-warning' ), + ) + ); + } + ?>

diff --git a/wp-admin/privacy-policy-guide.php b/wp-admin/privacy-policy-guide.php index b8f303aa7f..cf0c41f7a4 100644 --- a/wp-admin/privacy-policy-guide.php +++ b/wp-admin/privacy-policy-guide.php @@ -60,9 +60,15 @@ require_once ABSPATH . 'wp-admin/admin-header.php';


-
-

-
+ 'error', + 'additional_classes' => array( 'hide-if-js' ), + ) +); +?>

diff --git a/wp-admin/site-editor.php b/wp-admin/site-editor.php index 2da7222d7c..6442ee562b 100644 --- a/wp-admin/site-editor.php +++ b/wp-admin/site-editor.php @@ -160,22 +160,25 @@ require_once ABSPATH . 'wp-admin/admin-header.php';

-
-

- -

-
+ 'error', + 'additional_classes' => array( 'hide-if-js' ), + ) + ); + ?>
diff --git a/wp-admin/site-health-info.php b/wp-admin/site-health-info.php index 7676a8dc90..46b329adb6 100644 --- a/wp-admin/site-health-info.php +++ b/wp-admin/site-health-info.php @@ -18,11 +18,15 @@ if ( ! class_exists( 'WP_Site_Health' ) ) { } $health_check_site_status = WP_Site_Health::get_instance(); -?> -
-

-
+wp_admin_notice( + __( 'The Site Health check requires JavaScript.' ), + array( + 'type' => 'error', + 'additional_classes' => array( 'hide-if-js' ), + ) +); +?>
-

- 'success', + 'id' => 'message', + 'dismissible' => true, + ) + ); } else { - ?> -

- 'error', + 'id' => 'message', + 'dismissible' => true, + ) + ); } } ?> @@ -212,12 +222,15 @@ if ( isset( $_GET['tab'] ) && ! empty( $_GET['tab'] ) ) { require_once ABSPATH . 'wp-admin/admin-footer.php'; return; } else { + wp_admin_notice( + __( 'The Site Health check requires JavaScript.' ), + array( + 'type' => 'error', + 'additional_classes' => array( 'hide-if-js' ), + ) + ); ?> -
-

-
-

diff --git a/wp-admin/theme-editor.php b/wp-admin/theme-editor.php index 07de6269a7..39bf5cd4fa 100644 --- a/wp-admin/theme-editor.php +++ b/wp-admin/theme-editor.php @@ -189,31 +189,44 @@ if ( $file_description !== $file_show ) {

- -
-

-
- -
-

-
get_error_message() ? $edit_error->get_error_message() : $edit_error->get_error_code() ); ?>
-
- + 'message', + 'is-dismissible' => true, + 'additional_classes' => array( 'updated' ), + ) + ); +} elseif ( is_wp_error( $edit_error ) ) { + $error_code = esc_html( $edit_error->get_error_message() ? $edit_error->get_error_message() : $edit_error->get_error_code() ); + $message = '

' . __( 'There was an error while trying to update the file. You may need to fix something and try updating again.' ) . '

+
' . $error_code . '
'; + wp_admin_notice( + $message, + array( + 'type' => 'error', + 'id' => 'message', + ) + ); +} - -
-

-

- built-in CSS editor.' ), - esc_url( add_query_arg( 'autofocus[section]', 'custom_css', admin_url( 'customize.php' ) ) ) - ); - ?> -

-
- +if ( preg_match( '/\.css$/', $file ) && ! wp_is_block_theme() && current_user_can( 'customize' ) ) { + $message = '

' . __( 'Did you know?' ) . '

' . sprintf( + /* translators: %s: Link to Custom CSS section in the Customizer. */ + __( 'There is no need to change your CSS here — you can edit and live preview CSS changes in the built-in CSS editor.' ), + esc_url( add_query_arg( 'autofocus[section]', 'custom_css', admin_url( 'customize.php' ) ) ) + ) . '

'; + wp_admin_notice( + $message, + array( + 'type' => 'info', + 'id' => 'message', + ) + ); +} +?>
@@ -304,23 +317,30 @@ else :
- get_stylesheet() === get_template() ) : ?> -
-

- - - - -

-
- + get_stylesheet() === get_template() ) : + $message = ( is_writable( $file ) ) ? '' . __( 'Caution:' ) . ' ' : ''; + $message .= __( 'This is a file in your current parent theme.' ); + wp_admin_notice( + $message, + array( + 'type' => 'warning', + 'additional_classes' => array( 'inline' ), + ) + ); + endif; + ?>
- +

- +

- +
@@ -342,7 +364,7 @@ endif; // End if $error.
<# if ( data.installed ) { #> -

+ 'success', + 'additional_classes' => array( 'notice-alt' ), + ) + ); + ?> <# } #> <# if ( ! data.compatible_wp || ! data.compatible_php ) { #> diff --git a/wp-admin/themes.php b/wp-admin/themes.php index c1967e0237..aced47d8b1 100644 --- a/wp-admin/themes.php +++ b/wp-admin/themes.php @@ -469,52 +469,59 @@ foreach ( $themes as $theme ) :

'; + $message = ''; if ( ! $theme['compatibleWP'] && ! $theme['compatiblePHP'] ) { - _e( 'This theme does not work with your versions of WordPress and PHP.' ); + $message = __( 'This theme does not work with your versions of WordPress and PHP.' ); if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) { - printf( + $message .= sprintf( /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */ ' ' . __( 'Please update WordPress, and then learn more about updating PHP.' ), self_admin_url( 'update-core.php' ), esc_url( wp_get_update_php_url() ) ); - wp_update_php_annotation( '

', '' ); + $message .= wp_update_php_annotation( '

', '', false ); } elseif ( current_user_can( 'update_core' ) ) { - printf( + $message .= sprintf( /* translators: %s: URL to WordPress Updates screen. */ ' ' . __( 'Please update WordPress.' ), self_admin_url( 'update-core.php' ) ); } elseif ( current_user_can( 'update_php' ) ) { - printf( + $message .= sprintf( /* translators: %s: URL to Update PHP page. */ ' ' . __( 'Learn more about updating PHP.' ), esc_url( wp_get_update_php_url() ) ); - wp_update_php_annotation( '

', '' ); + $message .= wp_update_php_annotation( '

', '', false ); } } elseif ( ! $theme['compatibleWP'] ) { - _e( 'This theme does not work with your version of WordPress.' ); + $message .= __( 'This theme does not work with your version of WordPress.' ); if ( current_user_can( 'update_core' ) ) { - printf( + $message .= sprintf( /* translators: %s: URL to WordPress Updates screen. */ ' ' . __( 'Please update WordPress.' ), self_admin_url( 'update-core.php' ) ); } } elseif ( ! $theme['compatiblePHP'] ) { - _e( 'This theme does not work with your version of PHP.' ); + $message .= __( 'This theme does not work with your version of PHP.' ); if ( current_user_can( 'update_php' ) ) { - printf( + $message .= sprintf( /* translators: %s: URL to Update PHP page. */ ' ' . __( 'Learn more about updating PHP.' ), esc_url( wp_get_update_php_url() ) ); - wp_update_php_annotation( '

', '' ); + $message .= wp_update_php_annotation( '

', '', false ); } } - echo '

'; + + wp_admin_notice( + $message, + array( + 'type' => 'error', + 'additional_classes' => array( 'inline', 'notice-alt' ), + ) + ); } ?> @@ -692,6 +699,13 @@ if ( ! is_multisite() && $broken_themes ) { * @return string The template for displaying the auto-update setting link. */ function wp_theme_auto_update_setting_template() { + $notice = wp_get_admin_notice( + '', + array( + 'type' => 'error', + 'additional_classes' => array( 'notice-alt', 'inline', 'hidden' ), + ) + ); $template = '
<# if ( data.autoupdate.supported ) { #> @@ -717,7 +731,7 @@ function wp_theme_auto_update_setting_template() { <# } #>
' . wp_get_auto_update_message() . ' <# } #> - + ' . $notice . '
'; diff --git a/wp-admin/update-core.php b/wp-admin/update-core.php index be9708efbf..28f92ca303 100644 --- a/wp-admin/update-core.php +++ b/wp-admin/update-core.php @@ -255,14 +255,19 @@ function core_upgrade_preamble() { _e( 'An updated version of WordPress is available.' ); echo ''; - echo '

'; - printf( + $message = sprintf( /* translators: 1: Documentation on WordPress backups, 2: Documentation on updating WordPress. */ __( 'Important: Before updating, please back up your database and files. For help with updates, visit the Updating WordPress documentation page.' ), __( 'https://wordpress.org/documentation/article/wordpress-backups/' ), __( 'https://wordpress.org/documentation/article/updating-wordpress/' ) ); - echo '

'; + wp_admin_notice( + $message, + array( + 'type' => 'warning', + 'additional_classes' => array( 'inline' ), + ) + ); } elseif ( $is_development_version ) { echo '

' . __( 'You are using a development version of WordPress.' ) . '

'; } else { @@ -302,10 +307,22 @@ function core_auto_updates_settings() { if ( isset( $_GET['core-major-auto-updates-saved'] ) ) { if ( 'enabled' === $_GET['core-major-auto-updates-saved'] ) { $notice_text = __( 'Automatic updates for all WordPress versions have been enabled. Thank you!' ); - echo '

' . $notice_text . '

'; + wp_admin_notice( + $notice_text, + array( + 'type' => 'success', + 'dismissible' => true, + ) + ); } elseif ( 'disabled' === $_GET['core-major-auto-updates-saved'] ) { $notice_text = __( 'WordPress will only receive automatic security and maintenance releases from now on.' ); - echo '

' . $notice_text . '

'; + wp_admin_notice( + $notice_text, + array( + 'type' => 'success', + 'dismissible' => true, + ) + ); } } diff --git a/wp-admin/user-edit.php b/wp-admin/user-edit.php index e9cb68a7ad..554b21ad29 100644 --- a/wp-admin/user-edit.php +++ b/wp-admin/user-edit.php @@ -200,36 +200,57 @@ switch ( $action ) { require_once ABSPATH . 'wp-admin/admin-header.php'; ?> - ID ) && current_user_can( 'manage_network_options' ) ) : ?> -

- + ID ) && current_user_can( 'manage_network_options' ) ) : + $message = '' . __( 'Important:' ) . ' ' . __( 'This user has super admin privileges.' ); + wp_admin_notice( + $message, + array( + 'type' => 'info', + ) + ); + endif; - -
- -

- -

- - -

- -
- + if ( isset( $_GET['updated'] ) ) : + if ( IS_PROFILE_PAGE ) : + $message = '' . __( 'Profile updated.' ) . ''; + else : + $message = '' . __( 'User updated.' ) . ''; + endif; + if ( $wp_http_referer && ! str_contains( $wp_http_referer, 'user-new.php' ) && ! IS_PROFILE_PAGE ) : + $message .= '' . __( '← Go to Users' ) . ''; + endif; + wp_admin_notice( + $message, + array( + 'id' => 'message', + 'dismissible' => true, + 'additional_classes' => array( 'updated' ), + ) + ); + endif; - -
- -

- -
- + if ( isset( $_GET['error'] ) ) : + $message = ''; + if ( 'new-email' === $_GET['error'] ) : + $message = __( 'Error while saving the new email address. Please try again.' ); + endif; + wp_admin_notice( + $message, + array( + 'type' => 'error', + ) + ); + endif; - + if ( isset( $errors ) && is_wp_error( $errors ) ) { + ?>

\n

", $errors->get_error_messages() ); ?>

- +

@@ -802,11 +823,17 @@ switch ( $action ) {

- -
-

-
- + 'error', + 'additional_classes' => array( 'inline' ), + ) + ); + endif; + ?>
`. * @param string $after Markup to output after the annotation. Default `

`. + * @param bool $echo Markup should echo if true. Default `true`. + * + * @return string|void */ -function wp_update_php_annotation( $before = '

', $after = '

' ) { +function wp_update_php_annotation( $before = '

', $after = '

', $echo = true ) { $annotation = wp_get_update_php_annotation(); if ( $annotation ) { - echo $before . $annotation . $after; + if ( $echo ) { + echo $before . $annotation . $after; + } else { + return $before . $annotation . $after; + } } } diff --git a/wp-includes/version.php b/wp-includes/version.php index d69173e34b..fdc352287a 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.4-alpha-56569'; +$wp_version = '6.4-alpha-56570'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.