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

Last change on this file since 25973 was 18824, checked in by mistic100, 11 years ago

update for ContactForm 2.5

File size: 1.7 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{
20  if (script_basename() == 'admin')   
21  {
22    include_once(dirname(__FILE__).'/initadmin.php');
23  }
24}
25else
26{
27  add_event_handler('blockmanager_register_blocks', 'register_c1m_menubar_blocks');
28  add_event_handler('blockmanager_apply', 'c1m_apply');
29
30  function register_c1m_menubar_blocks( $menu_ref_arr )
31  {
32    $menu = & $menu_ref_arr[0];
33    if ($menu->get_id() != 'menubar')
34      return;
35    $menu->register_block( new RegisteredBlock( 'mbContact', 'Contact', 'C1M'));
36  }
37
38  function c1m_apply($menu_ref_arr)
39  {
40    global $template;
41
42    $menu = & $menu_ref_arr[0];
43   
44    load_language('plugin.lang', CONTACT_FORM_PATH);
45    load_language('lang', PHPWG_ROOT_PATH.PWG_LOCAL_DIR, array('no_fallback'=>true, 'local'=>true) );
46    // Envoi des données au template
47    $template->assign(array(
48      'C1MTITLE'     => l10n('Contact'),
49      'C1MNAME'      => l10n('Contact'),
50      'C1MURL'       => CONTACT_FORM_PUBLIC,
51      ));
52
53     
54    if (($block = $menu->get_block( 'mbContact' )) != null)
55    {
56      $template->set_template_dir(C1M_PATH.'template/');
57      $block->template = 'menubar_contact.tpl';
58    }
59  }
60}
61
62?>
Note: See TracBrowser for help on using the repository browser.