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/post.php

    r47550 r47808  
    5050if ( isset( $_POST['deletepost'] ) ) {
    5151    $action = 'delete';
    52 } elseif ( isset( $_POST['wp-preview'] ) && 'dopreview' == $_POST['wp-preview'] ) {
     52} elseif ( isset( $_POST['wp-preview'] ) && 'dopreview' === $_POST['wp-preview'] ) {
    5353    $action = 'preview';
    5454}
     
    5858    false !== strpos( $sendback, 'post.php' ) ||
    5959    false !== strpos( $sendback, 'post-new.php' ) ) {
    60     if ( 'attachment' == $post_type ) {
     60    if ( 'attachment' === $post_type ) {
    6161        $sendback = admin_url( 'upload.php' );
    6262    } else {
     
    112112    case 'post':
    113113        check_admin_referer( 'add-' . $post_type );
    114         $post_id = 'postajaxpost' == $action ? edit_post() : write_post();
     114        $post_id = 'postajaxpost' === $action ? edit_post() : write_post();
    115115        redirect_post( $post_id );
    116116        exit();
     
    140140        }
    141141
    142         if ( 'trash' == $post->post_status ) {
     142        if ( 'trash' === $post->post_status ) {
    143143            wp_die( __( 'You can’t edit this item because it is in the Trash. Please restore it and try again.' ) );
    144144        }
     
    152152
    153153        $post_type = $post->post_type;
    154         if ( 'post' == $post_type ) {
     154        if ( 'post' === $post_type ) {
    155155            $parent_file   = 'edit.php';
    156156            $submenu_file  = 'edit.php';
    157157            $post_new_file = 'post-new.php';
    158         } elseif ( 'attachment' == $post_type ) {
     158        } elseif ( 'attachment' === $post_type ) {
    159159            $parent_file   = 'upload.php';
    160160            $submenu_file  = 'upload.php';
Note: See TracChangeset for help on using the changeset viewer.