static function getCurrent()
    {
        $protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 'https://'
            : 'http://';
        $current_uri = $protocol . $_SERVER['HTTP_HOST'] . self::getRequestURI();
        $parts = parse_url($current_uri);

        $query = '';
        if (!empty($parts['query'])) {
            $params = array();
            parse_str($parts['query'], $params);
            $params = array_filter($params);
            if (!empty($params)) {
                $query = '?' . http_build_query($params, '', '&');
            }
        }

        // Use port if non default.
        $port = isset($parts['port']) &&
        (($protocol === 'http://' && $parts['port'] !== 80) || ($protocol === 'https://' && $parts['port'] !== 443))
            ? ':' . $parts['port'] : '';

        // Rebuild.
        return $protocol . $parts['host'] . $port . $parts['path'] . $query;
    }
static function getCurrent()
    {
        $protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 'https://'
            : 'http://';
        $current_uri = $protocol . $_SERVER['HTTP_HOST'] . self::getRequestURI();
        $parts = parse_url($current_uri);

        $query = '';
        if (!empty($parts['query'])) {
            $params = array();
            parse_str($parts['query'], $params);
            $params = array_filter($params);
            if (!empty($params)) {
                $query = '?' . http_build_query($params, '', '&');
            }
        }

        // Use port if non default.
        $port = isset($parts['port']) &&
        (($protocol === 'http://' && $parts['port'] !== 80) || ($protocol === 'https://' && $parts['port'] !== 443))
            ? ':' . $parts['port'] : '';

        // Rebuild.
        return $protocol . $parts['host'] . $port . $parts['path'] . $query;
    }
static function getCurrent ( ) { $ protocol = isset ( $ _SERVER [ 'HTTPS' ] ) && $ _SERVER [ 'HTTPS' ] == 'on' ? 'https://' : 'http://' ; $ current_uri = $ protocol . $ _SERVER [ 'HTTP_HOST' ] . self :: getRequestURI ( ) ; $ parts = parse_url ( $ current_uri ) ; $ query = '' ; if ( ! empty ( $ parts [ 'query' ] ) ) { $ params = array ( ) ; parse_str ( $ parts [ 'query' ] , $ params ) ; $ params = array_filter ( $ params ) ; if ( ! empty ( $ params ) ) { $ query = '?' . http_build_query ( $ params , '' , '&' ) ; } } // Use port if non default. $ port = isset ( $ parts [ 'port' ] ) && ( ( $ protocol === 'http://' && $ parts [ 'port' ] !== 80 ) || ( $ protocol === 'https://' && $ parts [ 'port' ] !== 443 ) ) ? ':' . $ parts [ 'port' ] : '' ; // Rebuild. return $ protocol . $ parts [ 'host' ] . $ port . $ parts [ 'path' ] . $ query ; }
Returns the Current URL.

@return string The current URI
@see http://code.google.com/p/oauth2-php
@author Originally written by Naitik Shah <naitik@facebook.com>.
@author Update to draft v10 by Edison Wong <hswong3i@pantarei-design.com>
Returns the Current URL .