|
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
|
|
|
if (!function_exists('easter')) { |
|
22
|
|
|
/** |
|
23
|
|
|
* @param $y |
|
24
|
|
|
* @param $holidays |
|
25
|
|
|
* @return int |
|
26
|
|
|
*/ |
|
27
|
|
|
function easter($y, &$holidays) |
|
|
|
|
|
|
28
|
|
|
{ |
|
29
|
|
|
$e = 21 + easter_days($y); |
|
30
|
|
|
if ($e > 31) { |
|
31
|
|
|
$e -= 31; |
|
32
|
|
|
$em = 4; |
|
33
|
|
|
} else { |
|
34
|
|
|
$em = 3; |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
return strtotime("$y-$em-$e"); |
|
38
|
|
|
} |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
$this->holidays = array(); |
|
42
|
|
|
$start = (int)date('Y') - 10; |
|
43
|
|
|
$end = $start + 30; |
|
44
|
|
|
|
|
45
|
|
|
for ($y = $start; $y < $end; ++$y) { |
|
46
|
|
|
$e = easter($y, $this->holidays); |
|
47
|
|
|
$ve = date('Y-n-j', strtotime('-2 days', $e)); |
|
48
|
|
|
$le = date('Y-n-j', strtotime('+1 days', $e)); |
|
49
|
|
|
$a = date('Y-n-j', strtotime('+39 days', $e)); |
|
50
|
|
|
$p = date('Y-n-j', strtotime('+49 days', $e)); |
|
51
|
|
|
$lp = date('Y-n-j', strtotime('+50 days', $e)); |
|
52
|
|
|
|
|
53
|
|
|
$this->holidays["$y-1-1"] = 'Nouvel an'; |
|
54
|
|
|
$this->holidays["$y-2-14"] = 'St-Valentin'; |
|
55
|
|
|
$this->holidays[$ve] = 'Vendredi Saint'; |
|
56
|
|
|
$this->holidays[date('Y-n-j', $e)] = 'Pâques'; |
|
57
|
|
|
$this->holidays[$le] = 'Lundi de Pâques'; |
|
58
|
|
|
$this->holidays[$a] = 'Ascension'; |
|
59
|
|
|
$this->holidays[$p] = 'Pentecôte'; |
|
60
|
|
|
$this->holidays[$lp] = 'Lundi de Pentecôte'; |
|
61
|
|
|
$this->holidays["$y-5-1"] = 'Fête du travail'; |
|
62
|
|
|
$this->holidays["$y-5-8"] = 'Victoire'; |
|
63
|
|
|
$this->holidays["$y-7-14"] = 'Fête Nationale'; |
|
64
|
|
|
$this->holidays["$y-8-15"] = 'Assomption'; |
|
65
|
|
|
$this->holidays["$y-11-1"] = 'Toussaint'; |
|
66
|
|
|
$this->holidays["$y-11-11"] = 'Armistice'; |
|
67
|
|
|
$this->holidays["$y-12-25"] = 'Noël'; |
|
68
|
|
|
} |
|
69
|
|
|
|
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.