You are here

function _grabFirstnameInitials in Bibliography Module 5

Same name and namespace in other branches
  1. 6 biblio.contributors.inc \_grabFirstnameInitials()
  2. 7 includes/biblio.contributors.inc \_grabFirstnameInitials()
  3. 7.2 includes/biblio.contributors.inc \_grabFirstnameInitials()
1 call to _grabFirstnameInitials()
_parse_author_array in ./biblio.module

File

./biblio.module, line 3340

Code

function _grabFirstnameInitials($remainder) {
  $firstname = $initials = '';
  $array = split(" ", $remainder);
  foreach ($array as $value) {
    if (preg_match("/[a-zA-Z]{2,}/", trim($value))) {
      $firstnameArray[] = trim($value);
    }
    else {
      $initialsArray[] = str_replace(".", " ", trim($value));
    }
  }
  if (isset($initialsArray)) {
    foreach ($initialsArray as $initial) {
      $initials .= ' ' . trim($initial);
    }
  }
  if (isset($firstnameArray)) {
    $firstname = join(" ", $firstnameArray);
  }
  return array(
    $firstname,
    $initials,
  );
}