diff --git a/CoinsPlugin.inc.php b/CoinsPlugin.inc.php
deleted file mode 100644
index 6adcff6..0000000
--- a/CoinsPlugin.inc.php
+++ /dev/null
@@ -1,133 +0,0 @@
-getEnabled()) {
- HookRegistry::register('Templates::Common::Footer::PageFooter', array($this, 'insertFooter'));
- }
- return $success;
- }
-
- /**
- * Get the display name of this plugin
- * @return string
- */
- function getDisplayName() {
- return __('plugins.generic.coins.displayName');
- }
-
- /**
- * Get the description of this plugin
- * @return string
- */
- function getDescription() {
- return __('plugins.generic.coins.description');
- }
-
- /**
- * Insert COinS tag.
- * @param $hookName string
- * @param $params array
- * @return boolean
- */
- function insertFooter($hookName, $params) {
- if ($this->getEnabled()) {
- $request = Application::get()->getRequest();
-
- // Ensure that the callback is being called from a page COinS should be embedded in.
- if (!in_array($request->getRequestedPage() . '/' . $request->getRequestedOp(), array(
- 'article/view',
- ))) return false;
-
- $smarty =& $params[1];
- $output =& $params[2];
- $templateMgr =& TemplateManager::getManager($request);
-
- $article = $templateMgr->get_template_vars('article');
- $journal = $templateMgr->get_template_vars('currentJournal');
- $issue = $templateMgr->get_template_vars('issue');
- $publication = $article->getCurrentPublication();
-
- $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.language', $article->getLocale()),
- array('rft.genre', 'article'),
- array('rft.title', $journal->getLocalizedName()),
- array('rft.jtitle', $journal->getLocalizedName()),
- array('rft.atitle', $article->getFullTitle($article->getLocale())),
- array('rft.artnum', $article->getBestArticleId()),
- array('rft.stitle', $journal->getLocalizedSetting('abbreviation')),
- array('rft.volume', $issue->getVolume()),
- array('rft.issue', $issue->getNumber()),
- );
-
- $authors = $publication->getData('authors');
- if ($firstAuthor = array_shift($authors)) {
- $vars = array_merge($vars, array(
- array('rft.aulast', $firstAuthor->getFamilyName($article->getLocale())),
- array('rft.aufirst', $firstAuthor->getGivenName($article->getLocale())),
- ));
- }
-
- $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->getStoredPubId('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;
- }
-}
-
diff --git a/CoinsPlugin.php b/CoinsPlugin.php
new file mode 100644
index 0000000..f943efb
--- /dev/null
+++ b/CoinsPlugin.php
@@ -0,0 +1,137 @@
+getEnabled()) {
+ Hook::add('Templates::Common::Footer::PageFooter', [$this, 'insertFooter']);
+ }
+ return $success;
+ }
+
+ /**
+ * Get the display name of this plugin
+ * @return string
+ */
+ function getDisplayName() {
+ return __('plugins.generic.coins.displayName');
+ }
+
+ /**
+ * Get the description of this plugin
+ * @return string
+ */
+ function getDescription() {
+ return __('plugins.generic.coins.description');
+ }
+
+ /**
+ * Insert COinS tag.
+ */
+ function insertFooter(string $hookName, array $params) : bool
+ {
+ if (!$this->getEnabled()) return false;
+ $request = Application::get()->getRequest();
+
+ // Ensure that the callback is being called from a page COinS should be embedded in.
+ if (!in_array($request->getRequestedPage() . '/' . $request->getRequestedOp(), [
+ 'article/view',
+ ])) return false;
+
+ $smarty =& $params[1];
+ $output =& $params[2];
+ $templateMgr = TemplateManager::getManager($request);
+
+ $article = $templateMgr->getTemplateVars('article');
+ $journal = $templateMgr->getTemplateVars('currentJournal');
+ $issue = $templateMgr->getTemplateVars('issue');
+ $publication = $article->getCurrentPublication();
+
+ $vars = [
+ ['ctx_ver', 'Z39.88-2004'],
+ ['rft_id', $request->url(null, 'article', 'view', $article->getId())],
+ ['rft_val_fmt', 'info:ofi/fmt:kev:mtx:journal'],
+ ['rft.language', $article->getLocale()],
+ ['rft.genre', 'article'],
+ ['rft.title', $journal->getLocalizedName()],
+ ['rft.jtitle', $journal->getLocalizedName()],
+ ['rft.atitle', $article->getFullTitle($article->getLocale())],
+ ['rft.artnum', $article->getBestArticleId()],
+ ['rft.stitle', $journal->getLocalizedSetting('abbreviation')],
+ ['rft.volume', $issue->getVolume()],
+ ['rft.issue', $issue->getNumber()],
+ ];
+
+ $authors = $publication->getData('authors');
+ if ($firstAuthor = $authors->first()) {
+ $vars = array_merge($vars, [
+ ['rft.aulast', $firstAuthor->getFamilyName($article->getLocale())],
+ ['rft.aufirst', $firstAuthor->getGivenName($article->getLocale())],
+ ]);
+ }
+
+ $datePublished = $article->getDatePublished();
+ if (!$datePublished) {
+ $datePublished = $issue->getDatePublished();
+ }
+
+ if ($datePublished) {
+ $vars[] = ['rft.date', date('Y-m-d', strtotime($datePublished))];
+ }
+
+ foreach ($authors as $author) {
+ $vars[] = ['rft.au', $author->getFullName()];
+ }
+
+ if ($doi = $article->getStoredPubId('doi')) {
+ $vars[] = ['rft_id', 'info:doi/' . $doi];
+ }
+ if ($article->getPages()) {
+ $vars[] = ['rft.pages', $article->getPages()];
+ }
+ if ($journal->getSetting('printIssn')) {
+ $vars[] = ['rft.issn', $journal->getSetting('printIssn')];
+ }
+ if ($journal->getSetting('onlineIssn')) {
+ $vars[] = ['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;
+ }
+}
+
diff --git a/index.php b/index.php
deleted file mode 100644
index 06cb604..0000000
--- a/index.php
+++ /dev/null
@@ -1,15 +0,0 @@
-