WordPress.org

Make WordPress Core

Changeset 45909


Ignore:
Timestamp:
08/29/2019 07:52:43 AM (3 months ago)
Author:
mikeschroder
Message:

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.

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/index.php

    r45649 r45909  
    3131
    3232// Die with an error message
    33 $die = __( 'You are running WordPress without JavaScript and CSS files. These need to be built.' ) . '</p>';
     33$die = sprintf(
     34    '<p>%s</p>',
     35    __( 'You are running WordPress without JavaScript and CSS files. These need to be built.' )
     36);
    3437
    3538$die .= '<p>' . sprintf(
  • trunk/src/wp-admin/css/common.css

    r45692 r45909  
    459459    padding: 0;
    460460    white-space: nowrap;
     461}
     462
     463.wp-die-message {
     464    font-size: 13px;
     465    line-height: 1.5;
     466    margin: 1em 0;
    461467}
    462468
  • trunk/src/wp-includes/functions.php

    r45908 r45909  
    31923192            );
    31933193            $message = "<ul>\n\t\t<li>" . join( "</li>\n\t\t<li>", $message ) . "</li>\n\t</ul>";
    3194         } else {
    3195             $message = "<p>$message</p>";
    3196         }
     3194        }
     3195
     3196        $message = sprintf(
     3197            '<div class="wp-die-message">%s</div>',
     3198            $message
     3199        );
    31973200    }
    31983201
     
    32643267            margin-top: 50px;
    32653268        }
    3266         #error-page p {
     3269        #error-page p,
     3270        #error-page .wp-die-message {
    32673271            font-size: 14px;
    32683272            line-height: 1.5;
Note: See TracChangeset for help on using the changeset viewer.