-
Notifications
You must be signed in to change notification settings - Fork 1
/
dateplus_menu.php
68 lines (59 loc) · 1.48 KB
/
dateplus_menu.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
<?php
/*
* Date+ - An advanced date display menu for e107
*
* Copyright (C) 2010-2015 Patrick Weaver (http://trickmod.com/)
* For additional information refer to the README.mkd file.
*
*/
if(!defined('e107_INIT')){ exit; }
require_once(e_PLUGIN.'dateplus/_class.php');
$pref = e107::pref('dateplus');
$tp = e107::getParser();
$sc = e107::getScBatch('dateplus', true);
$template = e107::getTemplate('dateplus');
$curMonth = date('n');
$curDay = date('j');
$hs = hanukkahStart();
$he = hanukkahStart() + 691200;
$text = "";
$holidays = getHolidays($curMonth, $curDay);
foreach($holidays as $holiday)
{
$holiray[] = array($holiday[0], $holiday[1], $holiday[2]);
}
if($pref['enableUserdays'] == true)
{
$userdays = getUserdays($curMonth, $curDay);
foreach($userdays as $userday)
{
$holiray[] = array($userday[0], $userday[1], $userday[2]);
}
}
if(date('j/n/Y', $hs) == date('j/n/Y'))
{
$holiray[] = array('Hanukkah starts', date('n', $hs), date('j', $hs));
}
if(date('j/n/Y', $he) == date('j/n/Y'))
{
$holiray[] = array('Hanukkah ends', date('n', $he), date('j', $he));
}
$all_holidays = '';
if(isset($holiray[0]))
{
foreach($holiray as $entry)
{
$sc->setVars(array(
'name' => $entry[0],
'month' => $entry[1],
'day' => $entry[2],
));
$all_holidays .= $tp->parseTemplate($template['holiday'], false, $sc);
}
}
$sc->setVars(array(
'all_holidays' => $all_holidays,
));
$text = $tp->parseTemplate($template['menu'], false, $sc);
e107::getRender()->tablerender('Date+', $text);
?>