Beispiel #1
0
 /**
  * Export bounces
  *
  * @return bool
  * @author Zainoudine soulé
  */
 private static function generate_csv_bounces_campaign($type)
 {
     $upload_dir = wp_upload_dir();
     $file_name = $upload_dir['basedir'] . '/bea-sender-' . $type . '.csv';
     @unlink($file_name);
     $header_titles = Bea_Sender_Export::get_header_titles($type);
     $list = Bea_Sender_Export::export_bounces();
     return self::generate_file($file_name, $header_titles, $list, $type);
 }
Beispiel #2
0
 /**
  * Export bea_s_receivers table in CSV for single campaign
  *
  *
  * @author Salah Khouildi
  */
 private static function generate_csv($campaign_id = 0)
 {
     $list = Bea_Sender_Export::export_campaign($campaign_id);
     header("Pragma: public");
     header("Expires: 0");
     header("Cache-Control: private");
     header("Content-type: text/csv");
     $file_name = "bea-send-" . date('d-m-y') . ".csv";
     if (isset($campaign_id) && (int) $campaign_id > 0) {
         $file_name = "bea-send-" . date('d-m-y') . "-campaign-" . $_GET['c_id'] . ".csv";
     }
     header("Content-Disposition: attachment; filename=" . $file_name);
     header("Accept-Ranges: bytes");
     $outstream = fopen("php://output", 'w');
     //Put header titles
     fputcsv($outstream, array_map('utf8_decode', Bea_Sender_Export::get_header_titles($campaign_id)), ';');
     // Put lines in csv file
     foreach ($list as $fields) {
         fputcsv($outstream, array_map('utf8_decode', $fields), ';');
     }
     fclose($outstream);
     die;
 }
 /**
  * Add the campaign id
  *
  * @param $campaign_id
  *
  * @return mixed|void
  * @author Nicolas Juen
  */
 public static function get_header_titles($campaign_id)
 {
     self::$header_titles = apply_filters('bea_sender_csv_headers', array('Id', 'Email', 'Current status', 'Bounce cat', 'Bounce type', 'Bounce no'), $campaign_id);
     return self::$header_titles;
 }