[ Index ]

PHP Cross Reference of phpBB-3.3.0-deutsch

title

Body

[close]

/phpbb/mimetype/ -> extension_guesser.php (source)

   1  <?php
   2  /**
   3  *
   4  * This file is part of the phpBB Forum Software package.
   5  *
   6  * @copyright (c) phpBB Limited <https://www.phpbb.com>
   7  * @license GNU General Public License, version 2 (GPL-2.0)
   8  *
   9  * For full copyright and license information, please see
  10  * the docs/CREDITS.txt file.
  11  *
  12  */
  13  
  14  namespace phpbb\mimetype;
  15  
  16  class extension_guesser extends guesser_base
  17  {
  18      /**
  19      * @var file extension map
  20      */
  21      protected $extension_map = array(
  22          '3dm'        => 'x-world/x-3dmf',
  23          '3dmf'        => 'x-world/x-3dmf',
  24          'a'        => 'application/octet-stream',
  25          'aab'        => 'application/x-authorware-bin',
  26          'aam'        => 'application/x-authorware-map',
  27          'aas'        => 'application/x-authorware-seg',
  28          'abc'        => 'text/vnd.abc',
  29          'acgi'        => 'text/html',
  30          'afl'        => 'video/animaflex',
  31          'ai'        => 'application/postscript',
  32          'aif'        => 'audio/aiff',
  33          'aifc'        => 'audio/aiff',
  34          'aiff'        => 'audio/aiff',
  35          'aim'        => 'application/x-aim',
  36          'aip'        => 'text/x-audiosoft-intra',
  37          'ani'        => 'application/x-navi-animation',
  38          'aos'        => 'application/x-nokia-9000-communicator-add-on-software',
  39          'aps'        => 'application/mime',
  40          'arc'        => 'application/octet-stream',
  41          'arj'        => 'application/arj',
  42          'art'        => 'image/x-jg',
  43          'asf'        => 'video/x-ms-asf',
  44          'asm'        => 'text/x-asm',
  45          'asp'        => 'text/asp',
  46          'asx'        => 'video/x-ms-asf',
  47          'au'        => 'audio/x-au',
  48          'avi'        => 'video/avi',
  49          'avs'        => 'video/avs-video',
  50          'bcpio'        => 'application/x-bcpio',
  51          'bin'        => 'application/x-binary',
  52          'bm'        => 'image/bmp',
  53          'bmp'        => 'image/bmp',
  54          'boo'        => 'application/book',
  55          'book'        => 'application/book',
  56          'boz'        => 'application/x-bzip2',
  57          'bsh'        => 'application/x-bsh',
  58          'bz'        => 'application/x-bzip',
  59          'bz2'        => 'application/x-bzip2',
  60          'c'        => 'text/x-c',
  61          'c++'        => 'text/x-c',
  62          'cat'        => 'application/vnd.ms-pki.seccat',
  63          'cc'        => 'text/plain',
  64          'ccad'        => 'application/clariscad',
  65          'cco'        => 'application/x-cocoa',
  66          'cdf'        => 'application/cdf',
  67          'cer'        => 'application/x-x509-ca-cert',
  68          'cha'        => 'application/x-chat',
  69          'chat'        => 'application/x-chat',
  70          'class'        => 'application/java',
  71          'com'        => 'application/octet-stream',
  72          'conf'        => 'text/plain',
  73          'cpio'        => 'application/x-cpio',
  74          'cpp'        => 'text/x-c',
  75          'cpt'        => 'application/x-cpt',
  76          'crl'        => 'application/pkix-crl',
  77          'crt'        => 'application/x-x509-ca-cert',
  78          'csh'        => 'application/x-csh',
  79          'css'        => 'text/css',
  80          'cxx'        => 'text/plain',
  81          'dcr'        => 'application/x-director',
  82          'deepv'        => 'application/x-deepv',
  83          'def'        => 'text/plain',
  84          'der'        => 'application/x-x509-ca-cert',
  85          'dif'        => 'video/x-dv',
  86          'dir'        => 'application/x-director',
  87          'dl'        => 'video/dl',
  88          'doc'        => 'application/msword',
  89          'dot'        => 'application/msword',
  90          'dp'        => 'application/commonground',
  91          'drw'        => 'application/drafting',
  92          'dump'        => 'application/octet-stream',
  93          'dv'        => 'video/x-dv',
  94          'dvi'        => 'application/x-dvi',
  95          'dwf'        => 'model/vnd.dwf',
  96          'dwg'        => 'image/x-dwg',
  97          'dxf'        => 'image/x-dwg',
  98          'dxr'        => 'application/x-director',
  99          'el'        => 'text/x-script.elisp',
 100          'elc'        => 'application/x-elc',
 101          'env'        => 'application/x-envoy',
 102          'eps'        => 'application/postscript',
 103          'es'        => 'application/x-esrehber',
 104          'etx'        => 'text/x-setext',
 105          'evy'        => 'application/x-envoy',
 106          'exe'        => 'application/octet-stream',
 107          'f'        => 'text/x-fortran',
 108          'f77'        => 'text/x-fortran',
 109          'f90'        => 'text/x-fortran',
 110          'fdf'        => 'application/vnd.fdf',
 111          'fif'        => 'image/fif',
 112          'fli'        => 'video/x-fli',
 113          'flo'        => 'image/florian',
 114          'flx'        => 'text/vnd.fmi.flexstor',
 115          'fmf'        => 'video/x-atomic3d-feature',
 116          'for'        => 'text/x-fortran',
 117          'fpx'        => 'image/vnd.fpx',
 118          'frl'        => 'application/freeloader',
 119          'funk'        => 'audio/make',
 120          'g'        => 'text/plain',
 121          'g3'        => 'image/g3fax',
 122          'gif'        => 'image/gif',
 123          'gl'        => 'video/x-gl',
 124          'gsd'        => 'audio/x-gsm',
 125          'gsm'        => 'audio/x-gsm',
 126          'gsp'        => 'application/x-gsp',
 127          'gss'        => 'application/x-gss',
 128          'gtar'        => 'application/x-gtar',
 129          'gz'        => 'application/x-gzip',
 130          'gzip'        => 'application/x-gzip',
 131          'h'        => 'text/x-h',
 132          'hdf'        => 'application/x-hdf',
 133          'help'        => 'application/x-helpfile',
 134          'hgl'        => 'application/vnd.hp-hpgl',
 135          'hh'        => 'text/x-h',
 136          'hlb'        => 'text/x-script',
 137          'hlp'        => 'application/hlp',
 138          'hpg'        => 'application/vnd.hp-hpgl',
 139          'hpgl'        => 'application/vnd.hp-hpgl',
 140          'hqx'        => 'application/x-binhex40',
 141          'hta'        => 'application/hta',
 142          'htc'        => 'text/x-component',
 143          'htm'        => 'text/html',
 144          'html'        => 'text/html',
 145          'htmls'        => 'text/html',
 146          'htt'        => 'text/webviewhtml',
 147          'htx'        => 'text/html',
 148          'ice'        => 'x-conference/x-cooltalk',
 149          'ico'        => 'image/x-icon',
 150          'idc'        => 'text/plain',
 151          'ief'        => 'image/ief',
 152          'iefs'        => 'image/ief',
 153          'iges'        => 'application/iges',
 154          'igs'        => 'application/iges',
 155          'ima'        => 'application/x-ima',
 156          'imap'        => 'application/x-httpd-imap',
 157          'inf'        => 'application/inf',
 158          'ins'        => 'application/x-internett-signup',
 159          'ip'        => 'application/x-ip2',
 160          'isu'        => 'video/x-isvideo',
 161          'it'        => 'audio/it',
 162          'iv'        => 'application/x-inventor',
 163          'ivr'        => 'i-world/i-vrml',
 164          'ivy'        => 'application/x-livescreen',
 165          'jam'        => 'audio/x-jam',
 166          'jav'        => 'text/plain',
 167          'jav'        => 'text/x-java-source',
 168          'java'        => 'text/x-java-source',
 169          'jcm'        => 'application/x-java-commerce',
 170          'jfif'        => 'image/jpeg',
 171          'jfif-tbnl'    => 'image/jpeg',
 172          'jpe'        => 'image/jpeg',
 173          'jpeg'        => 'image/jpeg',
 174          'jpg'        => 'image/jpeg',
 175          'jps'        => 'image/x-jps',
 176          'js'        => 'application/x-javascript',
 177          'jut'        => 'image/jutvision',
 178          'kar'        => 'audio/midi',
 179          'ksh'        => 'text/x-script.ksh',
 180          'la'        => 'audio/x-nspaudio',
 181          'lam'        => 'audio/x-liveaudio',
 182          'latex'        => 'application/x-latex',
 183          'lha'        => 'application/x-lha',
 184          'lhx'        => 'application/octet-stream',
 185          'list'        => 'text/plain',
 186          'lma'        => 'audio/x-nspaudio',
 187          'log'        => 'text/plain',
 188          'lsp'        => 'text/x-script.lisp',
 189          'lst'        => 'text/plain',
 190          'lsx'        => 'text/x-la-asf',
 191          'ltx'        => 'application/x-latex',
 192          'lzh'        => 'application/x-lzh',
 193          'lzx'        => 'application/x-lzx',
 194          'm'        => 'text/x-m',
 195          'm1v'        => 'video/mpeg',
 196          'm2a'        => 'audio/mpeg',
 197          'm2v'        => 'video/mpeg',
 198          'm3u'        => 'audio/x-mpequrl',
 199          'man'        => 'application/x-troff-man',
 200          'map'        => 'application/x-navimap',
 201          'mar'        => 'text/plain',
 202          'mbd'        => 'application/mbedlet',
 203          'mc$'        => 'application/x-magic-cap-package-1.0',
 204          'mcd'        => 'application/x-mathcad',
 205          'mcf'        => 'text/mcf',
 206          'mcp'        => 'application/netmc',
 207          'me'        => 'application/x-troff-me',
 208          'mht'        => 'message/rfc822',
 209          'mhtml'        => 'message/rfc822',
 210          'mid'        => 'audio/x-midi',
 211          'midi'        => 'audio/x-midi',
 212          'mif'        => 'application/x-mif',
 213          'mime'        => 'www/mime',
 214          'mjf'        => 'audio/x-vnd.audioexplosion.mjuicemediafile',
 215          'mjpg'        => 'video/x-motion-jpeg',
 216          'mm'        => 'application/x-meme',
 217          'mme'        => 'application/base64',
 218          'mod'        => 'audio/x-mod',
 219          'moov'        => 'video/quicktime',
 220          'mov'        => 'video/quicktime',
 221          'movie'        => 'video/x-sgi-movie',
 222          'mp2'        => 'audio/x-mpeg',
 223          'mp3'        => 'audio/x-mpeg-3',
 224          'mpa'        => 'audio/mpeg',
 225          'mpc'        => 'application/x-project',
 226          'mpe'        => 'video/mpeg',
 227          'mpeg'        => 'video/mpeg',
 228          'mpg'        => 'video/mpeg',
 229          'mpga'        => 'audio/mpeg',
 230          'mpp'        => 'application/vnd.ms-project',
 231          'mpt'        => 'application/x-project',
 232          'mpv'        => 'application/x-project',
 233          'mpx'        => 'application/x-project',
 234          'mrc'        => 'application/marc',
 235          'ms'        => 'application/x-troff-ms',
 236          'mv'        => 'video/x-sgi-movie',
 237          'my'        => 'audio/make',
 238          'mzz'        => 'application/x-vnd.audioexplosion.mzz',
 239          'nap'        => 'image/naplps',
 240          'naplps'    => 'image/naplps',
 241          'nc'        => 'application/x-netcdf',
 242          'ncm'        => 'application/vnd.nokia.configuration-message',
 243          'nif'        => 'image/x-niff',
 244          'niff'        => 'image/x-niff',
 245          'nix'        => 'application/x-mix-transfer',
 246          'nsc'        => 'application/x-conference',
 247          'nvd'        => 'application/x-navidoc',
 248          'o'        => 'application/octet-stream',
 249          'oda'        => 'application/oda',
 250          'omc'        => 'application/x-omc',
 251          'omcd'        => 'application/x-omcdatamaker',
 252          'omcr'        => 'application/x-omcregerator',
 253          'p'        => 'text/x-pascal',
 254          'p10'        => 'application/x-pkcs10',
 255          'p12'        => 'application/x-pkcs12',
 256          'p7a'        => 'application/x-pkcs7-signature',
 257          'p7c'        => 'application/x-pkcs7-mime',
 258          'p7m'        => 'application/x-pkcs7-mime',
 259          'p7r'        => 'application/x-pkcs7-certreqresp',
 260          'p7s'        => 'application/pkcs7-signature',
 261          'part'        => 'application/pro_eng',
 262          'pas'        => 'text/pascal',
 263          'pbm'        => 'image/x-portable-bitmap',
 264          'pcl'        => 'application/x-pcl',
 265          'pct'        => 'image/x-pict',
 266          'pcx'        => 'image/x-pcx',
 267          'pdb'        => 'chemical/x-pdb',
 268          'pdf'        => 'application/pdf',
 269          'pfunk'        => 'audio/make.my.funk',
 270          'pgm'        => 'image/x-portable-greymap',
 271          'pic'        => 'image/pict',
 272          'pict'        => 'image/pict',
 273          'pkg'        => 'application/x-newton-compatible-pkg',
 274          'pko'        => 'application/vnd.ms-pki.pko',
 275          'pl'        => 'text/x-script.perl',
 276          'plx'        => 'application/x-pixclscript',
 277          'pm'        => 'text/x-script.perl-module',
 278          'pm4'        => 'application/x-pagemaker',
 279          'pm5'        => 'application/x-pagemaker',
 280          'png'        => 'image/png',
 281          'pnm'        => 'image/x-portable-anymap',
 282          'pot'        => 'application/mspowerpoint',
 283          'pov'        => 'model/x-pov',
 284          'ppa'        => 'application/vnd.ms-powerpoint',
 285          'ppm'        => 'image/x-portable-pixmap',
 286          'pps'        => 'application/mspowerpoint',
 287          'ppt'        => 'application/mspowerpoint',
 288          'ppz'        => 'application/mspowerpoint',
 289          'pre'        => 'application/x-freelance',
 290          'prt'        => 'application/pro_eng',
 291          'ps'        => 'application/postscript',
 292          'psd'        => 'application/octet-stream',
 293          'pvu'        => 'paleovu/x-pv',
 294          'pwz'        => 'application/vnd.ms-powerpoint',
 295          'py'        => 'text/x-script.phyton',
 296          'pyc'        => 'applicaiton/x-bytecode.python',
 297          'qcp'        => 'audio/vnd.qcelp',
 298          'qd3'        => 'x-world/x-3dmf',
 299          'qd3d'        => 'x-world/x-3dmf',
 300          'qif'        => 'image/x-quicktime',
 301          'qt'        => 'video/quicktime',
 302          'qtc'        => 'video/x-qtc',
 303          'qti'        => 'image/x-quicktime',
 304          'qtif'        => 'image/x-quicktime',
 305          'ra'        => 'audio/x-realaudio',
 306          'ram'        => 'audio/x-pn-realaudio',
 307          'ras'        => 'image/x-cmu-raster',
 308          'rast'        => 'image/cmu-raster',
 309          'rexx'        => 'text/x-script.rexx',
 310          'rf'        => 'image/vnd.rn-realflash',
 311          'rgb'        => 'image/x-rgb',
 312          'rm'        => 'audio/x-pn-realaudio',
 313          'rmi'        => 'audio/mid',
 314          'rmm'        => 'audio/x-pn-realaudio',
 315          'rmp'        => 'audio/x-pn-realaudio',
 316          'rng'        => 'application/vnd.nokia.ringing-tone',
 317          'rnx'        => 'application/vnd.rn-realplayer',
 318          'roff'        => 'application/x-troff',
 319          'rp'        => 'image/vnd.rn-realpix',
 320          'rpm'        => 'audio/x-pn-realaudio-plugin',
 321          'rt'        => 'text/richtext',
 322          'rtf'        => 'text/richtext',
 323          'rtx'        => 'text/richtext',
 324          'rv'        => 'video/vnd.rn-realvideo',
 325          's'        => 'text/x-asm',
 326          's3m'        => 'audio/s3m',
 327          'saveme'    => 'application/octet-stream',
 328          'sbk'        => 'application/x-tbook',
 329          'scm'        => 'video/x-scm',
 330          'sdml'        => 'text/plain',
 331          'sdp'        => 'application/x-sdp',
 332          'sdr'        => 'application/sounder',
 333          'sea'        => 'application/x-sea',
 334          'set'        => 'application/set',
 335          'sgm'        => 'text/x-sgml',
 336          'sgml'        => 'text/x-sgml',
 337          'sh'        => 'text/x-script.sh',
 338          'shar'        => 'application/x-shar',
 339          'shtml'        => 'text/x-server-parsed-html',
 340          'sid'        => 'audio/x-psid',
 341          'sit'        => 'application/x-stuffit',
 342          'skd'        => 'application/x-koan',
 343          'skm'        => 'application/x-koan',
 344          'skp'        => 'application/x-koan',
 345          'skt'        => 'application/x-koan',
 346          'sl'        => 'application/x-seelogo',
 347          'smi'        => 'application/smil',
 348          'smil'        => 'application/smil',
 349          'snd'        => 'audio/x-adpcm',
 350          'sol'        => 'application/solids',
 351          'spc'        => 'text/x-speech',
 352          'spl'        => 'application/futuresplash',
 353          'spr'        => 'application/x-sprite',
 354          'sprite'    => 'application/x-sprite',
 355          'src'        => 'application/x-wais-source',
 356          'ssi'        => 'text/x-server-parsed-html',
 357          'ssm'        => 'application/streamingmedia',
 358          'sst'        => 'application/vnd.ms-pki.certstore',
 359          'step'        => 'application/step',
 360          'stl'        => 'application/vnd.ms-pki.stl',
 361          'stp'        => 'application/step',
 362          'sv4cpio'    => 'application/x-sv4cpio',
 363          'sv4crc'    => 'application/x-sv4crc',
 364          'svf'        => 'image/x-dwg',
 365          'svr'        => 'application/x-world',
 366          'swf'        => 'application/x-shockwave-flash',
 367          't'        => 'application/x-troff',
 368          'talk'        => 'text/x-speech',
 369          'tar'        => 'application/x-tar',
 370          'tbk'        => 'application/x-tbook',
 371          'tcl'        => 'text/x-script.tcl',
 372          'tcsh'        => 'text/x-script.tcsh',
 373          'tex'        => 'application/x-tex',
 374          'texi'        => 'application/x-texinfo',
 375          'texinfo'    => 'application/x-texinfo',
 376          'text'        => 'text/plain',
 377          'tgz'        => 'application/x-compressed',
 378          'tif'        => 'image/tiff',
 379          'tiff'        => 'image/tiff',
 380          'tr'        => 'application/x-troff',
 381          'tsi'        => 'audio/tsp-audio',
 382          'tsp'        => 'audio/tsplayer',
 383          'tsv'        => 'text/tab-separated-values',
 384          'turbot'    => 'image/florian',
 385          'txt'        => 'text/plain',
 386          'uil'        => 'text/x-uil',
 387          'uni'        => 'text/uri-list',
 388          'unis'        => 'text/uri-list',
 389          'unv'        => 'application/i-deas',
 390          'uri'        => 'text/uri-list',
 391          'uris'        => 'text/uri-list',
 392          'ustar'        => 'multipart/x-ustar',
 393          'uu'        => 'text/x-uuencode',
 394          'uue'        => 'text/x-uuencode',
 395          'vcd'        => 'application/x-cdlink',
 396          'vcs'        => 'text/x-vcalendar',
 397          'vda'        => 'application/vda',
 398          'vdo'        => 'video/vdo',
 399          'vew'        => 'application/groupwise',
 400          'viv'        => 'video/vivo',
 401          'vivo'        => 'video/vivo',
 402          'vmd'        => 'application/vocaltec-media-desc',
 403          'vmf'        => 'application/vocaltec-media-file',
 404          'voc'        => 'audio/voc',
 405          'vos'        => 'video/vosaic',
 406          'vox'        => 'audio/voxware',
 407          'vqe'        => 'audio/x-twinvq-plugin',
 408          'vqf'        => 'audio/x-twinvq',
 409          'vql'        => 'audio/x-twinvq-plugin',
 410          'vrml'        => 'application/x-vrml',
 411          'vrt'        => 'x-world/x-vrt',
 412          'vsd'        => 'application/x-visio',
 413          'vst'        => 'application/x-visio',
 414          'vsw'        => 'application/x-visio',
 415          'w60'        => 'application/wordperfect6.0',
 416          'w61'        => 'application/wordperfect6.1',
 417          'w6w'        => 'application/msword',
 418          'wav'        => 'audio/wav',
 419          'wb1'        => 'application/x-qpro',
 420          'wbmp'        => 'image/vnd.wap.wbmp',
 421          'web'        => 'application/vnd.xara',
 422          'wiz'        => 'application/msword',
 423          'wk1'        => 'application/x-123',
 424          'wmf'        => 'windows/metafile',
 425          'wml'        => 'text/vnd.wap.wml',
 426          'wmlc'        => 'application/vnd.wap.wmlc',
 427          'wmls'        => 'text/vnd.wap.wmlscript',
 428          'wmlsc'        => 'application/vnd.wap.wmlscriptc',
 429          'word'        => 'application/msword',
 430          'wp'        => 'application/wordperfect',
 431          'wp5'        => 'application/wordperfect',
 432          'wp6'        => 'application/wordperfect',
 433          'wpd'        => 'application/wordperfect',
 434          'wq1'        => 'application/x-lotus',
 435          'wri'        => 'application/mswrite',
 436          'wrl'        => 'model/vrml',
 437          'wrz'        => 'model/vrml',
 438          'wsc'        => 'text/scriplet',
 439          'wsrc'        => 'application/x-wais-source',
 440          'wtk'        => 'application/x-wintalk',
 441          'xbm'        => 'image/xbm',
 442          'xdr'        => 'video/x-amt-demorun',
 443          'xgz'        => 'xgl/drawing',
 444          'xif'        => 'image/vnd.xiff',
 445          'xl'        => 'application/excel',
 446          'xla'        => 'application/excel',
 447          'xlb'        => 'application/excel',
 448          'xlc'        => 'application/excel',
 449          'xld'        => 'application/excel',
 450          'xlk'        => 'application/excel',
 451          'xll'        => 'application/excel',
 452          'xlm'        => 'application/excel',
 453          'xls'        => 'application/excel',
 454          'xlt'        => 'application/excel',
 455          'xlv'        => 'application/excel',
 456          'xlw'        => 'application/excel',
 457          'xm'        => 'audio/xm',
 458          'xml'        => 'text/xml',
 459          'xmz'        => 'xgl/movie',
 460          'xpix'        => 'application/x-vnd.ls-xpix',
 461          'xpm'        => 'image/xpm',
 462          'x-png'        => 'image/png',
 463          'xsr'        => 'video/x-amt-showrun',
 464          'xwd'        => 'image/x-xwindowdump',
 465          'xyz'        => 'chemical/x-pdb',
 466          'z'        => 'application/x-compressed',
 467          'zip'        => 'application/x-zip-compressed',
 468          'zoo'        => 'application/octet-stream',
 469          'zsh'        => 'text/x-script.zsh',
 470      );
 471  
 472      /**
 473      * {@inheritdoc}
 474      */
 475  	public function is_supported()
 476      {
 477          return true;
 478      }
 479  
 480      /**
 481      * {@inheritdoc}
 482      */
 483  	public function guess($file, $file_name = '')
 484      {
 485          $file_name = (empty($file_name)) ? $file : $file_name;
 486          return $this->map_extension_to_type($file_name);
 487      }
 488  
 489      /**
 490      * Map extension of supplied file_name to mime type
 491      *
 492      * @param string $file_name Path to file or filename
 493      *
 494      * @return string|null Mimetype if known or null if not
 495      */
 496  	protected function map_extension_to_type($file_name)
 497      {
 498          $extension = pathinfo($file_name, PATHINFO_EXTENSION);
 499  
 500          if (isset($this->extension_map[$extension]))
 501          {
 502              return $this->extension_map[$extension];
 503          }
 504          else
 505          {
 506              return null;
 507          }
 508      }
 509  }


Generated: Tue Apr 7 19:44:41 2020 Cross-referenced by PHPXref 0.7.1