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

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

bug:2848
added two options for the slideshow

ToDo lang var

File size: 3.0 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// Need upgrade?
16global $conf;
17include(PHPWG_THEMES_PATH.'smartpocket/admin/upgrade.inc.php');
18
19
20// Redirect if page is not compatible with mobile theme
21/*if (!in_array(script_basename(), array('index', 'register', 'profile', 'identification', 'ws', 'admin')))
22  redirect(duplicate_index_url());
23*/
24
25//Retrive all pictures on thumbnails page
26add_event_handler('loc_index_thumbnails_selection', 'sp_select_all_thumbnails');
27
28function sp_select_all_thumbnails($selection)
29{
30  global $page, $template;
31
32  $template->assign('page_selection', array_flip($selection));
33
34  return $page['items'];
35}
36
37// Retrive all categories on thumbnails page
38add_event_handler('loc_end_index_category_thumbnails', 'sp_select_all_categories');
39
40function sp_select_all_categories($selection)
41{
42  global $tpl_thumbnails_var;
43  return $tpl_thumbnails_var;
44}
45
46// Get better derive parameters for screen size
47$type = IMG_LARGE;
48if (!empty($_COOKIE['screen_size']))
49{
50  $screen_size = explode('x', $_COOKIE['screen_size']);
51  $derivative_params = new ImageStdParams;
52  $derivative_params->load_from_db();
53
54  foreach ($derivative_params->get_all_type_map() as $type => $map)
55  {
56    if (max($map->sizing->ideal_size) >= max($screen_size) and min($map->sizing->ideal_size) >= min($screen_size))
57      break;
58  }
59}
60
61$this->assign('picture_derivative_params', ImageStdParams::get_by_type($type));
62$this->assign('thumbnail_derivative_params', ImageStdParams::get_by_type(IMG_SQUARE));
63
64//------------------------------------------------------------- mobile version & theme config
65add_event_handler('init', 'mobile_link');
66
67function mobile_link()
68{
69  global $template, $conf;
70  $config = unserialize( $conf['smartpocket'] );
71  $template->assign( 'smartpocket', $config );
72  if ( !empty($conf['mobile_theme']) && (get_device() != 'desktop' || mobile_theme()))
73  {
74    $template->assign(array(
75                            'TOGGLE_MOBILE_THEME_URL' => add_url_params(duplicate_index_url(),array('mobile' => mobile_theme() ? 'false' : 'true')),
76      ));
77  }
78}
79
80
81if ( !function_exists( 'add_menu_on_public_pages' ) ) { 
82  if ( defined('IN_ADMIN') and IN_ADMIN ) return false; 
83  add_event_handler('loc_after_page_header', 'add_menu_on_public_pages', 20); 
84
85  function  add_menu_on_public_pages() { 
86    if ( function_exists( 'initialize_menu') ) return false; # The current page has already the menu 
87    global $template, $page, $conf; 
88    if ( isset($page['body_id']) and $page['body_id']=="thePicturePage" ) 
89    {           
90      $template->set_filenames(array( 
91            'add_menu_on_public_pages' => dirname(__FILE__) . '/template/add_menu_on_public_pages.tpl', 
92      )); 
93      include_once(PHPWG_ROOT_PATH.'include/menubar.inc.php'); 
94      $template->parse('add_menu_on_public_pages');
95    }
96     
97     
98  } 
99} 
100
101
102?>
Note: See TracBrowser for help on using the repository browser.