/**
  * @param $attachments
  *
  * @return array
  */
 function new_job_notification_attachments($attachments)
 {
     $found = false;
     $archive = new wpml_zip();
     foreach ($attachments as $index => $attachment) {
         if (in_array($attachment, $this->attachments)) {
             $fh = fopen($attachment, 'r');
             $xliff_file = fread($fh, filesize($attachment));
             fclose($fh);
             $archive->addFile($xliff_file, basename($attachment));
             unset($attachments[$index]);
             $found = true;
         }
     }
     if ($found) {
         // add the zip file to the attachments.
         $archive_data = $archive->getZipData();
         $temp_dir = get_temp_dir();
         $file_name = $temp_dir . $this->_get_zip_name_from_attachments();
         $fh = fopen($file_name, 'w');
         fwrite($fh, $archive_data);
         fclose($fh);
         $attachments[] = $file_name;
     }
     return $attachments;
 }