You are here

public function BiblioStyleEndNoteTagged::importData in Bibliography Module 7.3

@inheritdoc

Overrides BiblioStyleEndNote::importData

File

plugins/biblio_style/endnote/BiblioStyleEndNoteTagged.php, line 13
EndNote tagged biblio style.

Class

BiblioStyleEndNoteTagged
@file EndNote tagged biblio style.

Code

public function importData($data, $options = array()) {
  $biblios = array();
  $data = str_replace("\r\n", "\n", $data);
  $data = explode("\n", $data);
  foreach ($data as $row) {
    if (empty($row)) {

      // Empty line.
      continue;
    }
    $tag = substr($row, 0, 2);
    $value = substr($row, 3);
    if ($tag == '%0') {
      $type = strtolower(str_replace(array(
        ' ',
        '-',
      ), '_', $value));
      $biblio = biblio_create($type);
      $wrapper = entity_metadata_wrapper('biblio', $biblio);
      continue;
    }
    $map = $this
      ->getMapping();
    if (empty($map['field'][$tag])) {
      continue;
    }
    $method = $map['field'][$tag]['import_method'];
    $this
      ->{$method}($wrapper, $tag, $value);
  }
  $biblios['success'][] = $biblio;
  return $biblios;
}