source: trunk/themes/smartpocket/themeconf.inc.php @ 23716

Last change on this file since 23716 was 23716, checked in by flop25, 11 years ago

bug:2848
Switch to Desktop link in the menu also

File size: 2.8 KB
Line 
1<?php
2/*
3Theme Name: Smart Pocket
4Version: 2.5.0
5Description: Mobile theme.
6Theme URI: http://piwigo.org/ext/extension_view.php?eid=599
7Author: P@t
8Author 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
20//Retrive all pictures on thumbnails page
21add_event_handler('loc_index_thumbnails_selection', 'sp_select_all_thumbnails');
22
23function sp_select_all_thumbnails($selection)
24{
25  global $page, $template;
26
27  $template->assign('page_selection', array_flip($selection));
28
29  return $page['items'];
30}
31
32// Retrive all categories on thumbnails page
33add_event_handler('loc_end_index_category_thumbnails', 'sp_select_all_categories');
34
35function sp_select_all_categories($selection)
36{
37  global $tpl_thumbnails_var;
38  return $tpl_thumbnails_var;
39}
40
41// Get better derive parameters for screen size
42$type = IMG_LARGE;
43if (!empty($_COOKIE['screen_size']))
44{
45  $screen_size = explode('x', $_COOKIE['screen_size']);
46  $derivative_params = new ImageStdParams;
47  $derivative_params->load_from_db();
48
49  foreach ($derivative_params->get_all_type_map() as $type => $map)
50  {
51    if (max($map->sizing->ideal_size) >= max($screen_size) and min($map->sizing->ideal_size) >= min($screen_size))
52      break;
53  }
54}
55
56$this->assign('picture_derivative_params', ImageStdParams::get_by_type($type));
57$this->assign('thumbnail_derivative_params', ImageStdParams::get_by_type(IMG_SQUARE));
58
59//------------------------------------------------------------- mobile version
60add_event_handler('init', 'mobile_link');
61
62function mobile_link()
63{
64  global $template, $conf;
65  if ( !empty($conf['mobile_theme']) && (get_device() != 'desktop' || mobile_theme()))
66  {
67    $template->assign('TOGGLE_MOBILE_THEME_URL',
68        add_url_params(
69          duplicate_index_url(),
70          array('mobile' => mobile_theme() ? 'false' : 'true')
71        )
72      );
73  }
74}
75
76
77if ( !function_exists( 'add_menu_on_public_pages' ) ) { 
78  if ( defined('IN_ADMIN') and IN_ADMIN ) return false; 
79  add_event_handler('loc_after_page_header', 'add_menu_on_public_pages', 20); 
80
81  function  add_menu_on_public_pages() { 
82    if ( function_exists( 'initialize_menu') ) return false; # The current page has already the menu 
83    global $template, $page, $conf; 
84    if ( isset($page['body_id']) and $page['body_id']=="thePicturePage" ) 
85    {           
86      $template->set_filenames(array( 
87            'add_menu_on_public_pages' => dirname(__FILE__) . '/template/add_menu_on_public_pages.tpl', 
88      )); 
89      include_once(PHPWG_ROOT_PATH.'include/menubar.inc.php'); 
90      $template->parse('add_menu_on_public_pages');
91    }
92     
93     
94  } 
95} 
96
97
98?>
Note: See TracBrowser for help on using the repository browser.