Make WordPress Core


Ignore:
Timestamp:
04/09/2020 03:41:04 PM (4 years ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Use strict type check for in_array() and array_search().

This addresses all the remaining WordPress.PHP.StrictInArray.MissingTrueStrict issues in core.

Includes minor code layout fixes for better readability.

Follow-up to [47550].

See #49542.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/network/site-info.php

    r47198 r47557  
    7373    $existing_details     = get_site( $id );
    7474    $blog_data_checkboxes = array( 'public', 'archived', 'spam', 'mature', 'deleted' );
     75
    7576    foreach ( $blog_data_checkboxes as $c ) {
    76         if ( ! in_array( $existing_details->$c, array( 0, 1 ) ) ) {
     77        if ( ! in_array( (int) $existing_details->$c, array( 0, 1 ), true ) ) {
    7778            $blog_data[ $c ] = $existing_details->$c;
    7879        } else {
     
    195196            <legend class="screen-reader-text"><?php _e( 'Set site attributes' ); ?></legend>
    196197            <?php foreach ( $attribute_fields as $field_key => $field_label ) : ?>
    197                 <label><input type="checkbox" name="blog[<?php echo $field_key; ?>]" value="1" <?php checked( (bool) $details->$field_key, true ); ?> <?php disabled( ! in_array( $details->$field_key, array( 0, 1 ) ) ); ?> />
     198                <label><input type="checkbox" name="blog[<?php echo $field_key; ?>]" value="1" <?php checked( (bool) $details->$field_key, true ); ?> <?php disabled( ! in_array( (int) $details->$field_key, array( 0, 1 ), true ) ); ?> />
    198199                <?php echo $field_label; ?></label><br/>
    199200            <?php endforeach; ?>
Note: See TracChangeset for help on using the changeset viewer.