From c97626bfb7c38c805ffacf77d88dfe20de3e8450 Mon Sep 17 00:00:00 2001 From: brol Date: Thu, 23 Apr 2015 18:45:00 +0200 Subject: [PATCH] 1.5 --- _define.php | 28 +++++ _prepend.php | 16 +++ _public.php | 203 +++++++++++++++++++++++++++++++++++++ _widgets.php | 44 ++++++++ changelog | 15 +++ img/fm.png | Bin 0 -> 581 bytes img/fqm.png | Bin 0 -> 653 bytes img/nm.png | Bin 0 -> 622 bytes img/tqm.png | Bin 0 -> 680 bytes img/wcm1.png | Bin 0 -> 766 bytes img/wcm2.png | Bin 0 -> 785 bytes img/wgm1.png | Bin 0 -> 725 bytes img/wgm2.png | Bin 0 -> 758 bytes inc/class.lunarphase.php | 213 +++++++++++++++++++++++++++++++++++++++ locales/fr/main.po | 133 ++++++++++++++++++++++++ style.css | 8 ++ 16 files changed, 660 insertions(+) create mode 100644 _define.php create mode 100644 _prepend.php create mode 100644 _public.php create mode 100644 _widgets.php create mode 100644 changelog create mode 100644 img/fm.png create mode 100644 img/fqm.png create mode 100644 img/nm.png create mode 100644 img/tqm.png create mode 100644 img/wcm1.png create mode 100644 img/wcm2.png create mode 100644 img/wgm1.png create mode 100644 img/wgm2.png create mode 100644 inc/class.lunarphase.php create mode 100644 locales/fr/main.po create mode 100644 style.css diff --git a/_define.php b/_define.php new file mode 100644 index 0000000..9a6684c --- /dev/null +++ b/_define.php @@ -0,0 +1,28 @@ +registerModule( + /* Name */ 'lunarPhase', + /* Description */ 'Display the moon phases', + /* Author */ 'Tomtom, Pierre Van Glabeke', + /* Verion */ '1.5', + /* Properties */ + array( + 'permissions' => 'usage,contentadmin', + 'type' => 'plugin', + 'dc_min' => '2.7', + 'support' => 'http://lab.dotclear.org/wiki/plugin/lunarPhase', + 'details' => 'http://plugins.dotaddict.org/dc2/details/lunarPhase' + ) +); \ No newline at end of file diff --git a/_prepend.php b/_prepend.php new file mode 100644 index 0000000..99ee36c --- /dev/null +++ b/_prepend.php @@ -0,0 +1,16 @@ +addBehavior('publicHeadContent',array('lunarPhaseBehaviors','addCss')); + +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 ''; + } +} + +class lunarPhasePublic +{ + /** + Displays lunarphase widget + + @param w dcWidget dcWidget object + @return string HTML code of widget + */ + public static function widget($w) + { + global $core; + + if ($w->offline) + return; + + $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 dcWidget dcWidget object + @param lp lunarPhaset lunarPhase object + @return string Live HTML part + */ + public static function getLive($w,$lp) + { + $ul_mask = ''; + $li_mask = '
  • %1$s
  • '; + $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 + '

    '.__('In live').'

    '. + sprintf($ul_mask,$res,'lunarphase'); + } + } + + /** + Returns "previsions" part of lunarphase widget + + @param w dcWidget dcWidget object + @param lp lunarPhaset lunarPhase object + @return string previsions HTML part + */ + public static function getPrevisions($w,$lp) + { + $ul_mask = ''; + $li_mask = '
  • %1$s
  • '; + $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 + '

    '.__('Previsions').'

    '. + sprintf($ul_mask,$res,'lunarphase'); + } + } + + /** + Returns value passed in argument with a correct format + + @param type string Type of convertion + @param value mixed Value to convert + @return mixed 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; + } +} \ No newline at end of file diff --git a/_widgets.php b/_widgets.php new file mode 100644 index 0000000..0ffb6ae --- /dev/null +++ b/_widgets.php @@ -0,0 +1,44 @@ +addBehavior('initWidgets',array('lunarPhaseWidgets','initWidgets')); + +class lunarPhaseWidgets +{ + public static function initWidgets($w) + { + $w->create('lunarphase',__('LunarPhase: moon phases'),array('lunarPhasePublic','widget'), + null, + __('Display the moon phases')); + $w->lunarphase->setting('title',__('Title:'),__('Moon phases')); + $w->lunarphase->setting('phase',__('Display actual phase of moon'),1,'check'); + $w->lunarphase->setting('illumination',__('Display actual illumination of moon'),1,'check'); + $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'); + $w->lunarphase->setting('dist_to_sun',__('Display actual distance between moon and sun'),1,'check'); + $w->lunarphase->setting('moon_angle',__('Display actual angle of moon'),1,'check'); + $w->lunarphase->setting('sun_angle',__('Display actual angle of sun'),1,'check'); + $w->lunarphase->setting('parallax',__('Display actual parallax of moon'),1,'check'); + $w->lunarphase->setting('previsions',__('Display all previsions for the next moon phases'),1,'check'); + $w->lunarphase->setting('homeonly',__('Display on:'),0,'combo', + array( + __('All pages') => 0, + __('Home page only') => 1, + __('Except on home page') => 2 + ) + ); + $w->lunarphase->setting('content_only',__('Content only'),0,'check'); + $w->lunarphase->setting('class',__('CSS class:'),''); + $w->lunarphase->setting('offline',__('Offline'),0,'check'); + } +} \ No newline at end of file diff --git a/changelog b/changelog new file mode 100644 index 0000000..bb1823e --- /dev/null +++ b/changelog @@ -0,0 +1,15 @@ +v1.5 (23/04/2015) Pierre Van Glabeke : +modification url support + +v1.4 (06/02/2015) Pierre Van Glabeke : +modifications localisation + +v1.3 (14/12/2014) Pierre Van Glabeke : +compatibilité dc2.7 + +v1.2 (17/02/2014) : +reprise par Pierre Van Glabeke +correction bug (waning_crescent_moon) +images refaites (merci à 999Diaoul) +compatibilité dc2.6 +fin de ligne unix \ No newline at end of file diff --git a/img/fm.png b/img/fm.png new file mode 100644 index 0000000000000000000000000000000000000000..9d2d572a565677181e0990864baa61e2e794dfd1 GIT binary patch literal 581 zcmV-L0=oT)P)U&#NGvR(PAtU2O0Z!9qbR9}q=Q@qrl8LVU%Od#6}7>`UDrT!tCA-^@AZyF(CnM6cH$yWQ@Op-|{+ zBoa9dhr^#;F4tR&#d1Jw5{*W45{t!t_WONUtyXY7^Z6WVwOTnC465&i7>!1cbxde$sg6`EO zFbo-w$KdgJ&acd7u~>UTq42_NHe*wv)oQ_PHoLQDxEv%RAZ_Y$x%}|IvxZ81CK8F_ zBuN6EVxdrgcDqe$f!~bRXf%Ruw+p3G34A`^Z<$Q?^48POU@-QP>0i`p^&hL%3KT^F zb}W@j(JLO0a!hkM{w|da6_^FH|bkCA#|1y%9ZsecPUY+!&S& T#p`w%00000NkvXXu0mjfYr_Uv literal 0 HcmV?d00001 diff --git a/img/fqm.png b/img/fqm.png new file mode 100644 index 0000000000000000000000000000000000000000..359d9b2af7afbc24a199e9f6fe1ee7457c81d98f GIT binary patch literal 653 zcmV;80&@L{P)@@(*PQ=s z-t+(8dG_T$2>kr{^Z%VYcdo5mxiST>A$l&cEu1c$|5?4~{^#_Y|DVHm?tg9|zVYb& ze`N6Q-@pH-PMuoW+uO^DVThJ(XfumL+kX!4Isdu*=7BLTgJ9tN`SY76Oqjq7H$=zW z*_Fep^goB^47ef07z6^_w{Ncm8=`Gs$|PYDdYajx<3ATr6R8Hhe*OAWe}BIOgPOjD zDTi_De-8HvD25Pg5C{MRKa)XD$EJ+MwBSFd=VY=CI&|pJYz8SUyLrrJg+PO*kZsWE z)2G)lNT^#aWj4S!pys(`8MJTTzJ&~O>V_Vy>i+-P zZEOB>d6ORfzkmP!KX>ljS_U;O18!aw`$x=%Y5zH0yMal7_yh?`;g23Y`deIFtOHI< zvg*cJOe#MA*(?enVFfh|pFto)K7Rc8f7Yy7i{L3+UE7dJSjBuRqgv2^cFW@boNj&p zxqM~;4Vr`1Adq)}3Gx5>_3Q6OM@NgIRJtl}!hEu6~EpO`g6|1%k+ z{bvIv)&(mz{ol1~*Z(bBwtxcmcYc2ULU(s}F@j~1g1Vl(go;t2kc!nD0X2t>A>lC_ n6XN6M2L%OHIXOA$V$%ZvsFA``;1;5R00000NkvXXu0mjfA^A=> literal 0 HcmV?d00001 diff --git a/img/nm.png b/img/nm.png new file mode 100644 index 0000000000000000000000000000000000000000..95f4e53c697a344e4fae74a35789df2e5b204383 GIT binary patch literal 622 zcmV-!0+IcRP)VbFx*uN~fs$RLoTODKFRc$+I`~NMdCm1}K{OJ4(2e9pLqz{GY>j?tgZ_ zg<#C#x8OgI-`xKa{u8e11XLv9HALDpq?*g6<3GF4y#Jhj^Z#@C%|pQ;F?OJVAX+h? zZH19{CMSj=5(Yli98PWjIeq3}7=R6fTq*D0u~FYElNoM^xVohsr&Y;+POs@i83Mx~ z?`j0pmVpfsmDgbu&-720<0eX{=@i6d5Gt)3$~|P|0i#t8wOkPWK69 z83YO^Deu;G3<3&9)vS84|2bVcff94caM8m5GM;tw83bju9a+`={__We<@3ef_mB>`F8BosXJ`7P3K$>`Xr zW6k}*@M7kd)34!Ba(u_48Ty~aFzr99S^j@E%aZ@BmZkq$&4I2pPWdgY>%Bly)l`&V znFMs5w4j_`7O$fDOde&swY(}08~9Z1=L@M=R*ESZ>R{6Y08Bj5{~B4!rT_o{07*qo IM6N<$f{dIm8vpm=P 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 Hu0mjf-?dJ+ literal 0 HcmV?d00001 diff --git a/img/wgm2.png b/img/wgm2.png new file mode 100644 index 0000000000000000000000000000000000000000..197db895e636191e8c2b34aa666970e680f5302e GIT binary patch literal 758 zcmVv zhS*F3*WBjvBBYB!l5`Pl$u86(O`6DHY|K5qzM&y)y8du3&+nY);W-CE{G_h_Vb-hO z{zqe~i8mAPCr8n0aYrV%kxjdHHv$PHcWP=GnklW(wz>)%8ym2dxdl5!mn$HO`Eoh? z#*?NJUVXSu`S;aFmGvIJIV6O~JeFucv4+oh;5XKk*;&pK!ju1#0 z`L`nq(pCxi`UY$@V1f5QY_i8sx|78h+@UmnOS|o)S+5ALGeD;jr{Rx}wJ_x1tLS%mPFG3C@cE?*wP9;XM z*d?=VZEc`ZsbGG79tStaVtsubU*F8j5K-I%K^Mhvj9j~#l1pzX-+7K8i>IVz!Tlive = new ArrayObject; + $this->previsions = new ArrayObject; + + $this->setLive(); + $this->setPrevisions(); + } + + public function getLive() + { + return $this->live; + } + + public function getPrevisions() + { + return $this->previsions; + } + + private function setLive() + { + $day = $this->jTime(time()) - self::epoch; + + # Calculate sun's position and angle + $N = $this->fixAngle((360 / 365.2422) * $day); + $M = $this->fixAngle($N + self::elonge - self::elongp); + $Ec = $this->kepler($M, self::eccent); + $Ec = sqrt((1 + self::eccent) / (1 - self::eccent)) * tan($Ec / 2); + $Ec = 2 * $this->toDeg(atan($Ec)); + $lambdaSun = $this->fixAngle($Ec + self::elongp); + $F = ((1 + self::eccent * cos($this->toRad($Ec))) / (1 - self::eccent * self::eccent)); + + # Calculate moon's age, position and angle + $ml = $this->fixAngle(13.1763966 * $day + self::mmLong); + $MM = $this->fixAngle($ml - 0.1114041 * $day - self::mmLongp); + $MN = $this->fixAngle(self::mlNode - 0.0529539 * $day); + $Ev = 1.2739 * sin($this->toRad(2 * ($ml - $lambdaSun) - $MM)); + $Ae = 0.1858 * sin($this->toRad($M)); + $A3 = 0.37 * sin($this->toRad($M)); + $MmP = $MM + $Ev - $Ae - $A3; + $mEc = 6.2886 * sin($this->toRad($MmP)); + $A4 = 0.214 * sin($this->toRad(2 * $MmP)); + $lP = $ml + $Ev + $mEc - $Ae + $A4; + $V = 0.6583 * sin($this->toRad(2 * ($lP - $lambdaSun))); + $lPP = $lP + $V; + $NP = $MN - 0.16 * sin($this->toRad($M)); + $y = sin($this->toRad($lPP - $NP)) * cos($this->toRad(self::mInc)); + $x = cos($this->toRad($lPP - $NP)); + $lambdaMoon = $this->toDeg(atan2($y, $x)); + $lambdaMoon += $NP; + $mage = $lPP - $lambdaSun; + $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['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_sun'] = self::sunsMax / $F; + $this->live['sun_angle'] = $F * self::sunAngSiz; + $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->setPhase(); + } + + private function setPhase() + { + if ($this->live['age'] >= self::synodic || $this->live['age'] <= self::synodic/8) { + $this->live['id'] = 'new_moon'; + $this->live['name'] = __('New moon'); + } + elseif ($this->live['age'] >= self::synodic/8 && $this->live['age'] <= self::synodic/4) { + $this->live['id'] = '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'; + $this->live['name'] = __('First quarter moon'); + } + elseif ($this->live['age'] >= self::synodic*3/8 && $this->live['age'] <= self::synodic/2) { + $this->live['id'] = 'waxing_gibbous_moon'; + $this->live['name'] = __('Waxing gibbous moon'); + } + elseif ($this->live['age'] >= self::synodic/2 && $this->live['age'] <= self::synodic*5/8) { + $this->live['id'] = 'full_moon'; + $this->live['name'] = __('Full moon'); + } + elseif ($this->live['age'] >= self::synodic*5/8 && $this->live['age'] <= self::synodic*3/4) { + $this->live['id'] = 'waning_gibbous_moon'; + $this->live['name'] = __('Waning gibbous 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'); + } + elseif ($this->live['age'] >= self::synodic*7/8 && $this->live['age'] <= self::synodic) { + $this->live['id'] = 'waning_crescent_moon'; + $this->live['name'] = __('Waning crescent moon'); + } + } + + private function setPrevisions() + { + $ts_day = 24*60*60; + $ts_synodic = self::synodic * $ts_day; + $start = time() - $this->live['age'] * $ts_day; + + $this->previsions['waxing_crescent_moon'] = array( + 'name' => __('Waxing crescent moon'), + 'date' => $start + $ts_synodic / 8 + ); + $this->previsions['first_quarter_moon'] = array( + 'name' => __('First quarter moon'), + 'date' => $start + $ts_synodic / 4 + ); + $this->previsions['waxing_gibbous_moon'] = array( + 'name' => __('Waxing gibbous moon'), + 'date' => $start + $ts_synodic * 3 / 8 + ); + $this->previsions['full_moon'] = array( + 'name' => __('Full moon'), + 'date' => $start + $ts_synodic / 2 + ); + $this->previsions['waning_gibbous_moon'] = array( + 'name' => __('Waning gibbous moon'), + 'date' => $start + $ts_synodic * 5 / 8 + ); + $this->previsions['last_quarter_moon'] = array( + 'name' => __('Last quarter moon'), + 'date' => $start + $ts_synodic * 3 / 4 + ); + $this->previsions['waning_crescent_moon'] = array( + 'name' => __('Waning crescent moon'), + 'date' => $start + $ts_synodic * 7 / 8 + ); + $this->previsions['new_moon'] = array( + 'name' => __('New moon'), + 'date' =>$start + $ts_synodic + ); + } + + private function fixAngle($x) + { + return ($x - 360.0 * (floor($x / 360.0))); + } + + private function toRad($x) + { + return ($x * (M_PI / 180.0)); + } + + private function toDeg($x) + { + return ($x * (180.0 / M_PI)); + } + + private function jTime($t) + { + return ($t / 86400) + 2440587.5; + } + + private function kepler($m, $ecc) + { + $delta = null; + $EPSILON = 1e-6; + + $m = $this->toRad($m); + $e = $m; + while (abs($delta) > $EPSILON) + { + $delta = $e - $ecc * sin($e) - $m; + $e -= $delta / (1 - $ecc * cos($e)); + } + return ($e); + } +} \ No newline at end of file diff --git a/locales/fr/main.po b/locales/fr/main.po new file mode 100644 index 0000000..fd4fec7 --- /dev/null +++ b/locales/fr/main.po @@ -0,0 +1,133 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" +"Project-Id-Version: lunarPhase 1.1-RC2\n" +"POT-Creation-Date: \n" +"PO-Revision-Date: 2010-09-30T22:49:45+00:00\n" +"Last-Translator: Thomas Bouron\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "Display the moon phases" +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" +msgstr "Phases de la Lune" + +#: _widgets.php:24 +msgid "Display actual phase of moon" +msgstr "Afficher la phase actuelle de la Lune" + +#: _widgets.php:25 +msgid "Display actual illumination of moon" +msgstr "Afficher le taux d'illumination actuel de la Lune" + +#: _widgets.php:26 +msgid "Display actual age of moon" +msgstr "Afficher l'âge actuel de la Lune" + +#: _widgets.php:27 +msgid "Display actual distance between moon and earth" +msgstr "Afficher la distance actuelle entre la Terre et la Lune" + +#: _widgets.php:28 +msgid "Display actual distance between moon and sun" +msgstr "Afficher la distance actuelle entre le Soleil et la Lune" + +#: _widgets.php:29 +msgid "Display actual angle of moon" +msgstr "Afficher l'angle actuel de la Lune" + +#: _widgets.php:30 +msgid "Display actual angle of sun" +msgstr "Afficher l'angle actuel du Soleil" + +#: _widgets.php:31 +msgid "Display actual parallax of moon" +msgstr "Afficher la parallaxe actuelle de la Lune" + +#: _widgets.php:32 +msgid "Display all previsions for the next moon phases" +msgstr "Afficher toutes les prévisions des prochaines lunaisons" + +#: inc/class.lunarphase.php:107 +#: inc/class.lunarphase.php:174 +msgid "New moon" +msgstr "Nouvelle lune" + +#: inc/class.lunarphase.php:111 +#: inc/class.lunarphase.php:146 +msgid "Waxing crescent moon" +msgstr "Lune croissante" + +#: inc/class.lunarphase.php:115 +#: inc/class.lunarphase.php:150 +msgid "First quarter moon" +msgstr "Premier quartier" + +#: inc/class.lunarphase.php:119 +#: inc/class.lunarphase.php:154 +msgid "Waxing gibbous moon" +msgstr "Lune gibbeuse croissante" + +#: inc/class.lunarphase.php:123 +#: inc/class.lunarphase.php:158 +msgid "Full moon" +msgstr "Pleine lune" + +#: inc/class.lunarphase.php:127 +#: inc/class.lunarphase.php:162 +msgid "Waning gibbous moon" +msgstr "Lune gibbeuse décroissante" + +#: inc/class.lunarphase.php:131 +#: inc/class.lunarphase.php:166 +msgid "Last quarter moon" +msgstr "Dernier quartier" + +#: inc/class.lunarphase.php:135 +#: inc/class.lunarphase.php:170 +msgid "Waning crescent moon" +msgstr "Lune décroissante" \ No newline at end of file diff --git a/style.css b/style.css new file mode 100644 index 0000000..2bed568 --- /dev/null +++ b/style.css @@ -0,0 +1,8 @@ +#sidebar .lunarphase ul li.new_moon{background:transparent url(index.php?pf=lunarPhase/img/nm.png) no-repeat left 0.2em;padding-left:2em;} +#sidebar .lunarphase ul li.waxing_crescent_moon{background:transparent url(index.php?pf=lunarPhase/img/wcm1.png) no-repeat left 0.2em;padding-left:2em;} +#sidebar .lunarphase ul li.first_quarter_moon{background:transparent url(index.php?pf=lunarPhase/img/fqm.png) no-repeat left 0.2em;padding-left:2em;} +#sidebar .lunarphase ul li.waxing_gibbous_moon{background:transparent url(index.php?pf=lunarPhase/img/wgm1.png) no-repeat left 0.2em;padding-left:2em;} +#sidebar .lunarphase ul li.full_moon{background:transparent url(index.php?pf=lunarPhase/img/fm.png) no-repeat left 0.2em;padding-left:2em;} +#sidebar .lunarphase ul li.waning_gibbous_moon{background:transparent url(index.php?pf=lunarPhase/img/wgm2.png) no-repeat left 0.2em;padding-left:2em;} +#sidebar .lunarphase ul li.last_quarter_moon{background:transparent url(index.php?pf=lunarPhase/img/tqm.png) no-repeat left 0.2em;padding-left:2em;} +#sidebar .lunarphase ul li.waning_crescent_moon{background:transparent url(index.php?pf=lunarPhase/img/wcm2.png) no-repeat left 0.2em;padding-left:2em;} \ No newline at end of file