Making WordPress.org


Ignore:
Timestamp:
06/05/2023 04:40:30 AM (2 years ago)
Author:
dd32
Message:

Plugin Directory: Upload Shortcode: Remove a level of if() nesting for slightly more readable code.

File:
1 edited

Legend:

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

    r12617 r12618  
    6161     */
    6262    public function process_upload() {
     63        if ( UPLOAD_ERR_OK !== $_FILES['zip_file']['error'] ) {
     64            return new \WP_Error( 'error_upload', __( 'Error in file upload.', 'wporg-plugins' ) );
     65        }
     66
     67        $zip_file         = $_FILES['zip_file']['tmp_name'];
    6368        $has_upload_token = $this->has_valid_upload_token();
    64         $zip_file         = $_FILES['zip_file']['tmp_name'];
    6569        $this->plugin_dir = Filesystem::unzip( $zip_file );
    6670
Note: See TracChangeset for help on using the changeset viewer.