Compare commits
No commits in common. "master" and "v1.8" have entirely different histories.
@ -1,9 +1,3 @@
|
||||
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
|
||||
|
32
README.md
32
README.md
@ -1,22 +1,25 @@
|
||||
# README
|
||||
|
||||
[![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)
|
||||
[![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)
|
||||
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-9ac123.svg)](https://plugins.dotaddict.org/dc2/details/lunarPhase)
|
||||
[![License](https://img.shields.io/badge/license-GPL--2.0-ececec.svg)](https://git.dotclear.watch/JcDenis/lunarPhase/src/branch/master/LICENSE)
|
||||
[![License](https://img.shields.io/github/license/JcDenis/lunarPhase)](https://git.dotclear.watch/JcDenis/lunarPhase/blob/master/LICENSE)
|
||||
|
||||
## ABOUT
|
||||
## WHAT IS LUNARPHASE ?
|
||||
|
||||
_lunarPhase_ is a plugin for the open-source web publishing software called [Dotclear](https://www.dotclear.org).
|
||||
_lunarPhase_ is a plugin for the open-source
|
||||
web publishing software called Dotclear.
|
||||
|
||||
> Show lunar phases on a widget.
|
||||
It shows lunar phases on a widget.
|
||||
|
||||
## REQUIREMENTS
|
||||
|
||||
* Dotclear 2.28
|
||||
_lunarPhase_ requires:
|
||||
|
||||
* content admin permissions to manage widgets
|
||||
* Dotclear 2.27
|
||||
* PHP 8.1+
|
||||
* Dotclear content admin permissions to manage widgets
|
||||
|
||||
## USAGE
|
||||
|
||||
@ -27,16 +30,15 @@ You should add widget to show lunar phases on your blog.
|
||||
|
||||
## LINKS
|
||||
|
||||
* [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)
|
||||
* 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)
|
||||
|
||||
## CONTRIBUTORS
|
||||
|
||||
* Tomtom (author)
|
||||
* Pierre Van Glabeke
|
||||
* Jean-Christian Denis (latest)
|
||||
* Jean-Christian Denis
|
||||
|
||||
You are welcome to contribute to this code.
|
||||
|
38
_define.php
38
_define.php
@ -1,30 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* @file
|
||||
* @brief The plugin lunarPhase definition
|
||||
* @ingroup lunarPhase
|
||||
* @brief lunarPhase, a plugin for Dotclear 2
|
||||
*
|
||||
* @defgroup lunarPhase Plugin lunarPhase.
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
*
|
||||
* Display the moon phases on a widget.
|
||||
* @author Tomtom, Pierre Van Glabeke and Contributors
|
||||
*
|
||||
* @author Tomtom (author)
|
||||
* @author Jean-Christian Denis (latest)
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
if (!defined('DC_RC_PATH')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$this->registerModule(
|
||||
'Moon phases',
|
||||
'Display the moon phases on a widget',
|
||||
'Tomtom, Pierre Van Glabeke and Contributors',
|
||||
'1.9',
|
||||
'1.8',
|
||||
[
|
||||
'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',
|
||||
'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',
|
||||
]
|
||||
);
|
||||
|
@ -2,11 +2,11 @@
|
||||
<modules xmlns:da="http://dotaddict.org/da/">
|
||||
<module id="lunarPhase">
|
||||
<name>Moon phases</name>
|
||||
<version>1.9</version>
|
||||
<version>1.8</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.9/plugin-lunarPhase.zip</file>
|
||||
<da:dcmin>2.28</da:dcmin>
|
||||
<file>https://git.dotclear.watch/JcDenis/lunarPhase/releases/download/v1.8/plugin-lunarPhase.zip</file>
|
||||
<da:dcmin>2.26</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>
|
||||
|
@ -1,20 +1,22 @@
|
||||
<?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 Dotclear\App;
|
||||
use dcCore;
|
||||
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
|
||||
@ -28,7 +30,7 @@ class Backend extends Process
|
||||
return false;
|
||||
}
|
||||
|
||||
App::behavior()->addBehavior('initWidgets', Widgets::initWidgets(...));
|
||||
dcCore::app()->addBehavior('initWidgets', [Widgets::class, 'initWidgets']);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1,20 +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 Dotclear\App;
|
||||
use dcCore;
|
||||
use dcUtils;
|
||||
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
|
||||
@ -28,15 +31,17 @@ class Frontend extends Process
|
||||
return false;
|
||||
}
|
||||
|
||||
App::behavior()->addBehaviors([
|
||||
dcCore::app()->addBehaviors([
|
||||
// Add public header for lunarphase css
|
||||
'publicHeadContent' => function (): void {
|
||||
if (App::blog()->isDefined()) {
|
||||
echo App::plugins()->cssLoad(App::blog()->url() . App::url()->getURLFor('lunarphase'));
|
||||
if (is_null(dcCore::app()->blog)) {
|
||||
return;
|
||||
}
|
||||
|
||||
echo dcUtils::cssLoad(dcCore::app()->blog->url . dcCore::app()->url->getURLFor('lunarphase'));
|
||||
},
|
||||
// Widgets
|
||||
'initWidgets' => Widgets::initWidgets(...),
|
||||
'initWidgets' => [Widgets::class, 'initWidgets'],
|
||||
]);
|
||||
|
||||
return true;
|
||||
|
@ -1,19 +1,21 @@
|
||||
<?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.
|
||||
|
27
src/My.php
27
src/My.php
@ -1,5 +1,15 @@
|
||||
<?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;
|
||||
@ -7,20 +17,11 @@ namespace Dotclear\Plugin\lunarPhase;
|
||||
use Dotclear\Module\MyPlugin;
|
||||
|
||||
/**
|
||||
* @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
|
||||
* This module definitions.
|
||||
*/
|
||||
class My extends MyPlugin
|
||||
{
|
||||
/**
|
||||
* List of lunar phase => image.
|
||||
*
|
||||
* @var array<string, string> LUNAR_PHASES
|
||||
*/
|
||||
/** @var array<string,string> List of lunar phase => image */
|
||||
public const LUNAR_PHASES = [
|
||||
'new_moon' => 'nm.png',
|
||||
'waxing_crescent_moon' => 'wcm1.png',
|
||||
@ -31,6 +32,4 @@ class My extends MyPlugin
|
||||
'last_quarter_moon' => 'tqm.png',
|
||||
'waning_crescent_moon' => 'wcm2.png',
|
||||
];
|
||||
|
||||
// Use default permissions
|
||||
}
|
||||
|
@ -1,20 +1,22 @@
|
||||
<?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 Dotclear\App;
|
||||
use dcCore;
|
||||
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
|
||||
@ -29,7 +31,7 @@ class Prepend extends Process
|
||||
}
|
||||
|
||||
// Register lunarphase CSS URL
|
||||
App::url()->register(
|
||||
dcCore::app()->url->register(
|
||||
'lunarphase',
|
||||
'lunarphase.css',
|
||||
'^lunarphase\.css',
|
||||
|
@ -1,23 +1,25 @@
|
||||
<?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 Dotclear\App;
|
||||
use dcCore;
|
||||
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
|
||||
@ -25,7 +27,7 @@ class Widgets
|
||||
$w->create(
|
||||
'lunarphase',
|
||||
__('Moon phases'),
|
||||
self::parseWidget(...),
|
||||
[self::class, 'parseWidget'],
|
||||
null,
|
||||
__('Display the moon phases')
|
||||
)
|
||||
@ -47,7 +49,7 @@ class Widgets
|
||||
|
||||
public static function parseWidget(WidgetsElement $w): string
|
||||
{
|
||||
if ($w->offline || !$w->checkHomeOnly(App::url()->type)) {
|
||||
if ($w->offline || !$w->checkHomeOnly(dcCore::app()->url->type)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
@ -198,14 +200,14 @@ class Widgets
|
||||
*/
|
||||
public static function formatValue(string $type, mixed $value): mixed
|
||||
{
|
||||
if (!App::blog()->isDefined()) {
|
||||
if (is_null(dcCore::app()->blog)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$res = '';
|
||||
$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');
|
||||
$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');
|
||||
|
||||
return match ($type) {
|
||||
'int' => number_format($value, 0),
|
||||
|
Loading…
Reference in New Issue
Block a user