output() public method

Generate CSV based string for output
public output ( $output = true, $filename = null, $data = [], $fields = [], $delimiter = null ) : CSV
return CSV data using delimiter of choice, or default
 /**
  * Renders the CSV.
  *
  * @return void
  */
 public function process()
 {
     $params = $this->gp;
     $exportParams = Tx_Formhandler_StaticFuncs::getSingle($this->settings, 'exportParams');
     if (!is_array($exportParams)) {
         $exportParams = t3lib_div::trimExplode(',', $exportParams);
     }
     //build data
     foreach ($params as $key => &$value) {
         if (is_array($value)) {
             $value = implode(',', $value);
         }
         if (count($exportParams) > 0 && !in_array($key, $exportParams)) {
             unset($params[$key]);
         }
         $value = str_replace('"', '""', $value);
     }
     // create new parseCSV object.
     $csv = new parseCSV();
     $csv->output('formhandler.csv', $data, $params);
     die;
 }
<?php

# include parseCSV class.
require_once '../parsecsv.lib.php';
# create new parseCSV object.
$csv = new parseCSV();
# Parse '_books.csv' using automatic delimiter detection...
$csv->auto('_books.csv');
# ...or if you know the delimiter, set the delimiter character
# if its not the default comma...
// $csv->delimiter = "\t";   # tab delimited
# ...and then use the parse() function.
// $csv->parse('_books.csv');
# now we have data in $csv->data, at which point we can modify
# it to our hearts content, like removing the last item...
array_pop($csv->data);
# then we output the file to the browser as a downloadable file...
$csv->output('books.csv');
# ...when the first parameter is given and is not null, the
# output method will itself send the correct headers and the
# data to download the output as a CSV file. if it's not set
# or is set to null, output will only return the generated CSV
# output data, and will not output to the browser itself.
 /**
  * Converts data array into CSV outputs it to the browser
  */
 public function ajax_export_csv()
 {
     // Purposely using $_REQUEST here since this method can work via a GET and POST request
     // POST requests are used when passing the data value since it's too big to pass via GET
     if (!is_numeric($_REQUEST['post_id']) || !current_user_can('edit_post', absint($_REQUEST['post_id']))) {
         wp_die('Unauthorized access', 'You do not have permission to do that', array('response' => 401));
     }
     $post = get_post(absint($_REQUEST['post_id']));
     // If the user passed a data value in their request we'll use it after validation
     if (isset($_POST['data']) && isset($_POST['title'])) {
         $data = m_chart()->validate_data(json_decode(stripslashes($_POST['data'])));
         $file_name = sanitize_title($_POST['title']);
     } else {
         $data = m_chart()->get_post_meta($post->ID, 'data');
         $file_name = sanitize_title(get_the_title($post->ID));
     }
     if (empty($data)) {
         return;
     }
     require_once __DIR__ . '/external/parsecsv/parsecsv.lib.php';
     $parse_csv = new parseCSV();
     $parse_csv->output($file_name . '.csv', $data);
     die;
 }
