-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmime.php
143 lines (137 loc) · 4.7 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<?php
namespace Status200;
class Mime {
private $defaultType = "application/octet-stream";
private $types = [
"mid" => "audio/midi",
"midi" => "audio/midi",
"kar" => "audio/midi",
"aac" => "audio/mp4",
"f4a" => "audio/mp4",
"f4b" => "audio/mp4",
"m4a" => "audio/mp4",
"mp3" => "audio/mpeg",
"oga" => "audio/ogg",
"ogg" => "audio/ogg",
"ra" => "audio/x-realaudio",
"wav" => "audio/x-wav",
"bmp" => "image/bmp",
"gif" => "image/gif",
"jpeg" => "image/jpeg",
"jpg" => "image/jpeg",
"png" => "image/png",
"tif" => "image/tiff",
"tiff" => "image/tiff",
"wbmp" => "image/vnd.wap.wbmp",
"webp" => "image/webp",
"ico" => "image/x-icon",
"cur" => "image/x-icon",
"jng" => "image/x-jng",
"js" => "application/javascript",
"json" => "application/json",
"webapp" => "application/x-web-app-manifest+json",
"manifest" => "text/cache-manifest",
"appcache" => "text/cache-manifest",
"doc" => "application/msword",
"xls" => "application/vnd.ms-excel",
"ppt" => "application/vnd.ms-powerpoint",
"docx" => "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"xlsx" => "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"pptx" => "application/vnd.openxmlformats-officedocument.presentationml.presentation",
"3gpp" => "video/3gpp",
"3gp" => "video/3gpp",
"mp4" => "video/mp4",
"m4v" => "video/mp4",
"f4v" => "video/mp4",
"f4p" => "video/mp4",
"mpeg" => "video/mpeg",
"mpg" => "video/mpeg",
"ogv" => "video/ogg",
"mov" => "video/quicktime",
"webm" => "video/webm",
"flv" => "video/x-flv",
"mng" => "video/x-mng",
"asx" => "video/x-ms-asf",
"asf" => "video/x-ms-asf",
"wmv" => "video/x-ms-wmv",
"avi" => "video/x-msvideo",
"atom" => "application/xml",
"rdf" => "application/xml",
"rss" => "application/xml",
"xml" => "application/xml",
"woff" => "application/font-woff",
"woff2" => "application/font-woff2",
"eot" => "application/vnd.ms-fontobject",
"ttc" => "application/x-font-ttf",
"ttf" => "application/x-font-ttf",
"otf" => "font/opentype",
"svg" => "image/svg+xml",
"svgz" => "image/svg+xml",
"jar" => "application/java-archive",
"war" => "application/java-archive",
"ear" => "application/java-archive",
"hqx" => "application/mac-binhex40",
"pdf" => "application/pdf",
"ps" => "application/postscript",
"eps" => "application/postscript",
"ai" => "application/postscript",
"rtf" => "application/rtf",
"wmlc" => "application/vnd.wap.wmlc",
"xhtml" => "application/xhtml+xml",
"kml" => "application/vnd.google-earth.kml+xml",
"kmz" => "application/vnd.google-earth.kmz",
"7z" => "application/x-7z-compressed",
"crx" => "application/x-chrome-extension",
"oex" => "application/x-opera-extension",
"xpi" => "application/x-xpinstall",
"cco" => "application/x-cocoa",
"jardiff" => "application/x-java-archive-diff",
"jnlp" => "application/x-java-jnlp-file",
"run" => "application/x-makeself",
"pl" => "application/x-perl",
"pm" => "application/x-perl",
"prc" => "application/x-pilot",
"pdb" => "application/x-pilot",
"rar" => "application/x-rar-compressed",
"rpm" => "application/x-redhat-package-manager",
"sea" => "application/x-sea",
"swf" => "application/x-shockwave-flash",
"sit" => "application/x-stuffit",
"tcl" => "application/x-tcl",
"tk" => "application/x-tcl",
"der" => "application/x-x509-ca-cert",
"pem" => "application/x-x509-ca-cert",
"crt" => "application/x-x509-ca-cert",
"torrent" => "application/x-bittorrent",
"zip" => "application/zip",
"bin" => "application/octet-stream",
"exe" => "application/octet-stream",
"dll" => "application/octet-stream",
"deb" => "application/octet-stream",
"dmg" => "application/octet-stream",
"iso" => "application/octet-stream",
"img" => "application/octet-stream",
"msi" => "application/octet-stream",
"msp" => "application/octet-stream",
"msm" => "application/octet-stream",
"safariextz" => "application/octet-stream",
"css" => "text/css",
"html" => "text/html",
"htm" => "text/html",
"shtml" => "text/html",
"mml" => "text/mathml",
"txt" => "text/plain",
"jad" => "text/vnd.sun.j2me.app-descriptor",
"wml" => "text/vnd.wap.wml",
"vtt" => "text/vtt",
"htc" => "text/x-component",
"vcf" => "text/x-vcard"
];
public function get($path)
{
// Get extension
$extension = pathinfo($path, PATHINFO_EXTENSION);
// Return MIME Type
return isset($this -> types[$extension]) ? $this -> types[$extension] : $this -> defaultType;
}
}