Compare commits
No commits in common. "2a7a365eea9d159517207f1c7167daf6cf7d8d3c" and "6dd3f2b4ba2a710db4fde82099f0a9729160fa76" have entirely different histories.
2a7a365eea
...
6dd3f2b4ba
90
CHANGELOG.md
90
CHANGELOG.md
|
@ -1,64 +1,44 @@
|
|||
dcLatestVersions 2023.08.06
|
||||
===========================================================
|
||||
* Require Dotclear 2.27
|
||||
* Require PHP7.4+
|
||||
* Upgrade to Dotclear 2.27
|
||||
* Move third party repository
|
||||
* Use Dotclear style for changelog
|
||||
* Change user pref to plugin ID (breaking)
|
||||
* Change widget id to plugin ID (breaking)
|
||||
2023.05.13
|
||||
- require dotclear 2.26
|
||||
- release for dotclear 2.26 stable
|
||||
|
||||
dcLatestVersions 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
|
||||
|
||||
dcLatestVersions 2023.04.23
|
||||
===========================================================
|
||||
* require dotclear 2.26
|
||||
* use latest dotclear namespace
|
||||
* add plugin Uninstaller features
|
||||
* remove magic
|
||||
* fix nullsafe warnings
|
||||
2023.03.26
|
||||
- require dotclear 2.26
|
||||
- use namespace
|
||||
|
||||
dcLatestVersions 2023.03.26
|
||||
===========================================================
|
||||
* require dotclear 2.26
|
||||
* use namespace
|
||||
2022.12.20
|
||||
- change plugin name
|
||||
- use anonymous functions
|
||||
- use abstract plugin name
|
||||
- fix install
|
||||
|
||||
dcLatestVersions 2022.12.20
|
||||
===========================================================
|
||||
* change plugin name
|
||||
* use anonymous functions
|
||||
* use abstract plugin name
|
||||
* fix install
|
||||
2022.11.20
|
||||
- fix compatibility with Dotclear 2.24 (required)
|
||||
|
||||
dcLatestVersions 2022.11.20
|
||||
===========================================================
|
||||
* fix compatibility with Dotclear 2.24 (required)
|
||||
2021.08.27
|
||||
- cleanup (PSR2,short array, ...)
|
||||
- enhance widget style
|
||||
- update license
|
||||
|
||||
dcLatestVersions 2021.08.27
|
||||
===========================================================
|
||||
* cleanup (PSR2,short array, ...)
|
||||
* enhance widget style
|
||||
* update license
|
||||
2020.09.18 - Pierre Van Glabeke
|
||||
- modif admin.php (merci à nanart)
|
||||
|
||||
dcLatestVersions 2020.09.18 - Pierre Van Glabeke
|
||||
===========================================================
|
||||
* modif admin.php (merci à nanart)
|
||||
2015.03.11 - Pierre Van Glabeke
|
||||
- ajout mode hors ligne et codage titre widget (widget)
|
||||
- encodage UNIX (LF)
|
||||
- modif url de support
|
||||
- modifs localisation
|
||||
- suppression icône
|
||||
|
||||
dcLatestVersions 2015.03.11 - Pierre Van Glabeke
|
||||
===========================================================
|
||||
* ajout mode hors ligne et codage titre widget (widget)
|
||||
* encodage UNIX (LF)
|
||||
* modif url de support
|
||||
* modifs localisation
|
||||
* suppression icône
|
||||
2013.11.18 - Jean-Christian Denis
|
||||
- First hg release
|
||||
|
||||
dcLatestVersions 2013.11.18 - Jean-Christian Denis
|
||||
===========================================================
|
||||
* First hg release
|
||||
|
||||
dcLatestVersions 2013.07.22 - Jean-Christian Denis
|
||||
===========================================================
|
||||
* First release
|
||||
2013.07.22 - Jean-Christian Denis
|
||||
- First release
|
30
README.md
30
README.md
|
@ -1,11 +1,11 @@
|
|||
# README
|
||||
|
||||
[![Release](https://img.shields.io/github/v/release/JcDenis/dcLatestVersions)](https://git.dotclear.watch/JcDenis/dcLatestVersions/releases)
|
||||
[![Date](https://img.shields.io/github/release-date/JcDenis/dcLatestVersions)](https://git.dotclear.watch/JcDenis/dcLatestVersions/releases)
|
||||
[![Issues](https://img.shields.io/github/issues/JcDenis/dcLatestVersions)](https://git.dotclear.watch/JcDenis/dcLatestVersions/issues)
|
||||
[![Dotclear](https://img.shields.io/badge/dotclear-v2.27-blue.svg)](https://fr.dotclear.org/download)
|
||||
[![Release](https://img.shields.io/github/v/release/JcDenis/dcLatestVersions)](https://github.com/JcDenis/dcLatestVersions/releases)
|
||||
[![Date](https://img.shields.io/github/release-date/JcDenis/dcLatestVersions)](https://github.com/JcDenis/dcLatestVersions/releases)
|
||||
[![Issues](https://img.shields.io/github/issues/JcDenis/dcLatestVersions)](https://github.com/JcDenis/dcLatestVersions/issues)
|
||||
[![Dotclear](https://img.shields.io/badge/dotclear-v2.26-blue.svg)](https://fr.dotclear.org/download)
|
||||
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-green.svg)](https://plugins.dotaddict.org/dc2/details/dcLatestVersions)
|
||||
[![License](https://img.shields.io/github/license/JcDenis/dcLatestVersions)](https://git.dotclear.watch/JcDenis/dcLatestVersions/blob/master/LICENSE)
|
||||
[![License](https://img.shields.io/github/license/JcDenis/dcLatestVersions)](https://github.com/JcDenis/dcLatestVersions/blob/master/LICENSE)
|
||||
|
||||
## WHAT IS DCLATESTVERSION ?
|
||||
|
||||
|
@ -16,14 +16,14 @@ Simply show visitors last versions of nightly build of Dotclear.
|
|||
|
||||
## REQUIREMENTS
|
||||
|
||||
_dcLatestVersions_ requires:
|
||||
dcLatestVersions requires:
|
||||
|
||||
* permissions to manage widgets
|
||||
* Dotclear 2.27
|
||||
* permissions to manage widgets
|
||||
* Dotclear 2.26
|
||||
|
||||
## USAGE
|
||||
|
||||
First install _dcLatestVersions_, manualy from a zip package or from
|
||||
First install dcLatestVersions, manualy from a zip package or from
|
||||
Dotaddict repository. (See Dotclear's documentation to know how do this)
|
||||
|
||||
Add and configure "Dotclear's latest versions" from widgets manager.
|
||||
|
@ -31,13 +31,11 @@ You can add a dashboard item by enable it from your dashboard preferences.
|
|||
|
||||
## MORE
|
||||
|
||||
* License : GNU GPL v2
|
||||
* Source & contribution : [Gitea Page](https://git.dotclear.watch/JcDenis/dcLatestVersion) or [GitHub Page](https://github.com/JcDenis/dcLatestVersions)
|
||||
* Packages & details: [Gitea Page](https://git.dotclear.watch/JcDenis/dcLatestVersion/releases) or [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/dcLatestVersions)
|
||||
* License : GNU GPL v2
|
||||
* Source & contribution : [GitHub Page](https://github.com/JcDenis/dcLatestVersions)
|
||||
* Packages & details: [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/dcLatestVersions)
|
||||
|
||||
## CONTRIBUTORS
|
||||
|
||||
* Jean-Chirstian Denis
|
||||
* Pierre Van Glabeke
|
||||
|
||||
You are welcome to contribute to this code.
|
||||
* Jean-Chirstian Denis
|
||||
* Pierre Van Glabeke
|
||||
|
|
12
_define.php
12
_define.php
|
@ -10,7 +10,7 @@
|
|||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
if (!defined('DC_RC_PATH')) {
|
||||
if (!defined('DC_RC_PATH') || is_null(dcCore::app()->auth)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -18,16 +18,16 @@ $this->registerModule(
|
|||
"Dotclear's latest versions",
|
||||
'Show the latest available versions of Dotclear',
|
||||
'Jean-Christian Denis, Pierre Van Glabeke',
|
||||
'2023.08.06',
|
||||
'2023.05.13',
|
||||
[
|
||||
'requires' => [['core', '2.27']],
|
||||
'requires' => [['core', '2.26']],
|
||||
'permissions' => dcCore::app()->auth->makePermissions([
|
||||
dcCore::app()->auth::PERMISSION_USAGE,
|
||||
dcCore::app()->auth::PERMISSION_CONTENT_ADMIN,
|
||||
]),
|
||||
'type' => 'plugin',
|
||||
'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues',
|
||||
'details' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/src/branch/master/README.md',
|
||||
'repository' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/raw/branch/master/dcstore.xml',
|
||||
'support' => 'http://forum.dotclear.org/viewforum.php?id=16',
|
||||
'details' => 'http://plugins.dotaddict.org/dc2/details/' . basename(__DIR__),
|
||||
'repository' => 'https://raw.githubusercontent.com/JcDenis/' . basename(__DIR__) . '/master/dcstore.xml',
|
||||
]
|
||||
);
|
||||
|
|
10
dcstore.xml
10
dcstore.xml
|
@ -2,12 +2,12 @@
|
|||
<modules xmlns:da="http://dotaddict.org/da/">
|
||||
<module id="dcLatestVersions">
|
||||
<name>Dotclear's latest versions</name>
|
||||
<version>2023.08.06</version>
|
||||
<version>2023.05.13</version>
|
||||
<author>Jean-Christian Denis, Pierre Van Glabeke</author>
|
||||
<desc>Show the latest available versions of Dotclear</desc>
|
||||
<file>https://gitea.dotclear.watch/JcDenis/dcLatestVersions/releases/download/v2023.08.06/plugin-dcLatestVersions.zip</file>
|
||||
<da:dcmin>2.27</da:dcmin>
|
||||
<da:details>https://git.dotclear.watch/JcDenis/dcLatestVersions/src/branch/master/README.md</da:details>
|
||||
<da:support>https://git.dotclear.watch/JcDenis/dcLatestVersions/issues</da:support>
|
||||
<file>https://github.com/JcDenis/dcLatestVersions/releases/download/v2023.05.13/plugin-dcLatestVersions.zip</file>
|
||||
<da:dcmin>2.26</da:dcmin>
|
||||
<da:details>http://plugins.dotaddict.org/dc2/details/dcLatestVersions</da:details>
|
||||
<da:support>http://forum.dotclear.org/viewforum.php?id=16</da:support>
|
||||
</module>
|
||||
</modules>
|
||||
|
|
|
@ -16,8 +16,8 @@ namespace Dotclear\Plugin\dcLatestVersions;
|
|||
|
||||
use ArrayObject;
|
||||
use dcCore;
|
||||
use dcNsProcess;
|
||||
use dcUpdate;
|
||||
use Dotclear\Core\Process;
|
||||
use Dotclear\Helper\Html\Form\{
|
||||
Checkbox,
|
||||
Label,
|
||||
|
@ -25,16 +25,18 @@ use Dotclear\Helper\Html\Form\{
|
|||
};
|
||||
use Dotclear\Helper\Html\Html;
|
||||
|
||||
class Backend extends Process
|
||||
class Backend extends dcNsProcess
|
||||
{
|
||||
public static function init(): bool
|
||||
{
|
||||
return self::status(My::checkContext(My::BACKEND));
|
||||
static::$init = defined('DC_CONTEXT_ADMIN');
|
||||
|
||||
return static::$init;
|
||||
}
|
||||
|
||||
public static function process(): bool
|
||||
{
|
||||
if (!self::status()) {
|
||||
if (!static::$init) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -42,15 +44,15 @@ class Backend extends Process
|
|||
'initWidgets' => [Widgets::class, 'initWidgets'],
|
||||
'adminDashboardItemsV2' => function (ArrayObject $__dashboard_items): void {
|
||||
// nullsafe PHP < 8.0
|
||||
if (is_null(dcCore::app()->blog)) {
|
||||
if (is_null(dcCore::app()->auth) || is_null(dcCore::app()->auth->user_prefs) || is_null(dcCore::app()->blog)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!My::prefs()->get('dashboard_items')) {
|
||||
if (!dcCore::app()->auth->user_prefs->get('dashboard')->get('dcLatestVersionsItems')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$builds = explode(',', (string) My::settings()->get('builds'));
|
||||
$builds = explode(',', (string) dcCore::app()->blog->settings->get(My::id())->get('builds'));
|
||||
if (empty($builds[0])) {
|
||||
return;
|
||||
}
|
||||
|
@ -95,9 +97,14 @@ class Backend extends Process
|
|||
},
|
||||
|
||||
'adminDashboardOptionsFormV2' => function (): void {
|
||||
if (!My::prefs()->prefExists('dashboard_items')) {
|
||||
My::prefs()->put(
|
||||
'dashboard_items',
|
||||
// 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')) {
|
||||
dcCore::app()->auth->user_prefs->get('dashboard')->put(
|
||||
'dcLatestVersionsItems',
|
||||
false,
|
||||
'boolean'
|
||||
);
|
||||
|
@ -108,10 +115,10 @@ class Backend extends Process
|
|||
'<h4>' . Html::escapeHTML(My::name()) . '</h4>' .
|
||||
(new Para())
|
||||
->__call('items', [[
|
||||
(new Checkbox(My::id() . 'dashboard_items', (bool) My::prefs()->get('dashboard_items')))
|
||||
(new Checkbox('dcLatestVersionsItems', (bool) dcCore::app()->auth->user_prefs->get('dashboard')->get('dcLatestVersionsItems')))
|
||||
->__call('value', [1]),
|
||||
(new Label(__("Show Dotclear's latest versions on dashboards."), Label::OUTSIDE_LABEL_AFTER))
|
||||
->__call('for', [My::id() . 'dashboard_items'])
|
||||
->__call('for', ['dcLatestVersionsItems'])
|
||||
->__call('class', ['classic']),
|
||||
]])
|
||||
->render() .
|
||||
|
@ -119,9 +126,14 @@ class Backend extends Process
|
|||
},
|
||||
|
||||
'adminAfterDashboardOptionsUpdate' => function (?string $user_id): void {
|
||||
My::prefs()->put(
|
||||
'dashboard_items',
|
||||
!empty($_POST[My::id() . 'dashboard_items']),
|
||||
// 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(
|
||||
'dcLatestVersionsItems',
|
||||
!empty($_POST['dcLatestVersionsItems']),
|
||||
'boolean'
|
||||
);
|
||||
},
|
||||
|
|
|
@ -15,18 +15,20 @@ declare(strict_types=1);
|
|||
namespace Dotclear\Plugin\dcLatestVersions;
|
||||
|
||||
use dcCore;
|
||||
use Dotclear\Core\Process;
|
||||
use dcNsProcess;
|
||||
|
||||
class Frontend extends Process
|
||||
class Frontend extends dcNsProcess
|
||||
{
|
||||
public static function init(): bool
|
||||
{
|
||||
return self::status(My::checkContext(My::FRONTEND));
|
||||
static::$init = defined('DC_RC_PATH');
|
||||
|
||||
return static::$init;
|
||||
}
|
||||
|
||||
public static function process(): bool
|
||||
{
|
||||
if (!self::status()) {
|
||||
if (!static::$init) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,22 +14,31 @@ declare(strict_types=1);
|
|||
|
||||
namespace Dotclear\Plugin\dcLatestVersions;
|
||||
|
||||
use Dotclear\Core\Process;
|
||||
use dcCore;
|
||||
use dcNsProcess;
|
||||
|
||||
class Install extends Process
|
||||
class Install extends dcNsProcess
|
||||
{
|
||||
public static function init(): bool
|
||||
{
|
||||
return self::status(My::checkContext(My::INSTALL));
|
||||
static::$init = defined('DC_CONTEXT_ADMIN')
|
||||
&& dcCore::app()->newVersion(My::id(), dcCore::app()->plugins->moduleInfo(My::id(), 'version'));
|
||||
|
||||
return static::$init;
|
||||
}
|
||||
|
||||
public static function process(): bool
|
||||
{
|
||||
if (!self::status()) {
|
||||
if (!static::$init) {
|
||||
return false;
|
||||
}
|
||||
|
||||
My::settings()->put(
|
||||
// nullsafe PHP < 8.0
|
||||
if (is_null(dcCore::app()->blog)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
dcCore::app()->blog->settings->get(My::id())->put(
|
||||
'builds',
|
||||
'stable,unstable,testing',
|
||||
'string',
|
||||
|
|
29
src/My.php
29
src/My.php
|
@ -14,11 +14,36 @@ declare(strict_types=1);
|
|||
|
||||
namespace Dotclear\Plugin\dcLatestVersions;
|
||||
|
||||
use Dotclear\Module\MyPlugin;
|
||||
use dcCore;
|
||||
|
||||
/**
|
||||
* This module definitions.
|
||||
*/
|
||||
class My extends MyPlugin
|
||||
class My
|
||||
{
|
||||
/**
|
||||
* This module id.
|
||||
*/
|
||||
public static function id(): string
|
||||
{
|
||||
return basename(dirname(__DIR__));
|
||||
}
|
||||
|
||||
/**
|
||||
* This module name.
|
||||
*/
|
||||
public static function name(): string
|
||||
{
|
||||
$name = 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__);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,19 +15,21 @@ declare(strict_types=1);
|
|||
namespace Dotclear\Plugin\dcLatestVersions;
|
||||
|
||||
use dcCore;
|
||||
use Dotclear\Core\Process;
|
||||
use dcNsProcess;
|
||||
use Dotclear\Plugin\Uninstaller\Uninstaller;
|
||||
|
||||
class Uninstall extends Process
|
||||
class Uninstall extends dcNsProcess
|
||||
{
|
||||
public static function init(): bool
|
||||
{
|
||||
return self::status(My::checkContext(My::UNINSTALL));
|
||||
static::$init = defined('DC_CONTEXT_ADMIN');
|
||||
|
||||
return static::$init;
|
||||
}
|
||||
|
||||
public static function process(): bool
|
||||
{
|
||||
if (!self::status() || !dcCore::app()->plugins->moduleExists('Uninstaller')) {
|
||||
if (!static::$init || !dcCore::app()->plugins->moduleExists('Uninstaller')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ class Widgets
|
|||
{
|
||||
$w
|
||||
->create(
|
||||
My::id() . 'widget',
|
||||
'dclatestversionswidget',
|
||||
My::name(),
|
||||
[self::class, 'parseWidget'],
|
||||
null,
|
||||
|
@ -59,7 +59,7 @@ class Widgets
|
|||
}
|
||||
|
||||
# Builds to check
|
||||
$builds = explode(',', (string) My::settings()->get('builds'));
|
||||
$builds = explode(',', (string) dcCore::app()->blog->settings->get(My::id())->get('builds'));
|
||||
if (empty($builds[0])) {
|
||||
return '';
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ class Widgets
|
|||
# Display
|
||||
return $w->renderDiv(
|
||||
(bool) $w->__get('content_only'),
|
||||
My::id() . 'widget ' . $w->__get('class'),
|
||||
'dclatestversionswidget ' . $w->__get('class'),
|
||||
'',
|
||||
($w->__get('title') ? $w->renderTitle(Html::escapeHTML($w->__get('title'))) : '') . sprintf('<ul>%s</ul>', implode('', $li))
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue