-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMime.php
82 lines (63 loc) · 1.85 KB
/
Mime.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
namespace phputil;
/**
* Common MIME types.
*
* @author Thiago Delgado Pinto
*
* @see https://en.wikipedia.org/wiki/Media_type
* @see http://www.iana.org/assignments/media-types/media-types.xhtml
* @see http://www.sitepoint.com/web-foundations/mime-types-complete-list/
*/
class Mime {
// TEXT
const HTML = 'text/html';
const JSON = 'application/json';
const RTF = 'text/richtext';
const TEXT = 'text/plain';
const TEXT_EVENT_STREAM = 'text/event-stream';
const XML = 'application/xml';
// IMAGE
const BMP = 'image/bmp';
const GIF = 'image/gif';
const JPG = 'image/jpeg';
const ICO = 'image/x-icon';
const PNG = 'image/png';
const TIFF = 'image/tiff';
// AUDIO
const MIDI = 'audio/midi';
const MP3 = 'audio/mpeg3';
const OGG = 'audio/ogg';
const WAV = 'audio/wav';
// VIDEO
const AVI = 'video/avi';
const MP4 = 'application/mp4';
// OFFICE APPLICATIONS
const EPS = 'application/postscript';
const MSEXCEL = 'application/excel';
const MSPOWERPOINT = 'application/mspowerpoint';
const MSWORD = 'application/msword';
const ODP = 'application/vnd.oasis.opendocument.presentation';
const ODS = 'application/vnd.oasis.opendocument.spreadsheet';
const ODT = 'application/vnd.oasis.opendocument.text';
const PDF = 'application/pdf';
// COMPRESSED/GROUPED
const GZIP = 'application/gzip';
const TAR = 'application/x-tar';
const TGZ = 'application/x-compressed';
const ZIP = 'application/zip';
// STREAM
const EXE = 'application/octet-stream';
const STREAM = 'application/octet-stream';
// USEFUL STATIC METHODS
static function make( $mime, $param = null, $paramValue = null ) {
if ( null === $param || null === $paramValue ) {
return $mime;
}
return "$mime;$param=$paramValue";
}
static function makeWithCharset( $mime, $charset ) {
return self::make( $mime, 'charset', $charset );
}
}
?>