Generate a URL to an application asset from a root domain such as CDN etc.

@param  string  $root
@param  string  $path
@param  bool|null  $secure
@return string
192348
public function assetFrom($root, $path, $secure = null)
    {
        // Once we get the root URL, we will check to see if it contains an index.php
        // file in the paths. If it does, we will remove it since it is not needed
        // for asset paths, but only for routes to endpoints in the application.
        $root = $this->getRootUrl($this->formatScheme($secure), $root);

        return $this->removeIndex($root).'/'.trim($path, '/');
    }
1048846
public function getProfileUrl($email, $secure = true)
    {
        $hash = md5(strtolower(trim($email)));

        return $this->getProfileUrlForHash($hash, $secure);
    }
950421
public function getUrl($email = null, array $params = [], $secure = true)
    {
        $url  = $secure ? static::SECURE_URL : static::BASE_URL;
        $url .= is_null($email)
            ? str_repeat('0', 32)
            : static::hashEmail($email);

        if ($this->hasFormat())
            $url .= ".{$this->getFormat()}";

        if ( ! empty($params))
            $url .= '?'.http_build_query($params);

        return $url;
    }
1143205
private function buildUrl(string $resource, ?bool $secure): string
    {
        $secure = isset($secure) ? (bool) $secure : $this->secure;

        $endpoint = $secure ? self::HTTPS_ENDPOINT : self::HTTP_ENDPOINT;

        return sprintf('%s/%s', $endpoint, $resource);
    }
1179646
public function url(string $path, string $text, $parameters = [], $secure = null)
    {
        return $this->add(Link::toUrl($path, $text, $parameters, $secure));
    }
100718
public function urlIfCan($authorization, string $path, string $text, array $parameters = [], $secure = null)
    {
        return $this->addIfCan($authorization, Link::toUrl($path, $text, $parameters, $secure));
    }
125680
public function redirectTo($path, $status = 302, $headers = [], $secure = null)
    {
        respondWith(response()->redirectTo($path, $status, $headers, $secure));
    }
541105
public function secure(bool $secure = true) : RouteBuilder
    {
        foreach ($this->routes as $route) {
            $route->secure($secure);
        }
        return $this;
    }
660947
public function url($uri, $secure = null)
    {
        // If path is full, so we just return.
        if (preg_match('#^http|//:#', $uri))
        {
            return $uri;
        }

        $path = $this->getCurrentPath().$uri;

        if(substr($path, 0, 6)=='public') $path = substr($path, 7);

        return $this->configAssetUrl($path, $secure);
    }
901721
public function get_url($forcedownload=false, $https=false) {
        if (!$this->is_readable()) {
            return null;
        }

        if ($this->lf->is_directory()) {
            return null;
        }

        $filepath = $this->lf->get_filepath();
        $filename = $this->lf->get_filename();
        $courseid = $this->context->instanceid;

        $path = '/'.$courseid.$filepath.$filename;

        return file_encode_url($this->urlbase, $path, $forcedownload, $https);
    }
596682
public function get($root, $path)
	{
		$url = $root . $path;

		$response = Http::get($url . $this->countryCode . $this->localLang);

		if (is_array($response)) {

			return $response;
		} else {

			return false;
		}
	}
299044
public function get_secure_url_token($generate = false)
    {
        if ($len = $this->config->get('use_secure_urls')) {
            if (empty($_SESSION['secure_token']) && $generate) {
                // generate x characters long token
                $length = $len > 1 ? $len : 16;
                $token  = rcube_utils::random_bytes($length);

                $plugin = $this->plugins->exec_hook('secure_token',
                    array('value' => $token, 'length' => $length));

                $_SESSION['secure_token'] = $plugin['value'];
            }

            return $_SESSION['secure_token'];
        }

        return false;
    }
643210
public function absUrl($uri, $secure = null)
    {

        $source = $this->url($uri, $secure);

        if(substr($source, 0, 7)=='/public') $source = substr($source, 7);

        return url($source);
    }
781603
public function urlWithParams($path = null, $qs = [], $secure = null)
    {
        $url = app('url')->to($path, $secure);
        if (count($qs)){
            foreach($qs as $key => $value){
                $qs[$key] = sprintf('%s=%s',$key, urlencode($value));
            }
            $url = sprintf('%s?%s', $url, implode('&', $qs));
        }
        return $url;
    }
675157
public function asset(string $path, string $assetSite = null): string
    {
        if (strlen($path) == 0) {
            throw new \InvalidArgumentException('Expected non-empty string');
        }

        // if you pass the full URL that contains "//" part, it'll be immediately
        // returned without any kind of building or parsing

        $pos = strpos($path, '//');
        if (($pos !== false && $pos < 10) || substr($path, 0, 2) == '//') {
            return $path;
        }

        $assets = Application::getConfig('application')->get('assets') ?? [];

        if ($path[0] != '/') {
            $path = '/' . $path;
        }

        $url = null;

        if ($assetSite != null) {
            if (isset($assets[$assetSite])) {
                $url = $assets[$assetSite];
            } else {
                $backtrace = debug_backtrace();
                $caller = $backtrace[1]['function'] ?? '[unknown caller]'; // TODO: Possible fix needed
                Log::warning("Asset site {$assetSite} is used in {$caller}, but not set in application config; using first asset site if any");

                if (count($assets) > 0) {
                    $url = array_values($assets)[0];
                }
            }
        } else {
            if (count($assets) > 0) {
                $url = array_values($assets)[0];
            }
        }

        if ($url == null) {
            return static::makeUrl($path);
        } else {
            if (substr($url, -1) != '/') {
                $url .= '/';
            }

            if (substr($path, 0, 1) == '/') {
                $path = substr($path, 1);
            }

            return $url . $path;
        }
    }
361124
public function asset_url($path)
	{
		$url = $this->asset_path($path);

		if (filter_var($url, FILTER_VALIDATE_URL) === false)
		{
			$url = \Uri::create($url);
		}

		return $url;
	}
984704
public function to($path, $extra = array(), $secure = null)
    {

        // Page object passed
        if(is_object($path) && $path instanceof SiteTreeNodeInterface){
            if(starts_with($path->getPath(),'http:')){
                $path = $path->getPath();
            }
            else{
                $path = $this->getPathFinder()->toPage($path);
            }
        }

        // PageTypeId passed
        elseif (is_string($path) && $this->pageTypes->has($path)) {

            $path = $this->getPathFinder()->toPageType($path);

        }

        // Path passed inside CMS-SiteTree
        elseif (is_string($path) && $this->currentCmsPathProvider->
                                        getCurrentCmsPath()
                                            ->isCmsPath()) {

            if ($extra && !isset($extra[0])) {
                $extra = array_values($extra);
                $extraPath = implode('/',$extra);
                $path = trim($path,'/') . '/' . trim($extraPath,'/');
                $extra = [];
            }

            if ($path == '/' && $this->getTreeScope()) {
                $path = trim($this->getTreeScope()->getPathPrefix() . $path, '/');
            }
        }

        elseif ($path == '/' && $treeScope = $this->getTreeScope()) {
            $path = trim($treeScope->getPathPrefix() . $path, '/');
        }

        return parent::to($path, $extra, $secure);
    }