Make WordPress Core


Ignore:
Timestamp:
04/22/2023 03:17:47 PM (2 years ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Use strict comparison where strtolower() is involved.

Follow-up to [649], [7736], [18821], [19444], [20886], [20893], [23303], [55642], [55652], [55653], [55654].

Props aristath, poena, afercia, SergeyBiryukov.
See #57839.

File:
1 edited

Legend:

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

    r55652 r55677  
    30303030    foreach ( $textarr as $piece ) {
    30313031
    3032         if ( preg_match( '|^<code[\s>]|i', $piece ) || preg_match( '|^<pre[\s>]|i', $piece ) || preg_match( '|^<script[\s>]|i', $piece ) || preg_match( '|^<style[\s>]|i', $piece ) ) {
     3032        if ( preg_match( '|^<code[\s>]|i', $piece )
     3033            || preg_match( '|^<pre[\s>]|i', $piece )
     3034            || preg_match( '|^<script[\s>]|i', $piece )
     3035            || preg_match( '|^<style[\s>]|i', $piece )
     3036        ) {
    30333037            $nested_code_pre++;
    3034         } elseif ( $nested_code_pre && ( '</code>' === strtolower( $piece ) || '</pre>' === strtolower( $piece ) || '</script>' === strtolower( $piece ) || '</style>' === strtolower( $piece ) ) ) {
     3038        } elseif ( $nested_code_pre
     3039            && ( '</code>' === strtolower( $piece )
     3040                || '</pre>' === strtolower( $piece )
     3041                || '</script>' === strtolower( $piece )
     3042                || '</style>' === strtolower( $piece )
     3043            )
     3044        ) {
    30353045            $nested_code_pre--;
    30363046        }
    30373047
    3038         if ( $nested_code_pre || empty( $piece ) || ( '<' === $piece[0] && ! preg_match( '|^<\s*[\w]{1,20}+://|', $piece ) ) ) {
     3048        if ( $nested_code_pre
     3049            || empty( $piece )
     3050            || ( '<' === $piece[0] && ! preg_match( '|^<\s*[\w]{1,20}+://|', $piece ) )
     3051        ) {
    30393052            $r .= $piece;
    30403053            continue;
     
    44644477        }
    44654478        $good_protocol_url = wp_kses_bad_protocol( $url, $protocols );
    4466         if ( strtolower( $good_protocol_url ) != strtolower( $url ) ) {
     4479        if ( strtolower( $good_protocol_url ) !== strtolower( $url ) ) {
    44674480            return '';
    44684481        }
Note: See TracChangeset for help on using the changeset viewer.