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.

git-svn-id: https://develop.svn.wordpress.org/trunk@47808 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2020-05-16 18:40:52 +00:00
parent 36e4db6b01
commit 6742d0d7a6
160 changed files with 1143 additions and 1007 deletions
+6 -6
View File
@@ -49,7 +49,7 @@ if ( isset( $_POST['post_type'] ) && $post && $post_type !== $_POST['post_type']
if ( isset( $_POST['deletepost'] ) ) {
$action = 'delete';
} elseif ( isset( $_POST['wp-preview'] ) && 'dopreview' == $_POST['wp-preview'] ) {
} elseif ( isset( $_POST['wp-preview'] ) && 'dopreview' === $_POST['wp-preview'] ) {
$action = 'preview';
}
@@ -57,7 +57,7 @@ $sendback = wp_get_referer();
if ( ! $sendback ||
false !== strpos( $sendback, 'post.php' ) ||
false !== strpos( $sendback, 'post-new.php' ) ) {
if ( 'attachment' == $post_type ) {
if ( 'attachment' === $post_type ) {
$sendback = admin_url( 'upload.php' );
} else {
$sendback = admin_url( 'edit.php' );
@@ -111,7 +111,7 @@ switch ( $action ) {
case 'postajaxpost':
case 'post':
check_admin_referer( 'add-' . $post_type );
$post_id = 'postajaxpost' == $action ? edit_post() : write_post();
$post_id = 'postajaxpost' === $action ? edit_post() : write_post();
redirect_post( $post_id );
exit();
@@ -139,7 +139,7 @@ switch ( $action ) {
wp_die( __( 'Sorry, you are not allowed to edit this item.' ) );
}
if ( 'trash' == $post->post_status ) {
if ( 'trash' === $post->post_status ) {
wp_die( __( 'You can’t edit this item because it is in the Trash. Please restore it and try again.' ) );
}
@@ -151,11 +151,11 @@ switch ( $action ) {
}
$post_type = $post->post_type;
if ( 'post' == $post_type ) {
if ( 'post' === $post_type ) {
$parent_file = 'edit.php';
$submenu_file = 'edit.php';
$post_new_file = 'post-new.php';
} elseif ( 'attachment' == $post_type ) {
} elseif ( 'attachment' === $post_type ) {
$parent_file = 'upload.php';
$submenu_file = 'upload.php';
$post_new_file = 'media-new.php';