mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-07 06:05:42 +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:
@@ -3233,7 +3233,7 @@ function wp_resource_hints() {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( in_array( $relation_type, array( 'preconnect', 'dns-prefetch' ) ) ) {
|
||||
if ( in_array( $relation_type, array( 'preconnect', 'dns-prefetch' ), true ) ) {
|
||||
$parsed = wp_parse_url( $url );
|
||||
|
||||
if ( empty( $parsed['host'] ) ) {
|
||||
@@ -3258,8 +3258,9 @@ function wp_resource_hints() {
|
||||
$html = '';
|
||||
|
||||
foreach ( $atts as $attr => $value ) {
|
||||
if ( ! is_scalar( $value ) ||
|
||||
( ! in_array( $attr, array( 'as', 'crossorigin', 'href', 'pr', 'rel', 'type' ), true ) && ! is_numeric( $attr ) ) ) {
|
||||
if ( ! is_scalar( $value )
|
||||
|| ( ! in_array( $attr, array( 'as', 'crossorigin', 'href', 'pr', 'rel', 'type' ), true ) && ! is_numeric( $attr ) )
|
||||
) {
|
||||
|
||||
continue;
|
||||
}
|
||||
@@ -3303,7 +3304,9 @@ function wp_dependencies_unique_hosts() {
|
||||
$dependency = $dependencies->registered[ $handle ];
|
||||
$parsed = wp_parse_url( $dependency->src );
|
||||
|
||||
if ( ! empty( $parsed['host'] ) && ! in_array( $parsed['host'], $unique_hosts ) && $parsed['host'] !== $_SERVER['SERVER_NAME'] ) {
|
||||
if ( ! empty( $parsed['host'] )
|
||||
&& ! in_array( $parsed['host'], $unique_hosts, true ) && $parsed['host'] !== $_SERVER['SERVER_NAME']
|
||||
) {
|
||||
$unique_hosts[] = $parsed['host'];
|
||||
}
|
||||
}
|
||||
@@ -3371,7 +3374,7 @@ function wp_default_editor() {
|
||||
$r = user_can_richedit() ? 'tinymce' : 'html'; // Defaults.
|
||||
if ( wp_get_current_user() ) { // Look for cookie.
|
||||
$ed = get_user_setting( 'editor', 'tinymce' );
|
||||
$r = ( in_array( $ed, array( 'tinymce', 'html', 'test' ) ) ) ? $ed : $r;
|
||||
$r = ( in_array( $ed, array( 'tinymce', 'html', 'test' ), true ) ) ? $ed : $r;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user