1 | <?php |
---|
2 | /* |
---|
3 | Plugin Name: Add < head > element |
---|
4 | Version: auto |
---|
5 | Description: Add element to tag < head > |
---|
6 | Plugin URI: http://piwigo.org/ext/extension_view.php?eid=582 |
---|
7 | Author: ddtddt |
---|
8 | Author URI: http://temmii.com/piwigo/ |
---|
9 | Has Settings: webmaster |
---|
10 | */ |
---|
11 | |
---|
12 | // +-----------------------------------------------------------------------+ |
---|
13 | // | Add < head > element plugin for piwigo by TEMMII | |
---|
14 | // +-----------------------------------------------------------------------+ |
---|
15 | // | Copyright(C) 2011 - 2021 ddtddt http://temmii.com/piwigo/ | |
---|
16 | // +-----------------------------------------------------------------------+ |
---|
17 | // | This program is free software; you can redistribute it and/or modify | |
---|
18 | // | it under the terms of the GNU General Public License as published by | |
---|
19 | // | the Free Software Foundation | |
---|
20 | // | | |
---|
21 | // | This program is distributed in the hope that it will be useful, but | |
---|
22 | // | WITHOUT ANY WARRANTY; without even the implied warranty of | |
---|
23 | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
---|
24 | // | General Public License for more details. | |
---|
25 | // | | |
---|
26 | // | You should have received a copy of the GNU General Public License | |
---|
27 | // | along with this program; if not, write to the Free Software | |
---|
28 | // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
---|
29 | // | USA. | |
---|
30 | // +-----------------------------------------------------------------------+ |
---|
31 | |
---|
32 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
33 | |
---|
34 | global $prefixeTable; |
---|
35 | |
---|
36 | define('AHE_DIR' , basename(dirname(__FILE__))); |
---|
37 | define('AHE_PATH' , PHPWG_PLUGINS_PATH . AHE_DIR . '/'); |
---|
38 | define('AHE_ADMIN' , get_root_url().'admin.php?page=plugin-'.AHE_DIR); |
---|
39 | |
---|
40 | add_event_handler('loading_lang', 'Add_head_element_loading_lang'); |
---|
41 | function Add_head_element_loading_lang(){ |
---|
42 | load_language('plugin.lang', AHE_PATH); |
---|
43 | } |
---|
44 | /* |
---|
45 | add_event_handler('get_admin_plugin_menu_links', 'AHE_admin_menu'); |
---|
46 | function AHE_admin_menu($menu){ |
---|
47 | if (is_webmaster()){ |
---|
48 | load_language('plugin.lang', AHE_PATH); |
---|
49 | $menu[] = array( |
---|
50 | 'NAME' => l10n('Add < head > element'), |
---|
51 | 'URL' => AHE_ADMIN, |
---|
52 | ); |
---|
53 | } |
---|
54 | return $menu; |
---|
55 | }*/ |
---|
56 | |
---|
57 | |
---|
58 | //add in <head> |
---|
59 | add_event_handler('loc_begin_page_header', 'AHE1',20 ); |
---|
60 | function AHE1(){ |
---|
61 | global $template,$conf; |
---|
62 | if (isset($conf['add_head_element_apply_on'])) |
---|
63 | { |
---|
64 | if (!is_array($conf['add_head_element_apply_on'])) |
---|
65 | { |
---|
66 | $conf['add_head_element_apply_on'] = explode(',', $conf['add_head_element_apply_on']); |
---|
67 | } |
---|
68 | |
---|
69 | if (defined('IN_ADMIN') and IN_ADMIN) |
---|
70 | { |
---|
71 | // we are in the administration |
---|
72 | if (!in_array('admin', $conf['add_head_element_apply_on'])) |
---|
73 | { |
---|
74 | return; |
---|
75 | } |
---|
76 | } |
---|
77 | else |
---|
78 | { |
---|
79 | // we are in the gallery |
---|
80 | if (!in_array('gallery', $conf['add_head_element_apply_on'])) |
---|
81 | { |
---|
82 | return; |
---|
83 | } |
---|
84 | } |
---|
85 | |
---|
86 | } |
---|
87 | |
---|
88 | if (!empty($conf['add_head_element'])) |
---|
89 | { |
---|
90 | $template->append('head_elements', $conf['add_head_element']); |
---|
91 | } |
---|
92 | } |
---|
93 | ?> |
---|