Beispiel #4
0
 /**
  * Create CSV File Export
  * @since 1.4
  * @version 1.0.1
  */
 public function download_export_log()
 {
     if (!isset($_REQUEST['mycred-export']) || $_REQUEST['mycred-export'] != 'do') {
         return;
     }
     // Must be logged in
     if (!is_user_logged_in()) {
         return;
     }
     // Make sure current user can export
     if (!apply_filters('mycred_user_can_export', false) && !$this->core->can_edit_creds()) {
         return;
     }
     // Security for front export
     if (apply_filters('mycred_allow_front_export', false) === true) {
         if (!isset($_REQUEST['token']) || !wp_verify_nonce($_REQUEST['token'], 'mycred-run-log-export')) {
             return;
         }
     } else {
         check_admin_referer('mycred-run-log-export', 'token');
     }
     $type = '';
     $data = array();
     // Sanitize the log query
     foreach ((array) $_POST as $key => $value) {
         if ($key == 'action') {
             continue;
         }
         $_value = sanitize_text_field($value);
         if ($_value != '') {
             $data[$key] = $_value;
         }
     }
     // Get exports
     $exports = mycred_get_log_exports();
     if (empty($exports)) {
         return;
     }
     // Identify the export type by the action button
     foreach ($exports as $id => $info) {
         if ($info['label'] == $_POST['action']) {
             $type = $id;
             break;
         }
     }
     // Act according to type
     switch ($type) {
         case 'all':
             $old_data = $data;
             unset($data);
             $data = array();
             $data['ctype'] = $old_data['ctype'];
             $data['number'] = -1;
             break;
         case 'search':
             $data['number'] = -1;
             break;
         case 'displayed':
         default:
             $data = apply_filters('mycred_export_log_args', $data);
             break;
     }
     // Custom Exports
     if (has_action('mycred_export_' . $type)) {
         do_action('mycred_export_' . $type, $data);
     } else {
         // Query the log
         $log = new myCRED_Query_Log($data, true);
         // If there are entries
         if ($log->have_entries()) {
             $export = array();
             // Loop though results
             foreach ($log->results as $entry) {
                 // Remove the row id
                 unset($entry['id']);
                 // Make sure entry and data does not contain any commas that could brake this
                 $entry['entry'] = str_replace(',', '', $entry['entry']);
                 $entry['data'] = str_replace(',', '.', $entry['data']);
                 // Add to export array
                 $export[] = $entry;
             }
             $log->reset_query();
             // Load parseCSV
             require_once myCRED_ASSETS_DIR . 'libs/parsecsv.lib.php';
             $csv = new parseCSV();
             // Run output and lets create a CSV file
             $date = date_i18n('Y-m-d');
             $csv->output(true, 'mycred-log-' . $date . '.csv', $export, array('ref', 'ref_id', 'user_id', 'creds', 'ctype', 'time', 'entry', 'data'));
             die;
         }
         $log->reset_query();
     }
 }
 /**
  * Function to generate a CSV file from submitted form values. This function is called by Tx_Formhandler_Controller_Backend
  *
  * @param array $records The records to export to CSV
  * @param array $exportParams A list of fields to export. If not set all fields are exported
  * @see Tx_Formhandler_Controller_Backend::generateCSV()
  * @return void
  */
 public function generateModuleCSV($records, $exportParams = array(), $delimiter = ',', $enclosure = '"', $encoding = 'utf-8', $fileName = 'formhandler.csv')
 {
     $data = array();
     $dataSorted = array();
     //build data array
     foreach ($records as $idx => $record) {
         if (!is_array($record['params'])) {
             $record['params'] = array();
         }
         foreach ($record['params'] as $subIdx => &$param) {
             if (is_array($param)) {
                 $param = implode(';', $param);
             }
         }
         if (count($exportParams) == 0 || in_array('pid', $exportParams)) {
             $record['params']['pid'] = $record['pid'];
         }
         if (count($exportParams) == 0 || in_array('submission_date', $exportParams)) {
             $record['params']['submission_date'] = date('d.m.Y H:i:s', $record['crdate']);
         }
         if (count($exportParams) == 0 || in_array('ip', $exportParams)) {
             $record['params']['ip'] = $record['ip'];
         }
         $data[] = $record['params'];
     }
     if (count($exportParams) > 0) {
         foreach ($data as $idx => &$params) {
             // fill missing fields with empty value
             foreach ($exportParams as $key => $exportParam) {
                 if (!array_key_exists($exportParam, $params)) {
                     $params[$exportParam] = '';
                 }
             }
             // remove unwanted fields
             foreach ($params as $key => $value) {
                 if (!in_array($key, $exportParams)) {
                     unset($params[$key]);
                 }
             }
         }
     }
     // sort data
     $dataSorted = array();
     foreach ($data as $idx => $array) {
         $dataSorted[] = $this->sortArrayByArray($array, $exportParams);
     }
     $data = $dataSorted;
     // create new parseCSV object.
     $csv = new parseCSV();
     $csv->delimiter = $csv->output_delimiter = $delimiter;
     $csv->enclosure = $enclosure;
     $csv->input_encoding = strtolower($this->getInputCharset());
     $csv->output_encoding = strtolower($encoding);
     $csv->convert_encoding = FALSE;
     if ($csv->input_encoding !== $csv->output_encoding) {
         $csv->convert_encoding = TRUE;
     }
     $csv->output($fileName, $data, $exportParams);
     die;
 }
 /**
  * Load Export
  * Creates a CSV export file of the 'mycred-export-raw' transient.
  * @since 1.3
  * @version 1.1
  */
 public function load_export()
 {
     // Security
     if ($this->core->can_edit_plugin()) {
         $export = get_transient('mycred-export-raw');
         if ($export === false) {
             return;
         }
         if (isset($export[0]['mycred_log'])) {
             $headers = array('mycred_user', 'mycred_amount', 'mycred_ctype', 'mycred_log');
         } else {
             $headers = array('mycred_user', 'mycred_amount', 'mycred_ctype');
         }
         require_once myCRED_ASSETS_DIR . 'libs/parsecsv.lib.php';
         $csv = new parseCSV();
         delete_transient('mycred-export-raw');
         $csv->output(true, 'mycred-balance-export.csv', $export, $headers);
         die;
     }
 }
 /**
  * Intercept query and generate csv for download
  */
 public function download_csv()
 {
     if (is_admin() && !empty($_POST['prelaunchr_download_csv']) && check_admin_referer(basename(__FILE__), 'prelaunchr-download') && current_user_can('manage_options')) {
         /**
          * parsecsv-for-php library
          */
         require_once PRELAUNCHR_PLUGIN_PATH . '/lib/parsecsv-for-php/parsecsv.lib.php';
         global $wpdb;
         /**
          * Our table name
          */
         $table_name = $wpdb->prefix . "prelaunchr";
         /**
          * Prepare the query
          */
         $query = "SELECT id,email,pid,rmail as referrer, count as referrals, time FROM {$table_name} A\n\t\t\t\t\t\tLEFT JOIN ( SELECT rid ,COUNT(*) as count FROM {$table_name} GROUP BY rid ORDER BY count DESC ) B \n\t\t\t\t\t\tON A.id = B.rid\n\t\t\t\t\t\tLEFT JOIN ( SELECT id as rid,email as rmail FROM {$table_name} ) C \n\t\t\t\t\t\tON A.rid = C.rid";
         $results = $wpdb->get_results($query, ARRAY_A);
         $csv = new parseCSV();
         $csv->output('data.csv', $results, array('id', 'email', 'pid', 'referrer', 'referrals', 'time'), ',');
         exit;
         // all done
     }
 }
