コード例 #1
0
function dateThisYear($ahebdate)
{
    $atodayhebrew = explode("/", strGregToHeb(date("M d, Y")));
    //Anyone born in addar should celebrate their birthday in in Adar II on a leap year.
    if ($ahebdate[0] == 6 && !isLeapYear($ahebdate[2]) && isLeapYear($atodayhebrew[2])) {
        $ahebdate[0] = 7;
    }
    $date = strtotime(jdtogregorian(jewishtojd($ahebdate[0], $ahebdate[1], $atodayhebrew[2])));
    $today = strtotime("today");
    if ($date < $today) {
        $datethisyear = date("M d, Y", strtotime(jdtogregorian(jewishtojd($ahebdate[0], $ahebdate[1], $atodayhebrew[2] + 1))));
    } else {
        $datethisyear = date("M d, Y", $date);
    }
    return $datethisyear;
}
コード例 #2
0
ファイル: datetime.class.php プロジェクト: laiello/pkgmanager
 public function set_hebrew_date_numeric($hd)
 {
     $is_leap = self::is_leap_year($hd[2]);
     if ($hd[0] == 6 || $hd[0] == 7 || $hd[0] == 14 || $hd[0] == 15) {
         if (!$is_leap) {
             $hd[0] = 6;
         } elseif ($hd[0] == 15) {
             $hd[0] = 7;
         } else {
             $hd[0] = 6;
         }
     }
     $jd = jewishtojd($hd[0], $hd[1], $hd[2]);
     if ($jd > 0) {
         $this->jd = $jd;
     }
 }
コード例 #3
0
 public function loadHolidays()
 {
     $jdDate = cal_to_jd(CAL_GREGORIAN, date('m'), date('d'), date('Y'));
     $hebrewDate = jdtojewish($jdDate);
     list($hebrewMonth, $hebrewDay, $hebrewYear) = explode('/', $hebrewDate);
     $holidays = array();
     $currYear = $hebrewYear - 1;
     // subtract a year for some reason
     $nextYear = $currYear + 1;
     foreach ($this->holidays as $key => $val) {
         $julianDate = jewishtojd($val[0], $val[1], $currYear);
         if (jdtounix($julianDate) < time()) {
             $julianDate = jewishtojd($val[0], $val[1], $nextYear);
             if (jdtounix($julianDate) < time()) {
                 $julianDate = jewishtojd($val[0], $val[1], $nextYear + 1);
             }
         }
         $unixTime = jdtounix($julianDate);
         $unixTime += 86400;
         // add 1 day for some reason
         $holidays[$key] = '@' . $unixTime;
     }
     return $holidays;
 }
コード例 #4
0
ファイル: JewishDate.php プロジェクト: kfirba/hebdate
 /**
  * Get the julian date representation for the current date.
  *
  * @return int
  */
 protected function toJulianDate()
 {
     $numericDate = $this->getParser()->parse();
     list($day, $month, $year) = $numericDate;
     return jewishtojd($month, $day, $year);
 }
コード例 #5
0
 public function toDateTime()
 {
     return new DateTime(jdtogregorian(jewishtojd($this->month, $this->day, $this->year)));
 }
