Making WordPress.org

Ticket #4664: trademark.diff

File trademark.diff, 11.6 KB (added by Ipstenu, 6 years ago)
  • trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-author-card.php

     
    1313 * @package WordPressdotorg\Plugin_Directory\Admin\Metabox
    1414 */
    1515class Author_Card {
     16
    1617        /**
     18         * List of known problematic IPs
     19         *
     20         * @var array
     21         */
     22        public static $iffy_ips = [
     23                '2.240.',
     24                '2.241.',
     25                '5.102.170.',
     26                '5.102.171.',
     27                '38.78.',
     28                '47.15.',
     29                '49.50.124.',
     30                '65.33.104.38',
     31                '71.41.77.202',
     32                '76.73.108.',
     33                '80.131.192.168',
     34                '87.188.',
     35                '91.228.',
     36                '91.238.',
     37                '94.103.41.',
     38                '109.123.',
     39                '110.55.1.251',
     40                '110.55.4.248',
     41                '116.193.162.',
     42                '119.235.251.',
     43                '159.253.145.183',
     44                '173.171.9.190',
     45                '173.234.140.18',
     46                '188.116.36.',
     47                '217.87.',
     48        ];
     49
     50        /**
    1751         * Displays information about the author of the current plugin.
    1852         *
    1953         * @param int|WP_Post $post_or_user_id The post or the ID of a specific user.
     
    250284         * @return string
    251285         */
    252286        protected static function link_ip( $ip ) {
    253                 return sprintf(
    254                         '<a href="%1$s">%2$s</a>',
     287
     288                $ip_data = array(
     289                        'name'    => $ip,
     290                        'tooltip' => '',
     291                        'iffy'    => false,
     292                );
     293
     294                foreach ( self::$iffy_ips as $check_ip ) {
     295                        if ( strpos( $ip, $check_ip ) !== false ) {
     296                                $ip_data['name']   .= '*';
     297                                $ip_data['tooltip'] = 'This IP may be problemtic and has been used for abuse before.';
     298                                $ip_data['iffy']    = true;
     299                        }
     300                }
     301
     302                $ip_name = ( true === $warning ) ? $ip . ' *' : $ip;
     303
     304                $output_ip = sprintf(
     305                        '<a href="%1$s" title="%2$s">%3$s</a>',
    255306                        esc_url( add_query_arg( array(
    256307                                'post_type' => 'plugin',
    257308                                's'         => $ip,
    258309                        ), admin_url( 'edit.php' ) ) ),
    259                         $ip
     310                        $ip_data['tooltip'],
     311                        $ip_data['name']
    260312                );
     313
     314                return $output_ip;
    261315        }
    262316
    263317        /**
  • trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-review-tools.php

     
    3232         * @var array
    3333         */
    3434        public static $reserved_slugs = [
    35                 'wordpress',
    36                 'woocommerce',
     35                'apple',
     36                'contact-form-7',
     37                'facebook',
    3738                'google',
    38                 'youtube',
     39                'instagram',
     40                'ios',
     41                'jetpack',
     42                'jquery',
     43                'microsoft',
     44                'paypal',
    3945                'twitter',
    40                 'facebook',
     46                'woocommerce',
     47                'wordpress',
    4148                'yoast',
    42                 'jetpack',
     49                'youtube',
    4350        ];
    4451
    4552        /**
     
    4956         */
    5057        public static $restricted_slugs = [
    5158                // High-value plugin genres due to their popularity, often abused by spammers.
     59                'booking',
     60                'bookmark',
     61                'cookie',
    5262                'gallery',
    5363                'lightbox',
     64                'seo',
    5465                'sitemap',
    55                 'bookmark',
     66                'slide',
    5667                'social',
    57                 'cookie',
    58                 'slide',
    59                 'seo',
    6068
    6169                // Plugins we generally don't allow.
    6270                'autoblog',
    6371                'auto-blog',
    64                 'booking',
     72                'framework',
     73                'library',
    6574                'plugin',
    6675                'spinning',
    67                 'framework',
    6876        ];
    6977
    7078        /**
     
    8694        ];
    8795
    8896        /**
    89          * List of known problematic IPs
    90          *
    91          * @var array
    92          */
    93         public static $iffy_ips = [
    94                 '2.240.',
    95                 '2.241.',
    96                 '5.102.170.',
    97                 '5.102.171.',
    98                 '38.78.',
    99                 '47.15.',
    100                 '49.50.124.',
    101                 '65.33.104.38',
    102                 '71.41.77.202',
    103                 '76.73.108.',
    104                 '80.131.192.168',
    105                 '87.188.',
    106                 '91.228.',
    107                 '91.238.',
    108                 '94.103.41.',
    109                 '109.123.',
    110                 '110.55.1.251',
    111                 '110.55.4.248',
    112                 '116.193.162.',
    113                 '119.235.251.',
    114                 '159.253.145.183',
    115                 '173.171.9.190',
    116                 '173.234.140.18',
    117                 '188.116.36.',
    118                 '217.87.',
    119         ];
    120 
    121         /**
    12297         * Displays links to plugin assets and automated flags.
    12398         */
    12499        public static function display() {
  • trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-upload-handler.php

     
    9595
    9696                        return new \WP_Error( 'unsupported_name', $error . ' ' . sprintf(
    9797                                /* translators: %s: 'Plugin Name:' */
    98                                 __( 'Plugin names may only contain latin letters (A-z), numbers, spaces, and hyphens. Please change the %s line in your main plugin file and upload it again.', 'wporg-plugins' ),
     98                                __( 'Plugin names may only contain latin letters (A-z), numbers, spaces, and hyphens. Please change the %s line in your main plugin file and readme, then you may upload it again.', 'wporg-plugins' ),
    9999                                esc_html( $this->plugin['Name'] ),
    100100                                '<code>Plugin Name:</code>'
    101101                        ) );
     
    107107
    108108                        return new \WP_Error( 'reserved_name', $error . ' ' . sprintf(
    109109                                /* translators: 1: plugin slug, 2: 'Plugin Name:' */
    110                                 __( 'Your chosen plugin name - %1$s - has been reserved for use by WordPress. Please change the %2$s line in your main plugin file and upload it again.', 'wporg-plugins' ),
     110                                __( 'Your chosen plugin name - %1$s - has been reserved and cannot be used. Please change the %2$s line in your main plugin file and readme, then you may upload it again.', 'wporg-plugins' ),
    111111                                '<code>' . $this->plugin_slug . '</code>',
    112112                                '<code>Plugin Name:</code>'
    113113                        ) );
    114114                }
    115115
     116                // Make sure it doesn't use a TRADEMARK protected slug.
     117                if ( $this->has_trademarked_slug() ) {
     118                        $error = __( 'Error: The plugin has a trademarked name.', 'wporg-plugins' );
     119
     120                        return new \WP_Error( 'trademarked_name', $error . ' ' . sprintf(
     121                                /* translators: 1: plugin slug, 2: 'Plugin Name:', 3: plugin email address. */
     122                                __( 'Your chosen plugin name - %1$s - has been flagged as trademark infringement and cannot be used. We have been legally compelled to protect specific trademarks and as such prevent the use of specific terms. Please change the %2$s line in your main plugin file and readme, then you may upload it again. If you feel this is in error, please email us at %3$s and explain why.', 'wporg-plugins' ),
     123                                '<code>' . $this->plugin_slug . '</code>',
     124                                '<code>Plugin Name:</code>',
     125                                '<code>plugins@wordpress.org</code>'
     126                        ) );
     127                }
     128
    116129                $plugin_post = Plugin_Directory::get_plugin_post( $this->plugin_slug );
    117130
    118131                // Is there already a plugin with the same slug by a different author?
     
    140153                        ) );
    141154                }
    142155
     156                // Prevent short plugin names (they're generally SEO grabs).
     157                if ( strlen( $this->plugin_slug ) < 5 ) {
     158                        $error = __( 'Error: The plugin slug is too short.', 'wporg-plugins' );
     159
     160                        return new \WP_Error( 'trademarked_name', $error . ' ' . sprintf(
     161                                /* translators: 1: plugin slug, 2: 'Plugin Name:' */
     162                                __( 'Your chosen plugin name - %1$s - is not permitted becuase it is too short. Please change the %2$s line in your main plugin file and readme and upload it again.', 'wporg-plugins' ),
     163                                '<code>' . $this->plugin_slug . '</code>',
     164                                '<code>Plugin Name:</code>'
     165                        ) );
     166                }
     167
    143168                if ( ! $this->plugin['Description'] ) {
    144169                        $error = __( 'Error: The plugin has no description.', 'wporg-plugins' );
    145170
     
    290315                        'plugins@wordpress.org'
    291316                ) . '</p><p>';
    292317
    293                 // Warn if the plugin starts with a reserved slug.
    294                 if ( $this->starts_with_reserved_slug() ) {
    295                         $message .= sprintf(
    296                                 /* translators: %s: plugin name */
    297                                 __( 'Warning: Your plugin will probably need to be renamed. Your chosen plugin name - %s - starts with a term that may belong to another company. When we review your submission we will either correct this for you or request you approve a new name.' ),
    298                                 esc_html( $this->plugin['Name'] )
    299                         ) . '</p><p>';
    300                 }
    301 
    302318                $message .= __( 'If there is any error in your submission, please email us as soon as possible. We can correct many issues before approval.', 'wporg-plugins' ) . '</p><p>';
    303319
    304320                $message .= sprintf(
     
    334350                        'admin',
    335351                        'wp-admin',
    336352                        'wordpress',
     353                        'jquery',
    337354                );
    338355
    339356                return in_array( $this->plugin_slug, $reserved_slugs );
     
    340357        }
    341358
    342359        /**
    343          * Whether the uploaded plugin uses a slug commonly abused by non-reps.
     360         * Whether the uploaded plugin uses a trademark in the slug.
    344361         *
    345362         * @return bool
    346363         */
    347         public function starts_with_reserved_slug() {
    348                 $abused_slugs = array(
    349                         'apple',
     364        public function has_trademarked_slug() {
     365                $return            = false;
     366                $trademarked_slugs = array(
     367                        'contact-form-7',
    350368                        'facebook',
    351369                        'google',
    352                         'ios',
    353                         'jetpack',
     370                        '-gram',
     371                        'gram-',
     372                        'instagram',
     373                        'insta',
    354374                        'microsoft',
    355375                        'paypal',
    356376                        'twitter',
     377                        'tweet',
     378                        'whatsapp',
     379                        'whats-app',
    357380                        'woocommerce',
    358381                        'wordpress',
    359382                        'yoast',
    360383                );
    361384
    362                 // Get the slug in an array.
    363                 $slug = explode( '-', $this->plugin_slug );
     385                foreach ( $trademarked_slugs as $trademark ) {
     386                        if ( strpos( $this->plugin_slug, $trademark ) ) {
     387                                $return = true;
     388                        }
     389                }
    364390
    365                 // If the slug is the same as the first term, flag for abuse.
    366                 return in_array( $slug[0], $abused_slugs );
     391                return $return;
    367392        }
    368393
    369394        /**
     
    406431                }
    407432
    408433                echo '<h4>' . sprintf( __( 'Results of Automated Plugin Scanning: %s', 'wporg-plugins' ), vsprintf( '<span class="%1$s">%2$s</span>', $verdict ) ) . '</h4>';
    409                 echo '<ul class="tc-result">' . 'Result' . '</ul>';
     434                echo '<ul class="tc-result">' . __( 'Result', 'wporg-plugins' ) . '</ul>';
    410435                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>';
    411436
    412437                return $result;
     
    445470                        $this->plugin['Name']
    446471                );
    447472
    448                 /* translators: 1: plugin name, 2: plugin slug */
     473                /*
     474                        Please leave the blank lines in place.
     475                */
    449476                $email_content = sprintf(
     477                        // translators: 1: plugin name, 2: plugin slug.
    450478                        __(
    451479'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.
    452480
    453 Your plugin has been given the initial slug of %2$s, however this is subject to change based on the results of your review.
     481Your plugin has been given the initial slug of %2$s based on your diplay name of %1$s. This is subject to change based on the results of your review.
    454482
    455 If there is any problem with this 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. For situations like an incorrect plugin slug, we are unable to change that post approval. If you do not inform us of any requirements now, we will be unable to honor them later.
     483If there are any 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. For situations like an incorrect plugin slug, we are unable to change that post approval. If you do not inform us of any requirements now, we will be unable to honor them later.
    456484
    457485We recommend you review the following links to understand the review process and our expectations:
    458486
     
    474502                wp_mail( $user_email, $email_subject, $email_content, 'From: plugins@wordpress.org' );
    475503        }
    476504
    477         // Helper
     505        // Helper.
    478506        /**
    479507         * Whitelist zip files to be allowed to be uploaded to the media library.
    480508         *