Rev 215 | Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
112 | daniel-mar | 1 | <?php |
2 | |||
3 | /* |
||
4 | * OIDplus 2.0 |
||
5 | * Copyright 2019 Daniel Marschall, ViaThinkSoft |
||
6 | * |
||
7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
||
8 | * you may not use this file except in compliance with the License. |
||
9 | * You may obtain a copy of the License at |
||
10 | * |
||
11 | * http://www.apache.org/licenses/LICENSE-2.0 |
||
12 | * |
||
13 | * Unless required by applicable law or agreed to in writing, software |
||
14 | * distributed under the License is distributed on an "AS IS" BASIS, |
||
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||
16 | * See the License for the specific language governing permissions and |
||
17 | * limitations under the License. |
||
18 | */ |
||
19 | |||
20 | use MatthiasMullie\Minify; |
||
21 | |||
22 | require_once __DIR__ . '/3p/minify/src/Minify.php'; |
||
23 | require_once __DIR__ . '/3p/minify/src/JS.php'; |
||
24 | require_once __DIR__ . '/3p/minify/src/Exception.php'; |
||
25 | |||
26 | error_reporting(E_ALL); |
||
27 | |||
28 | $minifier = new Minify\JS(__DIR__ . '/oidplus.js'); |
||
29 | |||
30 | $ary = glob(__DIR__ . '/plugins/publicPages/'.'*'.'/script.js'); |
||
31 | sort($ary); |
||
32 | foreach ($ary as $a) $minifier->add($a); |
||
33 | |||
34 | $ary = glob(__DIR__ . '/plugins/adminPages/'.'*'.'/script.js'); |
||
35 | sort($ary); |
||
36 | foreach ($ary as $a) $minifier->add($a); |
||
37 | |||
38 | $ary = glob(__DIR__ . '/plugins/raPages/'.'*'.'/script.js'); |
||
39 | sort($ary); |
||
40 | foreach ($ary as $a) $minifier->add($a); |
||
41 | |||
42 | $out = $minifier->minify(); |
||
43 | $etag = md5($out); |
||
44 | header("Etag: $etag"); |
||
45 | if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && (trim($_SERVER['HTTP_IF_NONE_MATCH']) == $etag)) { |
||
46 | header("HTTP/1.1 304 Not Modified"); |
||
47 | } else { |
||
48 | header('Content-Type:application/javascript'); |
||
49 | echo $out; |
||
50 | } |