Code Duplication    Length = 7-8 lines in 2 locations

src/wp-includes/formatting.php 1 location

@@ 1818-1824 (lines=7) @@
1815
1816
		if ( preg_match("/^[a-zA-Z]{2,5}\d?$/", $part) ) {
1817
			$allowed = false;
1818
			foreach ( $mimes as $ext_preg => $mime_match ) {
1819
				$ext_preg = '!^(' . $ext_preg . ')$!i';
1820
				if ( preg_match( $ext_preg, $part ) ) {
1821
					$allowed = true;
1822
					break;
1823
				}
1824
			}
1825
			if ( !$allowed )
1826
				$filename .= '_';
1827
		}

src/wp-includes/media.php 1 location

@@ 3337-3344 (lines=8) @@
3334
	$exts = array_merge( wp_get_audio_extensions(), wp_get_video_extensions() );
3335
	$mimes = get_allowed_mime_types();
3336
	$ext_mimes = array();
3337
	foreach ( $exts as $ext ) {
3338
		foreach ( $mimes as $ext_preg => $mime_match ) {
3339
			if ( preg_match( '#' . $ext . '#i', $ext_preg ) ) {
3340
				$ext_mimes[ $ext ] = $mime_match;
3341
				break;
3342
			}
3343
		}
3344
	}
3345
3346
	/**
3347
	 * Allows showing or hiding the "Create Audio Playlist" button in the media library.