Making WordPress.org

Changeset 9806


Ignore:
Timestamp:
05/01/2020 06:25:16 AM (5 years ago)
Author:
dd32
Message:

Plugin Directory: Allow users to bypass the trademark checks if their registerd profile email matches the trademark owner.

Props Ipstenu.
Fixes #5178.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-upload-handler.php

    r9805 r9806  
    461461        );
    462462
     463        // Domains from which exceptions would be accepted.
     464        $trademark_exceptions = array(
     465            'yoast.com'      => array( 'yoast' ),
     466            'automattic.com' => array( 'wordpress', 'woo', 'woocommerce' ),
     467        );
     468
    463469        $has_trademarked_slug = false;
    464470
     
    477483        }
    478484
     485        // Get the user email domain.
     486        $user_email_domain = explode( '@', wp_get_current_user()->user_email, 2 );
     487
     488        // If email domain is on our list of possible exceptions, we have an extra check.
     489        if ( array_key_exists( $user_email_domain[1], $trademark_exceptions ) ) {
     490            // If $has_trademarked_slug is in the array for that domain, they can use the term.
     491            if ( in_array( $has_trademarked_slug, $trademark_exceptions[ $user_email_domain[1] ] ) ) {
     492                $has_trademarked_slug = false;
     493            }
     494        }
     495
    479496        return $has_trademarked_slug;
    480497    }
Note: See TracChangeset for help on using the changeset viewer.