Last change
on this file since 22404 was
19773,
checked in by plg, 12 years ago
|
new plugin birthdate to calculate age of people on each photo
|
File size:
1.2 KB
|
Line | |
---|
1 | <?php |
---|
2 | defined('BIRTHDATE_PATH') or die('Hacking attempt!'); |
---|
3 | |
---|
4 | /** |
---|
5 | * add a prefilter on photo page |
---|
6 | */ |
---|
7 | function birthdate_loc_end_picture() |
---|
8 | { |
---|
9 | global $template, $picture; |
---|
10 | |
---|
11 | if (isset($picture['current']['date_creation'])) |
---|
12 | { |
---|
13 | list($ymd, $hms) = explode(' ', $picture['current']['date_creation']); |
---|
14 | list($year, $month, $day) = explode('-', $ymd); |
---|
15 | |
---|
16 | if (checkdate($month, $day, $year)) |
---|
17 | { |
---|
18 | $tpl_tags = $template->get_template_vars('related_tags'); |
---|
19 | |
---|
20 | if (!empty($tpl_tags)) |
---|
21 | { |
---|
22 | $template->clear_assign('related_tags'); |
---|
23 | |
---|
24 | foreach ($tpl_tags as $tag) |
---|
25 | { |
---|
26 | if (isset($tag['birthdate'])) |
---|
27 | { |
---|
28 | $age_label = birthdate_compute_age($tag['birthdate'], $picture['current']['date_creation']); |
---|
29 | if (isset($age_label)) |
---|
30 | { |
---|
31 | $tooltip = sprintf( |
---|
32 | l10n('on this photo %s is %s old'), |
---|
33 | $tag['name'], |
---|
34 | $age_label |
---|
35 | ); |
---|
36 | |
---|
37 | $tag['name'].= '</a> <span class="" title="'.$tooltip.'">('.$age_label.')</span><a>'; |
---|
38 | } |
---|
39 | } |
---|
40 | |
---|
41 | $template->append('related_tags', $tag); |
---|
42 | } |
---|
43 | } |
---|
44 | } |
---|
45 | } |
---|
46 | } |
---|
47 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.