source: extensions/block_search/main.inc.php @ 32881

Last change on this file since 32881 was 32432, checked in by ddtddt, 4 years ago

[block_search]

File size: 2.5 KB
Line 
1<?php
2/*
3Plugin Name:  Block search
4Version: auto
5Description: Add a block search
6Plugin URI: https://piwigo.org/ext/extension_view.php?eid=896
7Author: ddtddt
8Author URI: http://temmii.com/piwigo/
9*/
10
11// +-----------------------------------------------------------------------+
12// |Block search for Piwigo by TEMMII                                      |
13// +-----------------------------------------------------------------------+
14// | Copyright(C) 2020 - 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
31defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
32
33define('BSEARCH_PATH' , PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/');
34
35add_event_handler('loading_lang', 'bsearch_loading_lang');       
36function bsearch_loading_lang(){
37  load_language('plugin.lang', BSEARCH_PATH);
38}
39
40$PWGSacc = pwg_db_fetch_assoc(pwg_query("SELECT state FROM " . PLUGINS_TABLE . " WHERE id = 'PWG_Stuffs';"));
41
42if($PWGSacc['state'] == 'active'){
43  add_event_handler('get_stuffs_modules', 'register_bsearch_module');
44
45  function register_bsearch_module($modules){
46        array_push($modules, array(
47          'path' => BSEARCH_PATH.'/blocksearch',
48          'name' => l10n('Search'),
49          'description' => l10n('Add Search block'),
50        ));
51        return $modules;
52  }
53}else{
54  if (script_basename() == 'admin'){
55        global $page;
56        load_language('plugin.lang', BSEARCH_PATH);
57        $page['errors'][] = l10n('For use "Block search" the plugin PWG_Stuffs must be installed and activated');
58  }     
59}
Note: See TracBrowser for help on using the repository browser.