1 | <?php |
---|
2 | /* |
---|
3 | Theme Name: Smart Pocket |
---|
4 | Version: 2.5.1 |
---|
5 | Description: Mobile theme. |
---|
6 | Theme URI: http://piwigo.org/ext/extension_view.php?eid=599 |
---|
7 | Author: P@t |
---|
8 | Author URI: http://piwigo.org |
---|
9 | */ |
---|
10 | |
---|
11 | $themeconf = array( |
---|
12 | 'mobile' => true, |
---|
13 | ); |
---|
14 | |
---|
15 | // Redirect if page is not compatible with mobile theme |
---|
16 | if (!in_array(script_basename(), array('index', 'register', 'profile', 'identification', 'ws', 'admin'))) |
---|
17 | redirect(duplicate_index_url()); |
---|
18 | |
---|
19 | //Retrive all pictures on thumbnails page |
---|
20 | add_event_handler('loc_index_thumbnails_selection', 'sp_select_all_thumbnails'); |
---|
21 | |
---|
22 | function sp_select_all_thumbnails($selection) |
---|
23 | { |
---|
24 | global $page, $template; |
---|
25 | |
---|
26 | $template->assign('page_selection', array_flip($selection)); |
---|
27 | |
---|
28 | return $page['items']; |
---|
29 | } |
---|
30 | |
---|
31 | // Retrive all categories on thumbnails page |
---|
32 | add_event_handler('loc_end_index_category_thumbnails', 'sp_select_all_categories'); |
---|
33 | |
---|
34 | function sp_select_all_categories($selection) |
---|
35 | { |
---|
36 | global $tpl_thumbnails_var; |
---|
37 | return $tpl_thumbnails_var; |
---|
38 | } |
---|
39 | |
---|
40 | // Get better derive parameters for screen size |
---|
41 | $type = IMG_LARGE; |
---|
42 | if (!empty($_COOKIE['screen_size'])) |
---|
43 | { |
---|
44 | $screen_size = explode('x', $_COOKIE['screen_size']); |
---|
45 | $derivative_params = new ImageStdParams; |
---|
46 | $derivative_params->load_from_db(); |
---|
47 | |
---|
48 | foreach ($derivative_params->get_all_type_map() as $type => $map) |
---|
49 | { |
---|
50 | if (max($map->sizing->ideal_size) >= max($screen_size) and min($map->sizing->ideal_size) >= min($screen_size)) |
---|
51 | break; |
---|
52 | } |
---|
53 | } |
---|
54 | |
---|
55 | $this->assign('picture_derivative_params', ImageStdParams::get_by_type($type)); |
---|
56 | $this->assign('thumbnail_derivative_params', ImageStdParams::get_by_type(IMG_SQUARE)); |
---|
57 | |
---|
58 | ?> |
---|