22 define(
'IDENTITY_SETTING_GIVENNAME',
'givenName');
23 define(
'IDENTITY_SETTING_FAMILYNAME',
'familyName');
36 $localePrecedence = array($preferredLocale);
40 if (!in_array($site->getPrimaryLocale(), $localePrecedence)) $localePrecedence[] = $site->getPrimaryLocale();
44 foreach ($localePrecedence as $locale) {
45 if (empty($locale))
continue;
46 $value =& $this->
getData($key, $locale);
47 if (!empty($value))
return $value;
52 $data =& $this->
getData($key,
null);
53 foreach ((array) $data as $dataValue) {
54 if (!empty($dataValue))
return $dataValue;
72 function getFullName($preferred =
true, $familyFirst =
false, $defaultLocale =
null) {
76 if (!empty($preferredPublicName))
return $preferredPublicName;
79 if (empty($givenName)) {
80 if (is_null($defaultLocale)) {
84 $defaultLocale = $site->getPrimaryLocale();
86 $locale = $defaultLocale;
91 return ($familyName !=
''?
"$familyName, " :
'') . $givenName;
93 return $givenName . ($familyName !=
''?
" $familyName" :
'');
103 return $this->
getData(IDENTITY_SETTING_GIVENNAME, $locale);
112 $this->
setData(IDENTITY_SETTING_GIVENNAME, $givenName, $locale);
129 return $this->
getData(IDENTITY_SETTING_FAMILYNAME, $locale);
138 $this->
setData(IDENTITY_SETTING_FAMILYNAME, $familyName, $locale);
148 $localePriorityList = array();
150 if (!is_null($defaultLocale)) {
151 $localePriorityList[] = $defaultLocale;
156 foreach ($localePriorityList as $locale) {
158 if (!empty($givenName)) {
164 $locale = $site->getPrimaryLocale();
174 return $this->
getData(
'preferredPublicName', $locale);
183 $this->
setData(
'preferredPublicName', $preferredPublicName, $locale);
192 return $this->
getData(
'affiliation', $locale);
201 $this->
setData(
'affiliation', $affiliation, $locale);
216 return $this->
getData(
'email');
224 $this->
setData(
'email', $email);
232 return $this->
getData(
'orcid');
240 $this->
setData(
'orcid', $orcid);
248 return $this->
getData(
'country');
257 if (!$countryCode)
return null;
258 $isoCodes = new \Sokil\IsoCodes\IsoCodesFactory();
259 $country = $isoCodes->getCountries()->getByAlpha2($countryCode);
260 return $country?$country->getLocalName():
null;
268 $this->
setData(
'country', $country);
301 return $this->
getData(
'biography', $locale);
310 $this->
setData(
'biography', $biography, $locale);