Making WordPress.org

Changeset 13212


Ignore:
Timestamp:
02/14/2024 01:41:54 AM (3 years ago)
Author:
dd32
Message:

Plugin Directory: Upload: List the uploaded plugins with the most recent first, move the upload-additional prompt to the start of the list to match.

See #7384.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-upload.php

    r13211 r13212  
    281281                                                        echo '</li>';
    282282
     283                                                        add_filter( 'get_attached_media_args', $get_attached_media_args = function( $args ) {
     284                                                                $args['orderby'] = 'post_date';
     285                                                                $args['order']   = 'DESC';
     286                                                                return $args;
     287                                                        } );
     288                                                        $attached_media = get_attached_media( 'application/zip', $plugin );
     289                                                        remove_filter( 'get_attached_media_args', $get_attached_media_args );
     290
     291                                                        if ( $can_upload_extras ) {
     292                                                                echo '<li>';
     293                                                                echo '<a href="#" class="show-upload-additional hide-if-no-js">' . sprintf( __( 'Upload new version of %s for review.', 'wporg-plugins' ), esc_html( $plugin->post_title ) ) . '</a>';
     294
     295                                                                ?>
     296                                                                <form class="plugin-upload-form hidden" enctype="multipart/form-data" method="POST" action="">
     297                                                                        <?php wp_nonce_field( 'wporg-plugins-upload-' . $plugin->ID ); ?>
     298                                                                        <input type="hidden" name="action" value="upload-additional"/>
     299                                                                        <input type="hidden" name="plugin_id" value="<?php echo esc_attr( $plugin->ID ); ?>" />
     300
     301                                                                        <label class="button button-secondary zip-file">
     302                                                                                <input type="file" class="plugin-file" name="zip_file" size="25" accept=".zip" required data-maxbytes="<?php echo esc_attr( wp_max_upload_size() ); ?>" />
     303                                                                                <span><?php _e( 'Select File', 'wporg-plugins' ); ?></span>
     304                                                                        </label>
     305
     306                                                                        <input class="upload-button button button-primary" type="submit" value="<?php esc_attr_e( 'Upload', 'wporg-plugins' ) ?>"/>
     307                                                                </form>
     308                                                                <?php
     309                                                                echo '</li>';
     310                                                        }
     311
    283312                                                        echo '<li>';
    284                                                         $attached_media = get_attached_media( 'application/zip', $plugin );
    285 
    286313                                                        echo '<strong>' . __( 'Submitted files:', 'wporg' ) . '</strong><ol>';
    287314                                                        foreach ( $attached_media as $attachment_post_id => $upload ) {
     
    300327                                                                echo '</ul></li>';
    301328                                                        }
    302                                                         if ( $can_upload_extras ) {
    303                                                                 echo '<li class="unmarked-list"><a href="#" class="show-upload-additional hide-if-no-js">' . sprintf( __( 'Upload new version of %s for review.', 'wporg-plugins' ), esc_html( $plugin->post_title ) ) . '</a>';
    304                                                         }
    305329                                                        echo '</ol>';
    306330
    307                                                         if ( $can_upload_extras ) {
    308                                                                 ?>
    309                                                                 <form class="plugin-upload-form hidden" enctype="multipart/form-data" method="POST" action="">
    310                                                                         <?php wp_nonce_field( 'wporg-plugins-upload-' . $plugin->ID ); ?>
    311                                                                         <input type="hidden" name="action" value="upload-additional"/>
    312                                                                         <input type="hidden" name="plugin_id" value="<?php echo esc_attr( $plugin->ID ); ?>" />
    313 
    314                                                                         <label class="button button-secondary zip-file">
    315                                                                                 <input type="file" class="plugin-file" name="zip_file" size="25" accept=".zip" required data-maxbytes="<?php echo esc_attr( wp_max_upload_size() ); ?>" />
    316                                                                                 <span><?php _e( 'Select File', 'wporg-plugins' ); ?></span>
    317                                                                         </label>
    318 
    319                                                                         <input class="upload-button button button-primary" type="submit" value="<?php esc_attr_e( 'Upload', 'wporg-plugins' ) ?>"/>
    320                                                                 </form>
    321                                                                 <?php
    322                                                         }
    323331                                                        echo '</li>';
    324332                                                        echo '</ul>';
Note: See TracChangeset for help on using the changeset viewer.