Compare commits

..

1 Commits
v1.8 ... master

Author SHA1 Message Date
24077d4370
upgrade to Dotclear 2.28 2023-10-19 21:18:26 +02:00
10 changed files with 115 additions and 129 deletions

View File

@ -1,3 +1,9 @@
lunarPhase 1.9 - 2023.10.19
===========================================================
* Require Dotclear 2.28
* Require PHP 8.1
* Upgrade to Dotclear 2.28
lunarPhase 1.8 - 2023.08.14
===========================================================
* Require Dotclear 2.27

View File

@ -1,25 +1,22 @@
# README
[![Release](https://img.shields.io/badge/release-1.8-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/lunarPhase/releases)
[![Date](https://img.shields.io/badge/date-2023.08.15-c44d58.svg)](https://git.dotclear.watch/JcDenis/lunarPhase/releases)
[![Dotclear](https://img.shields.io/badge/dotclear-v2.27-137bbb.svg)](https://fr.dotclear.org/download)
[![Release](https://img.shields.io/badge/release-1.9-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/lunarPhase/releases)
![Date](https://img.shields.io/badge/date-2023.10.19-c44d58.svg)
[![Dotclear](https://img.shields.io/badge/dotclear-v2.28-137bbb.svg)](https://fr.dotclear.org/download)
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-9ac123.svg)](https://plugins.dotaddict.org/dc2/details/lunarPhase)
[![License](https://img.shields.io/github/license/JcDenis/lunarPhase)](https://git.dotclear.watch/JcDenis/lunarPhase/blob/master/LICENSE)
[![License](https://img.shields.io/badge/license-GPL--2.0-ececec.svg)](https://git.dotclear.watch/JcDenis/lunarPhase/src/branch/master/LICENSE)
## WHAT IS LUNARPHASE ?
## ABOUT
_lunarPhase_ is a plugin for the open-source
web publishing software called Dotclear.
_lunarPhase_ is a plugin for the open-source web publishing software called [Dotclear](https://www.dotclear.org).
It shows lunar phases on a widget.
> Show lunar phases on a widget.
## REQUIREMENTS
_lunarPhase_ requires:
* content admin permissions to manage widgets
* Dotclear 2.27
* Dotclear 2.28
* PHP 8.1+
* Dotclear content admin permissions to manage widgets
## USAGE
@ -30,15 +27,16 @@ You should add widget to show lunar phases on your blog.
## LINKS
* License : [GNU GPL v2](https://www.gnu.org/licenses/old-licenses/lgpl-2.0.html)
* Source & contribution : [Gitea Page](https://git.dotclear.watch/JcDenis/lunarPhase) or [GitHub Page](https://github.com/JcDenis/lunarPhase)
* Packages & details: [Gitea Page](https://git.dotclear.watch/JcDenis/lunarPhase/releases) or [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/lunarPhase)
* Discuss and help : [Dotclear Forum](http://forum.dotclear.org/viewtopic.php?pid=332971#p332971)
* [License](https://git.dotclear.watch/JcDenis/lunarPhase/src/branch/master/LICENSE)
* [Packages & details](https://git.dotclear.watch/JcDenis/lunarPhase/releases) (or on [Dotaddict](https://plugins.dotaddict.org/dc2/details/lunarPhase))
* [Sources & contributions](https://git.dotclear.watch/JcDenis/lunarPhase) (or on [GitHub](https://github.com/JcDenis/lunarPhase))
* [Issues & security](https://git.dotclear.watch/JcDenis/lunarPhase/issues) (or on [GitHub](https://github.com/JcDenis/lunarPhase/issues))
* [Discuss & help](http://forum.dotclear.org/viewtopic.php?pid=332971#p332971)
## CONTRIBUTORS
* Tomtom (author)
* Pierre Van Glabeke
* Jean-Christian Denis
* Jean-Christian Denis (latest)
You are welcome to contribute to this code.

View File

@ -1,36 +1,30 @@
<?php
/**
* @brief lunarPhase, a plugin for Dotclear 2
* @file
* @brief The plugin lunarPhase definition
* @ingroup lunarPhase
*
* @package Dotclear
* @subpackage Plugin
* @defgroup lunarPhase Plugin lunarPhase.
*
* @author Tomtom, Pierre Van Glabeke and Contributors
* Display the moon phases on a widget.
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
* @author Tomtom (author)
* @author Jean-Christian Denis (latest)
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
if (!defined('DC_RC_PATH')) {
return null;
}
declare(strict_types=1);
$this->registerModule(
'Moon phases',
'Display the moon phases on a widget',
'Tomtom, Pierre Van Glabeke and Contributors',
'1.8',
'1.9',
[
'requires' => [
['php', '8.1'],
['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',
'requires' => [['core', '2.28']],
'permissions' => 'My',
'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',
]
);

View File

@ -2,11 +2,11 @@
<modules xmlns:da="http://dotaddict.org/da/">
<module id="lunarPhase">
<name>Moon phases</name>
<version>1.8</version>
<version>1.9</version>
<author>Tomtom, Pierre Van Glabeke and Contributors</author>
<desc>Display the moon phases on a widget</desc>
<file>https://git.dotclear.watch/JcDenis/lunarPhase/releases/download/v1.8/plugin-lunarPhase.zip</file>
<da:dcmin>2.26</da:dcmin>
<file>https://git.dotclear.watch/JcDenis/lunarPhase/releases/download/v1.9/plugin-lunarPhase.zip</file>
<da:dcmin>2.28</da:dcmin>
<da:details>https://git.dotclear.watch/JcDenis/lunarPhase/src/branch/master/README.md</da:details>
<da:support>https://git.dotclear.watch/JcDenis/lunarPhase/issues</da:support>
</module>

View File

@ -1,22 +1,20 @@
<?php
/**
* @brief lunarPhase, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Tomtom, Pierre Van Glabeke 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\lunarPhase;
use dcCore;
use Dotclear\App;
use Dotclear\Core\Process;
/**
* @brief lunarPhase backend class.
* @ingroup lunarPhase
*
* @author Tomtom (author)
* @author Jean-Christian Denis (latest)
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
class Backend extends Process
{
public static function init(): bool
@ -30,7 +28,7 @@ class Backend extends Process
return false;
}
dcCore::app()->addBehavior('initWidgets', [Widgets::class, 'initWidgets']);
App::behavior()->addBehavior('initWidgets', Widgets::initWidgets(...));
return true;
}

View File

@ -1,23 +1,20 @@
<?php
/**
* @brief lunarPhase, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Tomtom, Pierre Van Glabeke 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\lunarPhase;
use dcCore;
use dcUtils;
use Dotclear\App;
use Dotclear\Core\Process;
/**
* @brief lunarPhase frontend class.
* @ingroup lunarPhase
*
* @author Tomtom (author)
* @author Jean-Christian Denis (latest)
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
class Frontend extends Process
{
public static function init(): bool
@ -31,17 +28,15 @@ class Frontend extends Process
return false;
}
dcCore::app()->addBehaviors([
App::behavior()->addBehaviors([
// Add public header for lunarphase css
'publicHeadContent' => function (): void {
if (is_null(dcCore::app()->blog)) {
return;
if (App::blog()->isDefined()) {
echo App::plugins()->cssLoad(App::blog()->url() . App::url()->getURLFor('lunarphase'));
}
echo dcUtils::cssLoad(dcCore::app()->blog->url . dcCore::app()->url->getURLFor('lunarphase'));
},
// Widgets
'initWidgets' => [Widgets::class, 'initWidgets'],
'initWidgets' => Widgets::initWidgets(...),
]);
return true;

View File

@ -1,21 +1,19 @@
<?php
/**
* @brief lunarPhase, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Tomtom, Pierre Van Glabeke 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\lunarPhase;
use ArrayObject;
/**
* @brief lunarPhase main class.
* @ingroup lunarPhase
*
* @author Tomtom (author)
* @author Jean-Christian Denis (latest)
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
class LunarPhase
{
# Astronomical constants.

View File

@ -1,15 +1,5 @@
<?php
/**
* @brief lunarPhase, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Tomtom, Pierre Van Glabeke 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\lunarPhase;
@ -17,11 +7,20 @@ namespace Dotclear\Plugin\lunarPhase;
use Dotclear\Module\MyPlugin;
/**
* This module definitions.
* @brief lunarPhase My helper.
* @ingroup lunarPhase
*
* @author Tomtom (author)
* @author Jean-Christian Denis (latest)
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
class My extends MyPlugin
{
/** @var array<string,string> List of lunar phase => image */
/**
* List of lunar phase => image.
*
* @var array<string, string> LUNAR_PHASES
*/
public const LUNAR_PHASES = [
'new_moon' => 'nm.png',
'waxing_crescent_moon' => 'wcm1.png',
@ -32,4 +31,6 @@ class My extends MyPlugin
'last_quarter_moon' => 'tqm.png',
'waning_crescent_moon' => 'wcm2.png',
];
// Use default permissions
}

View File

@ -1,22 +1,20 @@
<?php
/**
* @brief lunarPhase, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Tomtom, Pierre Van Glabeke 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\lunarPhase;
use dcCore;
use Dotclear\App;
use Dotclear\Core\Process;
/**
* @brief lunarPhase backend class.
* @ingroup lunarPhase
*
* @author Tomtom (author)
* @author Jean-Christian Denis (latest)
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
class Prepend extends Process
{
public static function init(): bool
@ -31,7 +29,7 @@ class Prepend extends Process
}
// Register lunarphase CSS URL
dcCore::app()->url->register(
App::url()->register(
'lunarphase',
'lunarphase.css',
'^lunarphase\.css',

View File

@ -1,25 +1,23 @@
<?php
/**
* @brief lunarPhase, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Tomtom, Pierre Van Glabeke 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\lunarPhase;
use dcCore;
use Dotclear\App;
use Dotclear\Helper\Date;
use Dotclear\Helper\Html\Html;
use Dotclear\Plugin\widgets\WidgetsStack;
use Dotclear\Plugin\widgets\WidgetsElement;
/**
* @brief lunarPhase widgets class.
* @ingroup lunarPhase
*
* @author Tomtom (author)
* @author Jean-Christian Denis (latest)
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
class Widgets
{
public static function initWidgets(WidgetsStack $w): void
@ -27,7 +25,7 @@ class Widgets
$w->create(
'lunarphase',
__('Moon phases'),
[self::class, 'parseWidget'],
self::parseWidget(...),
null,
__('Display the moon phases')
)
@ -49,7 +47,7 @@ class Widgets
public static function parseWidget(WidgetsElement $w): string
{
if ($w->offline || !$w->checkHomeOnly(dcCore::app()->url->type)) {
if ($w->offline || !$w->checkHomeOnly(App::url()->type)) {
return '';
}
@ -200,14 +198,14 @@ class Widgets
*/
public static function formatValue(string $type, mixed $value): mixed
{
if (is_null(dcCore::app()->blog)) {
if (!App::blog()->isDefined()) {
return null;
}
$res = '';
$format = dcCore::app()->blog->settings->get('system')->get('date_format') . ' - ';
$format .= dcCore::app()->blog->settings->get('system')->get('time_format');
$tz = dcCore::app()->blog->settings->get('system')->get('blog_timezone');
$format = App::blog()->settings()->get('system')->get('date_format') . ' - ';
$format .= App::blog()->settings()->get('system')->get('time_format');
$tz = App::blog()->settings()->get('system')->get('blog_timezone');
return match ($type) {
'int' => number_format($value, 0),