You are here

public function BiblioCrossRefClient::unixref_endElement in Bibliography Module 7

Same name and namespace in other branches
  1. 6.2 modules/crossref/biblio.crossref.client.php \BiblioCrossRefClient::unixref_endElement()
  2. 7.2 modules/crossref/biblio.crossref.client.php \BiblioCrossRefClient::unixref_endElement()

File

modules/crossref/biblio.crossref.client.php, line 236

Class

BiblioCrossRefClient

Code

public function unixref_endElement($parser, $name) {
  switch ($name) {
    case 'doi_record':
      $this->node['biblio_contributors'] += $this->contributors;
      array_walk_recursive($this->node, array(
        $this,
        'unixref_decode',
      ));
      $this->node['biblio_crossref_id'] = $this
        ->getDOI();
      $this->node['biblio_crossref_md5'] = md5(serialize($this->node));

      // biblio_save_node($node, $batch, $session_id, $save_node);.
      $this->nodes[] = $this->node;
      break;
    case 'person_name':
      $this->contributors[$this->contrib_count]['auth_type'] = _biblio_get_auth_type($this->auth_category, $this->node['biblio_type']);
      $this->contributors[$this->contrib_count]['auth_category'] = $this->auth_category;
      $this->contributors[$this->contrib_count]['name'] = $this->contributors[$this->contrib_count]['lastname'];
      if (isset($this->contributors[$this->contrib_count]['firstname'])) {
        $this->contributors[$this->contrib_count]['name'] .= ', ' . $this->contributors[$this->contrib_count]['firstname'];
      }
      $this->auth_category = '';
      $this->contrib_count++;
      break;
    case 'organization':
      $this->contributors[$this->contrib_count]['auth_type'] = _biblio_get_auth_type(5, $this->node['biblio_type']);
      $this->contributors[$this->contrib_count]['auth_category'] = 5;
      $this->contrib_count++;
      break;
    case 'pages':
      if (isset($this->node['biblio_first_page'])) {
        $this->node['biblio_pages'] = $this->node['biblio_first_page'];
      }
      if (isset($this->node['biblio_last_page'])) {
        $this->node['biblio_pages'] .= ' - ' . $this->node['biblio_last_page'];
      }
      break;
    case 'publication_date':
      break;
    case 'journal_issue':
    case 'journal_article':
      if (!isset($this->node['biblio_date']) || empty($this->node['biblio_date'])) {
        $day = !empty($this->node['day']) ? $this->node['day'] : 1;
        $month = !empty($this->node['month']) ? $this->node['month'] : 1;
        $year = !empty($this->node['year']) ? $this->node['year'] : 0;
        if ($year) {
          $this->node['biblio_date'] = date("M-d-Y", mktime(0, 0, 0, $day, $month, $year));
        }
      }
      if ((!isset($this->node['biblio_year']) || empty($this->node['biblio_year'])) && isset($this->node['year'])) {
        $this->node['biblio_year'] = $this->node['year'];
      }
      break;
    case 'conference_paper':
    case 'content_item':
    case 'report-paper_metadata':
    case 'standard_metadata':
    case 'database_date':
    case 'component':
      if ((!isset($this->node['biblio_year']) || empty($this->node['biblio_year'])) && isset($this->node['year'])) {
        $this->node['biblio_year'] = $this->node['year'];
        unset($this->node['year']);
      }

      // $this->node['biblio_doi']  = $this->node['doi'];.
      break;
    case 'issn':
    case 'isbn':
      $this->attribute = '';
      break;

    // HTML font style tags.
    case 'i':
    case 'b':
    case 'u':
    case 'sub':
    case 'sup':
      $this
        ->unixref_characterData(NULL, '</' . $name . '> ');
      break;
    case 'doi_data':
      $this->doi_data = FALSE;
      break;
    case 'citation_list':
      $this->citation_list = FALSE;
      break;
    default:
  }
}