Make WordPress Core

Ticket #37134: 37134.4.diff

File 37134.4.diff, 1.0 KB (added by miinasikk, 4 years ago)

Update patch based on changes. Add CSS value as filter param.

  • src/wp-includes/kses.php

     
    22202220                        }
    22212221                }
    22222222
    2223                 // Remove any CSS containing containing \ ( & } = or comments, except for url() useage checked above.
    2224                 if ( $found && ! preg_match( '%[\\\(&=}]|/\*%', $css_test_string ) ) {
    2225                         if ( $css != '' ) {
    2226                                 $css .= ';';
     2223                if ( $found ) {
     2224
     2225                        /**
     2226                         * Filters list of characters not allowed in CSS rules.
     2227                         * Default behaviour is removing any inline css containing \ ( & } = or comments, except for url() usage checked above.
     2228                         *
     2229                         * @param string Pattern of disallowed characters in CSS rules.
     2230                         * @param string CSS value to test.
     2231                         */
     2232                        $disallowed_chars = apply_filters( 'safe_style_disallowed_chars', '%[\\\(&=}]|/\*%', $css_test_string );
     2233                        if ( ! preg_match( $disallowed_chars, $css ) ) {
     2234                                if ( '' !== $css ) {
     2235                                        $css .= ';';
     2236                                }
     2237                                $css .= $css_item;
    22272238                        }
    2228 
    2229                         $css .= $css_item;
    22302239                }
    22312240        }
    22322241