WordPress.org

Making WordPress.org

Changeset 9613


Ignore:
Timestamp:
03/20/2020 07:15:55 PM (13 months ago)
Author:
coffee2code
Message:

Plugin Directory, Upload Handler: Improve trademark checks.

  • Differentiate error message based on whether trademark cannot be used at the start of the plugin name or at all
  • Amend the list of trademarks
  • Adjust trademark detection so that trademarks that cannot be used at the start of the plugin name are more strictly checked for only that position

Props Ipstenu, coffee2code.
Fixes #5083.

File:
1 edited

Legend:

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

    r9287 r9613  
    115115
    116116        // Make sure it doesn't use a TRADEMARK protected slug.
    117         if ( $this->has_trademarked_slug() ) {
     117        if ( false !== $this->has_trademarked_slug() ) {
    118118            $error = __( 'Error: The plugin includes a trademarked name.', 'wporg-plugins' );
    119119
    120             return new \WP_Error( 'trademarked_name', $error . ' ' . sprintf(
    121                 /* translators: 1: plugin slug, 2: trademarked term, 3: 'Plugin Name:', 4: plugin email address */
    122                 __( 'Your chosen plugin name - %1$s - contains the restricted term "%2$s" and cannot be used. Per the demands of trademark owners and in order to protect developers, we disallow the use of certain terms in ways that are infringing or misleading. In many cases, renaming your plugin to end with "for-%2$s" instead will resolve this issue. To do this, please change the %3$s line in your main plugin file and readme and upload the plugin again. If you feel this is in error, please email us at %4$s and explain why.', 'wporg-plugins' ),
    123                 '<code>' . $this->plugin_slug . '</code>',
    124                 $this->has_trademarked_slug(),
    125                 '<code>Plugin Name:</code>',
    126                 '<code>plugins@wordpress.org</code>'
    127             ) );
     120            if ( $this->has_trademarked_slug() === trim( $this->has_trademarked_slug(), '-' ) ) {
     121                // Trademarks that do NOT end in "-" indicate slug cannot contain term at all.
     122                $message = sprintf(
     123                    /* translators: 1: plugin slug, 2: trademarked term, 3: 'Plugin Name:', 4: plugin email address */
     124                    __( 'Your chosen plugin name - %1$s - contains the prohibited term "%2$s" and cannot be used. Per the demands of trademark owners we have been required to prevent the use of the term at all. To proceed with this submission you must remove "%2$s" from the %3$s line in both your main plugin file and readme entirely. Once you\'ve finished, you may upload the plugin again. If you feel this is in error, please email us at %4$s and explain why.', 'wporg-plugins' ),
     125                    '<code>' . $this->plugin_slug . '</code>',
     126                    trim( $this->has_trademarked_slug(), '-' ),
     127                    '<code>Plugin Name:</code>',
     128                    '<code>plugins@wordpress.org</code>'
     129                );
     130            } else {
     131                // Trademarks ending in "-" indicate slug cannot BEGIN with that term.
     132                $message = sprintf(
     133                    /* translators: 1: plugin slug, 2: trademarked term, 3: 'Plugin Name:', 4: plugin email address */
     134                    __( 'Your chosen plugin name - %1$s - contains the restricted term "%2$s" and cannot be used. Per the demands of trademark owners we disallow the use of certain terms in ways that are infringing or misleading. In order to proceed with this submission, you must change the %3$s line in your main plugin file and readme to end with  "-%2$s" instead. Once you\'ve finished, you may upload the plugin again. If you feel this is in error, please email us at %4$s and explain why.', 'wporg-plugins' ),
     135                    '<code>' . $this->plugin_slug . '</code>',
     136                    trim( $this->has_trademarked_slug(), '-' ),
     137                    '<code>Plugin Name:</code>',
     138                    '<code>plugins@wordpress.org</code>'
     139                );
     140            }
     141
     142            return new \WP_Error( 'trademarked_name', $error . ' ' . $message );
    128143        }
    129144
     
    377392        $trademarked_slugs = array(
    378393            'adobe-',
     394            'adsense-',
    379395            'advanced-custom-fields-',
     396            'adwords-',
    380397            'amazon-',
     398            'android-',
     399            'apple-',
     400            'bing-',
    381401            'contact-form-7-',
    382402            'divi-',
    383403            'easy-digital-downloads-',
    384404            'elementor-',
     405            'envato-',
    385406            'facebook',
    386407            'feedburner',
     
    390411            'gutenberg',
    391412            'instagram',
    392             'insta',
    393413            'macintosh-',
    394414            'microsoft-',
    395415            'ninja-forms-',
     416            'paypal-',
    396417            'pinterest-',
     418            'stripe-',
    397419            'twitter-',
    398420            'tweet',
     
    400422            'whats-app',
    401423            'woocommerce-',
     424            'woo-',
    402425            'wordpress',
    403426            'yoast',
     
    408431
    409432        foreach ( $trademarked_slugs as $trademark ) {
    410             if ( false !== strpos( $this->plugin_slug, $trademark ) ) {
    411                 $has_trademarked_slug = trim( $trademark, '-' );
     433            if ( '-' === $trademark[-1] ) {
     434                // Trademarks ending in "-" indicate slug cannot begin with that term.
     435                if ( 0 === strpos( $this->plugin_slug, $trademark ) ) {
     436                    $has_trademarked_slug = $trademark;
     437                    break;
     438                }
     439            } elseif ( false !== strpos( $this->plugin_slug, $trademark ) ) {
     440                // Otherwise, the term cannot appear anywhere in slug.
     441                $has_trademarked_slug = $trademark;
    412442                break;
    413443            }
     
    458488        echo '<h4>' . sprintf( __( 'Results of Automated Plugin Scanning: %s', 'wporg-plugins' ), vsprintf( '<span class="%1$s">%2$s</span>', $verdict ) ) . '</h4>';
    459489        echo '<ul class="tc-result">' . __( 'Result', 'wporg-plugins' ) . '</ul>';
    460         echo '<div class="notice notice-info"><p>' . __( 'Note: While the automated plugin scan is based on the Plugin Review Guidelines, it is not a complete review. A successful result from the scan does not guarantee that the plugin will pass review. All submitted plugins are reviewed manually before approval.', 'wporg-plugins' ) . '</p></div>';
     490        echo '<div class="notice notice-info"><p>' . __( 'Note: While the automated plugin scan is based on the Plugin Review Guidelines, it is not a complete review. A successful result from the scan does not guarantee that the plugin will be approved, only that it is sufficient to be reviewed. All submitted plugins are checked manually to ensure they meet security and guideline standards before approval.', 'wporg-plugins' ) . '</p></div>';
    461491
    462492        return $result;
     
    504534'Thank you for uploading %1$s to the WordPress Plugin Directory. We will review your submission as soon as possible and send you a follow up email with the results.
    505535
    506 Your plugin has been given the initial slug of %2$s based on your display name of %1$s. This is subject to change based on the results of your review.
    507 
    508 If you need to change the plugin slug, please reply to this email immediately and let us know what the correct slug should be. We will be unable to change your plugin slug once your review is completed.
     536Your plugin has been given the initial permalink (aka slug) of %2$s based on your display name of %1$s. This is subject to change based on the results of your review.
     537
     538If you need to change the plugin permalink, please reply to this email immediately and let us know what the correct slug should be. We will be unable to change your plugin slug once your review is completed.
    509539
    510540If there are any other problems with your submission, please reply to this email and let us know right away. In most cases, we can correct errors as long as the plugin has not yet been approved.
Note: See TracChangeset for help on using the changeset viewer.