Make WordPress Core


Ignore:
Timestamp:
01/29/2020 12:43:23 AM (7 years ago)
Author:
SergeyBiryukov
Message:

Docs: Improve inline comments per the documentation standards.

Includes minor code layout fixes for better readability.

See #48303.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/user.php

    r47101 r47122  
    8888        $secure_cookie = apply_filters( 'secure_signon_cookie', $secure_cookie, $credentials );
    8989
    90         global $auth_secure_cookie; // XXX ugly hack to pass this to wp_authenticate_cookie
     90        global $auth_secure_cookie; // XXX ugly hack to pass this to wp_authenticate_cookie().
    9191        $auth_secure_cookie = $secure_cookie;
    9292
    … …  
    209209
    210210                if ( empty( $email ) ) {
    211                         $error->add( 'empty_username', __( '<strong>ERROR</strong>: The email field is empty.' ) ); // Uses 'empty_username' for back-compat with wp_signon()
     211                        // Uses 'empty_username' for back-compat with wp_signon().
     212                        $error->add( 'empty_username', __( '<strong>ERROR</strong>: The email field is empty.' ) );
    212213                }
    213214
    … …  
    427428
    428429//
    429 // User option functions
     430// User option functions.
    430431//
    431432
    … …  
    481482
    482483        $prefix = $wpdb->get_blog_prefix();
    483         if ( $user->has_prop( $prefix . $option ) ) { // Blog specific
     484        if ( $user->has_prop( $prefix . $option ) ) { // Blog-specific.
    484485                $result = $user->get( $prefix . $option );
    485         } elseif ( $user->has_prop( $option ) ) { // User specific and cross-blog
     486        } elseif ( $user->has_prop( $option ) ) { // User-specific and cross-blog.
    486487                $result = $user->get( $option );
    487488        } else {
    … …  
    600601        $user_id = (int) $user_id;
    601602
    602         // Logged out users can't have sites
     603        // Logged out users can't have sites.
    603604        if ( empty( $user_id ) ) {
    604605                return array();
    … …  
    734735        }
    735736
    736         // Technically not needed, but does save calls to get_site and get_user_meta
    737         // in the event that the function is called when a user isn't logged in
     737        // Technically not needed, but does save calls to get_site() and get_user_meta()
     738        // in the event that the function is called when a user isn't logged in.
    738739        if ( empty( $user_id ) ) {
    739740                return false;
    … …  
    764765        }
    765766
    766         // no underscore before capabilities in $base_capabilities_key
     767        // No underscore before capabilities in $base_capabilities_key.
    767768        $base_capabilities_key = $wpdb->base_prefix . 'capabilities';
    768769        $site_capabilities_key = $wpdb->base_prefix . $blog_id . '_capabilities';
    … …  
    876877        global $wpdb;
    877878
    878         // Initialize
     879        // Initialize.
    879880        if ( ! $site_id ) {
    880881                $site_id = get_current_blog_id();
    … …  
    985986
    986987//
    987 // Private helper functions
     988// Private helper functions.
    988989//
    989990
    … …  
    15411542                }
    15421543
    1543                 // hashed in wp_update_user(), plaintext if called directly
     1544                // hashed in wp_update_user(), plaintext if called directly.
    15441545                $user_pass = ! empty( $userdata['user_pass'] ) ? $userdata['user_pass'] : $old_user_data->user_pass;
    15451546        } else {
    15461547                $update = false;
    1547                 // Hash the password
     1548                // Hash the password.
    15481549                $user_pass = wp_hash_password( $userdata['user_pass'] );
    15491550        }
    … …  
    15621563        $pre_user_login = apply_filters( 'pre_user_login', $sanitized_user_login );
    15631564
    1564         //Remove any non-printable chars from the login string to see if we have ended up with an empty username
     1565        // Remove any non-printable chars from the login string to see if we have ended up with an empty username.
    15651566        $user_login = trim( $pre_user_login );
    15661567
    … …  
    19341935        }
    19351936
    1936         // First, get all of the original fields
     1937        // First, get all of the original fields.
    19371938        $user_obj = get_userdata( $ID );
    19381939        if ( ! $user_obj ) {
    … …  
    19421943        $user = $user_obj->to_array();
    19431944
    1944         // Add additional custom fields
     1945        // Add additional custom fields.
    19451946        foreach ( _get_additional_user_keys( $user_obj ) as $key ) {
    19461947                $user[ $key ] = get_user_meta( $ID, $key, true );
    … …  
    19511952
    19521953        if ( ! empty( $userdata['user_pass'] ) && $userdata['user_pass'] !== $user_obj->user_pass ) {
    1953                 // If password is changing, hash it now
     1954                // If password is changing, hash it now.
    19541955                $plaintext_pass        = $userdata['user_pass'];
    19551956                $userdata['user_pass'] = wp_hash_password( $userdata['user_pass'] );
    … …  
    24122413                return $user;
    24132414        } elseif ( $hash_is_correct && $expiration_time ) {
    2414                 // Key has an expiration time that's passed
     2415                // Key has an expiration time that's passed.
    24152416                return new WP_Error( 'expired_key', __( 'Invalid key.' ) );
    24162417        }
    … …  
    24922493        $user_email = apply_filters( 'user_registration_email', $user_email );
    24932494
    2494         // Check the username
     2495        // Check the username.
    24952496        if ( $sanitized_user_login == '' ) {
    24962497                $errors->add( 'empty_username', __( '<strong>ERROR</strong>: Please enter a username.' ) );
    … …  
    25092510        }
    25102511
    2511         // Check the email address
     2512        // Check the email address.
    25122513        if ( $user_email == '' ) {
    25132514                $errors->add( 'empty_email', __( '<strong>ERROR</strong>: Please type your email address.' ) );
    … …  
    25682569        }
    25692570
    2570         update_user_option( $user_id, 'default_password_nag', true, true ); //Set up the Password change nag.
     2571        update_user_option( $user_id, 'default_password_nag', true, true ); // Set up the password change nag.
    25712572
    25722573        /**
    … …  
    27292730                }
    27302731
    2731                 // Upgrade stdClass to WP_User
     2732                // Upgrade stdClass to WP_User.
    27322733                if ( is_object( $current_user ) && isset( $current_user->ID ) ) {
    27332734                        $cur_id       = $current_user->ID;
    … …  
    34063407                array(
    34073408                        'post_type'     => 'user_request',
    3408                         'post_name__in' => array( $action_name ),  // Action name stored in post_name column.
    3409                         'title'         => $email_address, // Email address stored in post_title column.
     3409                        'post_name__in' => array( $action_name ), // Action name stored in post_name column.
     3410                        'title'         => $email_address,        // Email address stored in post_title column.
    34103411                        'post_status'   => array(
    34113412                                'request-pending',
Note: See TracChangeset for help on using the changeset viewer.