|
From: Florin C B. <ory...@us...> - 2013-04-29 05:04:29
|
Update of /cvsroot/mxbb/mx_calsnails/includes In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv16984 Modified Files: cal_functions.php Log Message: phpBB3 bbcode update Index: cal_functions.php =================================================================== RCS file: /cvsroot/mxbb/mx_calsnails/includes/cal_functions.php,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** cal_functions.php 7 Apr 2013 16:37:47 -0000 1.24 --- cal_functions.php 29 Apr 2013 05:04:26 -0000 1.25 *************** *** 1507,1512 **** $jdc = gregoriantojd($month, $day, $year); $dow = jddayofweek($jdc, 0) + 1; ! $j_date = $this->convertToNative(array('jdc' => $jdc)); ! $julDate = $this->caldean_date('Date', $month, $thisday, $year); $JDate = $this->caldean_date('HebrewDate', $month, $thisday, $year); --- 1507,1511 ---- $jdc = gregoriantojd($month, $day, $year); $dow = jddayofweek($jdc, 0) + 1; ! $j_date = $this->convertToNative(array('jdc' => $jdc)); $julDate = $this->caldean_date('Date', $month, $thisday, $year); $JDate = $this->caldean_date('HebrewDate', $month, $thisday, $year); *************** *** 2163,2167 **** return $woy; } ! /* Functions ported from mx_moonfases module --- 2162,2173 ---- return $woy; } ! /* ! Adds a specified number of days to the date provided. ! */ ! function addDays($day, $days) ! { ! $timestr = ($days > 0) ? "+" . $days . " days" : $days . " days"; ! return strtotime($timestr, $day); ! } /* Functions ported from mx_moonfases module *************** *** 2188,2199 **** the Paschal full moon (a number between -6 and 28) */ ! function passover_day($mode, $year) { ! //global $mx_user; ! $year = ($year) ? $year : date(Y); //Gregorian or Julian Year $G = $year % 19; $C = (int)($year / 100); $H = (int)($C - (int)($C / 4) - (int)((8*$C+13) / 25) + 19*$G + 15) % 30; ! $I = (int)$H - (int)($H / 28)*(1 - (int)($H / 28)*(int)(29 / ($H + 1))*((int)(21 - $G) / 11)); //$S21 = date("$year-03-21"); if($I <= 10) --- 2194,2205 ---- the Paschal full moon (a number between -6 and 28) */ ! function passover_day($mode, $g_year, $j_year = 0) { ! $g_year = ($g_year) ? $g_year : date(Y); //Gregorian or Julian Year ! $year = (intval($j_year) > 0) ? $this->JewishToGreg('GYear', false, false, $j_year) : $g_year; //Gregorian or Julian Year $G = $year % 19; $C = (int)($year / 100); $H = (int)($C - (int)($C / 4) - (int)((8*$C+13) / 25) + 19*$G + 15) % 30; ! $I = (int)$H - (int)($H / 28)*(1 - (int)($H / 28)*(int)(29 / ($H + 1))*((int)(21 - $G) / 11)); //$S21 = date("$year-03-21"); if($I <= 10) *************** *** 2201,2205 **** $GregLunarDay = str_pad(21 + $I, 2, '0', STR_PAD_LEFT); $PascaLunarDay = str_pad(20 + $I, 2, '0', STR_PAD_LEFT); ! $GregLunarMonth = 03; } else --- 2207,2211 ---- $GregLunarDay = str_pad(21 + $I, 2, '0', STR_PAD_LEFT); $PascaLunarDay = str_pad(20 + $I, 2, '0', STR_PAD_LEFT); ! $GregLunarMonth = 03; } else *************** *** 2208,2217 **** $PascalunarDay = str_pad($I - 11, 2, '0', STR_PAD_LEFT); $GregLunarMonth = 04; ! } $J = ($year + (int)($year / 4) + $I + 2 - $C + (int)($C / 4)) % 7; $L = $I - $J; $m = 3 + (int)(($L + 40) / 44); $OmerDay = $L + 28 - 31 * ((int)($m / 4)); ! $OmerMonth = 3 + (int)(($L + 40) / 44); switch ($mode) { --- 2214,2238 ---- $PascalunarDay = str_pad($I - 11, 2, '0', STR_PAD_LEFT); $GregLunarMonth = 04; ! } $J = ($year + (int)($year / 4) + $I + 2 - $C + (int)($C / 4)) % 7; $L = $I - $J; $m = 3 + (int)(($L + 40) / 44); $OmerDay = $L + 28 - 31 * ((int)($m / 4)); ! $OmerMonth = 3 + (int)(($L + 40) / 44); ! //$lagBaOmerDay = $L + 28 + 3 - 31 * ((int)($m / 4)); //+ 33 - 31 ! $lagBaOmerDay = 18 + $OmerDay - $GregLunarDay; //18 ! $lagBaOmerMonth = 4 + (int)(($L + 40) / 44); ! ! //$PalmSunday = addDays($OmerDay, -7); //Christian Lamb Day ! //$LaetareSunday = addDays($OmerDay, -21); ! //$GoodFriday = addDays($OmerDay, -2); ! ! //$HolyThursday = addDays($OmerDay, -3); ? ! //$ShroveTuesday = addDays($OmerDay, -47); ? ! //$AshWednesday = addDays($OmerDay, -46); ? ! //$AscensionDay = addDays($OmerDay, 39); ! $ShavuotDay = 6 + $OmerDay - $GregLunarDay; //6 ! //$Pentecost = addDays($OmerDay, 49); //6 ! switch ($mode) { *************** *** 2227,2238 **** case 'OmerDay': return $OmerDay; case 'JOmerDay': return $this->caldean_date('JDay', $OmerMonth, $OmerDay, $year); break; default: break; } } - // Implements from NativeCalendar::getHolidays() function getMoadim($j_year, $j_month, $j_day, $mode = CAL_LANG_FOREIGN) --- 2248,2277 ---- case 'OmerDay': return $OmerDay; + break; case 'JOmerDay': return $this->caldean_date('JDay', $OmerMonth, $OmerDay, $year); break; + case 'BaOmerMonth': + return $lagBaOmerMonth; + break; + case 'BaOmerDay': + return $lagBaOmerDay; + break; + case 'BOmerDay': + return $this->caldean_date('JDay', $lagBaOmerMonth, $lagBaOmerDay, $year); + break; + case 'AscensionDay': + return $AscensionDay; + break; + case 'PentecostDay': + return $PentecostDay; + break; + case 'ShavuotDay': + return $ShavuotDay; + break; default: break; } } // Implements from NativeCalendar::getHolidays() function getMoadim($j_year, $j_month, $j_day, $mode = CAL_LANG_FOREIGN) *************** *** 2246,2250 **** if (!isset($cache[$j_year][$j_month])) { ! $cache[$j_year][$j_month] = $this->_buildMoadim($j_year, $j_month); } if (isset($cache[$j_year][$j_month][$j_day])) --- 2285,2289 ---- if (!isset($cache[$j_year][$j_month])) { ! $cache[$j_year][$j_month] = $this->_buildMoadim($j_year, $j_month, $j_day); } if (isset($cache[$j_year][$j_month][$j_day])) *************** *** 2321,2324 **** --- 2360,2410 ---- } } + //this->JewishToGreg('GDate', 4, 30, 5767) === "1/20/2007" + function JewishToGreg($mode, $month = 0, $day = 0, $year = 0) + { + $month = (intval($month) > 0) ? $month : $this->caldean_date('JMonth'); //gregorianMonth of Pasca or Omer + $day = (intval($day) > 0) ? $day : $this->caldean_date('JDay'); //regorianDay of Pasca or Omer + $year = (intval($year) > 0) ? $year : $this->caldean_date('JYear'); //gregorianYear of Pasca or Omer + /* + jdmonthname() + 0 Gregorian - abbreviated Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec + 1 Gregorian January, February, March, April, May, June, July, August, September, October, November, December + 2 Julian - abbreviated Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec + 3 Julian January, February, March, April, May, June, July, August, September, October, November, December + 4 Jewish Tishri, Heshvan, Kislev, Tevet, Shevat, AdarI, AdarII, Nisan, Iyyar, Sivan, Tammuz, Av, Elul + 5 French Republican Vendemiaire, Brumaire, Frimaire, Nivose, Pluviose, Ventose, Germinal, Floreal, Prairial, Messidor, Thermidor, Fructidor, Extra + */ + $JDate = JewishToJD($month, $day, $year); //decimal fraction of the Julian date with the php gregoriantojd() + list($JD_Month, $JD_Day, $JD_Year) = split('/', $JDate); + $GDate = jdtogregorian($JDate); + list($GD_Month, $GD_Day, $GD_Year) = split('/', $GDate); + switch ($mode) + { + case 'JMonth': + return $JD_Month; + break; + case 'JDay': + return $JD_Day; + break; + case 'JYear': + return $JD_Year; + case 'JDate': + return $JDate; + break; + case 'GMonth': + return $GD_Month; + break; + case 'GYear': + return $GD_Year; + break; + case 'GDay': + return $GD_Day; + break; + case 'GDate': + default: + return $GDate; + break; + } + } // From NativeCalendar::getMonthName() *************** *** 2455,2459 **** // _buildHolidays() is the 'brain' of this object. It builds a table of holidays // for either a complete year or a month. ! function _buildMoadim($j_year, $j_month = 0) { $list = array(); --- 2541,2545 ---- // _buildHolidays() is the 'brain' of this object. It builds a table of holidays // for either a complete year or a month. ! function _buildMoadim($j_year, $j_month = 0, $j_day = 0) { $list = array(); *************** *** 2465,2469 **** $isru = $this->settings['isru']; $eves = $this->settings['eves']; ! // // Holidays of Nisan --- 2551,2556 ---- $isru = $this->settings['isru']; $eves = $this->settings['eves']; ! // Greg Year: ! $g_year = $this->JewishToGreg('GYear', $j_month, $j_day, $j_year); // // Holidays of Nisan *************** *** 2509,2516 **** } } ! // Yom HaBikurei: ! $j = $this->passover_day('JOmerDay', false); ! $list[NISAN][$j][] = 'yomHaBikurei'; ! // Yom HaShoaa: $d->set($j_year, NISAN, 27); // Rule #1: fri,sat -> thu -> sun --- 2596,2603 ---- } } ! // Yom HaBikurei: ! $o = $this->passover_day('JOmerDay', $g_year, $j_year); ! $list[NISAN][$o][] = 'yomHaBikurei'; ! // Yom HaShoaa: $d->set($j_year, NISAN, 27); // Rule #1: fri,sat -> thu -> sun *************** *** 2535,2539 **** } // ! // Holidays of Iyar // if ($j_month == IYAR || !$j_month) --- 2622,2626 ---- } // ! // Holidays of Aiir // if ($j_month == IYAR || !$j_month) *************** *** 2563,2567 **** } $list[$d->month][$d->day][] = 'yomHaAzmaut'; ! $list[IYAR][18][] = 'lagBaOmer'; $list[IYAR][28][] = 'yomYerishalayim'; if ($sefirat_omer) --- 2650,2655 ---- } $list[$d->month][$d->day][] = 'yomHaAzmaut'; ! $b = $this->passover_day('BaOmerDay', $g_year, $j_year); //18 ! $list[IYAR][$b][] = 'lagBaOmer'; $list[IYAR][28][] = 'yomYerishalayim'; if ($sefirat_omer) *************** *** 2578,2592 **** --- 2666,2688 ---- if ($j_month == SIVAN || !$j_month) { + $s = $this->passover_day('ShavuotDay', $g_year, $j_year); //6 + $s0 = $s - 1; //5 + $s2 = $s + 1; //7 + $s3 = $s + 2; //8 if ($eves) { $list[SIVAN][5][] = 'shavuotErevKhag'; + $list[SIVAN][$s0][] = 'shavuotErevKhag'; } $list[SIVAN][6][] = 'shavuot'; + $list[SIVAN][$s][] = 'shavuot'; if ($diaspora) { $list[SIVAN][7][] = 'shavuot2'; + $list[SIVAN][$s2][] = 'shavuot2'; if ($isru) { $list[SIVAN][8][] = 'shavuotIsruKhag'; + $list[SIVAN][$s3][] = 'shavuotIsruKhag'; } } *************** *** 2596,2604 **** { $list[SIVAN][7][] = 'shavuotIsruKhag'; } } if ($sefirat_omer) { ! for ($i = 1; $i < 6; $i++) { $list[SIVAN][$i][] = 'omer'; --- 2692,2701 ---- { $list[SIVAN][7][] = 'shavuotIsruKhag'; + $list[SIVAN][$s2][] = 'shavuotIsruKhag'; } } if ($sefirat_omer) { ! for ($i = 1; $i < $s; $i++) { $list[SIVAN][$i][] = 'omer'; |