Make WordPress Core


Ignore:
Timestamp:
05/16/2020 06:40:52 PM (3 years ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Use strict comparison where static strings are involved.

This reduces the number of WordPress.PHP.StrictComparisons.LooseComparison issues in half, from 1897 to 890.

Includes minor code layout fixes for better readability.

See #49542.

File:
1 edited

Legend:

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

    r47789 r47808  
    9797    header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true );
    9898
    99     if ( 'all' != $args['content'] && post_type_exists( $args['content'] ) ) {
     99    if ( 'all' !== $args['content'] && post_type_exists( $args['content'] ) ) {
    100100        $ptype = get_post_type_object( $args['content'] );
    101101        if ( ! $ptype->can_export ) {
     
    112112    }
    113113
    114     if ( $args['status'] && ( 'post' == $args['content'] || 'page' == $args['content'] ) ) {
     114    if ( $args['status'] && ( 'post' === $args['content'] || 'page' === $args['content'] ) ) {
    115115        $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_status = %s", $args['status'] );
    116116    } else {
     
    119119
    120120    $join = '';
    121     if ( $args['category'] && 'post' == $args['content'] ) {
     121    if ( $args['category'] && 'post' === $args['content'] ) {
    122122        $term = term_exists( $args['category'], 'category' );
    123123        if ( $term ) {
     
    127127    }
    128128
    129     if ( 'post' == $args['content'] || 'page' == $args['content'] || 'attachment' == $args['content'] ) {
     129    if ( in_array( $args['content'], array( 'post', 'page', 'attachment' ), true ) ) {
    130130        if ( $args['author'] ) {
    131131            $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_author = %d", $args['author'] );
     
    155155        $cats = array( $cat->term_id => $cat );
    156156        unset( $term, $cat );
    157     } elseif ( 'all' == $args['content'] ) {
     157    } elseif ( 'all' === $args['content'] ) {
    158158        $categories = (array) get_categories( array( 'get' => 'all' ) );
    159159        $tags       = (array) get_tags( array( 'get' => 'all' ) );
     
    429429     */
    430430    function wxr_filter_postmeta( $return_me, $meta_key ) {
    431         if ( '_edit_lock' == $meta_key ) {
     431        if ( '_edit_lock' === $meta_key ) {
    432432            $return_me = true;
    433433        }
     
    514514    <?php endforeach; ?>
    515515    <?php
    516     if ( 'all' == $args['content'] ) {
     516    if ( 'all' === $args['content'] ) {
    517517        wxr_nav_menu_terms();}
    518518    ?>
Note: See TracChangeset for help on using the changeset viewer.