function taxonomy_xml_file in Taxonomy import/export via XML 5
Same name and namespace in other branches
- 5.2 taxonomy_xml.module \taxonomy_xml_file()
- 6.2 taxonomy_xml.module \taxonomy_xml_file()
- 6 taxonomy_xml.module \taxonomy_xml_file()
taxonomy_xml_file
Return a flat file representation of the requested vocab
Default format is the original custom Drupal XML file.
1 string reference to 'taxonomy_xml_file'
- taxonomy_xml_menu in ./
taxonomy_xml.module - Implementation of hook_menu: Define menu links.
File
- ./
taxonomy_xml.module, line 150 - taxonomy_xml.module This module makes it possible to import and export taxonomies as XML documents.
Code
function taxonomy_xml_file($vid, $format = 'xml') {
// Retrieving Vocabulary name
$vocabulary = taxonomy_vocabulary_load($vid);
$vname = strtolower(str_replace(' ', '_', trim($vocabulary->name)));
unset($vocabulary);
switch ($format) {
case 'xml':
require_once 'xml_format.inc';
$file = taxonomy_xml_xml_create($vid);
break;
case 'rdf':
require_once 'rdf_format.inc';
$file = taxonomy_xml_rdf_create($vid);
break;
}
if (!empty($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 5.5') || strpos($_SERVER['HTTP_USER_AGENT'], 'Opera'))) {
header('Content-Type: application/dummy');
}
else {
header('Content-Type: application/octet-stream');
}
if (headers_sent()) {
echo 'Some data has already been output to browser, can\'t send file';
}
header('Content-Length: ' . strlen($file));
header("Content-Disposition: attachment; filename=taxonomy_{$vname}.{$format}");
echo $file;
}