function _grabFirstnameInitials in Bibliography Module 5
Same name and namespace in other branches
- 6 biblio.contributors.inc \_grabFirstnameInitials()
- 7 includes/biblio.contributors.inc \_grabFirstnameInitials()
- 7.2 includes/biblio.contributors.inc \_grabFirstnameInitials()
1 call to _grabFirstnameInitials()
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,
);
}