function PARSECREATORS::grabFirstnameInitials in Bibliography Module 5
Same name and namespace in other branches
- 6.2 modules/bibtexParse/PARSECREATORS.php \PARSECREATORS::grabFirstnameInitials()
- 6 bibtexParse/PARSECREATORS.php \PARSECREATORS::grabFirstnameInitials()
- 7.3 plugins/biblio_style/bibtex/PARSECREATORS.php \PARSECREATORS::grabFirstnameInitials()
- 7 modules/bibtexParse/PARSECREATORS.php \PARSECREATORS::grabFirstnameInitials()
- 7.2 modules/bibtexParse/PARSECREATORS.php \PARSECREATORS::grabFirstnameInitials()
1 call to PARSECREATORS::grabFirstnameInitials()
- PARSECREATORS::parse in bibtexParse/
PARSECREATORS.php
File
- bibtexParse/
PARSECREATORS.php, line 97
Class
Code
function grabFirstnameInitials($remainder) {
$firstname = $initials = '';
$array = split(" ", $remainder);
foreach ($array as $value) {
$firstChar = substr($value, 0, 1);
if (ord($firstChar) >= 97 && ord($firstChar) <= 122) {
$this->prefix[] = $value;
}
else {
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,
);
}