diff --git a/wp-admin/includes/class-bulk-upgrader-skin.php b/wp-admin/includes/class-bulk-upgrader-skin.php index 8ce4a70ff7..461311962d 100644 --- a/wp-admin/includes/class-bulk-upgrader-skin.php +++ b/wp-admin/includes/class-bulk-upgrader-skin.php @@ -143,10 +143,16 @@ class Bulk_Upgrader_Skin extends WP_Upgrader_Skin { echo '

'; if ( $this->error || ! $this->result ) { if ( $this->error ) { - echo '

' . sprintf( $this->upgrader->strings['skin_update_failed_error'], $title, '' . $this->error . '' ) . '

'; + $after_error_message = sprintf( $this->upgrader->strings['skin_update_failed_error'], $title, '' . $this->error . '' ); } else { - echo '

' . sprintf( $this->upgrader->strings['skin_update_failed'], $title ) . '

'; + $after_error_message = sprintf( $this->upgrader->strings['skin_update_failed'], $title ); } + wp_admin_notice( + $after_error_message, + array( + 'additional_classes' => array( 'error' ), + ) + ); echo ''; } diff --git a/wp-admin/includes/class-custom-background.php b/wp-admin/includes/class-custom-background.php index a2be358e77..b818016b28 100644 --- a/wp-admin/includes/class-custom-background.php +++ b/wp-admin/includes/class-custom-background.php @@ -256,16 +256,20 @@ class Custom_Background { } if ( ! empty( $this->updated ) ) { - ?> -
-

- Visit your site to see how it looks.' ), esc_url( home_url( '/' ) ) ); - ?> -

-
- + $updated_message = sprintf( + /* translators: %s: Home URL. */ + __( 'Background updated. Visit your site to see how it looks.' ), + esc_url( home_url( '/' ) ) + ); + wp_admin_notice( + $updated_message, + array( + 'id' => 'message', + 'additional_classes' => array( 'updated' ), + ) + ); + } + ?>

