Skip to content

[TEST ONLY] Structured Citations #10462

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions api/v1/submissions/PKPSubmissionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1255,6 +1255,8 @@ public function editPublication(Request $illuminateRequest): JsonResponse
$params = $this->convertStringsToSchema(PKPSchemaService::SCHEMA_PUBLICATION, $illuminateRequest->input());
$params['id'] = $publication->getId();

\APP\_helper\LogHelper::logInfo($params);

// Don't allow the status to be modified through the API. The `/publish` and /unpublish endpoints
// should be used instead.
if (array_key_exists('status', $params)) {
Expand Down Expand Up @@ -1928,6 +1930,8 @@ protected function getPublicationReferenceForm(Request $illuminateRequest): Json

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

\APP\_helper\LogHelper::logInfo($citationsForm->getConfig());

return response()->json($citationsForm->getConfig(), Response::HTTP_OK);
}

Expand Down
53 changes: 24 additions & 29 deletions classes/citation/Citation.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
/**
* @file classes/citation/Citation.php
*
* Copyright (c) 2014-2021 Simon Fraser University
* Copyright (c) 2000-2021 John Willinsky
* Copyright (c) 2014-2025 Simon Fraser University
* Copyright (c) 2000-2025 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class Citation
Expand All @@ -20,29 +20,33 @@

namespace PKP\citation;

class Citation extends \PKP\core\DataObject
use PKP\core\DataObject;

class Citation extends DataObject
{
/**
* Constructor.
*
* @param string $rawCitation an unparsed citation string
* @param string|null $rawCitation an unparsed citation string
*/
public function __construct($rawCitation = null)
public function __construct(string $rawCitation = null)
{
parent::__construct();
$this->setRawCitation($rawCitation);
}

//
// Getters and Setters
//
/**
* Get publication id.
*/
public function getPublicationId()
{
return $this->getData('publicationId');
}

/**
* Replace URLs through HTML links, if the citation does not already contain HTML links
*
* @return string
* Replace URLs through HTML links, if the citation does not already contain HTML links.
*/
public function getCitationWithLinks()
public function getCitationWithLinks(): string
{
$citation = $this->getRawCitation();
if (stripos($citation, '<a href=') === false) {
Expand All @@ -60,51 +64,42 @@ function ($matches) {
}

/**
* Get the rawCitation
*
* @return string
* Get the rawCitation.
*/
public function getRawCitation()
public function getRawCitation(): string
{
return $this->getData('rawCitation');
}

/**
* Set the rawCitation
* Set the rawCitation.
*/
public function setRawCitation(?string $rawCitation)
public function setRawCitation(?string $rawCitation): void
{
$rawCitation = $this->_cleanCitationString($rawCitation ?? '');
$rawCitation = $this->cleanCitationString($rawCitation ?? '');
$this->setData('rawCitation', $rawCitation);
}

/**
* Get the sequence number
*
* @return int
*/
public function getSequence()
public function getSequence(): int
{
return $this->getData('seq');
}

/**
* Set the sequence number
*
* @param int $seq
*/
public function setSequence($seq)
public function setSequence(int $seq): void
{
$this->setData('seq', $seq);
}

//
// Private methods
//
/**
* Take a citation string and clean/normalize it
*/
public function _cleanCitationString(string $citationString) : string
private function cleanCitationString(string $citationString = null): string
{
// 1) Strip slashes and whitespace
$citationString = trim(stripslashes($citationString));
Expand Down
253 changes: 0 additions & 253 deletions classes/citation/CitationDAO.php

This file was deleted.

Loading