Plugin Directory

Changeset 210167


Ignore:
Timestamp:
02/25/2010 02:03:26 PM (16 years ago)
Author:
beshkin
Message:

tagging version 0.6

Location:
zmanim-widget
Files:
6 added
10 edited
16 copied

Legend:

Unmodified
Added
Removed
  • zmanim-widget/tags/0.6/dictionary/ashkenaz.php

    r186971 r210167  
    11<?
    22$translate=array(
    3     'Shabbat'=>'Shabbos',
    4     'Alot_HaShachar'=>'Alos HaShachar',
    5     'Netz'=>'Netz',
    6     'Tallit'=>'Tallis',
    7     'Shma'=>'Sh\'ma',
    8     'Hatzot_Hayom'=>'Chatzos',
    9     'Mincha_Gedola'=>'Mincha Gedola',
    10     'Plag_Hamincha'=>'Plag Hamincha',
    11     'Tevet'=>'Teves',
    12     'Av'=>'Ov'
     3    'Shabbat'=>__('Shabbos','zmanim'),
     4    'Alot_HaShachar'=>__('Alos HaShachar','zmanim'),
     5    'Netz'=>__('Netz','zmanim'),
     6    'Tallit'=>__('Tallis','zmanim'),
     7    'Shma'=>__('Sh\'ma','zmanim'),
     8    'Hatzot_Hayom'=>__('Chatzos','zmanim'),
     9    'Mincha_Gedola'=>__('Mincha Gedola','zmanim'),
     10    'Plag_Hamincha'=>__('Plag Hamincha','zmanim'),
     11    'Tevet'=>__('Teves','zmanim'),
     12    'Av'=>__('Ov','zmanim')
    1313
    1414);
  • zmanim-widget/tags/0.6/dictionary/sephard.php

    r186971 r210167  
    11<?
    22$translate=array(
    3     'Shabbat'=>'Shabbat',
    4     'Alot_HaShachar'=>'Alot HaShachar',
    5     'Netz'=>'Netz',
    6     'Tallit'=>'Tallit',
    7     'Shma'=>'Sh\'ma',
    8     'Hatzot_Hayom'=>'Hatzot',
    9     'Mincha_Gedola'=>'Mincha Gedola',
    10     'Plag_Hamincha'=>'Plag Hamincha',
    11     'Tevet'=>'Tevet',
    12         'Av'=>'Av'
     3    'Shabbat'=>__('Shabbat','zmanim'),
     4    'Alot_HaShachar'=>__('Alot HaShachar','zmanim'),
     5    'Netz'=>__('Netz','zmanim'),
     6    'Tallit'=>__('Tallit','zmanim'),
     7    'Shma'=>__('Sh\'ma','zmanim'),
     8    'Hatzot_Hayom'=>__('Chatzot','zmanim'),
     9    'Mincha_Gedola'=>__('Mincha Gedola','zmanim'),
     10    'Plag_Hamincha'=>__('Plag Hamincha','zmanim'),
     11    'Tevet'=>__('Tevet','zmanim'),
     12    'Av'=>__('Av','zmanim')
    1313
    1414);
  • zmanim-widget/tags/0.6/hdate/hdate.php

    r186971 r210167  
    5252if (strlen($leftMin) <2) $leftMin="0$leftMin";
    5353
    54 if ($leftshabat > 1) $nday="It will come in $leftshabat days";
    55 if ($leftshabat ==1) $nday="It will come tomorrow";
    56 if ($leftshabat <1) $nday="It will come in $leftHour:$leftMin";
     54if ($leftshabat > 1) $nday=__("It will come in","zmanim").' '.$leftshabat.' '.__ngettext("day","days",$leftshabat,"zmanim");
     55if ($leftshabat ==1) $nday=__("It will come","zmanim")." ".__("tomorrow","zmanim");
     56if ($leftshabat <1) $nday=__("It will come in","zmanim")." $leftHour:$leftMin";
    5757
    5858if ( strlen($resultMin) < 2 && $resultMin == 0) $resultMin=$resultMin.'0';
     
    6363if ($weekday == 6 && "$currentHour$currentMin" < "$resultHour_end$resultMin_end") $nday=translate_z('Shabbat',$data['accent']);
    6464elseif ($weekday == 5 && "$currentHour$currentMin" > "$resultHour$resultMin") $nday=translate_z('Shabbat',$data['accent']);
    65 elseif ($weekday >= 6  && $leftHour < 0 ) $nday="It remains 6 days";
     65elseif ($weekday >= 6  && $leftHour < 0 ) $nday=__("It remains 6 days","zmanim");
    6666
    67 print '<ul><li><b>'.translate_z('Shabbat',$data['accent'])." time</b></li>";
     67print '<ul><li><b>'.translate_z('Shabbat',$data['accent'])."</b></li>";
    6868echo "<li>
    6969<ul>
    7070<li>$nday.</li>
    71 <li>Candle light : $sh_date $resultHour:$resultMin </li>
    72 <li>".translate_z('Shabbat',$data['accent'])." ends : $sh_date_end $resultHour_end:$resultMin_end</li></ul>
     71<li>".__("Candle light","zmanim")." : $sh_date $resultHour:$resultMin </li>
     72<li>".translate_z('Shabbat',$data['accent'])." ".__("ends","zmanim").": $sh_date_end $resultHour_end:$resultMin_end</li></ul>
    7373</li></ul>";
    7474?>
  • zmanim-widget/tags/0.6/hdate/holidays.inc

    r185227 r210167  
    1010
    1111function getJewishMonthName2($jewishMonth, $jewishYear) {
    12   $jewishMonthNamesLeap = array("Tishri", "Heshvan", "Kislev", translate_z("Tevet",$data['accent']),
    13                                 "Shevat", "Adar I", "Adar II", "Nisan",
    14                                 "Iyar", "Sivan", "Tammuz", translate_z("Av",$data['accent']), "Elul");
    15   $jewishMonthNamesNonLeap = array("Tishri", "Heshvan", "Kislev", translate_z("Tevet",$data['accent']),
    16                                    "Shevat", "Adar", "", "Nisan",
    17                                    "Iyar", "Sivan", "Tammuz", translate_z("Av",$data['accent']), "Elul");
     12  $jewishMonthNamesLeap = array(__("Tishri",'zmanim-widget'),
     13            __("Heshvan",'zmanim-widget'),
     14            __("Kislev",'zmanim-widget'), translate_z("Tevet",$data['accent']),
     15                        __("Shevat",'zmanim-widget'), __("Adar I",'zmanim-widget'),
     16            __("Adar II",'zmanim-widget'), __("Nisan",'zmanim-widget'),
     17                        __("Iyar",'zmanim-widget'), __("Sivan",'zmanim-widget'),
     18            __("Tammuz",'zmanim-widget'), translate_z("Av",$data['accent']), __("Elul",'zmanim-widget'));
     19  $jewishMonthNamesNonLeap = array(__("Tishri",'zmanim-widget'),
     20                        __("Heshvan",'zmanim-widget'),
     21                        __("Kislev",'zmanim-widget'), translate_z("Tevet",$data['accent']),
     22                        __("Shevat",'zmanim-widget'), "",         
     23                        __("Adar II",'zmanim-widget'), __("Nisan",'zmanim-widget'),
     24                        __("Iyar",'zmanim-widget'), __("Sivan",'zmanim-widget'),
     25                        __("Tammuz",'zmanim-widget'), translate_z("Av",$data['accent']), __("Elul",'zmanim-widget'));
    1826  if (isJewishLeapYear2($jewishYear))
    1927    return $jewishMonthNamesLeap[$jewishMonth-1];
  • zmanim-widget/tags/0.6/hdate/holidays.php

    r182644 r210167  
    1 <html>
    2 <head>
    3 <title>Calculating Jewish holidays</title>
    4 </head>
    5 <body>
    6 
    71<?php
    8 include('holidays.inc');
    9 
    10 if (isSet($_REQUEST["year"])) {
    11   $prevYear = $_REQUEST["year"]-1;
    12   $nextYear = $_REQUEST["year"]+1;
    13   $israeldiaspora = $_REQUEST["israeldiaspora"];
    14   $postponeShushanPurimOnSaturday = $_REQUEST["postponeshushanpurimonsaturday"];
    15   echo "<p>\n";
    16   echo "<a href=\"holidays.php?year=$prevYear&israeldiaspora=$israeldiaspora&postponeshushanpurimonsaturday=$postponeShushanPurimOnSaturday\">Previous year</a>";
    17   echo "| ";
    18   echo "<a href=\"holidays.php?year=$nextYear&israeldiaspora=$israeldiaspora&postponeshushanpurimonsaturday=$postponeShushanPurimOnSaturday\">Next year</a>";
    19   echo "</p>\n";
     2function isJewishLeapYear2($year) {
     3  if ($year % 19 == 0 || $year % 19 == 3 || $year % 19 == 6 ||
     4      $year % 19 == 8 || $year % 19 == 11 || $year % 19 == 14 ||
     5      $year % 19 == 17)
     6    return true;
     7  else
     8    return false;
     9}
     10
     11function getJewishMonthName2($jewishMonth, $jewishYear) {
     12  $jewishMonthNamesLeap = array(__("Tishri",'zmanim'),
     13            __("Heshvan",'zmanim'),
     14            __("Kislev",'zmanim'), translate_z("Tevet",$data['accent']),
     15                        __("Shevat",'zmanim'), __("Adar I",'zmanim'),
     16            __("Adar II",'zmanim'), __("Nisan",'zmanim'),
     17                        __("Iyar",'zmanim'), __("Sivan",'zmanim'),
     18            __("Tammuz",'zmanim'), translate_z("Av",$data['accent']), __("Elul",'zmanim'));
     19  $jewishMonthNamesNonLeap = array(__("Tishri",'zmanim'),
     20                        __("Heshvan",'zmanim'),
     21                        __("Kislev",'zmanim'), translate_z("Tevet",$data['accent']),
     22                        __("Shevat",'zmanim'), __("Adar",'zmanim'),         
     23                        "", __("Nisan",'zmanim'),
     24                        __("Iyar",'zmanim'), __("Sivan",'zmanim'),
     25                        __("Tammuz",'zmanim'), translate_z("Av",$data['accent']), __("Elul",'zmanim'));
     26  if (isJewishLeapYear2($jewishYear))
     27    return $jewishMonthNamesLeap[$jewishMonth-1];
     28  else
     29    return $jewishMonthNamesNonLeap[$jewishMonth-1];
     30}
     31
     32function getJewishHoliday2($jdCurrent, $isDiaspora, $postponeShushanPurimOnSaturday) {
     33  $result = array();
     34
     35  $TISHRI = 1;
     36  $HESHVAN = 2;
     37  $KISLEV = 3;
     38  $TEVET = 4;
     39  $SHEVAT = 5;
     40  $ADAR = 6;
     41  $ADAR_I = 6;
     42  $ADAR_II = 7;
     43  $NISAN = 8;
     44  $IYAR = 9;
     45  $SIVAN = 10;
     46  $TAMMUZ = 11;
     47  $AV = 12;
     48  $ELUL = 13;
     49
     50  $SUNDAY = 0;
     51  $MONDAY = 1;
     52  $TUESDAY = 2;
     53  $WEDNESDAY = 3;
     54  $THURSDAY = 4;
     55  $FRIDAY = 5;
     56  $SATURDAY = 6;
     57
     58  $jewishDate = jdtojewish($jdCurrent);
     59  list($jewishMonth, $jewishDay, $jewishYear) = split('/', $jewishDate);
     60
     61  // Holidays in Elul
     62  if ($jewishDay == 29 && $jewishMonth == $ELUL)
     63    $result[] = __("Erev",'zmanim').' '.__("Rosh Hashanah",'zmanim');
     64
     65  // Holidays in Tishri
     66  if ($jewishDay == 1 && $jewishMonth == $TISHRI)
     67    $result[] = __("Rosh Hashanah",'zmanim')." I";
     68  if ($jewishDay == 2 && $jewishMonth == $TISHRI)
     69    $result[] = __("Rosh Hashanah",'zmanim')." II";
     70  $jd = jewishtojd($TISHRI, 3, $jewishYear);
     71  $weekdayNo = jddayofweek($jd, 0);
     72  if ($weekdayNo == $SATURDAY) { // If the 3 Tishri would fall on Saturday ...
     73    // ... postpone Tzom Gedaliah to Sunday
     74    if ($jewishDay == 4 && $jewishMonth == $TISHRI)
     75      $result[] = __("Tzom Gedaliah",'zmanim');
     76  } else {
     77    if ($jewishDay == 3 && $jewishMonth == $TISHRI)
     78      $result[] = __("Tzom Gedaliah",'zmanim');
     79  }
     80  if ($jewishDay == 9 && $jewishMonth == $TISHRI)
     81    $result[] = __("Erev",'zmanim').' '.__("Yom Kippur",'zmanim');
     82  if ($jewishDay == 10 && $jewishMonth == $TISHRI)
     83    $result[] = __("Yom Kippur",'zmanim');
     84  if ($jewishDay == 14 && $jewishMonth == $TISHRI)
     85    $result[] = __("Erev",'zmanim').' '.__("Sukkot",'zmanim');
     86  if ($jewishDay == 15 && $jewishMonth == $TISHRI)
     87    $result[] = __("Sukkot",'zmanim')." I";
     88  if ($jewishDay == 16 && $jewishMonth == $TISHRI && $isDiaspora)
     89    $result[] = __("Sukkot",'zmanim')." II";
     90  if ($isDiaspora) {
     91    if ($jewishDay >= 17 && $jewishDay <= 20 && $jewishMonth == $TISHRI)
     92      $result[] = __("Hol Hamoed",'zmanim')." ".__("Sukkot",'zmanim');
     93  } else {
     94    if ($jewishDay >= 16 && $jewishDay <= 20 && $jewishMonth == $TISHRI)
     95      $result[] = __("Hol Hamoed",'zmanim')." ".__("Sukkot",'zmanim');
     96  }
     97  if ($jewishDay == 21 && $jewishMonth == $TISHRI)
     98    $result[] = __("Hoshana Rabbah",'zmanim');
     99  if ($isDiaspora) {
     100    if ($jewishDay == 22 && $jewishMonth == $TISHRI)
     101      $result[] = __("Shemini Azeret",'zmanim');
     102    if ($jewishDay == 23 && $jewishMonth == $TISHRI)
     103      $result[] = __("Simchat Torah",'zmanim');
     104    if ($jewishDay == 24 && $jewishMonth == $TISHRI)
     105      $result[] = __("Isru Chag",'zmanim');
     106  } else {
     107    if ($jewishDay == 22 && $jewishMonth == $TISHRI)
     108      $result[] = __("Shemini Azeret",'zmanim')."/".__("Simchat Torah",'zmanim');
     109    if ($jewishDay == 23 && $jewishMonth == $TISHRI)
     110      $result[] = __("Isru Chag",'zmanim');
     111  }
     112
     113  // Holidays in Kislev/Tevet
     114  $hanukkahStart = jewishtojd($KISLEV, 25, $jewishYear);
     115  $hanukkahNo = (int) ($jdCurrent-$hanukkahStart+1);
     116  if ($hanukkahNo == 1) $result[] = __("Hanukkah",'zmanim')." I";
     117  if ($hanukkahNo == 2) $result[] = __("Hanukkah",'zmanim')." II";
     118  if ($hanukkahNo == 3) $result[] = __("Hanukkah",'zmanim')." III";
     119  if ($hanukkahNo == 4) $result[] = __("Hanukkah",'zmanim')." IV";
     120  if ($hanukkahNo == 5) $result[] = __("Hanukkah",'zmanim')." V";
     121  if ($hanukkahNo == 6) $result[] = __("Hanukkah",'zmanim')." VI";
     122  if ($hanukkahNo == 7) $result[] = __("Hanukkah",'zmanim')." VII";
     123  if ($hanukkahNo == 8) $result[] = __("Hanukkah",'zmanim')." VIII";
     124
     125  // Holidays in Tevet
     126  $jd = jewishtojd($TEVET, 10, $jewishYear);
     127  $weekdayNo = jddayofweek($jd, 0);
     128  if ($weekdayNo == $SATURDAY) { // If the 10 Tevet would fall on Saturday ...
     129    // ... postpone Tzom Tevet to Sunday
     130    if ($jewishDay == 11 && $jewishMonth == $TEVET)
     131      $result[] = __("Tzom",'zmanim')." ".translate_z("Tevet",$data['accent']);
     132  } else {
     133    if ($jewishDay == 10 && $jewishMonth == $TEVET)
     134      $result[] = __("Tzom",'zmanim')." ".translate_z("Tevet",$data['accent']);
     135  }
     136
     137  // Holidays in Shevat
     138  if ($jewishDay == 15 && $jewishMonth == $SHEVAT)
     139    $result[] = __("Tu",'zmanim')." ".__("B'Shevat",'zmanim');
     140
     141  // Holidays in Adar I
     142  if (isJewishLeapYear2($jewishYear) && $jewishDay == 14 && $jewishMonth == $ADAR_I)
     143    $result[] = __("Purim",'zmanim')." ".__("Katan",'zmanim');
     144  if (isJewishLeapYear2($jewishYear) && $jewishDay == 15 && $jewishMonth == $ADAR_I)
     145    $result[] = __("Shushan",'zmanim').' '.__("Purim",'zmanim')." ".__("Katan",'zmanim');
     146
     147  // Holidays in Adar or Adar II
     148  if (isJewishLeapYear2($jewishYear))
     149    $purimMonth = $ADAR_II;
     150  else
     151    $purimMonth = $ADAR;
     152  $jd = jewishtojd($purimMonth, 13, $jewishYear);
     153  $weekdayNo = jddayofweek($jd, 0);
     154  if ($weekdayNo == $SATURDAY) { // If the 13 Adar or Adar II would fall on Saturday ...
     155    // ... move Ta'anit Esther to the preceding Thursday
     156    if ($jewishDay == 11 && $jewishMonth == $purimMonth)
     157      $result[] = __("Ta'anith Esther",'zmanim');
     158  } else {
     159    if ($jewishDay == 13 && $jewishMonth == $purimMonth)
     160      $result[] = __("Ta'anith Esther",'zmanim');
     161  }
     162  if ($jewishDay == 14 && $jewishMonth == $purimMonth)
     163    $result[] = __("Purim",'zmanim');
     164  if ($postponeShushanPurimOnSaturday) {
     165    $jd = jewishtojd($purimMonth, 15, $jewishYear);
     166    $weekdayNo = jddayofweek($jd, 0);
     167    if ($weekdayNo == $SATURDAY) { // If the 15 Adar or Adar II would fall on Saturday ...
     168      // ... postpone Shushan Purim to Sunday
     169      if ($jewishDay == 16 && $jewishMonth == $purimMonth)
     170        $result[] = __("Shushan",'zmanim').' '.__("Purim",'zmanim');
     171    } else {
     172      if ($jewishDay == 15 && $jewishMonth == $purimMonth)
     173        $result[] = __("Shushan",'zmanim').' '.__("Purim",'zmanim');
     174    }
     175  } else {
     176    if ($jewishDay == 15 && $jewishMonth == $purimMonth)
     177      $result[] = __("Shushan",'zmanim').' '.__("Purim",'zmanim');
     178  }
     179
     180  // Holidays in Nisan
     181  $shabbatHagadolDay = 14;
     182  $jd = jewishtojd($NISAN, $shabbatHagadolDay, $jewishYear);
     183  while (jddayofweek($jd, 0) != $SATURDAY) {
     184    $jd--;
     185    $shabbatHagadolDay--;
     186  }
     187  if ($jewishDay == $shabbatHagadolDay && $jewishMonth == $NISAN)
     188    $result[] = translate_z("Shabbat",$data['accent']).' '.__("Hagadol",'zmanim');
     189  if ($jewishDay == 14 && $jewishMonth == $NISAN)
     190    $result[] = __("Erev",'zmanim').' '.__("Pesach",'zmanim');
     191  if ($jewishDay == 15 && $jewishMonth == $NISAN)
     192    $result[] = __("Pesach",'zmanim')." I";
     193  if ($jewishDay == 16 && $jewishMonth == $NISAN && $isDiaspora)
     194    $result[] = __("Pesach",'zmanim')." II";
     195  if ($isDiaspora) {
     196    if ($jewishDay >= 17 && $jewishDay <= 20 && $jewishMonth == $NISAN)
     197      $result[] = __("Hol Hamoed",'zmanim')." ".__("Pesach",'zmanim');
     198  } else {
     199    if ($jewishDay >= 16 && $jewishDay <= 20 && $jewishMonth == $NISAN)
     200      $result[] = __("Hol Hamoed",'zmanim')." ".__("Pesach",'zmanim');
     201  }
     202  if ($jewishDay == 21 && $jewishMonth == $NISAN)
     203    $result[] = __("Pesach",'zmanim')." VII";
     204  if ($jewishDay == 22 && $jewishMonth == $NISAN && $isDiaspora)
     205    $result[] = __("Pesach",'zmanim')." VIII";
     206  if ($isDiaspora) {
     207    if ($jewishDay == 23 && $jewishMonth == $NISAN)
     208      $result[] = __("Isru Chag",'zmanim');
     209  } else {
     210    if ($jewishDay == 22 && $jewishMonth == $NISAN)
     211      $result[] = __("Isru Chag",'zmanim');
     212  }
     213
     214  $jd = jewishtojd($NISAN, 27, $jewishYear);
     215  $weekdayNo = jddayofweek($jd, 0);
     216  if ($weekdayNo == $FRIDAY) { // If the 27 Nisan would fall on Friday ...
     217    // ... then Yom Hashoah falls on Thursday
     218    if ($jewishDay == 26 && $jewishMonth == $NISAN)
     219      $result[] = __("Yom Hashoah",'zmanim');
     220  } else {
     221    if ($jewishYear >= 5757) { // Since 1997 (5757) ...
     222      if ($weekdayNo == $SUNDAY) { // If the 27 Nisan would fall on Friday ...
     223        // ... then Yom Hashoah falls on Thursday
     224        if ($jewishDay == 28 && $jewishMonth == $NISAN)
     225          $result[] = __("Yom Hashoah",'zmanim');
     226      } else {
     227        if ($jewishDay == 27 && $jewishMonth == $NISAN)
     228          $result[] = __("Yom Hashoah",'zmanim');
     229      }
     230    } else {
     231      if ($jewishDay == 27 && $jewishMonth == $NISAN)
     232        $result[] = __("Yom Hashoah",'zmanim');
     233    }
     234  }
     235
     236  // Holidays in Iyar
     237
     238  $jd = jewishtojd($IYAR, 4, $jewishYear);
     239  $weekdayNo = jddayofweek($jd, 0);
     240
     241  // If the 4 Iyar would fall on Friday or Thursday ...
     242  // ... then Yom Hazikaron falls on Wednesday and Yom Ha'Atzmaut on Thursday
     243  if ($weekdayNo == $FRIDAY) {
     244    if ($jewishDay == 2 && $jewishMonth == $IYAR)
     245      $result[] = __("Yom Hazikaron",'zmanim');
     246    if ($jewishDay == 3 && $jewishMonth == $IYAR)
     247      $result[] = __("Yom Ha'Atzmaut",'zmanim');
     248  } else {
     249    if ($weekdayNo == $THURSDAY) {
     250      if ($jewishDay == 3 && $jewishMonth == $IYAR)
     251        $result[] = __("Yom Hazikaron",'zmanim');
     252      if ($jewishDay == 4 && $jewishMonth == $IYAR)
     253        $result[] = __("Yom Ha'Atzmaut",'zmanim');
     254    } else {
     255      if ($jewishYear >= 5764) { // Since 2004 (5764) ...
     256        if ($weekdayNo == $SUNDAY) { // If the 4 Iyar would fall on Sunday ...
     257          // ... then Yom Hazicaron falls on Monday
     258          if ($jewishDay == 5 && $jewishMonth == $IYAR)
     259            $result[] = __("Yom Hazikaron",'zmanim');
     260          if ($jewishDay == 6 && $jewishMonth == $IYAR)
     261            $result[] = __("Yom Ha'Atzmaut",'zmanim');
     262        } else {
     263          if ($jewishDay == 4 && $jewishMonth == $IYAR)
     264            $result[] = __("Yom Hazikaron",'zmanim');
     265          if ($jewishDay == 5 && $jewishMonth == $IYAR)
     266            $result[] = __("Yom Ha'Atzmaut",'zmanim');
     267        }
     268      } else {
     269        if ($jewishDay == 4 && $jewishMonth == $IYAR)
     270          $result[] = __("Yom Hazikaron",'zmanim');
     271        if ($jewishDay == 5 && $jewishMonth == $IYAR)
     272          $result[] = __("Yom Ha'Atzmaut",'zmanim');
     273      }
     274    }
     275  }
     276
     277  if ($jewishDay == 14 && $jewishMonth == $IYAR)
     278    $result[] = __("Pesach",'zmanim').' '.__("Sheini",'zmanim');
     279  if ($jewishDay == 18 && $jewishMonth == $IYAR)
     280    $result[] = __("Lag B'Omer",'zmanim');
     281  if ($jewishDay == 28 && $jewishMonth == $IYAR)
     282    $result[] = __("Yom Yerushalayim",'zmanim');
     283
     284  // Holidays in Sivan
     285  if ($jewishDay == 5 && $jewishMonth == $SIVAN)
     286    $result[] = __("Erev",'zmanim').' '.__("Shavuot",'zmanim');
     287  if ($jewishDay == 6 && $jewishMonth == $SIVAN)
     288    $result[] = __("Shavuot",'zmanim')." I";
     289  if ($jewishDay == 7 && $jewishMonth == $SIVAN && $isDiaspora)
     290    $result[] = __("Shavuot",'zmanim')." II";
     291  if ($isDiaspora) {
     292    if ($jewishDay == 8 && $jewishMonth == $SIVAN)
     293      $result[] = __("Isru Chag",'zmanim');
     294  } else {
     295    if ($jewishDay == 7 && $jewishMonth == $SIVAN)
     296      $result[] = __("Isru Chag",'zmanim');
     297  }
     298
     299  // Holidays in Tammuz
     300  $jd = jewishtojd($TAMMUZ, 17, $jewishYear);
     301  $weekdayNo = jddayofweek($jd, 0);
     302  if ($weekdayNo == $SATURDAY) { // If the 17 Tammuz would fall on Saturday ...
     303    // ... postpone Tzom Tammuz to Sunday
     304    if ($jewishDay == 18 && $jewishMonth == $TAMMUZ)
     305      $result[] = __("Tzom",'zmanim').' '.__("Tammuz",'zmanim');
     306  } else {
     307    if ($jewishDay == 17 && $jewishMonth == $TAMMUZ)
     308      $result[] = __("Tzom",'zmanim').' '.__("Tammuz",'zmanim');
     309  }
     310 
     311  // Holidays in Av
     312  $jd = jewishtojd($AV, 9, $jewishYear);
     313  $weekdayNo = jddayofweek($jd, 0);
     314  if ($weekdayNo == $SATURDAY) { // If the 9 Av would fall on Saturday ...
     315    // ... postpone Tisha B'Av to Sunday
     316    if ($jewishDay == 10 && $jewishMonth == $AV)
     317      $result[] = __("Tisha B'",'zmanim').' '.translate_z("Av",$data['accent']);
     318  } else {
     319    if ($jewishDay == 9 && $jewishMonth == $AV)
     320      $result[] = __("Tisha B'",'zmanim').' '.translate_z("Av",$data['accent']);
     321  }
     322  if ($jewishDay == 15 && $jewishMonth == $AV)
     323    $result[] = __("Tu B'",'zmanim').' '.translate_z("Av",$data['accent']);
     324
     325  return $result;
    20326}
    21327?>
    22 
    23 <form action="holidays.php" method="get">
    24 <input type="text" name="year" value="<?php echo $_REQUEST["year"]; ?>"/>
    25 <br/>
    26 <input type="radio" name="israeldiaspora" value="D"<?php if ($_REQUEST["israeldiaspora"] == "D") echo " checked"; ?>>Diaspora
    27 <input type="radio" name="israeldiaspora" value="I"<?php if ($_REQUEST["israeldiaspora"] == "I") echo " checked"; ?>>Israel
    28 <br/>
    29 <input type="checkbox" name="postponeshushanpurimonsaturday" value="X"<?php if ($_REQUEST["postponeshushanpurimonsaturday"] == "X") echo " checked"; ?>>
    30 Postpone Shushan Purim to Sunday if falling on Saturday
    31 <br/>
    32 <input type="submit" value="Calculate">
    33 </form>
    34 
    35 <?php
    36 if (isSet($_REQUEST["year"])) {
    37   if ($_REQUEST["israeldiaspora"] == "D")
    38     $isDiaspora = true;
    39   else
    40     $isDiaspora = false;
    41   if ($_REQUEST["postponeshushanpurimonsaturday"] == "X")
    42     $postponeShushanPurimOnSaturday = true;
    43   else
    44     $postponeShushanPurimOnSaturday = false;
    45   echo "<table border>\n";
    46   echo "<tr><th>Weekday</th><th>Gregorian date</th><th>Jewish date</th><th>Holiday</th></tr>\n";
    47   $gyear = $_REQUEST["year"];
    48   $weekdayNames = array("Sunday", "Monday", "Tuesday", "Wednesday",
    49                         "Thursday", "Friday", "Saturday");
    50   for ($gmonth = 1; $gmonth <= 12; $gmonth++) {
    51     $lastGDay = cal_days_in_month(CAL_GREGORIAN, $gmonth, $gyear);
    52     for ($gday = 1; $gday <= $lastGDay; $gday++) {
    53       $jdCurrent = gregoriantojd($gmonth, $gday, $gyear);
    54       $weekdayNo = jddayofweek($jdCurrent, 0);
    55       $weekdayName = $weekdayNames[$weekdayNo];
    56       $jewishDate = jdtojewish($jdCurrent);
    57       list($jewishMonth, $jewishDay, $jewishYear) = split('/', $jewishDate);
    58       $jewishMonthName = getJewishMonthName($jewishMonth, $jewishYear);
    59       $holidays = getJewishHoliday($jdCurrent, $isDiaspora, $postponeShushanPurimOnSaturday);
    60       if (count($holidays) > 0) {
    61         echo "<tr><td>$weekdayName</td><td>$gday/$gmonth/$gyear</td><td>$jewishDay $jewishMonthName $jewishYear</td><td>";
    62         for ($i = 0; $i < count($holidays); $i++) {
    63           if ($i > 0) echo "/";
    64           $holiday = $holidays[$i];
    65           echo "$holiday";
    66         }
    67         echo "</td></tr>\n";
    68       }
    69     }
    70   }
    71   echo "</table>\n";
    72 }
    73 ?>
    74 
    75 </body>
    76 </html>
  • zmanim-widget/tags/0.6/hdate/today.php

    r186971 r210167  
    3939
    4040echo "</ul>";
    41 echo '<ul><li><b>Zmanim</b></li><li>';
     41echo '<ul><li><b>'.__("Zmanim","zmanim").'</b></li><li>';
    4242echo '<ul>';
    4343print '<li>'.translate_z('Alot_HaShachar',$data['accent']).': '.date_sunrise($ts_t, SUNFUNCS_RET_STRING, $shlat, $shlong, 90+16.1, $shoffset).'</li>';
    4444print '<li>'.translate_z('Netz',$data['accent']).': '.$sunriseStr_t.'</li>';
    45 print '<li>Earliest '.translate_z('Tallit',$data['accent']).': '.date_sunrise($ts_t, SUNFUNCS_RET_STRING, $shlat, $shlong, 90+11, $shoffset).'</li>';
     45print '<li>'.__("Earliest","zmanim").' '.translate_z('Tallit',$data['accent']).': '.date_sunrise($ts_t, SUNFUNCS_RET_STRING, $shlat, $shlong, 90+11, $shoffset).'</li>';
    4646$time_2=implode(':',getProportionalHours($sunriseStr_t,$sunsetStr_t,3));
    47 print '<li>Latest '.translate_z('Shma',$data['accent']).': '.$time_2.'</li>';
     47print '<li>'.__("Latest","zmanim").' '.translate_z('Shma',$data['accent']).': '.$time_2.'</li>';
    4848$time_2=implode(':',getProportionalHours($sunriseStr_t,$sunsetStr_t,6));
    4949print '<li>'.translate_z('Hatzot_Hayom',$data['accent']).': '.$time_2.'</li>';
     
    5151print '<li>'.translate_z('Mincha_Gedola',$data['accent']).': '.$time_2.'</li>';
    5252$time_2=implode(':',getProportionalHours($sunriseStr_t,$sunsetStr_t,11.75));
    53 print '<li>'.translate_z('Plag Hamincha',$data['accent']).': '.$time_2.'</li>';
     53print '<li>'.__("Plag Hamincha","zmanim").': '.$time_2.'</li>';
    5454echo "</ul>\n";
    5555echo "</li></ul>\n";
  • zmanim-widget/tags/0.6/message.php

    r187230 r210167  
    11<?
    22include "functions.php";
    3 include_once("hdate/holidays.inc");
     3include_once("hdate/holidays.php");
    44if (!function_exists("getHebrewJewishDates")) include_once("hdate/hebrewdate.inc");
    55$ipi = getenv("REMOTE_ADDR");
  • zmanim-widget/tags/0.6/readme.txt

    r203456 r210167  
    44Requires at least: 2.7
    55Tested up from : 2.9
    6 Stable tag: 0.5.3
     6Stable tag: 0.6
    77
    88Displays Jewish calendar information in a widget.
     
    2424
    2525== Changelog ==
     26= 0.6 =
     27- Added localization methods and functions to the code
     28- created Russian translation
    2629= 0.5.3 =
    2730- Fixing problem with Warnings and notices due to some variable missing in functions.
  • zmanim-widget/tags/0.6/zmanim-widget.php

    r203456 r210167  
    44 Plugin URI: http://kosherdev.com/category/zmanim-widget/
    55 Description: Allows to turn off the Wordpress site, while Shabat of High Holidays are going on in your area.
    6  Version: 0.5.3
     6 Version: 0.6
    77 Author: Misha Beshkin
    88 Author URI: http://kosherdev.com/
     
    3737    echo $args['before_widget'];
    3838    $data=get_option('zmanim_widget');
    39     echo $args['before_title'] . 'Luach for ' .$data['location']. $args['after_title'];
     39    echo $args['before_title'] . __('Luach for ','zmanim') .$data['location']. $args['after_title'];
    4040    include "message.php";
    4141    echo $args['after_widget'];
     
    4646    register_sidebar_widget('Zmanim widget', array('zmanim_widget', 'widget'));
    4747    register_widget_control('Zmanim widget', array('zmanim_widget', 'control'));
     48    $currentLocale = get_locale();
     49    if(!empty($currentLocale)) {
     50                                $moFile = dirname(__FILE__) . "/localization/zmanim-" . $currentLocale . ".mo";
     51                                if(@file_exists($moFile) && is_readable($moFile)) load_textdomain('zmanim', $moFile);
     52                        }
    4853  }
    4954}
  • zmanim-widget/trunk/dictionary/ashkenaz.php

    r186971 r210167  
    11<?
    22$translate=array(
    3     'Shabbat'=>'Shabbos',
    4     'Alot_HaShachar'=>'Alos HaShachar',
    5     'Netz'=>'Netz',
    6     'Tallit'=>'Tallis',
    7     'Shma'=>'Sh\'ma',
    8     'Hatzot_Hayom'=>'Chatzos',
    9     'Mincha_Gedola'=>'Mincha Gedola',
    10     'Plag_Hamincha'=>'Plag Hamincha',
    11     'Tevet'=>'Teves',
    12     'Av'=>'Ov'
     3    'Shabbat'=>__('Shabbos','zmanim'),
     4    'Alot_HaShachar'=>__('Alos HaShachar','zmanim'),
     5    'Netz'=>__('Netz','zmanim'),
     6    'Tallit'=>__('Tallis','zmanim'),
     7    'Shma'=>__('Sh\'ma','zmanim'),
     8    'Hatzot_Hayom'=>__('Chatzos','zmanim'),
     9    'Mincha_Gedola'=>__('Mincha Gedola','zmanim'),
     10    'Plag_Hamincha'=>__('Plag Hamincha','zmanim'),
     11    'Tevet'=>__('Teves','zmanim'),
     12    'Av'=>__('Ov','zmanim')
    1313
    1414);
  • zmanim-widget/trunk/dictionary/sephard.php

    r186971 r210167  
    11<?
    22$translate=array(
    3     'Shabbat'=>'Shabbat',
    4     'Alot_HaShachar'=>'Alot HaShachar',
    5     'Netz'=>'Netz',
    6     'Tallit'=>'Tallit',
    7     'Shma'=>'Sh\'ma',
    8     'Hatzot_Hayom'=>'Hatzot',
    9     'Mincha_Gedola'=>'Mincha Gedola',
    10     'Plag_Hamincha'=>'Plag Hamincha',
    11     'Tevet'=>'Tevet',
    12         'Av'=>'Av'
     3    'Shabbat'=>__('Shabbat','zmanim'),
     4    'Alot_HaShachar'=>__('Alot HaShachar','zmanim'),
     5    'Netz'=>__('Netz','zmanim'),
     6    'Tallit'=>__('Tallit','zmanim'),
     7    'Shma'=>__('Sh\'ma','zmanim'),
     8    'Hatzot_Hayom'=>__('Chatzot','zmanim'),
     9    'Mincha_Gedola'=>__('Mincha Gedola','zmanim'),
     10    'Plag_Hamincha'=>__('Plag Hamincha','zmanim'),
     11    'Tevet'=>__('Tevet','zmanim'),
     12    'Av'=>__('Av','zmanim')
    1313
    1414);
  • zmanim-widget/trunk/hdate/hdate.php

    r186971 r210167  
    5252if (strlen($leftMin) <2) $leftMin="0$leftMin";
    5353
    54 if ($leftshabat > 1) $nday="It will come in $leftshabat days";
    55 if ($leftshabat ==1) $nday="It will come tomorrow";
    56 if ($leftshabat <1) $nday="It will come in $leftHour:$leftMin";
     54if ($leftshabat > 1) $nday=__("It will come in","zmanim").' '.$leftshabat.' '.__ngettext("day","days",$leftshabat,"zmanim");
     55if ($leftshabat ==1) $nday=__("It will come","zmanim")." ".__("tomorrow","zmanim");
     56if ($leftshabat <1) $nday=__("It will come in","zmanim")." $leftHour:$leftMin";
    5757
    5858if ( strlen($resultMin) < 2 && $resultMin == 0) $resultMin=$resultMin.'0';
     
    6363if ($weekday == 6 && "$currentHour$currentMin" < "$resultHour_end$resultMin_end") $nday=translate_z('Shabbat',$data['accent']);
    6464elseif ($weekday == 5 && "$currentHour$currentMin" > "$resultHour$resultMin") $nday=translate_z('Shabbat',$data['accent']);
    65 elseif ($weekday >= 6  && $leftHour < 0 ) $nday="It remains 6 days";
     65elseif ($weekday >= 6  && $leftHour < 0 ) $nday=__("It remains 6 days","zmanim");
    6666
    67 print '<ul><li><b>'.translate_z('Shabbat',$data['accent'])." time</b></li>";
     67print '<ul><li><b>'.translate_z('Shabbat',$data['accent'])."</b></li>";
    6868echo "<li>
    6969<ul>
    7070<li>$nday.</li>
    71 <li>Candle light : $sh_date $resultHour:$resultMin </li>
    72 <li>".translate_z('Shabbat',$data['accent'])." ends : $sh_date_end $resultHour_end:$resultMin_end</li></ul>
     71<li>".__("Candle light","zmanim")." : $sh_date $resultHour:$resultMin </li>
     72<li>".translate_z('Shabbat',$data['accent'])." ".__("ends","zmanim").": $sh_date_end $resultHour_end:$resultMin_end</li></ul>
    7373</li></ul>";
    7474?>
  • zmanim-widget/trunk/hdate/holidays.inc

    r185227 r210167  
    1010
    1111function getJewishMonthName2($jewishMonth, $jewishYear) {
    12   $jewishMonthNamesLeap = array("Tishri", "Heshvan", "Kislev", translate_z("Tevet",$data['accent']),
    13                                 "Shevat", "Adar I", "Adar II", "Nisan",
    14                                 "Iyar", "Sivan", "Tammuz", translate_z("Av",$data['accent']), "Elul");
    15   $jewishMonthNamesNonLeap = array("Tishri", "Heshvan", "Kislev", translate_z("Tevet",$data['accent']),
    16                                    "Shevat", "Adar", "", "Nisan",
    17                                    "Iyar", "Sivan", "Tammuz", translate_z("Av",$data['accent']), "Elul");
     12  $jewishMonthNamesLeap = array(__("Tishri",'zmanim-widget'),
     13            __("Heshvan",'zmanim-widget'),
     14            __("Kislev",'zmanim-widget'), translate_z("Tevet",$data['accent']),
     15                        __("Shevat",'zmanim-widget'), __("Adar I",'zmanim-widget'),
     16            __("Adar II",'zmanim-widget'), __("Nisan",'zmanim-widget'),
     17                        __("Iyar",'zmanim-widget'), __("Sivan",'zmanim-widget'),
     18            __("Tammuz",'zmanim-widget'), translate_z("Av",$data['accent']), __("Elul",'zmanim-widget'));
     19  $jewishMonthNamesNonLeap = array(__("Tishri",'zmanim-widget'),
     20                        __("Heshvan",'zmanim-widget'),
     21                        __("Kislev",'zmanim-widget'), translate_z("Tevet",$data['accent']),
     22                        __("Shevat",'zmanim-widget'), "",         
     23                        __("Adar II",'zmanim-widget'), __("Nisan",'zmanim-widget'),
     24                        __("Iyar",'zmanim-widget'), __("Sivan",'zmanim-widget'),
     25                        __("Tammuz",'zmanim-widget'), translate_z("Av",$data['accent']), __("Elul",'zmanim-widget'));
    1826  if (isJewishLeapYear2($jewishYear))
    1927    return $jewishMonthNamesLeap[$jewishMonth-1];
  • zmanim-widget/trunk/hdate/holidays.php

    r182644 r210167  
    1 <html>
    2 <head>
    3 <title>Calculating Jewish holidays</title>
    4 </head>
    5 <body>
    6 
    71<?php
    8 include('holidays.inc');
    9 
    10 if (isSet($_REQUEST["year"])) {
    11   $prevYear = $_REQUEST["year"]-1;
    12   $nextYear = $_REQUEST["year"]+1;
    13   $israeldiaspora = $_REQUEST["israeldiaspora"];
    14   $postponeShushanPurimOnSaturday = $_REQUEST["postponeshushanpurimonsaturday"];
    15   echo "<p>\n";
    16   echo "<a href=\"holidays.php?year=$prevYear&israeldiaspora=$israeldiaspora&postponeshushanpurimonsaturday=$postponeShushanPurimOnSaturday\">Previous year</a>";
    17   echo "| ";
    18   echo "<a href=\"holidays.php?year=$nextYear&israeldiaspora=$israeldiaspora&postponeshushanpurimonsaturday=$postponeShushanPurimOnSaturday\">Next year</a>";
    19   echo "</p>\n";
     2function isJewishLeapYear2($year) {
     3  if ($year % 19 == 0 || $year % 19 == 3 || $year % 19 == 6 ||
     4      $year % 19 == 8 || $year % 19 == 11 || $year % 19 == 14 ||
     5      $year % 19 == 17)
     6    return true;
     7  else
     8    return false;
     9}
     10
     11function getJewishMonthName2($jewishMonth, $jewishYear) {
     12  $jewishMonthNamesLeap = array(__("Tishri",'zmanim'),
     13            __("Heshvan",'zmanim'),
     14            __("Kislev",'zmanim'), translate_z("Tevet",$data['accent']),
     15                        __("Shevat",'zmanim'), __("Adar I",'zmanim'),
     16            __("Adar II",'zmanim'), __("Nisan",'zmanim'),
     17                        __("Iyar",'zmanim'), __("Sivan",'zmanim'),
     18            __("Tammuz",'zmanim'), translate_z("Av",$data['accent']), __("Elul",'zmanim'));
     19  $jewishMonthNamesNonLeap = array(__("Tishri",'zmanim'),
     20                        __("Heshvan",'zmanim'),
     21                        __("Kislev",'zmanim'), translate_z("Tevet",$data['accent']),
     22                        __("Shevat",'zmanim'), __("Adar",'zmanim'),         
     23                        "", __("Nisan",'zmanim'),
     24                        __("Iyar",'zmanim'), __("Sivan",'zmanim'),
     25                        __("Tammuz",'zmanim'), translate_z("Av",$data['accent']), __("Elul",'zmanim'));
     26  if (isJewishLeapYear2($jewishYear))
     27    return $jewishMonthNamesLeap[$jewishMonth-1];
     28  else
     29    return $jewishMonthNamesNonLeap[$jewishMonth-1];
     30}
     31
     32function getJewishHoliday2($jdCurrent, $isDiaspora, $postponeShushanPurimOnSaturday) {
     33  $result = array();
     34
     35  $TISHRI = 1;
     36  $HESHVAN = 2;
     37  $KISLEV = 3;
     38  $TEVET = 4;
     39  $SHEVAT = 5;
     40  $ADAR = 6;
     41  $ADAR_I = 6;
     42  $ADAR_II = 7;
     43  $NISAN = 8;
     44  $IYAR = 9;
     45  $SIVAN = 10;
     46  $TAMMUZ = 11;
     47  $AV = 12;
     48  $ELUL = 13;
     49
     50  $SUNDAY = 0;
     51  $MONDAY = 1;
     52  $TUESDAY = 2;
     53  $WEDNESDAY = 3;
     54  $THURSDAY = 4;
     55  $FRIDAY = 5;
     56  $SATURDAY = 6;
     57
     58  $jewishDate = jdtojewish($jdCurrent);
     59  list($jewishMonth, $jewishDay, $jewishYear) = split('/', $jewishDate);
     60
     61  // Holidays in Elul
     62  if ($jewishDay == 29 && $jewishMonth == $ELUL)
     63    $result[] = __("Erev",'zmanim').' '.__("Rosh Hashanah",'zmanim');
     64
     65  // Holidays in Tishri
     66  if ($jewishDay == 1 && $jewishMonth == $TISHRI)
     67    $result[] = __("Rosh Hashanah",'zmanim')." I";
     68  if ($jewishDay == 2 && $jewishMonth == $TISHRI)
     69    $result[] = __("Rosh Hashanah",'zmanim')." II";
     70  $jd = jewishtojd($TISHRI, 3, $jewishYear);
     71  $weekdayNo = jddayofweek($jd, 0);
     72  if ($weekdayNo == $SATURDAY) { // If the 3 Tishri would fall on Saturday ...
     73    // ... postpone Tzom Gedaliah to Sunday
     74    if ($jewishDay == 4 && $jewishMonth == $TISHRI)
     75      $result[] = __("Tzom Gedaliah",'zmanim');
     76  } else {
     77    if ($jewishDay == 3 && $jewishMonth == $TISHRI)
     78      $result[] = __("Tzom Gedaliah",'zmanim');
     79  }
     80  if ($jewishDay == 9 && $jewishMonth == $TISHRI)
     81    $result[] = __("Erev",'zmanim').' '.__("Yom Kippur",'zmanim');
     82  if ($jewishDay == 10 && $jewishMonth == $TISHRI)
     83    $result[] = __("Yom Kippur",'zmanim');
     84  if ($jewishDay == 14 && $jewishMonth == $TISHRI)
     85    $result[] = __("Erev",'zmanim').' '.__("Sukkot",'zmanim');
     86  if ($jewishDay == 15 && $jewishMonth == $TISHRI)
     87    $result[] = __("Sukkot",'zmanim')." I";
     88  if ($jewishDay == 16 && $jewishMonth == $TISHRI && $isDiaspora)
     89    $result[] = __("Sukkot",'zmanim')." II";
     90  if ($isDiaspora) {
     91    if ($jewishDay >= 17 && $jewishDay <= 20 && $jewishMonth == $TISHRI)
     92      $result[] = __("Hol Hamoed",'zmanim')." ".__("Sukkot",'zmanim');
     93  } else {
     94    if ($jewishDay >= 16 && $jewishDay <= 20 && $jewishMonth == $TISHRI)
     95      $result[] = __("Hol Hamoed",'zmanim')." ".__("Sukkot",'zmanim');
     96  }
     97  if ($jewishDay == 21 && $jewishMonth == $TISHRI)
     98    $result[] = __("Hoshana Rabbah",'zmanim');
     99  if ($isDiaspora) {
     100    if ($jewishDay == 22 && $jewishMonth == $TISHRI)
     101      $result[] = __("Shemini Azeret",'zmanim');
     102    if ($jewishDay == 23 && $jewishMonth == $TISHRI)
     103      $result[] = __("Simchat Torah",'zmanim');
     104    if ($jewishDay == 24 && $jewishMonth == $TISHRI)
     105      $result[] = __("Isru Chag",'zmanim');
     106  } else {
     107    if ($jewishDay == 22 && $jewishMonth == $TISHRI)
     108      $result[] = __("Shemini Azeret",'zmanim')."/".__("Simchat Torah",'zmanim');
     109    if ($jewishDay == 23 && $jewishMonth == $TISHRI)
     110      $result[] = __("Isru Chag",'zmanim');
     111  }
     112
     113  // Holidays in Kislev/Tevet
     114  $hanukkahStart = jewishtojd($KISLEV, 25, $jewishYear);
     115  $hanukkahNo = (int) ($jdCurrent-$hanukkahStart+1);
     116  if ($hanukkahNo == 1) $result[] = __("Hanukkah",'zmanim')." I";
     117  if ($hanukkahNo == 2) $result[] = __("Hanukkah",'zmanim')." II";
     118  if ($hanukkahNo == 3) $result[] = __("Hanukkah",'zmanim')." III";
     119  if ($hanukkahNo == 4) $result[] = __("Hanukkah",'zmanim')." IV";
     120  if ($hanukkahNo == 5) $result[] = __("Hanukkah",'zmanim')." V";
     121  if ($hanukkahNo == 6) $result[] = __("Hanukkah",'zmanim')." VI";
     122  if ($hanukkahNo == 7) $result[] = __("Hanukkah",'zmanim')." VII";
     123  if ($hanukkahNo == 8) $result[] = __("Hanukkah",'zmanim')." VIII";
     124
     125  // Holidays in Tevet
     126  $jd = jewishtojd($TEVET, 10, $jewishYear);
     127  $weekdayNo = jddayofweek($jd, 0);
     128  if ($weekdayNo == $SATURDAY) { // If the 10 Tevet would fall on Saturday ...
     129    // ... postpone Tzom Tevet to Sunday
     130    if ($jewishDay == 11 && $jewishMonth == $TEVET)
     131      $result[] = __("Tzom",'zmanim')." ".translate_z("Tevet",$data['accent']);
     132  } else {
     133    if ($jewishDay == 10 && $jewishMonth == $TEVET)
     134      $result[] = __("Tzom",'zmanim')." ".translate_z("Tevet",$data['accent']);
     135  }
     136
     137  // Holidays in Shevat
     138  if ($jewishDay == 15 && $jewishMonth == $SHEVAT)
     139    $result[] = __("Tu",'zmanim')." ".__("B'Shevat",'zmanim');
     140
     141  // Holidays in Adar I
     142  if (isJewishLeapYear2($jewishYear) && $jewishDay == 14 && $jewishMonth == $ADAR_I)
     143    $result[] = __("Purim",'zmanim')." ".__("Katan",'zmanim');
     144  if (isJewishLeapYear2($jewishYear) && $jewishDay == 15 && $jewishMonth == $ADAR_I)
     145    $result[] = __("Shushan",'zmanim').' '.__("Purim",'zmanim')." ".__("Katan",'zmanim');
     146
     147  // Holidays in Adar or Adar II
     148  if (isJewishLeapYear2($jewishYear))
     149    $purimMonth = $ADAR_II;
     150  else
     151    $purimMonth = $ADAR;
     152  $jd = jewishtojd($purimMonth, 13, $jewishYear);
     153  $weekdayNo = jddayofweek($jd, 0);
     154  if ($weekdayNo == $SATURDAY) { // If the 13 Adar or Adar II would fall on Saturday ...
     155    // ... move Ta'anit Esther to the preceding Thursday
     156    if ($jewishDay == 11 && $jewishMonth == $purimMonth)
     157      $result[] = __("Ta'anith Esther",'zmanim');
     158  } else {
     159    if ($jewishDay == 13 && $jewishMonth == $purimMonth)
     160      $result[] = __("Ta'anith Esther",'zmanim');
     161  }
     162  if ($jewishDay == 14 && $jewishMonth == $purimMonth)
     163    $result[] = __("Purim",'zmanim');
     164  if ($postponeShushanPurimOnSaturday) {
     165    $jd = jewishtojd($purimMonth, 15, $jewishYear);
     166    $weekdayNo = jddayofweek($jd, 0);
     167    if ($weekdayNo == $SATURDAY) { // If the 15 Adar or Adar II would fall on Saturday ...
     168      // ... postpone Shushan Purim to Sunday
     169      if ($jewishDay == 16 && $jewishMonth == $purimMonth)
     170        $result[] = __("Shushan",'zmanim').' '.__("Purim",'zmanim');
     171    } else {
     172      if ($jewishDay == 15 && $jewishMonth == $purimMonth)
     173        $result[] = __("Shushan",'zmanim').' '.__("Purim",'zmanim');
     174    }
     175  } else {
     176    if ($jewishDay == 15 && $jewishMonth == $purimMonth)
     177      $result[] = __("Shushan",'zmanim').' '.__("Purim",'zmanim');
     178  }
     179
     180  // Holidays in Nisan
     181  $shabbatHagadolDay = 14;
     182  $jd = jewishtojd($NISAN, $shabbatHagadolDay, $jewishYear);
     183  while (jddayofweek($jd, 0) != $SATURDAY) {
     184    $jd--;
     185    $shabbatHagadolDay--;
     186  }
     187  if ($jewishDay == $shabbatHagadolDay && $jewishMonth == $NISAN)
     188    $result[] = translate_z("Shabbat",$data['accent']).' '.__("Hagadol",'zmanim');
     189  if ($jewishDay == 14 && $jewishMonth == $NISAN)
     190    $result[] = __("Erev",'zmanim').' '.__("Pesach",'zmanim');
     191  if ($jewishDay == 15 && $jewishMonth == $NISAN)
     192    $result[] = __("Pesach",'zmanim')." I";
     193  if ($jewishDay == 16 && $jewishMonth == $NISAN && $isDiaspora)
     194    $result[] = __("Pesach",'zmanim')." II";
     195  if ($isDiaspora) {
     196    if ($jewishDay >= 17 && $jewishDay <= 20 && $jewishMonth == $NISAN)
     197      $result[] = __("Hol Hamoed",'zmanim')." ".__("Pesach",'zmanim');
     198  } else {
     199    if ($jewishDay >= 16 && $jewishDay <= 20 && $jewishMonth == $NISAN)
     200      $result[] = __("Hol Hamoed",'zmanim')." ".__("Pesach",'zmanim');
     201  }
     202  if ($jewishDay == 21 && $jewishMonth == $NISAN)
     203    $result[] = __("Pesach",'zmanim')." VII";
     204  if ($jewishDay == 22 && $jewishMonth == $NISAN && $isDiaspora)
     205    $result[] = __("Pesach",'zmanim')." VIII";
     206  if ($isDiaspora) {
     207    if ($jewishDay == 23 && $jewishMonth == $NISAN)
     208      $result[] = __("Isru Chag",'zmanim');
     209  } else {
     210    if ($jewishDay == 22 && $jewishMonth == $NISAN)
     211      $result[] = __("Isru Chag",'zmanim');
     212  }
     213
     214  $jd = jewishtojd($NISAN, 27, $jewishYear);
     215  $weekdayNo = jddayofweek($jd, 0);
     216  if ($weekdayNo == $FRIDAY) { // If the 27 Nisan would fall on Friday ...
     217    // ... then Yom Hashoah falls on Thursday
     218    if ($jewishDay == 26 && $jewishMonth == $NISAN)
     219      $result[] = __("Yom Hashoah",'zmanim');
     220  } else {
     221    if ($jewishYear >= 5757) { // Since 1997 (5757) ...
     222      if ($weekdayNo == $SUNDAY) { // If the 27 Nisan would fall on Friday ...
     223        // ... then Yom Hashoah falls on Thursday
     224        if ($jewishDay == 28 && $jewishMonth == $NISAN)
     225          $result[] = __("Yom Hashoah",'zmanim');
     226      } else {
     227        if ($jewishDay == 27 && $jewishMonth == $NISAN)
     228          $result[] = __("Yom Hashoah",'zmanim');
     229      }
     230    } else {
     231      if ($jewishDay == 27 && $jewishMonth == $NISAN)
     232        $result[] = __("Yom Hashoah",'zmanim');
     233    }
     234  }
     235
     236  // Holidays in Iyar
     237
     238  $jd = jewishtojd($IYAR, 4, $jewishYear);
     239  $weekdayNo = jddayofweek($jd, 0);
     240
     241  // If the 4 Iyar would fall on Friday or Thursday ...
     242  // ... then Yom Hazikaron falls on Wednesday and Yom Ha'Atzmaut on Thursday
     243  if ($weekdayNo == $FRIDAY) {
     244    if ($jewishDay == 2 && $jewishMonth == $IYAR)
     245      $result[] = __("Yom Hazikaron",'zmanim');
     246    if ($jewishDay == 3 && $jewishMonth == $IYAR)
     247      $result[] = __("Yom Ha'Atzmaut",'zmanim');
     248  } else {
     249    if ($weekdayNo == $THURSDAY) {
     250      if ($jewishDay == 3 && $jewishMonth == $IYAR)
     251        $result[] = __("Yom Hazikaron",'zmanim');
     252      if ($jewishDay == 4 && $jewishMonth == $IYAR)
     253        $result[] = __("Yom Ha'Atzmaut",'zmanim');
     254    } else {
     255      if ($jewishYear >= 5764) { // Since 2004 (5764) ...
     256        if ($weekdayNo == $SUNDAY) { // If the 4 Iyar would fall on Sunday ...
     257          // ... then Yom Hazicaron falls on Monday
     258          if ($jewishDay == 5 && $jewishMonth == $IYAR)
     259            $result[] = __("Yom Hazikaron",'zmanim');
     260          if ($jewishDay == 6 && $jewishMonth == $IYAR)
     261            $result[] = __("Yom Ha'Atzmaut",'zmanim');
     262        } else {
     263          if ($jewishDay == 4 && $jewishMonth == $IYAR)
     264            $result[] = __("Yom Hazikaron",'zmanim');
     265          if ($jewishDay == 5 && $jewishMonth == $IYAR)
     266            $result[] = __("Yom Ha'Atzmaut",'zmanim');
     267        }
     268      } else {
     269        if ($jewishDay == 4 && $jewishMonth == $IYAR)
     270          $result[] = __("Yom Hazikaron",'zmanim');
     271        if ($jewishDay == 5 && $jewishMonth == $IYAR)
     272          $result[] = __("Yom Ha'Atzmaut",'zmanim');
     273      }
     274    }
     275  }
     276
     277  if ($jewishDay == 14 && $jewishMonth == $IYAR)
     278    $result[] = __("Pesach",'zmanim').' '.__("Sheini",'zmanim');
     279  if ($jewishDay == 18 && $jewishMonth == $IYAR)
     280    $result[] = __("Lag B'Omer",'zmanim');
     281  if ($jewishDay == 28 && $jewishMonth == $IYAR)
     282    $result[] = __("Yom Yerushalayim",'zmanim');
     283
     284  // Holidays in Sivan
     285  if ($jewishDay == 5 && $jewishMonth == $SIVAN)
     286    $result[] = __("Erev",'zmanim').' '.__("Shavuot",'zmanim');
     287  if ($jewishDay == 6 && $jewishMonth == $SIVAN)
     288    $result[] = __("Shavuot",'zmanim')." I";
     289  if ($jewishDay == 7 && $jewishMonth == $SIVAN && $isDiaspora)
     290    $result[] = __("Shavuot",'zmanim')." II";
     291  if ($isDiaspora) {
     292    if ($jewishDay == 8 && $jewishMonth == $SIVAN)
     293      $result[] = __("Isru Chag",'zmanim');
     294  } else {
     295    if ($jewishDay == 7 && $jewishMonth == $SIVAN)
     296      $result[] = __("Isru Chag",'zmanim');
     297  }
     298
     299  // Holidays in Tammuz
     300  $jd = jewishtojd($TAMMUZ, 17, $jewishYear);
     301  $weekdayNo = jddayofweek($jd, 0);
     302  if ($weekdayNo == $SATURDAY) { // If the 17 Tammuz would fall on Saturday ...
     303    // ... postpone Tzom Tammuz to Sunday
     304    if ($jewishDay == 18 && $jewishMonth == $TAMMUZ)
     305      $result[] = __("Tzom",'zmanim').' '.__("Tammuz",'zmanim');
     306  } else {
     307    if ($jewishDay == 17 && $jewishMonth == $TAMMUZ)
     308      $result[] = __("Tzom",'zmanim').' '.__("Tammuz",'zmanim');
     309  }
     310 
     311  // Holidays in Av
     312  $jd = jewishtojd($AV, 9, $jewishYear);
     313  $weekdayNo = jddayofweek($jd, 0);
     314  if ($weekdayNo == $SATURDAY) { // If the 9 Av would fall on Saturday ...
     315    // ... postpone Tisha B'Av to Sunday
     316    if ($jewishDay == 10 && $jewishMonth == $AV)
     317      $result[] = __("Tisha B'",'zmanim').' '.translate_z("Av",$data['accent']);
     318  } else {
     319    if ($jewishDay == 9 && $jewishMonth == $AV)
     320      $result[] = __("Tisha B'",'zmanim').' '.translate_z("Av",$data['accent']);
     321  }
     322  if ($jewishDay == 15 && $jewishMonth == $AV)
     323    $result[] = __("Tu B'",'zmanim').' '.translate_z("Av",$data['accent']);
     324
     325  return $result;
    20326}
    21327?>
    22 
    23 <form action="holidays.php" method="get">
    24 <input type="text" name="year" value="<?php echo $_REQUEST["year"]; ?>"/>
    25 <br/>
    26 <input type="radio" name="israeldiaspora" value="D"<?php if ($_REQUEST["israeldiaspora"] == "D") echo " checked"; ?>>Diaspora
    27 <input type="radio" name="israeldiaspora" value="I"<?php if ($_REQUEST["israeldiaspora"] == "I") echo " checked"; ?>>Israel
    28 <br/>
    29 <input type="checkbox" name="postponeshushanpurimonsaturday" value="X"<?php if ($_REQUEST["postponeshushanpurimonsaturday"] == "X") echo " checked"; ?>>
    30 Postpone Shushan Purim to Sunday if falling on Saturday
    31 <br/>
    32 <input type="submit" value="Calculate">
    33 </form>
    34 
    35 <?php
    36 if (isSet($_REQUEST["year"])) {
    37   if ($_REQUEST["israeldiaspora"] == "D")
    38     $isDiaspora = true;
    39   else
    40     $isDiaspora = false;
    41   if ($_REQUEST["postponeshushanpurimonsaturday"] == "X")
    42     $postponeShushanPurimOnSaturday = true;
    43   else
    44     $postponeShushanPurimOnSaturday = false;
    45   echo "<table border>\n";
    46   echo "<tr><th>Weekday</th><th>Gregorian date</th><th>Jewish date</th><th>Holiday</th></tr>\n";
    47   $gyear = $_REQUEST["year"];
    48   $weekdayNames = array("Sunday", "Monday", "Tuesday", "Wednesday",
    49                         "Thursday", "Friday", "Saturday");
    50   for ($gmonth = 1; $gmonth <= 12; $gmonth++) {
    51     $lastGDay = cal_days_in_month(CAL_GREGORIAN, $gmonth, $gyear);
    52     for ($gday = 1; $gday <= $lastGDay; $gday++) {
    53       $jdCurrent = gregoriantojd($gmonth, $gday, $gyear);
    54       $weekdayNo = jddayofweek($jdCurrent, 0);
    55       $weekdayName = $weekdayNames[$weekdayNo];
    56       $jewishDate = jdtojewish($jdCurrent);
    57       list($jewishMonth, $jewishDay, $jewishYear) = split('/', $jewishDate);
    58       $jewishMonthName = getJewishMonthName($jewishMonth, $jewishYear);
    59       $holidays = getJewishHoliday($jdCurrent, $isDiaspora, $postponeShushanPurimOnSaturday);
    60       if (count($holidays) > 0) {
    61         echo "<tr><td>$weekdayName</td><td>$gday/$gmonth/$gyear</td><td>$jewishDay $jewishMonthName $jewishYear</td><td>";
    62         for ($i = 0; $i < count($holidays); $i++) {
    63           if ($i > 0) echo "/";
    64           $holiday = $holidays[$i];
    65           echo "$holiday";
    66         }
    67         echo "</td></tr>\n";
    68       }
    69     }
    70   }
    71   echo "</table>\n";
    72 }
    73 ?>
    74 
    75 </body>
    76 </html>
  • zmanim-widget/trunk/hdate/today.php

    r186971 r210167  
    3939
    4040echo "</ul>";
    41 echo '<ul><li><b>Zmanim</b></li><li>';
     41echo '<ul><li><b>'.__("Zmanim","zmanim").'</b></li><li>';
    4242echo '<ul>';
    4343print '<li>'.translate_z('Alot_HaShachar',$data['accent']).': '.date_sunrise($ts_t, SUNFUNCS_RET_STRING, $shlat, $shlong, 90+16.1, $shoffset).'</li>';
    4444print '<li>'.translate_z('Netz',$data['accent']).': '.$sunriseStr_t.'</li>';
    45 print '<li>Earliest '.translate_z('Tallit',$data['accent']).': '.date_sunrise($ts_t, SUNFUNCS_RET_STRING, $shlat, $shlong, 90+11, $shoffset).'</li>';
     45print '<li>'.__("Earliest","zmanim").' '.translate_z('Tallit',$data['accent']).': '.date_sunrise($ts_t, SUNFUNCS_RET_STRING, $shlat, $shlong, 90+11, $shoffset).'</li>';
    4646$time_2=implode(':',getProportionalHours($sunriseStr_t,$sunsetStr_t,3));
    47 print '<li>Latest '.translate_z('Shma',$data['accent']).': '.$time_2.'</li>';
     47print '<li>'.__("Latest","zmanim").' '.translate_z('Shma',$data['accent']).': '.$time_2.'</li>';
    4848$time_2=implode(':',getProportionalHours($sunriseStr_t,$sunsetStr_t,6));
    4949print '<li>'.translate_z('Hatzot_Hayom',$data['accent']).': '.$time_2.'</li>';
     
    5151print '<li>'.translate_z('Mincha_Gedola',$data['accent']).': '.$time_2.'</li>';
    5252$time_2=implode(':',getProportionalHours($sunriseStr_t,$sunsetStr_t,11.75));
    53 print '<li>'.translate_z('Plag Hamincha',$data['accent']).': '.$time_2.'</li>';
     53print '<li>'.__("Plag Hamincha","zmanim").': '.$time_2.'</li>';
    5454echo "</ul>\n";
    5555echo "</li></ul>\n";
  • zmanim-widget/trunk/message.php

    r187230 r210167  
    11<?
    22include "functions.php";
    3 include_once("hdate/holidays.inc");
     3include_once("hdate/holidays.php");
    44if (!function_exists("getHebrewJewishDates")) include_once("hdate/hebrewdate.inc");
    55$ipi = getenv("REMOTE_ADDR");
  • zmanim-widget/trunk/readme.txt

    r203456 r210167  
    44Requires at least: 2.7
    55Tested up from : 2.9
    6 Stable tag: 0.5.3
     6Stable tag: 0.6
    77
    88Displays Jewish calendar information in a widget.
     
    2424
    2525== Changelog ==
     26= 0.6 =
     27- Added localization methods and functions to the code
     28- created Russian translation
    2629= 0.5.3 =
    2730- Fixing problem with Warnings and notices due to some variable missing in functions.
  • zmanim-widget/trunk/zmanim-widget.php

    r203456 r210167  
    44 Plugin URI: http://kosherdev.com/category/zmanim-widget/
    55 Description: Allows to turn off the Wordpress site, while Shabat of High Holidays are going on in your area.
    6  Version: 0.5.3
     6 Version: 0.6
    77 Author: Misha Beshkin
    88 Author URI: http://kosherdev.com/
     
    3737    echo $args['before_widget'];
    3838    $data=get_option('zmanim_widget');
    39     echo $args['before_title'] . 'Luach for ' .$data['location']. $args['after_title'];
     39    echo $args['before_title'] . __('Luach for ','zmanim') .$data['location']. $args['after_title'];
    4040    include "message.php";
    4141    echo $args['after_widget'];
     
    4646    register_sidebar_widget('Zmanim widget', array('zmanim_widget', 'widget'));
    4747    register_widget_control('Zmanim widget', array('zmanim_widget', 'control'));
     48    $currentLocale = get_locale();
     49    if(!empty($currentLocale)) {
     50                                $moFile = dirname(__FILE__) . "/localization/zmanim-" . $currentLocale . ".mo";
     51                                if(@file_exists($moFile) && is_readable($moFile)) load_textdomain('zmanim', $moFile);
     52                        }
    4853  }
    4954}
Note: See TracChangeset for help on using the changeset viewer.