getEnabled()) { HookRegistry::register('Templates::Article::Footer::PageFooter', array($this, 'insertFooter')); HookRegistry::register('Templates::Issue::Issue::Article', array($this, 'insertFooter')); } return $success; } function getDisplayName() { return __('plugins.generic.coins.displayName'); } function getDescription() { return __('plugins.generic.coins.description'); } /** * Get the name of the settings file to be installed site-wide when * OJS is installed. * @return string */ function getInstallSitePluginSettingsFile() { return $this->getPluginPath() . '/settings.xml'; } /** * Insert COinS tag. */ function insertFooter($hookName, $params) { if ($this->getEnabled()) { $smarty =& $params[1]; $output =& $params[2]; $templateMgr =& TemplateManager::getManager(); $article = $templateMgr->get_template_vars('article'); $journal = $templateMgr->get_template_vars('currentJournal'); $issue = $templateMgr->get_template_vars('issue'); $authors = $article->getAuthors(); $firstAuthor =& $authors[0]; $vars = array( array('ctx_ver', 'Z39.88-2004'), array('rft_id', Request::url(null, 'article', 'view', $article->getId())), array('rft_val_fmt', 'info:ofi/fmt:kev:mtx:journal'), array('rft.genre', 'article'), array('rft.title', $journal->getLocalizedTitle()), array('rft.jtitle', $journal->getLocalizedTitle()), array('rft.atitle', $article->getLocalizedTitle()), array('rft.artnum', $article->getBestArticleId()), array('rft.stitle', $journal->getLocalizedSetting('abbreviation')), array('rft.volume', $issue->getVolume()), array('rft.issue', $issue->getNumber()), array('rft.aulast', $firstAuthor->getLastName()), array('rft.aufirst', $firstAuthor->getFirstName()), array('rft.auinit', $firstAuthor->getMiddleName()) ); $datePublished = $article->getDatePublished(); if (!$datePublished) $datePublished = $issue->getDatePublished(); if ($datePublished) { $vars[] = array('rft.date', date('Y-m-d', strtotime($datePublished))); } foreach ($authors as $author) { $vars[] = array('rft.au', $author->getFullName()); } if ($doi = $article->getPubId('doi')) $vars[] = array('rft_id', 'info:doi/' . $doi); if ($article->getPages()) $vars[] = array('rft.pages', $article->getPages()); if ($journal->getSetting('printIssn')) $vars[] = array('rft.issn', $journal->getSetting('printIssn')); if ($journal->getSetting('onlineIssn')) $vars[] = array('rft.eissn', $journal->getSetting('onlineIssn')); $title = ''; foreach ($vars as $entries) { list($name, $value) = $entries; $title .= $name . '=' . urlencode($value) . '&'; } $title = htmlentities(substr($title, 0, -1)); $output .= "\n"; } return false; } } ?>