Skip to content

Commit

Permalink
Remove unnecessary "exit" call
Browse files Browse the repository at this point in the history
  • Loading branch information
Anh committed Feb 1, 2016
1 parent 861af6f commit 1d41c99
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
.idea
*.sublime-project
*.sublime-workspace
node_modules/*
Expand Down
17 changes: 9 additions & 8 deletions inc/fields/plupload-image.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,17 @@ static function handle_upload()

// Adds file as attachment to WordPress
$id = wp_insert_attachment( $attachment, $file_attr['file'], $post_id );
if ( ! is_wp_error( $id ) )
{
wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file_attr['file'] ) );

// Save file ID in meta field
add_post_meta( $post_id, $field_id, $id, false );
wp_send_json_success( self::img_html( $id ) );
if ( is_wp_error( $id ) )
{
wp_send_json_error();
}

exit;
wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file_attr['file'] ) );

// Save file ID in meta field
add_post_meta( $post_id, $field_id, $id, false );
wp_send_json_success( self::img_html( $id ) );
}

/**
Expand Down Expand Up @@ -184,7 +185,7 @@ static function normalize( $field )
'multipart_params' => array(
'field_id' => $field['id'],
'action' => 'rwmb_plupload_image_upload',
)
),
);
$field = parent::normalize( $field );

Expand Down
6 changes: 2 additions & 4 deletions js/plupload-image.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jQuery( function ( $ )
var $dropArea = $( this ),
$imageList = $dropArea.siblings( '.rwmb-uploaded' ),
uploaderData = $dropArea.data( 'js_options' ),
uploader = {};
uploader;

// Extend uploaderData
uploaderData.multipart_params = $.extend(
Expand Down Expand Up @@ -74,7 +74,6 @@ jQuery( function ( $ )
} );
up.refresh();
up.start();

} );

uploader.bind( 'Error', function ( up, e )
Expand Down Expand Up @@ -115,8 +114,7 @@ jQuery( function ( $ )
.fadeOut( 'slow', function ()
{
$( this ).remove();
}
);
} );
}

/**
Expand Down

0 comments on commit 1d41c99

Please sign in to comment.