Verzeichnisstruktur phpBB-3.3.15


Veröffentlicht
28.08.2024

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

MimeType.php

Zuletzt modifiziert: 02.04.2025, 15:03 - Dateigröße: 4.99 KiB


001  <?php
002   
003  namespace GuzzleHttp\Psr7;
004   
005  final class MimeType
006  {
007      /**
008       * Determines the mimetype of a file by looking at its extension.
009       *
010       * @param string $filename
011       *
012       * @return string|null
013       */
014      public static function fromFilename($filename)
015      {
016          return self::fromExtension(pathinfo($filename, PATHINFO_EXTENSION));
017      }
018   
019      /**
020       * Maps a file extensions to a mimetype.
021       *
022       * @param string $extension string The file extension.
023       *
024       * @return string|null
025       *
026       * @link http://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x/conf/mime.types
027       */
028      public static function fromExtension($extension)
029      {
030          static $mimetypes = [
031              '3gp' => 'video/3gpp',
032              '7z' => 'application/x-7z-compressed',
033              'aac' => 'audio/x-aac',
034              'ai' => 'application/postscript',
035              'aif' => 'audio/x-aiff',
036              'asc' => 'text/plain',
037              'asf' => 'video/x-ms-asf',
038              'atom' => 'application/atom+xml',
039              'avi' => 'video/x-msvideo',
040              'bmp' => 'image/bmp',
041              'bz2' => 'application/x-bzip2',
042              'cer' => 'application/pkix-cert',
043              'crl' => 'application/pkix-crl',
044              'crt' => 'application/x-x509-ca-cert',
045              'css' => 'text/css',
046              'csv' => 'text/csv',
047              'cu' => 'application/cu-seeme',
048              'deb' => 'application/x-debian-package',
049              'doc' => 'application/msword',
050              'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
051              'dvi' => 'application/x-dvi',
052              'eot' => 'application/vnd.ms-fontobject',
053              'eps' => 'application/postscript',
054              'epub' => 'application/epub+zip',
055              'etx' => 'text/x-setext',
056              'flac' => 'audio/flac',
057              'flv' => 'video/x-flv',
058              'gif' => 'image/gif',
059              'gz' => 'application/gzip',
060              'htm' => 'text/html',
061              'html' => 'text/html',
062              'ico' => 'image/x-icon',
063              'ics' => 'text/calendar',
064              'ini' => 'text/plain',
065              'iso' => 'application/x-iso9660-image',
066              'jar' => 'application/java-archive',
067              'jpe' => 'image/jpeg',
068              'jpeg' => 'image/jpeg',
069              'jpg' => 'image/jpeg',
070              'js' => 'text/javascript',
071              'json' => 'application/json',
072              'latex' => 'application/x-latex',
073              'log' => 'text/plain',
074              'm4a' => 'audio/mp4',
075              'm4v' => 'video/mp4',
076              'mid' => 'audio/midi',
077              'midi' => 'audio/midi',
078              'mov' => 'video/quicktime',
079              'mkv' => 'video/x-matroska',
080              'mp3' => 'audio/mpeg',
081              'mp4' => 'video/mp4',
082              'mp4a' => 'audio/mp4',
083              'mp4v' => 'video/mp4',
084              'mpe' => 'video/mpeg',
085              'mpeg' => 'video/mpeg',
086              'mpg' => 'video/mpeg',
087              'mpg4' => 'video/mp4',
088              'oga' => 'audio/ogg',
089              'ogg' => 'audio/ogg',
090              'ogv' => 'video/ogg',
091              'ogx' => 'application/ogg',
092              'pbm' => 'image/x-portable-bitmap',
093              'pdf' => 'application/pdf',
094              'pgm' => 'image/x-portable-graymap',
095              'png' => 'image/png',
096              'pnm' => 'image/x-portable-anymap',
097              'ppm' => 'image/x-portable-pixmap',
098              'ppt' => 'application/vnd.ms-powerpoint',
099              'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
100              'ps' => 'application/postscript',
101              'qt' => 'video/quicktime',
102              'rar' => 'application/x-rar-compressed',
103              'ras' => 'image/x-cmu-raster',
104              'rss' => 'application/rss+xml',
105              'rtf' => 'application/rtf',
106              'sgm' => 'text/sgml',
107              'sgml' => 'text/sgml',
108              'svg' => 'image/svg+xml',
109              'swf' => 'application/x-shockwave-flash',
110              'tar' => 'application/x-tar',
111              'tif' => 'image/tiff',
112              'tiff' => 'image/tiff',
113              'torrent' => 'application/x-bittorrent',
114              'ttf' => 'application/x-font-ttf',
115              'txt' => 'text/plain',
116              'wav' => 'audio/x-wav',
117              'webm' => 'video/webm',
118              'webp' => 'image/webp',
119              'wma' => 'audio/x-ms-wma',
120              'wmv' => 'video/x-ms-wmv',
121              'woff' => 'application/x-font-woff',
122              'wsdl' => 'application/wsdl+xml',
123              'xbm' => 'image/x-xbitmap',
124              'xls' => 'application/vnd.ms-excel',
125              'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
126              'xml' => 'application/xml',
127              'xpm' => 'image/x-xpixmap',
128              'xwd' => 'image/x-xwindowdump',
129              'yaml' => 'text/yaml',
130              'yml' => 'text/yaml',
131              'zip' => 'application/zip',
132          ];
133   
134          $extension = strtolower($extension);
135   
136          return isset($mimetypes[$extension])
137              ? $mimetypes[$extension]
138              : null;
139      }
140  }
141