WordPress.org

Make WordPress Core


Ignore:
Timestamp:
05/16/2020 06:40:52 PM (11 months 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/options.php

    r47550 r47808  
    6565    wp_redirect( admin_url( $redirect ) );
    6666    exit;
    67 } elseif ( ! empty( $_GET['dismiss'] ) && 'new_admin_email' == $_GET['dismiss'] ) {
     67} elseif ( ! empty( $_GET['dismiss'] ) && 'new_admin_email' === $_GET['dismiss'] ) {
    6868    check_admin_referer( 'dismiss-' . get_current_blog_id() . '-new_admin_email' );
    6969    delete_option( 'adminhash' );
     
    205205$whitelist_options = apply_filters( 'whitelist_options', $whitelist_options );
    206206
    207 if ( 'update' == $action ) { // We are saving settings sent from a settings page.
    208     if ( 'options' == $option_page && ! isset( $_POST['option_page'] ) ) { // This is for back compat and will eventually be removed.
     207if ( 'update' === $action ) { // We are saving settings sent from a settings page.
     208    if ( 'options' === $option_page && ! isset( $_POST['option_page'] ) ) { // This is for back compat and will eventually be removed.
    209209        $unregistered = true;
    210210        check_admin_referer( 'update-options' );
     
    224224    }
    225225
    226     if ( 'options' == $option_page ) {
     226    if ( 'options' === $option_page ) {
    227227        if ( is_multisite() && ! current_user_can( 'manage_network_options' ) ) {
    228228            wp_die( __( 'Sorry, you are not allowed to modify unregistered settings for this site.' ) );
     
    233233    }
    234234
    235     if ( 'general' == $option_page ) {
     235    if ( 'general' === $option_page ) {
    236236        // Handle custom date/time formats.
    237         if ( ! empty( $_POST['date_format'] ) && isset( $_POST['date_format_custom'] ) && '\c\u\s\t\o\m' == wp_unslash( $_POST['date_format'] ) ) {
     237        if ( ! empty( $_POST['date_format'] ) && isset( $_POST['date_format_custom'] )
     238            && '\c\u\s\t\o\m' === wp_unslash( $_POST['date_format'] )
     239        ) {
    238240            $_POST['date_format'] = $_POST['date_format_custom'];
    239241        }
    240         if ( ! empty( $_POST['time_format'] ) && isset( $_POST['time_format_custom'] ) && '\c\u\s\t\o\m' == wp_unslash( $_POST['time_format'] ) ) {
     242
     243        if ( ! empty( $_POST['time_format'] ) && isset( $_POST['time_format_custom'] )
     244            && '\c\u\s\t\o\m' === wp_unslash( $_POST['time_format'] )
     245        ) {
    241246            $_POST['time_format'] = $_POST['time_format_custom'];
    242247        }
     248
    243249        // Map UTC+- timezones to gmt_offsets and set timezone_string to empty.
    244250        if ( ! empty( $_POST['timezone_string'] ) && preg_match( '/^UTC[+-]/', $_POST['timezone_string'] ) ) {
     
    336342foreach ( (array) $options as $option ) :
    337343    $disabled = false;
    338     if ( '' == $option->option_name ) {
     344
     345    if ( '' === $option->option_name ) {
    339346        continue;
    340347    }
     348
    341349    if ( is_serialized( $option->option_value ) ) {
    342350        if ( is_serialized_string( $option->option_value ) ) {
     
    355363        $class               = 'all-options';
    356364    }
     365
    357366    $name = esc_attr( $option->option_name );
    358367    ?>
Note: See TracChangeset for help on using the changeset viewer.