forked from projectsend/projectsend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathassets.php
More file actions
131 lines (111 loc) · 3.44 KB
/
assets.php
File metadata and controls
131 lines (111 loc) · 3.44 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
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
<?php
/**
* Loads the required css and js files.
*
* @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[] = 'https://www.google.com/recaptcha/api.js';
$load_js_files[] = ASSETS_JS_URL . '/assets.js';
$load_js_files[] = ASSETS_JS_URL . '/app.js';
/** CSS */
/** Fonts*/
$load_css_files[] = 'https://fonts.googleapis.com/css?family=Open+Sans:400,700,300';
/**
* Optional scripts
*/
/**
* 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 = 'vendor/moxiecode/plupload/js/i18n/'.LOADED_LANG.'.js';
if ( file_exists( ROOT_DIR . DS . $plupload_lang_file ) ) {
$load_js_files[] = BASE_URI . '/' . $plupload_lang_file;
}
}
// $load_compat_js_files[] = array(
// 'file' => ASSETS_LIB_URL . '/flot/excanvas.js',
// 'cond' => 'lt IE 9',
// );
$load_css_files[] = ASSETS_CSS_URL . '/assets.css';
$load_css_files[] = ASSETS_CSS_URL . '/main.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.
* Possible locations: css/custom.css | assets/custom/custom.css
*/
$custom_css_locations = [ 'css/custom.css', 'assets/custom/custom.css' ];
foreach ( $custom_css_locations as $css_file ) {
if ( file_exists ( ROOT_DIR . DS . $css_file ) ) {
$load_css_files[] = BASE_URI . $css_file;
}
}
/**
* 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 files.
* Possible locations: includes/js/custom.js | assets/custom/custom.js
*/
$custom_js_locations = [ 'includes/js/custom.js', 'assets/custom/custom.js' ];
foreach ( $custom_js_locations as $js_file ) {
if ( file_exists ( ROOT_DIR . DS . $js_file ) ) {
$load_js_files[] = BASE_URI . $js_file;
}
}
/**
* 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
}
}
}
function load_js_header_files() {
?>
<script type="text/javascript" src="<?php echo ASSETS_LIB_URL; ?>/jquery/jquery.min.js"></script>
<script type="text/javascript" src="<?php echo ASSETS_LIB_URL; ?>/jquery-migrate/jquery-migrate.min.js"></script>
<script type="text/javascript" src="<?php echo BASE_URI; ?>/node_modules/@ckeditor/ckeditor5-build-classic/build/ckeditor.js"></script>
<!--[if lt IE 9]>
<script src="<?php echo ASSETS_LIB_URL; ?>/html5shiv.min.js"></script>
<script src="<?php echo ASSETS_LIB_URL; ?>/respond.min.js"></script>
<![endif]-->
<?php
}