Redirect to some url.

@param string $url
@param array  $extra
@param bool   $secure

@return mixed
356783
public static function to($url, $extra = [], $secure = null)
    {
        return self::getInstance()->to($url, $extra, $secure);
    }
730261
public function delete($url, array $data = array(), array $extra = array())
    {
        $curl = new Curl(array(
            CURLOPT_URL => $url,
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_CUSTOMREQUEST => 'DELETE',
            CURLOPT_POSTFIELDS => http_build_query($data)
        ), $extra);

        return $curl->exec();
    }
52659
public function redirectIfNotUrl($url, array $allowParams = array())
    {
        if ($url != $this->getRequest()->getRequestUri()) {
            $redirect = true;
            $newArgs = array();
            try {
                $tmp = parse_url($this->getRequest()->getRequestUri());
                if (isset($tmp['path']) && $tmp['path'] == $url) {
                    $redirect = false;
                }
                if (isset($tmp['query'])) {
                    parse_str($tmp['query'], $args);
                    $alloweds = array_merge($allowParams, $this->getParameter('nyroDev_utility.redirectIfNotUrl_params', array()));
                    foreach ($alloweds as $k) {
                        if (isset($args[$k])) {
                            $newArgs[$k] = $args[$k];
                        }
                    }
                    $redirect = count($newArgs) != count($args);
                }
            } catch (\Exception $e) {
                $redirect = false;
            }
            if ($redirect) {
                return new RedirectResponse($url.(count($newArgs) ? '?'.http_build_query($newArgs) : ''), 301);
            }
        }

        return false;
    }
1063089
public function redirectGuest($path, $status = 302, $headers = array(), $secure = null)
	{
		return $this->redirector->guest($path, $status, $headers, $secure);
	}
1127817
public function redirect($url, $permanent = false, $refresh = false)
	{
		if(strpos($url, '://') === false)
		{
			$host = APP_HOST;
			if( strlen($url) && $url[0] !== "/" )
			{
				$host .= "/";
			}

			$url = BASE_PROTOCOL . '://' . $host . $url;
		}

		EventManager::dispatch(new ResponseRedirectEvent($this, $url, $permanent, $refresh));

		if( headers_sent() )
		{
			$body  = '<html><head>';
			$body .= '<meta http-equiv="refresh" content="1; url=' . $url . '" />';
			$body .= '<title>Redirecting</title>';
			$body .= '</head><body onload="location.replace(\'' . str_replace( "'", "\\'", $url );
			$body .= '\' + document.location.hash)">Redirecting you to ' . $url . '</body></html>';
			$this->setBody($body);
		}
		else
		{
			$this->setCode($permanent ? 301 : 302);
			if( $refresh )
			{
				$this->header("Refresh", "0; URL=" . $url);
			}
			else
			{
				$this->header('Location', $url);
			}
		}

		$this->lock();

		return $this;
	}
870270
public function redirect($url, $status = 302)
    {
        if ($status != 302) {
            $this->setStatus($status);
        }
        $this->setHeader('Location', $url);
        $this->sendHeader();
    }
3955
public function getAuthorizationUrl(Request $request, $name, $redirectUrl = null, array $extraParameters = [])
    {
        $resourceOwner = $this->getResourceOwner($name);
        if (null === $redirectUrl) {
            if (!$this->connect || !$this->authorizationChecker->isGranted($this->grantRule)) {
                $redirectUrl = $this->httpUtils->generateUri($request, $this->getResourceOwnerCheckPath($name));
            } else {
                $redirectUrl = $this->getServiceAuthUrl($request, $resourceOwner);
            }
        }

        return $resourceOwner->getAuthorizationUrl($redirectUrl, $extraParameters);
    }
1006587
protected function executeQuery($url, array $data = array(), array $extra_result_data = array())
    {
        $headers = array(
            sprintf('Authorization: Bearer %s', $this->accessToken),
            'Content-Type: application/json',
            'Accept: application/json'
        );

        // Issue the request
        $content = $this->getAdapter()->getContent($url, 'POST', $headers, json_encode($data));

        if (null === $content) {
            return array_merge($this->getDefaults(), $extra_result_data);
        }

        return $this->parseResults($content, $extra_result_data);
    }
