public function setURLFromServerVars()
    {
        if ($this->server->get('REQUEST_SCHEME'))
        {
            $base = $this->server['REQUEST_SCHEME'] . '://' . $this->server['SERVER_NAME'];
            $this->url = new URL($base . $this->server['REQUEST_URI']);
            $this->webroot = new URL($base . rtrim(dirname($this->server->get('SCRIPT_NAME')), '/') . '/');
        }
        else
        {
            $this->url = new URL($this->server->get('REQUEST_URI'));

            $host = $this->server['SERVER_NAME'] ?: $this->url->host;
            $port = $this->server['SERVER_PORT'] ?: $this->url->port;
            $this->webroot = !empty($host) ? new URL('http://' . $host) : new URL('/');
            if ($port && $port != 80)
                $this->webroot->port = $port;
        }
    }
public function setURLFromServerVars()
    {
        if ($this->server->get('REQUEST_SCHEME'))
        {
            $base = $this->server['REQUEST_SCHEME'] . '://' . $this->server['SERVER_NAME'];
            $this->url = new URL($base . $this->server['REQUEST_URI']);
            $this->webroot = new URL($base . rtrim(dirname($this->server->get('SCRIPT_NAME')), '/') . '/');
        }
        else
        {
            $this->url = new URL($this->server->get('REQUEST_URI'));

            $host = $this->server['SERVER_NAME'] ?: $this->url->host;
            $port = $this->server['SERVER_PORT'] ?: $this->url->port;
            $this->webroot = !empty($host) ? new URL('http://' . $host) : new URL('/');
            if ($port && $port != 80)
                $this->webroot->port = $port;
        }
    }
public function setURLFromServerVars ( ) { if ( $ this -> server -> get ( 'REQUEST_SCHEME' ) ) { $ base = $ this -> server [ 'REQUEST_SCHEME' ] . '://' . $ this -> server [ 'SERVER_NAME' ] ; $ this -> url = new URL ( $ base . $ this -> server [ 'REQUEST_URI' ] ) ; $ this -> webroot = new URL ( $ base . rtrim ( dirname ( $ this -> server -> get ( 'SCRIPT_NAME' ) ) , '/' ) . '/' ) ; } else { $ this -> url = new URL ( $ this -> server -> get ( 'REQUEST_URI' ) ) ; $ host = $ this -> server [ 'SERVER_NAME' ] ? : $ this -> url -> host ; $ port = $ this -> server [ 'SERVER_PORT' ] ? : $ this -> url -> port ; $ this -> webroot = ! empty ( $ host ) ? new URL ( 'http://' . $ host ) : new URL ( '/' ) ; if ( $ port && $ port != 80 ) $ this -> webroot -> port = $ port ; } }
Determine the webroot and the URL from server variables. Webroot is
based on the location of the index.php that is executing, which we
consider to be the webroot.
Determine the webroot and the URL from server variables . Webroot is based on the location of the index . php that is executing which we consider to be the webroot .