1 | <?php |
---|
2 | /* |
---|
3 | Plugin Name: About 1 menu |
---|
4 | Version: auto |
---|
5 | Description: Add About as menu level 1 |
---|
6 | Plugin URI: http://piwigo.org/ext/extension_view.php?eid=478 |
---|
7 | Author: ddtddt |
---|
8 | Author URI: http://temmii.com/piwigo/ |
---|
9 | */ |
---|
10 | // +-----------------------------------------------------------------------+ |
---|
11 | // | About 1 menu plugin for piwigo by TEMMII | |
---|
12 | // +-----------------------------------------------------------------------+ |
---|
13 | // | Copyright(C) 2013-2021 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 | |
---|
30 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
31 | |
---|
32 | define('A1M_DIR' , basename(dirname(__FILE__))); |
---|
33 | define('A1M_PATH' , PHPWG_PLUGINS_PATH . A1M_DIR . '/'); |
---|
34 | |
---|
35 | add_event_handler('blockmanager_register_blocks', 'register_a1m_menubar_blocks'); |
---|
36 | add_event_handler('blockmanager_apply', 'a1m_apply'); |
---|
37 | |
---|
38 | function 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 | |
---|
46 | function a1m_apply($menu_ref_arr) |
---|
47 | { |
---|
48 | global $template,$user; |
---|
49 | |
---|
50 | $menu = & $menu_ref_arr[0]; |
---|
51 | |
---|
52 | $template->assign ( |
---|
53 | array ( |
---|
54 | 'A1MTITLE' => l10n('About Piwigo'), |
---|
55 | 'A1MNAME' => l10n('About'), |
---|
56 | 'A1MURL' => get_root_url().'about.php', |
---|
57 | ) ); |
---|
58 | |
---|
59 | |
---|
60 | if (($block = $menu->get_block( 'mbAbout' )) != null) { |
---|
61 | $template->set_template_dir(A1M_PATH.'template/'); |
---|
62 | if ($user['theme'] == 'bootstrapdefault'||$user['theme'] == 'bootstrap_darkroom'){ |
---|
63 | $block->template = 'menubar_about_Bootstrap_Default.tpl'; |
---|
64 | }else if ($user['theme'] == 'smartpocket'){ |
---|
65 | $block->template = 'menubar_about_smartpocket.tpl'; |
---|
66 | }else{ |
---|
67 | $block->template = 'menubar_about.tpl'; |
---|
68 | } |
---|
69 | } |
---|
70 | } |
---|
71 | |
---|
72 | |
---|
73 | ?> |
---|