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

Last change on this file since 24928 was 24928, checked in by ddtddt, 11 years ago

[trunk] - smartpocket - prepared 2.5.3

File size: 3.0 KB
RevLine 
[13182]1<?php
2/*
3Theme Name: Smart Pocket
[24928]4Version: 2.5.1
[13182]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);
[13234]14
[23718]15// Need upgrade?
16global $conf;
17include(PHPWG_THEMES_PATH.'smartpocket/admin/upgrade.inc.php');
18
19
[13545]20// Redirect if page is not compatible with mobile theme
[23713]21/*if (!in_array(script_basename(), array('index', 'register', 'profile', 'identification', 'ws', 'admin')))
[13545]22  redirect(duplicate_index_url());
[23713]23*/
[13545]24
[13234]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
[19009]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
[13545]46// Get better derive parameters for screen size
[21779]47$type = IMG_LARGE;
[13545]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
[21779]61$this->assign('picture_derivative_params', ImageStdParams::get_by_type($type));
[13545]62$this->assign('thumbnail_derivative_params', ImageStdParams::get_by_type(IMG_SQUARE));
63
[23718]64//------------------------------------------------------------- mobile version & theme config
[23716]65add_event_handler('init', 'mobile_link');
[23713]66
[23716]67function mobile_link()
68{
69  global $template, $conf;
[23718]70  $config = unserialize( $conf['smartpocket'] );
71  $template->assign( 'smartpocket', $config );
[23716]72  if ( !empty($conf['mobile_theme']) && (get_device() != 'desktop' || mobile_theme()))
73  {
[23718]74    $template->assign(array(
75                            'TOGGLE_MOBILE_THEME_URL' => add_url_params(duplicate_index_url(),array('mobile' => mobile_theme() ? 'false' : 'true')),
76      ));
[23716]77  }
78}
[23713]79
[23716]80
[23713]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
[13182]102?>
Note: See TracBrowser for help on using the repository browser.