Changeset 13575
- Timestamp:
- 04/19/2024 02:56:22 AM (6 months ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-review-tools.php
r13505 r13575 141 141 142 142 printf( 143 '<li>%1$s v%2$s <a href="%3$s" title="%4$s">%5$s</a> (%6$s) (<a href="%7$s" target="_blank">preview</a> | <a href="%8$s" target="_blank">pcp</a>) </li>',143 '<li>%1$s v%2$s <a href="%3$s" title="%4$s">%5$s</a> (%6$s) (<a href="%7$s" target="_blank">preview</a> | <a href="%8$s" target="_blank">pcp</a>)%9$s</li>', 144 144 esc_html( $zip_date ), 145 145 esc_html( $zip_file->version ), … … 149 149 esc_html( $zip_size ), 150 150 esc_url( $zip_preview ), 151 esc_url( $zip_pcp ) 151 esc_url( $zip_pcp ), 152 ( $zip_file->post_content ? '<br><div style="padding-left: 2em;">' . nl2br( $zip_file->post_content ) . '</div>' : '' ) 152 153 ); 153 154 } -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-upload-handler.php
r13574 r13575 79 79 80 80 $zip_file = $_FILES['zip_file']['tmp_name']; 81 $upload_comment = trim( wp_unslash( $_POST['comment'] ) ); 81 82 $has_upload_token = $this->has_valid_upload_token(); 82 83 $this->plugin_dir = Filesystem::unzip( $zip_file ); … … 492 493 } 493 494 494 $attachment = $this->save_zip_file( $plugin_post->ID );495 $attachment = $this->save_zip_file( $plugin_post->ID, $upload_comment ); 495 496 if ( is_wp_error( $attachment ) ) { 496 497 return $attachment; 498 } 499 500 // Store the uploaded comment as a plugin audit log. 501 if ( $upload_comment ) { 502 Tools::audit_log( 503 sprintf( 504 "Upload Comment for <a href='%s'>%s</a>\n%s", 505 wp_get_attachment_url( $attachment->ID ), 506 esc_html( $attachment->submitted_name ), 507 esc_html( $upload_comment ) 508 ), 509 $plugin_post->ID, 510 ); 497 511 } 498 512 … … 655 669 * @return WP_Post|WP_Error Attachment post or upload error. 656 670 */ 657 public function save_zip_file( $post_id ) {671 public function save_zip_file( $post_id, $upload_comment ) { 658 672 $zip_hash = sha1_file( $_FILES['zip_file']['tmp_name'] ); 659 673 if ( in_array( $zip_hash, get_post_meta( $post_id, 'uploaded_zip_hash' ) ?: [], true ) ) { … … 669 683 670 684 // Store the plugin details against the media as well. 671 $post_details 685 $post_details = array( 672 686 'post_title' => sprintf( '%s Version %s', $this->plugin['Name'], $this->plugin['Version'] ), 673 687 'post_excerpt' => $this->plugin['Description'], 688 'post_content' => esc_html( $upload_comment ) 674 689 ); 675 690 $attachment = media_handle_upload( 'zip_file', $post_id, $post_details ); … … 765 780 766 781 $text = sprintf( 767 "New ZIP uploaded by %s, version %s.\n %s\n%s",782 "New ZIP uploaded by %s, version %s.\nComment: %s\n%s", 768 783 wp_get_current_user()->user_login, 769 784 $attachment->version, 770 get_edit_post_link( $post ),785 $attachment->post_content, 771 786 wp_get_attachment_url( $attachment->ID ) 772 787 ); -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-upload.php
r13352 r13575 299 299 <input type="hidden" name="plugin_id" value="<?php echo esc_attr( $plugin->ID ); ?>" /> 300 300 301 <label> 302 <?php _e( 'Additional Information', 'wporg-plugins' ); ?><br> 303 <textarea name="comment" rows="3" cols="80"></textarea> 304 </label> 305 <br> 306 301 307 <label class="button button-secondary zip-file"> 302 308 <input type="file" class="plugin-file" name="zip_file" size="25" accept=".zip" required data-maxbytes="<?php echo esc_attr( wp_max_upload_size() ); ?>" /> … … 317 323 echo '<li>' . sprintf( __( 'Version: %s', 'wporg-plugins' ), '<code>' . esc_html( $upload->version ) . '</code>' ) . '</li>'; 318 324 echo '<li>' . sprintf( __( 'Upload Date: %s', 'wporg-plugins' ), date_i18n( get_option( 'date_format' ), strtotime( $upload->post_date ) ) ) . '</li>'; 325 if ( $upload->post_content ) { 326 echo '<li>' . nl2br( wp_kses_post( $upload->post_content ) ) . '</li>'; 327 } 319 328 if ( array_key_first( $attached_media) === $attachment_post_id ) { 320 329 printf( … … 398 407 <p> 399 408 <label> 409 <?php _e( 'Additional Information', 'wporg-plugins' ); ?><br> 410 <textarea name="comment" rows="3" cols="80"><?php 411 if ( ! empty( $_REQUEST['comment'] ) ) { 412 echo esc_textarea( $_REQUEST['comment'] ); 413 } 414 ?></textarea> 415 </label> 416 </p> 417 418 <p> 419 <label> 400 420 <input type="checkbox" name="requirements[faq]" required="required"> 401 421 <?php
Note: See TracChangeset
for help on using the changeset viewer.