Skip to content

Commit

Permalink
pkp/pkp-lib#6091 Clean up namespace usage
Browse files Browse the repository at this point in the history
  • Loading branch information
asmecher committed May 13, 2021
1 parent 877bd13 commit a5df9b0
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions classes/services/PublicationService.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
use PKP\services\PKPPublicationService;
use PKP\submission\SubmissionFile;
use PKP\submission\PKPSubmission;
use PKP\plugins\HookRegistry;
use PKP\core\PKPApplication;

use APP\core\Application;
use APP\core\Services;
Expand All @@ -32,15 +34,15 @@ class PublicationService extends PKPPublicationService
*/
public function __construct()
{
\HookRegistry::register('Publication::getProperties', [$this, 'getPublicationProperties']);
\HookRegistry::register('Publication::validate', [$this, 'validatePublication']);
\HookRegistry::register('Publication::add', [$this, 'addPublication']);
\HookRegistry::register('Publication::edit', [$this, 'editPublication']);
\HookRegistry::register('Publication::version', [$this, 'versionPublication']);
\HookRegistry::register('Publication::publish::before', [$this, 'publishPublicationBefore']);
\HookRegistry::register('Publication::publish', [$this, 'publishPublication']);
\HookRegistry::register('Publication::unpublish', [$this, 'unpublishPublication']);
\HookRegistry::register('Publication::delete::before', [$this, 'deletePublicationBefore']);
HookRegistry::register('Publication::getProperties', [$this, 'getPublicationProperties']);
HookRegistry::register('Publication::validate', [$this, 'validatePublication']);
HookRegistry::register('Publication::add', [$this, 'addPublication']);
HookRegistry::register('Publication::edit', [$this, 'editPublication']);
HookRegistry::register('Publication::version', [$this, 'versionPublication']);
HookRegistry::register('Publication::publish::before', [$this, 'publishPublicationBefore']);
HookRegistry::register('Publication::publish', [$this, 'publishPublication']);
HookRegistry::register('Publication::unpublish', [$this, 'unpublishPublication']);
HookRegistry::register('Publication::delete::before', [$this, 'deletePublicationBefore']);
}

/**
Expand Down Expand Up @@ -100,7 +102,7 @@ function ($publicationFormat) {
case 'urlPublished':
$values[$prop] = $dispatcher->url(
$request,
\PKPApplication::ROUTE_PAGE,
PKPApplication::ROUTE_PAGE,
$submissionContext->getData('urlPath'),
'catalog',
'book',
Expand Down Expand Up @@ -165,7 +167,7 @@ public function addPublication($hookName, $args)
continue;
}

$publicFileManager = new \PublicFileManager();
$publicFileManager = new PublicFileManager();
$coverImage = $publication->getData('coverImage', $localeKey);
$coverImageFilePath = $publicFileManager->getContextFilesPath($submissionContext->getId()) . '/' . $coverImage['uploadName'];
$this->makeThumbnail(
Expand Down Expand Up @@ -197,11 +199,11 @@ public function editPublication($hookName, $args)

// Create or delete the thumbnail of a cover image
if (array_key_exists('coverImage', $params)) {
$publicFileManager = new \PublicFileManager();
$publicFileManager = new PublicFileManager();
$submission = Services::get('submission')->get($newPublication->getData('submissionId'));

// Get the submission context
$submissionContext = \Application::get()->getRequest()->getContext();
$submissionContext = Application::get()->getRequest()->getContext();
if ($submissionContext->getId() !== $submission->getData('contextId')) {
$submissionContext = Services::get('context')->get($submission->getData('contextId'));
}
Expand Down Expand Up @@ -412,8 +414,8 @@ public function publishPublication($hookName, $args)
}

// Update notification
$request = \Application::get()->getRequest();
$notificationMgr = new \NotificationManager();
$request = Application::get()->getRequest();
$notificationMgr = new NotificationManager();
$notificationMgr->updateNotification(
$request,
[NOTIFICATION_TYPE_APPROVE_SUBMISSION],
Expand Down Expand Up @@ -459,8 +461,8 @@ public function unpublishPublication($hookName, $args)


// Update notification
$request = \Application::get()->getRequest();
$notificationMgr = new \NotificationManager();
$request = Application::get()->getRequest();
$notificationMgr = new NotificationManager();
$notificationMgr->updateNotification(
$request,
[NOTIFICATION_TYPE_APPROVE_SUBMISSION],
Expand Down

0 comments on commit a5df9b0

Please sign in to comment.