Make WordPress Core

Changeset 59573


Ignore:
Timestamp:
01/03/2025 10:55:42 PM (5 months ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Use strict comparison in wpmu_validate_blog_signup().

Follow-up to mu:8, mu:543, mu:550, mu:1364, mu:1958, [12603], [32733].

Props debarghyabanerjee, aristath, poena, afercia, SergeyBiryukov.
See #62279, #62283.

File:
1 edited

Legend:

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

    r59563 r59573  
    482482
    483483    $illegal_names = get_site_option( 'illegal_names' );
     484
    484485    if ( ! is_array( $illegal_names ) ) {
    485486        $illegal_names = array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator' );
    486487        add_site_option( 'illegal_names', $illegal_names );
    487488    }
     489
    488490    if ( in_array( $user_name, $illegal_names, true ) ) {
    489491        $errors->add( 'user_name', __( 'Sorry, that username is not allowed.' ) );
     
    517519
    518520    $limited_email_domains = get_site_option( 'limited_email_domains' );
     521
    519522    if ( is_array( $limited_email_domains ) && ! empty( $limited_email_domains ) ) {
    520523        $limited_email_domains = array_map( 'strtolower', $limited_email_domains );
    521         $emaildomain           = strtolower( substr( $user_email, 1 + strpos( $user_email, '@' ) ) );
    522         if ( ! in_array( $emaildomain, $limited_email_domains, true ) ) {
     524        $email_domain          = strtolower( substr( $user_email, 1 + strpos( $user_email, '@' ) ) );
     525
     526        if ( ! in_array( $email_domain, $limited_email_domains, true ) ) {
    523527            $errors->add( 'user_email', __( 'Sorry, that email address is not allowed!' ) );
    524528        }
     
    638642    $errors        = new WP_Error();
    639643    $illegal_names = get_site_option( 'illegal_names' );
    640     if ( false == $illegal_names ) {
     644
     645    if ( ! is_array( $illegal_names ) ) {
    641646        $illegal_names = array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator' );
    642647        add_site_option( 'illegal_names', $illegal_names );
     
    722727     */
    723728    if ( username_exists( $blogname ) ) {
    724         if ( ! is_object( $user ) || ( is_object( $user ) && ( $user->user_login != $blogname ) ) ) {
     729        if ( ! is_object( $user ) || ( is_object( $user ) && ( $user->user_login !== $blogname ) ) ) {
    725730            $errors->add( 'blogname', __( 'Sorry, that site is reserved!' ) );
    726731        }
Note: See TracChangeset for help on using the changeset viewer.