You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

46 lines
1.3 KiB

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