public function build(&$url = '', $fqr = true)
    {
        if (is_array($url)) {
            $url = '?'.http_build_query($url, '', '&');
        }

        $url = (string) $url;

        //remove the index.php for urls that starts with index.php?
        if (strpos($url, 'index.php?') === 0) {
            $url = substr($url, 9);
        }
        //add ? to the urls that starts with a query key=
        //elseif ( preg_match('/^\w+=/', $url) ) {
        elseif (preg_match('%^[^?/]+=%', $url)) {
            $url = '?'.$url;
        }

        $uri = clone $this->_clonable_url;

        $uri->setUrl($url);

        if ($uri->scheme || $uri->path) {
            return $uri;
        }

        $query = $uri->query;

        if (isset($query['format'])) {
            $uri->format = $query['format'];
            unset($query['format']);
        }

        if ($uri->format == 'html') {
            $uri->format = null;
        }

        $parts = array();

        if (isset($query['option'])) {
            $router = $this->getComponentRouter(str_replace('com_', '', $query['option']));
            $parts = pick($router->build($query), array());
        }

        if (isset($query['option'])) {
            array_unshift($parts, str_replace('com_', '', $query['option']));
            unset($query['option']);
        }

        $uri->query = $query;

        if (!$this->_enable_rewrite) {
            array_unshift($parts, 'index.php');
        } elseif (empty($parts)) {
            array_unshift($parts, '');
        }

        array_unshift($parts, $this->_base_url->path);

        $path = implode('/', $parts);

        $uri->path = $path;

        if ($fqr) {
            foreach (array('host', 'scheme', 'port', 'user', 'pass') as $part) {
                $uri->$part = $this->_base_url->$part;
            }
        }

        return $uri;
    }
public function build(&$url = '', $fqr = true)
    {
        if (is_array($url)) {
            $url = '?'.http_build_query($url, '', '&');
        }

        $url = (string) $url;

        //remove the index.php for urls that starts with index.php?
        if (strpos($url, 'index.php?') === 0) {
            $url = substr($url, 9);
        }
        //add ? to the urls that starts with a query key=
        //elseif ( preg_match('/^\w+=/', $url) ) {
        elseif (preg_match('%^[^?/]+=%', $url)) {
            $url = '?'.$url;
        }

        $uri = clone $this->_clonable_url;

        $uri->setUrl($url);

        if ($uri->scheme || $uri->path) {
            return $uri;
        }

        $query = $uri->query;

        if (isset($query['format'])) {
            $uri->format = $query['format'];
            unset($query['format']);
        }

        if ($uri->format == 'html') {
            $uri->format = null;
        }

        $parts = array();

        if (isset($query['option'])) {
            $router = $this->getComponentRouter(str_replace('com_', '', $query['option']));
            $parts = pick($router->build($query), array());
        }

        if (isset($query['option'])) {
            array_unshift($parts, str_replace('com_', '', $query['option']));
            unset($query['option']);
        }

        $uri->query = $query;

        if (!$this->_enable_rewrite) {
            array_unshift($parts, 'index.php');
        } elseif (empty($parts)) {
            array_unshift($parts, '');
        }

        array_unshift($parts, $this->_base_url->path);

        $path = implode('/', $parts);

        $uri->path = $path;

        if ($fqr) {
            foreach (array('host', 'scheme', 'port', 'user', 'pass') as $part) {
                $uri->$part = $this->_base_url->$part;
            }
        }

        return $uri;
    }
public function build ( & $ url = '' , $ fqr = true ) { if ( is_array ( $ url ) ) { $ url = '?' . http_build_query ( $ url , '' , '&' ) ; } $ url = ( string ) $ url ; //remove the index.php for urls that starts with index.php? if ( strpos ( $ url , 'index.php?' ) === 0 ) { $ url = substr ( $ url , 9 ) ; } //add ? to the urls that starts with a query key= //elseif ( preg_match('/^\w+=/', $url) ) { elseif ( preg_match ( '%^[^?/]+=%' , $ url ) ) { $ url = '?' . $ url ; } $ uri = clone $ this -> _clonable_url ; $ uri -> setUrl ( $ url ) ; if ( $ uri -> scheme || $ uri -> path ) { return $ uri ; } $ query = $ uri -> query ; if ( isset ( $ query [ 'format' ] ) ) { $ uri -> format = $ query [ 'format' ] ; unset ( $ query [ 'format' ] ) ; } if ( $ uri -> format == 'html' ) { $ uri -> format = null ; } $ parts = array ( ) ; if ( isset ( $ query [ 'option' ] ) ) { $ router = $ this -> getComponentRouter ( str_replace ( 'com_' , '' , $ query [ 'option' ] ) ) ; $ parts = pick ( $ router -> build ( $ query ) , array ( ) ) ; } if ( isset ( $ query [ 'option' ] ) ) { array_unshift ( $ parts , str_replace ( 'com_' , '' , $ query [ 'option' ] ) ) ; unset ( $ query [ 'option' ] ) ; } $ uri -> query = $ query ; if ( ! $ this -> _enable_rewrite ) { array_unshift ( $ parts , 'index.php' ) ; } elseif ( empty ( $ parts ) ) { array_unshift ( $ parts , '' ) ; } array_unshift ( $ parts , $ this -> _base_url -> path ) ; $ path = implode ( '/' , $ parts ) ; $ uri -> path = $ path ; if ( $ fqr ) { foreach ( array ( 'host' , 'scheme' , 'port' , 'user' , 'pass' ) as $ part ) { $ uri -> $ part = $ this -> _base_url -> $ part ; } } return $ uri ; }
Builds a SEF URL.

@param string $url URL to build
@param bool   $fqr Full query resolution
Builds a SEF URL .