Changeset View
Changeset View
Standalone View
Standalone View
plugins/csv_export/vcard2csv.php
Show First 20 Lines • Show All 152 Lines • ▼ Show 20 Lines | */ | ||||
public function head() | public function head() | ||||
{ | { | ||||
return $this->csv($this->fields); | return $this->csv($this->fields); | ||||
} | } | ||||
/** | /** | ||||
* Send headers of file download | * Send headers of file download | ||||
*/ | */ | ||||
public static function headers() | public static function headers($filename = 'contacts.csv') | ||||
{ | { | ||||
// send downlaod headers | // send downlaod headers | ||||
header('Content-Type: text/csv; charset=' . RCUBE_CHARSET); | header('Content-Type: text/csv; charset=' . RCUBE_CHARSET); | ||||
header('Content-Disposition: attachment; filename="contacts.csv"'); | header('Content-Disposition: attachment; filename="' . $filename . '"'); | ||||
} | } | ||||
protected function csv($fields = array(), $delimiter = ',', $enclosure = '"') | protected function csv($fields = array(), $delimiter = ',', $enclosure = '"') | ||||
{ | { | ||||
$str = ''; | $str = ''; | ||||
$escape_char = "\\"; | $escape_char = "\\"; | ||||
foreach ($fields as $value) { | foreach ($fields as $value) { | ||||
Show All 40 Lines |