You are here

function biblio_contributor_initial_parse in Bibliography Module 7.2

1 call to biblio_contributor_initial_parse()
biblio_contributor_create in ./biblio.module
Create a contributor entity object

File

includes/biblio.contributors.inc, line 537

Code

function biblio_contributor_initial_parse($name) {
  module_load_include('php', 'biblio', 'lib/msrc-authortool/autoload');
  spl_autoload_register('adAutoload', true, true);
  $analyzer = new \Analyzer\ContributorNames();
  $analyzer
    ->setOrgWords(biblio_contributor_org_words());
  $author_object = $analyzer
    ->analyze($name);

  // Author tool sometimes returns unknown characters. If that's the case,
  // convert it to UTF-8
  foreach ($author_object as $property => $value) {
    if (!mb_check_encoding($value)) {
      $author_object->{$property} = utf8_encode($value);
    }
  }
  return $author_object;
}