function node_export_get_file in Node export 7.3
Same name and namespace in other branches
- 6.3 node_export.pages.inc \node_export_get_file()
- 6.2 node_export.module \node_export_get_file()
Generate text file.
Parameters
$nids: An array of node ids.
$code_string: The text output.
$format: The format used.
2 calls to node_export_get_file()
- node_export_form_submit in ./
node_export.pages.inc - Export form submit function.
- node_export_gui in ./
node_export.pages.inc - Export GUI function.
File
- ./
node_export.pages.inc, line 432 - The Node export pages file.
Code
function node_export_get_file($nids, $code_string, $format = NULL) {
$filename_data = array();
$filename_data['node-count'] = count($nids);
$filename_data['timestamp'] = REQUEST_TIME;
$filename_data['format'] = $format ? $format : 'export';
// Add a list of nids
if (count($nids) <= variable_get('node_export_file_list', 10)) {
$filename_data['nid-list'] = '[' . implode(',', $nids) . ']';
}
$name = variable_get('node_export_filename', 'node-export[node_export_filename:nid-list]([node_export_filename:node-count]-nodes).[node_export_filename:timestamp].[node_export_filename:format]');
$data = array(
'node_export_filename' => (object) $filename_data,
);
$name = token_replace($name, $data);
$formats = node_export_format_handlers();
$format_data = $formats[$format];
$mime = !empty($format_data['#mime']) ? $format_data['#mime'] : 'text/plain';
header('Content-type: ' . $mime);
header('Content-Disposition: attachment; filename="' . $name . '"');
print $code_string;
// Clean exit.
module_invoke_all('exit');
exit;
}