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

Last change on this file since 14974 was 8104, checked in by ddtddt, 13 years ago

[extension] - About1menu - first release

File size: 1.2 KB
Line 
1<?php
2/*
3Plugin Name: About 1 menu
4Version: 1
5Description: Add About as menu level 1
6Plugin URI: http://piwigo.org
7Author: ddtddt
8Author URI:http://piwigo.org/ext/extension_view.php?eid=478
9*/
10
11if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
12
13define('A1M_DIR' , basename(dirname(__FILE__)));
14define('A1M_PATH' , PHPWG_PLUGINS_PATH . A1M_DIR . '/');
15
16add_event_handler('blockmanager_register_blocks', 'register_a1m_menubar_blocks');
17add_event_handler('blockmanager_apply', 'a1m_apply');
18
19function register_a1m_menubar_blocks( $menu_ref_arr )
20{
21  $menu = & $menu_ref_arr[0];
22  if ($menu->get_id() != 'menubar')
23    return;
24  $menu->register_block( new RegisteredBlock( 'mbAbout', 'About', 'A1M'));
25}
26
27function a1m_apply($menu_ref_arr)
28{
29  global $template;
30
31 $menu = & $menu_ref_arr[0];
32 
33     // Envoi des données au template
34            $template->assign   (
35                array   (
36        'A1MTITLE'     => l10n('About Piwigo'),
37        'A1MNAME'      => l10n('About'),
38        'A1MURL' => get_root_url().'about.php',
39                                )                       );
40
41   
42    if (($block = $menu->get_block( 'mbAbout' )) != null) {
43        $template->set_template_dir(A1M_PATH.'template/');
44        $block->template = 'menubar_about.tpl';
45    }
46}
47
48
49
50
51
52
53?>
Note: See TracBrowser for help on using the repository browser.