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