You are here

function PARSECREATORS::grabSurname in Bibliography Module 6

Same name and namespace in other branches
  1. 5 bibtexParse/PARSECREATORS.php \PARSECREATORS::grabSurname()
  2. 6.2 modules/bibtexParse/PARSECREATORS.php \PARSECREATORS::grabSurname()
  3. 7.3 plugins/biblio_style/bibtex/PARSECREATORS.php \PARSECREATORS::grabSurname()
  4. 7 modules/bibtexParse/PARSECREATORS.php \PARSECREATORS::grabSurname()
  5. 7.2 modules/bibtexParse/PARSECREATORS.php \PARSECREATORS::grabSurname()
1 call to PARSECREATORS::grabSurname()
PARSECREATORS::parseAuthor in bibtexParse/PARSECREATORS.php

File

bibtexParse/PARSECREATORS.php, line 294

Class

PARSECREATORS

Code

function grabSurname($input) {
  $surnameArray = split(" ", $input);
  $noPrefix = $surname = FALSE;
  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 ($surname) {
    $surname = join(" ", $surname);
  }
  if (isset($prefix)) {
    $prefix = join(" ", $prefix);
    return array(
      $surname,
      $prefix,
    );
  }
  return array(
    $surname,
    FALSE,
  );
}