function PARSECREATORS::parse in Bibliography Module 5        
                          
                  
                        Same name and namespace in other branches
- 6.2 modules/bibtexParse/PARSECREATORS.php \PARSECREATORS::parse()
- 6 bibtexParse/PARSECREATORS.php \PARSECREATORS::parse()
- 7.3 plugins/biblio_style/bibtex/PARSECREATORS.php \PARSECREATORS::parse()
- 7 modules/bibtexParse/PARSECREATORS.php \PARSECREATORS::parse()
- 7.2 modules/bibtexParse/PARSECREATORS.php \PARSECREATORS::parse()
File
 
   - bibtexParse/PARSECREATORS.php, line 39
Class
  
  - PARSECREATORS 
Code
function parse($input) {
  $input = trim($input);
  
  $authorArray = preg_split("/\\s(and|&)\\s/i", $input);
  foreach ($authorArray as $value) {
    $appellation = $prefix = $surname = $firstname = $initials = '';
    $this->prefix = array();
    $author = explode(",", preg_replace("/\\s{2,}/", ' ', trim($value)));
    $size = sizeof($author);
    
    if ($size == 1) {
      
      if (preg_match("/(.*){([^\\\\].*)}/", $value, $matches) && !preg_match("/(.*){\\\\.{.*}.*}/", $value, $matches2)) {
        $author = split(" ", $matches[1]);
        $surname = $matches[2];
      }
      else {
        $author = split(" ", $value);
        
        $surname = array_pop($author);
      }
    }
    else {
      if ($size == 2) {
        
        list($surname, $prefix) = $this
          ->grabSurname(array_shift($author));
      }
      else {
        
        $appellation = join(' ', array_splice($author, 1, 1));
        
        list($surname, $prefix) = $this
          ->grabSurname(array_shift($author));
      }
    }
    $remainder = join(" ", $author);
    list($firstname, $initials) = $this
      ->grabFirstnameInitials($remainder);
    if (!empty($this->prefix)) {
      $prefix = join(' ', $this->prefix);
    }
    $surname = $surname . ' ' . $appellation;
    $creators[] = array(
      'firstname' => trim($firstname),
      'initials' => trim($initials),
      'lastname' => trim($surname),
      'prefix' => trim($prefix),
    );
  }
  if (isset($creators)) {
    return $creators;
  }
  return FALSE;
}