Making WordPress.org

Ticket #5178: 5178.diff

File 5178.diff, 4.6 KB (added by Ipstenu, 4 years ago)
  • trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-upload-handler.php

     
    121121                                // Trademarks that do NOT end in "-" indicate slug cannot contain term at all.
    122122                                $message = sprintf(
    123123                                        /* 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' ),
     124                                        __( 'Your chosen plugin name - %1$s - contains the restricted term "%2$s" and cannot be used at all in your plugin permalink. 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' ),
    125125                                        '<code>' . $this->plugin_slug . '</code>',
    126126                                        trim( $this->has_trademarked_slug(), '-' ),
    127127                                        '<code>Plugin Name:</code>',
     
    208208
    209209                        return new \WP_Error( 'invalid_version', $error . ' ' . sprintf(
    210210                                /* translators: %s: 'Version:' */
    211                                 __( 'Version strings can only contain numeric and period characters (i.e. 1.2). Please correct the %s line in your main plugin file and upload the plugin again.', 'wporg-plugins' ),
     211                                __( 'Version strings may only contain numeric and period characters (i.e. 1.2). Please correct the %s line in your main plugin file and upload the plugin again.', 'wporg-plugins' ),
    212212                                '<code>Version:</code>'
    213213                        ) );
    214214                }
     
    232232
    233233                                return new \WP_Error( 'already_exists_in_the_wild', $error . ' ' . sprintf(
    234234                                        /* translators: 1: plugin slug, 2: 'Plugin Name:' */
    235                                         __( 'There is already a plugin with the name %1$s known to WordPress.org. You must rename your plugin by changing the %2$s line in your main plugin file and in your readme. Once you have done so, you may upload it again.', 'wporg-plugins' ),
     235                                        __( 'There is already a plugin with the name %1$s known to exist. This generally means the permalink %2$s is already in use outside of WordPress.org and has a significant user base. You must rename your plugin by changing the %3$s line in your main plugin file and in your readme. Once you have done so, you may upload it again. If you feel this is incorrect, email <a href="mailto:%4$s">%4$s</a> and explain why so that we may help you.', 'wporg-plugins' ),
    236236                                        '<code>' . $this->plugin['Name'] . '</code>',
    237                                         '<code>Plugin Name:</code>'
     237                                        '<code>' . $this->plugin_slug . '</code>',
     238                                        '<code>Plugin Name:</code>',
     239                                        'plugins@wordpress.org'
    238240                                ) );
    239241                        }
    240242                }
     
    431433                        'elementor-',
    432434                        'envato-',
    433435                        'facebook',
     436                        'fb-',
    434437                        'feedburner',
    435438                        'github-',
    436439                        'google-',
    437440                        'gravity-forms-',
    438441                        'gutenberg',
     442                        'ig-',
    439443                        'instagram',
     444                        'jetpack-',
    440445                        'macintosh-',
    441446                        'microsoft-',
    442447                        'ninja-forms-',
     
    445450                        'stripe-',
    446451                        'twitter-',
    447452                        'tweet',
     453                        'wa-',
    448454                        'whatsapp',
    449455                        'whats-app',
    450                         'woocommerce-',
     456                        'woocommerce',
    451457                        'woo-',
    452458                        'wordpress',
    453459                        'yoast',
     
    454460                        'youtube-',
    455461                );
    456462
     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
    457469                $has_trademarked_slug = false;
    458470
    459471                foreach ( $trademarked_slugs as $trademark ) {
     
    470482                        }
    471483                }
    472484
     485                // Get the user email domain.
     486                $user_email_domain = explode( '@', wp_get_current_user()->user_email );
     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
    473496                return $has_trademarked_slug;
    474497        }
    475498