ap_allowed_mimes()

Description #

Return allowed mime types.

Changelog #

VersionDescription
3.0.0Introduced.

Source #

File: includes/upload.php

function ap_allowed_mimes() {
	$allowed = ap_opt( 'allowed_file_mime' );

	if ( empty( $allowed ) ) {
		$allowed = '';
	}

	// Convert to array split by new line and =>.
	$allowed = explode( "\n", $allowed );

	$mimes = array();

	if ( ! empty( $allowed ) ) {
		foreach ( $allowed as $a ) {
			$a = explode( '=>', $a );

			if ( ! isset( $a[1] ) || empty( $a[0] ) || empty( $a[1] ) ) {
				continue;
			}

			$mimes[ trim( $a[0] ) ] = trim( $a[1] );
		}
	}

	/**
	 * Filter allowed mimes types.
	 *
	 * @param array $mimes Default mimes types.
	 * @since 3.0.0
	 */
	return apply_filters( 'ap_allowed_mimes', $mimes );
}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment