| Server IP : 127.0.1.1 / Your IP : 216.73.216.60 Web Server : Apache/2.4.58 (Ubuntu) System : Linux nepub 6.8.0-88-generic #89-Ubuntu SMP PREEMPT_DYNAMIC Sat Oct 11 01:02:46 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.2.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/html/public_html/plugins/generic/doiInSummary/ |
Upload File : |
<?php
/**
* Copyright (c) 2015-2023 Lepidus Tecnologia
* Distributed under the GNU GPL v3. For full terms see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt.
*/
import('lib.pkp.classes.plugins.GenericPlugin');
class DoiInSummaryPlugin extends GenericPlugin
{
public function register($category, $path, $mainContextId = null)
{
if (!parent::register($category, $path, $mainContextId)) {
return false;
}
if($this->getEnabled($mainContextId)) {
HookRegistry::register('Templates::Issue::Issue::Article', array($this, 'addDoiToArticleSummary'));
$this->addLocaleData();
$this->addDoiStyleSheet();
}
return true;
}
private function addDoiStyleSheet()
{
$request = Application::get()->getRequest();
$url = $request->getBaseUrl() . '/' . $this->getPluginPath() . '/styles/doi.css';
$templateMgr = TemplateManager::getManager($request);
$templateMgr->addStyleSheet('doiCSS', $url);
}
public function addDoiToArticleSummary($hookName, $args)
{
$templateMgr =& $args[1];
$output =& $args[2];
$submission = $templateMgr->getTemplateVars('article');
$doiUrl = $this->getArticleDoiUrl($submission);
if(!is_null($doiUrl)) {
$templateMgr->assign('doiUrl', $doiUrl);
$output .= $templateMgr->fetch($this->getTemplateResource('doi_summary.tpl'));
}
}
private function getArticleDoiUrl($article): ?string
{
$publication = $article->getCurrentPublication();
$doi = $publication->getData('pub-id::doi');
if(empty($doi)) {
return null;
}
return "https://doi.org/$doi";
}
public function getDisplayName()
{
return __('plugins.generic.doiInSummary.displayName');
}
public function getDescription()
{
return __('plugins.generic.doiInSummary.description');
}
public function clearCache($hookName, $args)
{
$templateMgr = TemplateManager::getManager();
$templateMgr->clearTemplateCache();
return false;
}
public function getInstallSitePluginSettingsFile()
{
return $this->getPluginPath() . '/settings.xml';
}
}