mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 09:07:59 +01:00
Coding Standards: Use strict comparison where count()
is involved.
Follow-up to [1636], [6974], [8114], [10322], [13326], [14760], [18006], [18541], [19743], [23249], [24115], [33359]. Props aristath, poena, afercia, SergeyBiryukov. See #57839. Built from https://develop.svn.wordpress.org/trunk@55642 git-svn-id: http://core.svn.wordpress.org/trunk@55154 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
0008d8df06
commit
bdfe3d5a46
@ -41,7 +41,7 @@ class WP_Importer {
|
||||
$hashtable[ $r->meta_value ] = (int) $r->post_id;
|
||||
}
|
||||
}
|
||||
} while ( count( $results ) == $limit );
|
||||
} while ( count( $results ) === $limit );
|
||||
|
||||
return $hashtable;
|
||||
}
|
||||
@ -110,7 +110,7 @@ class WP_Importer {
|
||||
}
|
||||
}
|
||||
}
|
||||
} while ( count( $results ) == $limit );
|
||||
} while ( count( $results ) === $limit );
|
||||
|
||||
return $hashtable;
|
||||
}
|
||||
|
@ -241,7 +241,7 @@ function add_menu_classes( $menu ) {
|
||||
$first_item = false;
|
||||
}
|
||||
|
||||
if ( $i == $items_count ) { // Last item.
|
||||
if ( $i === $items_count ) { // Last item.
|
||||
$classes = $menu[ $order ][4];
|
||||
$menu[ $order ][4] = add_cssclass( 'menu-top-last', $classes );
|
||||
}
|
||||
|
@ -2252,7 +2252,7 @@ class WP_Query {
|
||||
}
|
||||
if ( ! $post_type ) {
|
||||
$post_type = 'any';
|
||||
} elseif ( count( $post_type ) == 1 ) {
|
||||
} elseif ( count( $post_type ) === 1 ) {
|
||||
$post_type = $post_type[0];
|
||||
}
|
||||
|
||||
|
@ -1399,7 +1399,7 @@ class WP_Rewrite {
|
||||
// Extra permastructs.
|
||||
foreach ( $this->extra_permastructs as $permastructname => $struct ) {
|
||||
if ( is_array( $struct ) ) {
|
||||
if ( count( $struct ) == 2 ) {
|
||||
if ( count( $struct ) === 2 ) {
|
||||
$rules = $this->generate_rewrite_rules( $struct[0], $struct[1] );
|
||||
} else {
|
||||
$rules = $this->generate_rewrite_rules( $struct['struct'], $struct['ep_mask'], $struct['paged'], $struct['feed'], $struct['forcomments'], $struct['walk_dirs'], $struct['endpoints'] );
|
||||
|
@ -4243,7 +4243,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
}
|
||||
|
||||
// If no specific options where asked for, return all of them.
|
||||
if ( count( $options ) == 0 ) {
|
||||
if ( count( $options ) === 0 ) {
|
||||
$options = array_keys( $this->blog_options );
|
||||
}
|
||||
|
||||
|
@ -2297,7 +2297,7 @@ function get_usermeta( $user_id, $meta_key = '' ) {
|
||||
|
||||
$metas = array_map('maybe_unserialize', $metas);
|
||||
|
||||
if ( count($metas) == 1 )
|
||||
if ( count($metas) === 1 )
|
||||
return $metas[0];
|
||||
else
|
||||
return $metas;
|
||||
|
@ -1169,7 +1169,7 @@ function utf8_uri_encode( $utf8_string, $length = 0, $encode_ascii_characters =
|
||||
$unicode .= $encoded_char;
|
||||
$unicode_length += $encoded_char_length;
|
||||
} else {
|
||||
if ( count( $values ) == 0 ) {
|
||||
if ( count( $values ) === 0 ) {
|
||||
if ( $value < 224 ) {
|
||||
$num_octets = 2;
|
||||
} elseif ( $value < 240 ) {
|
||||
@ -1184,7 +1184,7 @@ function utf8_uri_encode( $utf8_string, $length = 0, $encode_ascii_characters =
|
||||
if ( $length && ( $unicode_length + ( $num_octets * 3 ) ) > $length ) {
|
||||
break;
|
||||
}
|
||||
if ( count( $values ) == $num_octets ) {
|
||||
if ( count( $values ) === $num_octets ) {
|
||||
for ( $j = 0; $j < $num_octets; $j++ ) {
|
||||
$unicode .= '%' . dechex( $values[ $j ] );
|
||||
}
|
||||
@ -3391,7 +3391,7 @@ function wp_remove_targeted_link_rel_filters() {
|
||||
function translate_smiley( $matches ) {
|
||||
global $wpsmiliestrans;
|
||||
|
||||
if ( count( $matches ) == 0 ) {
|
||||
if ( count( $matches ) === 0 ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
@ -5242,7 +5242,7 @@ function wp_sprintf_l( $pattern, $args ) {
|
||||
|
||||
$args = (array) $args;
|
||||
$result = array_shift( $args );
|
||||
if ( count( $args ) == 1 ) {
|
||||
if ( count( $args ) === 1 ) {
|
||||
$result .= $l['between_only_two'] . array_shift( $args );
|
||||
}
|
||||
|
||||
@ -5251,7 +5251,7 @@ function wp_sprintf_l( $pattern, $args ) {
|
||||
while ( $i ) {
|
||||
$arg = array_shift( $args );
|
||||
$i--;
|
||||
if ( 0 == $i ) {
|
||||
if ( 0 === $i ) {
|
||||
$result .= $l['between_last_two'] . $arg;
|
||||
} else {
|
||||
$result .= $l['between'] . $arg;
|
||||
|
@ -4754,7 +4754,7 @@ function smilies_init() {
|
||||
*/
|
||||
$wpsmiliestrans = apply_filters( 'smilies', $wpsmiliestrans );
|
||||
|
||||
if ( count( $wpsmiliestrans ) == 0 ) {
|
||||
if ( count( $wpsmiliestrans ) === 0 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -788,7 +788,7 @@ function wp_kses_one_attr( $attr, $element ) {
|
||||
// Parse attribute name and value from input.
|
||||
$split = preg_split( '/\s*=\s*/', $attr, 2 );
|
||||
$name = $split[0];
|
||||
if ( count( $split ) == 2 ) {
|
||||
if ( count( $split ) === 2 ) {
|
||||
$value = $split[1];
|
||||
|
||||
// Remove quotes surrounding $value.
|
||||
|
@ -274,7 +274,7 @@ function remove_user_from_blog( $user_id, $blog_id = 0, $reassign = 0 ) {
|
||||
$user->remove_all_caps();
|
||||
|
||||
$blogs = get_blogs_of_user( $user_id );
|
||||
if ( count( $blogs ) == 0 ) {
|
||||
if ( count( $blogs ) === 0 ) {
|
||||
update_user_meta( $user_id, 'primary_blog', '' );
|
||||
update_user_meta( $user_id, 'source_domain', '' );
|
||||
}
|
||||
|
@ -432,7 +432,7 @@ if ( ! function_exists( 'wp_mail' ) ) :
|
||||
$recipient_name = '';
|
||||
|
||||
if ( preg_match( '/(.*)<(.+)>/', $address, $matches ) ) {
|
||||
if ( count( $matches ) == 3 ) {
|
||||
if ( count( $matches ) === 3 ) {
|
||||
$recipient_name = $matches[1];
|
||||
$address = $matches[2];
|
||||
}
|
||||
|
@ -5732,7 +5732,7 @@ function get_page_by_path( $page_path, $output = OBJECT, $post_type = 'page' ) {
|
||||
$p = $parent;
|
||||
}
|
||||
|
||||
if ( 0 == $p->post_parent && count( $revparts ) == $count + 1 && $p->post_name == $revparts[ $count ] ) {
|
||||
if ( 0 == $p->post_parent && count( $revparts ) === $count + 1 && $p->post_name == $revparts[ $count ] ) {
|
||||
$foundid = $page->ID;
|
||||
if ( $page->post_type == $post_type ) {
|
||||
break;
|
||||
|
@ -152,7 +152,7 @@ function get_archive_template() {
|
||||
|
||||
$templates = array();
|
||||
|
||||
if ( count( $post_types ) == 1 ) {
|
||||
if ( count( $post_types ) === 1 ) {
|
||||
$post_type = reset( $post_types );
|
||||
$templates[] = "archive-{$post_type}.php";
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.3-alpha-55641';
|
||||
$wp_version = '6.3-alpha-55642';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user