source: extensions/About1menu/main.inc.php @ 32052

Revision 32038, 2.9 KB checked in by ddtddt, 3 weeks ago (diff)

[extensions] - About1menu - design smartpocket and bootstrap

Line 
1<?php
2/*
3Plugin Name: About 1 menu
4Version: auto
5Description: Add About as menu level 1
6Plugin URI: http://piwigo.org/ext/extension_view.php?eid=478
7Author: ddtddt
8Author URI: http://temmii.com/piwigo/
9*/
10// +-----------------------------------------------------------------------+
11// | About 1 menu plugin for piwigo                                        |
12// +-----------------------------------------------------------------------+
13// | Copyright(C) 2013-2020 ddtddt               http://temmii.com/piwigo/ |
14// +-----------------------------------------------------------------------+
15// | This program is free software; you can redistribute it and/or modify  |
16// | it under the terms of the GNU General Public License as published by  |
17// | the Free Software Foundation                                          |
18// |                                                                       |
19// | This program is distributed in the hope that it will be useful, but   |
20// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
21// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
22// | General Public License for more details.                              |
23// |                                                                       |
24// | You should have received a copy of the GNU General Public License     |
25// | along with this program; if not, write to the Free Software           |
26// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
27// | USA.                                                                  |
28// +-----------------------------------------------------------------------+
29
30if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
31
32define('A1M_DIR' , basename(dirname(__FILE__)));
33define('A1M_PATH' , PHPWG_PLUGINS_PATH . A1M_DIR . '/');
34
35add_event_handler('blockmanager_register_blocks', 'register_a1m_menubar_blocks');
36add_event_handler('blockmanager_apply', 'a1m_apply');
37
38function register_a1m_menubar_blocks( $menu_ref_arr )
39{
40  $menu = & $menu_ref_arr[0];
41  if ($menu->get_id() != 'menubar')
42    return;
43  $menu->register_block( new RegisteredBlock( 'mbAbout', 'About', 'A1M'));
44}
45
46function a1m_apply($menu_ref_arr)
47{
48  global $template,$user;
49
50 $menu = & $menu_ref_arr[0];
51 
52     // Envoi des données au template
53            $template->assign   (
54                array   (
55        'A1MTITLE'     => l10n('About Piwigo'),
56        'A1MNAME'      => l10n('About'),
57        'A1MURL' => get_root_url().'about.php',
58                                )                       );
59
60   
61    if (($block = $menu->get_block( 'mbAbout' )) != null) {
62        $template->set_template_dir(A1M_PATH.'template/');
63        if ($user['theme'] == 'bootstrapdefault'||$user['theme'] == 'bootstrap_darkroom'){
64                  $block->template = 'menubar_about_Bootstrap_Default.tpl';             
65                }else if ($user['theme'] == 'smartpocket'){
66                  $block->template = 'menubar_about_smartpocket.tpl';           
67                }else{
68                  $block->template = 'menubar_about.tpl';
69                }
70    }
71}
72
73
74
75
76
77
78?>
Note: See TracBrowser for help on using the repository browser.