public static function getProtocol($url = false)
    {
        if ($url) {
            return (preg_match('/^https/', $url)) ? 'https' : 'http';
        }

        $protocol = strtolower($_SERVER['SERVER_PROTOCOL']);
        $protocol = substr($protocol, 0, strpos($protocol, '/'));

        $ssl = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on');

        return ($ssl) ? $protocol . 's' : $protocol;
    }