Changeset 6287 for sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-upload-handler.php
- Timestamp:
- 12/19/2017 04:22:37 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-upload-handler.php
r6045 r6287 1 1 <?php 2 2 namespace WordPressdotorg\Plugin_Directory\Shortcodes; 3 3 4 use WordPressdotorg\Plugin_Directory\Readme\Parser; 4 5 use WordPressdotorg\Plugin_Directory\Plugin_Directory; … … 44 45 */ 45 46 public function __construct() { 46 require_once ( ABSPATH . 'wp-admin/includes/plugin.php' );47 require_once ( ABSPATH . 'wp-admin/includes/image.php' );48 require_once ( ABSPATH . 'wp-admin/includes/file.php' );49 require_once ( ABSPATH . 'wp-admin/includes/media.php' );47 require_once ABSPATH . 'wp-admin/includes/plugin.php'; 48 require_once ABSPATH . 'wp-admin/includes/image.php'; 49 require_once ABSPATH . 'wp-admin/includes/file.php'; 50 require_once ABSPATH . 'wp-admin/includes/media.php'; 50 51 } 51 52 … … 58 59 */ 59 60 public function process_upload() { 60 $zip_file = $_FILES['zip_file']['tmp_name'];61 $zip_file = $_FILES['zip_file']['tmp_name']; 61 62 $this->plugin_dir = Filesystem::unzip( $zip_file ); 62 63 … … 65 66 $plugin_data = get_plugin_data( $plugin_file, false, false ); // No markup/translation needed. 66 67 if ( ! empty( $plugin_data['Name'] ) ) { 67 $this->plugin = $plugin_data;68 $this->plugin = $plugin_data; 68 69 $this->plugin_root = dirname( $plugin_file ); 69 70 break; … … 104 105 if ( $this->has_reserved_slug() ) { 105 106 $error = __( 'Error: The plugin has a reserved name.', 'wporg-plugins' ); 106 107 107 108 return new \WP_Error( 'reserved_name', $error . ' ' . sprintf( 108 109 /* translators: 1: plugin slug, 2: 'Plugin Name:' */ … … 118 119 if ( $plugin_post && $plugin_post->post_author != get_current_user_id() ) { 119 120 $error = __( 'Error: The plugin already exists.', 'wporg-plugins' ); 120 121 121 122 return new \WP_Error( 'already_exists', $error . ' ' . sprintf( 122 123 /* translators: 1: plugin slug, 2: 'Plugin Name:' */ … … 130 131 if ( $plugin_post ) { 131 132 $error = __( 'Error: The plugin has already been submitted.', 'wporg-plugins' ); 132 133 133 134 return new \WP_Error( 'already_submitted', $error . ' ' . sprintf( 134 135 /* translators: 1: plugin slug, 2: plugins@wordpress.org */ … … 163 164 if ( preg_match( '|[^\d\.]|', $this->plugin['Version'] ) ) { 164 165 $error = __( 'Error: Plugin versions are expected to be numbers.', 'wporg-plugins' ); 165 166 166 167 return new \WP_Error( 'invalid_version', $error . ' ' . sprintf( 167 168 /* translators: %s: 'Version:' */ … … 174 175 if ( ! empty( $this->plugin['PluginURI'] ) && ! empty( $this->plugin['AuthorURI'] ) && $this->plugin['PluginURI'] == $this->plugin['AuthorURI'] ) { 175 176 $error = __( 'Error: Your plugin and author URIs are the same.', 'wporg-plugins' ); 176 177 return new \WP_Error( 'plugin_author_uri', $error . ' ' . 177 178 return new \WP_Error( 179 'plugin_author_uri', $error . ' ' . 178 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' ) 179 181 ); … … 183 185 if ( empty( $readme ) ) { 184 186 $error = __( 'Error: The plugin has no readme.', 'wporg-plugins' ); 185 187 186 188 return new \WP_Error( 'no_readme', $error . ' ' . sprintf( 187 189 /* translators: 1: readme.txt, 2: readme.md */ … … 199 201 if ( ! $result ) { 200 202 $error = __( 'Error: The plugin has failed the automated checks.', 'wporg-plugins' ); 201 203 202 204 return new \WP_Error( 'failed_checks', $error . ' ' . sprintf( 203 205 /* translators: 1: Plugin Check Plugin URL, 2: make.wordpress.org/plugins */ … … 210 212 // Passed all tests! 211 213 // Let's save everything and get things wrapped up. 212 213 214 // Create a new post on first-time submissions. 214 215 if ( ! $plugin_post ) { … … 225 226 'post_content' => $content, 226 227 'post_excerpt' => $this->plugin['Description'], 227 //'tax_input' => wp_unslash( $_POST['tax_input'] ), // for category selection228 // 'tax_input' => wp_unslash( $_POST['tax_input'] ), // for category selection 228 229 'meta_input' => array( 229 230 'tested' => $readme->tested, … … 277 278 278 279 /* translators: 1: plugin name, 2: plugin slug, 3: plugins@wordpress.org */ 279 $message = sprintf( __( '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.' ), 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.' ), 280 282 esc_html( $this->plugin['Name'] ), 281 283 '<code>' . $this->plugin_slug . '</code>' … … 283 285 284 286 /* translators: 1: plugins@wordpress.org */ 285 $message .= sprintf( __( 'We’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.' ), 287 $message .= sprintf( 288 __( 'We’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.' ), 286 289 'plugins@wordpress.org' 287 290 ) . '</p><p>'; … … 394 397 395 398 /* translators: %s: plugin name */ 396 $email_subject = sprintf( __( '[WordPress Plugin Directory] New Plugin - %s', 'wporg-plugins' ), 399 $email_subject = sprintf( 400 __( '[WordPress Plugin Directory] New Plugin - %s', 'wporg-plugins' ), 397 401 $this->plugin['Name'] 398 402 ); 399 403 400 404 /* translators: 1: plugin name, 2: plugin slug */ 401 $email_content = sprintf( __( '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. 405 $email_content = sprintf( 406 __( 407 '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. 402 408 403 409 Your plugin has been given the initial slug of %2$s, however this is subject to change based on the results of your review. … … 411 417 -- 412 418 The WordPress Plugin Directory Team 413 https://make.wordpress.org/plugins', 'wporg-plugins' ), 419 https://make.wordpress.org/plugins', 'wporg-plugins' 420 ), 414 421 $this->plugin['Name'], 415 422 $this->plugin_slug … … 422 429 423 430 // Helper 424 425 431 /** 426 432 * Whitelist zip files to be allowed to be uploaded to the media library.
Note: See TracChangeset
for help on using the changeset viewer.