Compare commits
No commits in common. "6dd3f2b4ba2a710db4fde82099f0a9729160fa76" and "79f41ea79bbd56799cce72bd05208b60ee8db963" have entirely different histories.
6dd3f2b4ba
...
79f41ea79b
11
CHANGELOG.md
11
CHANGELOG.md
|
@ -1,14 +1,3 @@
|
||||||
2023.05.13
|
|
||||||
- require dotclear 2.26
|
|
||||||
- release for dotclear 2.26 stable
|
|
||||||
|
|
||||||
2023.04.23
|
|
||||||
- require dotclear 2.26
|
|
||||||
- use latest dotclear namespace
|
|
||||||
- add plugin Uninstaller features
|
|
||||||
- remove magic
|
|
||||||
- fix nullsafe warnings
|
|
||||||
|
|
||||||
2023.03.26
|
2023.03.26
|
||||||
- require dotclear 2.26
|
- require dotclear 2.26
|
||||||
- use namespace
|
- use namespace
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
* @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') || is_null(dcCore::app()->auth)) {
|
if (!defined('DC_RC_PATH')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,12 +18,12 @@ $this->registerModule(
|
||||||
"Dotclear's latest versions",
|
"Dotclear's latest versions",
|
||||||
'Show the latest available versions of Dotclear',
|
'Show the latest available versions of Dotclear',
|
||||||
'Jean-Christian Denis, Pierre Van Glabeke',
|
'Jean-Christian Denis, Pierre Van Glabeke',
|
||||||
'2023.05.13',
|
'2023.03.26',
|
||||||
[
|
[
|
||||||
'requires' => [['core', '2.26']],
|
'requires' => [['core', '2.26']],
|
||||||
'permissions' => dcCore::app()->auth->makePermissions([
|
'permissions' => dcCore::app()->auth->makePermissions([
|
||||||
dcCore::app()->auth::PERMISSION_USAGE,
|
dcAuth::PERMISSION_USAGE,
|
||||||
dcCore::app()->auth::PERMISSION_CONTENT_ADMIN,
|
dcAuth::PERMISSION_CONTENT_ADMIN,
|
||||||
]),
|
]),
|
||||||
'type' => 'plugin',
|
'type' => 'plugin',
|
||||||
'support' => 'http://forum.dotclear.org/viewforum.php?id=16',
|
'support' => 'http://forum.dotclear.org/viewforum.php?id=16',
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
<modules xmlns:da="http://dotaddict.org/da/">
|
<modules xmlns:da="http://dotaddict.org/da/">
|
||||||
<module id="dcLatestVersions">
|
<module id="dcLatestVersions">
|
||||||
<name>Dotclear's latest versions</name>
|
<name>Dotclear's latest versions</name>
|
||||||
<version>2023.05.13</version>
|
<version>2023.03.26</version>
|
||||||
<author>Jean-Christian Denis, Pierre Van Glabeke</author>
|
<author>Jean-Christian Denis, Pierre Van Glabeke</author>
|
||||||
<desc>Show the latest available versions of Dotclear</desc>
|
<desc>Show the latest available versions of Dotclear</desc>
|
||||||
<file>https://github.com/JcDenis/dcLatestVersions/releases/download/v2023.05.13/plugin-dcLatestVersions.zip</file>
|
<file>https://github.com/JcDenis/dcLatestVersions/releases/download/v2023.03.26/plugin-dcLatestVersions.zip</file>
|
||||||
<da:dcmin>2.26</da:dcmin>
|
<da:dcmin>2.26</da:dcmin>
|
||||||
<da:details>http://plugins.dotaddict.org/dc2/details/dcLatestVersions</da:details>
|
<da:details>http://plugins.dotaddict.org/dc2/details/dcLatestVersions</da:details>
|
||||||
<da:support>http://forum.dotclear.org/viewforum.php?id=16</da:support>
|
<da:support>http://forum.dotclear.org/viewforum.php?id=16</da:support>
|
||||||
|
|
|
@ -9,11 +9,9 @@
|
||||||
# DOT NOT MODIFY THIS FILE !
|
# DOT NOT MODIFY THIS FILE !
|
||||||
#
|
#
|
||||||
|
|
||||||
use Dotclear\Helper\L10n;
|
l10n::$locales['Download Dotclear %s'] = 'Télécharger Dotclear %s';
|
||||||
|
l10n::$locales['Dotclear\'s latest versions'] = 'Dernières versions de Dotclear';
|
||||||
L10n::$locales['Download Dotclear %s'] = 'Télécharger Dotclear %s';
|
l10n::$locales['Show Dotclear\'s latest versions on dashboards.'] = 'Afficher les dernières versions de Dotclear sur le tableau de bord';
|
||||||
L10n::$locales['Dotclear\'s latest versions'] = 'Dernières versions de Dotclear';
|
l10n::$locales['Show the latest available versions of Dotclear'] = 'Afficher les dernières versions disponibles de Dotclear';
|
||||||
L10n::$locales['Show Dotclear\'s latest versions on dashboards.'] = 'Afficher les dernières versions de Dotclear sur le tableau de bord';
|
l10n::$locales['Text (%r = release, %v = version, %u = url):'] = 'Texte (%r = type, %v = version, %u = url) :';
|
||||||
L10n::$locales['Show the latest available versions of Dotclear'] = 'Afficher les dernières versions disponibles de Dotclear';
|
l10n::$locales['<strong>%r: </strong> <a href="%u" title="Download Dotclear %v">%v</a>'] = '<strong>%r : </strong> <a href="%u" title="Télécharger Dotclear %v">%v</a>';
|
||||||
L10n::$locales['Text (%r = release, %v = version, %u = url):'] = 'Texte (%r = type, %v = version, %u = url) :';
|
|
||||||
L10n::$locales['<strong>%r: </strong> <a href="%u" title="Download Dotclear %v">%v</a>'] = '<strong>%r : </strong> <a href="%u" title="Télécharger Dotclear %v">%v</a>';
|
|
||||||
|
|
|
@ -43,11 +43,6 @@ class Backend extends dcNsProcess
|
||||||
dcCore::app()->addBehaviors([
|
dcCore::app()->addBehaviors([
|
||||||
'initWidgets' => [Widgets::class, 'initWidgets'],
|
'initWidgets' => [Widgets::class, 'initWidgets'],
|
||||||
'adminDashboardItemsV2' => function (ArrayObject $__dashboard_items): void {
|
'adminDashboardItemsV2' => function (ArrayObject $__dashboard_items): void {
|
||||||
// nullsafe PHP < 8.0
|
|
||||||
if (is_null(dcCore::app()->auth) || is_null(dcCore::app()->auth->user_prefs) || is_null(dcCore::app()->blog)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!dcCore::app()->auth->user_prefs->get('dashboard')->get('dcLatestVersionsItems')) {
|
if (!dcCore::app()->auth->user_prefs->get('dashboard')->get('dcLatestVersionsItems')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -97,11 +92,6 @@ class Backend extends dcNsProcess
|
||||||
},
|
},
|
||||||
|
|
||||||
'adminDashboardOptionsFormV2' => function (): void {
|
'adminDashboardOptionsFormV2' => function (): void {
|
||||||
// nullsafe PHP < 8.0
|
|
||||||
if (is_null(dcCore::app()->auth) || is_null(dcCore::app()->auth->user_prefs)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!dcCore::app()->auth->user_prefs->get('dashboard')->prefExists('dcLatestVersionsItems')) {
|
if (!dcCore::app()->auth->user_prefs->get('dashboard')->prefExists('dcLatestVersionsItems')) {
|
||||||
dcCore::app()->auth->user_prefs->get('dashboard')->put(
|
dcCore::app()->auth->user_prefs->get('dashboard')->put(
|
||||||
'dcLatestVersionsItems',
|
'dcLatestVersionsItems',
|
||||||
|
@ -113,24 +103,14 @@ class Backend extends dcNsProcess
|
||||||
echo
|
echo
|
||||||
'<div class="fieldset">' .
|
'<div class="fieldset">' .
|
||||||
'<h4>' . Html::escapeHTML(My::name()) . '</h4>' .
|
'<h4>' . Html::escapeHTML(My::name()) . '</h4>' .
|
||||||
(new Para())
|
(new Para())->items([
|
||||||
->__call('items', [[
|
(new Checkbox('dcLatestVersionsItems', (bool) dcCore::app()->auth->user_prefs->get('dashboard')->get('dcLatestVersionsItems')))->value(1),
|
||||||
(new Checkbox('dcLatestVersionsItems', (bool) dcCore::app()->auth->user_prefs->get('dashboard')->get('dcLatestVersionsItems')))
|
(new Label(__("Show Dotclear's latest versions on dashboards."), Label::OUTSIDE_LABEL_AFTER))->for('dcLatestVersionsItems')->class('classic'),
|
||||||
->__call('value', [1]),
|
])->render() .
|
||||||
(new Label(__("Show Dotclear's latest versions on dashboards."), Label::OUTSIDE_LABEL_AFTER))
|
|
||||||
->__call('for', ['dcLatestVersionsItems'])
|
|
||||||
->__call('class', ['classic']),
|
|
||||||
]])
|
|
||||||
->render() .
|
|
||||||
'</div>';
|
'</div>';
|
||||||
},
|
},
|
||||||
|
|
||||||
'adminAfterDashboardOptionsUpdate' => function (?string $user_id): void {
|
'adminAfterDashboardOptionsUpdate' => function (?string $user_id): void {
|
||||||
// nullsafe PHP < 8.0
|
|
||||||
if (is_null(dcCore::app()->auth) || is_null(dcCore::app()->auth->user_prefs)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
dcCore::app()->auth->user_prefs->get('dashboard')->put(
|
dcCore::app()->auth->user_prefs->get('dashboard')->put(
|
||||||
'dcLatestVersionsItems',
|
'dcLatestVersionsItems',
|
||||||
!empty($_POST['dcLatestVersionsItems']),
|
!empty($_POST['dcLatestVersionsItems']),
|
||||||
|
|
|
@ -33,11 +33,6 @@ class Install extends dcNsProcess
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// nullsafe PHP < 8.0
|
|
||||||
if (is_null(dcCore::app()->blog)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
dcCore::app()->blog->settings->get(My::id())->put(
|
dcCore::app()->blog->settings->get(My::id())->put(
|
||||||
'builds',
|
'builds',
|
||||||
'stable,unstable,testing',
|
'stable,unstable,testing',
|
||||||
|
|
18
src/My.php
18
src/My.php
|
@ -17,12 +17,12 @@ namespace Dotclear\Plugin\dcLatestVersions;
|
||||||
use dcCore;
|
use dcCore;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This module definitions.
|
* Plugin definitions
|
||||||
*/
|
*/
|
||||||
class My
|
class My
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* This module id.
|
* This module id
|
||||||
*/
|
*/
|
||||||
public static function id(): string
|
public static function id(): string
|
||||||
{
|
{
|
||||||
|
@ -30,20 +30,10 @@ class My
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This module name.
|
* This module name
|
||||||
*/
|
*/
|
||||||
public static function name(): string
|
public static function name(): string
|
||||||
{
|
{
|
||||||
$name = dcCore::app()->plugins->moduleInfo(self::id(), 'name');
|
return __((string) dcCore::app()->plugins->moduleInfo(self::id(), 'name'));
|
||||||
|
|
||||||
return __(is_string($name) ? $name : self::id());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This module path.
|
|
||||||
*/
|
|
||||||
public static function path(): string
|
|
||||||
{
|
|
||||||
return dirname(__DIR__);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,82 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* @brief dcLatestVersions, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Jean-Christian Denis, Pierre Van Glabeke
|
|
||||||
*
|
|
||||||
* @copyright Jean-Christian Denis
|
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Dotclear\Plugin\dcLatestVersions;
|
|
||||||
|
|
||||||
use dcCore;
|
|
||||||
use dcNsProcess;
|
|
||||||
use Dotclear\Plugin\Uninstaller\Uninstaller;
|
|
||||||
|
|
||||||
class Uninstall extends dcNsProcess
|
|
||||||
{
|
|
||||||
public static function init(): bool
|
|
||||||
{
|
|
||||||
static::$init = defined('DC_CONTEXT_ADMIN');
|
|
||||||
|
|
||||||
return static::$init;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function process(): bool
|
|
||||||
{
|
|
||||||
if (!static::$init || !dcCore::app()->plugins->moduleExists('Uninstaller')) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Uninstaller::instance()
|
|
||||||
->addUserAction(
|
|
||||||
'settings',
|
|
||||||
'delete_all',
|
|
||||||
My::id()
|
|
||||||
)
|
|
||||||
->addUserAction(
|
|
||||||
'preferences',
|
|
||||||
'delete_related',
|
|
||||||
'dashboard:dcLatestVersionsItems'
|
|
||||||
)
|
|
||||||
->addUserAction(
|
|
||||||
'plugins',
|
|
||||||
'delete',
|
|
||||||
My::id()
|
|
||||||
)
|
|
||||||
->addUserAction(
|
|
||||||
'versions',
|
|
||||||
'delete',
|
|
||||||
My::id()
|
|
||||||
)
|
|
||||||
->addDirectAction(
|
|
||||||
'settings',
|
|
||||||
'delete_all',
|
|
||||||
My::id()
|
|
||||||
)
|
|
||||||
->addDirectAction(
|
|
||||||
'preferences',
|
|
||||||
'delete_related',
|
|
||||||
'dashboard:dcLatestVersionsItems'
|
|
||||||
)
|
|
||||||
->addDirectAction(
|
|
||||||
'plugins',
|
|
||||||
'delete',
|
|
||||||
My::id()
|
|
||||||
)
|
|
||||||
->addDirectAction(
|
|
||||||
'versions',
|
|
||||||
'delete',
|
|
||||||
My::id()
|
|
||||||
)
|
|
||||||
;
|
|
||||||
|
|
||||||
// no custom action
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -49,12 +49,7 @@ class Widgets
|
||||||
|
|
||||||
public static function parseWidget(WidgetsElement $w): string
|
public static function parseWidget(WidgetsElement $w): string
|
||||||
{
|
{
|
||||||
if ($w->__get('offline') || !$w->checkHomeOnly(dcCore::app()->url->type) || $w->__get('text') == '') {
|
if ($w->offline || !$w->checkHomeOnly(dcCore::app()->url->type) || $w->text == '') {
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
// nullsafe PHP < 8.0
|
|
||||||
if (is_null(dcCore::app()->blog)) {
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +88,7 @@ class Widgets
|
||||||
$updater->getVersion(),
|
$updater->getVersion(),
|
||||||
$updater->getFileURL(),
|
$updater->getFileURL(),
|
||||||
],
|
],
|
||||||
$w->__get('text')
|
$w->text
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,10 +98,10 @@ class Widgets
|
||||||
|
|
||||||
# Display
|
# Display
|
||||||
return $w->renderDiv(
|
return $w->renderDiv(
|
||||||
(bool) $w->__get('content_only'),
|
(bool) $w->content_only,
|
||||||
'dclatestversionswidget ' . $w->__get('class'),
|
'dclatestversionswidget ' . $w->class,
|
||||||
'',
|
'',
|
||||||
($w->__get('title') ? $w->renderTitle(Html::escapeHTML($w->__get('title'))) : '') . sprintf('<ul>%s</ul>', implode('', $li))
|
($w->title ? $w->renderTitle(Html::escapeHTML($w->title)) : '') . sprintf('<ul>%s</ul>', implode('', $li))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue