source: extensions/whois_online_menu/main.inc.php

Last change on this file was 32431, checked in by ddtddt, 3 years ago

[whois_online_menu] check whois_online is activate / add class by line

File size: 3.3 KB
Line 
1<?php
2/*
3Plugin Name: Whois Online in menu
4Version: auto
5Description: Add info whois_online in the menubar
6Plugin URI:http://piwigo.org/ext/extension_view.php?eid=619
7Author: ddtddt
8Author URI: http://temmii.com/piwigo/
9*/
10
11// +-----------------------------------------------------------------------+
12// | Whois Online menu plugin for piwigo  by TEMMII                        |
13// +-----------------------------------------------------------------------+
14// | Copyright(C) 2011-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('W1M_DIR' , basename(dirname(__FILE__)));
34define('W1M_PATH' , PHPWG_PLUGINS_PATH . W1M_DIR . '/');
35
36add_event_handler('loading_lang', 'w1m_loading_lang');   
37function w1m_loading_lang(){
38  load_language('plugin.lang', W1M_PATH);
39  load_language('lang', PHPWG_ROOT_PATH.PWG_LOCAL_DIR, array('no_fallback'=>true, 'local'=>true) );
40}
41
42
43$wonacc = pwg_db_fetch_assoc(pwg_query("SELECT state FROM " . PLUGINS_TABLE . " WHERE id = 'whois_online';"));
44
45if($wonacc['state'] != 'active'){
46        if (script_basename() == 'admin'){
47        global $page;
48        load_language('plugin.lang', W1M_PATH);
49        $page['errors'][] = l10n('For use "Whois Online in menu" the plugin whois_online must be installed and activated');
50  }     
51}
52else{
53add_event_handler('blockmanager_register_blocks', 'register_w1m_menubar_blocks');
54add_event_handler('blockmanager_apply', 'w1m_apply');
55
56function register_w1m_menubar_blocks( $menu_ref_arr ){
57  $menu = & $menu_ref_arr[0];
58  if ($menu->get_id() != 'menubar')
59  return;
60  $menu->register_block( new RegisteredBlock( 'mbWonline', 'Wonline', 'W1M'));
61}
62
63function w1m_apply($menu_ref_arr){
64  global $template;
65  $menu = & $menu_ref_arr[0];
66  $template->assign     (
67        array(
68      'W1MTITLE'     => l10n('Whois Online'),
69  ));
70
71  $template->assign('W1M_PATH', W1M_PATH);
72  if (($block = $menu->get_block( 'mbWonline' )) != null) {
73        $template->set_template_dir(W1M_PATH.'template/');
74        $block->template = 'report_about.tpl';
75  }
76}
77
78add_event_handler('loc_begin_page_header', 'WHE1',20 );
79function WHE1(){
80  global $template;
81  $cachewol='';
82  $template->append('head_elements', $cachewol);
83}
84}
85
86?>
Note: See TracBrowser for help on using the repository browser.