mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-09 23:24:34 +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:
@@ -1032,7 +1032,7 @@ function _wp_link_page( $i ) {
|
||||
if ( 1 == $i ) {
|
||||
$url = get_permalink();
|
||||
} else {
|
||||
if ( '' == get_option( 'permalink_structure' ) || in_array( $post->post_status, array( 'draft', 'pending' ) ) ) {
|
||||
if ( '' == get_option( 'permalink_structure' ) || in_array( $post->post_status, array( 'draft', 'pending' ), true ) ) {
|
||||
$url = add_query_arg( 'page', $i, get_permalink() );
|
||||
} elseif ( 'page' == get_option( 'show_on_front' ) && get_option( 'page_on_front' ) == $post->ID ) {
|
||||
$url = trailingslashit( get_permalink() ) . user_trailingslashit( "$wp_rewrite->pagination_base/" . $i, 'single_paged' );
|
||||
@@ -1395,7 +1395,7 @@ function wp_page_menu( $args = array() ) {
|
||||
);
|
||||
$args = wp_parse_args( $args, $defaults );
|
||||
|
||||
if ( ! in_array( $args['item_spacing'], array( 'preserve', 'discard' ) ) ) {
|
||||
if ( ! in_array( $args['item_spacing'], array( 'preserve', 'discard' ), true ) ) {
|
||||
// Invalid value, fall back to default.
|
||||
$args['item_spacing'] = $defaults['item_spacing'];
|
||||
}
|
||||
@@ -1811,7 +1811,7 @@ function wp_post_revision_title( $revision, $link = true ) {
|
||||
return $revision;
|
||||
}
|
||||
|
||||
if ( ! in_array( $revision->post_type, array( 'post', 'page', 'revision' ) ) ) {
|
||||
if ( ! in_array( $revision->post_type, array( 'post', 'page', 'revision' ), true ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1852,7 +1852,7 @@ function wp_post_revision_title_expanded( $revision, $link = true ) {
|
||||
return $revision;
|
||||
}
|
||||
|
||||
if ( ! in_array( $revision->post_type, array( 'post', 'page', 'revision' ) ) ) {
|
||||
if ( ! in_array( $revision->post_type, array( 'post', 'page', 'revision' ), true ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user