function taxonomy_csv_line_export in Taxonomy CSV import/export 6.5
Same name and namespace in other branches
- 6.2 export/taxonomy_csv.export.api.inc \taxonomy_csv_line_export()
- 6.3 export/taxonomy_csv.export.api.inc \taxonomy_csv_line_export()
- 6.4 export/taxonomy_csv.export.api.inc \taxonomy_csv_line_export()
- 7.5 export/taxonomy_csv.export.api.inc \taxonomy_csv_line_export()
- 7.4 export/taxonomy_csv.export.api.inc \taxonomy_csv_line_export()
Export a line.
Parameters
$line: Array to be exported to a line.
$options: An associative array of export options:
- 'separator' : string separator (formatted delimiter and enclosure).
- 'enclosure' : item enclosure.
- 'end_of_line': end of line string.
$handle: Handle of the open file where to save line.
$result_message: (Optional) Array of messages.
Return value
Result array: Array of messages.
1 call to taxonomy_csv_line_export()
- _taxonomy_csv_vocabulary_export_process in export/
taxonomy_csv.export.api.inc - Batch process of vocabulary export.
File
- export/
taxonomy_csv.export.api.inc, line 418 - Validate export options and manage export process.
Code
function taxonomy_csv_line_export($line, $options, &$handle, $result = array()) {
// Check if separator, enclosure or line ending exist in line.
$check_line = implode('', $line);
if (strpos($check_line, $options['separator']) !== FALSE || $options['enclosure'] != '' && strpos($check_line, $options['enclosure']) !== FALSE || $options['enclosure'] == '' && strpos($check_line, $options['end_of_line']) !== FALSE) {
$result[] = 313;
// Error delimiter or enclosure.
}
elseif (_taxonomy_csv_worst_message($result) < TAXONOMY_CSV_PROCESS_NOTICE) {
}
else {
// Save line to file.
$line = $options['enclosure'] . implode($options['separator'], $line) . $options['enclosure'] . $options['end_of_line'];
if (fwrite($handle, $line) === FALSE) {
$result[] = 312;
// Unable to write to file.
}
}
return $result;
}