Make WordPress Core


Ignore:
Timestamp:
01/29/2020 12:43:23 AM (6 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/ms-functions.php

    r47109 r47122  
    6363        }
    6464    } else {
    65         //TODO Review this call to add_user_to_blog too - to get here the user must have a role on this blog?
     65        // TODO: Review this call to add_user_to_blog too - to get here the user must have a role on this blog?
    6666        $result = add_user_to_blog( $first_blog->userblog_id, $user_id, 'subscriber' );
    6767
     
    7373
    7474    if ( ( ! is_object( $primary ) ) || ( $primary->archived == 1 || $primary->spam == 1 || $primary->deleted == 1 ) ) {
    75         $blogs = get_blogs_of_user( $user_id, true ); // if a user's primary blog is shut down, check their other blogs.
     75        $blogs = get_blogs_of_user( $user_id, true ); // If a user's primary blog is shut down, check their other blogs.
    7676        $ret   = false;
    7777        if ( is_array( $blogs ) && count( $blogs ) > 0 ) {
     
    274274    }
    275275
    276     // wp_revoke_user($user_id);
     276    // wp_revoke_user( $user_id );
    277277    $user = get_userdata( $user_id );
    278278    if ( ! $user ) {
     
    348348    $id     = wp_cache_get( md5( $domain . $path ), 'blog-id-cache' );
    349349
    350     if ( $id == -1 ) { // blog does not exist
     350    if ( $id == -1 ) { // Blog does not exist.
    351351        return 0;
    352352    } elseif ( $id ) {
     
    374374}
    375375
    376 // Admin functions
     376//
     377// Admin functions.
     378//
    377379
    378380/**
     
    508510    }
    509511
    510     // all numeric?
     512    // All numeric?
    511513    if ( preg_match( '/^[0-9]*$/', $user_name ) ) {
    512514        $errors->add( 'user_name', __( 'Sorry, usernames must have letters too!' ) );
     
    666668    }
    667669
    668     // do not allow users to create a blog that conflicts with a page on the main blog.
     670    // Do not allow users to create a blog that conflicts with a page on the main blog.
    669671    if ( ! is_subdomain_install() && $wpdb->get_var( $wpdb->prepare( 'SELECT post_name FROM ' . $wpdb->get_blog_prefix( $current_network->site_id ) . "posts WHERE post_type = 'page' AND post_name = %s", $blogname ) ) ) {
    670672        $errors->add( 'blogname', __( 'Sorry, you may not use that site name.' ) );
    671673    }
    672674
    673     // all numeric?
     675    // All numeric?
    674676    if ( preg_match( '/^[0-9]*$/', $blogname ) ) {
    675677        $errors->add( 'blogname', __( 'Sorry, site names must have letters too!' ) );
     
    713715
    714716    // Has someone already signed up for this domain?
    715     $signup = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->signups WHERE domain = %s AND path = %s", $mydomain, $path ) ); // TODO: Check email too?
     717    // TODO: Check email too?
     718    $signup = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->signups WHERE domain = %s AND path = %s", $mydomain, $path ) );
    716719    if ( ! empty( $signup ) ) {
    717720        $diff = time() - mysql2date( 'U', $signup->registered );
     
    841844    global $wpdb;
    842845
    843     // Format data
     846    // Format data.
    844847    $user       = preg_replace( '/\s+/', '', sanitize_user( $user, true ) );
    845848    $user_email = sanitize_email( $user_email );
     
    934937        $activate_url = network_site_url( "wp-activate.php?key=$key" );
    935938    } else {
    936         $activate_url = "http://{$domain}{$path}wp-activate.php?key=$key"; // @todo use *_url() API
     939        $activate_url = "http://{$domain}{$path}wp-activate.php?key=$key"; // @todo Use *_url() API.
    937940    }
    938941
     
    12131216    // TODO: What to do if we create a user but cannot create a blog?
    12141217    if ( is_wp_error( $blog_id ) ) {
    1215         // If blog is taken, that means a previous attempt to activate this blog failed in between creating the blog and
    1216         // setting the activation flag. Let's just set the active flag and instruct the user to reset their password.
     1218        /*
     1219         * If blog is taken, that means a previous attempt to activate this blog
     1220         * failed in between creating the blog and setting the activation flag.
     1221         * Let's just set the active flag and instruct the user to reset their password.
     1222         */
    12171223        if ( 'blog_taken' == $blog_id->get_error_code() ) {
    12181224            $blog_id->add_data( $signup );
     
    17891795
    17901796    // Walk through each blog and get the most recent post
    1791     // published by $user_id
     1797    // published by $user_id.
    17921798    foreach ( (array) $user_blogs as $blog ) {
    17931799        $prefix      = $wpdb->get_blog_prefix( $blog->userblog_id );
    17941800        $recent_post = $wpdb->get_row( $wpdb->prepare( "SELECT ID, post_date_gmt FROM {$prefix}posts WHERE post_author = %d AND post_type = 'post' AND post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1", $user_id ), ARRAY_A );
    17951801
    1796         // Make sure we found a post
     1802        // Make sure we found a post.
    17971803        if ( isset( $recent_post['ID'] ) ) {
    17981804            $post_gmt_ts = strtotime( $recent_post['post_date_gmt'] );
    17991805
    1800             // If this is the first post checked or if this post is
    1801             // newer than the current recent post, make it the new
    1802             // most recent post.
     1806            /*
     1807             * If this is the first post checked
     1808             * or if this post is newer than the current recent post,
     1809             * make it the new most recent post.
     1810             */
    18031811            if ( ! isset( $most_recent_post['post_gmt_ts'] ) || ( $post_gmt_ts > $most_recent_post['post_gmt_ts'] ) ) {
    18041812                $most_recent_post = array(
     
    18151823}
    18161824
    1817 // Misc functions
     1825//
     1826// Misc functions.
     1827//
    18181828
    18191829/**
     
    19211931    }
    19221932
    1923     // prevent a race condition
     1933    // Prevent a race condition.
    19241934    $recurse_start = false;
    19251935    if ( $global_terms_recurse === null ) {
     
    21832193        $blog_id = $meta['add_to_blog'];
    21842194        $role    = $meta['new_role'];
    2185         remove_user_from_blog( $user_id, get_network()->site_id ); // remove user from main blog.
     2195        remove_user_from_blog( $user_id, get_network()->site_id ); // Remove user from main blog.
    21862196
    21872197        $result = add_user_to_blog( $blog_id, $user_id, $role );
     
    23172327function filter_SSL( $url ) {  // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
    23182328    if ( ! is_string( $url ) ) {
    2319         return get_bloginfo( 'url' ); // Return home blog url with proper scheme
     2329        return get_bloginfo( 'url' ); // Return home blog URL with proper scheme.
    23202330    }
    23212331
     
    27792789        'headers' => '',
    27802790    );
    2781     // get network name
     2791    // Get network name.
    27822792    $network_name = wp_specialchars_decode( get_site_option( 'site_name' ), ENT_QUOTES );
    27832793
Note: See TracChangeset for help on using the changeset viewer.