Skip to content

Commit 08019f3

Browse files
committed
#10692 structured citations (development)
1 parent 848c70e commit 08019f3

23 files changed

+1049
-375
lines changed

api/v1/submissions/PKPSubmissionController.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,6 +1255,8 @@ public function editPublication(Request $illuminateRequest): JsonResponse
12551255
$params = $this->convertStringsToSchema(PKPSchemaService::SCHEMA_PUBLICATION, $illuminateRequest->input());
12561256
$params['id'] = $publication->getId();
12571257

1258+
\APP\_helper\LogHelper::logInfo($params);
1259+
12581260
// Don't allow the status to be modified through the API. The `/publish` and /unpublish endpoints
12591261
// should be used instead.
12601262
if (array_key_exists('status', $params)) {
@@ -1928,6 +1930,8 @@ protected function getPublicationReferenceForm(Request $illuminateRequest): Json
19281930

19291931
$citationsForm = new PKPCitationsForm($publicationApiUrl, $publication);
19301932

1933+
\APP\_helper\LogHelper::logInfo($citationsForm->getConfig());
1934+
19311935
return response()->json($citationsForm->getConfig(), Response::HTTP_OK);
19321936
}
19331937

classes/citation/Citation.php

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
/**
88
* @file classes/citation/Citation.php
99
*
10-
* Copyright (c) 2014-2021 Simon Fraser University
11-
* Copyright (c) 2000-2021 John Willinsky
10+
* Copyright (c) 2014-2025 Simon Fraser University
11+
* Copyright (c) 2000-2025 John Willinsky
1212
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
1313
*
1414
* @class Citation
@@ -20,29 +20,33 @@
2020

2121
namespace PKP\citation;
2222

23-
class Citation extends \PKP\core\DataObject
23+
use PKP\core\DataObject;
24+
25+
class Citation extends DataObject
2426
{
2527
/**
2628
* Constructor.
2729
*
28-
* @param string $rawCitation an unparsed citation string
30+
* @param string|null $rawCitation an unparsed citation string
2931
*/
30-
public function __construct($rawCitation = null)
32+
public function __construct(string $rawCitation = null)
3133
{
3234
parent::__construct();
3335
$this->setRawCitation($rawCitation);
3436
}
3537

36-
//
37-
// Getters and Setters
38-
//
38+
/**
39+
* Get publication id.
40+
*/
41+
public function getPublicationId()
42+
{
43+
return $this->getData('publicationId');
44+
}
3945

4046
/**
41-
* Replace URLs through HTML links, if the citation does not already contain HTML links
42-
*
43-
* @return string
47+
* Replace URLs through HTML links, if the citation does not already contain HTML links.
4448
*/
45-
public function getCitationWithLinks()
49+
public function getCitationWithLinks(): string
4650
{
4751
$citation = $this->getRawCitation();
4852
if (stripos($citation, '<a href=') === false) {
@@ -60,51 +64,42 @@ function ($matches) {
6064
}
6165

6266
/**
63-
* Get the rawCitation
64-
*
65-
* @return string
67+
* Get the rawCitation.
6668
*/
67-
public function getRawCitation()
69+
public function getRawCitation(): string
6870
{
6971
return $this->getData('rawCitation');
7072
}
7173

7274
/**
73-
* Set the rawCitation
75+
* Set the rawCitation.
7476
*/
75-
public function setRawCitation(?string $rawCitation)
77+
public function setRawCitation(?string $rawCitation): void
7678
{
77-
$rawCitation = $this->_cleanCitationString($rawCitation ?? '');
79+
$rawCitation = $this->cleanCitationString($rawCitation ?? '');
7880
$this->setData('rawCitation', $rawCitation);
7981
}
8082

8183
/**
8284
* Get the sequence number
83-
*
84-
* @return int
8585
*/
86-
public function getSequence()
86+
public function getSequence(): int
8787
{
8888
return $this->getData('seq');
8989
}
9090

9191
/**
9292
* Set the sequence number
93-
*
94-
* @param int $seq
9593
*/
96-
public function setSequence($seq)
94+
public function setSequence(int $seq): void
9795
{
9896
$this->setData('seq', $seq);
9997
}
10098

101-
//
102-
// Private methods
103-
//
10499
/**
105100
* Take a citation string and clean/normalize it
106101
*/
107-
public function _cleanCitationString(string $citationString) : string
102+
private function cleanCitationString(string $citationString = null): string
108103
{
109104
// 1) Strip slashes and whitespace
110105
$citationString = trim(stripslashes($citationString));

classes/citation/CitationDAO.php

Lines changed: 0 additions & 253 deletions
This file was deleted.

0 commit comments

Comments
 (0)