wp/lib/blobfolio/wp/bm/svg/svg_base.php
public static function sanitize_domain($domain = '') {
		if (!is_string($domain)) {
			return false;
		}

		$domain = mb::strtolower(trim($domain));

		// Try to parse a full URL.
		$host = wp_parse_url($domain, PHP_URL_HOST);
		if (!$host) {
			// Strip path?
			if (false !== ($start = mb::strpos($domain, '/'))) {
				$domain = mb::substr($domain, 0, $start);
			}

			// Strip query?
			if (false !== ($start = mb::strpos($domain, '?'))) {
				$domain = mb::substr($domain, 0, $start);
			}

			// Strip port?
			if (
				!filter_var($domain, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) &&
				false !== ($start = mb::strpos($domain, ':'))
			) {
				$domain = mb::substr($domain, 0, $start);
			}

			// Bail if invalid characters at this point.
			if (filter_var($domain, FILTER_SANITIZE_URL) !== $domain) {
				return false;
			}
		} else {
			$domain = $host;
		}

		if (is_string($domain)) {
			$domain = preg_replace('/^www\./u', '', $domain);
		}

		return $domain ? $domain : false;
	}
public static function sanitize_domain($domain = '') {
		if (!is_string($domain)) {
			return false;
		}

		$domain = mb::strtolower(trim($domain));

		// Try to parse a full URL.
		$host = wp_parse_url($domain, PHP_URL_HOST);
		if (!$host) {
			// Strip path?
			if (false !== ($start = mb::strpos($domain, '/'))) {
				$domain = mb::substr($domain, 0, $start);
			}

			// Strip query?
			if (false !== ($start = mb::strpos($domain, '?'))) {
				$domain = mb::substr($domain, 0, $start);
			}

			// Strip port?
			if (
				!filter_var($domain, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) &&
				false !== ($start = mb::strpos($domain, ':'))
			) {
				$domain = mb::substr($domain, 0, $start);
			}

			// Bail if invalid characters at this point.
			if (filter_var($domain, FILTER_SANITIZE_URL) !== $domain) {
				return false;
			}
		} else {
			$domain = $host;
		}

		if (is_string($domain)) {
			$domain = preg_replace('/^www\./u', '', $domain);
		}

		return $domain ? $domain : false;
	}
Sanitize a domain-like string for more
level comparison.

@param string $domain Domain.
@return string|bool Domain. False on failure.