Making WordPress.org

Ticket #4293: 4293.diff

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

     
    7777                        $error = __( 'Error: The plugin has no name.', 'wporg-plugins' );
    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                }
    8686
     
    9595
    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' ),
    99                                 esc_html( $this->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' ),
    10099                                '<code>Plugin Name:</code>'
    101100                        ) );
    102101                }
     
    121120
    122121                        return new \WP_Error( 'already_exists', $error . ' ' . sprintf(
    123122                                /* 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' ),
     123                                __( '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' ),
    125124                                '<code>' . $this->plugin_slug . '</code>',
    126125                                '<code>Plugin Name:</code>'
    127126                        ) );
     
    132131                        $error = __( 'Error: The plugin has already been submitted.', 'wporg-plugins' );
    133132
    134133                        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' ),
     134                                /* translators: 1: plugin slug, 2: Documentation URL, 3: plugins@wordpress.org */
     135                                __( '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:%2$s">%2$s</a> and let us know.', 'wporg-plugins' ),
    137136                                '<code>' . $this->plugin_slug . '</code>',
     137                                __( 'https://developer.wordpress.org/plugins/wordpress-org/how-to-use-subversion/', 'wporg-plugins' ),
    138138                                'plugins@wordpress.org'
    139139                        ) );
    140140                }
     
    144144
    145145                        return new \WP_Error( 'no_description', $error . ' ' . sprintf(
    146146                                /* 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' ),
     147                                __( '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' ),
    148148                                '<code>Description:</code>',
    149149                                __( 'https://developer.wordpress.org/plugins/the-basics/header-requirements/', 'wporg-plugins' )
    150150                        ) );
     
    155155
    156156                        return new \WP_Error( 'no_version', $error . ' ' . sprintf(
    157157                                /* 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' ),
     158                                __( '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' ),
    159159                                '<code>Version:</code>',
    160160                                __( 'https://developer.wordpress.org/plugins/the-basics/header-requirements/', 'wporg-plugins' )
    161161                        ) );
     
    166166
    167167                        return new \WP_Error( 'invalid_version', $error . ' ' . sprintf(
    168168                                /* 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' ),
     169                                __( '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' ),
    170170                                '<code>Version:</code>'
    171171                        ) );
    172172                }
     
    177177
    178178                        return new \WP_Error(
    179179                                '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' )
     180                                __( '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' )
    181181                        );
    182182                }
    183183
     
    187187
    188188                        return new \WP_Error( 'no_readme', $error . ' ' . sprintf(
    189189                                /* translators: 1: readme.txt, 2: readme.md */
    190                                 __( 'The zip file must include a file named %1$s or %2$s. We recommend using %1$s as it will allow you to fully utilize our directory.', 'wporg-plugins' ),
     190                                __( 'The zip file must include a readme file named %1$s or %2$s. We recommend using %1$s as it will allow you to fully utilize our directory.', 'wporg-plugins' ),
    191191                                '<code>readme.txt</code>',
    192192                                '<code>readme.md</code>'
    193193                        ) );
     
    202202                        $error = __( 'Error: The plugin has failed the automated checks.', 'wporg-plugins' );
    203203
    204204                        return new \WP_Error( 'failed_checks', $error . ' ' . sprintf(
    205                                 /* translators: 1: Plugin Check Plugin URL, 2: make.wordpress.org/plugins */
     205                                /* translators: 1: Plugin Check Plugin URL, 2: make.wordpress.org/plugins (BAD URL!) */
    206206                                __( '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' ),
    207207                                '//wordpress.org/plugins/plugin-check/',
    208208                                '<a href="https://make.wordpress.org/plugins">https://make.wordpress.org/plugins</a>'
     
    278278
    279279                /* 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                        __( '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 immediatly, as it cannot be changed once your plugin is approved.' ),
    282282                        esc_html( $this->plugin['Name'] ),
    283283                        '<code>' . $this->plugin_slug . '</code>'
    284284                ) . '</p><p>';
     
    289289                        'plugins@wordpress.org'
    290290                ) . '</p><p>';
    291291
    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>';
     292                // Warn if the plugin starts with a reserved slug.
     293                if ( $this->starts_with_reserved_slug() ) {
     294                        /* translators: 1: plugin name */
     295                        $message .= sprintf(
     296                                __( 'Warning: Your plugin will probably need to be renamed. Your chosen plugin name - %1$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.' ),
     297                                esc_html( $this->plugin['Name'] ),
     298                        ) . '</p><p>';
     299                }
    293300
     301                $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>';
     302
    294303                $message .= sprintf(
    295304                        /* translators: 1: URL to guidelines; 2: URL to FAQs; */
    296305                        wp_kses_post( __( 'While you&#8217;re waiting on your review, please take the time to read <a href="%1$s">the developer guidelines</a> and <a href="%2$s">the developer FAQ</a> as they will address most questions.', 'wporg-plugins' ) ),
     
    330339        }
    331340
    332341        /**
     342         * Whether the uploaded plugin uses a slug commonly abused by non reps
     343         *
     344         * @return bool
     345         */
     346        public function starts_with_reserved_slug() {
     347                $abused_slugs = array(
     348                        // Plugin Directory URL parameters.
     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         *
    335372         * Looks for either a readme.txt or readme.md file, prioritizing readme.txt.
     
    339376        protected function find_readme_file() {
    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 ) ) ) {
    345382                                return $file;
     
    358395                return true;
    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
    364401                // Display the errors.
     
    404441
    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                );
    410447
     
    415452
    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.
     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.
    419456
    420 We recommend you review the following links to understand the
     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/
    423460Frequently Asked Questions: https://developer.wordpress.org/plugins/wordpress-org/plugin-developer-faq/