-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
146 lines (133 loc) · 5.99 KB
/
index.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
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
<?php
/*
* hi_FancyBox for CMSimple - main module
*
* A simple plugin to include FancyBox (http://fancybox.net)
* and apply it to predefined css-classes
*
* @author Holger Irmler
* @link http://CMSimple.HolgerIrmler.de
*
* @copyright 2025 The CMSimple_XH developers <https://www.cmsimple-xh.org/?The_Team>
* @author The CMSimple_XH developers <[email protected]>
*
* @license GNU GPLv3 - http://www.gnu.org/licenses/gpl-3.0.en.html
*
* @version 4.2
* @date: 2025-02-17
* @build: 2025021701
*/
if ((!function_exists('sv'))
|| preg_match('#hi_fancybox' . preg_quote(DIRECTORY_SEPARATOR, '#') . 'index.php#i',
sv('PHP_SELF'))) {
die('Access denied');
}
function fancybox() {
global $bjs, $hjs, $o, $plugin_cf, $plugin_tx, $pth;
$fcbJs = '';
//Read settings for FancyBox from plugin_cf
$fcbSettings = '';
foreach ($plugin_cf['hi_fancybox'] as $key => $val) {
if (substr($key, 0, 4) == 'fcb_') {
$val == '' ? $val = 'false' : $val;
$fcbSettings .= substr($key, 4) . ': ' . $val . ',';
}
}
$onComplete = "fancyboxNavHide();";
$onClosed = '';
if ($plugin_cf['hi_fancybox']['activate_touchsupport']) {
$onComplete = "window.addEventListener('orientationchange', "
. "fcbOrientationChanged);"
. $onComplete;
$onClosed = "window.removeEventListener('orientationchange', "
. "fcbOrientationChanged);";
$fcbJs .= "\n" .
'<script type="text/javascript">
/* <![CDATA[ */
var fcbOrientationChanged = function () {
$.fancybox.refresh();
};
/* ]]> */
</script>' . "\n";
}
$fcbSettings .=
"'onComplete' : function() { "
. $onComplete
. " },";
$fcbSettings .=
"'onClosed' : function() { "
. $onClosed
. " },";
//remove last comma
$fcbSettings = substr($fcbSettings, 0, -1);
//Write the Script-tags to head section
//include jQuery-Plugin for CMSimple
if (!file_exists($pth['folder']['plugins'] . 'jquery/jquery.inc.php')) {
$o .= '<div class="cmsimplecore_warning">' .
$plugin_tx['hi_fancybox']['jquery_missing'] .
'</div>';
//drop the rest of the plugin-code
return($o);
} else {
//load inculde-file from jQuery-plugin
include_once($pth['folder']['plugins'] . 'jquery/jquery.inc.php');
//include jQuery to the <head>
include_jQuery();
//and the plugins...
include_jQueryPlugin('fancybox', $pth['folder']['base'] . 'plugins/hi_fancybox/libs/fancybox/jquery.fancybox.min.js');
//stylesheet
$hjs .= "\n"
. '<link rel="stylesheet" type="text/css" media="screen" href="'
. $pth['folder']['base']
. 'plugins/hi_fancybox/libs/fancybox/jquery.fancybox.min.css">';
$hjs .= "\n";
//include_jQueryPlugin('easing', $pth['folder']['base'] . 'plugins/hi_fancybox/libs/fancybox/fancybox-1.3.4/jquery.easing-1.3.pack.js');
if ($plugin_cf['hi_fancybox']['activate_mousewheel']) {
include_jQueryPlugin('mousewheel', $pth['folder']['base'] . 'plugins/hi_fancybox/libs/fancybox/jquery.mousewheel-3.1.2.min.js');
}
if ($plugin_cf['hi_fancybox']['activate_touchsupport']) {
include_jQueryPlugin('jquery.mobile.touch', $pth['folder']['base'] . 'plugins/hi_fancybox/libs/fancybox/jquery.mobile.custom.min.js');
include_jQueryPlugin('fancybox.touch', $pth['folder']['base'] . 'plugins/hi_fancybox/libs/fancybox/fancybox.touch.min.js');
}
//apply fancybox
$plugin_cf['hi_fancybox']['nav_hide_title'] == "" ? $hideTitle = "false" : $hideTitle = "true";
$fcbJs .= "\n" .
'<script type="text/javascript">
/* <![CDATA[ */
jQuery(document).ready(function($){
$("' . $plugin_cf['hi_fancybox']['class_single'] . '").fancybox({' . $fcbSettings . '});
$("' . $plugin_cf['hi_fancybox']['class_group'] . '").attr(\'rel\', \'gallery\').fancybox({' . $fcbSettings . '});
$("' . $plugin_cf['hi_fancybox']['class_iframe'] . '").fancybox({' . $fcbSettings . ', autoscale: false, type: \'iframe\'});
$("#gallery_main a[rel^=\'fancybox\']").fancybox({' . $fcbSettings . ', type: \'image\'}); //for lb_Gallery
var fcbtimer = false;
function fancyboxNavHide() {
var duration = '. $plugin_cf['hi_fancybox']['nav_duration_hide'] .';
var hideTitle = '. $hideTitle .';
clearTimeout(fcbtimer);
$(\'span#fancybox-left-ico\').addClass(\'fancybox-left-ico-show\');
$(\'#fancybox-right-ico\').addClass(\'fancybox-right-ico-show\');
$(\'#fancybox-title\').show();
fcbtimer = setTimeout(function () {
$(\'span#fancybox-left-ico\').removeClass(\'fancybox-left-ico-show\');
$(\'span#fancybox-right-ico\').removeClass(\'fancybox-right-ico-show\');
if (hideTitle) {
$(\'div#fancybox-title.fancybox-title-over\').fadeOut(\'fast\');
}
}, duration);
}
$(\'#fancybox-wrap\').on(\'click\', function () {
fancyboxNavHide();
});
});
/* ]]> */
</script>' . "\n";
if (isset($bjs)) {
$bjs .= $fcbJs;
} else {
$hjs .= $fcbJs;
}
}
}
if ($plugin_cf['hi_fancybox']['activate_global'] && !$edit) {
fancybox();
}