17 import(
'lib.pkp.classes.plugins.GalleryPlugin');
19 define(
'PLUGIN_GALLERY_XML_URL',
'https://pkp.sfu.ca/ojs/xml/plugins.xml');
32 $doc = $this->_getDocument();
34 foreach ($doc->getElementsByTagName(
'plugin') as $element) {
40 ($category ==
'' || $category == PLUGIN_GALLERY_ALL_CATEGORY_SEARCH_VALUE || $plugin->getCategory() == $category) &&
53 private function _getDocument() {
54 $doc =
new DOMDocument(
'1.0');
56 $response = $client->request(
'GET', PLUGIN_GALLERY_XML_URL);
57 $doc->loadXML($response->getBody());
78 $plugin->setCategory($element->getAttribute(
'category'));
79 $plugin->setProduct($element->getAttribute(
'product'));
80 $doc = $element->ownerDocument;
81 $foundRelease =
false;
82 for ($n = $element->firstChild; $n; $n=$n->nextSibling) {
83 if (!is_a($n,
'DOMElement'))
continue;
84 switch ($n->tagName) {
86 $plugin->setName($n->nodeValue, $n->getAttribute(
'locale'));
89 $plugin->setHomepage($n->nodeValue);
92 $plugin->setDescription($n->nodeValue, $n->getAttribute(
'locale'));
95 $plugin->setInstallationInstructions($n->nodeValue, $n->getAttribute(
'locale'));
98 $plugin->setSummary($n->nodeValue, $n->getAttribute(
'locale'));
113 if (!$foundRelease) {
126 for ($n = $element->firstChild; $n; $n=$n->nextSibling) {
127 if (!is_a($n,
'DOMElement'))
continue;
128 switch ($n->tagName) {
130 $plugin->setContactName($n->nodeValue);
133 $plugin->setContactInstitutionName($n->nodeValue);
136 $plugin->setContactEmail($n->nodeValue);
153 'date' => strtotime($element->getAttribute(
'date')),
154 'version' => $element->getAttribute(
'version'),
155 'md5' => $element->getAttribute(
'md5'),
159 for ($n = $element->firstChild; $n; $n=$n->nextSibling) {
160 if (!is_a($n,
'DOMElement'))
continue;
161 switch ($n->tagName) {
163 $release[$n->tagName][$n->getAttribute(
'locale')] = $n->nodeValue;
166 $release[
'package'] = $n->nodeValue;
168 case 'compatibility':
175 case 'certification':
176 $release[$n->tagName][] = $n->getAttribute(
'type');
184 if ($compatible && (!$plugin->getData(
'version') || version_compare($plugin->getData(
'version'), $release[
'version'],
'<'))) {
187 $plugin->setDate($release[
'date']);
188 $plugin->setVersion($release[
'version']);
189 $plugin->setReleaseMD5($release[
'md5']);
190 $plugin->setReleaseDescription($release[
'description']);
191 $plugin->setReleaseCertifications($release[
'certification']);
192 $plugin->setReleasePackage($release[
'package']);
208 if ($element->getAttribute(
'application')!=
$application->getName())
return false;
210 for ($n = $element->firstChild; $n; $n=$n->nextSibling) {
211 if (!is_a($n,
'DOMElement'))
continue;
212 switch ($n->tagName) {
215 if ($installedVersion->compare($n->nodeValue)==0) {