-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathjquery.inc.php
104 lines (94 loc) · 3.5 KB
/
jquery.inc.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
<?php
/**
* jQuery for CMSimple
*
* Include-file for use in CMSimple-Plugins
* to enable jQuery, jQueryUI
* and other jQuery-based plugins
*
* Version: 1.6.5
* Build: 2020072301
* Copyright: Holger Irmler
* Email: [email protected]
* Website: http://CMSimple.HolgerIrmler.de
* */
if (!defined('CMSIMPLE_XH_VERSION')) {
header('HTTP/1.0 403 Forbidden');
exit;
}
//be sure that all globals are accessible when called from another function
global $hjs, $plugin_cf, $pth;
function include_jQuery($path = '') {
global $pth, $plugin_cf, $hjs;
if (!defined('JQUERY')) {
if ($path == '') {
$path = $pth['folder']['plugins'] . 'jquery/lib/jquery/' . $plugin_cf['jquery']['version_core'] . '/jquery.min.js';
if (!is_file($path)) {
e('missing', 'file', $path);
return;
}
}
$js = '<script src="' . $path . '"></script>';
if ($plugin_cf['jquery']['load_migrate'] == 'true') {
$migrate = $pth['folder']['plugins'] . 'jquery/lib/migrate/' . $plugin_cf['jquery']['version_migrate'];
if (is_file($migrate)) {
$js .= "\n" . '<script src="' . $migrate . '"></script>';
$js .= "\n";
} else {
e('missing', 'file', $migrate);
return;
}
}
$hjs = $js . $hjs;
define('JQUERY', TRUE);
}
}
function include_jQueryUI($path = '') {
global $pth, $plugin_cf, $hjs;
if (!defined('JQUERY_UI')) {
if ($path == '') {
$path = $pth['folder']['plugins'] . 'jquery/lib/jquery_ui/' . $plugin_cf['jquery']['version_ui'] . '/jquery-ui.min.js';
if (!is_file($path)) {
e('missing', 'file', $path);
return;
}
}
$hjs .= "\n" . '<script src="' . $path . '"></script>';
define('JQUERY_UI', TRUE);
if (file_exists($pth['folder']['template'] . 'jquery_ui/jquery_ui.css')) {
//load a complete custom ui-theme
$hjs .= "\n" . tag('link rel="stylesheet" type="text/css" media="screen" href="'
. $pth['folder']['template'] . 'jquery_ui/jquery_ui.css"');
} else {
//load the default theme
$hjs .= "\n" . tag('link rel="stylesheet" type="text/css" media="screen" href="' . $pth['folder']['plugins']
. 'jquery/lib/jquery_ui/' . $plugin_cf['jquery']['version_ui'] . '/css/jquery-ui.min.css"');
$hjs .= "\n";
//include a custom css-file to overwrite single selectors
if (file_exists($pth['folder']['template'] . 'jquery_ui/stylesheet.css')) {
$hjs .= "\n" . tag('link rel="stylesheet" type="text/css" media="screen" href="'
. $pth['folder']['template'] . 'jquery_ui/stylesheet.css"')
. "\n";
}
}
}
}
function include_jQueryPlugin($name = '', $path = '') {
global $hjs, $jQueryPlugins;
if (!isset($jQueryPlugins)) {
$jQueryPlugins = array();
}
if (defined('JQUERY')) {
if ($name != '') {
if (!file_exists($path)) {
e('missing', 'file', $path);
return;
}
$name = strtolower($name);
if (!in_array($name, $jQueryPlugins)) {
$hjs .= "\n" . '<script src="' . $path . '"></script>';
$jQueryPlugins[] .= $name;
}
}
}
}