source: extensions/Contact1menu/main.inc.php @ 18822

Last change on this file since 18822 was 18822, checked in by plg, 11 years ago

load local language files

File size: 1.6 KB
Line 
1<?php
2/*
3Plugin Name: Contact 1 menu
4Version: auto
5Description: Add contact as menu level 1
6Plugin URI: http://piwigo.org/ext/extension_view.php?eid=479
7Author: ddtddt
8Author URI:http://piwigo.org
9*/
10
11if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
12
13define('C1M_DIR' , basename(dirname(__FILE__)));
14define('C1M_PATH' , PHPWG_PLUGINS_PATH . C1M_DIR . '/');
15
16$desacc = pwg_db_fetch_assoc(pwg_query("SELECT state FROM " . PLUGINS_TABLE . " WHERE id = 'ContactForm';"));
17
18if($desacc['state'] != 'active') 
19        {
20if (script_basename() == 'admin')   
21{
22  include_once(dirname(__FILE__).'/initadmin.php');
23}
24        }
25else
26        {
27
28add_event_handler('blockmanager_register_blocks', 'register_c1m_menubar_blocks');
29add_event_handler('blockmanager_apply', 'c1m_apply');
30
31function register_c1m_menubar_blocks( $menu_ref_arr )
32{
33  $menu = & $menu_ref_arr[0];
34  if ($menu->get_id() != 'menubar')
35    return;
36  $menu->register_block( new RegisteredBlock( 'mbContact', 'Contact', 'C1M'));
37}
38
39function c1m_apply($menu_ref_arr)
40{
41  global $template;
42
43 $menu = & $menu_ref_arr[0];
44 
45 load_language('plugin.lang', CF_PATH);
46 load_language('lang', PHPWG_ROOT_PATH.PWG_LOCAL_DIR, array('no_fallback'=>true, 'local'=>true) );
47     // Envoi des données au template
48            $template->assign   (
49                array   (
50        'C1MTITLE'     => l10n('contact_form_title'),
51        'C1MNAME'      => l10n('contact_form'),
52        'C1MURL' => get_root_url().'index.php?/contact',
53                                )                       );
54
55   
56    if (($block = $menu->get_block( 'mbContact' )) != null) {
57        $template->set_template_dir(C1M_PATH.'template/');
58        $block->template = 'menubar_contact.tpl';
59    }
60}
61        }
62
63?>
Note: See TracBrowser for help on using the repository browser.