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.
 
 
 
 
 

40 lines
1.1 KiB

  1. <?php
  2. /**
  3. * Disable error reporting
  4. *
  5. * Set this to error_reporting( -1 ) for debugging.
  6. */
  7. error_reporting(0);
  8. $basepath = dirname(__FILE__);
  9. function get_file($path) {
  10. if ( function_exists('realpath') )
  11. $path = realpath($path);
  12. if ( ! $path || ! @is_file($path) )
  13. return false;
  14. return @file_get_contents($path);
  15. }
  16. $expires_offset = 31536000; // 1 year
  17. header('Content-Type: application/javascript; charset=UTF-8');
  18. header('Vary: Accept-Encoding'); // Handle proxies
  19. header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) . ' GMT');
  20. header("Cache-Control: public, max-age=$expires_offset");
  21. if ( isset($_GET['c']) && 1 == $_GET['c'] && isset($_SERVER['HTTP_ACCEPT_ENCODING'])
  22. && false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') && ( $file = get_file($basepath . '/wp-tinymce.js.gz') ) ) {
  23. header('Content-Encoding: gzip');
  24. echo $file;
  25. } else {
  26. // Back compat. This file shouldn't be used if this condition can occur (as in, if gzip isn't accepted).
  27. echo get_file( $basepath . '/tinymce.min.js' );
  28. echo get_file( $basepath . '/plugins/compat3x/plugin.min.js' );
  29. }
  30. exit;