1<?php 2 3if(!defined('DOKU_INC')) define('DOKU_INC', dirname(__FILE__) . '/../../'); 4if(!defined('NOSESSION')) define('NOSESSION', true); // we do not use a session or authentication here (better caching) 5if(!defined('NL')) define('NL', "\n"); 6if(!defined('DOKU_DISABLE_GZIP_OUTPUT')) define('DOKU_DISABLE_GZIP_OUTPUT', 1); // we gzip ourself here 7require_once(DOKU_INC . 'inc/init.php'); 8 9// MAIN 10header('Content-Type: application/javascript; charset=utf-8'); 11jquery_out(); 12 13/** 14 * Delivers the jQuery JavaScript 15 * 16 * We do absolutely nothing fancy here but concatenating the different files 17 * and handling conditional and gzipped requests 18 * 19 * uses cache or fills it 20 */ 21function jquery_out() { 22 $cache = new cache('jquery', '.js'); 23 $files = array( 24 DOKU_INC . 'lib/scripts/jquery/jquery.min.js', 25 DOKU_INC . 'lib/scripts/jquery/jquery-ui.min.js', 26 DOKU_INC . 'lib/scripts/jquery/jquery-migrate.min.js', 27 ); 28 $cache_files = $files; 29 $cache_files[] = __FILE__; 30 31 // check cache age & handle conditional request 32 // This may exit if a cache can be used 33 $cache_ok = $cache->useCache(array('files' => $cache_files)); 34 http_cached($cache->cache, $cache_ok); 35 36 $js = ''; 37 foreach($files as $file) { 38 $js .= file_get_contents($file)."\n"; 39 } 40 stripsourcemaps($js); 41 42 http_cached_finish($cache->cache, $js); 43} 44