Advertisement
Guest User

Untitled

a guest
Aug 17th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1. if( ! isset( $_REQUEST['file_upload_nonce'] ) || !wp_verify_nonce( $_REQUEST['file_upload_nonce'], 'file_upload_nonce' ) ) {
  2.  
  3. }
  4.  
  5. if( ! empty( $_FILES ) ) {
  6.  
  7. foreach( $_FILES as $file ) {
  8.  
  9. if( ! empty( $_REQUEST['id'] ) ) {
  10. $settings = get_option( "awsm" . preg_replace('/[^da-z]/i', '', $_REQUEST['id']) . "_upload_settings" );
  11. $settings = json_decode( base64_decode( $settings ) );
  12. }
  13.  
  14. $defaul_settings = $this->settings;
  15.  
  16.  
  17. $bail = false;
  18. $pathinfo = pathinfo( $file['name'] );
  19.  
  20. if( empty( $pathinfo ) || ! is_array( $file ) ) {
  21. $bail = true;
  22. }
  23.  
  24.  
  25. $bail = apply_filters( "awsm_bail_upload", $bail, $file, $settings );
  26.  
  27. if( ! $bail ) {
  28. $media = $this->awsm_process_file( $file );
  29. $response['success'] = false !== $media;
  30. $response['media_uri'] = $media;
  31. } else {
  32. $response['success'] = false;
  33. }
  34.  
  35. $response["settings"] = $settings;
  36. $response["file"] = $file;
  37.  
  38.  
  39. $new_data = array(
  40.  
  41. 'post_parent' => 60,
  42. 'post_title' => 'Applications',
  43. 'post_status' => 'publish',
  44. 'post_type' => 'awsm_job_application'
  45. );
  46. $application = wp_insert_post( $new_data );
  47.  
  48.  
  49.  
  50. }
  51. }
  52. echo json_encode( $response );
  53. exit;
  54.  
  55. }
  56.  
  57. <form id="user-post" name="new_post" method="post" >
  58.  
  59.  
  60. <div class="awsm-process-file" data-task="<?php echo $data_task; ?>">
  61. Name: <input type="text" name="user_name" id="user_name"><br>
  62. Email: <input type="text" name="user_email" id="user_email"><br>
  63. Phone: <input type="text" name="user_phone" id="user_phone"><br>
  64.  
  65. <input type="text" name="openings" value=" <?php echo get_the_id() ; ?> ">
  66. <input type="file" name="awsm_up" style="" id="<?php echo $rand; ?>" /><br>
  67. <label class="upload" disabled="disabled"><br>
  68. <input type="submit" name="awsm_load" style="" id="user-submit-button" />
  69. </label>
  70. <?php wp_nonce_field('awsm_nonce', 'awsm_nonce'); ?>
  71. </div>
  72.  
  73. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement