-
Notifications
You must be signed in to change notification settings - Fork 1
/
CustomContent.php
64 lines (53 loc) · 1.96 KB
/
CustomContent.php
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
<?php
/*
** --------------------------------------------------------------
** MantisBT CustomContent Plugin
** --------------------------------------------------------------
** v1.0.180824
**
** Copyright (c) 2017-2018, Ryadel - https://www.ryadel.com/
** Released under the GNU General Public License v3 - http://opensource.org/licenses/GPL-3.0
*/
class CustomContentPlugin extends MantisPlugin {
public function register() {
$this->name = 'CustomContent Plugin';
$this->description = 'Enables the usage of various configuration parameters to insert custom HTML, PHP, JS and/or CSS content in the Mantis HTML layout';
$this->version = '0.1.0';
$this->requires = array(
'MantisCore' => '2.0.0'
);
$this->author = 'Ryadel';
$this->contact = '[email protected]';
$this->url = 'https://www.ryadel.com/';
}
public function hooks() {
return array(
'EVENT_LAYOUT_RESOURCES' => 'custom_head',
'EVENT_LAYOUT_BODY_BEGIN' => 'custom_body_begin',
'EVENT_LAYOUT_BODY_END' => 'custom_body_end',
'EVENT_LAYOUT_PAGE_HEADER' => 'custom_page_header',
'EVENT_LAYOUT_PAGE_FOOTER' => 'custom_page_footer'
);
}
public function custom_head($p_event) {
$this->custom_render('custom_head_file');
}
public function custom_body_begin($p_event) {
$this->custom_render('custom_body_begin_file');
}
public function custom_body_end($p_event) {
$this->custom_render('custom_body_end_file');
}
public function custom_page_header($p_event) {
$this->custom_render('custom_page_header_file');
}
public function custom_page_footer($p_event) {
$this->custom_render('custom_page_footer_file');
}
private function custom_render($key) {
$t_page = config_get_global($key);
if( !is_blank( $t_page ) && file_exists( $t_page ) && !is_dir( $t_page ) ) {
include( $t_page );
}
}
}