コード例 #6
0
ファイル: index.php プロジェクト: catalandres/dotcom
function format_greg_date_for_erev($hmonth, $hday, $hyear)
{
    $jd = jewishtojd($hmonth, $hday, $hyear);
    $greg_cal = cal_from_jd($jd, CAL_GREGORIAN);
    return sprintf("%s, %s %s %s", $greg_cal["abbrevdayname"], $greg_cal["day"], $greg_cal["monthname"], $greg_cal["year"]);
}
コード例 #7
0
ファイル: HebrewCal.php プロジェクト: ngchie/system
 /**
  * Method to get the holidays off all year
  * 
  * @param int $unixtime the date to check.
  * @param type $walledCity
  * @param type $isAbroad used to calculate Hag Sheni. Not implemented yet
  * 
  * @return string
  */
 public static function getHolidaysForYear($unixtime, $walledCity = false, $isAbroad = false)
 {
     $retArr = self::$STANDARD_YEAR_HEBCAL_HOLIDAYS;
     list($month, $day, $year) = self::getHebrewDate($unixtime, true);
     $isLeapYear = self::isLeapYear($unixtime);
     if ($isLeapYear) {
         //TODO add leap year data
         // handle purim month
         $retArr['07/13'] = $retArr['06/13'];
         //Purim evening
         $retArr['07/14'] = $retArr['06/14'];
         //Purim is in AdarII
         unset($retArr['06/13']);
         unset($retArr['06/14']);
     }
     //handled short Kislev
     if (cal_days_in_month(CAL_JEWISH, 3, (int) $year) == 29) {
         $retArr['04/03'] = $retArr['04/02'];
         //Hanukka
     }
     //Purim when you have a wall around you
     if ($walledCity) {
         $retArr['06/15'] = $retArr['06/14'];
         $retArr['06/14'] = $retArr['06/13'];
         unset($retArr['06/13']);
     }
     if (cal_from_jd(jewishtojd(8, 27, $year), CAL_JEWISH)['dow'] == 5) {
         // prepone Yom HaShoah
         $retArr['08/25'] = $retArr['08/26'];
         $retArr['08/26'] = $retArr['08/27'];
         unset($retArr['08/27']);
     } else {
         if (cal_from_jd(jewishtojd(8, 27, $year), CAL_JEWISH)['dow'] == 0) {
             // postpone
             $retArr['08/28'] = $retArr['08/27'];
             $retArr['08/27'] = $retArr['08/26'];
             unset($retArr['08/26']);
         }
     }
     if (cal_from_jd(jewishtojd(9, 5, $year), CAL_JEWISH)['dow'] == 1) {
         // postpone Yom Hazikaron & Atzma'ut from Monday
         $retArr['09/06'] = $retArr['09/05'];
         $retArr['09/05'] = $retArr['09/04'];
         $retArr['09/04'] = $retArr['09/03'];
         unset($retArr['09/03']);
     } else {
         if (cal_from_jd(jewishtojd(9, 5, $year), CAL_JEWISH)['dow'] == 6) {
             // prepone from Saturday
             $retArr['09/01'] = $retArr['09/03'];
             $retArr['09/02'] = $retArr['09/04'];
             $retArr['09/03'] = $retArr['09/05'];
             unset($retArr['09/04']);
             unset($retArr['09/05']);
         } else {
             if (cal_from_jd(jewishtojd(9, 5, $year), CAL_JEWISH)['dow'] == 5) {
                 // prepone from Friday
                 $retArr['09/02'] = $retArr['09/03'];
                 $retArr['09/03'] = $retArr['09/04'];
                 $retArr['09/04'] = $retArr['09/05'];
                 unset($retArr['09/05']);
             }
         }
     }
     if (cal_from_jd(jewishtojd(9, 28, $year), CAL_JEWISH)['dow'] == 5) {
         // prepone Jerusalem day
         $retArr['08/27'] = $retArr['08/28'];
         unset($retArr['08/28']);
     }
     return $retArr;
 }
