Make WordPress Core


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

    r47574 r47808  
    9292                $plugin_data['Network'] = $plugin_data['_sitewide'];
    9393        }
    94         $plugin_data['Network'] = ( 'true' == strtolower( $plugin_data['Network'] ) );
     94        $plugin_data['Network'] = ( 'true' === strtolower( $plugin_data['Network'] ) );
    9595        unset( $plugin_data['_sitewide'] );
    9696
     
    157157                                }
    158158                        }
    159                 } elseif ( 'hello.php' == basename( $plugin_file ) ) {
     159                } elseif ( 'hello.php' === basename( $plugin_file ) ) {
    160160                        $textdomain = 'default';
    161161                }
     
    296296        $plugins_dir  = @ opendir( $plugin_root );
    297297        $plugin_files = array();
     298
    298299        if ( $plugins_dir ) {
    299300                while ( ( $file = readdir( $plugins_dir ) ) !== false ) {
    300                         if ( substr( $file, 0, 1 ) == '.' ) {
     301                        if ( '.' === substr( $file, 0, 1 ) ) {
    301302                                continue;
    302303                        }
     304
    303305                        if ( is_dir( $plugin_root . '/' . $file ) ) {
    304306                                $plugins_subdir = @ opendir( $plugin_root . '/' . $file );
     307
    305308                                if ( $plugins_subdir ) {
    306309                                        while ( ( $subfile = readdir( $plugins_subdir ) ) !== false ) {
    307                                                 if ( substr( $subfile, 0, 1 ) == '.' ) {
     310                                                if ( '.' === substr( $subfile, 0, 1 ) ) {
    308311                                                        continue;
    309312                                                }
    310                                                 if ( substr( $subfile, -4 ) == '.php' ) {
     313
     314                                                if ( '.php' === substr( $subfile, -4 ) ) {
    311315                                                        $plugin_files[] = "$file/$subfile";
    312316                                                }
    313317                                        }
     318
    314319                                        closedir( $plugins_subdir );
    315320                                }
    316321                        } else {
    317                                 if ( substr( $file, -4 ) == '.php' ) {
     322                                if ( '.php' === substr( $file, -4 ) ) {
    318323                                        $plugin_files[] = $file;
    319324                                }
    320325                        }
    321326                }
     327
    322328                closedir( $plugins_dir );
    323329        }
     
    370376        if ( $plugins_dir ) {
    371377                while ( ( $file = readdir( $plugins_dir ) ) !== false ) {
    372                         if ( substr( $file, -4 ) == '.php' ) {
     378                        if ( '.php' === substr( $file, -4 ) ) {
    373379                                $plugin_files[] = $file;
    374380                        }
     
    14451451         * See wp-admin/admin.php for redirect from edit.php to tools.php.
    14461452         */
    1447         if ( 'tools.php' == $parent_slug ) {
     1453        if ( 'tools.php' === $parent_slug ) {
    14481454                $_registered_pages[ get_plugin_page_hookname( $menu_slug, 'edit.php' ) ] = true;
    14491455        }
     
    18371843                $plugin_page, $_wp_real_parent_file, $_wp_menu_nopriv, $_wp_submenu_nopriv;
    18381844
    1839         if ( ! empty( $parent ) && 'admin.php' != $parent ) {
     1845        if ( ! empty( $parent ) && 'admin.php' !== $parent ) {
    18401846                if ( isset( $_wp_real_parent_file[ $parent ] ) ) {
    18411847                        $parent = $_wp_real_parent_file[ $parent ];
     
    20192025
    20202026        $page_type = 'admin';
    2021         if ( empty( $parent_page ) || 'admin.php' == $parent_page || isset( $admin_page_hooks[ $plugin_page ] ) ) {
     2027        if ( empty( $parent_page ) || 'admin.php' === $parent_page || isset( $admin_page_hooks[ $plugin_page ] ) ) {
    20222028                if ( isset( $admin_page_hooks[ $plugin_page ] ) ) {
    20232029                        $page_type = 'toplevel';
     
    21662172 */
    21672173function add_option_whitelist( $new_options, $options = '' ) {
    2168         if ( '' == $options ) {
     2174        if ( '' === $options ) {
    21692175                global $whitelist_options;
    21702176        } else {
     
    22012207 */
    22022208function remove_option_whitelist( $del_options, $options = '' ) {
    2203         if ( '' == $options ) {
     2209        if ( '' === $options ) {
    22042210                global $whitelist_options;
    22052211        } else {
Note: See TracChangeset for help on using the changeset viewer.