Making WordPress.org

Changeset 8470


Ignore:
Timestamp:
03/16/2019 10:24:06 PM (7 years ago)
Author:
SergeyBiryukov
Message:

Plugin Directory: Upload: Improve the language used in explanations for upload errors.

Add a check whether the uploaded plugin starts with a commonly abused slug.

Props Ipstenu.
Fixes #4293.

File:
1 edited

Legend:

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

    r7805 r8470  
    7878
    7979            return new \WP_Error( 'no_name', $error . ' ' . sprintf(
    80                 /* translators: 1: plugin header line, 2: Codex URL */
    81                 __( 'Add a %1$s line to your main plugin file and upload the plugin again. <a href="%2$s">Plugin Headers</a>', 'wporg-plugins' ),
     80                /* translators: 1: plugin header line, 2: Documentation URL */
     81                __( 'Add a %1$s line to your main plugin file and upload the plugin again. For more information, please review our documentation on <a href="%2$s">Plugin Headers</a>.', 'wporg-plugins' ),
    8282                '<code>Plugin Name:</code>',
    83                 __( 'https://codex.wordpress.org/File_Header', 'wporg-plugins' )
     83                __( 'https://developer.wordpress.org/plugins/plugin-basics/header-requirements/', 'wporg-plugins' )
    8484            ) );
    8585        }
     
    9696            return new \WP_Error( 'unsupported_name', $error . ' ' . sprintf(
    9797                /* translators: %s: 'Plugin Name:' */
    98                 __( 'Plugin names can 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 upload it again.', 'wporg-plugins' ),
    9999                esc_html( $this->plugin['Name'] ),
    100100                '<code>Plugin Name:</code>'
     
    122122            return new \WP_Error( 'already_exists', $error . ' ' . sprintf(
    123123                /* translators: 1: plugin slug, 2: 'Plugin Name:' */
    124                 __( 'There is already a plugin called %1$s by a different author. Please change the %2$s line in your main plugin file and upload it again.', 'wporg-plugins' ),
     124                __( 'There is already a plugin with the name %1$s in the directory. Please rename your plugin by changing the %2$s line in your main plugin file and upload it again.', 'wporg-plugins' ),
    125125                '<code>' . $this->plugin_slug . '</code>',
    126126                '<code>Plugin Name:</code>'
     
    133133
    134134            return new \WP_Error( 'already_submitted', $error . ' ' . sprintf(
    135                 /* translators: 1: plugin slug, 2: plugins@wordpress.org */
    136                 __( 'You have already submitted a plugin called %1$s. Please be patient and wait for a review. If you have made a mistake, email <a href="mailto:%2$s">%2$s</a> and let us know.', 'wporg-plugins' ),
     135                /* translators: 1: plugin slug, 2: Documentation URL, 3: plugins@wordpress.org */
     136                __( 'You have already submitted a plugin named %1$s. There is no need to resubmit existing plugins, even for new versions. Simply update your plugin within the directory via <a href="%2$s">SVN</a>. If you need assistance, email <a href="mailto:%3$s">%3$s</a> and let us know.', 'wporg-plugins' ),
    137137                '<code>' . $this->plugin_slug . '</code>',
     138                __( 'https://developer.wordpress.org/plugins/wordpress-org/how-to-use-subversion/', 'wporg-plugins' ),
    138139                'plugins@wordpress.org'
    139140            ) );
     
    145146            return new \WP_Error( 'no_description', $error . ' ' . sprintf(
    146147                /* translators: 1: plugin header line, 2: Documentation URL */
    147                 __( 'Add a %1$s line to your main plugin file and upload the plugin again. <a href="%2$s">Plugin Headers</a>', 'wporg-plugins' ),
     148                __( 'Add a %1$s line to your main plugin file and upload the plugin again. Please review our documentation on <a href="%2$s">Plugin Headers</a> for more information.', 'wporg-plugins' ),
    148149                '<code>Description:</code>',
    149150                __( 'https://developer.wordpress.org/plugins/the-basics/header-requirements/', 'wporg-plugins' )
     
    156157            return new \WP_Error( 'no_version', $error . ' ' . sprintf(
    157158                /* translators: 1: plugin header line, 2: Documentation URL */
    158                 __( 'Add a %1$s line to your main plugin file and upload the plugin again. <a href="%2$s">Plugin Headers</a>', 'wporg-plugins' ),
     159                __( 'Add a %1$s line to your main plugin file and upload the plugin again. Please review our documentation on <a href="%2$s">Plugin Headers</a> for more information.', 'wporg-plugins' ),
    159160                '<code>Version:</code>',
    160161                __( 'https://developer.wordpress.org/plugins/the-basics/header-requirements/', 'wporg-plugins' )
     
    167168            return new \WP_Error( 'invalid_version', $error . ' ' . sprintf(
    168169                /* translators: %s: 'Version:' */
    169                 __( 'Version strings can only contain numeric and period characters (like 1.2). Please fix the %s line in your main plugin file and upload the plugin again.', 'wporg-plugins' ),
     170                __( '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' ),
    170171                '<code>Version:</code>'
    171172            ) );
     
    178179            return new \WP_Error(
    179180                'plugin_author_uri', $error . ' ' .
    180                 __( 'A plugin URL is a page/site that provides details about this specific plugin. An author URL is a page/site that provides information about the author of the plugin. You are not required to provide both, so pick the one that best applies to your URL.', 'wporg-plugins' )
     181                __( 'A plugin URI (Unique Record Indicator) is a webpage that provides details about this specific plugin. An author URI is a webpage that provides information about the author of the plugin. Those two URIs must be different. You are not required to provide both, so pick the one that best applies to your situation.', 'wporg-plugins' )
    181182            );
    182183        }
     
    203204
    204205            return new \WP_Error( 'failed_checks', $error . ' ' . sprintf(
    205                 /* translators: 1: Plugin Check Plugin URL, 2: make.wordpress.org/plugins */
     206                /* translators: 1: Plugin Check Plugin URL, 2: https://make.wordpress.org/plugins */
    206207                __( 'Please correct the problems with the plugin and upload it again. You can also use the <a href="%1$s">Plugin Check Plugin</a> to test your plugin before uploading. If you have any questions about this please post them to %2$s.', 'wporg-plugins' ),
    207208                '//wordpress.org/plugins/plugin-check/',
     
    277278        do_action( 'plugin_upload', $this->plugin, $plugin_post );
    278279
    279         /* translators: 1: plugin name, 2: plugin slug, 3: plugins@wordpress.org */
    280280        $message = sprintf(
    281             __( 'Thank you for uploading %1$s to the WordPress Plugin Directory. It has been given the initial plugin slug of %2$s, however that is subject to change based on the results of your code review.' ),
     281            /* translators: 1: plugin name, 2: plugin slug, 3: plugins@wordpress.org */
     282            __( 'Thank you for uploading %1$s to the WordPress Plugin Directory. It has been given the initial plugin slug of %2$s, however that is subject to change based on the results of your code review. If this slug is incorrect, please contact us immediately, as it cannot be changed once your plugin is approved.' ),
    282283            esc_html( $this->plugin['Name'] ),
    283284            '<code>' . $this->plugin_slug . '</code>'
    284285        ) . '</p><p>';
    285286
    286         /* translators: 1: plugins@wordpress.org */
    287287        $message .= sprintf(
     288            /* translators: 1: plugins@wordpress.org */
    288289            __( 'We&rsquo;ve sent you an email verifying this submission. Please make sure to whitelist our email address - <a href="mailto:%1$s">%1$s</a> - to ensure you receive all our communications.' ),
    289290            'plugins@wordpress.org'
    290291        ) . '</p><p>';
    291292
    292         $message .= __( 'If there is any error in your submission, please email us as we can correct many issues before approval.', 'wporg-plugins' ) . '</p><p>';
     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 submision 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
     302        $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>';
    293303
    294304        $message .= sprintf(
     
    331341
    332342    /**
     343     * Whether the uploaded plugin uses a slug commonly abused by non-reps.
     344     *
     345     * @return bool
     346     */
     347    public function starts_with_reserved_slug() {
     348        $abused_slugs = array(
     349            'apple',
     350            'facebook',
     351            'google',
     352            'ios',
     353            'jetpack',
     354            'microsoft',
     355            'paypal',
     356            'twitter',
     357            'woocommerce',
     358            'wordpress',
     359            'yoast',
     360        );
     361
     362        // Get the slug in an array.
     363        $slug = explode( '-', $this->plugin_slug );
     364
     365        // If the slug is the same as the first term, flag for abuse.
     366        return in_array( $slug[0], $abused_slugs );
     367    }
     368
     369    /**
    333370     * Find the plugin readme file.
    334371     *
     
    340377        $files = Filesystem::list_files( $this->plugin_root, false /* non-recursive */, '!^readme\.(txt|md)$!i' );
    341378
    342         // Prioritize readme.txt
     379        // Prioritize readme.txt file.
    343380        foreach ( $files as $file ) {
    344381            if ( '.txt' === strtolower( substr( $file, -4 ) ) ) {
     
    359396        // Run the checks.
    360397        // @todo Include plugin checker.
    361         // pass $this->plugin_root as the plugin root
     398        // Pass $this->plugin_root as the plugin root.
    362399        $result = true;
    363400
     
    405442        /* translators: %s: plugin name */
    406443        $email_subject = sprintf(
    407             __( '[WordPress Plugin Directory] New Plugin - %s', 'wporg-plugins' ),
     444            __( '[WordPress Plugin Directory] Successful Plugin Submission - %s', 'wporg-plugins' ),
    408445            $this->plugin['Name']
    409446        );
     
    416453Your plugin has been given the initial slug of %2$s, however this is subject to change based on the results of your review.
    417454
    418 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, so if you do not let us know of your requirements now, we will be unable to honor them later.
    419 
    420 We recommend you review the following links to understand the
     455If 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.
     456
     457We recommend you review the following links to understand the review process and our expectations:
    421458
    422459Guidelines: https://developer.wordpress.org/plugins/wordpress-org/detailed-plugin-guidelines/
Note: See TracChangeset for help on using the changeset viewer.