Kind final class
Minn\Media\Kind · public/minn/src/Minn/Media/Kind.php · 79 lines
Whether an attachment is an image, audio, video, or a given extension, judged by its MIME type first and its file extension second.
Constants and properties
| private | IMAGE_EXTENSIONS = array ( 0 => 'jpg', 1 => 'jpeg', 2 => 'jpe', 3 => 'gif', 4 => 'png', 5 => 'webp', 6 => 'avif', 7 => 'heic', ) | |
| const | POST_MIME_TYPES = array ( 'image' => array ( 0 => 'Images', 1 => 'Manage Images', 2 => 'Image <span class="count">(%s)</span>', 3 => 'Images <span class="count">(%s)</span>', ), 'audio' => array ( 0 => 'Audio', 1 => 'Manage Audio', 2 => 'Audio <span class="count">(%s)</span>', 3 => 'Audio <span class="count">(%s)</span>', ), 'video' => array ( 0 => 'Video', 1 => 'Manage Video', 2 => 'Video <span class="count">(%s)</span>', 3 => 'Video <span class="count">(%s)</span>', ), 'application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-word.document.macroEnabled.12,application/vnd.ms-word.template.macroEnabled.12,application/vnd.oasis.opendocument.text,application/vnd.apple.pages,application/pdf,application/vnd.ms-xpsdocument,application/oxps,application/rtf,application/wordperfect,application/octet-stream' => array ( 0 => 'Documents', 1 => 'Manage Documents', 2 => 'Document <span class="count">(%s)</span>', 3 => 'Documents <span class="count">(%s)</span>', ), 'application/vnd.apple.numbers,application/vnd.oasis.opendocument.spreadsheet,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel.sheet.macroEnabled.12,application/vnd.ms-excel.sheet.binary.macroEnabled.12' => array ( 0 => 'Spreadsheets', 1 => 'Manage Spreadsheets', 2 => 'Spreadsheet <span class="count">(%s)</span>', 3 => 'Spreadsheets <span class="count">(%s)</span>', ), 'application/x-gzip,application/rar,application/x-tar,application/zip,application/x-7z-compressed' => array ( 0 => 'Archives', 1 => 'Manage Archives', 2 => 'Archive <span class="count">(%s)</span>', 3 => 'Archives <span class="count">(%s)</span>', ), ) | The media library's filter groups: a MIME pattern (a top-level type, or a comma list of full types) => its plural label, its manage label, and the singular and plural count labels. |
Public
| static | matchWildcards(array $patterns, array $reals): array# | Real mime types grouped under the wildcard patterns that match them (image, audio/*, image/jpeg, *), the last pattern first; a pattern with no matches is omitted (probe post-remaining).
@return array<string, list<string>> | ||||||
| static | matches(string $type, string $mime, string $extension, array $audioExtensions, array $videoExtensions): bool# | Whether a file is of a media type, by mime prefix or by extension list. |
Nothing matches.