diff --git a/wp-activate.php b/wp-activate.php index 446cb7382c..3258c07d32 100644 --- a/wp-activate.php +++ b/wp-activate.php @@ -57,7 +57,7 @@ if ( null === $result || ( is_wp_error( $result ) && 'invalid_key' === $result-> } elseif ( is_wp_error( $result ) ) { $error_code = $result->get_error_code(); - if ( ! in_array( $error_code, $valid_error_codes ) ) { + if ( ! in_array( $error_code, $valid_error_codes, true ) ) { status_header( 400 ); } } @@ -136,7 +136,7 @@ get_header( 'wp-activate' ); get_error_code(), $valid_error_codes ) ) { + if ( is_wp_error( $result ) && in_array( $result->get_error_code(), $valid_error_codes, true ) ) { $signup = $result->get_error_data(); ?>
diff --git a/wp-admin/admin-ajax.php b/wp-admin/admin-ajax.php index d3dc4da2a5..4f41a31bd6 100644 --- a/wp-admin/admin-ajax.php +++ b/wp-admin/admin-ajax.php @@ -146,11 +146,11 @@ $core_actions_post_deprecated = array( 'wp-fullscreen-save-post', 'press-this-sa $core_actions_post = array_merge( $core_actions_post, $core_actions_post_deprecated ); // Register core Ajax calls. -if ( ! empty( $_GET['action'] ) && in_array( $_GET['action'], $core_actions_get ) ) { +if ( ! empty( $_GET['action'] ) && in_array( $_GET['action'], $core_actions_get, true ) ) { add_action( 'wp_ajax_' . $_GET['action'], 'wp_ajax_' . str_replace( '-', '_', $_GET['action'] ), 1 ); } -if ( ! empty( $_POST['action'] ) && in_array( $_POST['action'], $core_actions_post ) ) { +if ( ! empty( $_POST['action'] ) && in_array( $_POST['action'], $core_actions_post, true ) ) { add_action( 'wp_ajax_' . $_POST['action'], 'wp_ajax_' . str_replace( '-', '_', $_POST['action'] ), 1 ); } diff --git a/wp-admin/comment.php b/wp-admin/comment.php index 3f20c3cc2e..fea0b8a37c 100644 --- a/wp-admin/comment.php +++ b/wp-admin/comment.php @@ -255,7 +255,7 @@ switch ( $action ) { case 'unapprovecomment': $comment_id = absint( $_REQUEST['c'] ); - if ( in_array( $action, array( 'approvecomment', 'unapprovecomment' ) ) ) { + if ( in_array( $action, array( 'approvecomment', 'unapprovecomment' ), true ) ) { check_admin_referer( 'approve-comment_' . $comment_id ); } else { check_admin_referer( 'delete-comment_' . $comment_id ); @@ -275,7 +275,7 @@ switch ( $action ) { $redir = wp_get_referer(); } elseif ( '' != wp_get_original_referer() && ! $noredir ) { $redir = wp_get_original_referer(); - } elseif ( in_array( $action, array( 'approvecomment', 'unapprovecomment' ) ) ) { + } elseif ( in_array( $action, array( 'approvecomment', 'unapprovecomment' ), true ) ) { $redir = admin_url( 'edit-comments.php?p=' . absint( $comment->comment_post_ID ) ); } else { $redir = admin_url( 'edit-comments.php' ); diff --git a/wp-admin/edit-tags.php b/wp-admin/edit-tags.php index aedd70c1c5..cb1ac29fdb 100644 --- a/wp-admin/edit-tags.php +++ b/wp-admin/edit-tags.php @@ -19,7 +19,7 @@ if ( ! $tax ) { wp_die( __( 'Invalid taxonomy.' ) ); } -if ( ! in_array( $tax->name, get_taxonomies( array( 'show_ui' => true ) ) ) ) { +if ( ! in_array( $tax->name, get_taxonomies( array( 'show_ui' => true ) ), true ) ) { wp_die( __( 'Sorry, you are not allowed to edit terms in this taxonomy.' ) ); } diff --git a/wp-admin/edit.php b/wp-admin/edit.php index 1fb89e1e95..bc562d47cb 100644 --- a/wp-admin/edit.php +++ b/wp-admin/edit.php @@ -13,7 +13,7 @@ if ( ! $typenow ) { wp_die( __( 'Invalid post type.' ) ); } -if ( ! in_array( $typenow, get_post_types( array( 'show_ui' => true ) ) ) ) { +if ( ! in_array( $typenow, get_post_types( array( 'show_ui' => true ) ), true ) ) { wp_die( __( 'Sorry, you are not allowed to edit posts in this post type.' ) ); } diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php index ea33d9d792..d46e94ff24 100644 --- a/wp-admin/includes/ajax-actions.php +++ b/wp-admin/includes/ajax-actions.php @@ -976,7 +976,7 @@ function wp_ajax_dim_comment() { check_ajax_referer( "approve-comment_$id" ); - if ( in_array( $current, array( 'unapproved', 'spam' ) ) ) { + if ( in_array( $current, array( 'unapproved', 'spam' ), true ) ) { $result = wp_set_comment_status( $comment, 'approve', true ); } else { $result = wp_set_comment_status( $comment, 'hold', true ); @@ -1271,7 +1271,7 @@ function wp_ajax_replyto_comment( $action ) { if ( empty( $post->post_status ) ) { wp_die( 1 ); - } elseif ( in_array( $post->post_status, array( 'draft', 'pending', 'trash' ) ) ) { + } elseif ( in_array( $post->post_status, array( 'draft', 'pending', 'trash' ), true ) ) { wp_die( __( 'Error: You are replying to a comment on a draft post.' ) ); } @@ -2057,7 +2057,7 @@ function wp_ajax_inline_save() { } // Hack: wp_unique_post_slug() doesn't work for drafts, so we will fake that our post is published. - if ( ! empty( $data['post_name'] ) && in_array( $post['post_status'], array( 'draft', 'pending' ) ) ) { + if ( ! empty( $data['post_name'] ) && in_array( $post['post_status'], array( 'draft', 'pending' ), true ) ) { $post['post_status'] = 'publish'; $data['post_name'] = wp_unique_post_slug( $data['post_name'], $post['ID'], $post['post_status'], $post['post_type'], $post['post_parent'] ); } @@ -2525,7 +2525,7 @@ function wp_ajax_upload_attachment() { } // If the context is custom header or background, make sure the uploaded file is an image. - if ( isset( $post_data['context'] ) && in_array( $post_data['context'], array( 'custom-header', 'custom-background' ) ) ) { + if ( isset( $post_data['context'] ) && in_array( $post_data['context'], array( 'custom-header', 'custom-background' ), true ) ) { $wp_filetype = wp_check_filetype_and_ext( $_FILES['async-upload']['tmp_name'], $_FILES['async-upload']['name'] ); if ( ! wp_match_mime_types( 'image', $wp_filetype['type'] ) ) { @@ -2852,7 +2852,7 @@ function wp_ajax_dismiss_wp_pointer() { $dismissed = array_filter( explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) ) ); - if ( in_array( $pointer, $dismissed ) ) { + if ( in_array( $pointer, $dismissed, true ) ) { wp_die( 0 ); } diff --git a/wp-admin/includes/class-custom-background.php b/wp-admin/includes/class-custom-background.php index 30a05bf607..b62db4fb05 100644 --- a/wp-admin/includes/class-custom-background.php +++ b/wp-admin/includes/class-custom-background.php @@ -601,7 +601,7 @@ class Custom_Background { ); $size = 'thumbnail'; - if ( in_array( $_POST['size'], $sizes ) ) { + if ( in_array( $_POST['size'], $sizes, true ) ) { $size = esc_attr( $_POST['size'] ); } diff --git a/wp-admin/includes/class-custom-image-header.php b/wp-admin/includes/class-custom-image-header.php index 841dccc319..a8264d5bb7 100644 --- a/wp-admin/includes/class-custom-image-header.php +++ b/wp-admin/includes/class-custom-image-header.php @@ -1097,7 +1097,7 @@ endif; return; } - if ( in_array( $choice, array( 'remove-header', 'random-default-image', 'random-uploaded-image' ) ) ) { + if ( in_array( $choice, array( 'remove-header', 'random-default-image', 'random-uploaded-image' ), true ) ) { set_theme_mod( 'header_image', $choice ); remove_theme_mod( 'header_image_data' ); return; diff --git a/wp-admin/includes/class-walker-category-checklist.php b/wp-admin/includes/class-walker-category-checklist.php index 488d34d134..3647d8770b 100644 --- a/wp-admin/includes/class-walker-category-checklist.php +++ b/wp-admin/includes/class-walker-category-checklist.php @@ -82,7 +82,8 @@ class Walker_Category_Checklist extends Walker { } $args['popular_cats'] = empty( $args['popular_cats'] ) ? array() : $args['popular_cats']; - $class = in_array( $category->term_id, $args['popular_cats'] ) ? ' class="popular-category"' : ''; + + $class = in_array( $category->term_id, $args['popular_cats'] ) ? ' class="popular-category"' : ''; $args['selected_cats'] = empty( $args['selected_cats'] ) ? array() : $args['selected_cats']; diff --git a/wp-admin/includes/class-wp-automatic-updater.php b/wp-admin/includes/class-wp-automatic-updater.php index d6ec70e85b..10461f8f50 100644 --- a/wp-admin/includes/class-wp-automatic-updater.php +++ b/wp-admin/includes/class-wp-automatic-updater.php @@ -577,7 +577,7 @@ class WP_Automatic_Updater { */ $send = true; $transient_failures = array( 'incompatible_archive', 'download_failed', 'insane_distro', 'locked' ); - if ( in_array( $error_code, $transient_failures ) && ! get_site_option( 'auto_core_update_failed' ) ) { + if ( in_array( $error_code, $transient_failures, true ) && ! get_site_option( 'auto_core_update_failed' ) ) { wp_schedule_single_event( time() + HOUR_IN_SECONDS, 'wp_maybe_auto_update' ); $send = false; } @@ -596,7 +596,7 @@ class WP_Automatic_Updater { 'error_code' => $error_code, 'error_data' => $result->get_error_data(), 'timestamp' => time(), - 'retry' => in_array( $error_code, $transient_failures ), + 'retry' => in_array( $error_code, $transient_failures, true ), ) ); diff --git a/wp-admin/includes/class-wp-comments-list-table.php b/wp-admin/includes/class-wp-comments-list-table.php index be00e1f7b2..9b273f42fb 100644 --- a/wp-admin/includes/class-wp-comments-list-table.php +++ b/wp-admin/includes/class-wp-comments-list-table.php @@ -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' ); diff --git a/wp-admin/includes/class-wp-community-events.php b/wp-admin/includes/class-wp-community-events.php index 443968f4d7..7e9c7fdbb1 100644 --- a/wp-admin/includes/class-wp-community-events.php +++ b/wp-admin/includes/class-wp-community-events.php @@ -466,7 +466,7 @@ class WP_Community_Events { $trimmed_event_types = wp_list_pluck( $response_body['events'], 'type' ); // Make sure the soonest upcoming WordCamp is pinned in the list. - if ( ! in_array( 'wordcamp', $trimmed_event_types ) && $wordcamps ) { + if ( ! in_array( 'wordcamp', $trimmed_event_types, true ) && $wordcamps ) { array_pop( $response_body['events'] ); array_push( $response_body['events'], $wordcamps[0] ); } diff --git a/wp-admin/includes/class-wp-list-table.php b/wp-admin/includes/class-wp-list-table.php index c423eebbca..791ee7c159 100644 --- a/wp-admin/includes/class-wp-list-table.php +++ b/wp-admin/includes/class-wp-list-table.php @@ -181,7 +181,7 @@ class WP_List_Table { * @return mixed Property. */ public function __get( $name ) { - if ( in_array( $name, $this->compat_fields ) ) { + if ( in_array( $name, $this->compat_fields, true ) ) { return $this->$name; } } @@ -196,7 +196,7 @@ class WP_List_Table { * @return mixed Newly-set property. */ public function __set( $name, $value ) { - if ( in_array( $name, $this->compat_fields ) ) { + if ( in_array( $name, $this->compat_fields, true ) ) { return $this->$name = $value; } } @@ -210,7 +210,7 @@ class WP_List_Table { * @return bool Whether the property is set. */ public function __isset( $name ) { - if ( in_array( $name, $this->compat_fields ) ) { + if ( in_array( $name, $this->compat_fields, true ) ) { return isset( $this->$name ); } } @@ -223,7 +223,7 @@ class WP_List_Table { * @param string $name Property to unset. */ public function __unset( $name ) { - if ( in_array( $name, $this->compat_fields ) ) { + if ( in_array( $name, $this->compat_fields, true ) ) { unset( $this->$name ); } } @@ -238,7 +238,7 @@ class WP_List_Table { * @return mixed|bool Return value of the callback, false otherwise. */ public function __call( $name, $arguments ) { - if ( in_array( $name, $this->compat_methods ) ) { + if ( in_array( $name, $this->compat_methods, true ) ) { return $this->$name( ...$arguments ); } return false; @@ -1133,13 +1133,13 @@ class WP_List_Table { foreach ( $columns as $column_key => $column_display_name ) { $class = array( 'manage-column', "column-$column_key" ); - if ( in_array( $column_key, $hidden ) ) { + if ( in_array( $column_key, $hidden, true ) ) { $class[] = 'hidden'; } if ( 'cb' === $column_key ) { $class[] = 'check-column'; - } elseif ( in_array( $column_key, array( 'posts', 'comments', 'links' ) ) ) { + } elseif ( in_array( $column_key, array( 'posts', 'comments', 'links' ), true ) ) { $class[] = 'num'; } @@ -1329,7 +1329,7 @@ class WP_List_Table { $classes .= ' has-row-actions column-primary'; } - if ( in_array( $column_name, $hidden ) ) { + if ( in_array( $column_name, $hidden, true ) ) { $classes .= ' hidden'; } diff --git a/wp-admin/includes/class-wp-ms-themes-list-table.php b/wp-admin/includes/class-wp-ms-themes-list-table.php index 6cce71439e..03441acbe6 100644 --- a/wp-admin/includes/class-wp-ms-themes-list-table.php +++ b/wp-admin/includes/class-wp-ms-themes-list-table.php @@ -45,7 +45,7 @@ class WP_MS_Themes_List_Table extends WP_List_Table { ); $status = isset( $_REQUEST['theme_status'] ) ? $_REQUEST['theme_status'] : 'all'; - if ( ! in_array( $status, array( 'all', 'enabled', 'disabled', 'upgrade', 'search', 'broken' ) ) ) { + if ( ! in_array( $status, array( 'all', 'enabled', 'disabled', 'upgrade', 'search', 'broken' ), true ) ) { $status = 'all'; } @@ -143,7 +143,7 @@ class WP_MS_Themes_List_Table extends WP_List_Table { $totals[ $type ] = count( $list ); } - if ( empty( $themes[ $status ] ) && ! in_array( $status, array( 'all', 'search' ) ) ) { + if ( empty( $themes[ $status ] ) && ! in_array( $status, array( 'all', 'search' ), true ) ) { $status = 'all'; } @@ -674,7 +674,7 @@ class WP_MS_Themes_List_Table extends WP_List_Table { foreach ( $columns as $column_name => $column_display_name ) { $extra_classes = ''; - if ( in_array( $column_name, $hidden ) ) { + if ( in_array( $column_name, $hidden, true ) ) { $extra_classes .= ' hidden'; } diff --git a/wp-admin/includes/class-wp-ms-users-list-table.php b/wp-admin/includes/class-wp-ms-users-list-table.php index 1a66738d47..4f2932acdc 100644 --- a/wp-admin/includes/class-wp-ms-users-list-table.php +++ b/wp-admin/includes/class-wp-ms-users-list-table.php @@ -281,7 +281,7 @@ class WP_MS_Users_List_Table extends WP_List_Table { user_login, $super_admins ) ) { + if ( in_array( $user->user_login, $super_admins, true ) ) { echo ' — ' . __( 'Super Admin' ); } ?> diff --git a/wp-admin/includes/class-wp-plugin-install-list-table.php b/wp-admin/includes/class-wp-plugin-install-list-table.php index efb46b5dba..ff172b80d0 100644 --- a/wp-admin/includes/class-wp-plugin-install-list-table.php +++ b/wp-admin/includes/class-wp-plugin-install-list-table.php @@ -136,7 +136,7 @@ class WP_Plugin_Install_List_Table extends WP_List_Table { $nonmenu_tabs = apply_filters( 'install_plugins_nonmenu_tabs', $nonmenu_tabs ); // If a non-valid menu tab has been selected, And it's not a non-menu action. - if ( empty( $tab ) || ( ! isset( $tabs[ $tab ] ) && ! in_array( $tab, (array) $nonmenu_tabs ) ) ) { + if ( empty( $tab ) || ( ! isset( $tabs[ $tab ] ) && ! in_array( $tab, (array) $nonmenu_tabs, true ) ) ) { $tab = key( $tabs ); } diff --git a/wp-admin/includes/class-wp-plugins-list-table.php b/wp-admin/includes/class-wp-plugins-list-table.php index 3ec88eb7c2..ba8584ecc6 100644 --- a/wp-admin/includes/class-wp-plugins-list-table.php +++ b/wp-admin/includes/class-wp-plugins-list-table.php @@ -39,8 +39,10 @@ class WP_Plugins_List_Table extends WP_List_Table { ) ); + $status_whitelist = array( 'active', 'inactive', 'recently_activated', 'upgrade', 'mustuse', 'dropins', 'search', 'paused' ); + $status = 'all'; - if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], array( 'active', 'inactive', 'recently_activated', 'upgrade', 'mustuse', 'dropins', 'search', 'paused' ) ) ) { + if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], $status_whitelist, true ) ) { $status = $_REQUEST['plugin_status']; } @@ -243,7 +245,7 @@ class WP_Plugins_List_Table extends WP_List_Table { $totals[ $type ] = count( $list ); } - if ( empty( $plugins[ $status ] ) && ! in_array( $status, array( 'all', 'search' ) ) ) { + if ( empty( $plugins[ $status ] ) && ! in_array( $status, array( 'all', 'search' ), true ) ) { $status = 'all'; } @@ -398,7 +400,7 @@ class WP_Plugins_List_Table extends WP_List_Table { global $status; return array( - 'cb' => ! in_array( $status, array( 'mustuse', 'dropins' ) ) ? '' : '', + 'cb' => ! in_array( $status, array( 'mustuse', 'dropins' ), true ) ? '' : '', 'name' => __( 'Plugin' ), 'description' => __( 'Description' ), ); @@ -542,7 +544,7 @@ class WP_Plugins_List_Table extends WP_List_Table { public function bulk_actions( $which = '' ) { global $status; - if ( in_array( $status, array( 'mustuse', 'dropins' ) ) ) { + if ( in_array( $status, array( 'mustuse', 'dropins' ), true ) ) { return; } @@ -556,7 +558,7 @@ class WP_Plugins_List_Table extends WP_List_Table { protected function extra_tablenav( $which ) { global $status; - if ( ! in_array( $status, array( 'recently_activated', 'mustuse', 'dropins' ) ) ) { + if ( ! in_array( $status, array( 'recently_activated', 'mustuse', 'dropins' ), true ) ) { return; } @@ -597,7 +599,7 @@ class WP_Plugins_List_Table extends WP_List_Table { public function display_rows() { global $status; - if ( is_multisite() && ! $this->screen->in_admin( 'network' ) && in_array( $status, array( 'mustuse', 'dropins' ) ) ) { + if ( is_multisite() && ! $this->screen->in_admin( 'network' ) && in_array( $status, array( 'mustuse', 'dropins' ), true ) ) { return; } @@ -831,7 +833,7 @@ class WP_Plugins_List_Table extends WP_List_Table { $compatible_php = is_php_version_compatible( $requires_php ); $class = $is_active ? 'active' : 'inactive'; $checkbox_id = 'checkbox_' . md5( $plugin_data['Name'] ); - if ( $restrict_network_active || $restrict_network_only || in_array( $status, array( 'mustuse', 'dropins' ) ) || ! $compatible_php ) { + if ( $restrict_network_active || $restrict_network_only || in_array( $status, array( 'mustuse', 'dropins' ), true ) || ! $compatible_php ) { $checkbox = ''; } else { $checkbox = sprintf( @@ -870,7 +872,7 @@ class WP_Plugins_List_Table extends WP_List_Table { foreach ( $columns as $column_name => $column_display_name ) { $extra_classes = ''; - if ( in_array( $column_name, $hidden ) ) { + if ( in_array( $column_name, $hidden, true ) ) { $extra_classes = ' hidden'; } diff --git a/wp-admin/includes/class-wp-posts-list-table.php b/wp-admin/includes/class-wp-posts-list-table.php index b1aec0f793..871feeb84e 100644 --- a/wp-admin/includes/class-wp-posts-list-table.php +++ b/wp-admin/includes/class-wp-posts-list-table.php @@ -161,7 +161,7 @@ class WP_Posts_List_Table extends WP_List_Table { } else { $post_counts = (array) wp_count_posts( $post_type, 'readable' ); - if ( isset( $_REQUEST['post_status'] ) && in_array( $_REQUEST['post_status'], $avail_post_stati ) ) { + if ( isset( $_REQUEST['post_status'] ) && in_array( $_REQUEST['post_status'], $avail_post_stati, true ) ) { $total_items = $post_counts[ $_REQUEST['post_status'] ]; } elseif ( isset( $_REQUEST['show_sticky'] ) && $_REQUEST['show_sticky'] ) { $total_items = $this->sticky_posts_count; @@ -346,7 +346,7 @@ class WP_Posts_List_Table extends WP_List_Table { $status_name = $status->name; - if ( ! in_array( $status_name, $avail_post_stati ) || empty( $num_posts->$status_name ) ) { + if ( ! in_array( $status_name, $avail_post_stati, true ) || empty( $num_posts->$status_name ) ) { continue; } @@ -391,7 +391,7 @@ class WP_Posts_List_Table extends WP_List_Table { ); // Sticky comes after Publish, or if not listed, after All. - $split = 1 + array_search( ( isset( $status_links['publish'] ) ? 'publish' : 'all' ), array_keys( $status_links ) ); + $split = 1 + array_search( ( isset( $status_links['publish'] ) ? 'publish' : 'all' ), array_keys( $status_links ), true ); $status_links = array_merge( array_slice( $status_links, 0, $split ), $sticky_link, array_slice( $status_links, $split ) ); } @@ -646,7 +646,7 @@ class WP_Posts_List_Table extends WP_List_Table { } $post_status = ! empty( $_REQUEST['post_status'] ) ? $_REQUEST['post_status'] : 'all'; - if ( post_type_supports( $post_type, 'comments' ) && ! in_array( $post_status, array( 'pending', 'draft', 'future' ) ) ) { + if ( post_type_supports( $post_type, 'comments' ) && ! in_array( $post_status, array( 'pending', 'draft', 'future' ), true ) ) { $posts_columns['comments'] = '' . __( 'Comments' ) . ''; } @@ -1384,7 +1384,7 @@ class WP_Posts_List_Table extends WP_List_Table { } if ( is_post_type_viewable( $post_type_object ) ) { - if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ) ) ) { + if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ), true ) ) { if ( $can_edit_post ) { $preview_link = get_preview_post_link( $post ); $actions['view'] = sprintf( diff --git a/wp-admin/includes/class-wp-screen.php b/wp-admin/includes/class-wp-screen.php index 3a06e3a34a..e983ffef80 100644 --- a/wp-admin/includes/class-wp-screen.php +++ b/wp-admin/includes/class-wp-screen.php @@ -1157,7 +1157,7 @@ final class WP_Screen { foreach ( $columns as $column => $title ) { // Can't hide these for they are special. - if ( in_array( $column, $special ) ) { + if ( in_array( $column, $special, true ) ) { continue; } @@ -1174,7 +1174,7 @@ final class WP_Screen { $id = "$column-hide"; echo '\n"; } ?> @@ -1310,7 +1310,7 @@ final class WP_Screen { */ $view_mode_post_types = apply_filters( 'view_mode_post_types', $view_mode_post_types ); - if ( ! in_array( $this->post_type, $view_mode_post_types ) ) { + if ( ! in_array( $this->post_type, $view_mode_post_types, true ) ) { return; } diff --git a/wp-admin/includes/class-wp-terms-list-table.php b/wp-admin/includes/class-wp-terms-list-table.php index 9af2f0e502..03b997a443 100644 --- a/wp-admin/includes/class-wp-terms-list-table.php +++ b/wp-admin/includes/class-wp-terms-list-table.php @@ -61,7 +61,7 @@ class WP_Terms_List_Table extends WP_List_Table { $tax = get_taxonomy( $taxonomy ); // @todo Still needed? Maybe just the show_ui part. - if ( empty( $post_type ) || ! in_array( $post_type, get_post_types( array( 'show_ui' => true ) ) ) ) { + if ( empty( $post_type ) || ! in_array( $post_type, get_post_types( array( 'show_ui' => true ) ), true ) ) { $post_type = 'post'; } diff --git a/wp-admin/includes/class-wp-theme-install-list-table.php b/wp-admin/includes/class-wp-theme-install-list-table.php index 04594edaa0..824e213a0c 100644 --- a/wp-admin/includes/class-wp-theme-install-list-table.php +++ b/wp-admin/includes/class-wp-theme-install-list-table.php @@ -82,7 +82,7 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table { $nonmenu_tabs = apply_filters( 'install_themes_nonmenu_tabs', $nonmenu_tabs ); // If a non-valid menu tab has been selected, And it's not a non-menu action. - if ( empty( $tab ) || ( ! isset( $tabs[ $tab ] ) && ! in_array( $tab, (array) $nonmenu_tabs ) ) ) { + if ( empty( $tab ) || ( ! isset( $tabs[ $tab ] ) && ! in_array( $tab, (array) $nonmenu_tabs, true ) ) ) { $tab = key( $tabs ); } diff --git a/wp-admin/includes/class-wp-themes-list-table.php b/wp-admin/includes/class-wp-themes-list-table.php index 73143f393f..c9d943549a 100644 --- a/wp-admin/includes/class-wp-themes-list-table.php +++ b/wp-admin/includes/class-wp-themes-list-table.php @@ -302,14 +302,14 @@ class WP_Themes_List_Table extends WP_List_Table { public function search_theme( $theme ) { // Search the features. foreach ( $this->features as $word ) { - if ( ! in_array( $word, $theme->get( 'Tags' ) ) ) { + if ( ! in_array( $word, $theme->get( 'Tags' ), true ) ) { return false; } } // Match all phrases. foreach ( $this->search_terms as $word ) { - if ( in_array( $word, $theme->get( 'Tags' ) ) ) { + if ( in_array( $word, $theme->get( 'Tags' ), true ) ) { continue; } diff --git a/wp-admin/includes/class-wp-upgrader.php b/wp-admin/includes/class-wp-upgrader.php index a399bad07f..760d598515 100644 --- a/wp-admin/includes/class-wp-upgrader.php +++ b/wp-admin/includes/class-wp-upgrader.php @@ -545,7 +545,7 @@ class WP_Upgrader { $protected_directories = array_merge( $protected_directories, $wp_theme_directories ); } - if ( in_array( $destination, $protected_directories ) ) { + if ( in_array( $destination, $protected_directories, true ) ) { $remote_destination = trailingslashit( $remote_destination ) . trailingslashit( basename( $source ) ); $destination = trailingslashit( $destination ) . trailingslashit( basename( $source ) ); } diff --git a/wp-admin/includes/class-wp-users-list-table.php b/wp-admin/includes/class-wp-users-list-table.php index 505aa9a435..018654bdd2 100644 --- a/wp-admin/includes/class-wp-users-list-table.php +++ b/wp-admin/includes/class-wp-users-list-table.php @@ -517,7 +517,7 @@ class WP_Users_List_Table extends WP_List_Table { $classes .= ' num'; // Special case for that column. } - if ( in_array( $column_name, $hidden ) ) { + if ( in_array( $column_name, $hidden, true ) ) { $classes .= ' hidden'; } diff --git a/wp-admin/includes/dashboard.php b/wp-admin/includes/dashboard.php index ef2e833132..2a31c6c0b3 100644 --- a/wp-admin/includes/dashboard.php +++ b/wp-admin/includes/dashboard.php @@ -195,7 +195,7 @@ function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_ $side_widgets = array( 'dashboard_quick_press', 'dashboard_primary' ); $location = 'normal'; - if ( in_array( $widget_id, $side_widgets ) ) { + if ( in_array( $widget_id, $side_widgets, true ) ) { $location = 'side'; } diff --git a/wp-admin/includes/file.php b/wp-admin/includes/file.php index be67f664f3..53967c6dfb 100644 --- a/wp-admin/includes/file.php +++ b/wp-admin/includes/file.php @@ -1215,7 +1215,7 @@ function verify_file_signature( $filename, $signatures, $filename_for_errors = f } // Check we can process signatures. - if ( ! function_exists( 'sodium_crypto_sign_verify_detached' ) || ! in_array( 'sha384', array_map( 'strtolower', hash_algos() ) ) ) { + if ( ! function_exists( 'sodium_crypto_sign_verify_detached' ) || ! in_array( 'sha384', array_map( 'strtolower', hash_algos() ), true ) ) { return new WP_Error( 'signature_verification_unsupported', sprintf( @@ -1540,7 +1540,7 @@ function _unzip_file_ziparchive( $file, $to, $needed_dirs = array() ) { } $parent_folder = dirname( $dir ); - while ( ! empty( $parent_folder ) && untrailingslashit( $to ) != $parent_folder && ! in_array( $parent_folder, $needed_dirs ) ) { + while ( ! empty( $parent_folder ) && untrailingslashit( $to ) != $parent_folder && ! in_array( $parent_folder, $needed_dirs, true ) ) { $needed_dirs[] = $parent_folder; $parent_folder = dirname( $parent_folder ); } @@ -1666,7 +1666,7 @@ function _unzip_file_pclzip( $file, $to, $needed_dirs = array() ) { } $parent_folder = dirname( $dir ); - while ( ! empty( $parent_folder ) && untrailingslashit( $to ) != $parent_folder && ! in_array( $parent_folder, $needed_dirs ) ) { + while ( ! empty( $parent_folder ) && untrailingslashit( $to ) != $parent_folder && ! in_array( $parent_folder, $needed_dirs, true ) ) { $needed_dirs[] = $parent_folder; $parent_folder = dirname( $parent_folder ); } diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php index eba2c8b8db..c50666f6eb 100644 --- a/wp-admin/includes/media.php +++ b/wp-admin/includes/media.php @@ -950,7 +950,7 @@ function wp_media_upload_handler() { if ( isset( $_GET['tab'] ) && 'type_url' === $_GET['tab'] ) { $type = 'image'; - if ( isset( $_GET['type'] ) && in_array( $_GET['type'], array( 'video', 'audio', 'file' ) ) ) { + if ( isset( $_GET['type'] ) && in_array( $_GET['type'], array( 'video', 'audio', 'file' ), true ) ) { $type = $_GET['type']; } diff --git a/wp-admin/includes/meta-boxes.php b/wp-admin/includes/meta-boxes.php index 8e3ec6fb1c..2b4760a6da 100644 --- a/wp-admin/includes/meta-boxes.php +++ b/wp-admin/includes/meta-boxes.php @@ -334,7 +334,7 @@ endif;' . __( 'No comments yet.' ) . '
'; } else { $hidden = get_hidden_meta_boxes( get_current_screen() ); - if ( ! in_array( 'commentsdiv', $hidden ) ) { + if ( ! in_array( 'commentsdiv', $hidden, true ) ) { ?> link_rel ) ? $link->link_rel : ''; // In PHP 5.3: $link_rel = $link->link_rel ?: ''; $rels = preg_split( '/\s+/', $link_rel ); - if ( '' != $value && in_array( $value, $rels ) ) { + if ( '' != $value && in_array( $value, $rels, true ) ) { echo ' checked="checked"'; } @@ -1196,7 +1196,7 @@ function xfn_check( $class, $value = '', $deprecated = '' ) { if ( 'geographical' == $class && strpos( $link_rel, 'co-resident' ) === false && strpos( $link_rel, 'neighbor' ) === false ) { echo ' checked="checked"'; } - if ( 'identity' == $class && in_array( 'me', $rels ) ) { + if ( 'identity' == $class && in_array( 'me', $rels, true ) ) { echo ' checked="checked"'; } } @@ -1535,7 +1535,7 @@ function register_and_do_post_meta_boxes( $post ) { } $stati[] = 'private'; - if ( in_array( get_post_status( $post ), $stati ) ) { + if ( in_array( get_post_status( $post ), $stati, true ) ) { // If the post type support comments, or the post has comments, // allow the Comments meta box. if ( comments_open( $post ) || pings_open( $post ) || $post->comment_count > 0 || post_type_supports( $post_type, 'comments' ) ) { diff --git a/wp-admin/includes/misc.php b/wp-admin/includes/misc.php index 736dba8f3e..ba10e55f0e 100644 --- a/wp-admin/includes/misc.php +++ b/wp-admin/includes/misc.php @@ -599,7 +599,9 @@ function wp_doc_link_parse( $content ) { if ( T_STRING == $tokens[ $t ][0] && ( '(' == $tokens[ $t + 1 ] || '(' == $tokens[ $t + 2 ] ) ) { // If it's a function or class defined locally, there's not going to be any docs available. - if ( ( isset( $tokens[ $t - 2 ][1] ) && in_array( $tokens[ $t - 2 ][1], array( 'function', 'class' ) ) ) || ( isset( $tokens[ $t - 2 ][0] ) && T_OBJECT_OPERATOR == $tokens[ $t - 1 ][0] ) ) { + if ( ( isset( $tokens[ $t - 2 ][1] ) && in_array( $tokens[ $t - 2 ][1], array( 'function', 'class' ), true ) ) + || ( isset( $tokens[ $t - 2 ][0] ) && T_OBJECT_OPERATOR == $tokens[ $t - 1 ][0] ) + ) { $ignore_functions[] = $tokens[ $t ][1]; } // Add this to our stack of unique references. @@ -623,7 +625,7 @@ function wp_doc_link_parse( $content ) { $out = array(); foreach ( $functions as $function ) { - if ( in_array( $function, $ignore_functions ) ) { + if ( in_array( $function, $ignore_functions, true ) ) { continue; } $out[] = $function; @@ -656,9 +658,9 @@ function set_screen_options() { $map_option = $option; $type = str_replace( 'edit_', '', $map_option ); $type = str_replace( '_per_page', '', $type ); - if ( in_array( $type, get_taxonomies() ) ) { + if ( in_array( $type, get_taxonomies(), true ) ) { $map_option = 'edit_tags_per_page'; - } elseif ( in_array( $type, get_post_types() ) ) { + } elseif ( in_array( $type, get_post_types(), true ) ) { $map_option = 'edit_per_page'; } else { $option = str_replace( '-', '_', $option ); diff --git a/wp-admin/includes/ms.php b/wp-admin/includes/ms.php index d66433a2e5..f1567cb5d4 100644 --- a/wp-admin/includes/ms.php +++ b/wp-admin/includes/ms.php @@ -886,7 +886,7 @@ function confirm_delete_users( $users ) { ); } - if ( in_array( $delete_user->user_login, $site_admins ) ) { + if ( in_array( $delete_user->user_login, $site_admins, true ) ) { wp_die( sprintf( /* translators: %s: User login. */ diff --git a/wp-admin/includes/nav-menu.php b/wp-admin/includes/nav-menu.php index be068c21eb..e3d1053f77 100644 --- a/wp-admin/includes/nav-menu.php +++ b/wp-admin/includes/nav-menu.php @@ -25,7 +25,11 @@ function _wp_ajax_menu_quick_search( $request = array() ) { $type = isset( $request['type'] ) ? $request['type'] : ''; $object_type = isset( $request['object_type'] ) ? $request['object_type'] : ''; $query = isset( $request['q'] ) ? $request['q'] : ''; - $response_format = isset( $request['response-format'] ) && in_array( $request['response-format'], array( 'json', 'markup' ) ) ? $request['response-format'] : 'json'; + $response_format = isset( $request['response-format'] ) ? $request['response-format'] : ''; + + if ( ! $response_format || ! in_array( $response_format, array( 'json', 'markup' ), true ) ) { + $response_format = 'json'; + } if ( 'markup' == $response_format ) { $args['walker'] = new Walker_Nav_Menu_Checklist; @@ -184,7 +188,7 @@ function wp_initial_nav_menu_meta_boxes() { foreach ( array_keys( $wp_meta_boxes['nav-menus'] ) as $context ) { foreach ( array_keys( $wp_meta_boxes['nav-menus'][ $context ] ) as $priority ) { foreach ( $wp_meta_boxes['nav-menus'][ $context ][ $priority ] as $box ) { - if ( in_array( $box['id'], $initial_meta_boxes ) ) { + if ( in_array( $box['id'], $initial_meta_boxes, true ) ) { unset( $box['id'] ); } else { $hidden_meta_boxes[] = $box['id']; @@ -336,10 +340,11 @@ function wp_nav_menu_item_post_type_meta_box( $object, $box ) { $post_type_name = $box['args']->name; $post_type = get_post_type_object( $post_type_name ); + $tab_name = $post_type_name . '-tab'; // Paginate browsing for large numbers of post objects. $per_page = 50; - $pagenum = isset( $_REQUEST[ $post_type_name . '-tab' ] ) && isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 1; + $pagenum = isset( $_REQUEST[ $tab_name ] ) && isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 1; $offset = 0 < $pagenum ? $per_page * ( $pagenum - 1 ) : 0; $args = array( @@ -447,10 +452,10 @@ function wp_nav_menu_item_post_type_meta_box( $object, $box ) { array( 'base' => add_query_arg( array( - $post_type_name . '-tab' => 'all', - 'paged' => '%#%', - 'item-type' => 'post_type', - 'item-object' => $post_type_name, + $tab_name => 'all', + 'paged' => '%#%', + 'item-type' => 'post_type', + 'item-object' => $post_type_name, ) ), 'format' => '', @@ -473,8 +478,9 @@ function wp_nav_menu_item_post_type_meta_box( $object, $box ) { $walker = new Walker_Nav_Menu_Checklist( $db_fields ); $current_tab = 'most-recent'; - if ( isset( $_REQUEST[ $post_type_name . '-tab' ] ) && in_array( $_REQUEST[ $post_type_name . '-tab' ], array( 'all', 'search' ) ) ) { - $current_tab = $_REQUEST[ $post_type_name . '-tab' ]; + + if ( isset( $_REQUEST[ $tab_name ] ) && in_array( $_REQUEST[ $tab_name ], array( 'all', 'search' ), true ) ) { + $current_tab = $_REQUEST[ $tab_name ]; } if ( ! empty( $_REQUEST[ 'quick-search-posttype-' . $post_type_name ] ) ) { @@ -494,9 +500,9 @@ function wp_nav_menu_item_post_type_meta_box( $object, $box ) { $view_all_url = ''; $search_url = ''; if ( $nav_menu_selected_id ) { - $most_recent_url = esc_url( add_query_arg( $post_type_name . '-tab', 'most-recent', remove_query_arg( $removed_args ) ) ); - $view_all_url = esc_url( add_query_arg( $post_type_name . '-tab', 'all', remove_query_arg( $removed_args ) ) ); - $search_url = esc_url( add_query_arg( $post_type_name . '-tab', 'search', remove_query_arg( $removed_args ) ) ); + $most_recent_url = esc_url( add_query_arg( $tab_name, 'most-recent', remove_query_arg( $removed_args ) ) ); + $view_all_url = esc_url( add_query_arg( $tab_name, 'all', remove_query_arg( $removed_args ) ) ); + $search_url = esc_url( add_query_arg( $tab_name, 'search', remove_query_arg( $removed_args ) ) ); } ?>