wp-tinymce.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * Not used in core since 5.1.
  4. * This is a back-compat for plugins that may be using this method of loading directly.
  5. */
  6. /**
  7. * Disable error reporting
  8. *
  9. * Set this to error_reporting( -1 ) for debugging.
  10. */
  11. error_reporting( 0 );
  12. $basepath = __DIR__;
  13. function get_file( $path ) {
  14. if ( function_exists( 'realpath' ) ) {
  15. $path = realpath( $path );
  16. }
  17. if ( ! $path || ! @is_file( $path ) ) {
  18. return false;
  19. }
  20. return @file_get_contents( $path );
  21. }
  22. $expires_offset = 31536000; // 1 year.
  23. header( 'Content-Type: application/javascript; charset=UTF-8' );
  24. header( 'Vary: Accept-Encoding' ); // Handle proxies.
  25. header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', time() + $expires_offset ) . ' GMT' );
  26. header( "Cache-Control: public, max-age=$expires_offset" );
  27. $file = get_file( $basepath . '/wp-tinymce.js' );
  28. if ( isset( $_GET['c'] ) && $file ) {
  29. echo $file;
  30. } else {
  31. // Even further back compat.
  32. echo get_file( $basepath . '/tinymce.min.js' );
  33. echo get_file( $basepath . '/plugins/compat3x/plugin.min.js' );
  34. }
  35. exit;