Index: src/wp-includes/user.php
===================================================================
--- src/wp-includes/user.php	(revision 40900)
+++ src/wp-includes/user.php	(working copy)
@@ -26,18 +26,18 @@
  * @return WP_User|WP_Error WP_User on success, WP_Error on failure.
  */
 function wp_signon( $credentials = array(), $secure_cookie = '' ) {
-	if ( empty($credentials) ) {
+	if ( empty( $credentials ) ) {
 		$credentials = array(); // Back-compat for plugins passing an empty string.
 
-		if ( ! empty($_POST['log']) )
+		if ( ! empty( $_POST['log'] ) )
 			$credentials['user_login'] = $_POST['log'];
-		if ( ! empty($_POST['pwd']) )
+		if ( ! empty( $_POST['pwd'] ) )
 			$credentials['user_password'] = $_POST['pwd'];
-		if ( ! empty($_POST['rememberme']) )
+		if ( ! empty( $_POST['rememberme'] ) )
 			$credentials['remember'] = $_POST['rememberme'];
 	}
 
-	if ( !empty($credentials['remember']) )
+	if ( ! empty( $credentials['remember'] ) )
 		$credentials['remember'] = true;
 	else
 		$credentials['remember'] = false;
@@ -77,22 +77,22 @@
 	 */
 	$secure_cookie = apply_filters( 'secure_signon_cookie', $secure_cookie, $credentials );
 
-	global $auth_secure_cookie; // XXX ugly hack to pass this to wp_authenticate_cookie
+	global $auth_secure_cookie; // XXX ugly hack to pass this to wp_authenticate_cookie.
 	$auth_secure_cookie = $secure_cookie;
 
-	add_filter('authenticate', 'wp_authenticate_cookie', 30, 3);
+	add_filter( 'authenticate', 'wp_authenticate_cookie', 30, 3 );
 
-	$user = wp_authenticate($credentials['user_login'], $credentials['user_password']);
+	$user = wp_authenticate( $credentials['user_login'], $credentials['user_password'] );
 
 	if ( is_wp_error($user) ) {
-		if ( $user->get_error_codes() == array('empty_username', 'empty_password') ) {
-			$user = new WP_Error('', '');
+		if ( $user->get_error_codes() == array( 'empty_username', 'empty_password' ) ) {
+			$user = new WP_Error( '', '' );
 		}
 
 		return $user;
 	}
 
-	wp_set_auth_cookie($user->ID, $credentials['remember'], $secure_cookie);
+	wp_set_auth_cookie( $user->ID, $credentials['remember'], $secure_cookie );
 	/**
 	 * Fires after the user has successfully logged in.
 	 *
@@ -115,29 +115,29 @@
  * @param string                $password Password for authentication.
  * @return WP_User|WP_Error WP_User on success, WP_Error on failure.
  */
-function wp_authenticate_username_password($user, $username, $password) {
+function wp_authenticate_username_password( $user, $username, $password ) {
 	if ( $user instanceof WP_User ) {
 		return $user;
 	}
 
-	if ( empty($username) || empty($password) ) {
+	if ( empty( $username ) || empty( $password ) ) {
 		if ( is_wp_error( $user ) )
 			return $user;
 
 		$error = new WP_Error();
 
-		if ( empty($username) )
-			$error->add('empty_username', __('<strong>ERROR</strong>: The username field is empty.'));
+		if ( empty( $username ) )
+			$error->add( 'empty_username', __( '<strong>ERROR</strong>: The username field is empty.' ) );
 
-		if ( empty($password) )
-			$error->add('empty_password', __('<strong>ERROR</strong>: The password field is empty.'));
+		if ( empty( $password ) )
+			$error->add( 'empty_password', __( '<strong>ERROR</strong>: The password field is empty.' ) );
 
 		return $error;
 	}
 
-	$user = get_user_by('login', $username);
+	$user = get_user_by( 'login', $username );
 
-	if ( !$user ) {
+	if ( ! $user ) {
 		return new WP_Error( 'invalid_username',
 			__( '<strong>ERROR</strong>: Invalid username.' ) .
 			' <a href="' . wp_lostpassword_url() . '">' .
@@ -156,7 +156,7 @@
 	 * @param string           $password Password to check against the user.
 	 */
 	$user = apply_filters( 'wp_authenticate_user', $user, $password );
-	if ( is_wp_error($user) )
+	if ( is_wp_error( $user ) )
 		return $user;
 
 	if ( ! wp_check_password( $password, $user->user_pass, $user->ID ) ) {
@@ -199,7 +199,7 @@
 		$error = new WP_Error();
 
 		if ( empty( $email ) ) {
-			$error->add( 'empty_username', __( '<strong>ERROR</strong>: The email field is empty.' ) ); // Uses 'empty_username' for back-compat with wp_signon()
+			$error->add( 'empty_username', __( '<strong>ERROR</strong>: The email field is empty.' ) ); // Uses 'empty_username' for back-compat with wp_signon().
 		}
 
 		if ( empty( $password ) ) {
@@ -259,12 +259,12 @@
  * @param string                $password Password. If not empty, cancels the cookie authentication.
  * @return WP_User|WP_Error WP_User on success, WP_Error on failure.
  */
-function wp_authenticate_cookie($user, $username, $password) {
+function wp_authenticate_cookie( $user, $username, $password ) {
 	if ( $user instanceof WP_User ) {
 		return $user;
 	}
 
-	if ( empty($username) && empty($password) ) {
+	if ( empty( $username ) && empty( $password ) ) {
 		$user_id = wp_validate_auth_cookie();
 		if ( $user_id )
 			return new WP_User($user_id);
@@ -276,8 +276,8 @@
 		else
 			$auth_cookie = AUTH_COOKIE;
 
-		if ( !empty($_COOKIE[$auth_cookie]) )
-			return new WP_Error('expired_session', __('Please log in again.'));
+		if ( ! empty( $_COOKIE[$auth_cookie] ) )
+			return new WP_Error( 'expired_session', __( 'Please log in again.' ) );
 
 		// If the cookie is not set, be silent.
 	}
@@ -332,11 +332,11 @@
 		return $user_id;
 	}
 
-	if ( is_blog_admin() || is_network_admin() || empty( $_COOKIE[LOGGED_IN_COOKIE] ) ) {
+	if ( is_blog_admin() || is_network_admin() || empty( $_COOKIE[ LOGGED_IN_COOKIE ] ) ) {
 		return false;
 	}
 
-	return wp_validate_auth_cookie( $_COOKIE[LOGGED_IN_COOKIE], 'logged_in' );
+	return wp_validate_auth_cookie( $_COOKIE[ LOGGED_IN_COOKIE ], 'logged_in' );
 }
 
 /**
@@ -411,9 +411,7 @@
 	return $count;
 }
 
-//
-// User option functions
-//
+// User option functions.
 
 /**
  * Get the current user's ID
@@ -451,7 +449,7 @@
 function get_user_option( $option, $user = 0, $deprecated = '' ) {
 	global $wpdb;
 
-	if ( !empty( $deprecated ) )
+	if ( ! empty( $deprecated ) )
 		_deprecated_argument( __FUNCTION__, '3.0.0' );
 
 	if ( empty( $user ) )
@@ -506,7 +504,7 @@
 function update_user_option( $user_id, $option_name, $newvalue, $global = false ) {
 	global $wpdb;
 
-	if ( !$global )
+	if ( ! $global )
 		$option_name = $wpdb->get_blog_prefix() . $option_name;
 
 	return update_user_meta( $user_id, $option_name, $newvalue );
@@ -523,7 +521,7 @@
  *
  * @global wpdb $wpdb WordPress database abstraction object.
  *
- * @param int    $user_id     User ID
+ * @param int    $user_id     User ID.
  * @param string $option_name User option name.
  * @param bool   $global      Optional. Whether option name is global or blog specific.
  *                            Default false (blog specific).
@@ -532,7 +530,7 @@
 function delete_user_option( $user_id, $option_name, $global = false ) {
 	global $wpdb;
 
-	if ( !$global )
+	if ( ! $global )
 		$option_name = $wpdb->get_blog_prefix() . $option_name;
 	return delete_user_meta( $user_id, $option_name );
 }
@@ -553,7 +551,7 @@
 	$args = wp_parse_args( $args );
 	$args['count_total'] = false;
 
-	$user_search = new WP_User_Query($args);
+	$user_search = new WP_User_Query( $args );
 
 	return (array) $user_search->get_results();
 }
@@ -566,7 +564,7 @@
  *
  * @global wpdb $wpdb WordPress database abstraction object.
  *
- * @param int  $user_id User ID
+ * @param int  $user_id User ID.
  * @param bool $all     Whether to retrieve all sites, or only sites that are not
  *                      marked as deleted, archived, or spam.
  * @return array A list of the user's sites. An empty array if the user doesn't exist
@@ -577,7 +575,7 @@
 
 	$user_id = (int) $user_id;
 
-	// Logged out users can't have sites
+	// Logged out users can't have sites.
 	if ( empty( $user_id ) )
 		return array();
 
@@ -608,11 +606,11 @@
 		$site_id = get_current_blog_id();
 		$sites = array( $site_id => new stdClass );
 		$sites[ $site_id ]->userblog_id = $site_id;
-		$sites[ $site_id ]->blogname = get_option('blogname');
+		$sites[ $site_id ]->blogname = get_option( 'blogname' );
 		$sites[ $site_id ]->domain = '';
 		$sites[ $site_id ]->path = '';
 		$sites[ $site_id ]->site_id = 1;
-		$sites[ $site_id ]->siteurl = get_option('siteurl');
+		$sites[ $site_id ]->siteurl = get_option( 'siteurl' );
 		$sites[ $site_id ]->archived = 0;
 		$sites[ $site_id ]->spam = 0;
 		$sites[ $site_id ]->deleted = 0;
@@ -704,7 +702,7 @@
 	}
 
 	// Technically not needed, but does save calls to get_site and get_user_meta
-	// in the event that the function is called when a user isn't logged in
+	// in the event that the function is called when a user isn't logged in.
 	if ( empty( $user_id ) ) {
 		return false;
 	} else {
@@ -733,11 +731,11 @@
 		return false;
 	}
 
-	// no underscore before capabilities in $base_capabilities_key
+	// no underscore before capabilities in $base_capabilities_key.
 	$base_capabilities_key = $wpdb->base_prefix . 'capabilities';
 	$site_capabilities_key = $wpdb->base_prefix . $blog_id . '_capabilities';
 
-	if ( isset( $keys[ $base_capabilities_key ] ) && $blog_id == 1 ) {
+	if ( isset( $keys[ $base_capabilities_key ] ) && 1 == $blog_id ) {
 		return true;
 	}
 
@@ -762,8 +760,8 @@
  * @param bool   $unique     Optional, default is false. Whether the same key should not be added.
  * @return int|false Meta ID on success, false on failure.
  */
-function add_user_meta($user_id, $meta_key, $meta_value, $unique = false) {
-	return add_metadata('user', $user_id, $meta_key, $meta_value, $unique);
+function add_user_meta( $user_id, $meta_key, $meta_value, $unique = false ) {
+	return add_metadata( 'user', $user_id, $meta_key, $meta_value, $unique );
 }
 
 /**
@@ -776,13 +774,13 @@
  * @since 3.0.0
  * @link https://codex.wordpress.org/Function_Reference/delete_user_meta
  *
- * @param int    $user_id    User ID
+ * @param int    $user_id    User ID.
  * @param string $meta_key   Metadata name.
  * @param mixed  $meta_value Optional. Metadata value.
  * @return bool True on success, false on failure.
  */
-function delete_user_meta($user_id, $meta_key, $meta_value = '') {
-	return delete_metadata('user', $user_id, $meta_key, $meta_value);
+function delete_user_meta( $user_id, $meta_key, $meta_value = '' ) {
+	return delete_metadata( 'user', $user_id, $meta_key, $meta_value );
 }
 
 /**
@@ -796,8 +794,8 @@
  * @param bool   $single  Whether to return a single value.
  * @return mixed Will be an array if $single is false. Will be value of meta data field if $single is true.
  */
-function get_user_meta($user_id, $key = '', $single = false) {
-	return get_metadata('user', $user_id, $key, $single);
+function get_user_meta( $user_id, $key = '', $single = false ) {
+	return get_metadata( 'user', $user_id, $key, $single );
 }
 
 /**
@@ -817,8 +815,8 @@
  * @param mixed  $prev_value Optional. Previous value to check before removing.
  * @return int|bool Meta ID if the key didn't exist, true on successful update, false on failure.
  */
-function update_user_meta($user_id, $meta_key, $meta_value, $prev_value = '') {
-	return update_metadata('user', $user_id, $meta_key, $meta_value, $prev_value);
+function update_user_meta( $user_id, $meta_key, $meta_value, $prev_value = '' ) {
+	return update_metadata( 'user', $user_id, $meta_key, $meta_value, $prev_value );
 }
 
 /**
@@ -834,15 +832,15 @@
  *
  * @global wpdb $wpdb WordPress database abstraction object.
  *
- * @param string $strategy 'time' or 'memory'
+ * @param string $strategy 'time' or 'memory'.
  * @return array Includes a grand total and an array of counts indexed by role strings.
  */
-function count_users($strategy = 'time') {
+function count_users( $strategy = 'time' ) {
 	global $wpdb;
 
-	// Initialize
+	// Initialize.
 	$id = get_current_blog_id();
-	$blog_prefix = $wpdb->get_blog_prefix($id);
+	$blog_prefix = $wpdb->get_blog_prefix( $id );
 	$result = array();
 
 	if ( 'time' == $strategy ) {
@@ -854,7 +852,7 @@
 			$select_count[] = $wpdb->prepare( "COUNT(NULLIF(`meta_value` LIKE %s, false))", '%' . $wpdb->esc_like( '"' . $this_role . '"' ) . '%');
 		}
 		$select_count[] = "COUNT(NULLIF(`meta_value` = 'a:0:{}', false))";
-		$select_count = implode(', ', $select_count);
+		$select_count = implode( ', ', $select_count );
 
 		// Add the meta_value index to the selection list, then run the query.
 		$row = $wpdb->get_row( "
@@ -894,7 +892,7 @@
 		" );
 
 		foreach ( $users_of_blog as $caps_meta ) {
-			$b_roles = maybe_unserialize($caps_meta);
+			$b_roles = maybe_unserialize( $caps_meta );
 			if ( ! is_array( $b_roles ) )
 				continue;
 			if ( empty( $b_roles ) ) {
@@ -901,7 +899,7 @@
 				$avail_roles['none']++;
 			}
 			foreach ( $b_roles as $b_role => $val ) {
-				if ( isset($avail_roles[$b_role]) ) {
+				if ( isset( $avail_roles[$b_role] ) ) {
 					$avail_roles[$b_role]++;
 				} else {
 					$avail_roles[$b_role] = 1;
@@ -911,7 +909,7 @@
 
 		$result['total_users'] = count( $users_of_blog );
 		$result['avail_roles'] =& $avail_roles;
-	}
+	} // End if().
 
 	if ( is_multisite() ) {
 		$result['avail_roles']['none'] = 0;
@@ -949,9 +947,9 @@
 	$user = get_userdata( $for_user_id );
 
 	if ( ! $user ) {
-		$user_ID = 0;
+		$user_ID    = 0;
 		$user_level = 0;
-		$userdata = null;
+		$userdata   = null;
 		$user_login = $user_email = $user_url = $user_identity = '';
 		return;
 	}
@@ -1124,7 +1122,7 @@
 		}
 
 		$output .= "</select>";
-	}
+	} // End if().
 
 	/**
 	 * Filters the wp_dropdown_users() HTML output.
@@ -1157,15 +1155,15 @@
  *                        'attribute' and 'js'.
  * @return mixed Sanitized value.
  */
-function sanitize_user_field($field, $value, $user_id, $context) {
+function sanitize_user_field( $field, $value, $user_id, $context ) {
 	$int_fields = array('ID');
-	if ( in_array($field, $int_fields) )
+	if ( in_array( $field, $int_fields ) )
 		$value = (int) $value;
 
 	if ( 'raw' == $context )
 		return $value;
 
-	if ( !is_string($value) && !is_numeric($value) )
+	if ( ! is_string( $value ) && ! is_numeric( $value ) )
 		return $value;
 
 	$prefixed = false !== strpos( $field, 'user_' );
@@ -1194,7 +1192,7 @@
 		if ( 'description' == $field )
 			$value = esc_html( $value ); // textarea_escaped?
 		else
-			$value = esc_attr($value);
+			$value = esc_attr( $value );
 	} elseif ( 'db' == $context ) {
 		if ( $prefixed ) {
 			/** This filter is documented in wp-includes/post.php */
@@ -1235,7 +1233,7 @@
 			 */
 			$value = apply_filters( "user_{$field}", $value, $user_id, $context );
 		}
-	}
+	} // End if().
 
 	if ( 'user_url' == $field )
 		$value = esc_url($value);
@@ -1253,7 +1251,7 @@
  *
  * @since 3.0.0
  *
- * @param object|WP_User $user User object to be cached
+ * @param object|WP_User $user User object to be cached.
  * @return bool|null Returns false on failure.
  */
 function update_user_caches( $user ) {
@@ -1265,10 +1263,10 @@
 		$user = $user->data;
 	}
 
-	wp_cache_add($user->ID, $user, 'users');
-	wp_cache_add($user->user_login, $user->ID, 'userlogins');
-	wp_cache_add($user->user_email, $user->ID, 'useremail');
-	wp_cache_add($user->user_nicename, $user->ID, 'userslugs');
+	wp_cache_add( $user->ID, $user, 'users' );
+	wp_cache_add( $user->user_login, $user->ID, 'userlogins' );
+	wp_cache_add( $user->user_email, $user->ID, 'useremail' );
+	wp_cache_add( $user->user_nicename, $user->ID, 'userslugs' );
 }
 
 /**
@@ -1277,7 +1275,7 @@
  * @since 3.0.0
  * @since 4.4.0 'clean_user_cache' action was added.
  *
- * @param WP_User|int $user User object or ID to be cleaned from the cache
+ * @param WP_User|int $user User object or ID to be cleaned from the cache.
  */
 function clean_user_cache( $user ) {
 	if ( is_numeric( $user ) )
@@ -1419,7 +1417,7 @@
 
 	// Are we updating or creating?
 	if ( ! empty( $userdata['ID'] ) ) {
-		$ID = (int) $userdata['ID'];
+		$ID = ( int ) $userdata['ID'];
 		$update = true;
 		$old_user_data = get_userdata( $ID );
 
@@ -1427,11 +1425,11 @@
 			return new WP_Error( 'invalid_user_id', __( 'Invalid user ID.' ) );
 		}
 
-		// hashed in wp_update_user(), plaintext if called directly
+		// hashed in wp_update_user(), plaintext if called directly.
 		$user_pass = ! empty( $userdata['user_pass'] ) ? $userdata['user_pass'] : $old_user_data->user_pass;
 	} else {
 		$update = false;
-		// Hash the password
+		// Hash the password.
 		$user_pass = wp_hash_password( $userdata['user_pass'] );
 	}
 
@@ -1448,12 +1446,12 @@
 	 */
 	$pre_user_login = apply_filters( 'pre_user_login', $sanitized_user_login );
 
-	//Remove any non-printable chars from the login string to see if we have ended up with an empty username
+	//Remove any non-printable chars from the login string to see if we have ended up with an empty username.
 	$user_login = trim( $pre_user_login );
 
 	// user_login must be between 0 and 60 characters.
 	if ( empty( $user_login ) ) {
-		return new WP_Error('empty_user_login', __('Cannot create a user with an empty login name.') );
+		return new WP_Error( 'empty_user_login', __( 'Cannot create a user with an empty login name.' ) );
 	} elseif ( mb_strlen( $user_login ) > 60 ) {
 		return new WP_Error( 'user_login_too_long', __( 'Username may not be longer than 60 characters.' ) );
 	}
@@ -1624,7 +1622,7 @@
 
 	if ( $user_nicename_check ) {
 		$suffix = 2;
-		while ($user_nicename_check) {
+		while ( $user_nicename_check ) {
 			// user_nicename allows 50 chars. Subtract one for a hyphen, plus the length of the suffix.
 			$base_length = 49 - mb_strlen( $suffix );
 			$alt_user_nicename = mb_substr( $user_nicename, 0, $base_length ) . "-$suffix";
@@ -1691,7 +1689,7 @@
 	if ( isset( $userdata['role'] ) ) {
 		$user->set_role( $userdata['role'] );
 	} elseif ( ! $update ) {
-		$user->set_role(get_option('default_role'));
+		$user->set_role( get_option( 'default_role' ) );
 	}
 	wp_cache_delete( $user_id, 'users' );
 	wp_cache_delete( $user_login, 'userlogins' );
@@ -1736,7 +1734,7 @@
  * @param mixed $userdata An array of user data or a user object of type stdClass or WP_User.
  * @return int|WP_Error The updated user's ID or a WP_Error object if the user could not be updated.
  */
-function wp_update_user($userdata) {
+function wp_update_user( $userdata ) {
 	if ( $userdata instanceof stdClass ) {
 		$userdata = get_object_vars( $userdata );
 	} elseif ( $userdata instanceof WP_User ) {
@@ -1748,7 +1746,7 @@
 		return new WP_Error( 'invalid_user_id', __( 'Invalid user ID.' ) );
 	}
 
-	// First, get all of the original fields
+	// First, get all of the original fields.
 	$user_obj = get_userdata( $ID );
 	if ( ! $user_obj ) {
 		return new WP_Error( 'invalid_user_id', __( 'Invalid user ID.' ) );
@@ -1756,7 +1754,7 @@
 
 	$user = $user_obj->to_array();
 
-	// Add additional custom fields
+	// Add additional custom fields.
 	foreach ( _get_additional_user_keys( $user_obj ) as $key ) {
 		$user[ $key ] = get_user_meta( $ID, $key, true );
 	}
@@ -1765,7 +1763,7 @@
 	$user = add_magic_quotes( $user );
 
 	if ( ! empty( $userdata['user_pass'] ) && $userdata['user_pass'] !== $user_obj->user_pass ) {
-		// If password is changing, hash it now
+		// If password is changing, hash it now.
 		$plaintext_pass = $userdata['user_pass'];
 		$userdata['user_pass'] = wp_hash_password( $userdata['user_pass'] );
 
@@ -1870,7 +1868,7 @@
 			$pass_change_email['message'] = str_replace( '###SITEURL###', home_url(), $pass_change_email['message'] );
 
 			wp_mail( $pass_change_email['to'], sprintf( $pass_change_email['subject'], $blog_name ), $pass_change_email['message'], $pass_change_email['headers'] );
-		}
+		} // End if().
 
 		if ( ! empty( $send_email_change_email ) ) {
 			/* translators: Do not translate USERNAME, ADMIN_EMAIL, EMAIL, SITENAME, SITEURL: those are placeholders. */
@@ -1925,17 +1923,17 @@
 			$email_change_email['message'] = str_replace( '###SITEURL###', home_url(), $email_change_email['message'] );
 
 			wp_mail( $email_change_email['to'], sprintf( $email_change_email['subject'], $blog_name ), $email_change_email['message'], $email_change_email['headers'] );
-		}
+		} // End if().
 
 		if ( $switched_locale ) {
 			restore_previous_locale();
 		}
-	}
+	} // End if().
 
 	// Update the cookies if the password changed.
 	$current_user = wp_get_current_user();
 	if ( $current_user->ID == $ID ) {
-		if ( isset($plaintext_pass) ) {
+		if ( isset( $plaintext_pass ) ) {
 			wp_clear_auth_cookie();
 
 			// Here we calculate the expiration length of the current auth cookie and compare it to the default expiration.
@@ -1967,13 +1965,13 @@
  * @return int|WP_Error The newly created user's ID or a WP_Error object if the user could not
  *                      be created.
  */
-function wp_create_user($username, $password, $email = '') {
+function wp_create_user( $username, $password, $email = '' ) {
 	$user_login = wp_slash( $username );
-	$user_email = wp_slash( $email    );
+	$user_email = wp_slash( $email );
 	$user_pass = $password;
 
-	$userdata = compact('user_login', 'user_email', 'user_pass');
-	return wp_insert_user($userdata);
+	$userdata = compact( 'user_login', 'user_email', 'user_pass' );
+	return wp_insert_user( $userdata );
 }
 
 /**
@@ -2009,7 +2007,7 @@
 		$methods = array(
 			'aim'    => __( 'AIM' ),
 			'yim'    => __( 'Yahoo IM' ),
-			'jabber' => __( 'Jabber / Google Talk' )
+			'jabber' => __( 'Jabber / Google Talk' ),
 		);
 	}
 
@@ -2019,6 +2017,7 @@
 	 * @since 2.9.0
 	 *
 	 * @param array   $methods Array of contact methods and their labels.
+	 *
  	 * @param WP_User $user    WP_User object.
 	 */
 	return apply_filters( 'user_contactmethods', $methods, $user );
@@ -2160,15 +2159,15 @@
  * @param string $login     The user login.
  * @return WP_User|WP_Error WP_User object on success, WP_Error object for invalid or expired keys.
  */
-function check_password_reset_key($key, $login) {
+function check_password_reset_key( $key, $login ) {
 	global $wpdb, $wp_hasher;
 
 	$key = preg_replace('/[^a-z0-9]/i', '', $key);
 
-	if ( empty( $key ) || !is_string( $key ) )
+	if ( empty( $key ) || ! is_string( $key ) )
 		return new WP_Error('invalid_key', __('Invalid key'));
 
-	if ( empty($login) || !is_string($login) )
+	if ( empty($login) || ! is_string($login) )
 		return new WP_Error('invalid_key', __('Invalid key'));
 
 	$row = $wpdb->get_row( $wpdb->prepare( "SELECT ID, user_activation_key FROM $wpdb->users WHERE user_login = %s", $login ) );
@@ -2206,7 +2205,7 @@
 	if ( $hash_is_correct && $expiration_time && time() < $expiration_time ) {
 		return get_userdata( $row->ID );
 	} elseif ( $hash_is_correct && $expiration_time ) {
-		// Key has an expiration time that's passed
+		// Key has an expiration time that's passed.
 		return new WP_Error( 'expired_key', __( 'Invalid key' ) );
 	}
 
@@ -2236,8 +2235,8 @@
  *
  * @since 2.5.0
  *
- * @param object $user     The user
- * @param string $new_pass New password for the user in plaintext
+ * @param object $user     The user.
+ * @param string $new_pass New password for the user in plaintext.
  */
 function reset_password( $user, $new_pass ) {
 	/**
@@ -2269,8 +2268,8 @@
  *
  * @since 2.5.0
  *
- * @param string $user_login User's username for logging in
- * @param string $user_email User's email address to send password and add
+ * @param string $user_login User's username for logging in.
+ * @param string $user_email User's email address to send password and add.
  * @return int|WP_Error Either user's ID or error on failure.
  */
 function register_new_user( $user_login, $user_email ) {
@@ -2286,8 +2285,8 @@
 	 */
 	$user_email = apply_filters( 'user_registration_email', $user_email );
 
-	// Check the username
-	if ( $sanitized_user_login == '' ) {
+	// Check the username.
+	if ( '' == $sanitized_user_login ) {
 		$errors->add( 'empty_username', __( '<strong>ERROR</strong>: Please enter a username.' ) );
 	} elseif ( ! validate_username( $user_login ) ) {
 		$errors->add( 'invalid_username', __( '<strong>ERROR</strong>: This username is invalid because it uses illegal characters. Please enter a valid username.' ) );
@@ -2303,8 +2302,8 @@
 		}
 	}
 
-	// Check the email address
-	if ( $user_email == '' ) {
+	// Check the email address.
+	if ( '' == $user_email ) {
 		$errors->add( 'empty_email', __( '<strong>ERROR</strong>: Please type your email address.' ) );
 	} elseif ( ! is_email( $user_email ) ) {
 		$errors->add( 'invalid_email', __( '<strong>ERROR</strong>: The email address isn&#8217;t correct.' ) );
@@ -2501,7 +2500,7 @@
 			return $current_user;
 		}
 
-		// Upgrade stdClass to WP_User
+		// Upgrade stdClass to WP_User.
 		if ( is_object( $current_user ) && isset( $current_user->ID ) ) {
 			$cur_id = $current_user->ID;
 			$current_user = null;
