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

Last change on this file since 32860 was 32385, checked in by ddtddt, 4 years ago

[Contact1menu] piwigo 11

File size: 3.3 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://temmii.com/piwigo/
9*/
10
11// +-----------------------------------------------------------------------+
12// | Contact 1 menu plugin for piwigo  by TEMMII                           |
13// +-----------------------------------------------------------------------+
14// | Copyright(C) 2010 - 2021 ddtddt             http://temmii.com/piwigo/ |
15// +-----------------------------------------------------------------------+
16// | This program is free software; you can redistribute it and/or modify  |
17// | it under the terms of the GNU General Public License as published by  |
18// | the Free Software Foundation                                          |
19// |                                                                       |
20// | This program is distributed in the hope that it will be useful, but   |
21// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
22// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
23// | General Public License for more details.                              |
24// |                                                                       |
25// | You should have received a copy of the GNU General Public License     |
26// | along with this program; if not, write to the Free Software           |
27// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
28// | USA.                                                                  |
29// +-----------------------------------------------------------------------+
30
31if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
32
33define('C1M_DIR' , basename(dirname(__FILE__)));
34define('C1M_PATH' , PHPWG_PLUGINS_PATH . C1M_DIR . '/');
35
36$desacc = pwg_db_fetch_assoc(pwg_query("SELECT state FROM " . PLUGINS_TABLE . " WHERE id = 'ContactForm';"));
37
38if($desacc['state'] != 'active') 
39{
40  if (script_basename() == 'admin')   
41  {
42    include_once(dirname(__FILE__).'/initadmin.php');
43  }
44}
45else
46{
47  add_event_handler('blockmanager_register_blocks', 'register_c1m_menubar_blocks');
48  add_event_handler('blockmanager_apply', 'c1m_apply');
49
50  function register_c1m_menubar_blocks( $menu_ref_arr )
51  {
52    $menu = & $menu_ref_arr[0];
53    if ($menu->get_id() != 'menubar')
54      return;
55    $menu->register_block( new RegisteredBlock( 'mbContact', 'Contact', 'C1M'));
56  }
57
58  function c1m_apply($menu_ref_arr)
59  {
60    global $template, $user;
61    $menu = & $menu_ref_arr[0];
62   
63    load_language('plugin.lang', CONTACT_FORM_PATH);
64    load_language('lang', PHPWG_ROOT_PATH.PWG_LOCAL_DIR, array('no_fallback'=>true, 'local'=>true) );
65    $template->assign(array(
66      'C1MTITLE'     => l10n('Contact'),
67      'C1MNAME'      => l10n('Contact'),
68      'C1MURL'       => CONTACT_FORM_PUBLIC,
69      ));
70
71     
72    if (($block = $menu->get_block( 'mbContact' )) != null)
73    {
74      $template->set_template_dir(C1M_PATH.'template/');
75        if ($user['theme'] == 'bootstrapdefault'){
76                  $block->template = 'menubar_contact_Bootstrap_Default.tpl';           
77                }else if ($user['theme'] == 'smartpocket'){
78                  $block->template = 'menubar_contact_smartpocket.tpl';         
79                }else{
80                  $block->template = 'menubar_contact.tpl';
81                }
82    }
83  }
84}
85
86?>
Note: See TracBrowser for help on using the repository browser.