Ticket #4293: 4293.diff
| File 4293.diff, 11.8 KB (added by , 7 years ago) |
|---|
-
trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-upload-handler.php
77 77 $error = __( 'Error: The plugin has no name.', 'wporg-plugins' ); 78 78 79 79 return new \WP_Error( 'no_name', $error . ' ' . sprintf( 80 /* translators: 1: plugin header line, 2: CodexURL */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' ), 82 82 '<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' ) 84 84 ) ); 85 85 } 86 86 … … 95 95 96 96 return new \WP_Error( 'unsupported_name', $error . ' ' . sprintf( 97 97 /* 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' ), 100 99 '<code>Plugin Name:</code>' 101 100 ) ); 102 101 } … … 121 120 122 121 return new \WP_Error( 'already_exists', $error . ' ' . sprintf( 123 122 /* translators: 1: plugin slug, 2: 'Plugin Name:' */ 124 __( 'There is already a plugin called %1$s by a different author. Please changethe %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' ), 125 124 '<code>' . $this->plugin_slug . '</code>', 126 125 '<code>Plugin Name:</code>' 127 126 ) ); … … 132 131 $error = __( 'Error: The plugin has already been submitted.', 'wporg-plugins' ); 133 132 134 133 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' ), 137 136 '<code>' . $this->plugin_slug . '</code>', 137 __( 'https://developer.wordpress.org/plugins/wordpress-org/how-to-use-subversion/', 'wporg-plugins' ), 138 138 'plugins@wordpress.org' 139 139 ) ); 140 140 } … … 144 144 145 145 return new \WP_Error( 'no_description', $error . ' ' . sprintf( 146 146 /* 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' ), 148 148 '<code>Description:</code>', 149 149 __( 'https://developer.wordpress.org/plugins/the-basics/header-requirements/', 'wporg-plugins' ) 150 150 ) ); … … 155 155 156 156 return new \WP_Error( 'no_version', $error . ' ' . sprintf( 157 157 /* 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' ), 159 159 '<code>Version:</code>', 160 160 __( 'https://developer.wordpress.org/plugins/the-basics/header-requirements/', 'wporg-plugins' ) 161 161 ) ); … … 166 166 167 167 return new \WP_Error( 'invalid_version', $error . ' ' . sprintf( 168 168 /* translators: %s: 'Version:' */ 169 __( 'Version strings can only contain numeric and period characters ( like 1.2). Please fixthe %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' ), 170 170 '<code>Version:</code>' 171 171 ) ); 172 172 } … … 177 177 178 178 return new \WP_Error( 179 179 'plugin_author_uri', $error . ' ' . 180 __( 'A plugin UR L 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' ) 181 181 ); 182 182 } 183 183 … … 187 187 188 188 return new \WP_Error( 'no_readme', $error . ' ' . sprintf( 189 189 /* 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' ), 191 191 '<code>readme.txt</code>', 192 192 '<code>readme.md</code>' 193 193 ) ); … … 202 202 $error = __( 'Error: The plugin has failed the automated checks.', 'wporg-plugins' ); 203 203 204 204 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!) */ 206 206 __( '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' ), 207 207 '//wordpress.org/plugins/plugin-check/', 208 208 '<a href="https://make.wordpress.org/plugins">https://make.wordpress.org/plugins</a>' … … 278 278 279 279 /* translators: 1: plugin name, 2: plugin slug, 3: plugins@wordpress.org */ 280 280 $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.' ), 282 282 esc_html( $this->plugin['Name'] ), 283 283 '<code>' . $this->plugin_slug . '</code>' 284 284 ) . '</p><p>'; … … 289 289 'plugins@wordpress.org' 290 290 ) . '</p><p>'; 291 291 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 } 293 300 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 294 303 $message .= sprintf( 295 304 /* translators: 1: URL to guidelines; 2: URL to FAQs; */ 296 305 wp_kses_post( __( 'While you’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' ) ), … … 330 339 } 331 340 332 341 /** 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 /** 333 370 * Find the plugin readme file. 334 371 * 335 372 * Looks for either a readme.txt or readme.md file, prioritizing readme.txt. … … 339 376 protected function find_readme_file() { 340 377 $files = Filesystem::list_files( $this->plugin_root, false /* non-recursive */, '!^readme\.(txt|md)$!i' ); 341 378 342 // Prioritize readme.txt 379 // Prioritize readme.txt file. 343 380 foreach ( $files as $file ) { 344 381 if ( '.txt' === strtolower( substr( $file, -4 ) ) ) { 345 382 return $file; … … 358 395 return true; 359 396 // Run the checks. 360 397 // @todo Include plugin checker. 361 // pass $this->plugin_root as the plugin root 398 // pass $this->plugin_root as the plugin root. 362 399 $result = true; 363 400 364 401 // Display the errors. … … 404 441 405 442 /* translators: %s: plugin name */ 406 443 $email_subject = sprintf( 407 __( '[WordPress Plugin Directory] New Plugin - %s', 'wporg-plugins' ),444 __( '[WordPress Plugin Directory] Successful Plugin Submission - %s', 'wporg-plugins' ), 408 445 $this->plugin['Name'] 409 446 ); 410 447 … … 415 452 416 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. 417 454 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 yourrequirements now, we will be unable to honor them later.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. 419 456 420 We recommend you review the following links to understand the 457 We recommend you review the following links to understand the review process and our expectations: 421 458 422 459 Guidelines: https://developer.wordpress.org/plugins/wordpress-org/detailed-plugin-guidelines/ 423 460 Frequently Asked Questions: https://developer.wordpress.org/plugins/wordpress-org/plugin-developer-faq/