Use new code style
This commit is contained in:
@ -21,7 +21,6 @@ function wu_generate_csv($file_name, $data = array()) {
|
||||
$fp = fopen('php://output', 'w');
|
||||
|
||||
if ($fp && $data) {
|
||||
|
||||
header('Content-Type: text/csv; charset=utf-8');
|
||||
|
||||
header('Content-Disposition: attachment; filename="' . $file_name . '.csv"');
|
||||
@ -31,19 +30,11 @@ function wu_generate_csv($file_name, $data = array()) {
|
||||
header('Expires: 0');
|
||||
|
||||
foreach ($data as $data_line) {
|
||||
|
||||
if (is_array($data_line)) {
|
||||
|
||||
fputcsv($fp, array_values($data_line));
|
||||
|
||||
} elseif (is_object($data_line)) {
|
||||
|
||||
fputcsv($fp, array_values(get_object_vars($data_line)));
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end foreach;
|
||||
|
||||
} // end if;
|
||||
|
||||
} // end wu_generate_csv;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user