Administration: Output valid HTML when `wp_die()` is called.

To better support HTML and string calls to `wp_die()` without
outputting invalid HTML, wraps error messages in `<div>` rather than `<p>`.

Adds `.wp-die-message` CSS class for styling.

Props dinhtungdu, jeremyfelt, audrasjb, SergeyBiryukov, afercia, audrasjb, noisysocks.
Fixes #47580.
Built from https://develop.svn.wordpress.org/trunk@45909


git-svn-id: http://core.svn.wordpress.org/trunk@45720 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Mike Schroder 2019-08-29 07:54:01 +00:00
parent 6057b32e9b
commit ccdc221b32
6 changed files with 22 additions and 6 deletions

View File

@ -460,6 +460,12 @@ code {
white-space: nowrap;
}
.wp-die-message {
font-size: 13px;
line-height: 1.5;
margin: 1em 0;
}
/* .widefat - main style for tables */
.widefat {
border-spacing: 0;

File diff suppressed because one or more lines are too long

View File

@ -460,6 +460,12 @@ code {
white-space: nowrap;
}
.wp-die-message {
font-size: 13px;
line-height: 1.5;
margin: 1em 0;
}
/* .widefat - main style for tables */
.widefat {
border-spacing: 0;

File diff suppressed because one or more lines are too long

View File

@ -3191,9 +3191,12 @@ function _default_wp_die_handler( $message, $title = '', $args = array() ) {
wp_list_pluck( $parsed_args['additional_errors'], 'message' )
);
$message = "<ul>\n\t\t<li>" . join( "</li>\n\t\t<li>", $message ) . "</li>\n\t</ul>";
} else {
$message = "<p>$message</p>";
}
$message = sprintf(
'<div class="wp-die-message">%s</div>',
$message
);
}
$have_gettext = function_exists( '__' );
@ -3263,7 +3266,8 @@ function _default_wp_die_handler( $message, $title = '', $args = array() ) {
#error-page {
margin-top: 50px;
}
#error-page p {
#error-page p,
#error-page .wp-die-message {
font-size: 14px;
line-height: 1.5;
margin: 25px 0 20px;

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.3-alpha-45908';
$wp_version = '5.3-alpha-45909';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.