diff --git a/wp-admin/async-upload.php b/wp-admin/async-upload.php index f0f6dd0070..864f2be654 100644 --- a/wp-admin/async-upload.php +++ b/wp-admin/async-upload.php @@ -113,8 +113,8 @@ if ( isset( $_REQUEST['post_id'] ) ) { $id = media_handle_upload( 'async-upload', $post_id ); if ( is_wp_error( $id ) ) { - printf( - '
%s %s
%s
', + $message = sprintf( + '%s %s
%s', sprintf( '', __( 'Dismiss' ) @@ -126,6 +126,13 @@ if ( is_wp_error( $id ) ) { ), esc_html( $id->get_error_message() ) ); + wp_admin_notice( + $message, + array( + 'additional_classes' => array( 'error-div', 'error' ), + 'paragraph_wrap' => false, + ) + ); exit; } diff --git a/wp-admin/edit-comments.php b/wp-admin/edit-comments.php index 7420942f1c..262e2d9c35 100644 --- a/wp-admin/edit-comments.php +++ b/wp-admin/edit-comments.php @@ -301,7 +301,13 @@ if ( isset( $_REQUEST['error'] ) ) { break; } if ( $error_msg ) { - echo '

' . $error_msg . '

'; + wp_admin_notice( + $error_msg, + array( + 'id' => 'moderated', + 'additional_classes' => array( 'error' ), + ) + ); } } diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php index fd3bfb2165..dc3623606c 100644 --- a/wp-admin/edit-form-advanced.php +++ b/wp-admin/edit-form-advanced.php @@ -462,12 +462,21 @@ if ( $message ) : ) ); endif; + +$connection_lost_message = sprintf( + ' %1$s %2$s', + __( 'Connection lost. Saving has been disabled until you are reconnected.' ), + __( 'This post is being backed up in your browser, just in case.' ) +); + +wp_admin_notice( + $connection_lost_message, + array( + 'id' => 'lost-connection-notice', + 'additional_classes' => array( 'error', 'hidden' ), + ) +); ?> -
- -

- 'message', + 'additional_classes' => array( $class ), + 'dismissible' => true, + ) + ); $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'message', 'error' ), $_SERVER['REQUEST_URI'] ); endif; ?> diff --git a/wp-admin/import.php b/wp-admin/import.php index 7bf1c1a135..c97a31b6ed 100644 --- a/wp-admin/import.php +++ b/wp-admin/import.php @@ -60,16 +60,21 @@ $parent_file = 'tools.php';

- -
-

- ' . esc_html( $_GET['invalid'] ) . '' ); - ?> -

-
- +' . __( 'Error:' ) . ' ' . sprintf( + /* translators: %s: Importer slug. */ + __( 'The %s importer is invalid or is not installed.' ), + '' . esc_html( $_GET['invalid'] ) . '' + ); + wp_admin_notice( + $importer_not_installed, + array( + 'additional_classes' => array( 'error' ), + ) + ); +endif; +?>

$new_menu_title ) ); if ( is_wp_error( $_nav_menu_selected_id ) ) { - $messages[] = '

' . $_nav_menu_selected_id->get_error_message() . '

'; + $messages[] = wp_get_admin_notice( + $_nav_menu_selected_id->get_error_message(), + array( + 'id' => 'message', + 'additional_classes' => array( 'error' ), + 'dismissible' => true, + ) + ); } else { $_menu_object = wp_get_nav_menu_object( $_nav_menu_selected_id ); $nav_menu_selected_id = $_nav_menu_selected_id; @@ -435,7 +442,14 @@ switch ( $action ) { exit; } } else { - $messages[] = '

' . __( 'Please enter a valid menu name.' ) . '

'; + $messages[] = wp_get_admin_notice( + __( 'Please enter a valid menu name.' ), + array( + 'id' => 'message', + 'additional_classes' => array( 'error' ), + 'dismissible' => true, + ) + ); } // Update existing menu. @@ -457,7 +471,14 @@ switch ( $action ) { $menu_title = trim( esc_html( $_POST['menu-name'] ) ); if ( ! $menu_title ) { - $messages[] = '

' . __( 'Please enter a valid menu name.' ) . '

'; + $messages[] = wp_get_admin_notice( + __( 'Please enter a valid menu name.' ), + array( + 'id' => 'message', + 'additional_classes' => array( 'error' ), + 'dismissible' => true, + ) + ); $menu_title = $_menu_object->name; } @@ -510,7 +531,14 @@ switch ( $action ) { // Set menu locations. set_theme_mod( 'nav_menu_locations', $menu_locations ); - $messages[] = '

' . __( 'Menu locations updated.' ) . '

'; + $messages[] = wp_get_admin_notice( + __( 'Menu locations updated.' ), + array( + 'id' => 'message', + 'additional_classes' => array( 'updated' ), + 'dismissible' => true, + ) + ); } break; diff --git a/wp-admin/plugin-editor.php b/wp-admin/plugin-editor.php index fce25ea75c..345f0c09e0 100644 --- a/wp-admin/plugin-editor.php +++ b/wp-admin/plugin-editor.php @@ -29,7 +29,15 @@ if ( empty( $plugins ) ) { ?>

-

+ 'message', + 'additional_classes' => array( 'error' ), + ) + ); + ?>

