header.class.php 661 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. /**
  3. * Header utility functions.
  4. *
  5. * @license see /license.txt
  6. * @author Laurent Opprecht <laurent@opprecht.info> for the Univesity of Geneva
  7. */
  8. class Header
  9. {
  10. public static function content_type($mime_type, $charset = '')
  11. {
  12. if (empty($mime_type))
  13. {
  14. return;
  15. }
  16. $type = $charset ? "$mime_type;charset=$charset" : $mime_type;
  17. header('Content-type: ' . $type);
  18. }
  19. public static function content_type_xml()
  20. {
  21. header('Content-type: text/xml');
  22. }
  23. public static function content_type_javascript()
  24. {
  25. header('Content-type: application/javascript');
  26. }
  27. }