コード例 #8
0
ファイル: index.php プロジェクト: ardis196658/dotcom
    $hebdate = jdtojewish($jd);
    $debug = $hebdate;
    list($hmnum, $hd, $hy) = explode("/", $hebdate, 3);
    $hm = $hnum_to_str[$hmnum];
    //    $hmstr = jdmonthname($jd,4);
} else {
    $hmnum = $hmstr_to_num[$hm];
    if ($hmnum == 6 && !is_leap_year($hy)) {
        $hmnum = 7;
        $hm = "Adar";
    }
    $max_hd = cal_days_in_month(CAL_JEWISH, $hmnum, $hy);
    if ($hd > $max_hd) {
        form(true, "Hebrew day {$hd} out of valid range 1-{$max_hd} for {$hm} in year {$hy}", "");
    }
    $jd = jewishtojd($hmnum, $hd, $hy);
    $greg = jdtogregorian($jd);
    $debug = $greg;
    list($gm, $gd, $gy) = explode("/", $greg, 3);
}
// remove leading zeros, if any
if ($gm[0] == "0") {
    $gm = $gm[1];
}
if ($gd[0] == "0") {
    $gd = $gd[1];
}
$dow = jddayofweek($jd, 2);
if (strncmp("Adar", $hm, 4) == 0 && !is_leap_year($hy)) {
    $hm = "Adar";
} elseif ($hm == "Adar" && is_leap_year($hy)) {
$allUsers = true;
$activeDate = isset($_REQUEST['date']) ? strtotime($_REQUEST['date']) : strtotime("now");
$title = "Its your friend's Jewish Birthday";
$message = "Today (%1\$s) is %2\$s's Jewish Birthday. \n" . "You can buy %3\$s a Jewish Gift at http://www.judaism.com/index.asp?aref=mplotkin \n" . "or send %3\$s a message on Facebook at http://apps.facebook.com/jewishdates/birthdayInfo.php?id=%4\$s\n\n" . 'If you do not wish to receive these messages. Please set your preferences at http://apps.facebook.com/jewishdates/messageSettings.php.';
$messageHTML = 'Today (%1$s) is <a href="http://apps.facebook.com/jewishdates/birthdayInfo.php?id=%4$s">%2$s</a>\'s Jewish Birthday. ' . '<br />You can buy %3$s a <a href="http://www.judaism.com/index.asp?aref=mplotkin">Jewish Gift</a> ' . ' or send %3$s <a href="http://apps.facebook.com/jewishdates/birthdayInfo.php?id=%4$s">a message on Facebook</a>.<br /><br />' . '	<hr />  ' . 'Support Chabad Of New Paltz & the Jewish Facebook applications and win 10 Thousand $$$.<br>' . '<a href=http://www.JewPaltz.com/raffle>Buy a raffle ticket or ten NOW</a>.';
$one_line_story = array('{*actor*} has {*ammount*} friends whose <a href="http://apps.facebook.com/jewishdates/">Jewish Birthdays</a> are today({*today*}).', '{*actor*} has friends whose <a href="http://apps.facebook.com/jewishdates/">Jewish Birthdays</a> are today({*today*}).');
$short_story = array(array('template_title' => '{*actor*} has {*ammount*} friends whose <a href="http://apps.facebook.com/jewishdates/">Jewish Birthdays</a> are today({*today*}).', 'template_body' => 'You can add your <a href="http://apps.facebook.com/jewishdates/">Jewish Birthday</a>, the current Hebrew Date and other <a href="http://apps.facebook.com/jewishdates/">Jewish Dates</a> to your profile and get notified about your friends\' Jewish Bithdays with the <a href="http://apps.facebook.com/jewishdates/">Jewish Date Application</a>.'), array('template_title' => '{*actor*} has friends whose Jewish Birthdays are today({*today*}).', 'template_body' => 'You can add your <a href="http://apps.facebook.com/jewishdates/">Jewish Birthday</a>, the current Hebrew Date and other <a href="http://apps.facebook.com/jewishdates/">Jewish Dates</a> to your profile and get notified about your friends\' Jewish Bithdays with the <a href="http://apps.facebook.com/jewishdates/">Jewish Date Application</a>.'));
$full_story = $short_story;
$templateBundleId = $facebook->api_client->feed_registerTemplateBundle($one_line_story, $short_story, $full_story);
$picture = 'http://www2.newpaltz.edu/~plotkinm/php/facebook/jewishdates/Icon75x75.gif';
$pLink = 'http://apps.facebook.com/jewishdates/supportChabadOfNewPaltz.php';
//generate coresponding dates
$cDates = array();
$aTodayHebrew = explode("/", strGregToHeb(date("M d, Y", $activeDate)));
for ($i = 10; $i < 70; $i++) {
    $cdate = date("F d, Y", strtotime(jdtogregorian(jewishtojd($aTodayHebrew[0], $aTodayHebrew[1], $aTodayHebrew[2] - $i))));
    $cDates[$i] = $cdate;
}
$cDatesStr = join("','", $cDates);
$activeDateStr = date("l M d, Y", $activeDate);
$iLimit = isset($_REQUEST['limit']) ? $_REQUEST['limit'] : 0;
$iStopLimit = isset($_REQUEST['toLimit']) ? $_REQUEST['toLimit'] : 300;
$sql = "SELECT * FROM fbUsers WHERE sessionId is not null AND `current`=1 AND appId='{$appapikey}' " . ($allUsers ? "" : "AND id='{$user}'") . " Limit {$iLimit}, {$iStopLimit}";
trace($sql . '<br />Time Started: ');
$conn = dbConnect();
$results = mysql_query($sql, $conn);
$i = 0;
$actualPosts = 0;
?>
<h1><a href="?limit=<?php 
echo $iLimit + $iStopLimit;
コード例 #10
0
 /**
  * @desc Calculate the Jewish year "signature" code in the Hebrew calendar. This code is used to calculate
  * the Parashat HaShavua e.t.c.
  * The code format is as follows:
  *     char 0: 'p'=a simple year or 'm'=a leap year
  *     char 1: number 1-7 a weekday of Rosh Hashanah (1 is sunday, 7 is Shabbath)
  *     char 2: number 1-3: 1 - type of the year 'chasera','kesidrah','shlemah'
  *     char 3: number 1-7 a weekday of Rosh Chodesh Nisan (1 is sunday, 7 is Shabbath)
  *     If $this->location is in "Chul", 'c' is appended in appropriate situations
  * @param int $y the Jewish year number (like 5770)
  */
 public function get_year_sign($y = null)
 {
     if (empty($y)) {
         $y = $this->heb_date[2];
     }
     $is_leap = hcal_datetime::is_leap_year($y);
     $code = $is_leap ? 'm' : 'p';
     // get the JD of the Rosh HaShanah
     $rh_jd = jewishtojd(1, 1, $y);
     $code .= ($rh_jd + 1) % 7 + 1;
     // get the JD of Rosh Chodesh Nisan
     $n_jd = jewishtojd(8, 1, $y);
     $code .= $n_jd - $rh_jd - ($is_leap ? 205 : 175);
     $code .= ($n_jd + 1) % 7 + 1;
     if (!empty($this->location->data['chul']) && ($code[3] == '5' || $code[3] == '7')) {
         $code .= 'c';
     }
     return $code;
 }
コード例 #11
0
ファイル: jewishtojd.php プロジェクト: badlamer/hhvm
<?php

echo jewishtojd(-1, -1, -1) . "\n";
echo jewishtojd(0, 0, 0) . "\n";
echo jewishtojd(1, 1, 1) . "\n";
echo jewishtojd(2, 22, 5763) . "\n";
コード例 #12
0
ファイル: _class.php プロジェクト: gitter-badger/dateplus
function hanukkahStart($year = null)
{
    $reference = ($year == '2021' || $year == '2032' ? '11/1/' : '12/1/') . ($year !== null ? $year : date('Y'));
    list($month, $day, $year) = explode("/", jdtojewish(unixtojd(strtotime($reference))));
    return jdtounix(jewishtojd(3, 25, $year));
}