Source for file Christian.php
Documentation is available at Christian.php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
* Driver for Christian holidays
* Copyright (c) 1997-2008 The PHP Group
* This source file is subject to version 3.0 of the PHP license,
* that is bundled with this package in the file LICENSE, and is
* available at through the world-wide-web at
* http://www.php.net/license/3_01.txt.
* If you did not receive a copy of the PHP license and are unable to
* obtain it through the world-wide-web, please send a note to
* license@php.net so we can mail you a copy immediately.
* @author Carsten Lucke <luckec@tool-garage.de>
* @license http://www.php.net/license/3_01.txt PHP License 3.0.1
* @version CVS: $Id: Christian.php,v 1.15 2008/03/18 20:35:24 kguest Exp $
* @link http://pear.php.net/package/Date_Holidays
* class that calculates Christian holidays
* @author Carsten Lucke <luckec@tool-garage.de>
* @license http://www.php.net/license/3_01.txt PHP License 3.0.1
* @version CVS: $Id: Christian.php,v 1.15 2008/03/18 20:35:24 kguest Exp $
* @link http://pear.php.net/package/Date_Holidays
* Use the Date_Holidays::factory() method to construct an object of a
* Build the internal arrays that contain data about the calculated holidays
* @return boolean true on success, otherwise a PEAR_ErrorStack object
* @throws object PEAR_ErrorStack
'Circumcision of Jesus');
$this->_addHoliday('easter', $easterDate, 'Easter Sunday');
$palmSundayDate = new Date ($easterDate);
$palmSundayDate->subtractSpan (new Date_Span ('7, 0, 0, 0'));
$this->_addHoliday('palmSunday', $palmSundayDate, 'Palm Sunday');
$passionSundayDate = new Date ($palmSundayDate);
$passionSundayDate->subtractSpan (new Date_Span ('7, 0, 0, 0'));
$this->_addHoliday('passionSunday', $passionSundayDate, 'Passion Sunday');
$painfulFridayDate = new Date ($palmSundayDate);
$painfulFridayDate->subtractSpan (new Date_Span ('2, 0, 0, 0'));
$this->_addHoliday('painfulFriday', $painfulFridayDate, 'Painful Friday');
$whiteSundayDate = new Date ($easterDate);
$whiteSundayDate->addSpan (new Date_Span ('7, 0, 0, 0'));
$this->_addHoliday('whiteSunday', $whiteSundayDate, 'White Sunday');
$ashWednesdayDate = new Date ($easterDate);
$ashWednesdayDate->subtractSpan (new Date_Span ('46, 0, 0, 0'));
$this->_addHoliday('ashWednesday', $ashWednesdayDate, 'Ash Wednesday');
* Good Friday / Black Friday
$goodFridayDate = new Date ($easterDate);
$goodFridayDate->subtractSpan (new Date_Span ('2, 0, 0, 0'));
$this->_addHoliday('goodFriday', $goodFridayDate, 'Good Friday');
$goodFridayDate->getPrevDay (),
$easterDate->getNextDay (),
* Whitsun (determines Whit Monday, Ascension Day and
* Feast of Corpus Christi)
$whitsunDate = new Date ($easterDate);
$whitsunDate->addSpan (new Date_Span ('49, 0, 0, 0'));
$this->_addHoliday('whitsun', $whitsunDate, 'Whitsun');
$requestSunday = new Date ($whitsunDate);
$requestSunday->subtractSpan (new Date_Span ('14, 0, 0, 0'));
$this->_addHoliday('requestSunday', $requestSunday, 'Request Sunday');
$ascensionDayDate = new Date ($whitsunDate);
$ascensionDayDate->subtractSpan (new Date_Span ('10, 0, 0, 0'));
$this->_addHoliday('ascensionDay', $ascensionDayDate, 'Ascension Day');
$this->_addHoliday('whitMonday', $whitsunDate->getNextDay (), 'Whit Monday');
$trinitatisDate = new Date ($whitsunDate);
$trinitatisDate->addSpan (new Date_Span ('7, 0, 0, 0'));
* Feast of Corpus Christi
$corpusChristiDate = new Date ($whitsunDate);
$corpusChristiDate->addSpan (new Date_Span ('11, 0, 0, 0'));
'Feast of Corpus Christi');
* Friday of the 3rd week past Whitsun
$heartJesusDate = new Date ($whitsunDate);
$heartJesusDate->addSpan (new Date_Span ('19, 0, 0, 0'));
'Heart of Jesus celebration');
* Celebration of raising the Cross
'Celebration of raising the Cross');
* Sunday past Michaelis (29. September)
$michaelisDate = new Date ($this->_year . '-09-29');
$dayOfWeek = $michaelisDate->getDayOfWeek ();
$michaelisDate->addSpan (new Date_Span (sprintf('%d, 0, 0, 0',
$thanksGivingDate = $michaelisDate;
$this->_addHoliday('thanksGiving', $thanksGivingDate, 'Thanks Giving');
$kermisDate = new Date ($this->_year . '-10-01');
$dayOfWeek = $kermisDate->getDayOfWeek ();
$kermisDate->addSpan (new Date_Span (sprintf('%d, 0, 0, 0',
$kermisDate->addSpan (new Date_Span ('14, 0, 0, 0'));
$Advent4Date = new Date ($this->_year . '-12-25');
$dayOfWeek = $Advent4Date->getDayOfWeek ();
$Advent4Date->subtractSpan (new Date_Span (sprintf('%d, 0, 0, 0',
$this->_addHoliday('advent4', $Advent4Date, '4th Advent');
$Advent1Date = new Date ($Advent4Date);
$Advent1Date->subtractSpan (new Date_Span ('21, 0, 0, 0'));
$this->_addHoliday('advent1', $Advent1Date, '1st Advent');
$Advent2Date = new Date ($Advent4Date);
$Advent2Date->subtractSpan (new Date_Span ('14, 0, 0, 0'));
$this->_addHoliday('advent2', $Advent2Date, '2nd Advent');
$Advent3Date = new Date ($Advent4Date);
$Advent3Date->subtractSpan (new Date_Span ('7, 0, 0, 0'));
$this->_addHoliday('advent3', $Advent3Date, '3rd Advent');
$deathSundayDate = new Date ($Advent1Date);
$deathSundayDate->subtractSpan (new Date_Span ('7, 0, 0, 0'));
$this->_addHoliday('deathSunday', $deathSundayDate, 'Death\' Sunday');
$dayOfRepentance = new Date ($deathSundayDate);
$dayOfRepentance->subtractSpan (new Date_Span ('4, 0, 0, 0'));
$this->_addHoliday('dayOfRepentance', $dayOfRepentance, 'Day of Repentance');
* Calculates date for Easter using the Gaussian algorithm.
// number of days from 21 March to the Paschal Full Moon
// weekday of the Full Moon (0=Sunday,...)
$century = floor($year / 100 );
$l = floor($century / 4 );
$epact = ($century - $l - floor((8 * $century + 13 ) / 25 )
+ 19 * $golden + 15 ) % 30;
$i = $epact - floor($epact / 28 ) * (1 - floor($epact / 28 ) *
floor(29 / ($epact + 1 )) * floor((21 - $golden) / 11 ));
$j = ($year + floor($year / 4 ) + $i + 2 - $century + $l);
$i = (19 * $golden + 15 ) % 30;
$j = ($year + floor($year / 4 ) + $i) % 7;
$month = 3 + floor(($l + 40 ) / 44 );
$day = $l + 28 - 31 * floor($month / 4 );
$date = new Date (sprintf('%04d-%02d-%02d', $year, $month, $day));
Documentation generated on Thu, 10 Apr 2008 20:00:10 -0400 by phpDocumentor 1.4.0. PEAR Logo Copyright © PHP Group 2004.
|