454534
protected function buildUrl($baseUrl, $additionalUrl)
    {
        $baseUrl = parse_url($baseUrl);
        if (!is_array($additionalUrl)) {
            $additionalUrl = parse_url($additionalUrl);
        }

        if (isset($baseUrl['query'], $additionalUrl['query'])) {
            $additionalUrl['query'] = $baseUrl['query'] . '&' . $additionalUrl['query'];
        }

        $urlInfo = array_merge($baseUrl, $additionalUrl);
        $url = $urlInfo['scheme'] . '://'
            . (empty($urlInfo['username']) ? ''
                :(empty($urlInfo['password']) ? "{$urlInfo['username']}@"
                    :"{$urlInfo['username']}:{$urlInfo['password']}@"))
            . $urlInfo['host']
            . (empty($urlInfo['port']) ? '' : ":{$urlInfo['port']}")
            . (empty($urlInfo['path']) ? '' : $urlInfo['path'])
            . (empty($urlInfo['query']) ? '' : "?{$urlInfo['query']}")
            . (empty($urlInfo['fragment']) ? '' : "#{$urlInfo['fragment']}");

        return $url;
    }
811445
public function to($path, $extra = [], $secure = null)
    {
        // First we will check if the URL is already a valid URL. If it is we will not
        // try to generate a new one but will simply return the URL as is, which is
        // convenient since developers do not always have to check if it's valid.
        if ($this->isValidUrl($path)) {
            return $path;
        }

        $subfolder = site()->subfolder;
        $path = $subfolder ? $subfolder.'/'.Str::replaceFirst('/'.$subfolder.'/', '', $path) : $path;
        return parent::to($path, $extra, $secure);
    }
702408
public function to($path, $extra = array(), $secure = null){
        return $this->forwarder()->to($path, $extra, $secure);
    }
536583
public function url($path = null, $parameters = [], $secure = null)
    {
        return Url::to($this->uri() . '/' . $path, $parameters, $secure);
    }
736629
public function returnSuccess($message = '操作成功', $url = '', $extra = [])
    {
        if (! empty($this->redirectRoute)) {
            $url = Url::toRoute([
                $this->redirectRoute,
                'msg' => $message,
                'url' => $url,
                $extra
            ]);
        }
        $this->redirect($url);
    }
920001
protected function redirect($url = null, $queryParams = [], $statusCode = 302) {

		if(is_null($url)) {
			return $this->route->redirect($queryParams, $statusCode);
		}

		if($queryParams) {
			$query = (strpos($url, '?') === false ? '?' : '&') . http_build_query($queryParams);
		}

		else {
			$query = '';
		}

		return new RedirectResponse($url . $query, $statusCode);

	}
660784
public static function secureLink($url)
    {
        $app        = $GLOBALS['app'];
        if ($app->getSubject() !== null && $app->getSubject()->isAuthenticated()) {
            $separator = '&';
            if(!strpos($url, '?')) {
                $separator = '?';
            }
            $url = $url.$separator.'rand_token='.urlencode($app->getSessionManager()->getActiveSession()->get('nonce'));
        }
    }
728392
public function to($path, $extra = [], $secure = null) 
  {
    $url = $baseUrl = home_url($path, $this->getSchemeForUrl($secure));

    if (!empty($extra)) {
      $url = $baseUrl . '?' . http_build_query($extra);
    }

    return $url;
  }
1160907
static public function secureUrlCached($url, $params = []) {
        if (is_array($url)) {
            $url = implode("/", $url);
        }
        $cacheKey = Cached::keymaker(__METHOD__, $url, $params);
        $cached = new Cached($cacheKey);
        if (!$cached->exists()) {
            $result = self::secureUrl($url, $params);
            syslog(LOG_INFO, "Returned " . count($result) . " rows.");
            $cached->set($result);
        }
        return $cached->get();
    }