You are here

function _grabSurname in Bibliography Module 7.2

Same name and namespace in other branches
  1. 5 biblio.module \_grabSurname()
  2. 6 biblio.contributors.inc \_grabSurname()
  3. 7 includes/biblio.contributors.inc \_grabSurname()

Parameters

$input:

Return value

unknown_type

2 calls to _grabSurname()
BiblioContributorUnitTest::testGrabSurname in tests/contributor.test
biblio_parse_author in includes/biblio.contributors.inc

File

includes/biblio.contributors.inc, line 427

Code

function _grabSurname($input) {
  $no_prefix = FALSE;
  $surname = FALSE;
  $prefix = FALSE;
  $surname_array = explode(" ", $input);
  foreach ($surname_array as $value) {
    $first_char = substr($value, 0, 1);
    if (!$no_prefix && ord($first_char) >= 97 && ord($first_char) <= 122) {
      $prefix[] = $value;
    }
    else {
      $surname[] = $value;
      $no_prefix = TRUE;
    }
  }
  if (!empty($surname)) {
    $surname = implode(" ", $surname);
  }
  if (!empty($prefix)) {
    $prefix = implode(" ", $prefix);
  }
  return array(
    $surname,
    $prefix,
  );
}