forked from projectsend/projectsend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
assets.php
174 lines (157 loc) · 5.62 KB
/
assets.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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
<?php
/**
* Generates the list of CSS and JS files to load
* base on the $load_scripts array defined on each
* page.
*
* @package ProjectSend
*/
global $load_css_files;
global $load_js_files;
global $load_compat_js_files;
$load_css_files = array();
$load_js_files = array();
$load_compat_js_files = array();
/** Add the base files that every page will need, regardless of type */
/** JS */
$load_js_files[] = BASE_URI . 'assets/bootstrap/js/bootstrap.min.js';
$load_js_files[] = BASE_URI . 'includes/js/jquery.validations.js';
$load_js_files[] = BASE_URI . 'includes/js/jquery.psendmodal.js';
$load_js_files[] = BASE_URI . 'includes/js/jen/jen.js';
$load_js_files[] = BASE_URI . 'includes/js/js.cookie.js';
$load_js_files[] = BASE_URI . 'includes/js/main.js';
$load_js_files[] = BASE_URI . 'includes/js/js.functions.php';
/** CSS */
/** Fonts*/
$load_css_files[] = 'https://fonts.googleapis.com/css?family=Open+Sans:400,700,300';
$load_css_files[] = BASE_URI . 'assets/font-awesome/css/font-awesome.min.css';
/**
* Optional scripts
*/
if ( !empty( $load_scripts ) ) {
foreach ( $load_scripts as $script ) {
switch ( $script ) {
case 'recaptcha':
$load_js_files[] = 'https://www.google.com/recaptcha/api.js';
break;
case 'social_login':
$load_css_files[] = BASE_URI . 'css/social-login.css';
break;
case 'datepicker':
$load_css_files[] = BASE_URI . 'includes/js/bootstrap-datepicker/css/datepicker.css';
$load_js_files[] = BASE_URI . 'includes/js/bootstrap-datepicker/js/bootstrap-datepicker.js';
break;
case 'spinedit':
$load_css_files[] = BASE_URI . 'includes/js/bootstrap-spinedit/css/bootstrap-spinedit.css';
$load_js_files[] = BASE_URI . 'includes/js/bootstrap-spinedit/js/bootstrap-spinedit.js';
break;
case 'footable':
$footable_js_file = ( !empty( $footable_min ) ) ? 'footable.min.js' : 'footable.all.min.js';
$load_css_files[] = BASE_URI . 'includes/js/footable/css/footable.core.css';
$load_css_files[] = BASE_URI . 'css/footable.css';
$load_js_files[] = BASE_URI . 'includes/js/footable/' . $footable_js_file;
break;
case 'jquery_tags_input':
$load_css_files[] = BASE_URI . 'includes/js/jquery-tags-input/jquery.tagsinput.css';
$load_js_files[] = BASE_URI . 'includes/js/jquery-tags-input/jquery.tagsinput.min.js';
break;
case 'chosen':
$load_css_files[] = BASE_URI . 'includes/js/chosen/chosen.min.css';
$load_css_files[] = BASE_URI . 'includes/js/chosen/chosen.bootstrap.css';
$load_js_files[] = BASE_URI . 'includes/js/chosen/chosen.jquery.min.js';
break;
case 'toggle':
$load_css_files[] = BASE_URI . 'includes/js/bootstrap-toggle/css/bootstrap-toggle.min.css';
$load_js_files[] = BASE_URI . 'includes/js/bootstrap-toggle/js/bootstrap-toggle.min.js';
break;
case 'plupload':
$load_css_files[] = BASE_URI . 'includes/plupload/js/jquery.plupload.queue/css/jquery.plupload.queue.css';
$load_js_files[] = BASE_URI . 'includes/js/browserplus-min.js';
$load_js_files[] = BASE_URI . 'includes/plupload/js/plupload.full.js';
$load_js_files[] = BASE_URI . 'includes/plupload/js/jquery.plupload.queue/jquery.plupload.queue.js';
/**
* Load a plupload translation file, if the ProjectSend language
* on sys.config.php is set to anything other than "en", and the
* corresponding plupload file exists.
*/
if ( LOADED_LANG != 'en' ) {
$plupload_lang_file = 'includes/plupload/js/i18n/'.LOADED_LANG.'.js';
if ( file_exists( $plupload_lang_file ) ) {
$load_js_files[] = BASE_URI . $plupload_lang_file;
}
}
break;
case 'flot':
$load_js_files[] = BASE_URI . 'includes/js/flot/jquery.flot.min.js';
$load_js_files[] = BASE_URI . 'includes/js/flot/jquery.flot.resize.min.js';
$load_js_files[] = BASE_URI . 'includes/js/flot/jquery.flot.time.min.js';
$load_compat_js_files[] = array(
'file' => BASE_URI . 'includes/js/flot/excanvas.js',
'cond' => 'lt IE 9',
);
break;
case 'ckeditor':
if ( DESCRIPTIONS_USE_CKEDITOR == '1' ) {
$load_js_files[] = BASE_URI . 'includes/js/ckeditor/ckeditor.js';
}
break;
}
}
}
$load_css_files[] = BASE_URI . 'assets/bootstrap/css/bootstrap.min.css';
$load_css_files[] = BASE_URI . 'css/main.css';
$load_css_files[] = BASE_URI . 'css/mobile.css';
/**
* Load a different css file when called from the default template.
*/
if ( isset( $this_template_css ) ) {
$load_css_files[] = $this_template_css;
}
/**
* Custom CSS styles.
*/
$custom_css_location = ROOT_DIR . '/css/custom.css';
if ( file_exists( $custom_css_location ) ) {
$load_css_files[] = BASE_URI . 'css/custom.css';
}
/**
* Used on header to print the CSS files
*/
function load_css_files() {
global $load_css_files;
if ( !empty( $load_css_files ) ) {
foreach ( $load_css_files as $file ) {
?>
<link rel="stylesheet" media="all" type="text/css" href="<?php echo $file; ?>" />
<?php
}
}
}
/**
* Custom JS.
*/
$custom_js_location = ROOT_DIR . '/includes/js/custom.js';
if ( file_exists( $custom_js_location ) ) {
$load_js_files[] = BASE_URI . 'includes/js/custom.js';
}
/**
* Used before the </body> tag to print the JS files
*/
function load_js_files() {
global $load_compat_js_files;
global $load_js_files;
if ( !empty( $load_compat_js_files ) ) {
foreach ( $load_compat_js_files as $index => $info ) {
?>
<!--[if <?php echo $info['cond']; ?>]><script language="javascript" type="text/javascript" src="<?php echo $info['file']; ?>"></script><![endif]-->
<?php
}
}
if ( !empty( $load_js_files ) ) {
foreach ( $load_js_files as $file ) {
?>
<script src="<?php echo $file; ?>"></script>
<?php
}
}
}