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


Top ↑

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;
	}

Top ↑

Changelog Changelog

Changelog
Version Description
2.3.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.