forked from imagecms/ImageCMS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompress_js.php
executable file
·59 lines (52 loc) · 1.6 KB
/
compress_js.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
<?php
/*
* Image CMS
* Compress and output js files
*/
$files = array(
'mocha/mootools-1.3-core.js', // Mootools
'mocha/mootools-1.2-more.js',
'mocha/source/Core/Core.js', //MochaUI
'mocha/source/Window/Window.js',
'mocha/source/Window/Modal.js',
'mocha/source/Window/Windows-from-html.js',
'mocha/source/Window/Windows-from-json.js',
'mocha/source/Window/Arrange-cascade.js',
'mocha/source/Window/Arrange-tile.js',
'mocha/source/Window/Tabs.js',
'mocha/source/Layout/Layout.js',
'mocha/source/Layout/Dock.js',
'mocha/source/Layout/Workspaces.js',
'mocha/cms-windows.js', // Other files
'mocha/functions.js',
'mocha/init.js',
'plugins/Roar.js',
'plugins/Tabs.js',
'plugins/sortableTable.js',
'plugins/rdTree.js',
'plugins/calendar.compat.js',
'plugins/alertbox.packed.js',
'plugins/autocompleter/Autocompleter.js',
'plugins/autocompleter/Observer.js',
'plugins/autocompleter/Autocompleter.Request.js',
'plugins/autocompleter/Autocompleter.Local.js',
'mocha/mootools-more-1.3.2.1.js' //Element.Form for Autocomplete
);
$js_root = dirname(__FILE__);
$code = '';
foreach ($files as $file)
{
$code .= file_get_contents("$js_root/$file");
}
$exp = 3600 * 24 * 10;
header("Content-Type: text/javascript");
header("Vary: Accept-Encoding");
header("Expires: " . gmdate("D, d M Y H:i:s", time() + $exp) . " GMT");
if (extension_loaded('zlib'))
{
if (isset($_SERVER['HTTP_ACCEPT_ENCODING']) AND strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== FALSE)
{
ob_start('ob_gzhandler');
}
}
print $code;