-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pkp/pkp-lib#9771 Move ORCID functionality into core application
- Loading branch information
Showing
7 changed files
with
122 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
/** | ||
* @defgroup api_v1_orcid ORCID API requests | ||
*/ | ||
|
||
/** | ||
* @file api/v1/orcid/index.php | ||
* | ||
* Copyright (c) 2024 Simon Fraser University | ||
* Copyright (c) 2024 John Willinsky | ||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING. | ||
* | ||
* @ingroup api_v1_orcid | ||
* | ||
* @brief Handle requests for ORCID API functions. | ||
* | ||
*/ | ||
|
||
return new \PKP\handler\APIHandler(new \PKP\API\v1\orcid\OrcidController()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
|
||
/** | ||
* @file classes/orcid/OrcidWork.php | ||
* | ||
* Copyright (c) 2014-2024 Simon Fraser University | ||
* Copyright (c) 2000-2024 John Willinsky | ||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING. | ||
* | ||
* @class OrcidWork | ||
* | ||
* @brief Builds ORCID work object for deposit | ||
*/ | ||
|
||
namespace APP\orcid; | ||
|
||
use APP\core\Application; | ||
use APP\plugins\generic\citationStyleLanguage\CitationStyleLanguagePlugin; | ||
use APP\submission\Submission; | ||
use PKP\orcid\PKPOrcidWork; | ||
use PKP\plugins\PluginRegistry; | ||
|
||
class OrcidWork extends PKPOrcidWork | ||
{ | ||
/** | ||
* @inheritDoc | ||
*/ | ||
protected function getOrcidPublicationType(): string | ||
{ | ||
return 'preprint'; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
protected function getBibtexCitation(Submission $submission): string | ||
{ | ||
$request = Application::get()->getRequest(); | ||
try { | ||
PluginRegistry::loadCategory('generic'); | ||
/** @var CitationStyleLanguagePlugin $citationPlugin */ | ||
$citationPlugin = PluginRegistry::getPlugin('generic', 'citationstylelanguageplugin'); | ||
return trim( | ||
strip_tags( | ||
$citationPlugin->getCitation( | ||
$request, | ||
$submission, | ||
'bibtex', | ||
publication: $this->publication | ||
) | ||
) | ||
); | ||
} catch (\Exception $exception) { | ||
return ''; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
/** | ||
* @file classes/orcid/actions/SendSubmissionToOrcid.php | ||
* | ||
* Copyright (c) 2014-2024 Simon Fraser University | ||
* Copyright (c) 2000-2024 John Willinsky | ||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING. | ||
* | ||
* @class SendSubmissionToOrcid | ||
* | ||
* @brief Compile and trigger deposits of submissions to ORCID. | ||
*/ | ||
|
||
namespace APP\orcid\actions; | ||
|
||
use APP\orcid\OrcidWork; | ||
use PKP\orcid\actions\PKPSendSubmissionToOrcid; | ||
use PKP\orcid\PKPOrcidWork; | ||
|
||
class SendSubmissionToOrcid extends PKPSendSubmissionToOrcid | ||
{ | ||
/** | ||
* @inheritDoc | ||
*/ | ||
protected function getOrcidWork(array $authors): ?PKPOrcidWork | ||
{ | ||
return new OrcidWork($this->publication, $this->context, $authors); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
protected function canDepositSubmission(): bool | ||
{ | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters