-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.inc.php
More file actions
executable file
·163 lines (111 loc) · 3.37 KB
/
main.inc.php
File metadata and controls
executable file
·163 lines (111 loc) · 3.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<?php
/*
Plugin Name: Fancy Footer
Version: 1.0.5
Description: Enables a fancy footer below photo gallery
Plugin URI: http://piwigo.org/ext/extension_view.php?eid=862
Author: cccraig
*/
if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
// +-----------------------------------------------------------------------+
// | Define plugin constants |
// +-----------------------------------------------------------------------+
define('FANCY_FOOTER_ID', basename(dirname(__FILE__)));
define('FANCY_FOOTER_PATH' , PHPWG_PLUGINS_PATH . FANCY_FOOTER_ID . '/');
define('FANCY_FOOTER_ADMIN', get_root_url() . 'admin.php?page=plugin-' . FANCY_FOOTER_ID);
define('FANCY_FOOTER_VERSION', '1.0.3');
// +-----------------------------------------------------------------------+
// | Event handlers |
// +-----------------------------------------------------------------------+
add_event_handler('loc_end_page_tail', 'insert_fancy_footer');
add_event_handler('get_admin_plugin_menu_links', 'fancy_footer_admin_menu');
add_event_handler('init', 'fancy_footer_lang_init');
add_event_handler('loc_begin_page_header', 'fancy_footer_styles', 40, 2);
// +-----------------------------------------------------------------------+
// | functions |
// +-----------------------------------------------------------------------+
/*
* Loads translations
*/
function fancy_footer_lang_init(){
load_language('plugin.lang', FANCY_FOOTER_PATH);
}
/*
* Initializes the admin menu
*/
function fancy_footer_admin_menu( $menu ) {
array_push(
$menu,
array(
'NAME' => 'FancyFooter',
'URL' => get_admin_plugin_menu_link(dirname(__FILE__)).'/admin.php'
)
);
return $menu;
}
/*
* Catch the page end and insert our footer template
*/
function insert_fancy_footer( ) {
if(script_basename() != 'admin') {
/*
* Globals
*/
global $template, $page;
/*
* Retrieve footer configuration variable
*/
$data = unserialize(conf_get_param(FANCY_FOOTER_ID));
/*
* Assign these to the template
*/
$template -> assign($data);
/*
* Assign file path to template
*/
$template -> assign('FANCY_FOOTER_STYLE', realpath(FANCY_FOOTER_PATH));
/*
* Specify the footer template file
*/
$template -> set_filename('FOOTER', realpath(FANCY_FOOTER_PATH . 'footer.tpl'));
/*
* Parse template file and append to main template
*/
$template -> append('footer_elements', $template -> parse('FOOTER', false));
}
}
/*
* Catch the page end and insert our footer template
*/
function fancy_footer_styles() {
if(script_basename() != 'admin') {
/*
* Globals
*/
global $template;
/*
* Retrieve the current user theme
*/
$query = 'SELECT theme FROM ' . USER_INFOS_TABLE . ';';
$theme = pwg_db_fetch_assoc(pwg_query($query));
$theme = $theme['theme'];
// We have bootstrap darkroom theme
if ($theme == "bootstrap_darkroom") {
$path = 'plugins/FancyFooter/css/default.css';
} elseif ($theme == 'bootstrapdefault') {
$path = 'plugins/FancyFooter/css/boots.css';
} else {
$path = 'plugins/FancyFooter/css/clear.css';
}
/*
* Specify the header template file path
*/
$template -> func_combine_css(
array(
'id' => 'fancy_footer',
'path' => $path
)
);
}
}
?>