forked from infojunkie/MantisBT-Lightbox
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLightbox.php
More file actions
64 lines (57 loc) · 2.38 KB
/
Lightbox.php
File metadata and controls
64 lines (57 loc) · 2.38 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
<?php
/**
* Lightbox Integration
* Copyright (C) 2015 Karim Ratib (karim.ratib@gmail.com) and Kaue Santoja (shinjiiraki@gmail.com)
* MantisBT 2.x port Copyright (C) 2025 Marco Wobben (marcow@bcp-software.nl)
*
* Lightbox Integration is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License 2
* as published by the Free Software Foundation.
*
* Lightbox Integration is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Lightbox Integration; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
* or see http://www.gnu.org/licenses/.
*/
class LightboxPlugin extends MantisPlugin {
function register() {
$this->name = plugin_lang_get('title');
$this->description = plugin_lang_get('description');
$this->version = '1.2';
$this->page = 'config';
$this->requires = array(
'MantisCore' => '2.25.0',
);
$this->author = 'Karim Ratib, Kaue Santoja; MantisBT 2.x port by Marco Wobben';
$this->contact = 'marcow@bcp-software.nl';
$this->url = 'https://github.com/bcp-software/MantisBT-Lightbox';
}
/**
* Default plugin configuration.
*/
function config() {
return array(
'display_on_img_preview' => ON,
'display_on_img_link' => OFF,
'img_extensions' => 'jpg,jpeg,png,gif'
);
}
function hooks() {
return array(
'EVENT_LAYOUT_RESOURCES' => 'add_lightbox',
);
}
function add_lightbox($event) {
$currentUrl = explode('/', $_SERVER['PHP_SELF']);
if (end($currentUrl) !== 'view.php') return;
return '<script type="text/javascript" src="' . plugin_page( 'vars' ) . '" defer></script>' .
'<link href="' . plugin_file( 'lightbox/css/lightbox.css' ) . '" rel="stylesheet">' .
'<script type="text/javascript" src="' . plugin_file( 'Lightbox.js' ) . '" defer></script>' .
'<script type="text/javascript" src="' . plugin_file( 'lightbox/js/lightbox-min.js' ) . '" defer></script>';
}
}