Making WordPress.org

Changeset 9920


Ignore:
Timestamp:
05/25/2020 06:21:48 AM (4 years ago)
Author:
dufresnesteven
Message:

Plugins: Update readme validator to use updates error notices.

Props tellyworth, sergeybiryukov
Fixes: #2780

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-readme-validator.php

    r6842 r9920  
    1212        ?>
    1313        <div class="wrap">
    14             <h2><?php _e( 'WordPress Plugin readme.txt Validator', 'wporg-plugins' ); ?></h2>
    15 
    1614            <?php
    1715            if ( $_POST ) {
     
    7775        foreach ( $error_types as $field => $warning_label ) {
    7876            if ( ! empty( $errors[ $field ] ) ) {
    79                 $output .= "{$warning_label}\n<ul class='{$field} error'>\n";
     77                if ( 'errors' === $field ) {
     78                    $class = 'error';
     79                } elseif ( 'warnings' === $field ) {
     80                    $class = 'warning';
     81                } else {
     82                    $class = 'info';
     83                }
     84
     85                $output .= "<h3>{$warning_label}</h3>\n";
     86                $output .= "<div class='notice notice-{$class} notice-alt'>\n";
     87                $output .= "<ul class='{$field}'>\n";
    8088                foreach ( $errors[ $field ] as $notice ) {
    8189                    $output .= "<li>{$notice}</li>\n";
    8290                }
    8391                $output .= "</ul>\n";
     92                $output .= "</div>\n";
    8493            }
    8594        }
Note: See TracChangeset for help on using the changeset viewer.