Skip to content

Commit b29c552

Browse files
Merge branch 'removeHyperlinksCheck340-824' into 'main'
Remove funcionalidade da detecção de hyperlinks ORCID - 3.4.0 See merge request softwares-pkp/plugins_ojs/verificacao-metadados-documento!29
2 parents e8011c4 + d898f8b commit b29c552

10 files changed

Lines changed: 14 additions & 97 deletions

File tree

classes/DocumentChecker.php

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,12 @@ class DocumentChecker
1717
{
1818
private $pathFile;
1919
public $words;
20-
public $textHtml;
2120

2221
public function __construct($path)
2322
{
2423
$this->pathFile = $path;
2524
$parser = new ContentParser();
2625
$this->words = $parser->parseDocument($path);
27-
$this->textHtml = shell_exec("pdftohtml -s -i -stdout $path 2>/dev/null");
2826
}
2927

3028
private $patternsContribution = array(
@@ -169,23 +167,6 @@ public function checkTextOrcidsNumber()
169167
return count($orcidsDetected);
170168
}
171169

172-
public function checkHyperlinkOrcidsNumber()
173-
{
174-
$orcidsDetected = [];
175-
$hyperlinkOrcidPattern = "~<a href=\"https:\/\/orcid\.org\/\d{4}-\d{4}-\d{4}-\d{3}(\d|X|x)\">~";
176-
177-
if (preg_match_all($hyperlinkOrcidPattern, $this->textHtml, $matches)) {
178-
foreach ($matches[0] as $match) {
179-
$orcid = $this->checkOrcid($match);
180-
if ($orcid != '' && !in_array($orcid, $orcidsDetected)) {
181-
$orcidsDetected[] = $orcid;
182-
}
183-
}
184-
}
185-
186-
return count($orcidsDetected);
187-
}
188-
189170
public function checkConflictInterest()
190171
{
191172
return $this->checkForPattern($this->patternsConflictInterest, 3, 75, 1);

classes/DocumentChecklist.php

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,21 +78,12 @@ private function getStatusORCIDs($submission)
7878
{
7979
$numAuthors = count($submission->getCurrentPublication()->getData('authors'));
8080
$textOrcidsDetected = $this->docChecker->checkTextOrcidsNumber();
81-
$hyperlinkOrcidsDetected = $this->docChecker->checkHyperlinkOrcidsNumber();
8281

8382
if ($textOrcidsDetected >= $numAuthors) {
84-
if ($hyperlinkOrcidsDetected >= $numAuthors) {
85-
return ['orcidStatus' => 'Success'];
86-
} else {
87-
return [
88-
'orcidStatus' => 'Warning',
89-
'orcidWarningType' => 'hyperlinkOrcids',
90-
];
91-
}
83+
return ['orcidStatus' => 'Success'];
9284
} elseif ($textOrcidsDetected > 0 && $textOrcidsDetected < $numAuthors) {
9385
return [
9486
'orcidStatus' => 'Warning',
95-
'orcidWarningType' => 'textOrcids',
9687
'numOrcids' => $textOrcidsDetected,
9788
'numAuthors' => $numAuthors
9889
];

cypress/support/commands.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ Cypress.Commands.add('assertCheckingsFailed', function(title, checklistType) {
7676

7777
cy.get('#statusORCID').within(() => {
7878
cy.get('.analysisStatusError');
79-
cy.contains('span', "No ORCIDs were identified in the document. Make sure all the ORCIDs have been inserted in the document following the link format recommended by ORCID, also containing the hyperlink to the ORCID record page. Also make sure all the links correspond to the correct ORCID registry of each person listed in the document authorship.");
79+
cy.contains('span', "No ORCIDs were identified in the document. Make sure all the ORCIDs have been inserted in the document following the link format recommended by ORCID. Also make sure all the links correspond to the correct ORCID registry of each person listed in the document authorship.");
8080
});
8181

8282
cy.get('#statusTitleEnglish').within(() => {

locale/en/locale.po

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,15 @@ msgstr "The author's contribution statement is not necessary in single authorshi
4545
msgid "plugins.generic.contentAnalysis.status.orcidSuccess"
4646
msgstr "The ORCIDs of all authors were identified"
4747

48-
msgid "plugins.generic.contentAnalysis.status.orcidWarning.hyperlinkOrcids"
49-
msgstr "The hyperlinks to the ORCID records of all the authors in the submitted document were not identified"
50-
51-
msgid "plugins.generic.contentAnalysis.status.orcidWarning.textOrcids"
48+
msgid "plugins.generic.contentAnalysis.status.orcidWarning"
5249
msgstr ""
5350
"We only identified {$numOrcids} ORCIDs out of a total of {$numAuthors} authors, make sure all authors' ORCIDs are included in the document. "
54-
"Also make sure all the ORCIDs have been inserted in the document following the <a href=\"https://support.orcid.org/hc/en-us/articles/360006897674-Structure-of-the-ORCID-Identifier\">link format recommended by ORCID</a>, also containing the hyperlink to the ORCID record page."
51+
"Also make sure all the ORCIDs have been inserted in the document following the <a href=\"https://support.orcid.org/hc/en-us/articles/360006897674-Structure-of-the-ORCID-Identifier\">link format recommended by ORCID</a>."
5552

5653
msgid "plugins.generic.contentAnalysis.status.orcidError"
5754
msgstr ""
5855
"No ORCIDs were identified in the document. "
59-
"Make sure all the ORCIDs have been inserted in the document following the <a href=\"https://support.orcid.org/hc/en-us/articles/360006897674-Structure-of-the-ORCID-Identifier\">link format recommended by ORCID</a>, also containing the hyperlink to the ORCID record page. "
56+
"Make sure all the ORCIDs have been inserted in the document following the <a href=\"https://support.orcid.org/hc/en-us/articles/360006897674-Structure-of-the-ORCID-Identifier\">link format recommended by ORCID</a>. "
6057
"Also make sure all the links correspond to the correct ORCID registry of each person listed in the document authorship."
6158

6259
msgid "plugins.generic.contentAnalysis.status.conflictInterestSuccess"

locale/es/locale.po

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,15 @@ msgstr "La declaración de contribución de los autores no se requiere en los ca
4545
msgid "plugins.generic.contentAnalysis.status.orcidSuccess"
4646
msgstr "Se identificaron los ORCID de todos los autores"
4747

48-
msgid "plugins.generic.contentAnalysis.status.orcidWarning.hyperlinkOrcids"
49-
msgstr "No se identificaron los hipervínculos a los registros ORCID de todos los autores del documento presentado"
50-
51-
msgid "plugins.generic.contentAnalysis.status.orcidWarning.textOrcids"
48+
msgid "plugins.generic.contentAnalysis.status.orcidWarning"
5249
msgstr ""
5350
"Solo identificamos {$numOrcids} ORCID de un total de {$numAuthors} autores, asegúrese de que los ORCID de todos los autores estén incluidos en el documento. "
54-
"También asegúrese de que todas los ORCIDs se hayan ingresado en el manuscrito en el <a href=\"https://support.orcid.org/hc/en-us/articles/360006897674-Structure-of-the-ORCID-Identifier\">formato de enlace recomendado por ORCID</a>, conteniendo también el hipervínculo a la página del registro ORCID."
51+
"También asegúrese de que todas los ORCIDs se hayan ingresado en el manuscrito en el <a href=\"https://support.orcid.org/hc/en-us/articles/360006897674-Structure-of-the-ORCID-Identifier\">formato de enlace recomendado por ORCID</a>."
5552

5653
msgid "plugins.generic.contentAnalysis.status.orcidError"
5754
msgstr ""
5855
"No se identificaron ORCIDs en el documento. "
59-
"Asegúrese de que todas los ORCIDs se hayan ingresado en el manuscrito en el <a href=\"https://support.orcid.org/hc/en-us/articles/360006897674-Structure-of-the-ORCID-Identifier\">formato de enlace recomendado por ORCID</a>, conteniendo también el hipervínculo a la página del registro ORCID. "
56+
"Asegúrese de que todas los ORCIDs se hayan ingresado en el manuscrito en el <a href=\"https://support.orcid.org/hc/en-us/articles/360006897674-Structure-of-the-ORCID-Identifier\">formato de enlace recomendado por ORCID</a>. "
6057
"También asegúrese de que los enlaces coincidan con el registro ORCID correcto para cada persona que figura en la autoría del manuscrito."
6158

6259
msgid "plugins.generic.contentAnalysis.status.conflictInterestSuccess"

locale/pt_BR/locale.po

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,15 @@ msgstr "A declaração de contribuição dos autores não é necessária em caso
4444
msgid "plugins.generic.contentAnalysis.status.orcidSuccess"
4545
msgstr "Os ORCIDs de todos os autores foram identificados"
4646

47-
msgid "plugins.generic.contentAnalysis.status.orcidWarning.hyperlinkOrcids"
48-
msgstr "Não foram identificados os hyperlinks dos registros ORCID de todos os autores no documento enviado"
49-
50-
msgid "plugins.generic.contentAnalysis.status.orcidWarning.textOrcids"
47+
msgid "plugins.generic.contentAnalysis.status.orcidWarning"
5148
msgstr ""
5249
"Identificamos somente {$numOrcids} ORCIDs de um total de {$numAuthors} autores, certifique-se de que os ORCIDs de todos os autores foram incluídos no documento. "
53-
"Certifique-se também que todos os ORCIDs foram inseridos no manuscrito no <a href=\"https://support.orcid.org/hc/en-us/articles/360006897674-Structure-of-the-ORCID-Identifier\">formato de link recomendado pela ORCID</a>, contendo também o hyperlink para a página do registro ORCID."
50+
"Certifique-se também que todos os ORCIDs foram inseridos no manuscrito no <a href=\"https://support.orcid.org/hc/en-us/articles/360006897674-Structure-of-the-ORCID-Identifier\">formato de link recomendado pela ORCID</a>."
5451

5552
msgid "plugins.generic.contentAnalysis.status.orcidError"
5653
msgstr ""
5754
"Não foram identificados ORCIDs no documento. "
58-
"Certifique-se de que todos os ORCIDs foram inseridos no manuscrito no <a href=\"https://support.orcid.org/hc/en-us/articles/360006897674-Structure-of-the-ORCID-Identifier\">formato de link recomendado pela ORCID</a>, contendo também o hyperlink para a página do registro ORCID. "
55+
"Certifique-se de que todos os ORCIDs foram inseridos no manuscrito no <a href=\"https://support.orcid.org/hc/en-us/articles/360006897674-Structure-of-the-ORCID-Identifier\">formato de link recomendado pela ORCID</a>. "
5956
"Certifique-se também que os links correspondem ao registro ORCID correto de cada pessoa listada na autoria do manuscrito."
6057

6158
msgid "plugins.generic.contentAnalysis.status.conflictInterestSuccess"

templates/statusChecklist.tpl

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,7 @@
2121
<div id="statusORCID" class="analysisStatusElement">
2222
<div class="analysisStatus{$orcidStatus}"></div>
2323
{if $orcidStatus == "Warning"}
24-
{if $orcidWarningType == 'textOrcids'}
25-
<span>{translate key="plugins.generic.contentAnalysis.status.orcid{$orcidStatus}.textOrcids" numOrcids=$numOrcids numAuthors=$numAuthors}</span>
26-
{else}
27-
<span>{translate key="plugins.generic.contentAnalysis.status.orcid{$orcidStatus}.hyperlinkOrcids"}</span>
28-
{/if}
24+
<span>{translate key="plugins.generic.contentAnalysis.status.orcid{$orcidStatus}" numOrcids=$numOrcids numAuthors=$numAuthors}</span>
2925
{else}
3026
<span>{translate key="plugins.generic.contentAnalysis.status.orcid{$orcidStatus}"}</span>
3127
{/if}

tests/AuthorsORCIDTest.php

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,6 @@ class AuthorsORCIDTest extends DetectionOnDocumentTest
1414
"0000-0001-5727-2427",
1515
"https://orcid.org/0000-0000-0000-0000"
1616
];
17-
private $validHyperlinkOrcids = [
18-
"<a href=\"https://orcid.org/0000-0003-3904-0248\">",
19-
"<a href=\"https://orcid.org/0000-0002-1648-966X\">"
20-
];
21-
private $invalidHyperlinkOrcids = [
22-
"<a href=\"https://orcid.org/0000-0000-0000-0000\">",
23-
"<a href=\"orcid.org/0000-0001-5727-2427\">"
24-
];
2517

2618
public function setUp(): void
2719
{
@@ -57,19 +49,4 @@ public function testDoesntDetectInvalidTextOrcids(): void
5749

5850
$this->assertEquals(0, $this->documentChecker->checkTextOrcidsNumber());
5951
}
60-
61-
public function testDetectsValidHyperlinkOrcids(): void
62-
{
63-
$this->documentChecker->textHtml = $this->insertStringIntoTextHtml(implode(' ', $this->validHyperlinkOrcids), $this->documentChecker->textHtml);
64-
65-
$this->assertEquals(2, $this->documentChecker->checkHyperlinkOrcidsNumber());
66-
}
67-
68-
public function testDoesntDetectInvalidHyperlinkOrcids(): void
69-
{
70-
$this->documentChecker->textHtml = $this->insertStringIntoTextHtml(implode(' ', $this->invalidHyperlinkOrcids), $this->documentChecker->textHtml);
71-
72-
$this->assertEquals(0, $this->documentChecker->checkHyperlinkOrcidsNumber());
73-
}
74-
7552
}

tests/DocumentChecklistTest.php

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ class DocumentChecklistTest extends DetectionOnDocumentTest
1818
private $authorGivenName = "Sophie";
1919
private $authorFamilyName = "Anhalt-Zerbst";
2020
private $textOrcids = ["https://orcid.org/0000-0001-5727-2427", "https://orcid.org/0000-0002-1648-966X"];
21-
private $hyperlinkOrcids = [
22-
"<a href=\"https://orcid.org/0000-0001-5727-2427\">",
23-
"<a href=\"https://orcid.org/0000-0002-1648-966X\">"
24-
];
25-
2621

2722
public function setUp(): void
2823
{
@@ -70,12 +65,6 @@ private function executeChecklistAddingNewTextToDocument($text)
7065
return $this->documentChecklist->executeChecklist($this->submission);
7166
}
7267

73-
private function getStatusChecklistTextHtmlUpdating($string)
74-
{
75-
$this->documentChecklist->docChecker->textHtml = $this->insertStringIntoTextHtml($string, $this->documentChecklist->docChecker->textHtml);
76-
return $this->documentChecklist->executeChecklist($this->submission);
77-
}
78-
7968
public function testContributionSkippedSingleAuthor(): void
8069
{
8170
$statusChecklist = $this->documentChecklist->executeChecklist($this->submission);
@@ -94,16 +83,9 @@ public function testComparisonOrcidAuthors(): void
9483

9584
$statusChecklist = $this->executeChecklistAddingNewTextToDocument($this->textOrcids[0]);
9685
$this->assertEquals('Warning', $statusChecklist['orcidStatus']);
97-
$this->assertEquals('textOrcids', $statusChecklist['orcidWarningType']);
9886

9987
$statusChecklist = $this->executeChecklistAddingNewTextToDocument($this->textOrcids[1]);
100-
$this->assertEquals('Warning', $statusChecklist['orcidStatus']);
101-
$this->assertEquals('hyperlinkOrcids', $statusChecklist['orcidWarningType']);
102-
103-
$this->getStatusChecklistTextHtmlUpdating($this->hyperlinkOrcids[0]);
104-
$statusChecklist = $this->getStatusChecklistTextHtmlUpdating($this->hyperlinkOrcids[1]);
10588
$this->assertEquals('Success', $statusChecklist['orcidStatus']);
106-
10789
}
10890

10991
public function testChecksEthicOnlyWhenResearchInvolvesHumansOrAnimals(): void
@@ -139,7 +121,6 @@ public function testChecklistGeneralStatusWorksCorrectlyForNonArticles(): void
139121
$this->publication->setData('authors', [$this->createAuthor()]);
140122

141123
$this->executeChecklistAddingNewTextToDocument($this->textOrcids[0]);
142-
$this->getStatusChecklistTextHtmlUpdating($this->hyperlinkOrcids[0]);
143124
$this->executeChecklistAddingNewTextToDocument('Data availability statement lorem ipsum dolor sit amet');
144125
$statusChecklist = $this->executeChecklistAddingNewTextToDocument($this->title);
145126

version.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
<version>
1313
<application>contentAnalysis</application>
1414
<type>plugins.generic</type>
15-
<release>2.2.0</release>
16-
<date>2025-02-21</date>
15+
<release>2.2.1.0</release>
16+
<date>2025-09-04</date>
1717
<lazy-load>1</lazy-load>
1818
<class>ContentAnalysisPlugin</class>
1919
</version>

0 commit comments

Comments
 (0)