- -

- + ' . __( 'Caution:' ) . ' ' . __( 'This plugin may be active on other sites in the network.' ); + wp_admin_notice( + $maybe_active_plugin, + array( + 'additional_classes' => array( 'error' ), + ) + ); + endif; + ?>

- -

- + ' . __( 'Caution:' ) . ' ' . __( 'These plugins may be active on other sites in the network.' ); + wp_admin_notice( + $maybe_active_plugins, + array( + 'additional_classes' => array( 'error' ), + ) + ); + endif; + ?>

'; + wp_admin_notice( + __( 'File does not exist! Please double check the name and try again.' ), + array( + 'additional_classes' => array( 'error' ), + ) + ); else : ?> diff --git a/wp-admin/theme-install.php b/wp-admin/theme-install.php index ef4e4fe17f..25212974d8 100644 --- a/wp-admin/theme-install.php +++ b/wp-admin/theme-install.php @@ -183,9 +183,14 @@ require_once ABSPATH . 'wp-admin/admin-header.php';
-
-

-
+ array( 'error', 'hide-if-js' ), + ) + ); + ?>
diff --git a/wp-admin/themes.php b/wp-admin/themes.php index 9fb3701a12..d5d8c150e3 100644 --- a/wp-admin/themes.php +++ b/wp-admin/themes.php @@ -345,7 +345,12 @@ if ( ! validate_current_theme() || isset( $_GET['broken'] ) ) { $current_theme = wp_get_theme(); if ( $current_theme->errors() && ( ! is_multisite() || current_user_can( 'manage_network_themes' ) ) ) { - echo '

' . __( 'Error:' ) . ' ' . $current_theme->errors()->get_error_message() . '

'; + wp_admin_notice( + __( 'Error:' ) . ' ' . $current_theme->errors()->get_error_message(), + array( + 'additional_classes' => array( 'error' ), + ) + ); } $current_theme_actions = array(); @@ -438,79 +443,88 @@ foreach ( $themes as $theme ) : - -

- - Update now' ); ?> - - - -

- -

- Update now' ); + } else { + $new_version_available = __( 'New version available.' ); + } + wp_admin_notice( + $new_version_available, + array( + 'type' => 'warning', + 'additional_classes' => array( 'notice-alt', 'inline', 'update-message' ), + ) + ); + else : + $theme_update_error = ''; + if ( ! $theme['updateResponse']['compatibleWP'] && ! $theme['updateResponse']['compatiblePHP'] ) { + $theme_update_error .= sprintf( + /* translators: %s: Theme name. */ + __( 'There is a new version of %s available, but it does not work with your versions of WordPress and PHP.' ), + $theme['name'] + ); + if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) { + $theme_update_error .= 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() ) ); - if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) { - printf( - /* 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( '

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

', '' ); - } - } elseif ( ! $theme['updateResponse']['compatibleWP'] ) { - printf( - /* translators: %s: Theme name. */ - __( 'There is a new version of %s available, but it does not work with your version of WordPress.' ), - $theme['name'] + wp_update_php_annotation( '

', '', false ); + } elseif ( current_user_can( 'update_core' ) ) { + $theme_update_error .= sprintf( + /* translators: %s: URL to WordPress Updates screen. */ + ' ' . __( 'Please update WordPress.' ), + self_admin_url( 'update-core.php' ) ); - if ( current_user_can( 'update_core' ) ) { - printf( - /* translators: %s: URL to WordPress Updates screen. */ - ' ' . __( 'Please update WordPress.' ), - self_admin_url( 'update-core.php' ) - ); - } - } elseif ( ! $theme['updateResponse']['compatiblePHP'] ) { - printf( - /* translators: %s: Theme name. */ - __( 'There is a new version of %s available, but it does not work with your version of PHP.' ), - $theme['name'] + } elseif ( current_user_can( 'update_php' ) ) { + $theme_update_error .= sprintf( + /* translators: %s: URL to Update PHP page. */ + ' ' . __( 'Learn more about updating PHP.' ), + esc_url( wp_get_update_php_url() ) ); - if ( current_user_can( 'update_php' ) ) { - printf( - /* translators: %s: URL to Update PHP page. */ - ' ' . __( 'Learn more about updating PHP.' ), - esc_url( wp_get_update_php_url() ) - ); - wp_update_php_annotation( '

', '' ); - } + wp_update_php_annotation( '

', '', false ); } - ?> -

- - + } elseif ( ! $theme['updateResponse']['compatibleWP'] ) { + $theme_update_error .= sprintf( + /* translators: %s: Theme name. */ + __( 'There is a new version of %s available, but it does not work with your version of WordPress.' ), + $theme['name'] + ); + if ( current_user_can( 'update_core' ) ) { + $theme_update_error .= sprintf( + /* translators: %s: URL to WordPress Updates screen. */ + ' ' . __( 'Please update WordPress.' ), + self_admin_url( 'update-core.php' ) + ); + } + } elseif ( ! $theme['updateResponse']['compatiblePHP'] ) { + $theme_update_error .= sprintf( + /* translators: %s: Theme name. */ + __( 'There is a new version of %s available, but it does not work with your version of PHP.' ), + $theme['name'] + ); + if ( current_user_can( 'update_php' ) ) { + $theme_update_error .= sprintf( + /* translators: %s: URL to Update PHP page. */ + ' ' . __( 'Learn more about updating PHP.' ), + esc_url( wp_get_update_php_url() ) + ); + wp_update_php_annotation( '

', '', false ); + } + } + wp_admin_notice( + $theme_update_error, + array( + 'type' => 'error', + 'additional_classes' => array( 'notice-alt', 'inline', 'update-message' ), + ) + ); + endif; + endif; - - @@ -662,7 +674,9 @@ if ( ! is_multisite() && $broken_themes ) { - + get( 'Name' ) ? $broken_theme->display( 'Name' ) : esc_html( $broken_theme->get_stylesheet() ); ?> errors()->get_error_message(); ?> @@ -723,7 +737,9 @@ if ( ! is_multisite() && $broken_themes ) { } ?> - +

diff --git a/wp-admin/update-core.php b/wp-admin/update-core.php index 28f92ca303..acd6cf7bf7 100644 --- a/wp-admin/update-core.php +++ b/wp-admin/update-core.php @@ -1072,16 +1072,22 @@ if ( 'upgrade-core' === $action ) { if ( 'themes' === $upgrade_error ) { $theme_updates = get_theme_updates(); if ( ! empty( $theme_updates ) ) { - echo '

'; - _e( 'Please select one or more themes to update.' ); - echo '

'; + wp_admin_notice( + __( 'Please select one or more themes to update.' ), + array( + 'additional_classes' => array( 'error' ), + ) + ); } } else { $plugin_updates = get_plugin_updates(); if ( ! empty( $plugin_updates ) ) { - echo '

'; - _e( 'Please select one or more plugins to update.' ); - echo '

'; + wp_admin_notice( + __( 'Please select one or more plugins to update.' ), + array( + 'additional_classes' => array( 'error' ), + ) + ); } } } diff --git a/wp-admin/user-edit.php b/wp-admin/user-edit.php index f89e4e5ea0..642b0185c4 100644 --- a/wp-admin/user-edit.php +++ b/wp-admin/user-edit.php @@ -244,11 +244,12 @@ switch ( $action ) { endif; if ( isset( $errors ) && is_wp_error( $errors ) ) { - ?> -
-

\n

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

-
- \n

", $errors->get_error_messages() ), + array( + 'additional_classes' => array( 'error' ), + ) + ); } ?> diff --git a/wp-admin/user-new.php b/wp-admin/user-new.php index b516f4f460..7ef33a8132 100644 --- a/wp-admin/user-new.php +++ b/wp-admin/user-new.php @@ -381,17 +381,19 @@ if ( current_user_can( 'create_users' ) ) { ?> - -

- -
- get_error_messages() as $err ) { + $error_message .= "
  • $err
  • \n"; + } + wp_admin_notice( + '', + array( + 'additional_classes' => array( 'error' ), + 'paragraph_wrap' => false, + ) + ); endif; if ( ! empty( $messages ) ) { @@ -408,15 +410,21 @@ if ( ! empty( $messages ) ) { } ?> - -
    - get_error_messages() as $message ) { - echo "

    $message

    "; - } - ?> -
    - +get_error_messages() as $message ) { + $error_message .= "

    $message

    \n"; + } + wp_admin_notice( + $error_message, + array( + 'additional_classes' => array( 'error' ), + 'paragraph_wrap' => false, + ) + ); +endif; +?>
    current_action() ) {

    - -
    -

    -
    - + ' . __( 'Error:' ) . ' ' . __( 'Please select an option.' ), + array( + 'additional_classes' => array( 'error' ), + ) + ); + endif; + ?>

    @@ -742,17 +747,18 @@ switch ( $wp_list_table->current_action() ) { endif; ?> - -
    -
      - get_error_messages() as $err ) { - echo "
    • $err
    • \n"; - } - ?> -
    -
    - get_error_messages() as $err ) { + $error_message .= "
  • $err
  • \n"; + } + wp_admin_notice( + '', + array( + 'additional_classes' => array( 'error' ), + ) + ); endif; if ( ! empty( $messages ) ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index 1a3388a73a..4e8bfc2334 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.4-alpha-56599'; +$wp_version = '6.4-alpha-56600'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.