mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-05-24 05:04:25 +00:00
Coding Standards: Use strict type check for in_array() and array_search() where strings are involved.
This reduces the number of `WordPress.PHP.StrictInArray.MissingTrueStrict` issues from 486 to 50. Includes minor code layout fixes for better readability. See #49542. git-svn-id: https://develop.svn.wordpress.org/trunk@47550 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -87,7 +87,7 @@ class WP_Comments_List_Table extends WP_List_Table {
|
||||
global $post_id, $comment_status, $search, $comment_type;
|
||||
|
||||
$comment_status = isset( $_REQUEST['comment_status'] ) ? $_REQUEST['comment_status'] : 'all';
|
||||
if ( ! in_array( $comment_status, array( 'all', 'mine', 'moderated', 'approved', 'spam', 'trash' ) ) ) {
|
||||
if ( ! in_array( $comment_status, array( 'all', 'mine', 'moderated', 'approved', 'spam', 'trash' ), true ) ) {
|
||||
$comment_status = 'all';
|
||||
}
|
||||
|
||||
@@ -344,13 +344,13 @@ class WP_Comments_List_Table extends WP_List_Table {
|
||||
global $comment_status;
|
||||
|
||||
$actions = array();
|
||||
if ( in_array( $comment_status, array( 'all', 'approved' ) ) ) {
|
||||
if ( in_array( $comment_status, array( 'all', 'approved' ), true ) ) {
|
||||
$actions['unapprove'] = __( 'Unapprove' );
|
||||
}
|
||||
if ( in_array( $comment_status, array( 'all', 'moderated' ) ) ) {
|
||||
if ( in_array( $comment_status, array( 'all', 'moderated' ), true ) ) {
|
||||
$actions['approve'] = __( 'Approve' );
|
||||
}
|
||||
if ( in_array( $comment_status, array( 'all', 'moderated', 'approved', 'trash' ) ) ) {
|
||||
if ( in_array( $comment_status, array( 'all', 'moderated', 'approved', 'trash' ), true ) ) {
|
||||
$actions['spam'] = _x( 'Mark as Spam', 'comment' );
|
||||
}
|
||||
|
||||
@@ -360,7 +360,7 @@ class WP_Comments_List_Table extends WP_List_Table {
|
||||
$actions['unspam'] = _x( 'Not Spam', 'comment' );
|
||||
}
|
||||
|
||||
if ( in_array( $comment_status, array( 'trash', 'spam' ) ) || ! EMPTY_TRASH_DAYS ) {
|
||||
if ( in_array( $comment_status, array( 'trash', 'spam' ), true ) || ! EMPTY_TRASH_DAYS ) {
|
||||
$actions['delete'] = __( 'Delete Permanently' );
|
||||
} else {
|
||||
$actions['trash'] = __( 'Move to Trash' );
|
||||
|
||||
Reference in New Issue
Block a user