public function redirect($sURL, $iDelay=0)
    {
        // we need to parse the query part so that the values are rawurlencode()'ed
        // can't just use parse_url() cos we could be dealing with a relative URL which
        // parse_url() can't deal with.
        $queryStart = strpos($sURL, '?', strrpos($sURL, '/'));
        if($queryStart !== false)
        {
            $queryStart++;
            $queryEnd = strpos($sURL, '#', $queryStart);
            if($queryEnd === false)
                $queryEnd = strlen($sURL);
            $queryPart = substr($sURL, $queryStart, $queryEnd-$queryStart);
            parse_str($queryPart, $queryParts);
            $newQueryPart = "";
            if($queryParts)
            {
                $first = true;
                foreach($queryParts as $key => $value)
                {
                    if($first)
                        $first = false;
                    else
                        $newQueryPart .= '&';
                    $newQueryPart .= rawurlencode($key).'='.rawurlencode($value);
                }
            } elseif($_SERVER['QUERY_STRING']) {
                    //couldn't break up the query, but there's one there
                    //possibly "http://url/page.html?query1234" type of query?
                    //just encode it and hope it works
                    $newQueryPart = rawurlencode($_SERVER['QUERY_STRING']);
                }
            $sURL = str_replace($queryPart, $newQueryPart, $sURL);
        }
        if($iDelay)
            $this->script('window.setTimeout("window.location = \'' . $sURL . '\';",' . ($iDelay*1000) . ');');
        else
            $this->script('window.location = "' . $sURL . '";');
        return $this;
    }
public function redirect($sURL, $iDelay=0)
    {
        // we need to parse the query part so that the values are rawurlencode()'ed
        // can't just use parse_url() cos we could be dealing with a relative URL which
        // parse_url() can't deal with.
        $queryStart = strpos($sURL, '?', strrpos($sURL, '/'));
        if($queryStart !== false)
        {
            $queryStart++;
            $queryEnd = strpos($sURL, '#', $queryStart);
            if($queryEnd === false)
                $queryEnd = strlen($sURL);
            $queryPart = substr($sURL, $queryStart, $queryEnd-$queryStart);
            parse_str($queryPart, $queryParts);
            $newQueryPart = "";
            if($queryParts)
            {
                $first = true;
                foreach($queryParts as $key => $value)
                {
                    if($first)
                        $first = false;
                    else
                        $newQueryPart .= '&';
                    $newQueryPart .= rawurlencode($key).'='.rawurlencode($value);
                }
            } elseif($_SERVER['QUERY_STRING']) {
                    //couldn't break up the query, but there's one there
                    //possibly "http://url/page.html?query1234" type of query?
                    //just encode it and hope it works
                    $newQueryPart = rawurlencode($_SERVER['QUERY_STRING']);
                }
            $sURL = str_replace($queryPart, $newQueryPart, $sURL);
        }
        if($iDelay)
            $this->script('window.setTimeout("window.location = \'' . $sURL . '\';",' . ($iDelay*1000) . ');');
        else
            $this->script('window.location = "' . $sURL . '";');
        return $this;
    }
public function redirect ( $ sURL , $ iDelay = 0 ) { // we need to parse the query part so that the values are rawurlencode()'ed // can't just use parse_url() cos we could be dealing with a relative URL which // parse_url() can't deal with. $ queryStart = strpos ( $ sURL , '?' , strrpos ( $ sURL , '/' ) ) ; if ( $ queryStart !== false ) { $ queryStart ++ ; $ queryEnd = strpos ( $ sURL , '#' , $ queryStart ) ; if ( $ queryEnd === false ) $ queryEnd = strlen ( $ sURL ) ; $ queryPart = substr ( $ sURL , $ queryStart , $ queryEnd - $ queryStart ) ; parse_str ( $ queryPart , $ queryParts ) ; $ newQueryPart = "" ; if ( $ queryParts ) { $ first = true ; foreach ( $ queryParts as $ key => $ value ) { if ( $ first ) $ first = false ; else $ newQueryPart .= '&' ; $ newQueryPart .= rawurlencode ( $ key ) . '=' . rawurlencode ( $ value ) ; } } elseif ( $ _SERVER [ 'QUERY_STRING' ] ) { //couldn't break up the query, but there's one there //possibly "http://url/page.html?query1234" type of query? //just encode it and hope it works $ newQueryPart = rawurlencode ( $ _SERVER [ 'QUERY_STRING' ] ) ; } $ sURL = str_replace ( $ queryPart , $ newQueryPart , $ sURL ) ; } if ( $ iDelay ) $ this -> script ( 'window.setTimeout("window.location = \'' . $ sURL . '\';",' . ( $ iDelay * 1000 ) . ');' ) ; else $ this -> script ( 'window.location = "' . $ sURL . '";' ) ; return $ this ; }
Add a command to ask the browser to navigate to the specified URL

@param string        $sURL                The relative or fully qualified URL
@param integer        $iDelay                Number of seconds to delay before the redirect occurs

@return \Jaxon\Plugin\Response
Add a command to ask the browser to navigate to the specified URL