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 10jquery_out(); 11 12/** 13 * Delivers the jQuery JavaScript 14 * 15 * We do absolutely nothing fancy here but concatenating the different files 16 * and handling conditional and gzipped requests 17 * 18 * uses cache or fills it 19 */ 20function jquery_out() { 21 $cache = new cache('jquery', '.js'); 22 $files = array( 23 DOKU_INC . 'lib/scripts/jquery/jquery.min.js', 24 DOKU_INC . 'lib/scripts/jquery/jquery-ui.min.js', 25 DOKU_INC . 'lib/scripts/jquery/jquery-migrate.min.js', 26 ); 27 $cache_files = $files; 28 $cache_files[] = __FILE__; 29 30 // check cache age & handle conditional request 31 // This may exit if a cache can be used 32 $cache_ok = $cache->useCache(array('files' => $cache_files)); 33 http_cached($cache->cache, $cache_ok); 34 35 $js = ''; 36 foreach($files as $file) { 37 $js .= file_get_contents($file)."\n"; 38 } 39 stripsourcemaps($js); 40 41 http_cached_finish($cache->cache, $js); 42} 43