blob: 7b0fceb726dc0c2adeab1a30505751143d58d714 (
plain) (
blame)
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
|
<?php
use dokuwiki\Cache\Cache;
if (!defined('DOKU_INC')) define('DOKU_INC', __DIR__ . '/../../');
if (!defined('NOSESSION')) define('NOSESSION', true); // we do not use a session or authentication here (better caching)
if (!defined('NL')) define('NL', "\n");
if (!defined('DOKU_DISABLE_GZIP_OUTPUT')) define('DOKU_DISABLE_GZIP_OUTPUT', 1); // we gzip ourself here
require_once(DOKU_INC . 'inc/init.php');
// MAIN
header('Content-Type: application/javascript; charset=utf-8');
jquery_out();
/**
* Delivers the jQuery JavaScript
*
* We do absolutely nothing fancy here but concatenating the different files
* and handling conditional and gzipped requests
*
* uses cache or fills it
*/
function jquery_out()
{
$cache = new Cache('jquery', '.js');
$files = [
DOKU_INC . 'lib/scripts/jquery/jquery.min.js',
DOKU_INC . 'lib/scripts/jquery/jquery-ui.min.js'
];
$cache_files = $files;
$cache_files[] = __FILE__;
// check cache age & handle conditional request
// This may exit if a cache can be used
$cache_ok = $cache->useCache(['files' => $cache_files]);
http_cached($cache->cache, $cache_ok);
$js = '';
foreach ($files as $file) {
$js .= file_get_contents($file) . "\n";
}
stripsourcemaps($js);
http_cached_finish($cache->cache, $js);
}
|