Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $response = array();
- $response['success'] = false;
- if( ! isset( $_REQUEST['file_upload_nonce'] ) || !wp_verify_nonce( $_REQUEST['file_upload_nonce'], 'file_upload_nonce' ) ) {
- }
- if( ! empty( $_FILES ) ) {
- foreach( $_FILES as $file ) {
- if( ! empty( $_REQUEST['id'] ) ) {
- $settings = get_option( "awsm" . preg_replace('/[^da-z]/i', '', $_REQUEST['id']) . "_upload_settings" );
- $settings = json_decode( base64_decode( $settings ) );
- }
- $defaul_settings = $this->settings;
- $bail = false;
- $pathinfo = pathinfo( $file['name'] );
- if( empty( $pathinfo ) || ! is_array( $file ) ) {
- $bail = true;
- }
- $bail = apply_filters( "awsm_bail_upload", $bail, $file, $settings );
- if( ! $bail ) {
- $media = $this->awsm_process_file( $file );
- $response['success'] = false !== $media;
- $response['media_uri'] = $media;
- } else {
- $response['success'] = false;
- }
- $response["settings"] = $settings;
- $response["file"] = $file;
- $new_data = array(
- 'post_parent' => 60,
- 'post_title' => 'Applications',
- 'post_status' => 'publish',
- 'post_type' => 'awsm_job_application'
- );
- $application = wp_insert_post( $new_data );
- }
- }
- echo json_encode( $response );
- exit;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement