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