Make WordPress Core


Ignore:
Timestamp:
02/09/2020 04:52:28 PM (6 years ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Use Yoda conditions where appropriate.

See #49222.

File:
1 edited

Legend:

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

    r47122 r47219  
    10471047        if ( '<!--' == substr( $string, 0, 4 ) ) {
    10481048                $string = str_replace( array( '<!--', '-->' ), '', $string );
    1049                 while ( $string != ( $newstring = wp_kses( $string, $allowed_html, $allowed_protocols ) ) ) {
     1049                while ( ( $newstring = wp_kses( $string, $allowed_html, $allowed_protocols ) ) != $string ) {
    10501050                        $string = $newstring;
    10511051                }
    1052                 if ( $string == '' ) {
     1052                if ( '' == $string ) {
    10531053                        return '';
    10541054                }
     
    10791079
    10801080        // No attributes are allowed for closing elements.
    1081         if ( $slash != '' ) {
     1081        if ( '' != $slash ) {
    10821082                return "</$elem>";
    10831083        }
     
    13491349                } // End switch.
    13501350
    1351                 if ( $working == 0 ) { // Not well-formed, remove and try again.
     1351                if ( 0 == $working ) { // Not well-formed, remove and try again.
    13521352                        $attr = wp_kses_html_error( $attr );
    13531353                        $mode = 0;
     
    13551355        } // End while.
    13561356
    1357         if ( $mode == 1 && false === array_key_exists( $attrname, $attrarr ) ) {
     1357        if ( 1 == $mode && false === array_key_exists( $attrname, $attrarr ) ) {
    13581358                // Special case, for when the attribute list ends with a valueless
    13591359                // attribute like "selected".
     
    18461846 */
    18471847function valid_unicode( $i ) {
    1848         return ( $i == 0x9 || $i == 0xa || $i == 0xd ||
    1849                         ( $i >= 0x20 && $i <= 0xd7ff ) ||
    1850                         ( $i >= 0xe000 && $i <= 0xfffd ) ||
    1851                         ( $i >= 0x10000 && $i <= 0x10ffff ) );
     1848        return ( 0x9 == $i || 0xa == $i || 0xd == $i ||
     1849                        ( 0x20 <= $i && $i <= 0xd7ff ) ||
     1850                        ( 0xe000 <= $i && $i <= 0xfffd ) ||
     1851                        ( 0x10000 <= $i && $i <= 0x10ffff ) );
    18521852}
    18531853
     
    22452245        $css = '';
    22462246        foreach ( $css_array as $css_item ) {
    2247                 if ( $css_item == '' ) {
     2247                if ( '' == $css_item ) {
    22482248                        continue;
    22492249                }
     
    22832283                                $url = trim( $url_pieces[2] );
    22842284
    2285                                 if ( empty( $url ) || $url !== wp_kses_bad_protocol( $url, $allowed_protocols ) ) {
     2285                                if ( empty( $url ) || wp_kses_bad_protocol( $url, $allowed_protocols ) !== $url ) {
    22862286                                        $found = false;
    22872287                                        break;
     
    23032303                // Remove any CSS containing containing \ ( & } = or comments, except for url() useage checked above.
    23042304                if ( $found && ! preg_match( '%[\\\(&=}]|/\*%', $css_test_string ) ) {
    2305                         if ( $css != '' ) {
     2305                        if ( '' != $css ) {
    23062306                                $css .= ';';
    23072307                        }
Note: See TracChangeset for help on using the changeset viewer.