1 | <?php |
||
32 | class MimeTypes |
||
33 | { |
||
34 | |||
35 | /** |
||
36 | * Defines mimetype default |
||
37 | * |
||
38 | * @var string |
||
39 | */ |
||
40 | const MIMETYPE_DEFAULT = "application/octet-stream"; |
||
41 | |||
42 | /** |
||
43 | * Get the MIME Type for the specified filename. |
||
44 | * |
||
45 | * @param string $filename The filename to get mimeType for |
||
46 | * |
||
47 | * @return string |
||
48 | */ |
||
49 | 3 | public static function getMimeTypeByFilename($filename) |
|
62 | |||
63 | /** |
||
64 | * Return's the mimeType by given extension |
||
65 | * |
||
66 | * @param string $extension The extension to find the mime type for |
||
67 | * |
||
68 | * @return string |
||
69 | */ |
||
70 | 4 | public static function getMimeTypeByExtension($extension) |
|
79 | |||
80 | public static $types = array( |
||
81 | "html" => "text/html", |
||
82 | "htm" => "text/html", |
||
83 | "shtml" => "text/html", |
||
84 | "css" => "text/css", |
||
85 | "xml" => "text/xml", |
||
86 | "rss" => "text/xml", |
||
87 | "gif" => "image/gif", |
||
88 | "jpeg" => "image/jpeg", |
||
89 | "jpg" => "image/jpeg", |
||
90 | "js" => "application/javascript", |
||
91 | "atom" => "application/atom+xml", |
||
92 | "mml" => "text/mathml", |
||
93 | "txt" => "text/plain", |
||
94 | "csv" => "text/plain", |
||
95 | "jad" => "text/vnd.sun.j2me.app-descriptor", |
||
96 | "wml" => "text/vnd.wap.wml", |
||
97 | "htc" => "text/component", |
||
98 | "png" => "image/png", |
||
99 | "tif" => "image/tiff", |
||
100 | "tiff" => "image/tiff", |
||
101 | "wbmp" => "image/vnd.wap.wbmp", |
||
102 | "ico" => "image/icon", |
||
103 | "jng" => "image/jng", |
||
104 | "bmp" => "image/ms-bmp", |
||
105 | "svg" => "image/svg+xml", |
||
106 | "svgz" => "image/svg+xml", |
||
107 | "jar" => "application/java-archive", |
||
108 | "war" => "application/java-archive", |
||
109 | "ear" => "application/java-archive", |
||
110 | "json" => "application/json", |
||
111 | "hqx" => "application/mac-binhex40", |
||
112 | "doc" => "application/msword", |
||
113 | "pdf" => "application/pdf", |
||
114 | "ps" => "application/postscript", |
||
115 | "eps" => "application/postscript", |
||
116 | "ai" => "application/postscript", |
||
117 | "rtf" => "application/rtf", |
||
118 | "xls" => "application/vnd.ms-excel", |
||
119 | "ppt" => "application/vnd.ms-powerpoint", |
||
120 | "wmlc" => "application/vnd.wap.wmlc", |
||
121 | "kml" => "application/vnd.google-earth.kml+xml", |
||
122 | "kmz" => "application/vnd.google-earth.kmz", |
||
123 | "7z" => "application/x-7z-compressed", |
||
124 | "cco" => "application/x-cocoa", |
||
125 | "jardiff" => "application/x-java-archive-diff", |
||
126 | "jnlp" => "application/x-java-jnlp-file", |
||
127 | "run" => "application/x-makeself", |
||
128 | "pl" => "application/x-perl", |
||
129 | "pm" => "application/x-perl", |
||
130 | "prc" => "application/x-pilot", |
||
131 | "pdb" => "application/x-pilot", |
||
132 | "rar" => "application/x-rar-compressed", |
||
133 | "rpm" => "application/x-redhat-package-manager", |
||
134 | "sea" => "application/x-sea", |
||
135 | "swf" => "application/x-shockwave-flash", |
||
136 | "sit" => "application/x-stuffit", |
||
137 | "tcl" => "application/x-tcl", |
||
138 | "tk" => "application/x-tcl", |
||
139 | "der" => "application/x-x509-ca-cert", |
||
140 | "pem" => "application/x-x509-ca-cert", |
||
141 | "crt" => "application/x-x509-ca-cert", |
||
142 | "xpi" => "application/x-xpinstall", |
||
143 | "xhtml" => "application/xhtml+xml", |
||
144 | "zip" => "application/zip", |
||
145 | "bin" => "application/octet-stream", |
||
146 | "exe" => "application/octet-stream", |
||
147 | "dll" => "application/octet-stream", |
||
148 | "deb" => "application/octet-stream", |
||
149 | "dmg" => "application/octet-stream", |
||
150 | "eot" => "application/vnd.ms-fontobject", |
||
151 | "iso" => "application/octet-stream", |
||
152 | "img" => "application/octet-stream", |
||
153 | "msi" => "application/octet-stream", |
||
154 | "msp" => "application/octet-stream", |
||
155 | "msm" => "application/octet-stream", |
||
156 | "ogx" => "application/ogg", |
||
157 | "mid" => "audio/midi", |
||
158 | "midi" => "audio/midi", |
||
159 | "kar" => "audio/midi", |
||
160 | "mpga" => "audio/mpeg", |
||
161 | "mpega" => "audio/mpeg", |
||
162 | "mp2" => "audio/mpeg", |
||
163 | "mp3" => "audio/mpeg", |
||
164 | "m4a" => "audio/mpeg", |
||
165 | "oga" => "audio/ogg", |
||
166 | "ogg" => "audio/ogg", |
||
167 | "spx" => "audio/ogg", |
||
168 | "ra" => "audio/x-realaudio", |
||
169 | "weba" => "audio/webm", |
||
170 | "3gpp" => "video/3gpp", |
||
171 | "3gp" => "video/3gpp", |
||
172 | "mp4" => "video/mp4", |
||
173 | "mpeg" => "video/mpeg", |
||
174 | "mpg" => "video/mpeg", |
||
175 | "mpe" => "video/mpeg", |
||
176 | "ogv" => "video/ogg", |
||
177 | "mov" => "video/quicktime", |
||
178 | "webm" => "video/webm", |
||
179 | "flv" => "video/x-flv", |
||
180 | "mng" => "video/x-mng", |
||
181 | "asx" => "video/x-ms-asf", |
||
182 | "asf" => "video/x-ms-asf", |
||
183 | "wmv" => "video/x-ms-wmv", |
||
184 | "avi" => "video/x-msvideo", |
||
185 | "otf" => "application/font-sfnt", |
||
186 | "ttf" => "application/font-sfnt", |
||
187 | "woff" => "application/font-woff" |
||
188 | ); |
||
189 | } |
||
190 |