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"] = 'Vendredi Saint'; |
39
|
|
|
} else { |
40
|
|
|
$f = 31 - $f; |
41
|
|
|
$holidays["$y-3-$f"] = 'Vendredi Saint'; |
42
|
|
|
} |
43
|
|
|
$holidays["$y-$em-$e"] = 'Pâques'; |
44
|
|
|
if ($m > 31) { |
45
|
|
|
$m -= 31; |
46
|
|
|
$holidays["$y-4-$m"] = 'Lundi de Pâques'; |
47
|
|
|
} else { |
48
|
|
|
$holidays["$y-$em-$m"] = 'Lundi de Pâques'; |
49
|
|
|
} |
50
|
|
|
} |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
$this->holidays = array(); |
54
|
|
|
$start = (int)date('Y') - 10; |
55
|
|
|
$end = $start + 30; |
56
|
|
|
|
57
|
|
View Code Duplication |
for ($y = $start; $y < $end; ++$y) { |
58
|
|
|
easter($y, $this->holidays); |
59
|
|
|
$v = ((int)date('N', strtotime("$y-5-25")) == 1) ? '25' : date('j', strtotime('Last Monday', strtotime("$y-5-25"))); |
60
|
|
|
$m = date('j', strtotime('+2 Sunday', strtotime("$y-5-1"))); |
61
|
|
|
$f = date('j', strtotime('+3 Sunday', strtotime("$y-6-1"))); |
62
|
|
|
$c = date('j', strtotime('+1 Monday', strtotime("$y-8-1"))); |
63
|
|
|
$l = date('j', strtotime('+1 Monday', strtotime("$y-9-1"))); |
64
|
|
|
$t = date('j', strtotime('+2 Monday', strtotime("$y-10-1"))); |
65
|
|
|
|
66
|
|
|
$this->holidays["$y-1-1"] = 'Jour de l\'an'; |
67
|
|
|
$this->holidays["$y-2-14"] = 'St-Valentin'; |
68
|
|
|
$this->holidays["$y-3-17"] = 'St-Patrick'; |
69
|
|
|
$this->holidays["$y-4-22"] = 'Jour de la terre'; |
70
|
|
|
$this->holidays["$y-5-$m"] = 'Fête des mère'; |
71
|
|
|
$this->holidays["$y-5-$v"] = 'Fête de la reine'; |
72
|
|
|
$this->holidays["$y-6-$f"] = 'Fête des père'; |
73
|
|
|
$this->holidays["$y-6-24"] = 'St-Jean-Baptiste'; |
74
|
|
|
$this->holidays["$y-7-1"] = 'Fête du Canada'; |
75
|
|
|
$this->holidays["$y-8-$c"] = 'Congé provincial'; |
76
|
|
|
$this->holidays["$y-9-$l"] = 'Fête du travail'; |
77
|
|
|
$this->holidays["$y-10-$t"] = 'Action de grâce'; |
78
|
|
|
$this->holidays["$y-10-31"] = 'Halloween'; |
79
|
|
|
$this->holidays["$y-11-11"] = 'Jour du souvenir'; |
80
|
|
|
$this->holidays["$y-12-25"] = 'Noël'; |
81
|
|
|
$this->holidays["$y-12-26"] = 'Boxing Day'; |
82
|
|
|
} |
83
|
|
|
|
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.