/**
  * New resume notification
  */
 public function new_resume_submitted($resume_id)
 {
     include_once 'admin/class-wp-resume-manager-writepanels.php';
     $custom_fields = array_diff_key(WP_Resume_Manager_Writepanels::resume_fields(), array('_resume_file' => '', '_resume_expires' => ''));
     $resume = get_post($resume_id);
     $recipient = get_option('admin_email');
     $subject = sprintf(__('New Resume Submission From %s', 'wp-job-manager-resumes'), $resume->post_title);
     $attachments = array();
     $file_paths = get_resume_files($resume);
     foreach ($file_paths as $file_path) {
         $attachments[] = str_replace(array(site_url('/', 'http'), site_url('/', 'https')), ABSPATH, get_post_meta($resume_id, '_resume_file', true));
     }
     ob_start();
     get_job_manager_template('resume-submitted-notification.php', array('resume' => $resume, 'resume_id' => $resume_id, 'custom_fields' => $custom_fields), 'wp-job-manager-resumes', RESUME_MANAGER_PLUGIN_DIR . '/templates/');
     $message = ob_get_clean();
     add_filter('wp_mail_from', array(__CLASS__, 'get_from_address'));
     add_filter('wp_mail_from_name', array(__CLASS__, 'get_from_name'));
     wp_mail(apply_filters('resume_manager_new_resume_notification_recipient', $recipient, $resume_id), apply_filters('resume_manager_new_resume_notification_subject', $subject, $resume_id), $message, apply_filters('resume_manager_new_resume_notification_headers', '', $resume_id), apply_filters('resume_manager_new_resume_notification_attachments', array_filter($attachments), $resume_id));
     remove_filter('wp_mail_from', array(__CLASS__, 'get_from_address'));
     remove_filter('wp_mail_from_name', array(__CLASS__, 'get_from_name'));
 }
 /**
  * Sent the application email
  */
 public static function send_application($job_id, $resume_id, $application_message)
 {
     $user = wp_get_current_user();
     $resume_link = get_resume_share_link($resume_id);
     $candidate_name = get_the_title($resume_id);
     $candidate_email = get_post_meta($resume_id, '_candidate_email', true);
     $method = get_the_job_application_method($job_id);
     $sent = false;
     $attachments = array();
     $resume = get_post($resume_id);
     $file_paths = get_resume_files($resume);
     foreach ($file_paths as $file_path) {
         $attachments[] = str_replace(array(site_url('/', 'http'), site_url('/', 'https')), ABSPATH, get_post_meta($resume_id, '_resume_file', true));
     }
     if (empty($candidate_email)) {
         $candidate_email = $user->user_email;
     }
     $message = apply_filters('apply_with_resume_email_message', array('greeting' => __('Hello', 'wp-job-manager-resumes'), 'position' => sprintf("\n\n" . __('A candidate has applied online for the position "%s".', 'wp-job-manager-resumes'), get_the_title($job_id)), 'start_message' => "\n\n-----------\n\n", 'message' => $application_message, 'end_message' => "\n\n-----------\n\n", 'view_resume' => sprintf(__('You can view their online resume here: %s.', 'wp-job-manager-resumes'), $resume_link), 'contact' => "\n" . sprintf(__('Or you can contact them directly at: %s.', 'wp-job-manager-resumes'), $candidate_email)), get_current_user_id(), $job_id, $resume_id, $application_message);
     if (!empty($method->raw_email)) {
         $headers = array();
         $headers[] = 'From: ' . $candidate_name . ' <' . $candidate_email . '>';
         $headers[] = 'Reply-To: ' . $candidate_email;
         $sent = wp_mail(apply_filters('apply_with_resume_email_recipient', $method->raw_email, $job_id, $resume_id), apply_filters('apply_with_resume_email_subject', $method->subject, $job_id, $resume_id), implode('', $message), apply_filters('apply_with_resume_email_headers', $headers, $job_id, $resume_id), apply_filters('apply_with_resume_email_attachments', array_filter($attachments), $job_id, $resume_id));
     }
     do_action('applied_with_resume', get_current_user_id(), $job_id, $resume_id, $application_message, $sent);
     if ("email" !== $method->type && class_exists('WP_Job_Manager_Applications') && get_option('resume_manager_enable_application_for_url_method', 1)) {
         $sent = true;
     }
     return $sent;
 }
 public function download_resume_handler()
 {
     global $post, $is_IE;
     if (is_single() && !empty($_GET['download-resume']) && resume_manager_user_can_view_resume($post->ID) && apply_filters('resume_manager_user_can_download_resume_file', true, $post->ID)) {
         $file_paths = get_resume_files();
         $file_id = !empty($_GET['file-id']) ? absint($_GET['file-id']) : 0;
         $file_path = $file_paths[$file_id];
         if (!is_multisite()) {
             /*
              * Download file may be either http or https.
              * site_url() depends on whether the page containing the download (ie; My Account) is served via SSL because WC
              * modifies site_url() via a filter to force_ssl.
              * So blindly doing a str_replace is incorrect because it will fail when schemes are mismatched. This code
              * handles the various permutations.
              */
             $scheme = parse_url($file_path, PHP_URL_SCHEME);
             if ($scheme) {
                 $site_url = set_url_scheme(site_url(''), $scheme);
             } else {
                 $site_url = is_ssl() ? str_replace('https:', 'http:', site_url()) : site_url();
             }
             $file_path = str_replace(trailingslashit($site_url), ABSPATH, $file_path);
         } else {
             $network_url = is_ssl() ? str_replace('https:', 'http:', network_admin_url()) : network_admin_url();
             $upload_dir = wp_upload_dir();
             // Try to replace network url
             $file_path = str_replace(trailingslashit($network_url), ABSPATH, $file_path);
             // Now try to replace upload URL
             $file_path = str_replace($upload_dir['baseurl'], $upload_dir['basedir'], $file_path);
         }
         $file_path = realpath($file_path);
         $file_extension = strtolower(substr(strrchr($file_path, "."), 1));
         $ctype = "application/force-download";
         foreach (get_allowed_mime_types() as $mime => $type) {
             $mimes = explode('|', $mime);
             if (in_array($file_extension, $mimes)) {
                 $ctype = $type;
                 break;
             }
         }
         // Start setting headers
         if (!ini_get('safe_mode')) {
             @set_time_limit(0);
         }
         if (function_exists('get_magic_quotes_runtime') && get_magic_quotes_runtime()) {
             @set_magic_quotes_runtime(0);
         }
         if (function_exists('apache_setenv')) {
             @apache_setenv('no-gzip', 1);
         }
         @session_write_close();
         @ini_set('zlib.output_compression', 'Off');
         /**
          * Prevents errors, for example: transfer closed with 3 bytes remaining to read
          */
         @ob_end_clean();
         // Clear the output buffer
         if (ob_get_level()) {
             $levels = ob_get_level();
             for ($i = 0; $i < $levels; $i++) {
                 @ob_end_clean();
                 // Zip corruption fix
             }
         }
         if ($is_IE && is_ssl()) {
             // IE bug prevents download via SSL when Cache Control and Pragma no-cache headers set.
             header('Expires: Wed, 11 Jan 1984 05:00:00 GMT');
             header('Cache-Control: private');
         } else {
             nocache_headers();
         }
         $filename = basename($file_path);
         if (strstr($filename, '?')) {
             $filename = current(explode('?', $filename));
         }
         header("X-Robots-Tag: noindex, nofollow", true);
         header("Content-Type: " . $ctype);
         header("Content-Description: File Transfer");
         header("Content-Disposition: attachment; filename=\"" . $filename . "\";");
         header("Content-Transfer-Encoding: binary");
         if ($size = @filesize($file_path)) {
             header("Content-Length: " . $size);
         }
         $this->readfile_chunked($file_path) or wp_die(__('File not found', 'wp-job-manager-resumes') . ' <a href="' . esc_url(home_url()) . '" class="wc-forward">' . __('Go to homepage', 'wp-job-manager-resumes') . '</a>');
         exit;
     }
 }
<?php

if (($resume_files = get_resume_files()) && apply_filters('resume_manager_user_can_download_resume_file', true, $post->ID)) {
    ?>
	<?php 
    foreach ($resume_files as $key => $resume_file) {
        ?>
		<li class="resume-file resume-file-<?php 
        echo substr(strrchr($resume_file, '.'), 1);
        ?>
">
			<a rel="nofollow" href="<?php 
        echo esc_url(get_resume_file_download_url(null, $key));
        ?>
"><?php 
        echo basename($resume_file);
        ?>
</a>
		</li>
	<?php 
    }
}