You are here

function _biblio_parse_authors in Bibliography Module 6.2

Same name and namespace in other branches
  1. 5 biblio.module \_biblio_parse_authors()

Parses author name into components and populates array of name components.

This parses the old (pre 6.x) format author entry, splits in on the semicolons and adds new elements to the biblio_contributors array.

Parameters

array $biblio_contributors: An array passed in by reference.

string $authors: The author string in pre-Drupal 6 format.

integer $cat: (optional) The type of author (Primary, Secondary, Tertiary, Corporate) as an integer ID. The default is 1 (Primary).

1 call to _biblio_parse_authors()
_biblio_move_authors in ./biblio.install
Moves author data into biblio_contributor* tables.

File

./biblio.install, line 1973
Install, update, and uninstall functions for the biblio module.

Code

function _biblio_parse_authors(&$biblio_contributors, $authors, $cat = 1) {
  $authors = str_ireplace(" and ", "; ", $authors);
  $authors = str_ireplace(" & ", "; ", $authors);
  $author_array = explode(';', $authors);
  $rank = 0;
  foreach ($author_array as $author) {

    // Insert spaces after firstname initials, if neccessary.
    $author = preg_replace("/\\.([^\\s-])/", ". \\1", trim($author));
    $biblio_contributors[$cat][] = array(
      'name' => $author,
      'auth_type' => $cat,
      'rank' => $rank++,
    );
  }
}