[prev in list] [next in list] [prev in thread] [next in thread]
List: pear-cvs
Subject: [PEAR-CVS] =?utf-8?q?svn:_/pear/packages/Date=5FHolidays/tags/_Date=5FHolidays=5FAustralia-0.2.0/Dat
From: Ken_Guest <kguest () php ! net>
Date: 2011-09-27 16:14:58
Message-ID: svn-kguest-1317140098-317401-2086680566 () svn ! php ! net
[Download RAW message or body]
kguest Tue, 27 Sep 2011 16:14:58 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=317401
Log:
Tagging the 0.2.0 release
Changed paths:
A pear/packages/Date_Holidays/tags/Date_Holidays_Australia-0.2.0/
A pear/packages/Date_Holidays/tags/Date_Holidays_Australia-0.2.0/Date/
A pear/packages/Date_Holidays/tags/Date_Holidays_Australia-0.2.0/Date/Holidays/
A pear/packages/Date_Holidays/tags/Date_Holidays_Australia-0.2.0/Date/Holidays/Driver/
A + pear/packages/Date_Holidays/tags/Date_Holidays_Australia-0.2.0/Date/Holidays/Driver/Australia.php
(from pear/packages/Date_Holidays/trunk/Date/Holidays/Driver/Australia.php:r314863)
A + pear/packages/Date_Holidays/tags/Date_Holidays_Australia-0.2.0/Date/Holidays/Driver/AustraliaNSW.php
(from pear/packages/Date_Holidays/trunk/Date/Holidays/Driver/AustraliaNSW.php:r314863)
A + pear/packages/Date_Holidays/tags/Date_Holidays_Australia-0.2.0/Date/Holidays/Driver/AustraliaSA.php
(from pear/packages/Date_Holidays/trunk/Date/Holidays/Driver/AustraliaSA.php:r314863)
A + pear/packages/Date_Holidays/tags/Date_Holidays_Australia-0.2.0/Date/Holidays/Driver/AustraliaWA.php
(from pear/packages/Date_Holidays/trunk/Date/Holidays/Driver/AustraliaWA.php:r314863)
A + pear/packages/Date_Holidays/tags/Date_Holidays_Australia-0.2.0/package_australia.xml
(from pear/packages/Date_Holidays/trunk/package_australia.xml:r317400)
["svn-diffs-317401.txt" (text/x-diff)]
Copied: pear/packages/Date_Holidays/tags/Date_Holidays_Australia-0.2.0/Date/Holidays/Driver/Australia.php \
(from rev 314863, pear/packages/Date_Holidays/trunk/Date/Holidays/Driver/Australia.php)
===================================================================
--- pear/packages/Date_Holidays/tags/Date_Holidays_Australia-0.2.0/Date/Holidays/Driver/Australia.php \
(rev 0)
+++ pear/packages/Date_Holidays/tags/Date_Holidays_Australia-0.2.0/Date/Holidays/Driver/Australia.php 2011-09-27 \
16:14:58 UTC (rev 317401) @@ -0,0 +1,161 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+/**
+ * This file contains only the Driver class for determining holidays in Australia.
+ *
+ * PHP Version 4
+ *
+ * @category Date
+ * @package Date_Holidays
+ * @author Sam Wilson <sam@archives.org.au>
+ * @license BSD http://www.opensource.org/licenses/bsd-license.php
+ * @link http://pear.php.net/package/Date_Holidays
+ */
+
+require_once 'Date/Calc.php';
+require_once 'Date/Holidays/Driver/Christian.php';
+
+/**
+ * This is a Driver class that calculates holidays in Australia. Individual states
+ * generally have other holidays as well (ones that sometimes override those defined
+ * herein) and so if one is available you should combine it with this one.
+ *
+ * @category Date
+ * @package Date_Holidays
+ * @subpackage Driver
+ * @author Sam Wilson <sam@archives.org.au>
+ * @license BSD http://www.opensource.org/licenses/bsd-license.php
+ * @link http://pear.php.net/package/Date_Holidays
+ */
+class Date_Holidays_Driver_Australia extends Date_Holidays_Driver
+{
+ /**
+ * this driver's name
+ *
+ * @access protected
+ * @var string
+ */
+ var $_driverName = 'Australia';
+
+ /**
+ * Constructor
+ *
+ * Use the Date_Holidays::factory() method to construct an object of a
+ * certain driver
+ *
+ * @access protected
+ */
+ function Date_Holidays_Driver_Australia()
+ {
+ }
+
+ /**
+ * Build the internal arrays that contain data about holidays.
+ *
+ * @access protected
+ * @return boolean true on success, otherwise a PEAR_ErrorStack object
+ * @throws object PEAR_ErrorStack
+ */
+ function _buildHolidays()
+ {
+ parent::_buildHolidays();
+
+ /*
+ * New Year's Day
+ */
+ $newYearsDay = new Date($this->_year . '-01-01');
+ if ($newYearsDay->getDayOfWeek() == 0) { // 0 = Sunday
+ $newYearsDay = $this->_year . '-01-02';
+ } elseif ($newYearsDay->getDayOfWeek() == 6) { // 6 = Saturday
+ $newYearsDay = $this->_year . '-01-03';
+ }
+ $this->_addHoliday('newYearsDay', $newYearsDay, 'New Year\'s Day');
+
+ /*
+ * Australia Day
+ */
+ $australiaDay = new Date($this->_year . '-01-26');
+ if ($australiaDay->getDayOfWeek() == 0) { // 0 = Sunday
+ $australiaDay = $this->_year . '-01-27';
+ } elseif ($australiaDay->getDayOfWeek() == 6) { // 6 = Saturday
+ $australiaDay = $this->_year . '-01-28';
+ }
+ $this->_addHoliday('australiaDay', $australiaDay, 'Australia Day');
+
+ /*
+ * Easter
+ */
+ $easter = Date_Holidays_Driver_Christian::calcEaster($this->_year);
+ $goodFridayDate = new Date($easter);
+ $goodFridayDate = $this->_addDays($easter, -2);
+ $this->_addHoliday('goodFriday', $goodFridayDate, 'Good Friday');
+ $this->_addHoliday('easterMonday', $easter->getNextDay(), 'Easter Monday');
+
+ /*
+ * Anzac Day
+ */
+ $anzacDay = new Date($this->_year . '-04-25');
+ $this->_addHoliday('anzacDay', $anzacDay, 'Anzac Day');
+ if ($anzacDay->getDayOfWeek() == 0) { // 0 = Sunday
+ $anzacDayHol = $this->_year . '-04-26';
+ $this->_addHoliday('anzacDayHoliday', $anzacDayHol, 'Anzac Day \
Holiday'); + } elseif ($anzacDay->getDayOfWeek() == 6) { // 6 = Saturday
+ $anzacDayHol = $this->_year . '-04-27';
+ $this->_addHoliday('anzacDayHoliday', $anzacDayHol, 'Anzac Day \
Holiday'); + }
+
+ /*
+ * The Queen's Birthday.
+ * See http://en.wikipedia.org/wiki/Queen%27s_Official_Birthday#Australia
+ */
+ $queensBirthday = Date_Calc::nWeekdayOfMonth(1, 1, 6, $this->_year);
+ $this->_addHoliday('queensBirthday', $queensBirthday, "Queen's Birthday");
+
+ /*
+ * Christmas and Boxing days
+ */
+ $christmasDay = new Date($this->_year.'-12-25');
+ $boxingDay = new Date($this->_year.'-12-26');
+ $this->_addHoliday('christmasDay', $christmasDay, 'Christmas Day');
+ $this->_addHoliday('boxingDay', $boxingDay, 'Boxing Day');
+ if ($christmasDay->getDayName() == 'Sunday') {
+ $this->_addHoliday(
+ 'boxingDayHoliday', $this->_year.'-12-27', 'Boxing Day Holiday'
+ );
+ } elseif ($christmasDay->getDayName() == 'Friday') {
+ $this->_addHoliday(
+ 'boxingDayHoliday', $this->_year.'-12-28', 'Boxing Day Holiday'
+ );
+ } elseif ($christmasDay->getDayName() == 'Saturday') {
+ $this->_addHoliday(
+ 'christmasDayHoliday', $this->_year.'-12-27', 'Christmas Day \
Holiday' + );
+ $this->_addHoliday(
+ 'boxingDayHoliday', $this->_year.'-12-28', 'Boxing Day Holiday'
+ );
+ }
+
+ /*
+ * Check for errors, and return.
+ */
+ if (Date_Holidays::errorsOccurred()) {
+ return Date_Holidays::getErrorStack();
+ }
+ return true;
+
+ }
+
+ /**
+ * Method that returns an array containing the ISO3166 codes ('au' and 'aus')
+ * that identify this driver.
+ *
+ * @static
+ * @access public
+ * @return array possible ISO3166 codes
+ */
+ function getISO3166Codes()
+ {
+ return array('au', 'aus');
+ }
+
+}
Copied: pear/packages/Date_Holidays/tags/Date_Holidays_Australia-0.2.0/Date/Holidays/Driver/AustraliaNSW.php \
(from rev 314863, pear/packages/Date_Holidays/trunk/Date/Holidays/Driver/AustraliaNSW.php)
===================================================================
--- pear/packages/Date_Holidays/tags/Date_Holidays_Australia-0.2.0/Date/Holidays/Driver/AustraliaNSW.php \
(rev 0)
+++ pear/packages/Date_Holidays/tags/Date_Holidays_Australia-0.2.0/Date/Holidays/Driver/AustraliaNSW.php 2011-09-27 \
16:14:58 UTC (rev 317401) @@ -0,0 +1,72 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+/**
+ * This file contains only the Driver class for determining holidays in New South \
Wales + *
+ * PHP Version 4
+ *
+ * @category Date
+ * @package Date_Holidays
+ * @author Daniel O'Connor <daniel.oconnor@gmail.com>
+ * @license BSD http://www.opensource.org/licenses/bsd-license.php
+ * @link http://pear.php.net/package/Date_Holidays
+ */
+
+require_once 'Date/Calc.php';
+
+/**
+ * This Driver class calculates holidays in Western Australia. It should be used in
+ * conjunction with the Australia driver.
+ *
+ * @category Date
+ * @package Date_Holidays
+ * @subpackage Driver
+ * @author Daniel O'Connor <daniel.oconnor@gmail.com>
+ * @license BSD http://www.opensource.org/licenses/bsd-license.php
+ * @link http://pear.php.net/package/Date_Holidays
+ */
+class Date_Holidays_Driver_AustraliaNSW extends Date_Holidays_Driver
+{
+ /**
+ * this driver's name
+ *
+ * @access protected
+ * @var string
+ */
+ var $_driverName = 'AustraliaNSW';
+
+ /**
+ * Constructor
+ *
+ * @access protected
+ */
+ function Date_Holidays_Driver_AustraliaNSW()
+ {
+ }
+
+ /**
+ * Build the internal arrays that contain data about holidays.
+ *
+ * @access protected
+ * @return boolean true on success, otherwise a PEAR_ErrorStack object
+ * @throws object PEAR_ErrorStack
+ */
+ function _buildHolidays()
+ {
+ parent::_buildHolidays();
+
+ /*
+ * Labour Day - 1st Monday of October
+ */
+ $labourDay = Date_Calc::nWeekdayOfMonth(1, 1, 10, $this->_year);
+ $this->_addHoliday('labourDay', $labourDay, "Labour Day");
+
+ /*
+ * See http://en.wikipedia.org/wiki/Queen%27s_Official_Birthday#Australia
+ */
+ $foundationDay = Date_Calc::nWeekdayOfMonth(2, 1, 6, $this->_year);
+ $this->_addHoliday('queensBirthday', $foundationDay, "Queen's Birthday");
+
+ } // _buildHolidays()
+
+} // Date_Holidays_Driver_AustraliaNSW
Copied: pear/packages/Date_Holidays/tags/Date_Holidays_Australia-0.2.0/Date/Holidays/Driver/AustraliaSA.php \
(from rev 314863, pear/packages/Date_Holidays/trunk/Date/Holidays/Driver/AustraliaSA.php)
===================================================================
--- pear/packages/Date_Holidays/tags/Date_Holidays_Australia-0.2.0/Date/Holidays/Driver/AustraliaSA.php \
(rev 0)
+++ pear/packages/Date_Holidays/tags/Date_Holidays_Australia-0.2.0/Date/Holidays/Driver/AustraliaSA.php 2011-09-27 \
16:14:58 UTC (rev 317401) @@ -0,0 +1,75 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+/**
+ * This file contains only the Driver class for determining holidays in South
+ * Australia.
+ *
+ * PHP Version 4
+ *
+ * Copyright (c) 1997-2008 The PHP Group
+ *
+ * @category Date
+ * @package Date_Holidays
+ * @author Daniel O'Connor <daniel.oconnor@gmail.com>
+ * @license BSD http://www.opensource.org/licenses/bsd-license.php
+ * @link http://pear.php.net/package/Date_Holidays
+ */
+
+require_once 'Date/Calc.php';
+
+/**
+ * This Driver class calculates holidays in South Australia. It should be used in
+ * conjunction with the Australia driver.
+ *
+ * @category Date
+ * @package Date_Holidays
+ * @subpackage Driver
+ * @author Daniel O'Connor <daniel.oconnor@gmail.com>
+ * @license BSD http://www.opensource.org/licenses/bsd-license.php
+ * @link http://pear.php.net/package/Date_Holidays
+ */
+class Date_Holidays_Driver_AustraliaSA extends Date_Holidays_Driver
+{
+ /**
+ * this driver's name
+ *
+ * @access protected
+ * @var string
+ */
+ var $_driverName = 'AustraliaSA';
+
+ /**
+ * Constructor
+ *
+ * @access protected
+ */
+ function Date_Holidays_Driver_AustraliaSA()
+ {
+ }
+
+ /**
+ * Build the internal arrays that contain data about holidays.
+ *
+ * @access protected
+ * @return boolean true on success, otherwise a PEAR_ErrorStack object
+ * @throws object PEAR_ErrorStack
+ */
+ function _buildHolidays()
+ {
+ parent::_buildHolidays();
+
+ /*
+ * Labour Day - 1st Monday of October
+ */
+ $labourDay = Date_Calc::nWeekdayOfMonth(1, 1, 10, $this->_year);
+ $this->_addHoliday('labourDay', $labourDay, "Labour Day");
+
+ /*
+ * See http://en.wikipedia.org/wiki/Queen%27s_Official_Birthday#Australia
+ */
+ $foundationDay = Date_Calc::nWeekdayOfMonth(2, 1, 6, $this->_year);
+ $this->_addHoliday('queensBirthday', $foundationDay, "Queen's Birthday");
+
+ } // _buildHolidays()
+
+} // Date_Holidays_Driver_AustraliaSA
Copied: pear/packages/Date_Holidays/tags/Date_Holidays_Australia-0.2.0/Date/Holidays/Driver/AustraliaWA.php \
(from rev 314863, pear/packages/Date_Holidays/trunk/Date/Holidays/Driver/AustraliaWA.php)
===================================================================
--- pear/packages/Date_Holidays/tags/Date_Holidays_Australia-0.2.0/Date/Holidays/Driver/AustraliaWA.php \
(rev 0)
+++ pear/packages/Date_Holidays/tags/Date_Holidays_Australia-0.2.0/Date/Holidays/Driver/AustraliaWA.php 2011-09-27 \
16:14:58 UTC (rev 317401) @@ -0,0 +1,96 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+/**
+ * This file contains only the Driver class for determining holidays in Western
+ * Australia.
+ *
+ * PHP Version 4
+ *
+ * @category Date
+ * @package Date_Holidays
+ * @author Sam Wilson <sam@archives.org.au>
+ * @license BSD http://www.opensource.org/licenses/bsd-license.php
+ * @link http://pear.php.net/package/Date_Holidays
+ */
+
+require_once 'Date/Calc.php';
+
+/**
+ * This Driver class calculates holidays in Western Australia. It should be used in
+ * conjunction with the Australia driver.
+ *
+ * @category Date
+ * @package Date_Holidays
+ * @subpackage Driver
+ * @author Sam Wilson <sam@archives.org.au>
+ * @license BSD http://www.opensource.org/licenses/bsd-license.php
+ * @link http://pear.php.net/package/Date_Holidays
+ */
+class Date_Holidays_Driver_AustraliaWA extends Date_Holidays_Driver
+{
+ /**
+ * this driver's name
+ *
+ * @access protected
+ * @var string
+ */
+ var $_driverName = 'AustraliaWA';
+
+ /**
+ * Constructor
+ *
+ * @access protected
+ */
+ function Date_Holidays_Driver_AustraliaWA()
+ {
+ }
+
+ /**
+ * Build the internal arrays that contain data about holidays.
+ *
+ * @access protected
+ * @return boolean true on success, otherwise a PEAR_ErrorStack object
+ * @throws object PEAR_ErrorStack
+ */
+ function _buildHolidays()
+ {
+ parent::_buildHolidays();
+
+ /*
+ * Labour Day.
+ */
+ $labourDay = Date_Calc::nWeekdayOfMonth(1, 1, 3, $this->_year);
+ $this->_addHoliday('labourDay', $labourDay, "Labour Day");
+
+ /*
+ * Foundation Day (Queen's Birthday in other states).
+ * See http://en.wikipedia.org/wiki/Queen%27s_Official_Birthday#Australia
+ */
+ $foundationDay = Date_Calc::nWeekdayOfMonth(1, 1, 6, $this->_year);
+ $this->_addHoliday('foundationDay', $foundationDay, "Foundation Day");
+
+ /*
+ * The Queen's Birthday. There is no firm rule to determine this date \
before + * it is proclaimed, but it is usually the last Monday of September \
or the + * first Monday of October, to fit in with school terms and the Perth \
Royal + * Show. Here we assume that whichever of the two is closest to the \
start of + * Octber will be the holiday; this has been verified to be correct \
up to and + * including 2013, but dates beyond then should be verified once \
they've been + * proclaimed (and something added here to account for \
historical and future + * irregularities).
+ */
+ $y = $this->_year;
+ $lastMonSept = new Date(Date_Calc::nWeekdayOfMonth('last', 1, 9, $y));
+ $firstMonOct = new Date(Date_Calc::nWeekdayOfMonth(1, 1, 10, $y));
+ $daysToEnd = 30 - $lastMonSept->getDay();
+ $daysToStart = $firstMonOct->getDay();
+ if ($daysToEnd < $daysToStart) {
+ $queensBirthday = $lastMonSept;
+ } else {
+ $queensBirthday = $firstMonOct;
+ }
+ $this->_addHoliday('queensBirthday', $queensBirthday, "Queen's Birthday");
+
+ } // _buildHolidays()
+
+} // Date_Holidays_Driver_AustraliaWA
Copied: pear/packages/Date_Holidays/tags/Date_Holidays_Australia-0.2.0/package_australia.xml \
(from rev 317400, pear/packages/Date_Holidays/trunk/package_australia.xml) \
===================================================================
--- pear/packages/Date_Holidays/tags/Date_Holidays_Australia-0.2.0/package_australia.xml \
(rev 0)
+++ pear/packages/Date_Holidays/tags/Date_Holidays_Australia-0.2.0/package_australia.xml 2011-09-27 \
16:14:58 UTC (rev 317401) @@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<package packagerversion="1.7.1" version="2.0" \
xmlns="http://pear.php.net/dtd/package-2.0" \
xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" \
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" \
xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 \
http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 \
http://pear.php.net/dtd/package-2.0.xsd"> + <name>Date_Holidays_Australia</name>
+ <channel>pear.php.net</channel>
+ <summary>Driver based class to calculate holidays in Australia.</summary>
+ <description>Date_Holidays helps you calculate the dates and titles of holidays and \
other special celebrations. This is the driver for calculating holidays in \
Australia.</description> + <lead>
+ <name>Ken Guest</name>
+ <user>kguest</user>
+ <email>ken@linux.ie</email>
+ <active>yes</active>
+ </lead>
+ <developer>
+ <name>Daniel O'Connor</name>
+ <user>doconnor</user>
+ <email>daniel.oconnor@gmail.com</email>
+ <active>yes</active>
+ </developer>
+ <contributor>
+ <name>Sam Wilson</name>
+ <user>samwilson</user>
+ <email>sam@archives.org.au</email>
+ <active>no</active>
+ </contributor>
+ <date>2011-09-27</date>
+ <time>16:23:19</time>
+ <version>
+ <release>0.2.0</release>
+ <api>0.17.2</api>
+ </version>
+ <stability>
+ <release>alpha</release>
+ <api>alpha</api>
+ </stability>
+<license uri="http://www.opensource.org/licenses/bsd-license.php">BSD</license>
+ <notes>
+ * Includes new Date_Holidays_AustraliaSA and Date_Holidays_AustraliaNSW drivers.
+ </notes>
+ <contents>
+ <dir baseinstalldir="/" name="/">
+ <dir name="Date">
+ <dir name="Holidays">
+ <dir name="Driver">
+ <file name="Australia.php" role="php" />
+ <file name="AustraliaNSW.php" role="php" />
+ <file name="AustraliaSA.php" role="php" />
+ <file name="AustraliaWA.php" role="php" />
+ </dir> <!-- /Holidays/Driver -->
+ </dir> <!-- /Holidays -->
+ </dir>
+ </dir> <!-- / -->
+ </contents>
+ <dependencies>
+ <required>
+ <php>
+ <min>4.0.0</min>
+ </php>
+ <pearinstaller>
+ <min>1.7.1</min>
+ </pearinstaller>
+ <package>
+ <name>Date_Holidays</name>
+ <channel>pear.php.net</channel>
+ <min>0.21.4</min>
+ </package>
+ </required>
+ </dependencies>
+ <phprelease />
+ <changelog>
+ <release>
+ <version>
+ <release>0.2.0</release>
+ <api>0.17.2</api>
+ </version>
+ <stability>
+ <release>alpha</release>
+ <api>alpha</api>
+ </stability>
+ <date>2011-09-27</date>
+ <license uri="http://www.opensource.org/licenses/bsd-license.php">BSD</license>
+ <notes>* Includes new Date_Holidays_AustraliaSA and Date_Holidays_AustraliaNSW \
drivers.</notes> + </release>
+ <release>
+ <version>
+ <release>0.1.0</release>
+ <api>0.17.2</api>
+ </version>
+ <stability>
+ <release>alpha</release>
+ <api>alpha</api>
+ </stability>
+ <date>2008-08-23</date>
+ <license uri="http://www.opensource.org/licenses/bsd-license.php">BSD</license>
+ <notes>initial pear release</notes>
+ </release>
+ </changelog>
+</package>
--
PEAR CVS Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic