lib/ImageHelper.php
public static function is_svg( $file_path ) {
		if ( ! isset( $file_path ) || '' === $file_path || ! file_exists( $file_path ) ) {
			return false;
		}

		if ( TextHelper::ends_with( strtolower($file_path), '.svg' ) ) {
			return true;
		}

		/**
		 * Try reading mime type.
		 *
		 * SVG images are not allowed by default in WordPress, so we have to pass a default mime
		 * type for SVG images.
		 */
		$mime = wp_check_filetype_and_ext( $file_path, basename( $file_path ), array(
			'svg' => 'image/svg+xml',
		) );

		return in_array( $mime['type'], array(
			'image/svg+xml',
			'text/html',
			'text/plain',
			'image/svg',
		) );
	}
public static function is_svg( $file_path ) {
		if ( ! isset( $file_path ) || '' === $file_path || ! file_exists( $file_path ) ) {
			return false;
		}

		if ( TextHelper::ends_with( strtolower($file_path), '.svg' ) ) {
			return true;
		}

		/**
		 * Try reading mime type.
		 *
		 * SVG images are not allowed by default in WordPress, so we have to pass a default mime
		 * type for SVG images.
		 */
		$mime = wp_check_filetype_and_ext( $file_path, basename( $file_path ), array(
			'svg' => 'image/svg+xml',
		) );

		return in_array( $mime['type'], array(
			'image/svg+xml',
			'text/html',
			'text/plain',
			'image/svg',
		) );
	}
public static function is_svg ( $ file_path ) { if ( ! isset ( $ file_path ) || '' === $ file_path || ! file_exists ( $ file_path ) ) { return false ; } if ( TextHelper :: ends_with ( strtolower ( $ file_path ) , '.svg' ) ) { return true ; } /**
		 * Try reading mime type.
		 *
		 * SVG images are not allowed by default in WordPress, so we have to pass a default mime
		 * type for SVG images.
		 */ $ mime = wp_check_filetype_and_ext ( $ file_path , basename ( $ file_path ) , array ( 'svg' => 'image/svg+xml' , ) ) ; return in_array ( $ mime [ 'type' ] , array ( 'image/svg+xml' , 'text/html' , 'text/plain' , 'image/svg' , ) ) ; }
Checks if file is an SVG.

@param string $file_path File path to check.
@return bool True if SVG, false if not SVG or file doesn't exist.
Checks if file is an SVG .