diff --git a/wp-admin/includes/bookmark.php b/wp-admin/includes/bookmark.php index 124f9cf698..b66513e362 100644 --- a/wp-admin/includes/bookmark.php +++ b/wp-admin/includes/bookmark.php @@ -198,7 +198,7 @@ function wp_insert_link( $linkdata, $wp_error = false ) { $link_category = ( ! empty( $parsed_args['link_category'] ) ) ? $parsed_args['link_category'] : array(); // Make sure we set a valid category. - if ( ! is_array( $link_category ) || 0 == count( $link_category ) ) { + if ( ! is_array( $link_category ) || 0 === count( $link_category ) ) { $link_category = array( get_option( 'default_link_category' ) ); } @@ -257,7 +257,7 @@ function wp_insert_link( $linkdata, $wp_error = false ) { */ function wp_set_link_cats( $link_id = 0, $link_categories = array() ) { // If $link_categories isn't already an array, make it one: - if ( ! is_array( $link_categories ) || 0 == count( $link_categories ) ) { + if ( ! is_array( $link_categories ) || 0 === count( $link_categories ) ) { $link_categories = array( get_option( 'default_link_category' ) ); } diff --git a/wp-admin/includes/class-wp-upgrader.php b/wp-admin/includes/class-wp-upgrader.php index 902b160de3..8c85c99fb9 100644 --- a/wp-admin/includes/class-wp-upgrader.php +++ b/wp-admin/includes/class-wp-upgrader.php @@ -498,7 +498,7 @@ class WP_Upgrader { $remote_destination = $wp_filesystem->find_folder( $local_destination ); // Locate which directory to copy to the new folder. This is based on the actual folder holding the files. - if ( 1 == count( $source_files ) && $wp_filesystem->is_dir( trailingslashit( $args['source'] ) . $source_files[0] . '/' ) ) { + if ( 1 === count( $source_files ) && $wp_filesystem->is_dir( trailingslashit( $args['source'] ) . $source_files[0] . '/' ) ) { // Only one folder? Then we want its contents. $source = trailingslashit( $args['source'] ) . trailingslashit( $source_files[0] ); } elseif ( count( $source_files ) == 0 ) { diff --git a/wp-admin/includes/deprecated.php b/wp-admin/includes/deprecated.php index c37d7f5537..89d7eec437 100644 --- a/wp-admin/includes/deprecated.php +++ b/wp-admin/includes/deprecated.php @@ -1339,7 +1339,7 @@ function wp_dashboard_plugins_output( $rss, $args = array() ) { // Pick a random, non-installed plugin. while ( true ) { // Abort this foreach loop iteration if there's no plugins left of this type. - if ( 0 == count($items) ) + if ( 0 === count($items) ) continue 2; $item_key = array_rand($items); diff --git a/wp-admin/includes/file.php b/wp-admin/includes/file.php index fb31e5aa6b..9a0f93bac4 100644 --- a/wp-admin/includes/file.php +++ b/wp-admin/includes/file.php @@ -1627,7 +1627,7 @@ function _unzip_file_pclzip( $file, $to, $needed_dirs = array() ) { return new WP_Error( 'incompatible_archive', __( 'Incompatible Archive.' ), $archive->errorInfo( true ) ); } - if ( 0 == count( $archive_files ) ) { + if ( 0 === count( $archive_files ) ) { return new WP_Error( 'empty_archive_pclzip', __( 'Empty archive.' ) ); } diff --git a/wp-admin/includes/menu.php b/wp-admin/includes/menu.php index d3a09a36c3..7323443949 100644 --- a/wp-admin/includes/menu.php +++ b/wp-admin/includes/menu.php @@ -168,7 +168,7 @@ foreach ( $menu as $id => $data ) { * If there is only one submenu and it is has same destination as the parent, * remove the submenu. */ - if ( ! empty( $submenu[ $data[2] ] ) && 1 == count( $submenu[ $data[2] ] ) ) { + if ( ! empty( $submenu[ $data[2] ] ) && 1 === count( $submenu[ $data[2] ] ) ) { $subs = $submenu[ $data[2] ]; $first_sub = reset( $subs ); if ( $data[2] == $first_sub[2] ) { diff --git a/wp-admin/includes/ms.php b/wp-admin/includes/ms.php index aaffbd2266..bd5462182e 100644 --- a/wp-admin/includes/ms.php +++ b/wp-admin/includes/ms.php @@ -856,7 +856,7 @@ function confirm_delete_users( $users ) { ?>
- + @@ -974,7 +974,7 @@ function confirm_delete_users( $users ) { /** This action is documented in wp-admin/users.php */ do_action( 'delete_user_form', $current_user, $allusers ); - if ( 1 == count( $users ) ) : + if ( 1 === count( $users ) ) : ?> diff --git a/wp-admin/nav-menus.php b/wp-admin/nav-menus.php index f1a45022d5..65861ed900 100644 --- a/wp-admin/nav-menus.php +++ b/wp-admin/nav-menus.php @@ -423,12 +423,19 @@ $add_new_screen = ( isset( $_GET['menu'] ) && 0 == $_GET['menu'] ) ? true : fals $locations_screen = ( isset( $_GET['action'] ) && 'locations' === $_GET['action'] ) ? true : false; +$page_count = wp_count_posts( 'page' ); + /* * If we have one theme location, and zero menus, we take them right * into editing their first menu. */ -$page_count = wp_count_posts( 'page' ); -$one_theme_location_no_menus = ( 1 == count( get_registered_nav_menus() ) && ! $add_new_screen && empty( $nav_menus ) && ! empty( $page_count->publish ) ) ? true : false; +if ( 1 === count( get_registered_nav_menus() ) && ! $add_new_screen + && empty( $nav_menus ) && ! empty( $page_count->publish ) +) { + $one_theme_location_no_menus = true; +} else { + $one_theme_location_no_menus = false; +} $nav_menus_l10n = array( 'oneThemeLocationNoMenus' => $one_theme_location_no_menus, @@ -928,7 +935,7 @@ require_once ABSPATH . 'wp-admin/admin-header.php'; get_error_codes() ) && 'no_wildcard_dns' === $result->get_error_code() ) { + if ( 1 === count( $result->get_error_codes() ) && 'no_wildcard_dns' === $result->get_error_code() ) { network_step2( $result ); } else { network_step1( $result ); diff --git a/wp-admin/themes.php b/wp-admin/themes.php index 6ee6b14462..5ea32017c3 100644 --- a/wp-admin/themes.php +++ b/wp-admin/themes.php @@ -285,7 +285,7 @@ if ( $ct->errors() && ( ! is_multisite() || current_user_can( 'manage_network_th /* // Certain error codes are less fatal than others. We can still display theme information in most cases. -if ( ! $ct->errors() || ( 1 == count( $ct->errors()->get_error_codes() ) +if ( ! $ct->errors() || ( 1 === count( $ct->errors()->get_error_codes() ) && in_array( $ct->errors()->get_error_code(), array( 'theme_no_parent', 'theme_parent_invalid', 'theme_no_index' ) ) ) ) : ?> */ diff --git a/wp-admin/update-core.php b/wp-admin/update-core.php index aa2f91c37d..9ff14eb601 100644 --- a/wp-admin/update-core.php +++ b/wp-admin/update-core.php @@ -46,7 +46,7 @@ function list_core_update( $update ) { $version_string = $update->current; } elseif ( 'en_US' === $update->locale && $update->packages->partial && $wp_version == $update->partial_version ) { $updates = get_core_updates(); - if ( $updates && 1 == count( $updates ) ) { + if ( $updates && 1 === count( $updates ) ) { // If the only available update is a partial builds, it doesn't need a language-specific version string. $version_string = $update->current; } diff --git a/wp-admin/users.php b/wp-admin/users.php index 04164d7179..7f85cc7c4d 100644 --- a/wp-admin/users.php +++ b/wp-admin/users.php @@ -278,7 +278,7 @@ switch ( $wp_list_table->current_action() ) { - + @@ -415,7 +415,7 @@ switch ( $wp_list_table->current_action() ) {