prefix . 'adf_entities'; $upload = wp_upload_dir(); $upload_dir = $upload['basedir'].'/discuss-form/'.date('Y').'/'.date('m'); $upload_url = $upload['baseurl'].'/discuss-form/'.date('Y').'/'.date('m'); $admin_ext_email = sanitize_email(get_option('admin_email')); if(isset($_POST['admin_ext_email'])){ $admin_ext_email = sanitize_email($_POST['admin_ext_email']); } $mail_nonce = $merror = 0; $upload_file_url = $upload_dir .'/'. sanitize_file_name($_FILES['file']['name']); parse_str($_POST['post'], $output); $adf_description = sanitize_text_field($_POST['post']); if($_POST) { if(!is_dir($upload_dir)) { mkdir($upload_dir, 0755, true); } if ( 0 < $_FILES['file']['error'] ) { echo 'Error: ' . $_FILES['file']['error'] . '
'; } else { $filename = sanitize_file_name($_FILES['file']['name']); $check_filetype = wp_check_filetype_and_ext($_FILES['file'],$filename); $valid_ext = array('jpg|jpeg|jpe' => 'image/jpeg','png' => 'image/png','gif' => 'image/gif','pdf' => 'application/pdf','doc' => 'application/msword','docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'); if(in_array($check_filetype['type'] , $valid_ext,TRUE)) { $loc = $upload_dir .'/'. sanitize_file_name($_FILES['file']['name']); if(file_exists($loc)){ $increment = 0; list($name, $ext) = explode('.', $loc); while(file_exists($loc)) { $increment++; $loc = $name. $increment . '.' . $ext; $filename = $name. $increment . '.' . $ext; $upload_file_url = $filename; } move_uploaded_file($_FILES['file']['tmp_name'],$filename); } else { move_uploaded_file($_FILES['file']['tmp_name'], $upload_dir .'/'. sanitize_file_name($_FILES['file']['name'])); } } } $out = 'Please Find Project Detail
'; $out .= ''; foreach ($output as $key => $value) { $out .= ''; if($key !== 'adf_demo_wpnonce') { if(sanitize_text_field($key) == 'projectType'){ $out .= ''; foreach ($value as $subkey => $val) { if($val){ $out .= ''; $out .= ''; } } }else{ $out .= ''; } } $out .= ''; } $out .= '
Services:
'.sanitize_text_field($val).':'; foreach ($val as $innval) { $out .= ' '.sanitize_text_field($innval).'
'; } $out .= '
'.ucwords(str_replace('adf_',' ',sanitize_text_field($key))).''.$value.'
'; /*------- Email Sendding---------*/ $headers= "MIME-Version: 1.0\n" . "Content-Type: text/html; charset=\"" . get_option('blog_charset') . "\"\n"; $attachments = $attachments = array($upload_file_url); $to = $admin_ext_email; $subject = esc_html('Project Specification'); $a = wp_mail( $to, $subject, $out,$headers,$attachments); if(!$a){ echo esc_html('Try After Some time Mail not sendding'); }else{ echo esc_html('Mail send Our Team will contact You soon !'); } die(); } } ?>