Returns the redirect_url for this request, with a fallback to the referring page

@param string|null $default Default URL to use redirect_url is not found in request or data
@return mixed
540074
protected function _refererRedirectUrl($default = null)
    {
        $controller = $this->_controller();

        return $this->_redirectUrl($controller->referer($default, true));
    }
747554
public function getUploadUrl( $default = null ) {

		$prop = $this->properties[ self::PROP_UPLOAD_URL ];

		if( isset( $prop ) && strlen( $prop ) > 0 ) {

			return $prop;
		}

		return $default;
	}
540990
public function referer($default = null, $local = false)
    {
        if (!$this->request) {
            return Router::url($default, !$local);
        }

        $referer = $this->request->referer($local);
        if ($referer === '/' && $default && $default !== $referer) {
            $url = Router::url($default, !$local);
            $base = $this->request->getAttribute('base');
            if ($local && $base && strpos($url, $base) === 0) {
                $url = substr($url, strlen($base));
                if ($url[0] !== '/') {
                    $url = '/' . $url;
                }

                return $url;
            }

            return $url;
        }

        return $referer;
    }
463102
public function getHeader($header, $default = null) 
    {
        $name = strtoupper(str_replace('-', '_', $header));
        if (substr($name, 0, 5) != 'HTTP_') {
            $name = 'HTTP_' . $name;
        }
        
        if (($header = $this->getServer($name)) != null) {
            return $header;
        }
        
        return $default;
    }
550247
public function get($parameter, $default = null)
    {
        if ('link' == $parameter) {
            return $this->getLink();
        }

        return isset($this->config[$parameter]) ? $this->config[$parameter] : $default;
    }
841330
private function url()
    {
        if (isset($this->_options[self::ENTRY_BASEURL])) {
            return $this->_options[self::ENTRY_BASEURL];
        }

        // this is the default
        return Urls::URL_EXPORT;
    }
30197
public function redirectionLink()
    {
        // Check external redirect
        if ($this->RedirectionType == 'External') {
            return $this->ExternalURL ?: null;
        }

        // Check internal redirect
        /** @var SiteTree $linkTo */
        $linkTo = $this->LinkToID ? SiteTree::get()->byID($this->LinkToID) : null;
        if (empty($linkTo)) {
            return null;
        }

        // We shouldn't point to ourselves - that would create an infinite loop!  Return null since we have a
        // bad configuration
        if ($this->ID == $linkTo->ID) {
            return null;
        }

        // If we're linking to another redirectorpage then just return the URLSegment, to prevent a cycle of redirector
        // pages from causing an infinite loop.  Instead, they will cause a 30x redirection loop in the browser, but
        // this can be handled sufficiently gracefully by the browser.
        if ($linkTo instanceof RedirectorPage) {
            return $linkTo->regularLink();
        }

        // For all other pages, just return the link of the page.
        return $linkTo->Link();
    }
1268442
public function getUrl($doRedirect = null)
    {
        if (null === $doRedirect) {
            $doRedirect = $this->useUrlRedirect;
        }

        if ($this->isRedirect() && $doRedirect) {
            return $this->getRedirect();
        }

        return $this->_url;
    }
897480
public static function get(string $variable, $default = null) {
		return isset(self::$_get[$variable])
			? urldecode(self::$_get[$variable])
			: $default;
	}
1371980
public function getDefaultPostLoginUrl()
    {
        $result = '';
        $loginRedirectMode = (string) $this->config->get('concrete.misc.login_redirect');
        switch ($loginRedirectMode) {
            case 'CUSTOM':
                $loginRedirectCollectionID = $this->config->get('concrete.misc.login_redirect_cid');
                if ($this->valn->integer($loginRedirectCollectionID, 1)) {
                    $page = Page::getByID($loginRedirectCollectionID);
                    if ($page && !$page->isError()) {
                        $result = (string) $this->resolverManager->resolve([$page]);
                    }
                }
                break;
            case 'DESKTOP':
                $desktop = DesktopList::getMyDesktop();
                if ($desktop && !$desktop->isError()) {
                    $result = (string) $this->resolverManager->resolve([$desktop]);
                }
                break;
        }

        return $result;
    }
514138
public function getParameter($key, $default = null) {
        $value = $this->getUrl()->getQuery()->get($key);

        if ($value === null) {
            $value = $this->getData()->get($key, $default);
        }

        return $value;
    }
426578
public static function method($default = 'GET')
	{
		// get the method from the current active request
		if ($request = \Request::active() and $method = $request->get_method())
		{
			return $method;
		}

		// if called before a request is active, fall back to the global server setting
		if (\Config::get('security.allow_x_headers', false))
		{
			return \Input::server('HTTP_X_HTTP_METHOD_OVERRIDE', \Input::server('REQUEST_METHOD', $default));
		}
		else
		{
			return \Input::server('REQUEST_METHOD', $default);
		}
	}
298832
public function getRedirectUri()
    {
        // Force `addTrailingSlashesToUrls` to `false` while we generate the redirectUri
        $addTrailingSlashesToUrls = \Craft\craft()->config->get('addTrailingSlashesToUrls');
        \Craft\craft()->config->set('addTrailingSlashesToUrls', false);

        $redirectUri = \Craft\UrlHelper::getActionUrl('oauth/connect');

        // Set `addTrailingSlashesToUrls` back to its original value
        \Craft\craft()->config->set('addTrailingSlashesToUrls', $addTrailingSlashesToUrls);

        // We don't want the CP trigger showing in the action URL.
        $redirectUri =  str_replace(\Craft\craft()->config->get('cpTrigger').'/', '', $redirectUri);

        OauthPlugin::log('Redirect URI: '. $redirectUri, LogLevel::Info);

        return $redirectUri;
    }
1323485
public function redirectTo($defaultActionId = 'index')
    {
        if ($this->returnUrl !== null) {
            return $this->controller->redirect($this->returnUrl);
        }

        return $this->controller->redirect($defaultActionId);
    }
336507
protected function getBatchRedirectUrl() : string
    {
        // default url
        $result = ['plugin' => $this->plugin, 'controller' => $this->name, 'action' => 'index'];

        $currentUrl = $this->request->getEnv('HTTP_ORIGIN') . $this->request->getRequestTarget();
        // if referer does not match current url, redirect to referer (delete action)
        if (false === strpos($this->referer(), $currentUrl)) {
            $result = $this->referer();
        }

        // use batch redirect url if provided (edit action)
        if ($this->request->getData('batch.redirect_url')) {
            $result = $this->request->getData('batch.redirect_url');
        }

        return Router::url($result);
    }
1181743
private function getCallbackUrl($callback_url)
    {
        $callback_url = $callback_url ?: $this->config_handler->get('laravel-facebook-sdk.default_redirect_uri');

        return $this->url->to($callback_url);
    }
926765
public function previous($fallback = false)
    {
        $referrer = $this->getContext()->getHeaders()->get('referer');
        $url = $referrer ? $this->to($referrer) : $this->getPreviousUrlFromSession();
        if ($url) {
            return $url;
        } elseif ($fallback) {
            return $this->to($fallback);
        } else {
            return $this->to('/');
        }
    }