Make WordPress Core


Ignore:
Timestamp:
02/09/2020 04:51:22 PM (6 years ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Use Yoda conditions in some wp-admin files.

Props subrataemfluence, marcio-zebedeu, bookdude13, 1naveengiri, alishankhan.
Fixes #44365, #48455.

File:
1 edited

Legend:

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

    r47198 r47218  
    7373         * attempt to do no more than threshold value, with some +/- allowed.
    7474         */
    75         if ( $c <= 50 || ( $c > 50 && mt_rand( 0, (int) ( $c / 50 ) ) == 1 ) ) {
     75        if ( $c <= 50 || ( $c > 50 && mt_rand( 0, (int) ( $c / 50 ) ) === 1 ) ) {
    7676            require_once ABSPATH . WPINC . '/http.php';
    7777            $response = wp_remote_get(
     
    182182
    183183        // Back-compat for plugins using add_management_page().
    184         if ( empty( $page_hook ) && 'edit.php' == $pagenow && '' != get_plugin_page_hook( $plugin_page, 'tools.php' ) ) {
     184        if ( empty( $page_hook ) && 'edit.php' === $pagenow && '' !== get_plugin_page_hook( $plugin_page, 'tools.php' ) ) {
    185185            // There could be plugin specific params on the URL, so we need the whole query string.
    186186            if ( ! empty( $_SERVER['QUERY_STRING'] ) ) {
     
    371371     * In all other cases, 'load-' . $pagenow should be used instead.
    372372     */
    373     if ( $typenow == 'page' ) {
    374         if ( $pagenow == 'post-new.php' ) {
     373    if ( 'page' === $typenow ) {
     374        if ( 'post-new.php' === $pagenow ) {
    375375            do_action( 'load-page-new.php' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
    376         } elseif ( $pagenow == 'post.php' ) {
     376        } elseif ( 'post.php' === $pagenow ) {
    377377            do_action( 'load-page.php' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
    378378        }
    379     } elseif ( $pagenow == 'edit-tags.php' ) {
    380         if ( $taxnow == 'category' ) {
     379    } elseif ( 'edit-tags.php' === $pagenow ) {
     380        if ( 'category' === $taxnow ) {
    381381            do_action( 'load-categories.php' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
    382         } elseif ( $taxnow == 'link_category' ) {
     382        } elseif ( 'link_category' === $taxnow ) {
    383383            do_action( 'load-edit-link-categories.php' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
    384384        }
Note: See TracChangeset for help on using the changeset viewer.