mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +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:
@@ -42,7 +42,7 @@
|
||||
function redirect_canonical( $requested_url = null, $do_redirect = true ) {
|
||||
global $wp_rewrite, $is_IIS, $wp_query, $wpdb, $wp;
|
||||
|
||||
if ( isset( $_SERVER['REQUEST_METHOD'] ) && ! in_array( strtoupper( $_SERVER['REQUEST_METHOD'] ), array( 'GET', 'HEAD' ) ) ) {
|
||||
if ( isset( $_SERVER['REQUEST_METHOD'] ) && ! in_array( strtoupper( $_SERVER['REQUEST_METHOD'] ), array( 'GET', 'HEAD' ), true ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -331,7 +331,7 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) {
|
||||
}
|
||||
|
||||
$addl_path = '';
|
||||
if ( is_feed() && in_array( get_query_var( 'feed' ), $wp_rewrite->feeds ) ) {
|
||||
if ( is_feed() && in_array( get_query_var( 'feed' ), $wp_rewrite->feeds, true ) ) {
|
||||
$addl_path = ! empty( $addl_path ) ? trailingslashit( $addl_path ) : '';
|
||||
if ( ! is_singular() && get_query_var( 'withcomments' ) ) {
|
||||
$addl_path .= 'comments/';
|
||||
@@ -751,7 +751,7 @@ function wp_redirect_admin_locations() {
|
||||
site_url( 'dashboard', 'relative' ),
|
||||
site_url( 'admin', 'relative' ),
|
||||
);
|
||||
if ( in_array( untrailingslashit( $_SERVER['REQUEST_URI'] ), $admins ) ) {
|
||||
if ( in_array( untrailingslashit( $_SERVER['REQUEST_URI'] ), $admins, true ) ) {
|
||||
wp_redirect( admin_url() );
|
||||
exit;
|
||||
}
|
||||
@@ -761,7 +761,7 @@ function wp_redirect_admin_locations() {
|
||||
home_url( 'login', 'relative' ),
|
||||
site_url( 'login', 'relative' ),
|
||||
);
|
||||
if ( in_array( untrailingslashit( $_SERVER['REQUEST_URI'] ), $logins ) ) {
|
||||
if ( in_array( untrailingslashit( $_SERVER['REQUEST_URI'] ), $logins, true ) ) {
|
||||
wp_redirect( wp_login_url() );
|
||||
exit;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user