WordPress.org

Make WordPress Core


Ignore:
Timestamp:
08/22/2019 12:21:49 AM (8 weeks ago)
Author:
SergeyBiryukov
Message:

Administration: Adjust [45814] to address a backward compatibility issue for plugins passing multiple CSS classes to add_settings_error().

Only add the notice- prefix for error, success, warning, info CSS classes, keep other classes as is.

Add unit tests for settings_errors().

Props afercia, SergeyBiryukov.
Fixes #44941.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/template.php

    r45814 r45873  
    18151815        }
    18161816
     1817        if ( in_array( $details['type'], array( 'error', 'success', 'warning', 'info' ) ) ) {
     1818            $details['type'] = 'notice-' . $details['type'];
     1819        }
     1820
    18171821        $css_id    = sprintf(
    18181822            'setting-error-%s',
    1819             sanitize_html_class( $details['code'] )
     1823            esc_attr( $details['code'] )
    18201824        );
    18211825        $css_class = sprintf(
    1822             'notice notice-%s settings-error is-dismissible',
    1823             sanitize_html_class( $details['type'] )
     1826            'notice %s settings-error is-dismissible',
     1827            esc_attr( $details['type'] )
    18241828        );
    18251829
Note: See TracChangeset for help on using the changeset viewer.