Changeset 3034
- Timestamp:
- 04/28/2016 05:40:32 PM (9 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-status-transitions.php
r3029 r3034 79 79 } 80 80 81 $attachment = current( $attachments );81 $attachment = end( $attachments ); 82 82 $plugin_author = get_user_by( 'id', $post->post_author ); 83 83 … … 102 102 ) ); 103 103 104 // Delete zip. 105 wp_delete_attachment( $attachment->ID, true ); 104 // Delete zips. 105 foreach ( $attachments as $attachment ) { 106 wp_delete_attachment( $attachment->ID, true ); 107 } 106 108 107 109 // Grant commit access. -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-review-tools.php
r2978 r3034 9 9 class Review_Tools { 10 10 static function display() { 11 $post = get_post(); 12 $zip_files = get_attached_media( 'application/zip', $post ); 11 $post = get_post(); 13 12 14 if ( $zip_files) {15 $zip_ file = current( $zip_files);16 $zip_url = wp_get_attachment_url( $zip_file->ID ); 13 foreach ( get_attached_media( 'application/zip', $post ) as $zip_file ) { 14 $zip_url = wp_get_attachment_url( $zip_file->ID ); 15 17 16 printf( '<p>' . __( '<strong>Zip file:</strong> %s', 'wporg-plugins' ) . '</p>', 18 17 sprintf( '<a href="%s">%s</a>', esc_url( $zip_url ), esc_html( $zip_url ) ) -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php
r3020 r3034 514 514 'post_type' => 'plugin', 515 515 'name' => $plugin_slug, 516 'post_status' => array( 'publish', 'pending', 'disabled', 'closed' ),516 'post_status' => array( 'publish', 'pending', 'disabled', 'closed', 'draft' ), 517 517 ) ); 518 518 if ( ! $posts ) { -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-upload-handler.php
r3025 r3034 94 94 } 95 95 96 // Is there already a plugin with the name name? 97 if ( Plugin_Directory::get_plugin_post( $this->plugin_slug ) ) { 96 $plugin_post = Plugin_Directory::get_plugin_post( $this->plugin_slug ); 97 98 // Is there already a plugin by a different author? 99 if ( $plugin_post instanceof \WP_Post && $plugin_post->post_author != get_current_user_id() ) { 98 100 /* translators: 1: plugin slug, 2: style.css */ 99 101 return sprintf( __( 'There is already a plugin called %1$s by a different author. Please change the name of your plugin and upload it again.', 'wporg-plugins' ), … … 158 160 // Let's save everything and get things wrapped up. 159 161 160 $content = ''; 161 foreach ( $readme->sections as $section => $section_content ) { 162 $content .= "\n\n<!--section={$section}-->\n{$section_content}"; 163 } 164 165 // Add a Plugin Directory entry for this plugin. 166 $plugin_post = Plugin_Directory::create_plugin_post( array( 167 'title' => $this->plugin['Name'], 168 'slug' => $this->plugin_slug, 169 'status' => 'draft', 170 'author' => get_current_user_id(), 171 'content' => $content, 172 'description' => $this->plugin['Description'], 173 'tags' => $readme->tags, 174 'meta' => array( 175 'tested' => $readme->tested, 176 'requires' => $readme->requires, 177 'stable_tag' => $readme->stable_tag, 178 'upgrade_notice' => $readme->upgrade_notice, 179 'contributors' => $readme->contributors, 180 'screenshots' => $readme->screenshots, 181 'donate_link' => $readme->donate_link, 182 'sections' => array_keys( $readme->sections ), 183 'version' => $this->plugin['Version'], 184 'header_name' => $this->plugin['Name'], 185 'header_plugin_uri' => $this->plugin['PluginURI'], 186 'header_author' => $this->plugin['Author'], 187 'header_author_uri' => $this->plugin['AuthorURI'], 188 'header_textdomain' => $this->plugin['TextDomain'], 189 'header_description' => $this->plugin['Description'], 190 'assets_screenshots' => array(), 191 'assets_icons' => array(), 192 'assets_banners' => array(), 193 'assets_banners_color' => false, 194 'support_threads' => 0, 195 'support_threads_resolved' => 0, 196 ), 197 ) ); 198 if ( is_wp_error( $plugin_post ) ) { 199 return $plugin_post->get_error_message(); 162 // Create a new post on first-time submissions. 163 if ( ! ( $plugin_post instanceof \WP_Post ) ) { 164 $content = ''; 165 foreach ( $readme->sections as $section => $section_content ) { 166 $content .= "\n\n<!--section={$section}-->\n{$section_content}"; 167 } 168 169 // Add a Plugin Directory entry for this plugin. 170 $plugin_post = Plugin_Directory::create_plugin_post( array( 171 'title' => $this->plugin['Name'], 172 'slug' => $this->plugin_slug, 173 'status' => 'draft', 174 'author' => get_current_user_id(), 175 'content' => $content, 176 'description' => $this->plugin['Description'], 177 'tags' => $readme->tags, 178 'meta' => array( 179 'tested' => $readme->tested, 180 'requires' => $readme->requires, 181 'stable_tag' => $readme->stable_tag, 182 'upgrade_notice' => $readme->upgrade_notice, 183 'contributors' => $readme->contributors, 184 'screenshots' => $readme->screenshots, 185 'donate_link' => $readme->donate_link, 186 'sections' => array_keys( $readme->sections ), 187 'version' => $this->plugin['Version'], 188 'header_name' => $this->plugin['Name'], 189 'header_plugin_uri' => $this->plugin['PluginURI'], 190 'header_author' => $this->plugin['Author'], 191 'header_author_uri' => $this->plugin['AuthorURI'], 192 'header_textdomain' => $this->plugin['TextDomain'], 193 'header_description' => $this->plugin['Description'], 194 'assets_screenshots' => array(), 195 'assets_icons' => array(), 196 'assets_banners' => array(), 197 'assets_banners_color' => false, 198 'support_threads' => 0, 199 'support_threads_resolved' => 0, 200 ), 201 ) ); 202 if ( is_wp_error( $plugin_post ) ) { 203 return $plugin_post->get_error_message(); 204 } 200 205 } 201 206 … … 294 299 */ 295 300 public function save_zip_file( $post_id ) { 296 $_FILES['zip_file']['name'] = wp_generate_password( 12, false ) . '-' . $_FILES['zip_file']['name'];301 $_FILES['zip_file']['name'] = date( 'd_H-i-s' ) . '_' . $_FILES['zip_file']['name']; 297 302 298 303 add_filter( 'site_option_upload_filetypes', array( $this, 'whitelist_zip_files' ) );
Note: See TracChangeset
for help on using the changeset viewer.