Beispiel #8
0
 /**
  * Renders the CSV.
  *
  * @return void
  */
 public function process()
 {
     $params = $this->gp;
     $exportParams = $this->utilityFuncs->getSingle($this->settings, 'exportParams');
     if (!is_array($exportParams) && strpos($exportParams, ',') !== FALSE) {
         $exportParams = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $exportParams);
     }
     //build data
     foreach ($params as $key => &$value) {
         if (is_array($value)) {
             $value = implode(',', $value);
         }
         if (!empty($exportParams) && !in_array($key, $exportParams)) {
             unset($params[$key]);
         }
         $value = str_replace('"', '""', $value);
     }
     // create new parseCSV object.
     $csv = new \parseCSV();
     //parseCSV expects data to be a two dimensional array
     $data = array($params);
     $fields = FALSE;
     if (intval($this->utilityFuncs->getSingle($this->settings, 'addFieldNames')) === 1) {
         $fields = array_keys($params);
         $csv->heading = TRUE;
     }
     if ($this->settings['delimiter']) {
         $csv->delimiter = $csv->output_delimiter = $this->utilityFuncs->getSingle($this->settings, 'delimiter');
     }
     if ($this->settings['enclosure']) {
         $csv->enclosure = $this->utilityFuncs->getSingle($this->settings, 'enclosure');
     }
     $inputEncoding = $this->utilityFuncs->getSingle($this->settings, 'inputEncoding');
     if (strlen(trim($inputEncoding)) === 0) {
         $inputEncoding = 'utf-8';
     }
     $outputEncoding = $this->utilityFuncs->getSingle($this->settings, 'outputEncoding');
     if (strlen(trim($outputEncoding)) === 0) {
         $outputEncoding = 'utf-8';
     }
     $csv->input_encoding = strtolower($inputEncoding);
     $csv->output_encoding = strtolower($outputEncoding);
     $csv->convert_encoding = FALSE;
     if ($csv->input_encoding !== $csv->output_encoding) {
         $csv->convert_encoding = TRUE;
     }
     if (intval($this->settings['returnFileName']) === 1 || intval($this->settings['returnGP']) === 1) {
         $outputPath = $this->utilityFuncs->getDocumentRoot();
         if ($this->settings['customTempOutputPath']) {
             $outputPath .= $this->settings['customTempOutputPath'];
         } else {
             $outputPath .= '/typo3temp/';
         }
         $outputPath = $this->utilityFuncs->sanitizePath($outputPath);
         $filename = $outputPath . $this->settings['filePrefix'] . $this->utilityFuncs->generateHash() . '.csv';
         $csv->save($filename, $data, FALSE, $fields);
         if (intval($this->settings['returnFileName']) === 1) {
             return $filename;
         } else {
             if (!is_array($this->gp['generator-csv-generated-files'])) {
                 $this->gp['generator-csv-generated-files'] = array();
             }
             $this->gp['generator-csv-generated-files'][] = $filename;
             return $this->gp;
         }
     } else {
         $fileName = 'formhandler.csv';
         if ($this->settings['outputFileName']) {
             $fileName = $this->utilityFuncs->getSingle($this->settings, 'outputFileName');
         }
         $csv->output($fileName, $data, $fields);
         die;
     }
 }
