Coding Standards: Use strict comparison in some wp-admin files.

Props pikamander2, mukesh27, SergeyBiryukov.
Fixes #49239.

git-svn-id: https://develop.svn.wordpress.org/trunk@47785 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2020-05-12 18:30:03 +00:00
parent afaab88e8e
commit 94d96bde71
24 changed files with 151 additions and 105 deletions

View File

@@ -22,16 +22,16 @@ if ( isset( $_POST['deletecomment'] ) ) {
$action = 'deletecomment';
}
if ( 'cdc' == $action ) {
if ( 'cdc' === $action ) {
$action = 'delete';
} elseif ( 'mac' == $action ) {
} elseif ( 'mac' === $action ) {
$action = 'approve';
}
if ( isset( $_GET['dt'] ) ) {
if ( 'spam' == $_GET['dt'] ) {
if ( 'spam' === $_GET['dt'] ) {
$action = 'spam';
} elseif ( 'trash' == $_GET['dt'] ) {
} elseif ( 'trash' === $_GET['dt'] ) {
$action = 'trash';
}
}
@@ -71,7 +71,7 @@ switch ( $action ) {
comment_footer_die( __( 'Sorry, you are not allowed to edit this comment.' ) );
}
if ( 'trash' == $comment->comment_approved ) {
if ( 'trash' === $comment->comment_approved ) {
comment_footer_die( __( 'This comment is in the Trash. Please move it out of the Trash if you want to edit it.' ) );
}
@@ -101,7 +101,7 @@ switch ( $action ) {
}
// No need to re-approve/re-trash/re-spam a comment.
if ( str_replace( '1', 'approve', $comment->comment_approved ) == $action ) {
if ( str_replace( '1', 'approve', $comment->comment_approved ) === $action ) {
wp_redirect( admin_url( 'edit-comments.php?same=' . $comment_id ) );
die();
}
@@ -109,7 +109,7 @@ switch ( $action ) {
require_once ABSPATH . 'wp-admin/admin-header.php';
$formaction = $action . 'comment';
$nonce_action = 'approve' == $action ? 'approve-comment_' : 'delete-comment_';
$nonce_action = ( 'approve' === $action ) ? 'approve-comment_' : 'delete-comment_';
$nonce_action .= $comment_id;
?>
@@ -137,7 +137,7 @@ switch ( $action ) {
break;
}
if ( '0' != $comment->comment_approved ) { // If not unapproved.
if ( '0' !== $comment->comment_approved ) { // If not unapproved.
$message = '';
switch ( $comment->comment_approved ) {
case '1':
@@ -271,9 +271,9 @@ switch ( $action ) {
comment_footer_die( __( 'Sorry, you are not allowed to edit comments on this post.' ) );
}
if ( '' != wp_get_referer() && ! $noredir && false === strpos( wp_get_referer(), 'comment.php' ) ) {
if ( wp_get_referer() && ! $noredir && false === strpos( wp_get_referer(), 'comment.php' ) ) {
$redir = wp_get_referer();
} elseif ( '' != wp_get_original_referer() && ! $noredir ) {
} elseif ( wp_get_original_referer() && ! $noredir ) {
$redir = wp_get_original_referer();
} elseif ( in_array( $action, array( 'approvecomment', 'unapprovecomment' ), true ) ) {
$redir = admin_url( 'edit-comments.php?p=' . absint( $comment->comment_post_ID ) );
@@ -348,9 +348,9 @@ switch ( $action ) {
* @param int $comment_id The ID of the comment being edited.
*/
$location = apply_filters( 'comment_edit_redirect', $location, $comment_id );
wp_redirect( $location );
exit();
wp_redirect( $location );
exit;
default:
wp_die( __( 'Unknown action.' ) );