Skip to content

Commit

Permalink
pkp/pkp-lib#10796 adjust orcid node and minor styling (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaitlinnewson authored Jan 22, 2025
1 parent e2afb64 commit 1454459
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions filter/PreprintCrossrefXmlFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@
namespace APP\plugins\generic\crossref\filter;

use APP\core\Application;
use APP\core\Request;
use APP\plugins\generic\crossref\CrossrefExportDeployment;
use APP\publication\Publication;
use DOMDocument;
use PKP\core\Dispatcher;
use PKP\submission\PKPSubmission;

class PreprintCrossrefXmlFilter extends \PKP\plugins\importexport\native\filter\NativeExportFilter
Expand Down Expand Up @@ -90,7 +92,7 @@ public function &process(&$pubObjects)
*/
public function createRootNode($doc)
{
/** @var CrossrefExportDeployment */
/** @var CrossrefExportDeployment $deployment */
$deployment = $this->getDeployment();
$rootNode = $doc->createElementNS($deployment->getNamespace(), $deployment->getRootElementName());
$rootNode->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', $deployment->getXmlSchemaInstance());
Expand All @@ -111,7 +113,7 @@ public function createRootNode($doc)
*/
public function createHeadNode($doc)
{
/** @var CrossrefExportDeployment */
/** @var CrossrefExportDeployment $deployment */
$deployment = $this->getDeployment();
$context = $deployment->getContext();
$plugin = $deployment->getPlugin();
Expand Down Expand Up @@ -146,7 +148,7 @@ public function createHeadNode($doc)
public function createPostedContentNode($doc, $publication, $submission)
{
assert($publication instanceof Publication);
/** @var CrossrefExportDeployment */
/** @var CrossrefExportDeployment $deployment */
$deployment = $this->getDeployment();
$request = Application::get()->getRequest();

Expand Down Expand Up @@ -180,13 +182,6 @@ public function createPostedContentNode($doc, $publication, $submission)
$personNameNode->appendChild($doc->createElementNS($deployment->getNamespace(), 'given_name', htmlspecialchars(ucfirst($givenNames[$locale]), ENT_COMPAT, 'UTF-8')));
$personNameNode->appendChild($doc->createElementNS($deployment->getNamespace(), 'surname', htmlspecialchars(ucfirst($familyNames[$locale]), ENT_COMPAT, 'UTF-8')));

if ($author->getData('orcid')) {
$orcidNode = $doc->createElementNS($deployment->getNamespace(), 'ORCID', $author->getData('orcid'));
$orcidAuthenticated = $author->getData('orcidIsVerified') ? 'true' : 'false';
$orcidNode->setAttribute('authenticated', $orcidAuthenticated);
$personNameNode->appendChild($orcidNode);
}

$hasAltName = false;
foreach ($familyNames as $otherLocal => $familyName) {
if ($otherLocal != $locale && isset($familyName) && !empty($familyName)) {
Expand All @@ -209,9 +204,13 @@ public function createPostedContentNode($doc, $publication, $submission)
}
} else {
$personNameNode->appendChild($doc->createElementNS($deployment->getNamespace(), 'surname', htmlspecialchars(ucfirst($givenNames[$locale]), ENT_COMPAT, 'UTF-8')));
if ($author->getData('orcid')) {
$personNameNode->appendChild($doc->createElementNS($deployment->getNamespace(), 'ORCID', $author->getData('orcid')));
}
}

if ($author->getData('orcid')) {
$orcidNode = $doc->createElementNS($deployment->getNamespace(), 'ORCID', $author->getData('orcid'));
$orcidAuthenticated = $author->getData('orcidIsVerified') ? 'true' : 'false';
$orcidNode->setAttribute('authenticated', $orcidAuthenticated);
$personNameNode->appendChild($orcidNode);
}

$contributorsNode->appendChild($personNameNode);
Expand Down Expand Up @@ -326,7 +325,7 @@ public function createDOIDataNode($doc, $doi, $url)
*/
public function createParentDoiNode($doc, $parentDoi)
{
/** @var CrossrefExportDeployment */
/** @var CrossrefExportDeployment $deployment */
$deployment = $this->getDeployment();
$parentDoiNode = $doc->createElementNS($deployment->getRELNamespace(), 'rel:related_item');
$intraWorkRelationNode = $doc->createElementNS($deployment->getRELNamespace(), 'rel:intra_work_relation', htmlspecialchars($parentDoi, ENT_COMPAT, 'UTF-8'));
Expand All @@ -347,7 +346,7 @@ public function createParentDoiNode($doc, $parentDoi)
*/
public function createVorDoiNode($doc, $vorDoi)
{
/** @var CrossrefExportDeployment */
/** @var CrossrefExportDeployment $deployment */
$deployment = $this->getDeployment();
$vorDoiNode = $doc->createElementNS($deployment->getRELNamespace(), 'rel:related_item');
$intraWorkRelationNode = $doc->createElementNS($deployment->getRELNamespace(), 'rel:intra_work_relation', htmlspecialchars($vorDoi, ENT_COMPAT, 'UTF-8'));
Expand All @@ -363,7 +362,7 @@ public function createVorDoiNode($doc, $vorDoi)
*
*
*/
protected function _getDispatcher(\APP\core\Request $request): \PKP\core\Dispatcher
protected function _getDispatcher(Request $request): Dispatcher
{
$dispatcher = $request->getDispatcher();
if ($dispatcher === null) {
Expand Down

0 comments on commit 1454459

Please sign in to comment.