check_upload_mimes()

check_upload_mimes()函数是Wordpress函数

check_upload_mimes( array $mimes )

根据白名单检查MIME类型数组。
Check an array of MIME types against a whitelist.

说明(Description)

WordPress附带一组允许上传的文件类型,在wp includes中定义/函数.php在get_allowed_mime_types()中。此函数用于根据wp admin/network上的多站点超级管理员提供的文件类型白名单筛选该列表/设置.php.


参数(Parameters)

参数类型必填说明
$mimes(array)必需

返回(Return)

(array)


源码(Source)

/**
 * Check an array of MIME types against a whitelist.
 *
 * WordPress ships with a set of allowed upload filetypes,
 * which is defined in wp-includes/functions.php in
 * get_allowed_mime_types(). This function is used to filter
 * that list against the filetype whitelist provided by Multisite
 * Super Admins at wp-admin/network/settings.php.
 *
 * @since MU
 *
 * @param array $mimes
 * @return array
 */
function check_upload_mimes( $mimes ) {
	$site_exts = explode( ' ', get_site_option( 'upload_filetypes', 'jpg jpeg png gif' ) );
	$site_mimes = array();
	foreach ( $site_exts as $ext ) {
		foreach ( $mimes as $ext_pattern => $mime ) {
			if ( $ext != '' && strpos( $ext_pattern, $ext ) !== false )
				$site_mimes[$ext_pattern] = $mime;
		}
	}
	return $site_mimes;
}
更新版本源码位置使用被使用
MU (3.0.0)wp-includes/ms-functions.php:184701 function
0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索