-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathextension.driver.php
38 lines (34 loc) · 1.04 KB
/
extension.driver.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
<?php
class extension_timeparams extends Extension {
public function about() {
return array(
'name' => 'TimeParams',
'version' => '0.1',
'release-date' => '2013-08-13',
'author' => array(
'name' => 'Kyle McGuire',
'website' => 'http://kymcism.com/',
'email' => '[email protected]'
)
);
}
public function getSubscribedDelegates() {
return array(
array(
'page' => '/frontend/',
'delegate' => 'FrontendParamsResolve',
'callback' => 'addParam'
),
);
}
public function addParam(&$context) {
$context['params']['next-year'] = date('Y')+1;
$context['params']['unix-now'] = time();
$context['params']['unix-now-plus-3'] = time()+(3*24*60*60);
$context['params']['unix-now-minus-3'] = time()-(3*24*60*60);
$context['params']['last-year'] = date('Y')-1;
$context['params']['tomorrow'] = substr(date('c', time()+24*60*60), 0, 10);
$context['params']['today-plus-3'] = substr(date('c', time()+3*24*60*60), 0, 10);
$context['params']['today-minus-3'] = substr(date('c', time()-3*24*60*60), 0, 10);
}
}