-
Notifications
You must be signed in to change notification settings - Fork 10
/
UNO.php
562 lines (491 loc) · 17.5 KB
/
UNO.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
/**
* UNO
*
* PHP Version 5
*
* Authors:
* 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.
*
* @category Date
* @package Date_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$
* @link http://pear.php.net/package/Date_Holidays
*/
/**
* Driver-class that calculates UNO (United Nations Organization) holidays
*
* @category Date
* @package Date_Holidays
* @subpackage Driver
* @author Carsten Lucke <luckec@tool-garage.de>
* @license http://www.php.net/license/3_01.txt PHP License 3.0.1
* @version CVS: $Id$
* @link http://pear.php.net/package/Date_Holidays
*/
class Date_Holidays_Driver_UNO extends Date_Holidays_Driver
{
/**
* this driver's name
*
* @access protected
* @var string
*/
var $_driverName = 'UNO';
/**
* Constructor
*
* Use the Date_Holidays::factory() method to construct an object of a
* certain driver
*
* @access protected
*/
protected function __construct()
{
}
/**
* Build the internal arrays that contain data about the calculated holidays
*
* @access protected
* @return boolean true on success, otherwise a PEAR_ErrorStack object
* @throws object PEAR_ErrorStack
*/
function _buildHolidays()
{
/**
* World's leprosy day
*/
$this->_addHoliday('leprosyDay',
$this->_year . '-01-28',
'World\'s leprosy day');
/**
* International day of the native tongue
*/
$this->_addHoliday('nativeTongueDay',
$this->_year . '-02-21',
'International Day of the native tongue');
/**
* International Women's Day
*/
$this->_addHoliday('womensDay',
$this->_year . '-03-08',
'International Women\'s Day');
/**
* International World Consumers' Day
*/
$this->_addHoliday('worldConsumersDay',
$this->_year . '-03-15',
'International World Consumers\' Day');
/**
* International day of the forest
*/
$this->_addHoliday('intForestDay',
$this->_year . '-03-21',
'International day of the forest');
/**
* International day of beating racism
*/
$this->_addHoliday('intDayBeatingRacism',
$this->_year . '-03-21',
'International day of beating racism');
/**
* Day of poesy
*/
$this->_addHoliday('dayOfPoesy',
$this->_year . '-03-21',
'Day of poesy');
/**
* Day of water
*/
$this->_addHoliday('dayOfWater',
$this->_year . '-03-22',
'Day of water');
/**
* World's meteorology day
*/
$this->_addHoliday('meteorologyDay',
$this->_year . '-03-23',
'World\'s meteorology day');
/**
* World's tuberculosis day
*/
$this->_addHoliday('tuberculosisDay',
$this->_year . '-03-24',
'World\'s tuberculosis day');
/**
* World's Health Day
*/
$this->_addHoliday('worldsHealthDay',
$this->_year . '-04-07',
'World\'s Health Day');
/**
* Book and Copyright's Day
*/
$this->_addHoliday('bookAndCopyrightDay',
$this->_year . '-04-23',
'Book and Copyright\'s Day');
/**
* Tree's Day
*/
$this->_addHoliday('treesDay',
$this->_year . '-04-25',
'Tree\'s Day');
/**
* World's day of intellectual property
*/
$this->_addHoliday('intellectualPropertyDay',
$this->_year . '-04-26',
'World\'s day of intellectual property');
/**
* International day of work
*/
$this->_addHoliday('intDayOfWork',
$this->_year . '-05-01',
'International day of work');
/**
* International day for freedom of the press
*/
$this->_addHoliday('freedomOfPressDay',
$this->_year . '-05-03',
'International day for freedom of the press');
/**
* Day of the sun
*/
$this->_addHoliday('dayOfTheSun',
$this->_year . '-05-03',
'Day of the sun');
/**
* International Family's Day
*/
$this->_addHoliday('intFamilyDay',
$this->_year . '-05-15',
'International Family\'s Day');
/**
* World's Telecommunications Day
*/
$this->_addHoliday('telecommunicationsDay',
$this->_year . '-05-17',
'World\'s Telecommunications Day');
/**
* International day of cultural development
*/
$this->_addHoliday('culturalDevelopmentDay',
$this->_year . '-05-21',
'International day of cultural development');
/**
* International day of biological diversity
*/
if ($this->_year >= 2001) {
$this->_addHoliday('biologicalDiversityDay',
$this->_year . '-05-22',
'International day of biological diversity');
} else {
$this->_addHoliday('biologicalDiversityDay',
$this->_year . '-12-29',
'International day of biological diversity');
}
/**
* African Liberation Day
*/
$this->_addHoliday('africanLiberationDay',
$this->_year . '-05-25',
'African Liberation Day');
/**
* International UN Peace Squads' Day
*/
$this->_addHoliday('unPeaceSquadsDay',
$this->_year . '-05-29',
'International UN Peace Squads\' Day');
/**
* World's Nonsmokers' Day
*/
$this->_addHoliday('nonsmokersDay',
$this->_year . '-05-31',
'World\'s Nonsmokers\' Day');
/**
* World's Agriculturalists' Day
*/
$this->_addHoliday('farmersDay',
$this->_year . '-06-01',
'World\'s Agriculturalists\' Day');
/**
* World's Environment Day
*/
$this->_addHoliday('environmentDay',
$this->_year . '-06-05',
'World\'s Environment Day');
/**
* African Children's Day
*/
$this->_addHoliday('africanChildrenDay',
$this->_year . '-06-16',
'African Children\'s Day');
/**
* World's Desert's Day
*/
$this->_addHoliday('desertDay',
$this->_year . '-06-17',
'World\'s Desert\'s Day');
/**
* African Fugitives' Day
*/
$this->_addHoliday('africanFugitiveDay',
$this->_year . '-06-20',
'African Fugitives\' Day');
/**
* International day against drugs
*/
$this->_addHoliday('antiDrugsDay',
$this->_year . '-06-26',
'International day against drugs');
/**
* International Cooperative Societies' Day
*/
$coopDayDate = new Date($this->_year . '-07-01');
while ($coopDayDate->getDayOfWeek() != 6) {
$coopDayDate = $coopDayDate->getNextDay();
}
$this->_addHoliday('intCoopDay',
$coopDayDate,
'International Cooperative Societies\' Day');
/**
* World's Population Day
*/
$this->_addHoliday('populationDay',
$this->_year . '-07-11',
'World\'s Population Day');
/**
* International day of indigenous people
*/
$this->_addHoliday('indigenousPeopleDay',
$this->_year . '-08-09',
'International day of indigenous people');
/**
* International Youth' Day
*/
$this->_addHoliday('intYouthDay',
$this->_year . '-08-12',
'International Youth\' Day');
/**
* International day of slave trade's abolishment
*/
$this->_addHoliday('slaveTradeDay',
$this->_year . '-08-23',
'International day of slave trade\'s abolishment');
/**
* World's Alphabetization Day
*/
$this->_addHoliday('alphabetizationDay',
$this->_year . '-09-08',
'World\'s Alphabetization Day');
/**
* Ozone Layer's Protection Day
*/
$this->_addHoliday('ozoneLayerProtectionDay',
$this->_year . '-09-16',
'Ozone Layer\'s Protection Day');
/**
* International day of peace
*/
$peaceDayDate = new Date($this->_year . '-09-01');
while ($peaceDayDate->getDayOfWeek() != 2) {
$peaceDayDate = $peaceDayDate->getNextDay();
}
$peaceDayDate = $this->_addDays($peaceDayDate, 14);
$this->_addHoliday('intPeaceDay',
$peaceDayDate,
'International day of peace');
/**
* World's day of tourism
*/
$this->_addHoliday('tourismDay',
$this->_year . '-09-27',
'World\'s day of tourism');
/**
* International fugitives' day
*/
$this->_addHoliday('intFugitiveDay',
$this->_year . '-09-28',
'International fugitives\' day');
/**
* International aged people's day
*/
$this->_addHoliday('agedPeopleDay',
$this->_year . '-10-01',
'International aged people\'s day');
/**
* World's day for prevention of cruelty to animals
*/
$this->_addHoliday('animalsDay',
$this->_year . '-10-04',
'World\'s day for prevention of cruelty to animals');
/**
* Beginning of the International Outer Space Week
*/
$this->_addHoliday('outerSpaceWeek',
$this->_year . '-10-04',
'Beginning of the International Outer Space Week');
/**
* World's Habitat Day
*/
$habitatDayDate = new Date($this->_year . '-10-01');
while ($habitatDayDate->getDayOfWeek() != 1) {
$habitatDayDate = $habitatDayDate->getNextDay();
}
$this->_addHoliday('habitatDay', $coopDayDate, 'World\'s Habitat Day');
/**
* International Teachers' Day
*/
$this->_addHoliday('teachersDay',
$this->_year . '-10-05',
'International Teachers\' Day');
/**
* World Post Association's Day
*/
$this->_addHoliday('postAssociationDay',
$this->_year . '-10-09',
'World Post Association\'s Day');
/**
* World's Sanity Day
*/
$this->_addHoliday('sanityDay',
$this->_year . '-10-10',
'World\'s Sanity Day');
/**
* World's Nourishment Day
*/
$this->_addHoliday('nourishmentDay',
$this->_year . '-10-16',
'World\'s Nourishment Day');
/**
* International day for removal of poverty
*/
$this->_addHoliday('povertyRemovalDay',
$this->_year . '-10-17',
'International day for removal of poverty');
/**
* United Nations' Day
*/
$this->_addHoliday('unitedNationsDay',
$this->_year . '-10-24',
'United Nations\' Day');
/**
* World's day of information about evolvement
*/
$this->_addHoliday('evolvementInfoDay',
$this->_year . '-10-24',
'World\'s day of information about evolvement');
/**
* Beginning of the Disarmament Week
*/
$this->_addHoliday('evolvementInfoDay',
$this->_year . '-10-24',
'Beginning of the Disarmament Week');
/**
* International day against environmental exploitation in wartime
*/
$this->_addHoliday('environmentalExploitationDay',
$this->_year . '-11-06',
'International day against environmental exploitation in wartime');
/**
* International day of tolerance
*/
$this->_addHoliday('toleranceDay',
$this->_year . '-11-16',
'International day of tolerance');
/**
* African Industrialization Day
*/
$this->_addHoliday('africanIndustrializationDay',
$this->_year . '-11-20',
'African Industrialization Day');
/**
* World's Children's Day
*/
$this->_addHoliday('worldChildrenDay',
$this->_year . '-11-20',
'World\'s Children\'s Day');
/**
* World's Television Day
*/
$this->_addHoliday('televisionDay',
$this->_year . '-11-21',
'World\'s Television Day');
/**
* International day for removal of violence against women
*/
$this->_addHoliday('noViolenceAgainstWomen',
$this->_year . '-11-25',
'International day for removal of violence against women');
/**
* International day of solidarity with Palestinian people
*/
$this->_addHoliday('palestinianSolidarity',
$this->_year . '-11-29',
'International day of solidarity with Palestinian people');
/**
* World AIDS Day
*/
$this->_addHoliday('worldAidsDay',
$this->_year . '-12-01',
'World AIDS Day');
/**
* International day for abolishment of slavery
*/
$this->_addHoliday('againstSlaveryDay',
$this->_year . '-12-01',
'International day for abolishment of slavery');
/**
* International day for disabled people
*/
$this->_addHoliday('disabledPeopleDay',
$this->_year . '-12-03',
'International day for disabled people');
/**
* International evolvement helpers' day
*/
$this->_addHoliday('evolvementHelperDay',
$this->_year . '-12-05',
'International evolvement helpers\' day');
/**
* International day of civil aeronautics
*/
$this->_addHoliday('civilAeronauticsDay',
$this->_year . '-12-07',
'International day of civil aeronautics');
/**
* International day of human rights
*/
$this->_addHoliday('humanRightsDay',
$this->_year . '-12-10',
'International day of human rights');
/**
* UNICEF Day
*/
$this->_addHoliday('unicefDay',
$this->_year . '-12-11',
'UNICEF Day');
/**
* International migrants' day
*/
$this->_addHoliday('migrantsDay',
$this->_year . '-12-18',
'International migrants\' day');
if (Date_Holidays::errorsOccurred()) {
return Date_Holidays::getErrorStack();
}
return true;
}
}
?>