Beispiel #9
0
 function exportcsv($rows, $title)
 {
     // require the necessary library
     require_once "parsecsv/parsecsv.lib.php";
     // set filename
     $filename = str_replace(" ", "_", $title) . "_" . date("Y.m.d-H.i") . ".csv";
     // if we have records, comma delimit the fields/columns and carriage return delimit the rows
     if (!empty($rows)) {
         foreach ($rows as $row) {
             //throw away the first line which list the form parameters
             $crumbs = array_shift($row);
             $title = array_shift($row);
             $hds = array_shift($row);
             $hvals = array_values($hds);
             // find key of any links
             foreach ($hvals as $h) {
                 if (stripos($h, "_link")) {
                     list($fld, $lnk) = preg_split("/_/", $h);
                     $ukey[] = array_search($h, $hvals);
                     unset($hds[$h]);
                 }
             }
             // iterate row to build URL. if required
             if (!empty($ukey)) {
                 foreach ($row as $r) {
                     foreach ($ukey as $n => $u) {
                         // dump the URL related fields for display
                         unset($r[$u]);
                     }
                     $arr[] = $r;
                 }
                 $row = $arr;
                 unset($arr);
             }
             $csv = new parseCSV();
             $this->w->out($csv->output($filename, $row, $hds));
             unset($ukey);
         }
         $this->w->sendHeader("Content-type", "application/csv");
         $this->w->sendHeader("Content-Disposition", "attachment; filename=" . $filename);
         $this->w->setLayout(null);
     }
 }
 function export($text = false)
 {
     // get the conditions
     $conditions = $this->_getConditions();
     $modelName = $this->modelName;
     $callbacks = false;
     $fields = array_keys($this->settings['fields']);
     #$recursive = -1;
     $order = null;
     if (!empty($this->controller->passedArgs['sort'])) {
         $order = array($this->controller->passedArgs['sort'] => $this->controller->passedArgs['direction']);
     }
     $rows = $this->controller->{$modelName}->find('all', compact('conditions', 'order', 'callbacks', 'fields', 'recursive'));
     foreach ($rows as &$row) {
         $newRow = array();
         foreach ($row as $model => $values) {
             foreach ($values as $field => $value) {
                 $newRow[$model . '.' . $field] = $this->csvCell($value);
             }
         }
         $row = $newRow;
     }
     App::import('Vendor', 'Advindex.parseCSV', array('file' => 'parsecsv-0.3.2' . DS . 'parsecsv.lib.php'));
     $csv = new parseCSV();
     $return = $csv->output(!$text, $this->controller->name . '.csv', $rows, $this->settings['fields']);
     if ($text) {
         header('Content-type: text/plain');
         echo $return;
     } else {
         Configure::write('debug', 0);
         // get rid of sql log at the end
     }
     exit;
 }
Beispiel #11
0
function gigpress_export()
{
    check_admin_referer('gigpress-action');
    global $wpdb;
    require_once WP_PLUGIN_DIR . '/gigpress/lib/parsecsv.lib.php';
    $further_where = '';
    switch ($_POST['scope']) {
        case 'upcoming':
            $further_where = " AND show_expire >= '" . GIGPRESS_NOW . "'";
            break;
        case 'past':
            $further_where = " AND show_expire < '" . GIGPRESS_NOW . "'";
            break;
    }
    if (isset($_POST['artist_id']) && $_POST['artist_id'] != '-1') {
        $further_where .= ' AND s.show_artist_id = ' . $wpdb->prepare('%d', $_POST['artist_id']) . ' ';
    }
    if (isset($_POST['tour_id']) && $_POST['tour_id'] != '-1') {
        $further_where .= ' AND s.show_tour_id = ' . $wpdb->prepare('%d', $_POST['tour_id']) . ' ';
    }
    $name = 'gigpress-export-' . date('Y-m-d') . '.csv';
    $fields = array("Date", "Time", "End date", "Artist", "Venue", "Address", "City", "Country", "Venue phone", "Venue URL", "Admittance", "Price", "Ticket URL", "Ticket phone", "Notes", "Tour", "Status", "Related ID", "Related URL");
    $shows = $wpdb->get_results("\n\t\tSELECT show_date, show_time, show_expire, artist_name, venue_name, venue_address, venue_city, venue_country, venue_phone, venue_url, show_ages, show_price, show_tix_url, show_tix_phone, show_notes, tour_name, show_status, show_related FROM " . GIGPRESS_VENUES . " as v, " . GIGPRESS_ARTISTS . " as a, " . GIGPRESS_SHOWS . " as s LEFT JOIN " . GIGPRESS_TOURS . " as t ON s.show_tour_id = t.tour_id WHERE show_status != 'deleted' AND s.show_artist_id = a.artist_id AND s.show_venue_id = v.venue_id" . $further_where . " ORDER BY show_date DESC,show_time DESC\n\t\t", ARRAY_A);
    if ($shows) {
        $export_shows = array();
        foreach ($shows as $show) {
            $show['show_time'] = $show['show_time'][7] == 1 ? '' : $show['show_time'];
            $show['show_expire'] = $show['show_date'] == $show['show_expire'] ? '' : $show['show_expire'];
            $show['show_related_url'] = $show['show_related'] ? gigpress_related_link($show['show_related'], 'url') : '';
            $export_shows[] = $show;
        }
        $export = new parseCSV();
        $export->output($name, stripslashes_deep($export_shows), $fields, ',');
    } else {
        echo '<p>' . __('Nothing to export.', 'gigpress') . '</p>';
    }
}
 /**
  * Function to generate a CSV file from submitted form values. This function is called by Tx_Formhandler_Controller_Backend
  *
  * @param array $records The records to export to CSV
  * @param array $exportParams A list of fields to export. If not set all fields are exported
  * @see Tx_Formhandler_Controller_Backend::generateCSV()
  * @return void
  */
 public function generateModuleCSV($records, $exportParams = array())
 {
     $data = array();
     $dataSorted = array();
     //build data array
     foreach ($records as $idx => $record) {
         if (!is_array($record['params'])) {
             $record['params'] = array();
         }
         foreach ($record['params'] as $subIdx => &$param) {
             if (is_array($param)) {
                 $param = implode(';', $param);
             }
         }
         $data[] = $record['params'];
     }
     if (count($exportParams) > 0) {
         foreach ($data as $idx => &$params) {
             // fill missing fields with empty value
             foreach ($exportParams as $key => $param) {
                 if (!array_key_exists($param, $params)) {
                     $params[$param] = '';
                 }
             }
             // remove unwanted fields
             foreach ($params as $key => $value) {
                 if (!in_array($key, $exportParams)) {
                     unset($params[$key]);
                 }
             }
         }
     }
     // sort data
     $dataSorted = array();
     foreach ($data as $idx => $array) {
         $dataSorted[] = $this->sortArrayByArray($array, $exportParams);
     }
     $data = $dataSorted;
     // create new parseCSV object.
     $csv = new parseCSV();
     $csv->output('formhandler.csv', $data, $exportParams);
     die;
 }
