Make WordPress Core

Changeset 55653


Ignore:
Timestamp:
04/16/2023 10:46:17 AM (2 years ago)
Author:
SergeyBiryukov
Message:

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

Follow-up to [3606], [10738], [33359], [55642], [55652].

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

Location:
trunk/src
Files:
3 edited

Legend:

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

    r54953 r55653  
    13661366            reset( $plugin_slugs );
    13671367            foreach ( $plugin_slugs as $plugin_slug ) {
    1368                 if ( $slug == substr( $plugin_slug, 0, strlen( $slug ) ) ) {
     1368                if ( $slug === substr( $plugin_slug, 0, strlen( $slug ) ) ) {
    13691369                    unset( $items[$item_key] );
    13701370                    continue 2;
  • trunk/src/wp-includes/deprecated.php

    r55642 r55653  
    948948
    949949    $order = 'ASC';
    950     if ( substr($orderby, 0, 1) == '_' ) {
     950    if ( substr($orderby, 0, 1) === '_' ) {
    951951        $order = 'DESC';
    952952        $orderby = substr($orderby, 1);
     
    981981
    982982        if ( $show_updated )
    983             if (substr($row->link_updated_f, 0, 2) != '00')
     983            if (substr($row->link_updated_f, 0, 2) !== '00')
    984984                $title .= ' ('.__('Last updated') . ' ' . gmdate(get_option('links_updated_date_format'), $row->link_updated_f + (get_option('gmt_offset') * HOUR_IN_SECONDS)) . ')';
    985985
     
    10431043    // Handle link category sorting.
    10441044    $direction = 'ASC';
    1045     if ( '_' == substr($order,0,1) ) {
     1045    if ( '_' === substr($order,0,1) ) {
    10461046        $direction = 'DESC';
    10471047        $order = substr($order,1);
     
    17401740        $link_text = $matches[4][$i];
    17411741        $content = str_replace( $link_match, $link_text . ' ' . $link_number, $content );
    1742         $link_url = ( ( strtolower( substr( $link_url, 0, 7 ) ) != 'http://' ) && ( strtolower( substr( $link_url, 0, 8 ) ) != 'https://' ) ) ? get_option( 'home' ) . $link_url : $link_url;
     1742        $link_url = ( ( strtolower( substr( $link_url, 0, 7 ) ) !== 'http://' ) && ( strtolower( substr( $link_url, 0, 8 ) ) !== 'https://' ) ) ? get_option( 'home' ) . $link_url : $link_url;
    17431743        $links_summary .= "\n" . $link_number . ' ' . $link_url;
    17441744    }
  • trunk/src/wp-includes/kses.php

    r55652 r55653  
    800800        }
    801801        if ( '"' === $quote || "'" === $quote ) {
    802             if ( substr( $value, -1 ) != $quote ) {
     802            if ( substr( $value, -1 ) !== $quote ) {
    803803                return '';
    804804            }
Note: See TracChangeset for help on using the changeset viewer.