release 0.3 - namespace

This commit is contained in:
Jean-Christian Paul Denis 2023-03-11 20:03:02 +01:00
parent 66fd478a06
commit 45499b0b75
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
13 changed files with 284 additions and 205 deletions

View File

@ -1,4 +1,6 @@
x.x 0.3 - 2023.03.11
- required Dotclear 2.25, up to 2.25.3
- use php namespace
- fix translation - fix translation
0.2 - 2022.12.03 0.2 - 2022.12.03
@ -6,5 +8,5 @@ x.x
- Add Dotclear maximum version compatibility (thanks @Gvx- ) - Add Dotclear maximum version compatibility (thanks @Gvx- )
0.1.1 - 2022.12.03 0.1.1 - 2022.12.03
- Required Dotclear 2.19 - Required Dotclear 2.19, up to 2.23.1
- First release - First release

View File

@ -3,7 +3,7 @@
[![Release](https://img.shields.io/github/v/release/JcDenis/checkStoreVersion)](https://github.com/JcDenis/checkStoreVersion/releases) [![Release](https://img.shields.io/github/v/release/JcDenis/checkStoreVersion)](https://github.com/JcDenis/checkStoreVersion/releases)
[![Date](https://img.shields.io/github/release-date/JcDenis/checkStoreVersion)](https://github.com/JcDenis/checkStoreVersion/releases) [![Date](https://img.shields.io/github/release-date/JcDenis/checkStoreVersion)](https://github.com/JcDenis/checkStoreVersion/releases)
[![Issues](https://img.shields.io/github/issues/JcDenis/checkStoreVersion)](https://github.com/JcDenis/checkStoreVersion/issues) [![Issues](https://img.shields.io/github/issues/JcDenis/checkStoreVersion)](https://github.com/JcDenis/checkStoreVersion/issues)
[![Dotclear](https://img.shields.io/badge/dotclear-v2.19-blue.svg)](https://fr.dotclear.org/download) [![Dotclear](https://img.shields.io/badge/dotclear-v2.25-blue.svg)](https://fr.dotclear.org/download)
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-green.svg)](https://plugins.dotaddict.org/dc2/details/checkStoreVersion) [![Dotaddict](https://img.shields.io/badge/dotaddict-official-green.svg)](https://plugins.dotaddict.org/dc2/details/checkStoreVersion)
[![License](https://img.shields.io/github/license/JcDenis/checkStoreVersion)](https://github.com/JcDenis/checkStoreVersion/blob/master/LICENSE) [![License](https://img.shields.io/github/license/JcDenis/checkStoreVersion)](https://github.com/JcDenis/checkStoreVersion/blob/master/LICENSE)
@ -20,7 +20,7 @@ This plugin check official or third-party repositories of installed plugins or t
_CheckStoreVersion_ requires: _CheckStoreVersion_ requires:
* superadmin permissions * superadmin permissions
* Dotclear 2.19 * Dotclear 2.25
## USAGE ## USAGE

View File

@ -18,13 +18,13 @@ $this->registerModule(
'Check store version', 'Check store version',
'Check plugins and themes available version before update', 'Check plugins and themes available version before update',
'Jean-Christian Denis and Contributors', 'Jean-Christian Denis and Contributors',
'0.2', '0.3',
[ [
'requires' => [['core', '2.19']], 'requires' => [['core', '2.25']],
'permissions' => null, 'permissions' => null,
'type' => 'plugin', 'type' => 'plugin',
'support' => 'https://github.com/JcDenis/checkStoreVersion', 'support' => 'https://github.com/JcDenis/checkStoreVersion',
'details' => 'https://plugins.dotaddict.org/dc2/details/checkStoreVersion', 'details' => 'https://plugins.dotaddict.org/dc2/details/checkStoreVersion',
'repository' => 'https://raw.githubusercontent.com/JcDenis/checkStoreVersion/master/dcstore.xml' 'repository' => 'https://raw.githubusercontent.com/JcDenis/checkStoreVersion/master/dcstore.xml',
] ]
); );

View File

@ -1,19 +0,0 @@
<?php
/**
* @brief checkStoreVersion, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis and Contributors
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
if (!defined('DC_RC_PATH')) {
return null;
}
$__autoload['csvStore'] = dirname(__FILE__) . '/inc/class.csv.store.php';
$__autoload['csvStoreReader'] = dirname(__FILE__) . '/inc/class.csv.store.reader.php';
$__autoload['csvStoreParser'] = dirname(__FILE__) . '/inc/class.csv.store.parser.php';

View File

@ -2,11 +2,11 @@
<modules xmlns:da="http://dotaddict.org/da/"> <modules xmlns:da="http://dotaddict.org/da/">
<module id="checkStoreVersion"> <module id="checkStoreVersion">
<name>Check store version</name> <name>Check store version</name>
<version>0.2</version> <version>0.3</version>
<author>Jean-Christian Denis and Contributors</author> <author>Jean-Christian Denis and Contributors</author>
<desc>Check plugins and themes available version before update</desc> <desc>Check plugins and themes available version before update</desc>
<file>https://github.com/JcDenis/checkStoreVersion/releases/download/v0.2/plugin-checkStoreVersion.zip</file> <file>https://github.com/JcDenis/checkStoreVersion/releases/download/v0.3/plugin-checkStoreVersion.zip</file>
<da:dcmin>2.19</da:dcmin> <da:dcmin>2.25</da:dcmin>
<da:details>https://plugins.dotaddict.org/dc2/details/checkStoreVersion</da:details> <da:details>https://plugins.dotaddict.org/dc2/details/checkStoreVersion</da:details>
<da:support>https://github.com/JcDenis/checkStoreVersion</da:support> <da:support>https://github.com/JcDenis/checkStoreVersion</da:support>
</module> </module>

23
locales/fr/main.lang.php Normal file
View File

@ -0,0 +1,23 @@
<?php
/**
* @package Dotclear
*
* @copyright Olivier Meunier & Association Dotclear
* @copyright GPL-2.0-only
*/
#
# DOT NOT MODIFY THIS FILE !
#
l10n::$locales['Store version'] = 'Version de dépôt';
l10n::$locales['Check stores versions'] = 'Vérifier les version sur les dépôts';
l10n::$locales['This version does not support Dotclear > %s'] = 'Cette version ne supporte pas Dotclear > %s';
l10n::$locales['There is no module to check'] = 'Il n\'y a pas de module à vérifier';
l10n::$locales['Check lastest stores versions'] = 'Vérifier les dernières versions sur les dépôts';
l10n::$locales['Modules list'] = 'Liste des modules';
l10n::$locales['Latest version'] = 'Dernière version';
l10n::$locales['Written for Dotclear'] = 'Ecrit pour Dotclear';
l10n::$locales['No version available'] = 'Aucune version disponible';
l10n::$locales['No update available'] = 'Aucune mise à jour disponible';
l10n::$locales['Newer version available'] = 'Une nouvelle version disponible';
l10n::$locales['No version available on stores'] = 'Aucune version disponible sur les dépôts';

View File

@ -3,7 +3,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Project-Id-Version: checkStoreVersion 0.2\n" "Project-Id-Version: checkStoreVersion 0.2\n"
"POT-Creation-Date: \n" "POT-Creation-Date: \n"
"PO-Revision-Date: 2022-12-03T19:31:22+00:00\n" "PO-Revision-Date: 2023-03-11T18:50:59+00:00\n"
"Last-Translator: Jean-Christian Denis\n" "Last-Translator: Jean-Christian Denis\n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"

44
src/Backend.php Normal file
View File

@ -0,0 +1,44 @@
<?php
/**
* @brief checkStoreVersion, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis and Contributors
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
declare(strict_types=1);
namespace Dotclear\Plugin\checkStoreVersion;
use dcCore;
use dcNsProcess;
class Backend extends dcNsProcess
{
public static function init(): bool
{
if (defined('DC_CONTEXT_ADMIN')) {
self::$init = dcCore::app()->auth->isSuperAdmin();
}
return self::$init;
}
public static function process(): bool
{
if (!self::$init) {
return false;
}
dcCore::app()->addBehaviors([
'pluginsToolsTabsV2' => [BackendBehaviors::class, 'pluginTabs'],
'themesToolsTabsV2' => [BackendBehaviors::class, 'themesTabs'],
]);
return true;
}
}

View File

@ -10,46 +10,44 @@
* @copyright Jean-Christian Denis * @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/ */
if (!defined('DC_CONTEXT_ADMIN')) { declare(strict_types=1);
return null;
}
# only superadmin namespace Dotclear\Plugin\checkStoreVersion;
if (!$core->auth->isSuperAdmin()) {
return null;
}
# admin behaviors use dcAdminHelper;
$core->addBehavior('pluginsToolsTabs', ['csvBehaviors', 'pluginsToolsTabs']); use dcCore;
$core->addBehavior('themesToolsTabs', ['csvBehaviors', 'themesToolsTabs']); use dcModules;
use dcPage;
use dcUtils;
use html;
class csvBehaviors class BackendBehaviors
{ {
public const DC_MAX = '2.23.1';
# admin plugins page tab # admin plugins page tab
public static function pluginsToolsTabs(dcCore $core): void public static function pluginsToolsTabs(): void
{ {
self::modulesToolsTabs($core, $core->plugins, explode(',', DC_DISTRIB_PLUGINS), $core->adminurl->get('admin.plugins')); self::modulesToolsTabs(dcCore::app()->plugins, explode(',', DC_DISTRIB_PLUGINS), dcCore::app()->adminurl->get('admin.plugins'));
} }
# admin themes page tab # admin themes page tab
public static function themesToolsTabs(dcCore $core): void public static function themesToolsTabs(): void
{ {
self::modulesToolsTabs($core, $core->themes, explode(',', DC_DISTRIB_THEMES), $core->adminurl->get('admin.blog.theme')); self::modulesToolsTabs(dcCore::app()->themes, explode(',', DC_DISTRIB_THEMES), dcCore::app()->adminurl->get('admin.blog.theme'));
} }
# generic page tab # generic page tab
private static function modulesToolsTabs(dcCore $core, dcModules $modules, array $excludes, string $page_url): void private static function modulesToolsTabs(dcModules $modules, array $excludes, string $page_url): void
{ {
$repos = empty($_POST['csvcheck']) ? null :
(new CsvStore($modules, (string) dcCore::app()->blog->settings->get('system')->get('store_plugin_url'), true))->get(true);
echo echo
'<div class="multi-part" id="csv" title="' . __('Store version') . '">' . '<div class="multi-part" id="csv" title="' . __('Store version') . '">' .
'<h3>' . __('Check stores versions') . '</h3>'; '<h3>' . __('Check stores versions') . '</h3>';
if (!method_exists('dcUtils', 'versionsCompare') if (dcUtils::versionsCompare(DC_VERSION, My::DC_MAX, '>', false)) {
|| dcUtils::versionsCompare(DC_VERSION, self::DC_MAX, '>', false)) {
echo echo
'<div class="error"><p>' . sprintf(__('This version does not support Dotclear > %s'), self::DC_MAX) . '</p></div>'; '<div class="error"><p>' . sprintf(__('This version does not support Dotclear > %s'), My::DC_MAX) . '</p></div>';
return; return;
} }
@ -72,12 +70,11 @@ class csvBehaviors
echo echo
'<form method="post" action="' . $page_url . '#csv" id="csvform">' . '<form method="post" action="' . $page_url . '#csv" id="csvform">' .
'<p><input type="submit" name="csvcheck" value="' . __('Check lastest stores versions') . '" />' . '<p><input type="submit" name="csvcheck" value="' . __('Check lastest stores versions') . '" />' .
$core->formNonce() . '</p>' . dcCore::app()->formNonce() . '</p>' .
'</form>'; '</form>';
if (!empty($_POST['csvcheck'])) { if ($repos !== null) {
$store = new csvStore($modules, dcCore::app()->blog->settings->system->store_plugin_url, true); self::modulesList($list, $repos);
self::modulesList($list, $store->get(true));
} }
echo echo
@ -86,7 +83,7 @@ class csvBehaviors
private static function modulesList($modules, $repos) private static function modulesList($modules, $repos)
{ {
echo echo
'<div class="table-outer">' . '<div class="table-outer">' .
'<table id="mvmodules" class="modules">' . '<table id="mvmodules" class="modules">' .
'<caption class="hidden">' . html::escapeHTML(__('Modules list')) . '</caption><tr>' . '<caption class="hidden">' . html::escapeHTML(__('Modules list')) . '</caption><tr>' .
@ -101,7 +98,6 @@ class csvBehaviors
} }
foreach ($modules as $id => $module) { foreach ($modules as $id => $module) {
if (!isset($repos[$id])) { if (!isset($repos[$id])) {
$img = [__('No version available'), 'check-off.png']; $img = [__('No version available'), 'check-off.png'];
} elseif (isset($repos[$id]) && dcUtils::versionsCompare(DC_VERSION, $repos[$id]['dc_min'], '>=', false)) { } elseif (isset($repos[$id]) && dcUtils::versionsCompare(DC_VERSION, $repos[$id]['dc_min'], '>=', false)) {
@ -131,37 +127,37 @@ class csvBehaviors
echo echo
'<tr class="line' . (isset($repos[$id]) ? '' : ' offline') . '" id="mvmodules_m_' . html::escapeHTML($id) . '">' . '<tr class="line' . (isset($repos[$id]) ? '' : ' offline') . '" id="mvmodules_m_' . html::escapeHTML($id) . '">' .
'<td class="module-icon nowrap">' . '<td class="module-icon nowrap">' .
$img . '</td>' . $img . '</td>' .
'<td class="module-icon nowrap">' . '<td class="module-icon nowrap">' .
dcAdminHelper::adminIcon($icon, false, html::escapeHTML($id), html::escapeHTML($id)) . '</td>' . dcAdminHelper::adminIcon($icon, false, html::escapeHTML($id), html::escapeHTML($id)) . '</td>' .
'<th class="module-name nowrap" scope="row">' . '<th class="module-name nowrap" scope="row">' .
html::escapeHTML($module['name']) . ($id != $module['name'] ? sprintf(__(' (%s)'), $id) : '') . html::escapeHTML($module['name']) . ($id != $module['name'] ? sprintf(__(' (%s)'), $id) : '') .
'</td>'; '</td>';
if (isset($repos[$id])) { if (isset($repos[$id])) {
echo echo
'<td class="module-version nowrap count">' . '<td class="module-version nowrap count">' .
html::escapeHTML($repos[$id]['current_version']) . '</td>' . html::escapeHTML($repos[$id]['current_version']) . '</td>' .
'<td class="module-version nowrap count maximal">' . '<td class="module-version nowrap count maximal">' .
html::escapeHTML($repos[$id]['version']) . '</td>' . html::escapeHTML($repos[$id]['version']) . '</td>' .
'<td class="module-version nowrap count">' . '<td class="module-version nowrap count">' .
html::escapeHTML($repos[$id]['dc_min']) . '</td>'; html::escapeHTML($repos[$id]['dc_min']) . '</td>';
if (DC_ALLOW_REPOSITORIES) { if (DC_ALLOW_REPOSITORIES) {
echo echo
'<td class="module-repository nowrap count">' . '<td class="module-repository nowrap count">' .
(empty($module['repository']) ? __('Official repository') : __('Third-party repository')) . '</td>'; (empty($module['repository']) ? __('Official repository') : __('Third-party repository')) . '</td>';
} }
} else { } else {
echo echo
'<td class="module-current-version nowrap count">' . '<td class="module-current-version nowrap count">' .
html::escapeHTML($module['version']) . '</td>' . html::escapeHTML($module['version']) . '</td>' .
'<td class="module-version nowrap count maximal" colspan="' . (DC_ALLOW_REPOSITORIES ? '3' : '2') . '">' . '<td class="module-version nowrap count maximal" colspan="' . (DC_ALLOW_REPOSITORIES ? '3' : '2') . '">' .
html::escapeHTML(__('No version available on stores')) . '</td>'; html::escapeHTML(__('No version available on stores')) . '</td>';
} }
echo echo
'</tr>'; '</tr>';
} }

View File

@ -10,73 +10,78 @@
* @copyright Jean-Christian Denis * @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/ */
if (!defined('DC_RC_PATH')) { declare(strict_types=1);
return null;
} namespace Dotclear\Plugin\checkStoreVersion;
class csvStore extends dcStore use dcStore;
{ use dcUtils;
# overwrite dcStore::check to remove cache and use csvStoreReader and check disabled modules use Exception;
public function check($force = true) use http;
{
if (!$this->xml_url) { class CsvStore extends dcStore
return false; {
} # overwrite dcStore::check to remove cache and use csvStoreReader and check disabled modules
public function check(bool $force = true): bool
try { {
$parser = DC_STORE_NOT_UPDATE ? false : csvStoreReader::quickParse($this->xml_url, DC_TPL_CACHE, $force); if (!$this->xml_url) {
} catch (Exception $e) { return false;
return false; }
}
try {
$raw_datas = !$parser ? [] : $parser->getModules(); $parser = DC_STORE_NOT_UPDATE ? false : CsvStoreReader::quickParse($this->xml_url, DC_TPL_CACHE, $force);
} catch (Exception $e) {
uasort($raw_datas, fn ($a, $b) => strtolower($a['id']) <=> strtolower($b['id'])); return false;
}
$updates = [];
$current = array_merge($this->modules->getModules(), $this->modules->getDisabledModules()); $raw_datas = !$parser ? [] : $parser->getModules();
foreach ($current as $p_id => $p_infos) {
# non privileged user has no info uasort($raw_datas, fn ($a, $b) => strtolower($a['id']) <=> strtolower($b['id']));
if (!is_array($p_infos)) {
continue; $updates = [];
} $current = array_merge($this->modules->getModules(), $this->modules->getDisabledModules());
# main repository foreach ($current as $p_id => $p_infos) {
if (isset($raw_datas[$p_id])) { # non privileged user has no info
if (dcUtils::versionsCompare($raw_datas[$p_id]['version'], $p_infos['version'], '>=')) { if (!is_array($p_infos)) {
$updates[$p_id] = $raw_datas[$p_id]; continue;
$updates[$p_id]['root'] = $p_infos['root']; }
$updates[$p_id]['root_writable'] = $p_infos['root_writable']; # main repository
$updates[$p_id]['current_version'] = $p_infos['version']; if (isset($raw_datas[$p_id])) {
} if (dcUtils::versionsCompare($raw_datas[$p_id]['version'], $p_infos['version'], '>=')) {
unset($raw_datas[$p_id]); $updates[$p_id] = $raw_datas[$p_id];
} $updates[$p_id]['root'] = $p_infos['root'];
# per module third-party repository $updates[$p_id]['root_writable'] = $p_infos['root_writable'];
if (!empty($p_infos['repository']) && DC_ALLOW_REPOSITORIES) { $updates[$p_id]['current_version'] = $p_infos['version'];
try { }
$dcs_url = substr($p_infos['repository'], -12, 12) == '/dcstore.xml' ? $p_infos['repository'] : http::concatURL($p_infos['repository'], 'dcstore.xml'); unset($raw_datas[$p_id]);
$dcs_parser = csvStoreReader::quickParse($dcs_url, DC_TPL_CACHE, $force); }
if ($dcs_parser !== false) { # per module third-party repository
$dcs_raw_datas = $dcs_parser->getModules(); if (!empty($p_infos['repository']) && DC_ALLOW_REPOSITORIES) {
if (isset($dcs_raw_datas[$p_id]) && dcUtils::versionsCompare($dcs_raw_datas[$p_id]['version'], $p_infos['version'], '>=')) { try {
if (!isset($updates[$p_id]) || dcUtils::versionsCompare($dcs_raw_datas[$p_id]['version'], $updates[$p_id]['version'], '>=')) { $dcs_url = substr($p_infos['repository'], -12, 12) == '/dcstore.xml' ? $p_infos['repository'] : http::concatURL($p_infos['repository'], 'dcstore.xml');
$dcs_raw_datas[$p_id]['repository'] = true; $dcs_parser = CsvStoreReader::quickParse($dcs_url, DC_TPL_CACHE, $force);
$updates[$p_id] = $dcs_raw_datas[$p_id]; if ($dcs_parser !== false) {
$updates[$p_id]['root'] = $p_infos['root']; $dcs_raw_datas = $dcs_parser->getModules();
$updates[$p_id]['root_writable'] = $p_infos['root_writable']; if (isset($dcs_raw_datas[$p_id]) && dcUtils::versionsCompare($dcs_raw_datas[$p_id]['version'], $p_infos['version'], '>=')) {
$updates[$p_id]['current_version'] = $p_infos['version']; if (!isset($updates[$p_id]) || dcUtils::versionsCompare($dcs_raw_datas[$p_id]['version'], $updates[$p_id]['version'], '>=')) {
} $dcs_raw_datas[$p_id]['repository'] = true;
} $updates[$p_id] = $dcs_raw_datas[$p_id];
} $updates[$p_id]['root'] = $p_infos['root'];
} catch (Exception $e) { $updates[$p_id]['root_writable'] = $p_infos['root_writable'];
} $updates[$p_id]['current_version'] = $p_infos['version'];
} }
} }
}
$this->data = [ } catch (Exception $e) {
'new' => [], }
'update' => $updates, }
]; }
return true; $this->data = [
} 'new' => [],
} 'update' => $updates,
];
return true;
}
}

View File

@ -10,48 +10,50 @@
* @copyright Jean-Christian Denis * @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/ */
if (!defined('DC_RC_PATH')) { declare(strict_types=1);
return null;
} namespace Dotclear\Plugin\checkStoreVersion;
class csvStoreParser extends dcStoreParser use dcStoreParser;
{
# overwrite dcStoreParser to bypasse current dotclear version class CsvStoreParser extends dcStoreParser
protected function _parse() {
{ # overwrite dcStoreParser to bypasse current dotclear version
if (empty($this->xml->module)) { protected function _parse()
return; {
} if (empty($this->xml->module)) {
return;
foreach ($this->xml->module as $i) { }
$attrs = $i->attributes();
foreach ($this->xml->module as $i) {
$item = []; $attrs = $i->attributes();
# DC/DA shared markers $item = [];
$item['id'] = (string) $attrs['id'];
$item['file'] = (string) $i->file; # DC/DA shared markers
$item['label'] = (string) $i->name; // deprecated $item['id'] = (string) $attrs['id'];
$item['name'] = (string) $i->name; $item['file'] = (string) $i->file;
$item['version'] = (string) $i->version; $item['label'] = (string) $i->name; // deprecated
$item['author'] = (string) $i->author; $item['name'] = (string) $i->name;
$item['desc'] = (string) $i->desc; $item['version'] = (string) $i->version;
$item['author'] = (string) $i->author;
# DA specific markers $item['desc'] = (string) $i->desc;
$item['dc_min'] = (string) $i->children(self::$bloc)->dcmin;
$item['details'] = (string) $i->children(self::$bloc)->details; # DA specific markers
$item['section'] = (string) $i->children(self::$bloc)->section; $item['dc_min'] = (string) $i->children(self::$bloc)->dcmin;
$item['support'] = (string) $i->children(self::$bloc)->support; $item['details'] = (string) $i->children(self::$bloc)->details;
$item['sshot'] = (string) $i->children(self::$bloc)->sshot; $item['section'] = (string) $i->children(self::$bloc)->section;
$item['support'] = (string) $i->children(self::$bloc)->support;
$tags = []; $item['sshot'] = (string) $i->children(self::$bloc)->sshot;
foreach ($i->children(self::$bloc)->tags as $t) {
$tags[] = (string) $t->tag; $tags = [];
} foreach ($i->children(self::$bloc)->tags as $t) {
$item['tags'] = implode(', ', $tags); $tags[] = (string) $t->tag;
}
# No more filters here, return all modules $item['tags'] = implode(', ', $tags);
$this->items[$item['id']] = $item;
} # No more filters here, return all modules
} $this->items[$item['id']] = $item;
} }
}
}

View File

@ -10,25 +10,31 @@
* @copyright Jean-Christian Denis * @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/ */
class csvStoreReader extends dcStoreReader declare(strict_types=1);
{
# overwrite dcStoreReader to remove cache and use mvStoreParser namespace Dotclear\Plugin\checkStoreVersion;
public function parse($url)
{ use dcStoreReader;
$this->validators = [];
class CsvStoreReader extends dcStoreReader
if (!$this->getModulesXML($url) || $this->getStatus() != '200') { {
return false; # overwrite dcStoreReader to remove cache and use mvStoreParser
} public function parse($url)
{
return new csvStoreParser($this->getContent()); $this->validators = [];
}
if (!$this->getModulesXML($url) || $this->getStatus() != '200') {
# overwrite dcStoreReader to remove cache and use mvStoreParser return false;
public static function quickParse($url, $cache_dir = null, $force = true) }
{
$parser = new self(); return new CsvStoreParser($this->getContent());
}
return $parser->parse($url);
} # overwrite dcStoreReader to remove cache and use mvStoreParser
} public static function quickParse($url, $cache_dir = null, $force = true)
{
$parser = new self();
return $parser->parse($url);
}
}

20
src/My.php Normal file
View File

@ -0,0 +1,20 @@
<?php
/**
* @brief checkStoreVersion, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis and Contributors
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
declare(strict_types=1);
namespace Dotclear\Plugin\checkStoreVersion;
class My
{
public const DC_MAX = '2.25.3';
}