BP_Attachment::validate_mime_types()
Validate the allowed mime types using WordPress allowed mime types.
Description Description
In case of a multisite, the mime types are already restricted by the ‘upload_filetypes’ setting. BuddyPress will respect this setting.
See also See also
Source Source
File: bp-core/classes/class-bp-attachment.php
protected function validate_mime_types() {
$wp_mimes = get_allowed_mime_types();
$valid_mimes = array();
// Set the allowed mimes for the upload.
foreach ( (array) $this->allowed_mime_types as $ext ) {
foreach ( $wp_mimes as $ext_pattern => $mime ) {
if ( $ext !== '' && strpos( $ext_pattern, $ext ) !== false ) {
$valid_mimes[$ext_pattern] = $mime;
}
}
}
return $valid_mimes;
}
Changelog Changelog
| Version | Description |
|---|---|
| 2.3.0 | Introduced. |