|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
* You may not change or alter any portion of this comment or credits |
|
4
|
|
|
* of supporting developers from this source code or any supporting source code |
|
5
|
|
|
* which is considered copyrighted (c) material of the original comment or credit authors. |
|
6
|
|
|
* |
|
7
|
|
|
* This program is distributed in the hope that it will be useful, |
|
8
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
9
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* @copyright {@link http://xoops.org/ XOOPS Project} |
|
14
|
|
|
* @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license} |
|
15
|
|
|
* @package |
|
16
|
|
|
* @since |
|
17
|
|
|
* @author XOOPS Development Team, |
|
18
|
|
|
* @author Antiques Promotion (http://www.antiquespromotion.ca) |
|
19
|
|
|
*/ |
|
20
|
|
|
|
|
21
|
|
View Code Duplication |
if (!function_exists('easter')) { |
|
22
|
|
|
/** |
|
23
|
|
|
* @param $y |
|
24
|
|
|
* @param $holidays |
|
25
|
|
|
*/ |
|
26
|
|
|
function easter($y, &$holidays) |
|
|
|
|
|
|
27
|
|
|
{ |
|
28
|
|
|
$e = 21 + easter_days($y); |
|
29
|
|
|
if ($e > 31) { |
|
30
|
|
|
$e -= 31; |
|
31
|
|
|
$em = 4; |
|
32
|
|
|
} else { |
|
33
|
|
|
$em = 3; |
|
34
|
|
|
} |
|
35
|
|
|
$f = $e - 2; |
|
36
|
|
|
$m = $e + 1; |
|
37
|
|
|
if ($f > 0) { |
|
38
|
|
|
$holidays["$y-$em-$f"] = 'Good Friday'; |
|
39
|
|
|
} else { |
|
40
|
|
|
$f = 31 - $f; |
|
41
|
|
|
$holidays["$y-3-$f"] = 'Good Friday'; |
|
42
|
|
|
} |
|
43
|
|
|
$holidays["$y-$em-$e"] = 'Easter'; |
|
44
|
|
|
if ($m > 31) { |
|
45
|
|
|
$m -= 31; |
|
46
|
|
|
$holidays["$y-4-$m"] = 'Easter Monday'; |
|
47
|
|
|
} else { |
|
48
|
|
|
$holidays["$y-$em-$m"] = 'Easter Monday'; |
|
49
|
|
|
} |
|
50
|
|
|
} |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
$this->holidays = array(); |
|
54
|
|
|
$start = (int)date('Y') - 10; |
|
55
|
|
|
$end = $start + 30; |
|
56
|
|
|
|
|
57
|
|
|
for ($y = $start; $y < $end; ++$y) { |
|
58
|
|
|
easter($y, $this->holidays); |
|
59
|
|
|
$k = date('j', strtotime('+3 Monday', strtotime("$y-1-1"))); |
|
60
|
|
|
$w = date('j', strtotime('+3 Monday', strtotime("$y-2-1"))); |
|
61
|
|
|
$me = date('j', strtotime('Last Saturday May', strtotime("$y-5-1"))); // Last Monday of May but there's a bug... Last Saturday is a hack. |
|
62
|
|
|
$mo = date('j', strtotime('+2 Sunday', strtotime("$y-5-1"))); |
|
63
|
|
|
$f = date('j', strtotime('+3 Sunday', strtotime("$y-6-1"))); |
|
64
|
|
|
$l = date('j', strtotime('+1 Monday', strtotime("$y-9-1"))); |
|
65
|
|
|
$c = date('j', strtotime('+2 Monday', strtotime("$y-10-1"))); |
|
66
|
|
|
$t = date('j', strtotime('+4 Thursday', strtotime("$y-11-1"))); |
|
67
|
|
|
|
|
68
|
|
|
$this->holidays["$y-1-1"] = 'New Year\'s Day'; |
|
69
|
|
|
$this->holidays["$y-1-$k"] = 'Martin Luther King, Jr. Day'; |
|
70
|
|
|
$this->holidays["$y-2-2"] = 'Groundhog Day'; |
|
71
|
|
|
$this->holidays["$y-2-14"] = 'Valentine\'s Day'; |
|
72
|
|
|
$this->holidays["$y-2-$w"] = 'Washington\'s Birthday'; |
|
73
|
|
|
$this->holidays["$y-3-17"] = 'St. Patrick\'s'; |
|
74
|
|
|
$this->holidays["$y-4-22"] = 'Earth Day'; |
|
75
|
|
|
$this->holidays["$y-5-$mo"] = 'Mother\'s Day'; |
|
76
|
|
|
$this->holidays["$y-5-$me"] = 'Memorial'; |
|
77
|
|
|
$this->holidays["$y-6-$f"] = 'Father\'s Day'; |
|
78
|
|
|
$this->holidays["$y-7-4"] = 'Independence Day'; |
|
79
|
|
|
$this->holidays["$y-9-$l"] = 'Labour Day'; |
|
80
|
|
|
$this->holidays["$y-10-$c"] = 'Columbus Day'; |
|
81
|
|
|
$this->holidays["$y-10-31"] = 'Halloween'; |
|
82
|
|
|
$this->holidays["$y-11-11"] = 'Veterans Day'; |
|
83
|
|
|
$this->holidays["$y-11-$t"] = 'Thanksgiving'; |
|
84
|
|
|
$this->holidays["$y-12-25"] = 'Christmas'; |
|
85
|
|
|
} |
|
86
|
|
|
|
This check looks for functions that have already been defined in other files.
Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the
@ignoreannotation.See also the PhpDoc documentation for @ignore.