Beispiel #13
0
     }
     retornaJSON($m->alteraNomeColunaDB($codigo_estat_conexao, $_GET["nome_esquema"], $_GET["nome_tabela"], $_GET["nome_coluna"], $_GET["novonome_coluna"]));
     exit;
     break;
 case "OBTEMDADOSTABELADB":
     $m = new Metaestat();
     if ($_GET["formato"] == "json") {
         retornaJSON($m->obtemDadosTabelaDB($codigo_estat_conexao, $_GET["nome_esquema"], $_GET["nome_tabela"], $_GET["geo"], $_GET["nreg"]));
     }
     if ($_GET["formato"] == "csv") {
         $dados = $m->obtemDadosTabelaDB($codigo_estat_conexao, $_GET["nome_esquema"], $_GET["nome_tabela"], $_GET["geo"], $_GET["nreg"]);
         require_once dirname(__FILE__) . "/../../pacotes/parsecsv/parsecsv.lib.php";
         $csv = new parseCSV();
         //$csv->encoding('UTF-16', 'UTF-8');
         $csv->titles = $dados["nomescolunas"];
         $csv->output(true, 'mvar' . $_GET["nome_tabela"] . '_' . date('dmY') . '.csv', $dados["linhas"]);
     }
     exit;
     break;
     /*
     Valor: DESCREVECOLUNASTABELA
     
     Lista as colunas de uma tabela
     
     Parametros:
     
     formato
     
     codigo_estat_conexao
     
     nome_esquema
Beispiel #14
0
 function zoo_export_classifieds_as_csv($args)
 {
     extract($args);
     global $wpdb;
     $query = '';
     $query_select = "`ID` as `post_id`";
     $post_values = array('post_author', 'post_date', 'post_title', 'post_content');
     foreach ($post_values as $value) {
         $query_select .= ', `' . $value . '`';
     }
     $query .= "SELECT {$query_select} ";
     $query .= "FROM {$wpdb->posts} WHERE `post_status` = 'publish' AND `post_type` = 'classified-ad' ";
     if ($from) {
         $from = date('Y-m-d 00:00:00', strtotime($from));
         $query .= "AND `post_date` >= '{$from}' ";
     }
     if ($to) {
         $to = date('Y-m-d 24:59:59', strtotime($to));
         $query .= "AND `post_date` <= '{$to}' ";
     }
     if ($sort) {
         $query .= "ORDER BY `post_date` {$sort} ";
     }
     if ($number_of_posts) {
         $query .= "LIMIT {$number_of_posts} ";
     }
     if ($number_of_posts && $offset) {
         $query .= "OFFSET {$offset}";
     }
     $results = $wpdb->get_results($query);
     $locale = 'classified-ads';
     $classified_posts = array();
     if (!$results) {
         wp_die('No classified found!', $locale);
     } else {
         foreach ($results as $key => $post) {
             $categories = get_the_terms($post->post_id, 'classified-category');
             $categories_as_string = '';
             if ($categories) {
                 $increment = 0;
                 $count_categories = count($categories);
                 foreach ($categories as $category) {
                     $increment++;
                     if ($increment < $count_categories) {
                         $categories_as_string .= $category->name . ', ';
                     } else {
                         $categories_as_string .= $category->name;
                     }
                 }
             }
             $custom_fields = get_post_custom($post->post_id);
             $meta_names = zoo_get_classified_post_meta_names();
             $classified_meta_values = array();
             $agents = '';
             $galleries = '';
             if ($custom_fields) {
                 foreach ($meta_names as $meta_name) {
                     if (key_exists($meta_name, $custom_fields)) {
                         if ($meta_name === '_zoo_classified_classified_agents') {
                             $classified_agents = maybe_unserialize($custom_fields[$meta_name][0]);
                             foreach ($classified_agents as $agent_info) {
                                 foreach ($agent_info as $key => $value) {
                                     $agents .= ucfirst($key) . ': ' . $value . "\r\n";
                                 }
                             }
                             $classified_meta_values[$meta_name] = $agents;
                         } elseif ($meta_name === '_zoo_classified_gallery_images') {
                             $classified_galleries = maybe_unserialize($custom_fields[$meta_name][0]);
                             $count_classified_galleries = count($classified_galleries);
                             $increment = 0;
                             foreach ($classified_galleries as $gallery) {
                                 $increment++;
                                 if ($increment < $count_classified_galleries) {
                                     $galleries .= $gallery . "\r\n";
                                 } else {
                                     $galleries .= $gallery;
                                 }
                             }
                             $classified_meta_values[$meta_name] = $galleries;
                         } elseif ($meta_name === '_zoo_classified_owner') {
                             $classified_meta_values[$meta_name] = get_the_author_meta('display_name', $custom_fields[$meta_name][0]);
                         } else {
                             $classified_meta_values[$meta_name] = $custom_fields[$meta_name][0];
                         }
                     } else {
                         $classified_meta_values[$meta_name] = '';
                     }
                 }
             }
             $classified_posts[] = array($post->post_id, $classified_meta_values['_zoo_classified_unique_id'], $post->post_date, $post->post_title, $post->post_content, $categories_as_string, $classified_meta_values['_zoo_classified_price'], $classified_meta_values['_zoo_classified_price_view'], $classified_meta_values['_zoo_classified_address'], $classified_meta_values['_zoo_classified_classified_agents'], $classified_meta_values['_zoo_classified_gallery_images'], $classified_meta_values['_zoo_classified_featured'], $classified_meta_values['_zoo_classified_owner']);
             $header = array('Post ID', 'Classified ID', 'Post Date', 'Title', 'Content', 'Category', 'Classified Price', 'Classified Price View', 'Classified Address', 'Classified Agents', 'Classified Galleries', 'Classified Featured', 'Classified Owner');
         }
         $file_name = 'export-classifieds-' . date_i18n("Y-m-d_H-i-s") . '.csv';
         $csv = new parseCSV();
         $csv->output($file_name, $classified_posts, $header, ',');
         die;
     }
 }