diff --git a/wp-admin/includes/class-custom-image-header.php b/wp-admin/includes/class-custom-image-header.php index 5d0260b1c3..9df725af0c 100644 --- a/wp-admin/includes/class-custom-image-header.php +++ b/wp-admin/includes/class-custom-image-header.php @@ -524,18 +524,22 @@ class Custom_Image_Header { ) ); } - ?> - updated ) ) { ?> -
-

- Visit your site to see how it looks.' ), esc_url( home_url( '/' ) ) ); - ?> -

-
- + if ( ! empty( $this->updated ) ) { + $updated_message = sprintf( + /* translators: %s: Home URL. */ + __( 'Header updated. Visit your site to see how it looks.' ), + esc_url( home_url( '/' ) ) + ); + wp_admin_notice( + $updated_message, + array( + 'id' => 'message', + 'additional_classes' => array( 'updated' ), + ) + ); + } + ?>

diff --git a/wp-admin/includes/class-wp-plugin-install-list-table.php b/wp-admin/includes/class-wp-plugin-install-list-table.php index 330a35e624..7823f00b70 100644 --- a/wp-admin/includes/class-wp-plugin-install-list-table.php +++ b/wp-admin/includes/class-wp-plugin-install-list-table.php @@ -290,10 +290,17 @@ class WP_Plugin_Install_List_Table extends WP_List_Table { /** */ public function no_items() { - if ( isset( $this->error ) ) { ?> -

error->get_error_message(); ?>

-

-
+ if ( isset( $this->error ) ) { + $error_message = '

' . $this->error->get_error_message() . '

'; + $error_message .= '

'; + wp_admin_notice( + $error_message, + array( + 'additional_classes' => array( 'inline', 'error' ), + 'paragraph_wrap' => false, + ) + ); + ?>
' . '' . - '

', esc_attr( $this->get_column_count() ) ); + $incompatible_message = ''; if ( ! $compatible_php && ! $compatible_wp ) { - _e( 'This plugin does not work with your versions of WordPress and PHP.' ); + $incompatible_message .= __( 'This plugin does not work with your versions of WordPress and PHP.' ); if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) { - printf( + $incompatible_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( '

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

', '', false ); } elseif ( current_user_can( 'update_core' ) ) { - printf( + $incompatible_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( + $incompatible_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( '

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

', '', false ); } } elseif ( ! $compatible_wp ) { - _e( 'This plugin does not work with your version of WordPress.' ); + $incompatible_message .= __( 'This plugin does not work with your version of WordPress.' ); if ( current_user_can( 'update_core' ) ) { - printf( + $incompatible_message .= sprintf( /* translators: %s: URL to WordPress Updates screen. */ ' ' . __( 'Please update WordPress.' ), self_admin_url( 'update-core.php' ) ); } } elseif ( ! $compatible_php ) { - _e( 'This plugin does not work with your version of PHP.' ); + $incompatible_message .= __( 'This plugin does not work with your version of PHP.' ); if ( current_user_can( 'update_php' ) ) { - printf( + $incompatible_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( '

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

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

'; + wp_admin_notice( + $incompatible_message, + array( + 'type' => 'error', + 'additional_classes' => array( 'notice-alt', 'inline', 'update-message' ), + ) + ); + + echo ''; } /** diff --git a/wp-admin/includes/class-wp-privacy-policy-content.php b/wp-admin/includes/class-wp-privacy-policy-content.php index 31f776f09c..a64d043233 100644 --- a/wp-admin/includes/class-wp-privacy-policy-content.php +++ b/wp-admin/includes/class-wp-privacy-policy-content.php @@ -138,19 +138,20 @@ final class WP_Privacy_Policy_Content { return; } - ?> -
-

- review the guide and update your privacy policy.' ), - esc_url( admin_url( 'privacy-policy-guide.php?tab=policyguide' ) ) - ); - ?> -

-
- review the guide and update your privacy policy.' ), + esc_url( admin_url( 'privacy-policy-guide.php?tab=policyguide' ) ) + ); + + wp_admin_notice( + $privacy_message, + array( + 'type' => 'warning', + 'additional_classes' => array( 'policy-text-updated' ), + 'dismissible' => true, + ) + ); } /** diff --git a/wp-admin/includes/dashboard.php b/wp-admin/includes/dashboard.php index a92b684818..f74b408881 100644 --- a/wp-admin/includes/dashboard.php +++ b/wp-admin/includes/dashboard.php @@ -573,9 +573,16 @@ function wp_dashboard_quick_press( $error_msg = false ) {
- -
- + array( 'error' ), + ) + ); + } + ?>
'; require_once ABSPATH . 'wp-admin/admin-footer.php'; die(); @@ -142,7 +151,13 @@ function network_step1( $errors = false ) { $hostname = get_clean_basedomain(); $has_ports = strstr( $hostname, ':' ); if ( ( false !== $has_ports && ! in_array( $has_ports, array( ':80', ':443' ), true ) ) ) { - echo '

' . __( 'Error:' ) . ' ' . __( 'You cannot install a network of sites with your server address.' ) . '

'; + wp_admin_notice( + '' . __( 'Error:' ) . ' ' . __( 'You cannot install a network of sites with your server address.' ), + array( + 'additional_classes' => array( 'error' ), + ) + ); + echo '

' . sprintf( /* translators: %s: Port number. */ __( 'You cannot use port numbers such as %s.' ), @@ -160,11 +175,17 @@ function network_step1( $errors = false ) { $error_codes = array(); if ( is_wp_error( $errors ) ) { - echo '

' . __( 'Error: The network could not be created.' ) . '

'; + $network_created_error_message = '

' . __( 'Error: The network could not be created.' ) . '

'; foreach ( $errors->get_error_messages() as $error ) { - echo "

$error

"; + $network_created_error_message .= "

$error

"; } - echo '
'; + wp_admin_notice( + $network_created_error_message, + array( + 'additional_classes' => array( 'error' ), + 'paragraph_wrap' => false, + ) + ); $error_codes = $errors->get_error_codes(); } @@ -195,33 +216,39 @@ function network_step1( $errors = false ) { $subdomain_install = false; $got_mod_rewrite = got_mod_rewrite(); if ( $got_mod_rewrite ) { // Dangerous assumptions. - echo '

' . __( 'Note:' ) . ' '; - printf( + $message_class = 'updated'; + $message = '

' . __( 'Warning:' ) . ' '; + $message .= '

' . sprintf( /* translators: %s: mod_rewrite */ __( 'Please make sure the Apache %s module is installed as it will be used at the end of this installation.' ), 'mod_rewrite' - ); - echo '

'; + ) . '

'; } elseif ( $is_apache ) { - echo '

' . __( 'Warning:' ) . ' '; - printf( + $message_class = 'error'; + $message = '

' . __( 'Warning:' ) . ' '; + $message .= sprintf( /* translators: %s: mod_rewrite */ __( 'It looks like the Apache %s module is not installed.' ), 'mod_rewrite' - ); - echo '

'; + ) . '

'; } if ( $got_mod_rewrite || $is_apache ) { // Protect against mod_rewrite mimicry (but ! Apache). - echo '

'; - printf( + $message .= '

' . sprintf( /* translators: 1: mod_rewrite, 2: mod_rewrite documentation URL, 3: Google search for mod_rewrite. */ __( 'If %1$s is disabled, ask your administrator to enable that module, or look at the Apache documentation or elsewhere for help setting it up.' ), 'mod_rewrite', 'https://httpd.apache.org/docs/mod/mod_rewrite.html', 'https://www.google.com/search?q=apache+mod_rewrite' + ) . '

'; + + wp_admin_notice( + $message, + array( + 'additional_classes' => array( $message_class, 'inline' ), + 'paragraph_wrap' => false, + ) ); - echo '

'; } } @@ -263,7 +290,14 @@ function network_step1( $errors = false ) { endif; if ( WP_CONTENT_DIR !== ABSPATH . 'wp-content' && ( allow_subdirectory_install() || ! allow_subdomain_install() ) ) { - echo '

' . __( 'Warning:' ) . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '

'; + $subdirectory_warning_message = '' . __( 'Warning:' ) . ' '; + $subdirectory_warning_message .= __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ); + wp_admin_notice( + $subdirectory_warning_message, + array( + 'additional_classes' => array( 'error', 'inline' ), + ) + ); } $is_www = str_starts_with( $hostname, 'www.' ); @@ -409,7 +443,12 @@ function network_step2( $errors = false ) { // Wildcard DNS message. if ( is_wp_error( $errors ) ) { - echo '
' . $errors->get_error_message() . '
'; + wp_admin_notice( + $errors->get_error_message(), + array( + 'additional_classes' => array( 'error' ), + ) + ); } if ( $_POST ) { @@ -426,8 +465,14 @@ function network_step2( $errors = false ) { get_var( "SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = 1 AND meta_key = 'subdomain_install'" ); + + wp_admin_notice( + '' . __( 'Warning:' ) . ' ' . __( 'An existing WordPress network was detected.' ), + array( + 'additional_classes' => array( 'error' ), + ) + ); ?> -

-

-

- ' . __( 'Before you can upload your import file, you will need to fix the following error:' ) . '

'; + $upload_directory_error .= '

' . $upload_dir['error'] . '

'; + wp_admin_notice( + $upload_directory_error, + array( + 'additonal_classes' => array( 'error' ), + 'paragraph_wrap' => false, + ) + ); else : ?> @@ -1434,16 +1439,17 @@ function do_meta_boxes( $screen, $context, $data_object ) { if ( WP_DEBUG && ! $block_compatible && 'edit' === $screen->parent_base && ! $screen->is_block_editor() && ! isset( $_GET['meta-box-loader'] ) ) { $plugin = _get_plugin_from_callback( $box['callback'] ); if ( $plugin ) { - ?> -
-

- {$plugin['Name']}" ); - ?> -

-
- {$plugin['Name']}" + ); + wp_admin_notice( + $meta_box_not_compatible_message, + array( + 'additional_classes' => array( 'error', 'inline' ), + ) + ); } } @@ -2695,17 +2701,22 @@ function convert_to_screen( $hook_name ) { * @access private */ function _local_storage_notice() { - ?> - - '; + $local_storage_message .= __( 'The backup of this post in your browser is different from the version below.' ); + $local_storage_message .= '

'; + $local_storage_message .= '

'; + $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.' ); + $local_storage_message .= '

'; + + wp_admin_notice( + $local_storage_message, + array( + 'id' => 'local-storage-notice', + 'additional_classes' => array( 'hidden' ), + 'dismissible' => true, + 'paragraph_wrap' => false, + ) + ); } /** diff --git a/wp-admin/includes/update.php b/wp-admin/includes/update.php index d4628f531f..2d3ccfbbb3 100644 --- a/wp-admin/includes/update.php +++ b/wp-admin/includes/update.php @@ -342,7 +342,14 @@ function update_nag() { ); } - echo "
$msg
"; + wp_admin_notice( + $msg, + array( + 'type' => 'warning', + 'additonal_classes' => array( 'update-nag', 'inline' ), + 'paragraph_wrap' => false, + ) + ); } /** @@ -884,7 +891,14 @@ function maintenance_nag() { $msg = __( 'An automated WordPress update has failed to complete! Please notify the site administrator.' ); } - echo "
$msg
"; + wp_admin_notice( + $msg, + array( + 'type' => 'warning', + 'additional_classes' => array( 'update-nag', 'inline' ), + 'paragraph_wrap' => false, + ) + ); } /** diff --git a/wp-admin/includes/user.php b/wp-admin/includes/user.php index 1d2d919348..e19727401d 100644 --- a/wp-admin/includes/user.php +++ b/wp-admin/includes/user.php @@ -535,28 +535,30 @@ function default_password_nag() { if ( 'profile.php' === $pagenow || ! get_user_option( 'default_password_nag' ) ) { return; } - ?> -
-

- - -

-

- %2$s | ', - esc_url( get_edit_profile_url() . '#password' ), - __( 'Yes, take me to my profile page' ) - ); - printf( - '%2$s', - '?default_password_nag=0', - __( 'No thanks, do not remind me again' ) - ); - ?> -

-
- %1$s %2$s

', + __( 'Notice:' ), + __( 'You are using the auto-generated password for your account. Would you like to change it?' ) + ); + $default_password_nag_message .= sprintf( + '

%2$s | ', + esc_url( get_edit_profile_url() . '#password' ), + __( 'Yes, take me to my profile page' ) + ); + $default_password_nag_message .= sprintf( + '%2$s

', + '?default_password_nag=0', + __( 'No thanks, do not remind me again' ) + ); + + wp_admin_notice( + $default_password_nag_message, + array( + 'additional_classes' => array( 'error', 'default-password-nag' ), + 'paragraph_wrap' => false, + ) + ); } /** diff --git a/wp-includes/version.php b/wp-includes/version.php index 44c3dff68b..1a3388a73a 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.4-alpha-56598'; +$wp_version = '6.4-alpha-56599'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.