lib/Pico.php
protected function evaluateRequestUrl()
    {
        // use QUERY_STRING; e.g. /pico/?sub/page
        $pathComponent = isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : '';
        if ($pathComponent) {
            $pathComponent = strstr($pathComponent, '&', true) ?: $pathComponent;
            if (strpos($pathComponent, '=') === false) {
                $this->requestUrl = trim(rawurldecode($pathComponent), '/');
            }
        }

        // use REQUEST_URI (requires URL rewriting); e.g. /pico/sub/page
        if (($this->requestUrl === null) && $this->isUrlRewritingEnabled()) {
            $scriptName = isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : '/index.php';

            $basePath = dirname($scriptName);
            $basePath = !in_array($basePath, array('.', '/', '\\'), true) ? $basePath . '/' : '/';
            $basePathLength = strlen($basePath);

            $requestUri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
            if ($requestUri && (substr($requestUri, 0, $basePathLength) === $basePath)) {
                $requestUri = substr($requestUri, $basePathLength);
                if ($requestUri && (($queryStringPos = strpos($requestUri, '?')) !== false)) {
                    $requestUri = substr($requestUri, 0, $queryStringPos);
                }
                if ($requestUri && ($requestUri !== basename($scriptName))) {
                    $this->requestUrl = rtrim(rawurldecode($requestUri), '/');
                }
            }
        }

        if ($this->requestUrl === null) {
            $this->requestUrl = '';
        }
    }
protected function evaluateRequestUrl()
    {
        // use QUERY_STRING; e.g. /pico/?sub/page
        $pathComponent = isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : '';
        if ($pathComponent) {
            $pathComponent = strstr($pathComponent, '&', true) ?: $pathComponent;
            if (strpos($pathComponent, '=') === false) {
                $this->requestUrl = trim(rawurldecode($pathComponent), '/');
            }
        }

        // use REQUEST_URI (requires URL rewriting); e.g. /pico/sub/page
        if (($this->requestUrl === null) && $this->isUrlRewritingEnabled()) {
            $scriptName = isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : '/index.php';

            $basePath = dirname($scriptName);
            $basePath = !in_array($basePath, array('.', '/', '\\'), true) ? $basePath . '/' : '/';
            $basePathLength = strlen($basePath);

            $requestUri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
            if ($requestUri && (substr($requestUri, 0, $basePathLength) === $basePath)) {
                $requestUri = substr($requestUri, $basePathLength);
                if ($requestUri && (($queryStringPos = strpos($requestUri, '?')) !== false)) {
                    $requestUri = substr($requestUri, 0, $queryStringPos);
                }
                if ($requestUri && ($requestUri !== basename($scriptName))) {
                    $this->requestUrl = rtrim(rawurldecode($requestUri), '/');
                }
            }
        }

        if ($this->requestUrl === null) {
            $this->requestUrl = '';
        }
    }
protected function evaluateRequestUrl ( ) { // use QUERY_STRING; e.g. /pico/?sub/page $ pathComponent = isset ( $ _SERVER [ 'QUERY_STRING' ] ) ? $ _SERVER [ 'QUERY_STRING' ] : '' ; if ( $ pathComponent ) { $ pathComponent = strstr ( $ pathComponent , '&' , true ) ? : $ pathComponent ; if ( strpos ( $ pathComponent , '=' ) === false ) { $ this -> requestUrl = trim ( rawurldecode ( $ pathComponent ) , '/' ) ; } } // use REQUEST_URI (requires URL rewriting); e.g. /pico/sub/page if ( ( $ this -> requestUrl === null ) && $ this -> isUrlRewritingEnabled ( ) ) { $ scriptName = isset ( $ _SERVER [ 'SCRIPT_NAME' ] ) ? $ _SERVER [ 'SCRIPT_NAME' ] : '/index.php' ; $ basePath = dirname ( $ scriptName ) ; $ basePath = ! in_array ( $ basePath , array ( '.' , '/' , '\\' ) , true ) ? $ basePath . '/' : '/' ; $ basePathLength = strlen ( $ basePath ) ; $ requestUri = isset ( $ _SERVER [ 'REQUEST_URI' ] ) ? $ _SERVER [ 'REQUEST_URI' ] : '' ; if ( $ requestUri && ( substr ( $ requestUri , 0 , $ basePathLength ) === $ basePath ) ) { $ requestUri = substr ( $ requestUri , $ basePathLength ) ; if ( $ requestUri && ( ( $ queryStringPos = strpos ( $ requestUri , '?' ) ) !== false ) ) { $ requestUri = substr ( $ requestUri , 0 , $ queryStringPos ) ; } if ( $ requestUri && ( $ requestUri !== basename ( $ scriptName ) ) ) { $ this -> requestUrl = rtrim ( rawurldecode ( $ requestUri ) , '/' ) ; } } } if ( $ this -> requestUrl === null ) { $ this -> requestUrl = '' ; } }
Evaluates the requested URL

Pico uses the `QUERY_STRING` routing method (e.g. `/pico/?sub/page`)
to support SEO-like URLs out-of-the-box with any webserver. You can
still setup URL rewriting to basically remove the `?` from URLs.
However, URL rewriting requires some special configuration of your
webserver, but this should be "basic work" for any webmaster...

With Pico 1.0 you had to setup URL rewriting (e.g. using `mod_rewrite`
on Apache) in a way that rewritten URLs follow the `QUERY_STRING`
principles. Starting with version 2.0, Pico additionally supports the
`REQUEST_URI` routing method, what allows you to simply rewrite all
requests to just `index.php`. Pico then reads the requested page from
the `REQUEST_URI` environment variable provided by the webserver.
Please note that `QUERY_STRING` takes precedence over `REQUEST_URI`.

Pico 0.9 and older required Apache with `mod_rewrite` enabled, thus old
plugins, templates and contents may require you to enable URL rewriting
to work. If you're upgrading from Pico 0.9, you will probably have to
update your rewriting rules.

We recommend you to use the `link` filter in templates to create
internal links, e.g. `{{ "sub/page"|link }}` is equivalent to
`{{ base_url }}/sub/page` and `{{ base_url }}?sub/page`, depending on
enabled URL rewriting. In content files you can use the `%base_url%`
variable; e.g. `%base_url%?sub/page` will be replaced accordingly.

Heads up! Pico always interprets the first parameter as name of the
requested page (provided that the parameter has no value). According to
that you MUST NOT call Pico with a parameter without value as first
parameter (e.g. http://example.com/pico/?someBooleanParam), otherwise
Pico interprets `someBooleanParam` as name of the requested page. Use
`/pico/?someBooleanParam=` or `/pico/?index&someBooleanParam` instead.

@see Pico::getRequestUrl()

@return void
Evaluates the requested URL