-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathget.php
46 lines (39 loc) · 1.23 KB
/
get.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
<?php
if(!array_key_exists('files', $_POST)) {
exit();
}
$files = array();
foreach($_POST['files'] as $file) {
$files[] = @file_get_contents($file);
}
header('Content-Type: text/javascript');
header('Content-Disposition: attachment; filename="moocanvas.js"');
echo cache_compress($files, $_POST['compression']);
function cache_compress($build, $compress = 'packer') {
$copyright = "//MooCanvas, My Object Oriented Canvas Element. Copyright (c) 2008 Olmo Maldonado, ";
$copyright.= "<http://ibolmo.com/>, MIT Style License.";
switch (strtolower($compress)){
case 'packer': {
require 'assets/class.JavaScriptPacker.php';
$packer = new JavaScriptPacker(implode("\r\n", $build), 62, true, false);
$build = $packer->pack();
$build = $copyright."\r\n".$build;
break;
}
case 'nodocs': {
$build = implode("\r\n", $build);
$build = preg_replace('@\/\*(.*?)\*\/@ms', '', $build);
$build = str_replace("\t\n", "\n", $build);
$build = str_replace("\n\n\n", "\n", $build);
$build = str_replace("\n\n\n", "\n\n", $build);
$build = $copyright."\r\n".$build;
break;
}
default: {
$build = $copyright."\r\n".implode("\r\n", $build);
break;
}
}
return $build;
}
?>