Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
MimeMap | n/a |
0 / 0 |
n/a |
0 / 0 |
0 | n/a |
0 / 0 |
1 | <?php |
2 | /** |
3 | * This program is free software; you can redistribute it and/or modify |
4 | * it under the terms of the GNU General Public License as published by |
5 | * the Free Software Foundation; either version 2 of the License, or |
6 | * (at your option) any later version. |
7 | * |
8 | * This program is distributed in the hope that it will be useful, |
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 | * GNU General Public License for more details. |
12 | * |
13 | * You should have received a copy of the GNU General Public License along |
14 | * with this program; if not, write to the Free Software Foundation, Inc., |
15 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
16 | * http://www.gnu.org/copyleft/gpl.html |
17 | * |
18 | * @file |
19 | */ |
20 | |
21 | namespace Wikimedia\Mime; |
22 | |
23 | /** |
24 | * Map of MIME types to file extensions and media types. |
25 | * |
26 | * @internal |
27 | * @ingroup Mime |
28 | */ |
29 | class MimeMap { |
30 | /** @var array Map of MIME types to an array of file extensions */ |
31 | public const MIME_EXTENSIONS = [ |
32 | 'application/ogg' => [ 'ogx', 'ogg', 'ogm', 'ogv', 'oga', 'spx', 'opus' ], |
33 | 'application/pdf' => [ 'pdf' ], |
34 | 'application/vnd.apple.mpegurl' => [ 'm3u8', 'm3u' ], |
35 | 'application/vnd.ms-opentype' => [ 'otf' ], |
36 | 'application/vnd.oasis.opendocument.chart' => [ 'odc' ], |
37 | 'application/vnd.oasis.opendocument.chart-template' => [ 'otc' ], |
38 | 'application/vnd.oasis.opendocument.database' => [ 'odb' ], |
39 | 'application/vnd.oasis.opendocument.formula' => [ 'odf' ], |
40 | 'application/vnd.oasis.opendocument.formula-template' => [ 'otf' ], |
41 | 'application/vnd.oasis.opendocument.graphics' => [ 'odg' ], |
42 | 'application/vnd.oasis.opendocument.graphics-template' => [ 'otg' ], |
43 | 'application/vnd.oasis.opendocument.image' => [ 'odi' ], |
44 | 'application/vnd.oasis.opendocument.image-template' => [ 'oti' ], |
45 | 'application/vnd.oasis.opendocument.presentation' => [ 'odp' ], |
46 | 'application/vnd.oasis.opendocument.presentation-template' => [ 'otp' ], |
47 | 'application/vnd.oasis.opendocument.spreadsheet' => [ 'ods' ], |
48 | 'application/vnd.oasis.opendocument.spreadsheet-template' => [ 'ots' ], |
49 | 'application/vnd.oasis.opendocument.text' => [ 'odt' ], |
50 | 'application/vnd.oasis.opendocument.text-master' => [ 'otm', 'odm' ], |
51 | 'application/vnd.oasis.opendocument.text-template' => [ 'ott' ], |
52 | 'application/vnd.oasis.opendocument.text-web' => [ 'oth' ], |
53 | 'application/javascript' => [ 'js' ], |
54 | 'application/x-mpegurl' => [ 'm3u', 'm3u8' ], |
55 | 'application/x-shockwave-flash' => [ 'swf' ], |
56 | 'audio/midi' => [ 'mid', 'midi', 'kar' ], |
57 | 'audio/mpeg' => [ 'mpga', 'mpa', 'mp2', 'mp3' ], |
58 | 'audio/x-aiff' => [ 'aif', 'aiff', 'aifc' ], |
59 | 'audio/x-wav' => [ 'wav' ], |
60 | 'audio/ogg' => [ 'oga', 'spx', 'ogg', 'opus' ], |
61 | 'audio/opus' => [ 'opus', 'ogg', 'oga', 'spx' ], |
62 | 'image/x-bmp' => [ 'bmp' ], |
63 | 'image/gif' => [ 'gif' ], |
64 | 'image/jpeg' => [ 'jpeg', 'jpg', 'jpe', 'jps' ], |
65 | 'image/png' => [ 'png', 'apng' ], |
66 | 'image/svg+xml' => [ 'svg' ], |
67 | 'image/svg' => [ 'svg' ], |
68 | 'image/tiff' => [ 'tiff', 'tif' ], |
69 | 'image/vnd.djvu' => [ 'djvu', 'djv' ], |
70 | 'image/x.djvu' => [ 'djvu' ], |
71 | 'image/x-djvu' => [ 'djvu' ], |
72 | 'image/x-portable-pixmap' => [ 'ppm' ], |
73 | 'image/x-xcf' => [ 'xcf' ], |
74 | 'text/plain' => [ 'txt' ], |
75 | 'text/html' => [ 'html', 'htm' ], |
76 | 'video/ogg' => [ 'ogv', 'ogm', 'ogg' ], |
77 | 'video/mpeg' => [ 'mpg', 'mpeg', 'mpe' ], |
78 | 'application/acad' => [ 'dwg' ], |
79 | 'application/andrew-inset' => [ 'ez' ], |
80 | 'application/mac-binhex40' => [ 'hqx' ], |
81 | 'application/mac-compactpro' => [ 'cpt' ], |
82 | 'application/mathml+xml' => [ 'mathml' ], |
83 | 'application/msword' => [ 'doc', 'dot' ], |
84 | 'application/octet-stream' => [ 'bin', 'dms', 'lha', 'lzh', 'exe', 'class', 'so', 'dll' ], |
85 | 'application/oda' => [ 'oda' ], |
86 | 'application/postscript' => [ 'ai', 'eps', 'ps' ], |
87 | 'application/rdf+xml' => [ 'rdf', 'owl' ], |
88 | 'application/smil' => [ 'smi', 'smil' ], |
89 | 'application/srgs' => [ 'gram' ], |
90 | 'application/srgs+xml' => [ 'grxml' ], |
91 | 'application/vnd.mif' => [ 'mif' ], |
92 | 'application/vnd.ms-excel' => [ 'xls', 'xlt', 'xla' ], |
93 | 'application/vnd.ms-powerpoint' => [ 'ppt', 'pot', 'pps', 'ppa' ], |
94 | 'application/vnd.wap.wbxml' => [ 'wbxml' ], |
95 | 'application/vnd.wap.wmlc' => [ 'wmlc' ], |
96 | 'application/vnd.wap.wmlscriptc' => [ 'wmlsc' ], |
97 | 'application/voicexml+xml' => [ 'vxml' ], |
98 | 'application/x-7z-compressed' => [ '7z' ], |
99 | 'application/x-bcpio' => [ 'bcpio' ], |
100 | 'application/x-bzip' => [ 'bz' ], |
101 | 'application/x-bzip2' => [ 'bz2' ], |
102 | 'application/x-cdlink' => [ 'vcd' ], |
103 | 'application/x-chess-pgn' => [ 'pgn' ], |
104 | 'application/x-cpio' => [ 'cpio' ], |
105 | 'application/x-csh' => [ 'csh' ], |
106 | 'application/x-dia-diagram' => [ 'dia' ], |
107 | 'application/x-director' => [ 'dcr', 'dir', 'dxr' ], |
108 | 'application/x-dvi' => [ 'dvi' ], |
109 | 'application/x-futuresplash' => [ 'spl' ], |
110 | 'application/x-gtar' => [ 'gtar', 'tar' ], |
111 | 'application/x-gzip' => [ 'gz' ], |
112 | 'application/x-hdf' => [ 'hdf' ], |
113 | 'application/x-jar' => [ 'jar' ], |
114 | 'application/json' => [ 'json' ], |
115 | 'application/x-koan' => [ 'skp', 'skd', 'skt', 'skm' ], |
116 | 'application/x-latex' => [ 'latex' ], |
117 | 'application/x-netcdf' => [ 'nc', 'cdf' ], |
118 | 'application/x-sh' => [ 'sh' ], |
119 | 'application/x-shar' => [ 'shar' ], |
120 | 'application/x-stuffit' => [ 'sit' ], |
121 | 'application/x-sv4cpio' => [ 'sv4cpio' ], |
122 | 'application/x-sv4crc' => [ 'sv4crc' ], |
123 | 'application/x-tar' => [ 'tar' ], |
124 | 'application/x-tcl' => [ 'tcl' ], |
125 | 'application/x-tex' => [ 'tex' ], |
126 | 'application/x-texinfo' => [ 'texinfo', 'texi' ], |
127 | 'application/x-troff' => [ 't', 'tr', 'roff' ], |
128 | 'application/x-troff-man' => [ 'man' ], |
129 | 'application/x-troff-me' => [ 'me' ], |
130 | 'application/x-troff-ms' => [ 'ms' ], |
131 | 'application/x-ustar' => [ 'ustar' ], |
132 | 'application/x-wais-source' => [ 'src' ], |
133 | 'application/x-xpinstall' => [ 'xpi' ], |
134 | 'application/xhtml+xml' => [ 'xhtml', 'xht' ], |
135 | 'application/xslt+xml' => [ 'xslt' ], |
136 | 'application/xml' => [ 'xml', 'xsl', 'xsd', 'kml' ], |
137 | 'application/xml-dtd' => [ 'dtd' ], |
138 | 'application/zip' => |
139 | [ 'zip', 'jar', 'xpi', 'sxc', 'stc', 'sxd', 'std', 'sxi', 'sti', 'sxm', 'stm', 'sxw', 'stw' ], |
140 | 'application/x-rar' => [ 'rar' ], |
141 | 'font/sfnt' => [ 'ttf' ], |
142 | 'application/font-sfnt' => [ 'ttf' ], |
143 | 'font/woff' => [ 'woff' ], |
144 | 'application/font-woff' => [ 'woff' ], |
145 | 'font/woff2' => [ 'woff2' ], |
146 | 'application/font-woff2' => [ 'woff2' ], |
147 | 'application/vnd.ms-fontobject' => [ 'eot' ], |
148 | 'application/x-font-ttf' => [ 'ttf' ], |
149 | 'audio/basic' => [ 'au', 'snd' ], |
150 | 'video/webm' => [ 'webm' ], |
151 | 'audio/webm' => [ 'webm' ], |
152 | 'audio/x-matroska' => [ 'mka', 'mkv' ], |
153 | 'audio/x-mpegurl' => [ 'm3u' ], |
154 | 'audio/x-ogg' => [ 'oga', 'ogg', 'spx', 'opus' ], |
155 | 'audio/x-pn-realaudio' => [ 'ram', 'rm' ], |
156 | 'audio/x-pn-realaudio-plugin' => [ 'rpm' ], |
157 | 'audio/x-realaudio' => [ 'ra' ], |
158 | 'audio/wav' => [ 'wav' ], |
159 | 'audio/x-flac' => [ 'flac' ], |
160 | 'audio/flac' => [ 'flac' ], |
161 | 'chemical/x-pdb' => [ 'pdb' ], |
162 | 'chemical/x-xyz' => [ 'xyz' ], |
163 | 'image/bmp' => [ 'bmp' ], |
164 | 'image/cgm' => [ 'cgm' ], |
165 | 'image/ief' => [ 'ief' ], |
166 | 'image/jp2' => [ 'jp2', 'j2k', 'jpg2' ], |
167 | 'image/jpx' => [ 'jpf', 'jpx' ], |
168 | 'image/vnd.microsoft.icon' => [ 'ico' ], |
169 | 'image/vnd.wap.wbmp' => [ 'wbmp' ], |
170 | 'image/webp' => [ 'webp' ], |
171 | 'image/x-cmu-raster' => [ 'ras' ], |
172 | 'image/x-icon' => [ 'ico' ], |
173 | 'image/x-jps' => [ 'jps' ], |
174 | 'image/x-ms-bmp' => [ 'bmp' ], |
175 | 'image/x-portable-anymap' => [ 'pnm' ], |
176 | 'image/x-portable-bitmap' => [ 'pbm' ], |
177 | 'image/x-portable-graymap' => [ 'pgm' ], |
178 | 'image/x-rgb' => [ 'rgb' ], |
179 | 'image/x-photoshop' => [ 'psd' ], |
180 | 'image/x-xbitmap' => [ 'xbm' ], |
181 | 'image/x-xpixmap' => [ 'xpm' ], |
182 | 'image/x-xwindowdump' => [ 'xwd' ], |
183 | 'model/iges' => [ 'igs', 'iges' ], |
184 | 'model/mesh' => [ 'msh', 'mesh', 'silo' ], |
185 | 'model/vrml' => [ 'wrl', 'vrml' ], |
186 | 'text/calendar' => [ 'ics', 'ifb' ], |
187 | 'text/css' => [ 'css' ], |
188 | 'text/csv' => [ 'csv' ], |
189 | 'text/richtext' => [ 'rtx' ], |
190 | 'text/rtf' => [ 'rtf' ], |
191 | 'text/sgml' => [ 'sgml', 'sgm' ], |
192 | 'text/tab-separated-values' => [ 'tsv' ], |
193 | 'text/vnd.wap.wml' => [ 'wml' ], |
194 | 'text/vnd.wap.wmlscript' => [ 'wmls' ], |
195 | 'text/xml' => [ 'xml', 'xsl', 'xslt', 'rss', 'rdf' ], |
196 | 'text/x-component' => [ 'htc' ], |
197 | 'text/x-setext' => [ 'etx' ], |
198 | 'text/x-sawfish' => [ 'jl' ], |
199 | 'video/mp4' => [ 'mp4', 'm4a', 'm4p', 'm4b', 'm4r', 'm4v' ], |
200 | 'audio/mp4' => [ 'm4a' ], |
201 | 'video/quicktime' => [ 'qt', 'mov' ], |
202 | 'video/vnd.mpegurl' => [ 'mxu' ], |
203 | 'video/x-flv' => [ 'flv' ], |
204 | 'video/x-matroska' => [ 'mkv', 'mka' ], |
205 | 'video/x-msvideo' => [ 'avi' ], |
206 | 'video/x-ogg' => [ 'ogv', 'ogm', 'ogg' ], |
207 | 'video/x-sgi-movie' => [ 'movie' ], |
208 | 'x-conference/x-cooltalk' => [ 'ice' ], |
209 | 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => [ 'docx' ], |
210 | 'application/vnd.openxmlformats-officedocument.wordprocessingml.template' => [ 'dotx' ], |
211 | 'application/vnd.ms-word.document.macroenabled.12' => [ 'docm' ], |
212 | 'application/vnd.ms-word.template.macroenabled.12' => [ 'dotm' ], |
213 | 'application/vnd.openxmlformats-officedocument.presentationml.template' => [ 'potx' ], |
214 | 'application/vnd.openxmlformats-officedocument.presentationml.slideshow' => [ 'ppsx' ], |
215 | 'application/vnd.openxmlformats-officedocument.presentationml.presentation' => [ 'pptx' ], |
216 | 'application/vnd.ms-powerpoint.addin.macroenabled.12' => [ 'ppam' ], |
217 | 'application/vnd.ms-powerpoint.presentation.macroenabled.12' => [ 'pptm', 'potm' ], |
218 | 'application/vnd.ms-powerpoint.slideshow.macroenabled.12' => [ 'ppsm' ], |
219 | 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => [ 'xlsx' ], |
220 | 'application/vnd.openxmlformats-officedocument.spreadsheetml.template' => [ 'xltx' ], |
221 | 'application/vnd.ms-excel.sheet.macroenabled.12' => [ 'xlsm' ], |
222 | 'application/vnd.ms-excel.template.macroenabled.12' => [ 'xltm' ], |
223 | 'application/vnd.ms-excel.addin.macroenabled.12' => [ 'xlam' ], |
224 | 'application/vnd.ms-excel.sheet.binary.macroenabled.12' => [ 'xlsb' ], |
225 | 'model/vnd.dwfx+xps' => [ 'dwfx' ], |
226 | 'application/vnd.ms-xpsdocument' => [ 'xps' ], |
227 | 'chemical/x-mdl-molfile' => [ 'mol' ], |
228 | 'chemical/x-mdl-sdfile' => [ 'sdf' ], |
229 | 'chemical/x-mdl-rxnfile' => [ 'rxn' ], |
230 | 'chemical/x-mdl-rdfile' => [ 'rd' ], |
231 | 'chemical/x-mdl-rgfile' => [ 'rg' ], |
232 | 'application/x-amf' => [ 'amf' ], |
233 | 'application/sla' => [ 'stl' ], |
234 | 'application/wasm' => [ 'wasm' ], |
235 | |
236 | // Vague pseudo-types should be at the end so that they don't take |
237 | // precedence over the more specific types above in getMimeTypesFromExtension() |
238 | 'application/x-opc+zip' => [ |
239 | 'docx', 'dotx', 'docm', 'dotm', 'potx', 'ppsx', 'pptx', 'ppam', 'pptm', 'potm', 'ppsm', |
240 | 'xlsx', 'xltx', 'xlsm', 'xltm', 'xlam', 'xlsb', 'dwfx', 'xps' |
241 | ], |
242 | 'application/vnd.oasis.opendocument' => [ |
243 | 'odt', 'ott', 'odg', 'otg', 'odp', 'otp', 'ods', 'ots', 'odc', 'otc', |
244 | 'odi', 'oti', 'odf', 'otf', 'odm', 'oth', |
245 | ] |
246 | ]; |
247 | |
248 | /** @var array Map of built-in media types and their associated MIME types */ |
249 | public const MEDIA_TYPES = [ |
250 | MEDIATYPE_OFFICE => [ |
251 | 'application/pdf', |
252 | 'application/vnd.oasis.opendocument.chart', |
253 | 'application/vnd.oasis.opendocument.chart-template', |
254 | 'application/vnd.oasis.opendocument.database', |
255 | 'application/vnd.oasis.opendocument.formula', |
256 | 'application/vnd.oasis.opendocument.formula-template', |
257 | 'application/vnd.oasis.opendocument.graphics', |
258 | 'application/vnd.oasis.opendocument.graphics-template', |
259 | 'application/vnd.oasis.opendocument.image', |
260 | 'application/vnd.oasis.opendocument.image-template', |
261 | 'application/vnd.oasis.opendocument.presentation', |
262 | 'application/vnd.oasis.opendocument.presentation-template', |
263 | 'application/vnd.oasis.opendocument.spreadsheet', |
264 | 'application/vnd.oasis.opendocument.spreadsheet-template', |
265 | 'application/vnd.oasis.opendocument.text', |
266 | 'application/vnd.oasis.opendocument.text-template', |
267 | 'application/vnd.oasis.opendocument.text-master', |
268 | 'application/vnd.oasis.opendocument.text-web', |
269 | 'application/pdf', |
270 | 'application/acrobat', |
271 | 'application/msword', |
272 | 'application/vnd.ms-excel', |
273 | 'application/vnd.ms-powerpoint', |
274 | 'application/x-director', |
275 | 'image/vnd.djvu', |
276 | 'image/x.djvu', |
277 | 'image/x-djvu', |
278 | 'text/rtf', |
279 | 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', |
280 | 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', |
281 | 'application/vnd.ms-word.document.macroenabled.12', |
282 | 'application/vnd.ms-word.template.macroenabled.12', |
283 | 'application/vnd.openxmlformats-officedocument.presentationml.template', |
284 | 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', |
285 | 'application/vnd.openxmlformats-officedocument.presentationml.presentation', |
286 | 'application/vnd.ms-powerpoint.addin.macroenabled.12', |
287 | 'application/vnd.ms-powerpoint.presentation.macroenabled.12', |
288 | 'application/vnd.ms-powerpoint.presentation.macroenabled.12', |
289 | 'application/vnd.ms-powerpoint.slideshow.macroenabled.12', |
290 | 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', |
291 | 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', |
292 | 'application/vnd.ms-excel.sheet.macroenabled.12', |
293 | 'application/vnd.ms-excel.template.macroenabled.12', |
294 | 'application/vnd.ms-excel.addin.macroenabled.12', |
295 | 'application/vnd.ms-excel.sheet.binary.macroenabled.12', |
296 | ], |
297 | MEDIATYPE_EXECUTABLE => [ |
298 | 'application/javascript', |
299 | 'text/javascript', |
300 | 'application/x-javascript', |
301 | 'application/javascript', |
302 | 'text/javascript', |
303 | 'application/x-javascript', |
304 | 'application/x-ecmascript', |
305 | 'text/ecmascript', |
306 | 'application/x-bash', |
307 | 'application/x-sh', |
308 | 'application/x-csh', |
309 | 'application/x-tcsh', |
310 | 'application/x-tcl', |
311 | 'application/x-perl', |
312 | 'application/x-python', |
313 | 'application/wasm', |
314 | ], |
315 | MEDIATYPE_MULTIMEDIA => [ |
316 | 'application/x-shockwave-flash', |
317 | 'application/ogg', |
318 | 'application/vnd.apple.mpegurl', |
319 | 'application/x-mpegurl', |
320 | 'audio/ogg', |
321 | 'video/ogg', |
322 | 'application/ogg', |
323 | 'application/x-ogg', |
324 | 'audio/ogg', |
325 | 'audio/x-ogg', |
326 | 'video/ogg', |
327 | 'video/x-ogg', |
328 | 'application/x-shockwave-flash', |
329 | 'audio/x-pn-realaudio-plugin', |
330 | 'model/iges', |
331 | 'model/mesh', |
332 | 'model/vrml', |
333 | 'video/quicktime', |
334 | 'video/x-msvideo', |
335 | ], |
336 | MEDIATYPE_AUDIO => [ |
337 | 'audio/midi', |
338 | 'audio/x-aiff', |
339 | 'audio/x-wav', |
340 | 'audio/mp3', |
341 | 'audio/mpeg', |
342 | 'audio/mpeg', |
343 | 'audio/mp3', |
344 | 'audio/mpeg3', |
345 | 'audio/mp4', |
346 | 'audio/wav', |
347 | 'audio/x-wav', |
348 | 'audio/wave', |
349 | 'audio/midi', |
350 | 'audio/mid', |
351 | 'audio/basic', |
352 | 'audio/ogg', |
353 | 'audio/opus', |
354 | 'audio/x-aiff', |
355 | 'audio/x-pn-realaudio', |
356 | 'audio/x-realaudio', |
357 | 'audio/webm', |
358 | 'audio/x-matroska', |
359 | 'audio/x-flac', |
360 | 'audio/flac', |
361 | ], |
362 | MEDIATYPE_BITMAP => [ |
363 | 'image/x-bmp', |
364 | 'image/x-ms-bmp', |
365 | 'image/bmp', |
366 | 'image/gif', |
367 | 'image/jpeg', |
368 | 'image/png', |
369 | 'image/tiff', |
370 | 'image/vnd.djvu', |
371 | 'image/x-xcf', |
372 | 'image/x-portable-pixmap', |
373 | 'image/gif', |
374 | 'image/png', |
375 | 'image/x-png', |
376 | 'image/ief', |
377 | 'image/jpeg', |
378 | 'image/x-jps', |
379 | 'image/pjpeg', |
380 | 'image/jp2', |
381 | 'image/jpx', |
382 | 'image/xbm', |
383 | 'image/tiff', |
384 | 'image/x-icon', |
385 | 'image/x-ico', |
386 | 'image/vnd.microsoft.icon', |
387 | 'image/x-rgb', |
388 | 'image/x-portable-pixmap', |
389 | 'image/x-portable-graymap', |
390 | 'image/x-portable-greymap', |
391 | 'image/x-bmp', |
392 | 'image/x-ms-bmp', |
393 | 'image/bmp', |
394 | 'application/x-bmp', |
395 | 'application/bmp', |
396 | 'image/x-photoshop', |
397 | 'image/psd', |
398 | 'image/x-psd', |
399 | 'image/photoshop', |
400 | 'image/vnd.adobe.photoshop', |
401 | 'image/webp', |
402 | ], |
403 | MEDIATYPE_DRAWING => [ |
404 | 'image/svg+xml', |
405 | 'image/svg+xml', |
406 | 'application/svg+xml', |
407 | 'application/svg', |
408 | 'image/svg', |
409 | 'application/postscript', |
410 | 'application/x-latex', |
411 | 'application/x-tex', |
412 | 'application/x-dia-diagram', |
413 | 'application/acad', |
414 | 'application/x-acad', |
415 | 'application/autocad_dwg', |
416 | 'image/x-dwg', |
417 | 'application/dwg', |
418 | 'application/x-dwg', |
419 | 'application/x-autocad', |
420 | 'image/vnd.dwg', |
421 | 'drawing/dwg', |
422 | 'chemical/x-mdl-molfile', |
423 | 'chemical/x-mdl-sdfile', |
424 | 'chemical/x-mdl-rxnfile', |
425 | 'chemical/x-mdl-rdfile', |
426 | 'chemical/x-mdl-rgfile', |
427 | ], |
428 | MEDIATYPE_TEXT => [ |
429 | 'text/plain', |
430 | 'text/html', |
431 | 'text/plain', |
432 | 'text/html', |
433 | 'application/xhtml+xml', |
434 | 'application/xml', |
435 | 'text/xml', |
436 | 'text', |
437 | 'application/json', |
438 | 'text/csv', |
439 | 'text/tab-separated-values', |
440 | ], |
441 | MEDIATYPE_VIDEO => [ |
442 | 'video/ogg', |
443 | 'video/mpeg', |
444 | 'video/mpeg', |
445 | 'application/mpeg', |
446 | 'video/ogg', |
447 | 'video/x-sgi-video', |
448 | 'video/x-flv', |
449 | 'video/webm', |
450 | 'video/x-matroska', |
451 | 'video/mp4', |
452 | ], |
453 | MEDIATYPE_UNKNOWN => [ |
454 | 'unknown/unknown', |
455 | 'application/octet-stream', |
456 | 'application/x-empty', |
457 | ], |
458 | MEDIATYPE_ARCHIVE => [ |
459 | 'application/zip', |
460 | 'application/x-zip', |
461 | 'application/x-gzip', |
462 | 'application/x-bzip', |
463 | 'application/x-bzip2', |
464 | 'application/x-tar', |
465 | 'application/x-stuffit', |
466 | 'application/x-opc+zip', |
467 | 'application/x-7z-compressed', |
468 | ], |
469 | MEDIATYPE_3D => [ |
470 | 'application/sla', |
471 | ], |
472 | ]; |
473 | |
474 | /** @var array Map of variant MIME types to their canonical MIME type */ |
475 | public const MIME_TYPE_ALIASES = [ |
476 | 'text/javascript' => 'application/javascript', |
477 | 'application/x-javascript' => 'application/javascript', |
478 | 'audio/mpeg' => 'audio/mp3', |
479 | 'audio/ogg' => 'application/ogg', |
480 | 'video/ogg' => 'application/ogg', |
481 | 'image/x-ms-bmp' => 'image/x-bmp', |
482 | 'image/bmp' => 'image/x-bmp', |
483 | 'application/octet-stream' => 'unknown/unknown', |
484 | 'application/x-empty' => 'unknown/unknown', |
485 | 'image/x-png' => 'image/png', |
486 | 'image/pjpeg' => 'image/jpeg', |
487 | 'image/x-ico' => 'image/x-icon', |
488 | 'image/vnd.microsoft.icon' => 'image/x-icon', |
489 | 'image/x-portable-greymap' => 'image/x-portable-graymap', |
490 | 'application/x-bmp' => 'image/x-bmp', |
491 | 'application/bmp' => 'image/x-bmp', |
492 | 'image/psd' => 'image/x-photoshop', |
493 | 'image/x-psd' => 'image/x-photoshop', |
494 | 'image/photoshop' => 'image/x-photoshop', |
495 | 'image/vnd.adobe.photoshop' => 'image/x-photoshop', |
496 | 'application/svg+xml' => 'image/svg+xml', |
497 | 'application/svg' => 'image/svg+xml', |
498 | 'image/svg' => 'image/svg+xml', |
499 | 'audio/mp3' => 'audio/mpeg', |
500 | 'audio/mpeg3' => 'audio/mpeg', |
501 | 'audio/x-wav' => 'audio/wav', |
502 | 'audio/wave' => 'audio/wav', |
503 | 'audio/mid' => 'audio/midi', |
504 | 'application/mpeg' => 'video/mpeg', |
505 | 'application/x-ogg' => 'application/ogg', |
506 | 'audio/x-ogg' => 'application/ogg', |
507 | 'video/x-ogg' => 'application/ogg', |
508 | 'application/xhtml+xml' => 'text/html', |
509 | 'text/xml' => 'application/xml', |
510 | 'application/x-zip' => 'application/zip', |
511 | 'application/x-ecmascript' => 'application/javascript', |
512 | 'text/ecmascript' => 'application/javascript', |
513 | 'application/acrobat' => 'application/pdf', |
514 | 'image/x.djvu' => 'image/vnd.djvu', |
515 | 'image/x-djvu' => 'image/vnd.djvu', |
516 | 'application/x-acad' => 'application/acad', |
517 | 'application/autocad_dwg' => 'application/acad', |
518 | 'image/x-dwg' => 'application/acad', |
519 | 'application/dwg' => 'application/acad', |
520 | 'application/x-dwg' => 'application/acad', |
521 | 'application/x-autocad' => 'application/acad', |
522 | 'image/vnd.dwg' => 'application/acad', |
523 | 'drawing/dwg' => 'application/acad', |
524 | 'image/jpeg2000' => 'image/jp2', |
525 | 'image/jpeg2000-image' => 'image/jp2', |
526 | 'image/x-jpeg2000-image' => 'image/jp2', |
527 | ]; |
528 | } |