Perforce Chronicle 2012.2/486814
API Documentation
|
Extends mime-type validator to clear the magic file search paths. More...
Static Public Member Functions | |
static | getTypeOfFile ($file) |
Utility method to determine the mime-type of an arbitrary file. | |
static | groupContainsType ($group, $type) |
Utility method to validate that a mime-type group contains this mime-type. | |
Protected Attributes | |
$_magicFiles = array() |
Extends mime-type validator to clear the magic file search paths.
This allows the finfo() extension to fallback on its internal mime database rather than using a database found in the file-system which may be incompatible.
static P4Cms_Validate_File_MimeType::getTypeOfFile | ( | $ | file | ) | [static] |
Utility method to determine the mime-type of an arbitrary file.
string | $file | the path of the file to get the mime type of. |
{ $validator = new static(''); $validator->isValid($file); return $validator->_type; }
static P4Cms_Validate_File_MimeType::groupContainsType | ( | $ | group, |
$ | type | ||
) | [static] |
Utility method to validate that a mime-type group contains this mime-type.
string | $group | the mime-type group to search |
string | $type | the mime-type |
{ $validator = new static($group); $mimetype = $validator->getMimeType(true); if (in_array($type, $mimetype)) { return true; } $types = explode('/', $type); $types = array_merge($types, explode('-', $type)); $types = array_merge($types, explode(';', $type)); foreach ($mimetype as $mime) { if (in_array($mime, $types)) { return true; } } return false; }
P4Cms_Validate_File_MimeType::$_magicFiles = array() [protected] |