Skip to content

Commit 5740da8

Browse files
committed
#10692 Structured Citations
1 parent 2645c39 commit 5740da8

22 files changed

+1341
-350
lines changed
Binary file not shown.

classes/citation/.project/readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
https://tug.ctan.org/info/biblatex-cheatsheet/biblatex-cheatsheet.pdf

classes/citation/Citation.php

Lines changed: 23 additions & 28 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-2024 Simon Fraser University
11+
* Copyright (c) 2000-2024 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
{
7779
$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)