src/DataHandling.php
public static function sanitizeUrl($url)
    {
        $url = trim($url);

        if (!$url) {
            return null;
        }

        if (!preg_match("/^https?:\/\//i", $url)) {
            $url = "http://" . $url;
        }

        return self::sanitizeString($url);
    }
public static function sanitizeUrl($url)
    {
        $url = trim($url);

        if (!$url) {
            return null;
        }

        if (!preg_match("/^https?:\/\//i", $url)) {
            $url = "http://" . $url;
        }

        return self::sanitizeString($url);
    }
public static function sanitizeUrl ( $ url ) { $ url = trim ( $ url ) ; if ( ! $ url ) { return null ; } if ( ! preg_match ( "/^https?:\/\//i" , $ url ) ) { $ url = "http://" . $ url ; } return self :: sanitizeString ( $ url ) ; }
Prefixes the url with a protocol if it has none, to prevent local lookups.

@param string $url
@return string|null
Prefixes the url with a protocol if it has none to prevent local lookups .