Compare commits

..

No commits in common. "master" and "v2023.08.06" have entirely different histories.

10 changed files with 139 additions and 123 deletions

View File

@ -1,15 +1,3 @@
dcLatestVersions 2023.10.15
===========================================================
* Require Dotclear 2.28
* Require PHP 8.1
* Cosmetic clean
dcLatestVersions 2023.10.11
===========================================================
* Require Dotclear 2.28
* Require PHP 8.1
* Upgrade to Dotclear 2.28
dcLatestVersions 2023.08.06 dcLatestVersions 2023.08.06
=========================================================== ===========================================================
* Require Dotclear 2.27 * Require Dotclear 2.27

View File

@ -1,22 +1,25 @@
# README # README
[![Release](https://img.shields.io/badge/release-2023.10.15-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/dcLatestVersions/releases) [![Release](https://img.shields.io/github/v/release/JcDenis/dcLatestVersions)](https://git.dotclear.watch/JcDenis/dcLatestVersions/releases)
![Date](https://img.shields.io/badge/date-2023.10.15-c44d58.svg) [![Date](https://img.shields.io/github/release-date/JcDenis/dcLatestVersions)](https://git.dotclear.watch/JcDenis/dcLatestVersions/releases)
[![Dotclear](https://img.shields.io/badge/dotclear-v2.28-137bbb.svg)](https://fr.dotclear.org/download) [![Issues](https://img.shields.io/github/issues/JcDenis/dcLatestVersions)](https://git.dotclear.watch/JcDenis/dcLatestVersions/issues)
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-9ac123.svg)](https://plugins.dotaddict.org/dc2/details/dcLatestVersions) [![Dotclear](https://img.shields.io/badge/dotclear-v2.27-blue.svg)](https://fr.dotclear.org/download)
[![License](https://img.shields.io/badge/license-GPL--2.0-ececec.svg)](https://git.dotclear.watch/JcDenis/dcLatestVersions/src/branch/master/LICENSE) [![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)
## ABOUT ## WHAT IS DCLATESTVERSION ?
_dcLatestVersions_ is a plugin for the open-source web publishing software called [Dotclear](https://www.dotclear.org). "Dotclear's latest versions" is a plugin for the open-source
web publishing software called Dotclear.
> Simply show visitors last versions of nightly build of Dotclear. Simply show visitors last versions of nightly build of Dotclear.
## REQUIREMENTS ## REQUIREMENTS
* Dotclear 2.28 _dcLatestVersions_ requires:
* PHP 8.1
* Dotclear permissions to manage widgets * permissions to manage widgets
* Dotclear 2.27
## USAGE ## USAGE
@ -28,14 +31,13 @@ You can add a dashboard item by enable it from your dashboard preferences.
## MORE ## MORE
* [License](https://git.dotclear.watch/JcDenis/dcLatestVersion/src/branch/master/LICENSE) * License : GNU GPL v2
* [Packages & details](https://git.dotclear.watch/JcDenis/dcLatestVersion/releases) (or on [Dotaddict](https://plugins.dotaddict.org/dc2/details/dcLatestVersion)) * Source & contribution : [Gitea Page](https://git.dotclear.watch/JcDenis/dcLatestVersion) or [GitHub Page](https://github.com/JcDenis/dcLatestVersions)
* [Sources & contributions](https://git.dotclear.watch/JcDenis/dcLatestVersion) (or on [GitHub](https://github.com/JcDenis/dcLatestVersion)) * Packages & details: [Gitea Page](https://git.dotclear.watch/JcDenis/dcLatestVersion/releases) or [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/dcLatestVersions)
* [Issues & security](https://git.dotclear.watch/JcDenis/dcLatestVersion/issues) (or on [GitHub](https://github.com/JcDenis/dcLatestVersion/issues))
## CONTRIBUTORS ## CONTRIBUTORS
* Jean-Chirstian Denis (author) * Jean-Chirstian Denis
* Pierre Van Glabeke * Pierre Van Glabeke
You are welcome to contribute to this code. You are welcome to contribute to this code.

View File

@ -1,25 +1,30 @@
<?php <?php
/** /**
* @file * @brief dcLatestVersions, a plugin for Dotclear 2
* @brief The plugin dcLatestVersions definition
* @ingroup dcLatestVersions
* *
* @defgroup dcLatestVersions Plugin dcLatestVersions. * @package Dotclear
* @subpackage Plugin
* *
* Show the latest available versions of Dotclear. * @author Jean-Christian Denis, Pierre Van Glabeke
* *
* @author Jean-Christian Denis
* @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')) {
return null;
}
$this->registerModule( $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.10.15', '2023.08.06',
[ [
'requires' => [['core', '2.28']], 'requires' => [['core', '2.27']],
'permissions' => 'My', 'permissions' => dcCore::app()->auth->makePermissions([
dcCore::app()->auth::PERMISSION_USAGE,
dcCore::app()->auth::PERMISSION_CONTENT_ADMIN,
]),
'type' => 'plugin', 'type' => 'plugin',
'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues', 'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues',
'details' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/src/branch/master/README.md', 'details' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/src/branch/master/README.md',

View File

@ -2,11 +2,11 @@
<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.10.15</version> <version>2023.08.06</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://git.dotclear.watch/JcDenis/dcLatestVersions/releases/download/v2023.10.15/plugin-dcLatestVersions.zip</file> <file>https://gitea.dotclear.watch/JcDenis/dcLatestVersions/releases/download/v2023.08.06/plugin-dcLatestVersions.zip</file>
<da:dcmin>2.28</da:dcmin> <da:dcmin>2.27</da:dcmin>
<da:details>https://git.dotclear.watch/JcDenis/dcLatestVersions/src/branch/master/README.md</da:details> <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> <da:support>https://git.dotclear.watch/JcDenis/dcLatestVersions/issues</da:support>
</module> </module>

View File

@ -1,12 +1,22 @@
<?php <?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); declare(strict_types=1);
namespace Dotclear\Plugin\dcLatestVersions; namespace Dotclear\Plugin\dcLatestVersions;
use ArrayObject; use ArrayObject;
use Dotclear\App; use dcCore;
use Dotclear\Core\Backend\Update; use dcUpdate;
use Dotclear\Core\Process; use Dotclear\Core\Process;
use Dotclear\Helper\Html\Form\{ use Dotclear\Helper\Html\Form\{
Checkbox, Checkbox,
@ -15,14 +25,6 @@ use Dotclear\Helper\Html\Form\{
}; };
use Dotclear\Helper\Html\Html; use Dotclear\Helper\Html\Html;
/**
* @brief dcLatestVersions backend class.
* @ingroup dcLatestVersions
*
* @author Jean-Christian Denis
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
class Backend extends Process class Backend extends Process
{ {
public static function init(): bool public static function init(): bool
@ -36,12 +38,15 @@ class Backend extends Process
return false; return false;
} }
App::behavior()->addBehaviors([ dcCore::app()->addBehaviors([
'initWidgets' => Widgets::initWidgets(...), 'initWidgets' => [Widgets::class, 'initWidgets'],
'adminDashboardItemsV2' => function (ArrayObject $__dashboard_items): void { 'adminDashboardItemsV2' => function (ArrayObject $__dashboard_items): void {
if (!App::blog()->isDefined() // nullsafe PHP < 8.0
|| !My::prefs()->get('dashboard_items') if (is_null(dcCore::app()->blog)) {
) { return;
}
if (!My::prefs()->get('dashboard_items')) {
return; return;
} }
@ -58,11 +63,11 @@ class Backend extends Process
continue; continue;
} }
$updater = new Update( $updater = new dcUpdate(
App::config()->coreUpdateUrl(), DC_UPDATE_URL,
'dotclear', 'dotclear',
$build, $build,
App::config()->cacheRoot() . '/versions' DC_TPL_CACHE . '/versions'
); );
if (false === $updater->check('0')) { if (false === $updater->check('0')) {

View File

@ -1,20 +1,22 @@
<?php <?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); declare(strict_types=1);
namespace Dotclear\Plugin\dcLatestVersions; namespace Dotclear\Plugin\dcLatestVersions;
use Dotclear\App; use dcCore;
use Dotclear\Core\Process; use Dotclear\Core\Process;
/**
* @brief dcLatestVersions frontend class.
* @ingroup dcLatestVersions
*
* @author Jean-Christian Denis
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
class Frontend extends Process class Frontend extends Process
{ {
public static function init(): bool public static function init(): bool
@ -28,7 +30,9 @@ class Frontend extends Process
return false; return false;
} }
App::behavior()->addBehavior('initWidgets', Widgets::initWidgets(...)); dcCore::app()->addBehaviors([
'initWidgets' => [Widgets::class, 'initWidgets'],
]);
return true; return true;
} }

View File

@ -1,19 +1,21 @@
<?php <?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); declare(strict_types=1);
namespace Dotclear\Plugin\dcLatestVersions; namespace Dotclear\Plugin\dcLatestVersions;
use Dotclear\Core\Process; use Dotclear\Core\Process;
/**
* @brief dcLatestVersions installation class.
* @ingroup dcLatestVersions
*
* @author Jean-Christian Denis
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
class Install extends Process class Install extends Process
{ {
public static function init(): bool public static function init(): bool

View File

@ -1,5 +1,15 @@
<?php <?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); declare(strict_types=1);
namespace Dotclear\Plugin\dcLatestVersions; namespace Dotclear\Plugin\dcLatestVersions;
@ -7,14 +17,8 @@ namespace Dotclear\Plugin\dcLatestVersions;
use Dotclear\Module\MyPlugin; use Dotclear\Module\MyPlugin;
/** /**
* @brief dcLatestVersions My helper. * This module definitions.
* @ingroup dcLatestVersions
*
* @author Jean-Christian Denis
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/ */
class My extends MyPlugin class My extends MyPlugin
{ {
// Use default permissions
} }

View File

@ -1,20 +1,23 @@
<?php <?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); declare(strict_types=1);
namespace Dotclear\Plugin\dcLatestVersions; namespace Dotclear\Plugin\dcLatestVersions;
use dcCore;
use Dotclear\Core\Process; use Dotclear\Core\Process;
use Dotclear\Plugin\Uninstaller\Uninstaller; use Dotclear\Plugin\Uninstaller\Uninstaller;
/**
* @brief dcLatestVersions uninstall class.
* @ingroup dcLatestVersions
*
* @author Jean-Christian Denis
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
class Uninstall extends Process class Uninstall extends Process
{ {
public static function init(): bool public static function init(): bool
@ -24,7 +27,7 @@ class Uninstall extends Process
public static function process(): bool public static function process(): bool
{ {
if (!self::status()) { if (!self::status() || !dcCore::app()->plugins->moduleExists('Uninstaller')) {
return false; return false;
} }

View File

@ -1,23 +1,25 @@
<?php <?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); declare(strict_types=1);
namespace Dotclear\Plugin\dcLatestVersions; namespace Dotclear\Plugin\dcLatestVersions;
use Dotclear\App; use dcCore;
use Dotclear\Core\Backend\Update; use dcUpdate;
use Dotclear\Helper\Html\Html; use Dotclear\Helper\Html\Html;
use Dotclear\Plugin\widgets\WidgetsStack; use Dotclear\Plugin\widgets\WidgetsStack;
use Dotclear\Plugin\widgets\WidgetsElement; use Dotclear\Plugin\widgets\WidgetsElement;
/**
* @brief dcLatestVersions widgets class.
* @ingroup dcLatestVersions
*
* @author Jean-Christian Denis
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
class Widgets class Widgets
{ {
public static function initWidgets(WidgetsStack $w): void public static function initWidgets(WidgetsStack $w): void
@ -26,7 +28,7 @@ class Widgets
->create( ->create(
My::id() . 'widget', My::id() . 'widget',
My::name(), My::name(),
self::parseWidget(...), [self::class, 'parseWidget'],
null, null,
__('Show the latest available versions of Dotclear') __('Show the latest available versions of Dotclear')
) )
@ -47,11 +49,12 @@ class Widgets
public static function parseWidget(WidgetsElement $w): string public static function parseWidget(WidgetsElement $w): string
{ {
if ($w->__get('offline') if ($w->__get('offline') || !$w->checkHomeOnly(dcCore::app()->url->type) || $w->__get('text') == '') {
|| !$w->checkHomeOnly(App::url()->type) return '';
|| $w->__get('text') == '' }
|| !App::blog()->isDefined()
) { // nullsafe PHP < 8.0
if (is_null(dcCore::app()->blog)) {
return ''; return '';
} }
@ -68,11 +71,11 @@ class Widgets
continue; continue;
} }
$updater = new Update( $updater = new dcUpdate(
App::config()->coreUpdateUrl(), DC_UPDATE_URL,
'dotclear', 'dotclear',
$build, $build,
App::config()->cacheRoot() . '/versions' DC_TPL_CACHE . '/versions'
); );
if (false === $updater->check('0')) { if (false === $updater->check('0')) {