Make WordPress Core


Ignore:
Timestamp:
01/09/2020 12:53:29 AM (7 years ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Use strict comparison and Yoda conditions in the root directory files.

Props pikamander2.
Fixes #48965.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-mail.php

    r45932 r47054  
    102102                                $content_transfer_encoding = $content_transfer_encoding[0];
    103103                        }
    104                         if ( ( $content_type == 'multipart/alternative' ) && ( false !== strpos( $line, 'boundary="' ) ) && ( '' == $boundary ) ) {
     104                        if ( ( 'multipart/alternative' === $content_type ) && ( false !== strpos( $line, 'boundary="' ) ) && ( '' === $boundary ) ) {
    105105                                $boundary = trim( $line );
    106106                                $boundary = explode( '"', $boundary );
    … …  
    143143
    144144                        if ( preg_match( '/Date: /i', $line ) ) { // of the form '20 Mar 2002 20:32:37 +0100'
    145                                 $ddate         = str_replace( 'Date: ', '', trim( $line ) );
    146                                 $ddate         = preg_replace( '!\s*\(.+\)\s*$!', '', $ddate ); // remove parenthesised timezone string if it exists, as this confuses strtotime
    147                                 $ddate_U      = strtotime( $ddate );
    148                                 $post_date     = gmdate( 'Y-m-d H:i:s', $ddate_U + $time_difference );
    149                                 $post_date_gmt = gmdate( 'Y-m-d H:i:s', $ddate_U );
     145                                $ddate           = str_replace( 'Date: ', '', trim( $line ) );
     146                                $ddate           = preg_replace( '!\s*\(.+\)\s*$!', '', $ddate ); // remove parenthesised timezone string if it exists, as this confuses strtotime
     147                                $ddate_timestamp = strtotime( $ddate );
     148                                $post_date       = gmdate( 'Y-m-d H:i:s', $ddate_timestamp + $time_difference );
     149                                $post_date_gmt   = gmdate( 'Y-m-d H:i:s', $ddate_timestamp );
    150150                        }
    151151                }
    … …  
    163163        $subject = trim( $subject );
    164164
    165         if ( $content_type == 'multipart/alternative' ) {
     165        if ( 'multipart/alternative' === $content_type ) {
    166166                $content = explode( '--' . $boundary, $content );
    167167                $content = $content[2];
    … …  
    213213        $post_title = xmlrpc_getposttitle( $content );
    214214
    215         if ( $post_title == '' ) {
     215        if ( '' === $post_title ) {
    216216                $post_title = $subject;
    217217        }
Note: See TracChangeset for help on using the changeset viewer.