14 import(
'lib.pkp.classes.plugins.GatewayPlugin');
15 import(
'lib.pkp.classes.site.VersionCheck');
16 import(
'lib.pkp.classes.db.DBResultRange');
17 import(
'lib.pkp.classes.core.ArrayItemIterator');
19 define(
'PLN_PLUGIN_PING_ARTICLE_COUNT', 12);
22 @include_once(
'Archive/Tar.php');
33 parent::__construct();
49 return 'PLNGatewayPlugin';
56 return __(
'plugins.generic.plngateway.displayName');
63 return __(
'plugins.generic.plngateway.description');
80 return $plugin->getPluginPath();
89 return $plugin->getTemplatePath($inCore);
99 return $plugin->getEnabled();
110 $pluginVersionFile = $this->
getPluginPath() . DIRECTORY_SEPARATOR .
'version.xml';
111 $pluginVersion = VersionCheck::parseVersionXml($pluginVersionFile);
112 $templateMgr->assign(
'pluginVersion', $pluginVersion);
115 $termsAccepted = $plugin->termsAgreed($journal->getId());
116 if ($termsAccepted) {
117 $templateMgr->assign(
'termsAccepted',
'yes');
118 $terms = unserialize($plugin->getSetting($journal->getId(),
'terms_of_use'));
119 $termsAgreement = unserialize($plugin->getSetting($journal->getId(),
'terms_of_use_agreement'));
121 $templateMgr->assign(
'termsAccepted',
'no');
125 $products =
$application->getEnabledProducts(
'plugins.generic');
126 $prerequisites = array(
127 'phpVersion' => PHP_VERSION,
128 'zipInstalled' => class_exists(
'ZipArchive') ?
'yes' :
'no',
129 'tarInstalled' => class_exists(
'Archive_Tar') ?
'yes' :
'no',
130 'acron' => isset($products[
'acron']) ?
'yes' :
'no',
133 $templateMgr->assign(
'prerequisites', $prerequisites);
135 $termKeys = array_keys($terms);
136 $termsDisplay = array();
137 foreach ($termKeys as $key) {
138 $termsDisplay[] = array(
140 'term' => $terms[$key][
'term'],
141 'updated' => $terms[$key][
'updated'],
142 'accepted' => $termsAgreement[$key]
148 $ojsVersion = $versionDao->getCurrentVersion();
149 $templateMgr->assign(
'ojsVersion', $ojsVersion->getVersionString());
152 $publications = array();
153 $submissions = $submissionDao->getByContextId($journal->getId());
154 while ($submission = $submissions->next()) {
155 $publication = $submission->getCurrentPublication();
156 if (!$publication || $publication->getData(
'status') != STATUS_PUBLISHED)
continue;
157 $publications[] = $publication;
158 if (
count($publications) == PLN_PLUGIN_PING_ARTICLE_COUNT)
break;
160 $submissions->close();
161 $templateMgr->assign(
'publications', $publications);
162 $templateMgr->assign(
'pln_network', $plugin->getSetting($journal->getId(),
'pln_network'));
164 header(
'Content-Type: text/xml; charset=' .
Config::getVar(
'i18n',
'client_charset'));
165 $templateMgr->display($plugin->getTemplateResource(
'ping.tpl'));