Code Duplication    Length = 9-11 lines in 2 locations

modules/custom-css/custom-css/preprocessors/lessc.inc.php 1 location

@@ 1001-1009 (lines=9) @@
998
		if($fullpath && ($fsize = filesize($fullpath)) !== false) {
999
			// IE8 can't handle data uris larger than 32KB
1000
			if($fsize/1024 < 32) {
1001
				if(is_null($mime)) {
1002
					if(class_exists('finfo')) { // php 5.3+
1003
						$finfo = new finfo(FILEINFO_MIME);
1004
						$mime = explode('; ', $finfo->file($fullpath));
1005
						$mime = $mime[0];
1006
					} elseif(function_exists('mime_content_type')) { // PHP 5.2
1007
						$mime = mime_content_type($fullpath);
1008
					}
1009
				}
1010
1011
				if(!is_null($mime)) // fallback if the mime type is still unknown
1012
					$url = sprintf('data:%s;base64,%s', $mime, base64_encode(file_get_contents($fullpath)));

class.json-api-endpoints.php 1 location

@@ 1752-1762 (lines=11) @@
1749
	 * @return bool
1750
	 */
1751
	protected function is_file_supported_for_sideloading( $file ) {
1752
		if ( class_exists( 'finfo' ) ) { // php 5.3+
1753
			$finfo = new finfo( FILEINFO_MIME );
1754
			$mime = explode( '; ', $finfo->file( $file ) );
1755
			$type = $mime[0];
1756
1757
		} elseif ( function_exists( 'mime_content_type' ) ) { // PHP 5.2
1758
			$type = mime_content_type( $file );
1759
1760
		} else {
1761
			return false;
1762
		}
1763
1764
		/**
1765
		 * Filter the list of supported mime types for media sideloading.