Source for file Christian.php
Documentation is available at Christian.php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2002 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.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/2_02.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. |
// +----------------------------------------------------------------------+
// | Authors: Carsten Lucke <luckec@tool-garage.de> |
// +----------------------------------------------------------------------+
// $Id: Christian.php,v 1.6 2006/10/22 22:14:10 quipo Exp $
* class that calculates Christian holidays
* @version $Id: Christian.php,v 1.6 2006/10/22 22:14:10 quipo Exp $
* @author Carsten Lucke <luckec@tool-garage.de>
* Use the Date_Holidays::factory() method to construct an object of a certain driver
* 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
$this->_addHoliday('jesusCircumcision', $this->_year . '-01-01', 'Circumcision of Jesus');
$this->_addHoliday('mariaCleaning', $this->_year . '-02-02', 'Cleaning of Maria');
$this->_addHoliday('mariaAnnouncement', $this->_year . '-03-25', 'Maria Announcement');
$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');
$this->_addHoliday('greenThursday', $goodFridayDate->getPrevDay (), 'Green Thursday');
$this->_addHoliday('easterMonday', $easterDate->getNextDay (), 'Easter Monday');
* 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');
$this->_addHoliday('mariaHaunting', $this->_year . '-05-31', 'Haunting of Maria');
$trinitatisDate = new Date ($whitsunDate);
$trinitatisDate->addSpan (new Date_Span ('7, 0, 0, 0'));
$this->_addHoliday('trinitatis', $trinitatisDate, 'Trinitatis');
* Feast of Corpus Christi
$corpusChristiDate = new Date ($whitsunDate);
$corpusChristiDate->addSpan (new Date_Span ('11, 0, 0, 0'));
$this->_addHoliday('corpusChristi', $corpusChristiDate, 'Feast of Corpus Christi');
* Friday of the 3rd week past Whitsun
$heartJesusDate = new Date ($whitsunDate);
$heartJesusDate->addSpan (new Date_Span ('19, 0, 0, 0'));
$this->_addHoliday('heartJesus', $heartJesusDate, 'Heart of Jesus celebration');
$this->_addHoliday('johannisCelebration', $this->_year . '-06-24', 'Johannis celebration');
$this->_addHoliday('petrusAndPaulus', $this->_year . '-06-29', 'Petrus and Paulus');
$this->_addHoliday('mariaAscension', $this->_year . '-08-15', 'Ascension of Maria');
* Celebration of raising the Cross
$this->_addHoliday('crossRaising', $this->_year . '-09-14', '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', 7 - $dayOfWeek)));
$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', 7 - $dayOfWeek)));
$kermisDate->addSpan (new Date_Span ('14, 0, 0, 0'));
$this->_addHoliday('reformationDay', $this->_year . '-10-31', 'Reformation Day');
$this->_addHoliday('allSaintsDay', $this->_year . '-11-01', 'All Saints\' Day');
$Advent4Date = new Date ($this->_year . '-12-25');
$dayOfWeek = $Advent4Date->getDayOfWeek ();
$Advent4Date->subtractSpan (new Date_Span (sprintf('%d, 0, 0, 0', $dayOfWeek)));
$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');
$this->_addHoliday('stNicholasDay', $this->_year . '-12-06', 'St. Nicholas\' Day');
$this->_addHoliday('mariaConception', $this->_year . '-12-08', 'Conception of Maria');
* 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 );
$epact = ($century - floor($century / 4 ) - 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 + floor($century / 4 ));
$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 Mon, 11 Mar 2019 15:03:06 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|