release 1.6 for dotclear 2.24
parent
838d9d6440
commit
62f92cd10e
27
CHANGELOG.md
27
CHANGELOG.md
|
@ -1,15 +1,18 @@
|
||||||
v1.5 (23/04/2015) Pierre Van Glabeke :
|
1.6 - 2022.12.15
|
||||||
modification url support
|
- update to dotclear 2.24
|
||||||
|
|
||||||
v1.4 (06/02/2015) Pierre Van Glabeke :
|
1.5 - 2015.04.23 - Pierre Van Glabeke :
|
||||||
modifications localisation
|
- modification url support
|
||||||
|
|
||||||
v1.3 (14/12/2014) Pierre Van Glabeke :
|
1.4 - 2015.02.06 - Pierre Van Glabeke :
|
||||||
compatibilité dc2.7
|
- modifications localisation
|
||||||
|
|
||||||
v1.2 (17/02/2014) :
|
1.3 - 2014.12.14 - Pierre Van Glabeke :
|
||||||
reprise par Pierre Van Glabeke
|
- compatibilité dc2.7
|
||||||
correction bug (waning_crescent_moon)
|
|
||||||
images refaites (merci à 999Diaoul)
|
1.2 2014.02.17 :
|
||||||
compatibilité dc2.6
|
- reprise par Pierre Van Glabeke
|
||||||
fin de ligne unix
|
- correction bug (waning_crescent_moon)
|
||||||
|
- images refaites (merci à 999Diaoul)
|
||||||
|
- compatibilité dc2.6
|
||||||
|
- fin de ligne unix
|
23
LICENSE
23
LICENSE
|
@ -1,12 +1,12 @@
|
||||||
GNU GENERAL PUBLIC LICENSE
|
GNU GENERAL PUBLIC LICENSE
|
||||||
Version 2, June 1991
|
Version 2, June 1991
|
||||||
|
|
||||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
of this license document, but changing it is not allowed.
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
Preamble
|
Preamble
|
||||||
|
|
||||||
The licenses for most software are designed to take away your
|
The licenses for most software are designed to take away your
|
||||||
freedom to share and change it. By contrast, the GNU General Public
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
@ -56,7 +56,7 @@ patent must be licensed for everyone's free use or not licensed at all.
|
||||||
The precise terms and conditions for copying, distribution and
|
The precise terms and conditions for copying, distribution and
|
||||||
modification follow.
|
modification follow.
|
||||||
|
|
||||||
GNU GENERAL PUBLIC LICENSE
|
GNU GENERAL PUBLIC LICENSE
|
||||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
0. This License applies to any program or other work which contains
|
0. This License applies to any program or other work which contains
|
||||||
|
@ -255,7 +255,7 @@ make exceptions for this. Our decision will be guided by the two goals
|
||||||
of preserving the free status of all derivatives of our free software and
|
of preserving the free status of all derivatives of our free software and
|
||||||
of promoting the sharing and reuse of software generally.
|
of promoting the sharing and reuse of software generally.
|
||||||
|
|
||||||
NO WARRANTY
|
NO WARRANTY
|
||||||
|
|
||||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||||
|
@ -277,9 +277,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||||
POSSIBILITY OF SUCH DAMAGES.
|
POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
How to Apply These Terms to Your New Programs
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
If you develop a new program, and you want it to be of the greatest
|
If you develop a new program, and you want it to be of the greatest
|
||||||
possible use to the public, the best way to achieve this is to make it
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
@ -290,8 +290,8 @@ to attach them to the start of each source file to most effectively
|
||||||
convey the exclusion of warranty; and each file should have at least
|
convey the exclusion of warranty; and each file should have at least
|
||||||
the "copyright" line and a pointer to where the full notice is found.
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
{description}
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
Copyright (C) {year} {fullname}
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -329,7 +329,7 @@ necessary. Here is a sample; alter the names:
|
||||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||||
|
|
||||||
{signature of Ty Coon}, 1 April 1989
|
<signature of Ty Coon>, 1 April 1989
|
||||||
Ty Coon, President of Vice
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
This General Public License does not permit incorporating your program into
|
This General Public License does not permit incorporating your program into
|
||||||
|
@ -337,4 +337,3 @@ proprietary programs. If your program is a subroutine library, you may
|
||||||
consider it more useful to permit linking proprietary applications with the
|
consider it more useful to permit linking proprietary applications with the
|
||||||
library. If this is what you want to do, use the GNU Lesser General
|
library. If this is what you want to do, use the GNU Lesser General
|
||||||
Public License instead of this License.
|
Public License instead of this License.
|
||||||
|
|
||||||
|
|
46
README.md
46
README.md
|
@ -1,2 +1,44 @@
|
||||||
# lunarPhase
|
# README
|
||||||
Afficher les phases lunaire et autres données
|
|
||||||
|
[![Release](https://img.shields.io/github/v/release/JcDenis/lunarPhase)](https://github.com/JcDenis/lunarPhase/releases)
|
||||||
|
[![Date](https://img.shields.io/github/release-date/JcDenis/lunarPhase)](https://github.com/JcDenis/lunarPhase/releases)
|
||||||
|
[![Issues](https://img.shields.io/github/issues/JcDenis/lunarPhase)](https://github.com/JcDenis/lunarPhase/issues)
|
||||||
|
[![Dotclear](https://img.shields.io/badge/dotclear-v2.24-blue.svg)](https://fr.dotclear.org/download)
|
||||||
|
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-green.svg)](https://plugins.dotaddict.org/dc2/details/lunarPhase)
|
||||||
|
[![License](https://img.shields.io/github/license/JcDenis/lunarPhase)](https://github.com/JcDenis/lunarPhase/blob/master/LICENSE)
|
||||||
|
|
||||||
|
## WHAT IS LUNARPHASE ?
|
||||||
|
|
||||||
|
_lunarPhase_ is a plugin for the open-source
|
||||||
|
web publishing software called Dotclear.
|
||||||
|
|
||||||
|
It shows lunar phases on a widget.
|
||||||
|
|
||||||
|
## REQUIREMENTS
|
||||||
|
|
||||||
|
_lunarPhase_ requires:
|
||||||
|
|
||||||
|
* content admin permissions to manage widgets
|
||||||
|
* Dotclear 2.24
|
||||||
|
|
||||||
|
## USAGE
|
||||||
|
|
||||||
|
First install _lunarPhase_, manualy from a zip package or from
|
||||||
|
Dotaddict repository. (See Dotclear's documentation to know how do this)
|
||||||
|
|
||||||
|
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 : [GitHub Page](https://github.com/JcDenis/lunarPhase)
|
||||||
|
* Packages & details : [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
|
||||||
|
|
||||||
|
You are welcome to contribute to this code.
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @brief lunarPhase, a plugin for Dotclear 2
|
||||||
|
*
|
||||||
|
* @package Dotclear
|
||||||
|
* @subpackage Plugin
|
||||||
|
*
|
||||||
|
* @author Tomtom, Pierre Van Glabeke and Contributors
|
||||||
|
*
|
||||||
|
* @copyright Jean-Crhistian Denis
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
|
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
require __DIR__ . '/_widgets.php';
|
55
_define.php
55
_define.php
|
@ -1,28 +1,33 @@
|
||||||
<?php
|
<?php
|
||||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
/**
|
||||||
# This file is part of lunarPhase, a plugin for Dotclear.
|
* @brief lunarPhase, a plugin for Dotclear 2
|
||||||
#
|
*
|
||||||
# Copyright (c) 2009-2015 Tomtom
|
* @package Dotclear
|
||||||
# Contributor: Pierre Van Glabeke
|
* @subpackage Plugin
|
||||||
#
|
*
|
||||||
# Licensed under the GPL version 2.0 license.
|
* @author Tomtom, Pierre Van Glabeke and Contributors
|
||||||
# A copy of this license is available in LICENSE file or at
|
*
|
||||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
* @copyright Jean-Crhistian Denis
|
||||||
# -- END LICENSE BLOCK ------------------------------------
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
if (!defined('DC_RC_PATH')) { return; }
|
if (!defined('DC_RC_PATH')) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
$this->registerModule(
|
$this->registerModule(
|
||||||
/* Name */ 'lunarPhase',
|
'lunarPhase',
|
||||||
/* Description */ 'Display the moon phases',
|
'Display the moon phases on a widget',
|
||||||
/* Author */ 'Tomtom, Pierre Van Glabeke',
|
'Tomtom, Pierre Van Glabeke and Contributors',
|
||||||
/* Verion */ '1.5',
|
'1.6',
|
||||||
/* Properties */
|
[
|
||||||
array(
|
'requires' => [['core', '2.24']],
|
||||||
'permissions' => 'usage,contentadmin',
|
'permissions' => dcCore::app()->auth->makePermissions([
|
||||||
'type' => 'plugin',
|
dcAuth::PERMISSION_USAGE,
|
||||||
'dc_min' => '2.7',
|
dcAuth::PERMISSION_CONTENT_ADMIN,
|
||||||
'support' => 'http://forum.dotclear.org/viewtopic.php?pid=332971#p332971',
|
]),
|
||||||
'details' => 'http://plugins.dotaddict.org/dc2/details/lunarPhase'
|
'type' => 'plugin',
|
||||||
)
|
'support' => 'http://forum.dotclear.org/viewtopic.php?pid=332971#p332971',
|
||||||
);
|
'details' => 'https://plugins.dotaddict.org/dc2/details/' . basename(__DIR__),
|
||||||
|
'repository' => 'https://raw.githubusercontent.com/JcDenis/' . basename(__DIR__) . '/master/dcstore.xml',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
60
_prepend.php
60
_prepend.php
|
@ -1,16 +1,50 @@
|
||||||
<?php
|
<?php
|
||||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
/**
|
||||||
# This file is part of lunarPhase, a plugin for Dotclear.
|
* @brief lunarPhase, a plugin for Dotclear 2
|
||||||
#
|
*
|
||||||
# Copyright (c) 2009-2015 Tomtom
|
* @package Dotclear
|
||||||
# Contributor: Pierre Van Glabeke
|
* @subpackage Plugin
|
||||||
#
|
*
|
||||||
# Licensed under the GPL version 2.0 license.
|
* @author Tomtom, Pierre Van Glabeke and Contributors
|
||||||
# A copy of this license is available in LICENSE file or at
|
*
|
||||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
* @copyright Jean-Crhistian Denis
|
||||||
# -- END LICENSE BLOCK ------------------------------------
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
if (!defined('DC_RC_PATH')) { return; }
|
*/
|
||||||
|
if (!defined('DC_RC_PATH')) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
$__autoload['lunarPhase'] = dirname(__FILE__).'/inc/class.lunarphase.php';
|
Clearbricks::lib()->autoload(['lunarPhase' => __DIR__ . '/inc/class.lunarphase.php']);
|
||||||
|
|
||||||
require dirname(__FILE__).'/_widgets.php';
|
// Register lunarphase CSS URL
|
||||||
|
dcCore::app()->url->register(
|
||||||
|
'lunarphase',
|
||||||
|
'lunarphase.css',
|
||||||
|
'^lunarphase\.css',
|
||||||
|
function ($args) {
|
||||||
|
$phases = [
|
||||||
|
'new_moon' => 'nm',
|
||||||
|
'waxing_crescent_moon' => 'wcm1',
|
||||||
|
'first_quarter_moon' => 'fqm',
|
||||||
|
'waxing_gibbous_moon' => 'wgm1',
|
||||||
|
'full_moon' => 'fm',
|
||||||
|
'waning_gibbous_moon' => 'wgm2',
|
||||||
|
'last_quarter_moon' => 'tqm',
|
||||||
|
'waning_crescent_moon' => 'wcm2',
|
||||||
|
];
|
||||||
|
|
||||||
|
header('Content-Type: text/css; charset=UTF-8');
|
||||||
|
echo "/* lunarphase widget style */\n";
|
||||||
|
|
||||||
|
foreach ($phases as $phase => $image) {
|
||||||
|
echo
|
||||||
|
sprintf(
|
||||||
|
'#sidebar .lunarphase ul li.%s{background:transparent url(%s) no-repeat left 0.2em;padding-left:2em;}',
|
||||||
|
$phase,
|
||||||
|
dcCore::app()->blog->getPF(basename(__dir__) . '/img/' . $image . '.png')
|
||||||
|
) . "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
217
_public.php
217
_public.php
|
@ -1,203 +1,22 @@
|
||||||
<?php
|
<?php
|
||||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
/**
|
||||||
# This file is part of lunarPhase, a plugin for Dotclear.
|
* @brief lunarPhase, a plugin for Dotclear 2
|
||||||
#
|
*
|
||||||
# Copyright (c) 2009-2015 Tomtom
|
* @package Dotclear
|
||||||
# Contributor: Pierre Van Glabeke
|
* @subpackage Plugin
|
||||||
#
|
*
|
||||||
# Licensed under the GPL version 2.0 license.
|
* @author Tomtom, Pierre Van Glabeke and Contributors
|
||||||
# A copy of this license is available in LICENSE file or at
|
*
|
||||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
* @copyright Jean-Crhistian Denis
|
||||||
# -- END LICENSE BLOCK ------------------------------------
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
if (!defined('DC_RC_PATH')) { return; }
|
*/
|
||||||
|
if (!defined('DC_RC_PATH')) {
|
||||||
$core->addBehavior('publicHeadContent',array('lunarPhaseBehaviors','addCss'));
|
return null;
|
||||||
|
|
||||||
class lunarPhaseBehaviors
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
This function add CSS file in the public header
|
|
||||||
*/
|
|
||||||
public static function addCss()
|
|
||||||
{
|
|
||||||
global $core;
|
|
||||||
|
|
||||||
$url = $core->blog->getQMarkURL().'pf='.basename(dirname(__FILE__)).'/style.css';
|
|
||||||
|
|
||||||
echo '<link rel="stylesheet" media="screen" type="text/css" href="'.$url.'" />';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class lunarPhasePublic
|
require __DIR__ . '/_widgets.php';
|
||||||
{
|
|
||||||
/**
|
|
||||||
Displays lunarphase widget
|
|
||||||
|
|
||||||
@param w <b>dcWidget</b> dcWidget object
|
|
||||||
@return <b>string</b> HTML code of widget
|
|
||||||
*/
|
|
||||||
public static function widget($w)
|
|
||||||
{
|
|
||||||
global $core;
|
|
||||||
|
|
||||||
if ($w->offline)
|
// Add public header for lunarphase css
|
||||||
return;
|
dcCore::app()->addBehavior('publicHeadContent', function () {
|
||||||
|
echo dcUtils::cssLoad(dcCore::app()->blog->url . dcCore::app()->url->getURLFor('lunarphase'));
|
||||||
$lp = new lunarPhase();
|
});
|
||||||
|
|
||||||
if (($w->homeonly == 1 && $core->url->type != 'default') ||
|
|
||||||
($w->homeonly == 2 && $core->url->type == 'default')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$res =
|
|
||||||
($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '');
|
|
||||||
|
|
||||||
# Get live content
|
|
||||||
$res .= lunarPhasePublic::getLive($w,$lp);
|
|
||||||
# Get prevision content
|
|
||||||
$res .= lunarPhasePublic::getPrevisions($w,$lp);
|
|
||||||
|
|
||||||
return $w->renderDiv($w->content_only,'lunarphase '.$w->class,'',$res);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Returns "live" part of lunarphase widget
|
|
||||||
|
|
||||||
@param w <b>dcWidget</b> dcWidget object
|
|
||||||
@param lp <b>lunarPhaset</b> lunarPhase object
|
|
||||||
@return <b>string</b> Live HTML part
|
|
||||||
*/
|
|
||||||
public static function getLive($w,$lp)
|
|
||||||
{
|
|
||||||
$ul_mask = '<ul>%1$s</ul>';
|
|
||||||
$li_mask = '<li class="%2$s">%1$s</li>';
|
|
||||||
$live = $lp->getLive();
|
|
||||||
$res = '';
|
|
||||||
|
|
||||||
# Phase
|
|
||||||
if ($w->phase) {
|
|
||||||
$res .= sprintf($li_mask,$live['name'],$live['id']);
|
|
||||||
}
|
|
||||||
# Illumination
|
|
||||||
if ($w->illumination) {
|
|
||||||
$res .=
|
|
||||||
sprintf($li_mask,sprintf(__('Illumination: %s%%'),
|
|
||||||
lunarPhasePublic::formatValue('percent',$live['illumination'])),
|
|
||||||
'illumination');
|
|
||||||
}
|
|
||||||
# Moon's age
|
|
||||||
if ($w->age) {
|
|
||||||
$res .=
|
|
||||||
sprintf($li_mask,sprintf(__('Age of moon: %s days'),
|
|
||||||
lunarPhasePublic::formatValue('int',$live['age'])),
|
|
||||||
'age');
|
|
||||||
}
|
|
||||||
# Distance from earth
|
|
||||||
if ($w->dist_to_earth) {
|
|
||||||
$res .=
|
|
||||||
sprintf($li_mask,sprintf(__('Distance to earth: %s km'),
|
|
||||||
lunarPhasePublic::formatValue('int',$live['dist_to_earth'])),
|
|
||||||
'dist_to_earth');
|
|
||||||
}
|
|
||||||
# Distance from sun
|
|
||||||
if ($w->dist_to_sun) {
|
|
||||||
$res .=
|
|
||||||
sprintf($li_mask,sprintf(__('Distance to sun: %s km'),
|
|
||||||
lunarPhasePublic::formatValue('int',$live['dist_to_sun'])),
|
|
||||||
'dist_to_sun');
|
|
||||||
}
|
|
||||||
# Moon's angle
|
|
||||||
if ($w->moon_angle) {
|
|
||||||
$res .=
|
|
||||||
sprintf($li_mask,sprintf(__('Angle of moon: %s deg'),
|
|
||||||
lunarPhasePublic::formatValue('deg',$live['moon_angle'])),
|
|
||||||
'moon_angle');
|
|
||||||
}
|
|
||||||
# Sun's angle
|
|
||||||
if ($w->sun_angle) {
|
|
||||||
$res .=
|
|
||||||
sprintf($li_mask,sprintf(__('Angle of sun: %s deg'),
|
|
||||||
lunarPhasePublic::formatValue('deg',$live['sun_angle'])),
|
|
||||||
'sun_angle');
|
|
||||||
}
|
|
||||||
# Parallax
|
|
||||||
if ($w->parallax) {
|
|
||||||
$res .=
|
|
||||||
sprintf($li_mask,sprintf(__('Parallax: %s deg'),
|
|
||||||
lunarPhasePublic::formatValue('deg',$live['parallax'])),
|
|
||||||
'parallax');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strlen($res) > 0) {
|
|
||||||
return
|
|
||||||
'<h3>'.__('In live').'</h3>'.
|
|
||||||
sprintf($ul_mask,$res,'lunarphase');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Returns "previsions" part of lunarphase widget
|
|
||||||
|
|
||||||
@param w <b>dcWidget</b> dcWidget object
|
|
||||||
@param lp <b>lunarPhaset</b> lunarPhase object
|
|
||||||
@return <b>string</b> previsions HTML part
|
|
||||||
*/
|
|
||||||
public static function getPrevisions($w,$lp)
|
|
||||||
{
|
|
||||||
$ul_mask = '<ul class="%2$s">%1$s</ul>';
|
|
||||||
$li_mask = '<li class="%2$s" title="%3$s">%1$s</li>';
|
|
||||||
$res = '';
|
|
||||||
|
|
||||||
if ($w->previsions) {
|
|
||||||
foreach ($lp->getPrevisions() as $k => $v) {
|
|
||||||
$res .= sprintf($li_mask,lunarPhasePublic::formatValue('date',$v['date']),$k,$v['name']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strlen($res) > 0) {
|
|
||||||
return
|
|
||||||
'<h3>'.__('Previsions').'</h3>'.
|
|
||||||
sprintf($ul_mask,$res,'lunarphase');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Returns value passed in argument with a correct format
|
|
||||||
|
|
||||||
@param type <b>string</b> Type of convertion
|
|
||||||
@param value <b>mixed</b> Value to convert
|
|
||||||
@return <b>mixed</b> Converted value
|
|
||||||
*/
|
|
||||||
public static function formatValue($type = '',$value)
|
|
||||||
{
|
|
||||||
$res = '';
|
|
||||||
$format = $GLOBALS['core']->blog->settings->system->date_format.' - ';
|
|
||||||
$format .= $GLOBALS['core']->blog->settings->system->time_format;
|
|
||||||
$tz = $GLOBALS['core']->blog->settings->system->blog_timezone;
|
|
||||||
|
|
||||||
switch ($type) {
|
|
||||||
case 'int':
|
|
||||||
$res = number_format($value,0);
|
|
||||||
break;
|
|
||||||
case 'float':
|
|
||||||
$res = number_format($value,2);
|
|
||||||
break;
|
|
||||||
case 'percent':
|
|
||||||
$res = number_format($value * 100,0);
|
|
||||||
break;
|
|
||||||
case 'date':
|
|
||||||
$res = dt::str($format,$value,$tz);
|
|
||||||
break;
|
|
||||||
case 'deg':
|
|
||||||
$res = number_format(($value * (180.0 / M_PI)),2);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$res = $value;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $res;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
248
_widgets.php
248
_widgets.php
|
@ -1,44 +1,214 @@
|
||||||
<?php
|
<?php
|
||||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
/**
|
||||||
# This file is part of lunarPhase, a plugin for Dotclear.
|
* @brief lunarPhase, a plugin for Dotclear 2
|
||||||
#
|
*
|
||||||
# Copyright (c) 2009-2015 Tomtom
|
* @package Dotclear
|
||||||
# Contributor: Pierre Van Glabeke
|
* @subpackage Plugin
|
||||||
#
|
*
|
||||||
# Licensed under the GPL version 2.0 license.
|
* @author Tomtom, Pierre Van Glabeke and Contributors
|
||||||
# A copy of this license is available in LICENSE file or at
|
*
|
||||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
* @copyright Jean-Crhistian Denis
|
||||||
# -- END LICENSE BLOCK ------------------------------------
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
if (!defined('DC_RC_PATH')) { return; }
|
*/
|
||||||
|
if (!defined('DC_RC_PATH')) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
$core->addBehavior('initWidgets',array('lunarPhaseWidgets','initWidgets'));
|
dcCore::app()->addBehavior('initWidgets', ['lunarPhaseWidgets','initWidgets']);
|
||||||
|
|
||||||
class lunarPhaseWidgets
|
class lunarPhaseWidgets
|
||||||
{
|
{
|
||||||
public static function initWidgets($w)
|
public static function initWidgets($w)
|
||||||
{
|
{
|
||||||
$w->create('lunarphase',__('LunarPhase: moon phases'),array('lunarPhasePublic','widget'),
|
$w->create(
|
||||||
null,
|
'lunarphase',
|
||||||
__('Display the moon phases'));
|
__('LunarPhase: moon phases'),
|
||||||
$w->lunarphase->setting('title',__('Title:'),__('Moon phases'));
|
['lunarPhaseWidgets','widget'],
|
||||||
$w->lunarphase->setting('phase',__('Display actual phase of moon'),1,'check');
|
null,
|
||||||
$w->lunarphase->setting('illumination',__('Display actual illumination of moon'),1,'check');
|
__('Display the moon phases')
|
||||||
$w->lunarphase->setting('age',__('Display actual age of moon'),1,'check');
|
)
|
||||||
$w->lunarphase->setting('dist_to_earth',__('Display actual distance between moon and earth'),1,'check');
|
->addTitle(__('Moon phases'))
|
||||||
$w->lunarphase->setting('dist_to_sun',__('Display actual distance between moon and sun'),1,'check');
|
->setting('phase', __('Display actual phase of moon'), 1, 'check')
|
||||||
$w->lunarphase->setting('moon_angle',__('Display actual angle of moon'),1,'check');
|
->setting('illumination', __('Display actual illumination of moon'), 1, 'check')
|
||||||
$w->lunarphase->setting('sun_angle',__('Display actual angle of sun'),1,'check');
|
->setting('age', __('Display actual age of moon'), 1, 'check')
|
||||||
$w->lunarphase->setting('parallax',__('Display actual parallax of moon'),1,'check');
|
->setting('dist_to_earth', __('Display actual distance between moon and earth'), 1, 'check')
|
||||||
$w->lunarphase->setting('previsions',__('Display all previsions for the next moon phases'),1,'check');
|
->setting('dist_to_sun', __('Display actual distance between moon and sun'), 1, 'check')
|
||||||
$w->lunarphase->setting('homeonly',__('Display on:'),0,'combo',
|
->setting('moon_angle', __('Display actual angle of moon'), 1, 'check')
|
||||||
array(
|
->setting('sun_angle', __('Display actual angle of sun'), 1, 'check')
|
||||||
__('All pages') => 0,
|
->setting('parallax', __('Display actual parallax of moon'), 1, 'check')
|
||||||
__('Home page only') => 1,
|
->setting('previsions', __('Display all previsions for the next moon phases'), 1, 'check')
|
||||||
__('Except on home page') => 2
|
->addHomeOnly()
|
||||||
)
|
->addContentOnly()
|
||||||
);
|
->addClass()
|
||||||
$w->lunarphase->setting('content_only',__('Content only'),0,'check');
|
->addOffline();
|
||||||
$w->lunarphase->setting('class',__('CSS class:'),'');
|
}
|
||||||
$w->lunarphase->setting('offline',__('Offline'),0,'check');
|
|
||||||
}
|
public static function widget($w)
|
||||||
}
|
{
|
||||||
|
if ($w->offline) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$w->checkHomeOnly(dcCore::app()->url->type)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$lp = new lunarPhase();
|
||||||
|
|
||||||
|
return $w->renderDiv(
|
||||||
|
$w->content_only,
|
||||||
|
'lunarphase ' . $w->class,
|
||||||
|
'',
|
||||||
|
($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '') .
|
||||||
|
self::getLive($w, $lp) .
|
||||||
|
self::getPrevisions($w, $lp)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns "live" part of lunarphase widget
|
||||||
|
*
|
||||||
|
* @param dcWidget $w dcWidget object
|
||||||
|
* @param lunarPhase $lp lunarPhase object
|
||||||
|
* @return string Live HTML part
|
||||||
|
*/
|
||||||
|
public static function getLive($w, $lp)
|
||||||
|
{
|
||||||
|
$li = '<li class="%2$s">%1$s</li>';
|
||||||
|
$live = $lp->getLive();
|
||||||
|
$res = '';
|
||||||
|
|
||||||
|
# Phase
|
||||||
|
if ($w->phase) {
|
||||||
|
$res .= sprintf($li, $live['name'], $live['id']);
|
||||||
|
}
|
||||||
|
# Illumination
|
||||||
|
if ($w->illumination) {
|
||||||
|
$res .= sprintf(
|
||||||
|
$li,
|
||||||
|
sprintf(
|
||||||
|
__('Illumination: %s%%'),
|
||||||
|
self::formatValue('percent', $live['illumination'])
|
||||||
|
),
|
||||||
|
'illumination'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
# Moon's age
|
||||||
|
if ($w->age) {
|
||||||
|
$res .= sprintf(
|
||||||
|
$li,
|
||||||
|
sprintf(
|
||||||
|
__('Age of moon: %s days'),
|
||||||
|
self::formatValue('int', $live['age'])
|
||||||
|
),
|
||||||
|
'age'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
# Distance from earth
|
||||||
|
if ($w->dist_to_earth) {
|
||||||
|
$res .= sprintf(
|
||||||
|
$li,
|
||||||
|
sprintf(
|
||||||
|
__('Distance to earth: %s km'),
|
||||||
|
self::formatValue('int', $live['dist_to_earth'])
|
||||||
|
),
|
||||||
|
'dist_to_earth'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
# Distance from sun
|
||||||
|
if ($w->dist_to_sun) {
|
||||||
|
$res .= sprintf(
|
||||||
|
$li,
|
||||||
|
sprintf(
|
||||||
|
__('Distance to sun: %s km'),
|
||||||
|
self::formatValue('int', $live['dist_to_sun'])
|
||||||
|
),
|
||||||
|
'dist_to_sun'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
# Moon's angle
|
||||||
|
if ($w->moon_angle) {
|
||||||
|
$res .= sprintf(
|
||||||
|
$li,
|
||||||
|
sprintf(
|
||||||
|
__('Angle of moon: %s deg'),
|
||||||
|
self::formatValue('deg', $live['moon_angle'])
|
||||||
|
),
|
||||||
|
'moon_angle'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
# Sun's angle
|
||||||
|
if ($w->sun_angle) {
|
||||||
|
$res .= sprintf(
|
||||||
|
$li,
|
||||||
|
sprintf(
|
||||||
|
__('Angle of sun: %s deg'),
|
||||||
|
self::formatValue('deg', $live['sun_angle'])
|
||||||
|
),
|
||||||
|
'sun_angle'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
# Parallax
|
||||||
|
if ($w->parallax) {
|
||||||
|
$res .= sprintf(
|
||||||
|
$li,
|
||||||
|
sprintf(
|
||||||
|
__('Parallax: %s deg'),
|
||||||
|
self::formatValue('deg', $live['parallax'])
|
||||||
|
),
|
||||||
|
'parallax'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return strlen($res) > 0 ?
|
||||||
|
sprintf('<h4>%s</h4><ul>%s</ul>', __('In live'), $res)
|
||||||
|
: '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns "previsions" part of lunarphase widget
|
||||||
|
*
|
||||||
|
* @param dcWidget $w dcWidget object
|
||||||
|
* @param lunarPhase $lp lunarPhase object
|
||||||
|
* @return string Previsions HTML part
|
||||||
|
*/
|
||||||
|
public static function getPrevisions($w, $lp)
|
||||||
|
{
|
||||||
|
$li = '<li class="%s" title="%s">%s</li>';
|
||||||
|
$res = '';
|
||||||
|
|
||||||
|
if ($w->previsions) {
|
||||||
|
foreach ($lp->getPrevisions() as $k => $v) {
|
||||||
|
$res .= sprintf($li, $k, $v['name'], self::formatValue('date', (int) $v['date']));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return strlen($res) > 0 ?
|
||||||
|
sprintf('<h4>%s</h4><ul class="lunarphase">%s</ul>', __('Previsions'), $res)
|
||||||
|
: '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns value passed in argument with a correct format
|
||||||
|
*
|
||||||
|
* @param string $type Type of convertion
|
||||||
|
* @param mixed $value Value to convert
|
||||||
|
* @return mixed Converted value
|
||||||
|
*/
|
||||||
|
public static function formatValue($type, $value)
|
||||||
|
{
|
||||||
|
$res = '';
|
||||||
|
$format = dcCore::app()->blog->settings->system->date_format . ' - ';
|
||||||
|
$format .= dcCore::app()->blog->settings->system->time_format;
|
||||||
|
$tz = dcCore::app()->blog->settings->system->blog_timezone;
|
||||||
|
|
||||||
|
return match ($type) {
|
||||||
|
'int' => number_format($value, 0),
|
||||||
|
'float' => number_format($value, 2),
|
||||||
|
'percent' => number_format($value * 100, 0),
|
||||||
|
'date' => dt::str($format, $value, $tz),
|
||||||
|
'deg' => number_format(($value * (180.0 / M_PI)), 2),
|
||||||
|
default => $value,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<modules xmlns:da="http://dotaddict.org/da/">
|
||||||
|
<module id="lunarPhase">
|
||||||
|
<name>lunarPhase</name>
|
||||||
|
<version>1.6</version>
|
||||||
|
<author>Tomtom, Pierre Van Glabeke and Contributors</author>
|
||||||
|
<desc>Display the moon phases on a widget</desc>
|
||||||
|
<file>https://github.com/JcDenis/lunarPhase/releases/download/v1.6/plugin-lunarPhase.zip</file>
|
||||||
|
<da:dcmin>2.24</da:dcmin>
|
||||||
|
<da:details>https://plugins.dotaddict.org/dc2/details/lunarPhase</da:details>
|
||||||
|
<da:support>http://forum.dotclear.org/viewtopic.php?pid=332971#p332971</da:support>
|
||||||
|
</module>
|
||||||
|
</modules>
|
|
@ -1,213 +1,210 @@
|
||||||
<?php
|
<?php
|
||||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
/**
|
||||||
# This file is part of lunarPhase, a plugin for Dotclear.
|
* @brief lunarPhase, a plugin for Dotclear 2
|
||||||
#
|
*
|
||||||
# Copyright (c) 2009-2015 Tomtom
|
* @package Dotclear
|
||||||
# Contributor: Pierre Van Glabeke
|
* @subpackage Plugin
|
||||||
#
|
*
|
||||||
# Licensed under the GPL version 2.0 license.
|
* @author Tomtom, Pierre Van Glabeke and Contributors
|
||||||
# A copy of this license is available in LICENSE file or at
|
*
|
||||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
* @copyright Jean-Crhistian Denis
|
||||||
# -- END LICENSE BLOCK ------------------------------------
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
if (!defined('DC_RC_PATH')) {return;}
|
*/
|
||||||
|
if (!defined('DC_RC_PATH')) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
class lunarPhase
|
class lunarPhase
|
||||||
{
|
{
|
||||||
# Astronomical constants.
|
# Astronomical constants.
|
||||||
const epoch = 2444238.5; # 1980 January 0.0
|
public const epoch = 2444238.5; # 1980 January 0.0
|
||||||
|
|
||||||
# Constants defining the Sun's apparent orbit.
|
# Constants defining the Sun's apparent orbit.
|
||||||
const elonge = 278.833540; # ecliptic longitude of the Sun at epoch 1980.0
|
public const elonge = 278.833540; # ecliptic longitude of the Sun at epoch 1980.0
|
||||||
const elongp = 282.596403; # ecliptic longitude of the Sun at perigee
|
public const elongp = 282.596403; # ecliptic longitude of the Sun at perigee
|
||||||
const eccent = 0.016718; # eccentricity of Earth's orbit
|
public const eccent = 0.016718; # eccentricity of Earth's orbit
|
||||||
const sunsMax = 1.495985e8; # semi-major axis of Earth's orbit, km
|
public const sunsMax = 1.495985e8; # semi-major axis of Earth's orbit, km
|
||||||
const sunAngSiz = 0.533128; # sun's angular size, degrees, at semi-major axis distance
|
public const sunAngSiz = 0.533128; # sun's angular size, degrees, at semi-major axis distance
|
||||||
|
|
||||||
# Elements of the Moon's orbit, epoch 1980.0.
|
# Elements of the Moon's orbit, epoch 1980.0.
|
||||||
const mmLong = 64.975464; # moon's mean longitude at the epoch
|
public const mmLong = 64.975464; # moon's mean longitude at the epoch
|
||||||
const mmLongp = 349.383063; # mean longitude of the perigee at the epoch
|
public const mmLongp = 349.383063; # mean longitude of the perigee at the epoch
|
||||||
const mlNode = 151.950429; # mean longitude of the node at the epoch
|
public const mlNode = 151.950429; # mean longitude of the node at the epoch
|
||||||
const mInc = 5.145396; # inclination of the Moon's orbit
|
public const mInc = 5.145396; # inclination of the Moon's orbit
|
||||||
const mEcc = 0.054900; # eccentricity of the Moon's orbit
|
public const mEcc = 0.054900; # eccentricity of the Moon's orbit
|
||||||
const mAngSiz = 0.5181; # moon's angular size at distance a from Earth
|
public const mAngSiz = 0.5181; # moon's angular size at distance a from Earth
|
||||||
const msMax = 384401.0; # semi-major axis of Moon's orbit in km
|
public const msMax = 384401.0; # semi-major axis of Moon's orbit in km
|
||||||
const mParallax = 0.9507; # parallax at distance a from Earth
|
public const mParallax = 0.9507; # parallax at distance a from Earth
|
||||||
const synodic = 29.53058868; # synodic month (new Moon to new Moon)
|
public const synodic = 29.53058868; # synodic month (new Moon to new Moon)
|
||||||
|
|
||||||
protected $live;
|
protected $live;
|
||||||
protected $previsions;
|
protected $previsions;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->live = new ArrayObject;
|
$this->live = new ArrayObject();
|
||||||
$this->previsions = new ArrayObject;
|
$this->previsions = new ArrayObject();
|
||||||
|
|
||||||
$this->setLive();
|
$this->setLive();
|
||||||
$this->setPrevisions();
|
$this->setPrevisions();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLive()
|
public function getLive()
|
||||||
{
|
{
|
||||||
return $this->live;
|
return $this->live;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPrevisions()
|
public function getPrevisions()
|
||||||
{
|
{
|
||||||
return $this->previsions;
|
return $this->previsions;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function setLive()
|
private function setLive()
|
||||||
{
|
{
|
||||||
$day = $this->jTime(time()) - self::epoch;
|
$day = $this->jTime(time()) - self::epoch;
|
||||||
|
|
||||||
# Calculate sun's position and angle
|
# Calculate sun's position and angle
|
||||||
$N = $this->fixAngle((360 / 365.2422) * $day);
|
$N = $this->fixAngle((360 / 365.2422) * $day);
|
||||||
$M = $this->fixAngle($N + self::elonge - self::elongp);
|
$M = $this->fixAngle($N + self::elonge - self::elongp);
|
||||||
$Ec = $this->kepler($M, self::eccent);
|
$Ec = $this->kepler($M, self::eccent);
|
||||||
$Ec = sqrt((1 + self::eccent) / (1 - self::eccent)) * tan($Ec / 2);
|
$Ec = sqrt((1 + self::eccent) / (1 - self::eccent)) * tan($Ec / 2);
|
||||||
$Ec = 2 * $this->toDeg(atan($Ec));
|
$Ec = 2 * $this->toDeg(atan($Ec));
|
||||||
$lambdaSun = $this->fixAngle($Ec + self::elongp);
|
$lambdaSun = $this->fixAngle($Ec + self::elongp);
|
||||||
$F = ((1 + self::eccent * cos($this->toRad($Ec))) / (1 - self::eccent * self::eccent));
|
$F = ((1 + self::eccent * cos($this->toRad($Ec))) / (1 - self::eccent * self::eccent));
|
||||||
|
|
||||||
# Calculate moon's age, position and angle
|
# Calculate moon's age, position and angle
|
||||||
$ml = $this->fixAngle(13.1763966 * $day + self::mmLong);
|
$ml = $this->fixAngle(13.1763966 * $day + self::mmLong);
|
||||||
$MM = $this->fixAngle($ml - 0.1114041 * $day - self::mmLongp);
|
$MM = $this->fixAngle($ml - 0.1114041 * $day - self::mmLongp);
|
||||||
$MN = $this->fixAngle(self::mlNode - 0.0529539 * $day);
|
$MN = $this->fixAngle(self::mlNode - 0.0529539 * $day);
|
||||||
$Ev = 1.2739 * sin($this->toRad(2 * ($ml - $lambdaSun) - $MM));
|
$Ev = 1.2739 * sin($this->toRad(2 * ($ml - $lambdaSun) - $MM));
|
||||||
$Ae = 0.1858 * sin($this->toRad($M));
|
$Ae = 0.1858 * sin($this->toRad($M));
|
||||||
$A3 = 0.37 * sin($this->toRad($M));
|
$A3 = 0.37 * sin($this->toRad($M));
|
||||||
$MmP = $MM + $Ev - $Ae - $A3;
|
$MmP = $MM + $Ev - $Ae - $A3;
|
||||||
$mEc = 6.2886 * sin($this->toRad($MmP));
|
$mEc = 6.2886 * sin($this->toRad($MmP));
|
||||||
$A4 = 0.214 * sin($this->toRad(2 * $MmP));
|
$A4 = 0.214 * sin($this->toRad(2 * $MmP));
|
||||||
$lP = $ml + $Ev + $mEc - $Ae + $A4;
|
$lP = $ml + $Ev + $mEc - $Ae + $A4;
|
||||||
$V = 0.6583 * sin($this->toRad(2 * ($lP - $lambdaSun)));
|
$V = 0.6583 * sin($this->toRad(2 * ($lP - $lambdaSun)));
|
||||||
$lPP = $lP + $V;
|
$lPP = $lP + $V;
|
||||||
$NP = $MN - 0.16 * sin($this->toRad($M));
|
$NP = $MN - 0.16 * sin($this->toRad($M));
|
||||||
$y = sin($this->toRad($lPP - $NP)) * cos($this->toRad(self::mInc));
|
$y = sin($this->toRad($lPP - $NP)) * cos($this->toRad(self::mInc));
|
||||||
$x = cos($this->toRad($lPP - $NP));
|
$x = cos($this->toRad($lPP - $NP));
|
||||||
$lambdaMoon = $this->toDeg(atan2($y, $x));
|
$lambdaMoon = $this->toDeg(atan2($y, $x));
|
||||||
$lambdaMoon += $NP;
|
$lambdaMoon += $NP;
|
||||||
$mage = $lPP - $lambdaSun;
|
$mage = $lPP - $lambdaSun;
|
||||||
$BetaM = $this->toDeg(asin(sin($this->toRad($lPP - $NP)) * sin($this->toRad(self::mInc))));
|
$BetaM = $this->toDeg(asin(sin($this->toRad($lPP - $NP)) * sin($this->toRad(self::mInc))));
|
||||||
|
|
||||||
$this->live['illumination'] = (1 - cos($this->toRad($mage))) / 2;
|
$this->live['illumination'] = (1 - cos($this->toRad($mage))) / 2;
|
||||||
$this->live['age'] = self::synodic * ($this->fixAngle($mage) / 360.0);
|
$this->live['age'] = self::synodic * ($this->fixAngle($mage) / 360.0);
|
||||||
$this->live['dist_to_earth'] = (self::msMax * (1 - self::mEcc * self::mEcc)) / (1 + self::mEcc * cos($this->toRad($MmP + $mEc)));
|
$this->live['dist_to_earth'] = (self::msMax * (1 - self::mEcc * self::mEcc)) / (1 + self::mEcc * cos($this->toRad($MmP + $mEc)));
|
||||||
$this->live['dist_to_sun'] = self::sunsMax / $F;
|
$this->live['dist_to_sun'] = self::sunsMax / $F;
|
||||||
$this->live['sun_angle'] = $F * self::sunAngSiz;
|
$this->live['sun_angle'] = $F * self::sunAngSiz;
|
||||||
$this->live['moon_angle'] = self::mAngSiz / ($this->live['dist_to_earth'] / self::msMax);
|
$this->live['moon_angle'] = self::mAngSiz / ($this->live['dist_to_earth'] / self::msMax);
|
||||||
$this->live['parallax'] = self::mParallax / ($this->live['dist_to_earth'] / self::msMax);
|
$this->live['parallax'] = self::mParallax / ($this->live['dist_to_earth'] / self::msMax);
|
||||||
|
|
||||||
$this->setPhase();
|
$this->setPhase();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function setPhase()
|
private function setPhase()
|
||||||
{
|
{
|
||||||
if ($this->live['age'] >= self::synodic || $this->live['age'] <= self::synodic/8) {
|
if ($this->live['age'] >= self::synodic || $this->live['age'] <= self::synodic / 8) {
|
||||||
$this->live['id'] = 'new_moon';
|
$this->live['id'] = 'new_moon';
|
||||||
$this->live['name'] = __('New moon');
|
$this->live['name'] = __('New moon');
|
||||||
}
|
} elseif ($this->live['age'] >= self::synodic / 8 && $this->live['age'] <= self::synodic / 4) {
|
||||||
elseif ($this->live['age'] >= self::synodic/8 && $this->live['age'] <= self::synodic/4) {
|
$this->live['id'] = 'waxing_crescent_moon';
|
||||||
$this->live['id'] = 'waxing_crescent_moon';
|
$this->live['name'] = __('Waxing crescent moon');
|
||||||
$this->live['name'] = __('Waxing crescent moon');
|
} elseif ($this->live['age'] >= self::synodic / 4 && $this->live['age'] <= self::synodic * 3 / 8) {
|
||||||
}
|
$this->live['id'] = 'first_quarter_moon';
|
||||||
elseif ($this->live['age'] >= self::synodic/4 && $this->live['age'] <= self::synodic*3/8) {
|
$this->live['name'] = __('First quarter moon');
|
||||||
$this->live['id'] = 'first_quarter_moon';
|
} elseif ($this->live['age'] >= self::synodic * 3 / 8 && $this->live['age'] <= self::synodic / 2) {
|
||||||
$this->live['name'] = __('First quarter moon');
|
$this->live['id'] = 'waxing_gibbous_moon';
|
||||||
}
|
$this->live['name'] = __('Waxing gibbous moon');
|
||||||
elseif ($this->live['age'] >= self::synodic*3/8 && $this->live['age'] <= self::synodic/2) {
|
} elseif ($this->live['age'] >= self::synodic / 2 && $this->live['age'] <= self::synodic * 5 / 8) {
|
||||||
$this->live['id'] = 'waxing_gibbous_moon';
|
$this->live['id'] = 'full_moon';
|
||||||
$this->live['name'] = __('Waxing gibbous moon');
|
$this->live['name'] = __('Full moon');
|
||||||
}
|
} elseif ($this->live['age'] >= self::synodic * 5 / 8 && $this->live['age'] <= self::synodic * 3 / 4) {
|
||||||
elseif ($this->live['age'] >= self::synodic/2 && $this->live['age'] <= self::synodic*5/8) {
|
$this->live['id'] = 'waning_gibbous_moon';
|
||||||
$this->live['id'] = 'full_moon';
|
$this->live['name'] = __('Waning gibbous moon');
|
||||||
$this->live['name'] = __('Full moon');
|
} elseif ($this->live['age'] >= self::synodic * 3 / 4 && $this->live['age'] <= self::synodic * 7 / 8) {
|
||||||
}
|
$this->live['id'] = 'last_quarter_moon';
|
||||||
elseif ($this->live['age'] >= self::synodic*5/8 && $this->live['age'] <= self::synodic*3/4) {
|
$this->live['name'] = __('Last quarter moon');
|
||||||
$this->live['id'] = 'waning_gibbous_moon';
|
} elseif ($this->live['age'] >= self::synodic * 7 / 8 && $this->live['age'] <= self::synodic) {
|
||||||
$this->live['name'] = __('Waning gibbous moon');
|
$this->live['id'] = 'waning_crescent_moon';
|
||||||
}
|
$this->live['name'] = __('Waning crescent moon');
|
||||||
elseif ($this->live['age'] >= self::synodic*3/4 && $this->live['age'] <= self::synodic*7/8) {
|
}
|
||||||
$this->live['id'] = 'last_quarter_moon';
|
}
|
||||||
$this->live['name'] = __('Last quarter moon');
|
|
||||||
}
|
private function setPrevisions()
|
||||||
elseif ($this->live['age'] >= self::synodic*7/8 && $this->live['age'] <= self::synodic) {
|
{
|
||||||
$this->live['id'] = 'waning_crescent_moon';
|
$ts_day = 24 * 60 * 60;
|
||||||
$this->live['name'] = __('Waning crescent moon');
|
$ts_synodic = self::synodic * $ts_day;
|
||||||
}
|
$start = time() - $this->live['age'] * $ts_day;
|
||||||
}
|
|
||||||
|
$this->previsions['waxing_crescent_moon'] = [
|
||||||
private function setPrevisions()
|
'name' => __('Waxing crescent moon'),
|
||||||
{
|
'date' => $start + $ts_synodic / 8,
|
||||||
$ts_day = 24*60*60;
|
];
|
||||||
$ts_synodic = self::synodic * $ts_day;
|
$this->previsions['first_quarter_moon'] = [
|
||||||
$start = time() - $this->live['age'] * $ts_day;
|
'name' => __('First quarter moon'),
|
||||||
|
'date' => $start + $ts_synodic / 4,
|
||||||
$this->previsions['waxing_crescent_moon'] = array(
|
];
|
||||||
'name' => __('Waxing crescent moon'),
|
$this->previsions['waxing_gibbous_moon'] = [
|
||||||
'date' => $start + $ts_synodic / 8
|
'name' => __('Waxing gibbous moon'),
|
||||||
);
|
'date' => $start + $ts_synodic * 3 / 8,
|
||||||
$this->previsions['first_quarter_moon'] = array(
|
];
|
||||||
'name' => __('First quarter moon'),
|
$this->previsions['full_moon'] = [
|
||||||
'date' => $start + $ts_synodic / 4
|
'name' => __('Full moon'),
|
||||||
);
|
'date' => $start + $ts_synodic / 2,
|
||||||
$this->previsions['waxing_gibbous_moon'] = array(
|
];
|
||||||
'name' => __('Waxing gibbous moon'),
|
$this->previsions['waning_gibbous_moon'] = [
|
||||||
'date' => $start + $ts_synodic * 3 / 8
|
'name' => __('Waning gibbous moon'),
|
||||||
);
|
'date' => $start + $ts_synodic * 5 / 8,
|
||||||
$this->previsions['full_moon'] = array(
|
];
|
||||||
'name' => __('Full moon'),
|
$this->previsions['last_quarter_moon'] = [
|
||||||
'date' => $start + $ts_synodic / 2
|
'name' => __('Last quarter moon'),
|
||||||
);
|
'date' => $start + $ts_synodic * 3 / 4,
|
||||||
$this->previsions['waning_gibbous_moon'] = array(
|
];
|
||||||
'name' => __('Waning gibbous moon'),
|
$this->previsions['waning_crescent_moon'] = [
|
||||||
'date' => $start + $ts_synodic * 5 / 8
|
'name' => __('Waning crescent moon'),
|
||||||
);
|
'date' => $start + $ts_synodic * 7 / 8,
|
||||||
$this->previsions['last_quarter_moon'] = array(
|
];
|
||||||
'name' => __('Last quarter moon'),
|
$this->previsions['new_moon'] = [
|
||||||
'date' => $start + $ts_synodic * 3 / 4
|
'name' => __('New moon'),
|
||||||
);
|
'date' => $start + $ts_synodic,
|
||||||
$this->previsions['waning_crescent_moon'] = array(
|
];
|
||||||
'name' => __('Waning crescent moon'),
|
}
|
||||||
'date' => $start + $ts_synodic * 7 / 8
|
|
||||||
);
|
private function fixAngle($x)
|
||||||
$this->previsions['new_moon'] = array(
|
{
|
||||||
'name' => __('New moon'),
|
return ($x - 360.0 * (floor($x / 360.0)));
|
||||||
'date' =>$start + $ts_synodic
|
}
|
||||||
);
|
|
||||||
}
|
private function toRad($x)
|
||||||
|
{
|
||||||
private function fixAngle($x)
|
return ($x * (M_PI / 180.0));
|
||||||
{
|
}
|
||||||
return ($x - 360.0 * (floor($x / 360.0)));
|
|
||||||
}
|
private function toDeg($x)
|
||||||
|
{
|
||||||
private function toRad($x)
|
return ($x * (180.0 / M_PI));
|
||||||
{
|
}
|
||||||
return ($x * (M_PI / 180.0));
|
|
||||||
}
|
private function jTime($t)
|
||||||
|
{
|
||||||
private function toDeg($x)
|
return ($t / 86400) + 2440587.5;
|
||||||
{
|
}
|
||||||
return ($x * (180.0 / M_PI));
|
|
||||||
}
|
private function kepler($m, $ecc)
|
||||||
|
{
|
||||||
private function jTime($t)
|
$delta = null;
|
||||||
{
|
$EPSILON = 1e-6;
|
||||||
return ($t / 86400) + 2440587.5;
|
|
||||||
}
|
$m = $this->toRad($m);
|
||||||
|
$e = $m;
|
||||||
private function kepler($m, $ecc)
|
while (abs((int) $delta) > $EPSILON) {
|
||||||
{
|
$delta = $e - $ecc * sin($e) - $m;
|
||||||
$delta = null;
|
$e -= $delta / (1 - $ecc * cos($e));
|
||||||
$EPSILON = 1e-6;
|
}
|
||||||
|
|
||||||
$m = $this->toRad($m);
|
return ($e);
|
||||||
$e = $m;
|
}
|
||||||
while (abs($delta) > $EPSILON)
|
}
|
||||||
{
|
|
||||||
$delta = $e - $ecc * sin($e) - $m;
|
|
||||||
$e -= $delta / (1 - $ecc * cos($e));
|
|
||||||
}
|
|
||||||
return ($e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,133 +1,99 @@
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
"Project-Id-Version: lunarPhase 1.1-RC2\n"
|
"Project-Id-Version: lunarPhase 1.6\n"
|
||||||
"POT-Creation-Date: \n"
|
"POT-Creation-Date: \n"
|
||||||
"PO-Revision-Date: 2010-09-30T22:49:45+00:00\n"
|
"PO-Revision-Date: 2022-12-15T21:10:10+00:00\n"
|
||||||
"Last-Translator: Thomas Bouron\n"
|
"Last-Translator: Jean-Crhistian Denis\n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
||||||
|
|
||||||
|
msgid "LunarPhase: moon phases"
|
||||||
|
msgstr "LunarPhase : phases de la Lune"
|
||||||
|
|
||||||
msgid "Display the moon phases"
|
msgid "Display the moon phases"
|
||||||
msgstr "Afficher les phases de la Lune et autres données"
|
msgstr "Afficher les phases de la Lune et autres données"
|
||||||
|
|
||||||
#: _public.php:84
|
|
||||||
msgid "Illumination: %s%%"
|
|
||||||
msgstr "Illumination : %s%%"
|
|
||||||
|
|
||||||
#: _public.php:91
|
|
||||||
msgid "Age of moon: %s days"
|
|
||||||
msgstr "Age de la Lune : %s jours"
|
|
||||||
|
|
||||||
#: _public.php:98
|
|
||||||
msgid "Distance to earth: %s km"
|
|
||||||
msgstr "Distance à la Terre : %s km"
|
|
||||||
|
|
||||||
#: _public.php:105
|
|
||||||
msgid "Distance to sun: %s km"
|
|
||||||
msgstr "Distance au Soleil : %s km"
|
|
||||||
|
|
||||||
#: _public.php:112
|
|
||||||
msgid "Angle of moon: %s deg"
|
|
||||||
msgstr "Angle de la Lune : %s deg"
|
|
||||||
|
|
||||||
#: _public.php:119
|
|
||||||
msgid "Angle of sun: %s deg"
|
|
||||||
msgstr "Angle du Soleil : %s deg"
|
|
||||||
|
|
||||||
#: _public.php:126
|
|
||||||
msgid "Parallax: %s deg"
|
|
||||||
msgstr "Parallaxe : %s deg"
|
|
||||||
|
|
||||||
#: _public.php:133
|
|
||||||
msgid "In live"
|
|
||||||
msgstr "En direct"
|
|
||||||
|
|
||||||
#: _public.php:159
|
|
||||||
msgid "Previsions"
|
|
||||||
msgstr "Prévisions"
|
|
||||||
|
|
||||||
#: _widgets.php:20
|
|
||||||
msgid "LunarPhase: moon phases"
|
|
||||||
msgstr "LunarPhase : phases de la Lune"
|
|
||||||
|
|
||||||
#: _widgets.php:22
|
|
||||||
msgid "Moon phases"
|
msgid "Moon phases"
|
||||||
msgstr "Phases de la Lune"
|
msgstr "Phases de la Lune"
|
||||||
|
|
||||||
#: _widgets.php:24
|
|
||||||
msgid "Display actual phase of moon"
|
msgid "Display actual phase of moon"
|
||||||
msgstr "Afficher la phase actuelle de la Lune"
|
msgstr "Afficher la phase actuelle de la Lune"
|
||||||
|
|
||||||
#: _widgets.php:25
|
|
||||||
msgid "Display actual illumination of moon"
|
msgid "Display actual illumination of moon"
|
||||||
msgstr "Afficher le taux d'illumination actuel de la Lune"
|
msgstr "Afficher le taux d'illumination actuel de la Lune"
|
||||||
|
|
||||||
#: _widgets.php:26
|
|
||||||
msgid "Display actual age of moon"
|
msgid "Display actual age of moon"
|
||||||
msgstr "Afficher l'âge actuel de la Lune"
|
msgstr "Afficher l'âge actuel de la Lune"
|
||||||
|
|
||||||
#: _widgets.php:27
|
|
||||||
msgid "Display actual distance between moon and earth"
|
msgid "Display actual distance between moon and earth"
|
||||||
msgstr "Afficher la distance actuelle entre la Terre et la Lune"
|
msgstr "Afficher la distance actuelle entre la Terre et la Lune"
|
||||||
|
|
||||||
#: _widgets.php:28
|
|
||||||
msgid "Display actual distance between moon and sun"
|
msgid "Display actual distance between moon and sun"
|
||||||
msgstr "Afficher la distance actuelle entre le Soleil et la Lune"
|
msgstr "Afficher la distance actuelle entre le Soleil et la Lune"
|
||||||
|
|
||||||
#: _widgets.php:29
|
|
||||||
msgid "Display actual angle of moon"
|
msgid "Display actual angle of moon"
|
||||||
msgstr "Afficher l'angle actuel de la Lune"
|
msgstr "Afficher l'angle actuel de la Lune"
|
||||||
|
|
||||||
#: _widgets.php:30
|
|
||||||
msgid "Display actual angle of sun"
|
msgid "Display actual angle of sun"
|
||||||
msgstr "Afficher l'angle actuel du Soleil"
|
msgstr "Afficher l'angle actuel du Soleil"
|
||||||
|
|
||||||
#: _widgets.php:31
|
|
||||||
msgid "Display actual parallax of moon"
|
msgid "Display actual parallax of moon"
|
||||||
msgstr "Afficher la parallaxe actuelle de la Lune"
|
msgstr "Afficher la parallaxe actuelle de la Lune"
|
||||||
|
|
||||||
#: _widgets.php:32
|
|
||||||
msgid "Display all previsions for the next moon phases"
|
msgid "Display all previsions for the next moon phases"
|
||||||
msgstr "Afficher toutes les prévisions des prochaines lunaisons"
|
msgstr "Afficher toutes les prévisions des prochaines lunaisons"
|
||||||
|
|
||||||
#: inc/class.lunarphase.php:107
|
msgid "Illumination: %s%%"
|
||||||
#: inc/class.lunarphase.php:174
|
msgstr "Illumination : %s%%"
|
||||||
|
|
||||||
|
msgid "Age of moon: %s days"
|
||||||
|
msgstr "Age de la Lune : %s jours"
|
||||||
|
|
||||||
|
msgid "Distance to earth: %s km"
|
||||||
|
msgstr "Distance à la Terre : %s km"
|
||||||
|
|
||||||
|
msgid "Distance to sun: %s km"
|
||||||
|
msgstr "Distance au Soleil : %s km"
|
||||||
|
|
||||||
|
msgid "Angle of moon: %s deg"
|
||||||
|
msgstr "Angle de la Lune : %s deg"
|
||||||
|
|
||||||
|
msgid "Angle of sun: %s deg"
|
||||||
|
msgstr "Angle du Soleil : %s deg"
|
||||||
|
|
||||||
|
msgid "Parallax: %s deg"
|
||||||
|
msgstr "Parallaxe : %s deg"
|
||||||
|
|
||||||
|
msgid "In live"
|
||||||
|
msgstr "En direct"
|
||||||
|
|
||||||
|
msgid "Previsions"
|
||||||
|
msgstr "Prévisions"
|
||||||
|
|
||||||
msgid "New moon"
|
msgid "New moon"
|
||||||
msgstr "Nouvelle lune"
|
msgstr "Nouvelle lune"
|
||||||
|
|
||||||
#: inc/class.lunarphase.php:111
|
|
||||||
#: inc/class.lunarphase.php:146
|
|
||||||
msgid "Waxing crescent moon"
|
msgid "Waxing crescent moon"
|
||||||
msgstr "Lune croissante"
|
msgstr "Lune croissante"
|
||||||
|
|
||||||
#: inc/class.lunarphase.php:115
|
|
||||||
#: inc/class.lunarphase.php:150
|
|
||||||
msgid "First quarter moon"
|
msgid "First quarter moon"
|
||||||
msgstr "Premier quartier"
|
msgstr "Premier quartier"
|
||||||
|
|
||||||
#: inc/class.lunarphase.php:119
|
|
||||||
#: inc/class.lunarphase.php:154
|
|
||||||
msgid "Waxing gibbous moon"
|
msgid "Waxing gibbous moon"
|
||||||
msgstr "Lune gibbeuse croissante"
|
msgstr "Lune gibbeuse croissante"
|
||||||
|
|
||||||
#: inc/class.lunarphase.php:123
|
|
||||||
#: inc/class.lunarphase.php:158
|
|
||||||
msgid "Full moon"
|
msgid "Full moon"
|
||||||
msgstr "Pleine lune"
|
msgstr "Pleine lune"
|
||||||
|
|
||||||
#: inc/class.lunarphase.php:127
|
|
||||||
#: inc/class.lunarphase.php:162
|
|
||||||
msgid "Waning gibbous moon"
|
msgid "Waning gibbous moon"
|
||||||
msgstr "Lune gibbeuse décroissante"
|
msgstr "Lune gibbeuse décroissante"
|
||||||
|
|
||||||
#: inc/class.lunarphase.php:131
|
|
||||||
#: inc/class.lunarphase.php:166
|
|
||||||
msgid "Last quarter moon"
|
msgid "Last quarter moon"
|
||||||
msgstr "Dernier quartier"
|
msgstr "Dernier quartier"
|
||||||
|
|
||||||
#: inc/class.lunarphase.php:135
|
|
||||||
#: inc/class.lunarphase.php:170
|
|
||||||
msgid "Waning crescent moon"
|
msgid "Waning crescent moon"
|
||||||
msgstr "Lune décroissante"
|
msgstr "Lune décroissante"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue