You are here

function apachesolr_multilingual_textfile_download in Apache Solr Multilingual 6.2

Same name and namespace in other branches
  1. 6 apachesolr_multilingual_textfile/apachesolr_multilingual_textfile.module \apachesolr_multilingual_textfile_download()
1 string reference to 'apachesolr_multilingual_textfile_download'
apachesolr_multilingual_textfile_menu in apachesolr_multilingual_textfile/apachesolr_multilingual_textfile.module

File

apachesolr_multilingual_textfile/apachesolr_multilingual_textfile.module, line 539

Code

function apachesolr_multilingual_textfile_download($form) {
  if ($node = node_load(array(
    'vid' => $form->vid,
  ))) {
    $s2f = explode('.', $node->filename);
    $filename = $s2f[0] . '_' . $node->language . '.' . $s2f[1];
    $data = apachesolr_multilingual_textfile_isolatin1accent_filter($node->body);
    if (strpos($filename, 'compoundwords') !== FALSE || strpos($filename, 'protwords') !== FALSE) {

      // compoundwords and protwords are used AFTER a lower case filter in schema.xml.
      // because isolatin1accent_filter converted all accent characters we don't need to care about the locale for strtolower
      $data = drupal_strtolower($data);
    }
    drupal_set_header('Content-Type: text/xml; charset=utf-8');
    drupal_set_header("Content-Disposition: attachment; filename=\"{$filename}\"");
    print $data;
    exit;
  }
  drupal_not_found();
}