17 import(
'lib.pkp.classes.plugins.GenericPlugin');
19 define(
'ORCID_URL',
'https://orcid.org/');
20 define(
'ORCID_URL_SANDBOX',
'https://sandbox.orcid.org/');
21 define(
'ORCID_API_URL_PUBLIC',
'https://pub.orcid.org/');
22 define(
'ORCID_API_URL_PUBLIC_SANDBOX',
'https://pub.sandbox.orcid.org/');
23 define(
'ORCID_API_URL_MEMBER',
'https://api.orcid.org/');
24 define(
'ORCID_API_URL_MEMBER_SANDBOX',
'https://api.sandbox.orcid.org/');
25 define(
'ORCID_API_VERSION_URL',
'v2.1/');
26 define(
'ORCID_API_SCOPE_PUBLIC',
'/authenticate');
27 define(
'ORCID_API_SCOPE_MEMBER',
'/activities/update');
29 define(
'OAUTH_TOKEN_URL',
'oauth/token');
30 define(
'ORCID_EMPLOYMENTS_URL',
'employments');
31 define(
'ORCID_PROFILE_URL',
'person');
32 define(
'ORCID_EMAIL_URL',
'email');
33 define(
'ORCID_WORK_URL',
'work');
39 private $submissionIdToBePublished;
40 private $currentContextId;
45 function register($category, $path, $mainContextId =
null) {
46 $success = parent::register($category, $path, $mainContextId);
47 if (!
Config::getVar(
'general',
'installed') || defined(
'RUNNING_UPGRADE'))
return true;
48 if ($success && $this->
getEnabled($mainContextId)) {
58 HookRegistry::register(
'User::PublicProfile::AdditionalItems', array($this,
'handleUserPublicProfileDisplay'));
70 HookRegistry::register(
'submissionsubmitstep3form::execute', array($this,
'handleSubmissionSubmitStep3FormExecute'));
78 if ($this->
getSetting($contextId,
'sendMailToAuthorsOnPublication')) {
88 $schema->properties->orcidSandbox = (object)[
91 'validation' => [
'nullable']
93 $schema->properties->orcidAccessToken = (object)[
96 'validation' => [
'nullable']
98 $schema->properties->orcidAccessScope = (object)[
100 'apiSummary' =>
true,
101 'validation' => [
'nullable']
103 $schema->properties->orcidRefreshToken = (object)[
105 'apiSummary' =>
true,
106 'validation' => [
'nullable']
108 $schema->properties->orcidAccessExpiresOn = (object)[
110 'apiSummary' =>
true,
111 'validation' => [
'nullable']
113 $schema->properties->orcidAccessDenied = (object)[
115 'apiSummary' =>
true,
116 'validation' => [
'nullable']
118 $schema->properties->orcidEmailToken = (object)[
120 'apiSummary' =>
true,
121 'validation' => [
'nullable']
123 $schema->properties->orcidWorkPutCode = (object)[
125 'apiSummary' =>
true,
126 'validation' => [
'nullable']
139 return $this->
getPluginPath() . DIRECTORY_SEPARATOR .
'pages';
149 if ($this->
getEnabled() && $page ==
'orcidapi') {
150 $this->
import(
'pages/OrcidHandler');
151 define(
'HANDLER_CLASS',
'OrcidHandler');
167 case 'orcidProfileAPIPath':
170 case 'orcidClientId':
173 case 'orcidClientSecret':
177 return parent::getSetting($contextId, $name);
180 return $config_value ?: parent::getSetting($contextId, $name);
191 return isset($apiUrl) && trim($apiUrl) && isset($clientId) && trim($clientId) &&
192 isset($clientSecret) && trim($clientSecret);
210 case 'authorform::display':
211 $authorForm =& $args[0];
212 $author = $authorForm->getAuthor();
214 $authenticated = !empty($author->getData(
'orcidAccessToken'));
215 $templateMgr->assign(
217 'orcidAccessToken' => $author->getData(
'orcidAccessToken'),
218 'orcidAccessScope' => $author->getData(
'orcidAccessScope'),
219 'orcidAccessExpiresOn' => $author->getData(
'orcidAccessExpiresOn'),
220 'orcidAccessDenied' => $author->getData(
'orcidAccessDenied'),
221 'orcidAuthenticated' => $authenticated
226 $templateMgr->registerFilter(
"output", array($this,
'authorFormFilter'));
242 $templateMgr =& $args[0];
243 $template =& $args[1];
247 $templateMgr->addStyleSheet(
249 $request->getBaseUrl() .
'/' . $this->getStyleSheet(),
251 'contexts' => array(
'frontend',
'backend')
256 case 'frontend/pages/userRegister.tpl':
257 $templateMgr->registerFilter(
"output", array($this,
'registrationFilter'));
259 case 'frontend/pages/article.tpl':
260 case 'frontend/pages/preprint.tpl':
261 $script =
'var orcidIconSvg = ' . json_encode($this->
getIcon()) .
';';
263 $publication = $templateMgr->getTemplateVars(
'publication');
265 $authors = $publication->getData(
'authors');
267 foreach ($authors as $author) {
268 if (!empty($author->getOrcid()) && !empty($author->getData(
'orcidAccessToken'))) {
269 $script .=
'$("a[href=\"' . $author->getOrcid() .
'\"]").prepend(orcidIconSvg);';
273 $templateMgr->addJavaScript(
'orcidIconDisplay', $script, [
'inline' =>
true]);
297 $contextId = ($context ==
null) ? 0 : $context->getId();
299 $apiPath = $this->
getSetting($contextId,
'orcidProfileAPIPath');
300 if ($apiPath == ORCID_API_URL_PUBLIC || $apiPath == ORCID_API_URL_MEMBER) {
303 return ORCID_URL_SANDBOX;
317 assert($context !=
null);
318 $contextId = $context->getId();
321 $scope = ORCID_API_SCOPE_MEMBER;
323 $scope = ORCID_API_SCOPE_PUBLIC;
327 $redirectUrl =
$request->getDispatcher()->url(
$request, ROUTE_PAGE,
null,
'orcidapi',
328 $handlerMethod,
null, $redirectParams);
330 return $this->
getOauthPath() .
'authorize?' . http_build_query(
332 'client_id' => $this->
getSetting($contextId,
'orcidClientId'),
333 'response_type' =>
'code',
335 'redirect_uri' => $redirectUrl)
347 if (preg_match(
'/<form[^>]+id="register"[^>]+>/', $output, $matches, PREG_OFFSET_CAPTURE)) {
348 $match = $matches[0][0];
349 $offset = $matches[0][1];
352 $contextId = ($context ==
null) ? 0 : $context->getId();
353 $targetOp =
'register';
354 $templateMgr->assign(array(
355 'targetOp' => $targetOp,
357 'orcidOAuthUrl' => $this->
buildOAuthUrl(
'orcidAuthorize', array(
'targetOp' => $targetOp)),
358 'orcidIcon' => $this->
getIcon(),
361 $newOutput = substr($output, 0, $offset + strlen($match));
363 $newOutput .= substr($output, $offset + strlen($match));
364 $output = $newOutput;
365 $templateMgr->unregisterFilter(
'output', array($this,
'registrationFilter'));
380 $templateMgr =& $params[1];
381 $output =& $params[2];
385 $contextId = ($context ==
null) ? 0 : $context->getId();
386 $targetOp =
'profile';
387 $templateMgr->assign(
389 'targetOp' => $targetOp,
391 'orcidOAuthUrl' => $this->
buildOAuthUrl(
'orcidAuthorize', array(
'targetOp' => $targetOp)),
392 'orcidClientId' => $this->
getSetting($contextId,
'orcidClientId'),
393 'orcidIcon' => $this->
getIcon(),
394 'orcidAuthenticated' => !empty($user->getData(
'orcidAccessToken')),
410 if (preg_match(
'/<input[^>]+name="submissionId"[^>]*>/', $output, $matches, PREG_OFFSET_CAPTURE)) {
411 $match = $matches[0][0];
412 $offset = $matches[0][1];
413 $templateMgr->assign(
'orcidIcon', $this->
getIcon());
414 $newOutput = substr($output, 0, $offset + strlen($match));
416 $newOutput .= substr($output, $offset + strlen($match));
417 $output = $newOutput;
418 $templateMgr->unregisterFilter(
'output', array($this,
'authorFormFilter'));
433 $form->readUserVars(array(
'requestOrcidAuthorization',
'deleteOrcid'));
435 $requestAuthorization = $form->getData(
'requestOrcidAuthorization');
436 $deleteOrcid = $form->getData(
'deleteOrcid');
437 $author = $form->getAuthor();
439 if ($author && $requestAuthorization) {
443 if ($author && $deleteOrcid) {
444 $author->setOrcid(
null);
460 $form->readUserVars(array(
'orcid'));
461 $user->setOrcid($form->getData(
'orcid'));
477 $publication = $publicationDao->getById($form->submission->getData(
'currentPublicationId'));
478 $authors = $publication->getData(
'authors');
484 if ($authors[0]->getOrcid() === $user->getOrcid()) {
488 $authors[0]->setData(
'orcidAccessToken', $user->getData(
'orcidAccessToken'));
489 $authors[0]->setData(
'orcidAccessScope', $user->getData(
'orcidAccessScope'));
490 $authors[0]->setData(
'orcidRefreshToken', $user->getData(
'orcidRefreshToken'));
491 $authors[0]->setData(
'orcidAccessExpiresOn', $user->getData(
'orcidAccessExpiresOn'));
492 $authors[0]->setData(
'orcidSandbox', $user->getData(
'orcidSandbox'));
496 $authorDao->updateObject($authors[0]);
512 $fields =& $params[1];
513 $fields[] =
'orcidSandbox';
514 $fields[] =
'orcidAccessToken';
515 $fields[] =
'orcidAccessScope';
516 $fields[] =
'orcidRefreshToken';
517 $fields[] =
'orcidAccessExpiresOn';
518 $fields[] =
'orcidAccessDenied';
527 return __(
'plugins.generic.orcidProfile.displayName');
534 return __(
'plugins.generic.orcidProfile.description');
549 if (is_array($params[
'path'])) {
550 $params[
'path'] = array_merge($path, $params[
'path']);
551 } elseif (!empty($params[
'path'])) {
552 $params[
'path'] = array_merge($path, array($params[
'path']));
554 $params[
'path'] = $path;
557 if (!empty($params[
'id'])) {
558 $params[
'path'] = array_merge($params[
'path'], array($params[
'id']));
559 unset($params[
'id']);
561 return $smarty->smartyUrl($params, $smarty);
569 import(
'lib.pkp.classes.linkAction.request.AjaxModal');
582 'verb' =>
'settings',
584 'category' =>
'generic'
589 __(
'manager.plugins.settings'),
593 parent::getActions(
$request, $actionArgs)
601 switch (
$request->getUserVar(
'verb')) {
604 $contextId = ($context ==
null) ? 0 : $context->getId();
607 $templateMgr->registerPlugin(
'function',
'plugin_url', array($this,
'smartyPluginUrl'));
609 ORCID_API_URL_PUBLIC =>
'plugins.generic.orcidProfile.manager.settings.orcidProfileAPIPath.public',
610 ORCID_API_URL_PUBLIC_SANDBOX =>
'plugins.generic.orcidProfile.manager.settings.orcidProfileAPIPath.publicSandbox',
611 ORCID_API_URL_MEMBER =>
'plugins.generic.orcidProfile.manager.settings.orcidProfileAPIPath.member',
612 ORCID_API_URL_MEMBER_SANDBOX =>
'plugins.generic.orcidProfile.manager.settings.orcidProfileAPIPath.memberSandbox'
614 $templateMgr->assign(
'orcidApiUrls', $apiOptions);
615 $templateMgr->assign(
'logLevelOptions', [
616 'ERROR' =>
'plugins.generic.orcidProfile.manager.settings.logLevel.error',
617 'ALL' =>
'plugins.generic.orcidProfile.manager.settings.logLevel.all'
619 $this->
import(
'OrcidProfileSettingsForm');
622 $form->readInputData();
623 if ($form->validate()) {
632 return parent::manage($args,
$request);
651 return file_exists($path) ? file_get_contents($path) :
'';
663 import(
'lib.pkp.classes.mail.MailTemplate');
664 return new MailTemplate($emailKey,
null, $context,
false);
679 assert($context !=
null);
681 $contextId = $context->getId();
684 $mailTemplate =
'ORCID_REQUEST_AUTHOR_AUTHORIZATION';
686 $mailTemplate =
'ORCID_COLLECT_AUTHOR_ID';
690 $emailToken = md5(microtime() . $author->getEmail());
692 $author->setData(
'orcidEmailToken', $emailToken);
696 $publication = $publicationDao->getById($author->getData(
'publicationId'));
698 $oauthUrl = $this->
buildOAuthUrl(
'orcidVerify', array(
'token' => $emailToken,
'publicationId' => $publication->getId()));
699 $aboutUrl =
$request->getDispatcher()->url(
$request, ROUTE_PAGE,
null,
'orcidapi',
'about',
null);
702 $mail->setFrom($context->getData(
'contactEmail'), $context->getData(
'contactName'));
705 $mail->setRecipients(array(array(
'name' => $author->getFullName(),
'email' => $author->getEmail())));
708 $mail->sendWithParams(array(
709 'orcidAboutUrl' => $aboutUrl,
710 'authorOrcidUrl' => $oauthUrl,
711 'authorName' => $author->getFullName(),
712 'articleTitle' => $publication->getLocalizedTitle(),
713 'submissionTitle' => $publication->getLocalizedTitle(),
718 $authorDao->updateObject($author);
733 $newPublication =& $args[0];
735 $publication =& $args[1];
737 $submission =& $args[2];
742 switch ($newPublication->getData(
'status')) {
743 case STATUS_PUBLISHED:
744 case STATUS_SCHEDULED:
759 $submission = $args[0];
761 $decision = $args[1];
763 if ($decision[
'decision'] == SUBMISSION_EDITOR_DECISION_ACCEPT) {
764 $publication = $submission->getCurrentPublication();
766 if (isset($publication)) {
770 $authors = $authorDao->getByPublicationId($submission->getCurrentPublication()->getId());
772 foreach ($authors as $author) {
773 $orcidAccessExpiresOn = Carbon\Carbon::parse($author->getData(
'orcidAccessExpiresOn'));
774 if ($author->getData(
'orcidAccessToken') ==
null || $orcidAccessExpiresOn->isPast()) {
797 $contextId = $this->currentContextId = $context->getId();
798 $publicationId = $publication->getId();
799 $submissionId = $publication->getData(
'submissionId');
806 $issueId = $publication->getData(
'issueId');
807 if (isset($issueId)) {
813 $authors = $authorDao->getByPublicationId($publicationId);
816 $authorsWithOrcid = [];
817 foreach ($authors as $author) {
818 if ($author->getOrcid() && $author->getData(
'orcidAccessToken')) {
819 $orcidAccessExpiresOn = Carbon\Carbon::parse($author->getData(
'orcidAccessExpiresOn'));
820 if ($orcidAccessExpiresOn->isFuture()) {
821 # Extract only the ORCID from the stored ORCID uri
822 $orcid = basename(parse_url($author->getOrcid(), PHP_URL_PATH));
823 $authorsWithOrcid[$orcid] = $author;
825 $this->
logError(
"Token expired on $orcidAccessExpiresOn for author " . $author->getId() .
", deleting orcidAccessToken!");
831 if (empty($authorsWithOrcid)) {
832 $this->
logInfo(
'No contributor with ORICD id or valid access token for submission ' . $submissionId);
837 $this::logInfo(
"Request body (without put-code): " . json_encode($orcidWork));
839 $requestsSuccess = [];
840 foreach ($authorsWithOrcid as $orcid => $author) {
841 $url = $this->
getSetting($contextId,
'orcidProfileAPIPath') . ORCID_API_VERSION_URL . $orcid .
'/' . ORCID_WORK_URL;
844 if ($putCode = $author->getData(
'orcidWorkPutCode')) {
846 $url .=
'/' . $putCode;
848 $orcidWork[
'put-code'] = $putCode;
851 unset($orcidWork[
'put-code']);
854 $orcidWorkJson = json_encode($orcidWork);
857 'Content-Type: application/vnd.orcid+json',
858 'Content-Length: ' . strlen($orcidWorkJson),
859 'Accept: application/json',
860 'Authorization: Bearer ' . $author->getData(
'orcidAccessToken')
863 $this->
logInfo(
"$method $url");
864 $this->
logInfo(
"Header: " . var_export($header,
true));
866 $ch = curl_init($url);
867 curl_setopt_array($ch, [
868 CURLOPT_CUSTOMREQUEST => $method,
869 CURLOPT_POSTFIELDS => $orcidWorkJson,
870 CURLOPT_RETURNTRANSFER =>
true,
871 CURLOPT_HTTPHEADER => $header
875 curl_setopt($ch, CURLOPT_PROXY, $httpProxyHost);
876 curl_setopt($ch, CURLOPT_PROXYPORT,
Config::getVar(
'proxy',
'http_port',
'80'));
878 curl_setopt($ch, CURLOPT_PROXYUSERPWD, $username .
':' .
Config::getVar(
'proxy',
'password'));
882 $responseHeaders = [];
887 curl_setopt($ch, CURLOPT_HEADERFUNCTION,
888 function ($curl, $header) use (&$responseHeaders) {
889 $len = strlen($header);
890 $header = explode(
':', $header, 2);
891 if (count($header) < 2) {
896 $name = strtolower(trim($header[0]));
897 if (!array_key_exists($name, $responseHeaders)) {
898 $responseHeaders[$name] = [trim($header[1])];
900 $responseHeaders[$name][] = trim($header[1]);
907 $result = curl_exec($ch);
909 if (curl_error($ch)) {
910 $this->
logError(
'Unable to post to ORCID API, curl error: ' . curl_error($ch));
915 $httpstatus = curl_getinfo($ch, CURLINFO_HTTP_CODE);
918 $this->
logInfo(
"Response status: $httpstatus");
920 switch ($httpstatus) {
923 $this->
logInfo(
"Work updated in profile, putCode: $putCode");
924 $requestsSuccess[$orcid] =
true;
927 $location = $responseHeaders[
'location'][0];
929 $putCode = intval(basename(parse_url($location, PHP_URL_PATH)));
930 $this->
logInfo(
"Work added to profile, putCode: $putCode");
931 $author->setData(
'orcidWorkPutCode', $putCode);
932 $authorDao->updateObject($author);
933 $requestsSuccess[$orcid] =
true;
937 $error = json_decode($result);
938 if ($error->error ===
'invalid_token') {
939 $this->
logError(
"$error->error_description, deleting orcidAccessToken from author");
942 $requestsSuccess[$orcid] =
false;
946 if ($method ===
'PUT') {
947 $this->
logError(
"Work deleted from ORCID record, deleting putCode form author");
948 $author->setData(
'orcidWorkPutCode',
null);
949 $authorDao->updateObject($author);
950 $requestsSuccess[$orcid] =
false;
952 $this->
logError(
"Unexpected status $httpstatus response, body: $result");
953 $requestsSuccess[$orcid] =
false;
957 $this->
logError(
'Work already added to profile, response body: ' . $result);
958 $requestsSuccess[$orcid] =
false;
961 $this->
logError(
"Unexpected status $httpstatus response, body: $result");
962 $requestsSuccess[$orcid] =
false;
965 if (array_product($requestsSuccess)) {
968 return $requestsSuccess;
986 $submission =
Services::get(
'submission')->get($publication->getData(
'submissionId'));
991 $bibtexCitation = trim(strip_tags($citationPlugin->getCitation(
$request, $submission,
'bibtex', $issue, $publication)));
993 $publicationLocale = ($publication->getData(
'locale')) ? $publication->getData(
'locale') :
'en_US';
994 $supportedSubmissionLocales = $context->getSupportedSubmissionLocales();
996 $publicationUrl =
$request->getDispatcher()->url(
$request, ROUTE_PAGE,
null,
'article',
'view', $submission->getId());
1001 'value' => $publication->getLocalizedData(
'title', $publicationLocale) ??
''
1004 'value' => $publication->getLocalizedData(
'subtitle', $publicationLocale) ??
''
1007 'journal-title' => [
1008 'value' => $context->getName($publicationLocale) ??
''
1010 'short-description' => trim(strip_tags($publication->getLocalizedData(
'abstract', $publicationLocale))) ??
'',
1011 'type' =>
'JOURNAL_ARTICLE',
1013 'external-id' => $this->buildOrcidExternalIds($submission, $publication, $context, $issue, $publicationUrl)
1015 'publication-date' => $this->buildOrcidPublicationDate($publication, $issue),
1016 'url' => $publicationUrl,
1018 'citation-type' =>
'BIBTEX',
1019 'citation-value' => $bibtexCitation
1021 'language-code' => substr($publicationLocale, 0, 2),
1023 'contributor' => $this->buildOrcidContributors($authors, $context, $publication)
1026 $translatedTitleAvailable =
false;
1027 foreach ($supportedSubmissionLocales as $defaultLanguage) {
1028 if ($defaultLanguage !== $publicationLocale) {
1029 $iso2LanguageCode = substr($defaultLanguage, 0, 2);
1030 $defaultTitle = $publication->getLocalizedData($iso2LanguageCode);
1031 if (strlen($defaultTitle) > 0 && !$translatedTitleAvailable) {
1032 $orcidWork[
'title'][
'translated-title'] = [
'value' => $defaultTitle,
'language-code' => $iso2LanguageCode];
1033 $translatedTitleAvailable =
true;
1048 private function buildOrcidPublicationDate($publication, $issue =
null) {
1049 $publicationPublishDate = Carbon\Carbon::parse($publication->getData(
'datePublished'));
1052 'year' => [
'value' => $publicationPublishDate->format(
"Y")],
1053 'month' => [
'value' => $publicationPublishDate->format(
"m")],
1054 'day' => [
'value' => $publicationPublishDate->format(
"d")]
1069 private function buildOrcidExternalIds($submission, $publication, $context, $issue, $articleUrl) {
1070 $contextId = $context->getId();
1072 $externalIds = array();
1075 $articleHasStoredPubId =
false;
1076 if (is_array($pubIdPlugins)) {
1077 foreach ($pubIdPlugins as $plugin) {
1078 if (!$plugin->getEnabled()) {
1082 $pubIdType = $plugin->getPubIdType();
1085 $pubId = $publication->getData($pubIdType);
1089 'external-id-type' => self::PUBID_TO_ORCID_EXT_ID[$pubIdType],
1090 'external-id-value' => $pubId,
1091 'external-id-url' => [
1092 'value' => $plugin->getResolvingURL($contextId, $pubId)
1094 'external-id-relationship' =>
'SELF'
1097 $articleHasStoredPubId =
true;
1100 # Add issue ids if they exist
1101 $pubId = $issue->getStoredPubId($pubIdType);
1104 'external-id-type' => self::PUBID_TO_ORCID_EXT_ID[$pubIdType],
1105 'external-id-value' => $pubId,
1106 'external-id-url' => [
1107 'value' => $plugin->getResolvingURL($contextId, $pubId)
1109 'external-id-relationship' =>
'PART_OF'
1114 error_log(
"OrcidProfilePlugin::buildOrcidExternalIds: No pubId plugins could be loaded");
1117 if (!$articleHasStoredPubId) {
1121 'external-id-type' =>
'uri',
1122 'external-id-value' => $articleUrl,
1123 'external-id-relationship' =>
'SELF'
1129 if ($context->getData(
'onlineIssn')) {
1131 'external-id-type' =>
'issn',
1132 'external-id-value' => $context->getData(
'onlineIssn'),
1133 'external-id-relationship' =>
'PART_OF'
1137 return $externalIds;
1149 private function buildOrcidContributors($authors, $context, $publication) {
1153 foreach ($authors as $author) {
1155 $fullName = $author->getLocalizedGivenName() .
" " . $author->getLocalizedFamilyName();
1157 if (strlen($fullName) == 0) {
1158 $this->
logError(
"Contributor Name not defined" . $author->getAllData());
1161 'credit-name' => $fullName,
1162 'contributor-attributes' => [
1163 'contributor-sequence' => $first ?
'FIRST' :
'ADDITIONAL'
1167 $userGroup = $author->getUserGroup();
1168 $role = self::USER_GROUP_TO_ORCID_ROLE[$userGroup->getName(
'en_US')];
1171 $contributor[
'contributor-attributes'][
'contributor-role'] = $role;
1174 if ($author->getOrcid()) {
1175 $orcid = basename(parse_url($author->getOrcid(), PHP_URL_PATH));
1177 if ($author->getData(
'orcidSandbox')) {
1178 $uri = ORCID_URL_SANDBOX . $orcid;
1179 $host =
'sandbox.orcid.org';
1181 $uri = $author->getOrcid();
1182 $host =
'orcid.org';
1185 $contributor[
'contributor-orcid'] = [
1194 $contributors[] = $contributor;
1197 return $contributors;
1208 $author->setData(
'orcidAccessToken',
null);
1209 $author->setData(
'orcidAccessScope',
null);
1210 $author->setData(
'orcidRefreshToken',
null);
1211 $author->setData(
'orcidAccessExpiresOn',
null);
1212 $author->setData(
'orcidSandbox',
null);
1216 $authorDao->updateObject($author);
1234 self::writeLog($message,
'ERROR');
1244 if ($this->
getSetting($this->currentContextId,
'logLevel') ===
'ERROR') {
1247 self::writeLog($message,
'INFO');
1258 private static function writeLog($message, $level) {
1259 $fineStamp = date(
'Y-m-d H:i:s') . substr(microtime(), 1, 4);
1260 error_log(
"$fineStamp $level $message\n", 3, self::logFilePath());
1269 $this->currentContextId = $contextId;
1276 $apiUrl = $this->
getSetting($contextId,
'orcidProfileAPIPath');
1277 if ($apiUrl === ORCID_API_URL_MEMBER || $apiUrl === ORCID_API_URL_MEMBER_SANDBOX) {