You are here

function _grabSurname in Bibliography Module 6

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

Parameters

$input:

Return value

unknown_type

1 call to _grabSurname()
biblio_parse_author in ./biblio.contributors.inc

File

./biblio.contributors.inc, line 372

Code

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