Return URL to file.

@param bool $reset
@return string
175853
public function url($reset = true)
    {
        $output = preg_replace('|^' . preg_quote(GRAV_ROOT, '|') . '|', '', $this->get('filepath'));

        $locator = Grav::instance()['locator'];
        if ($locator->isStream($output)) {
            $output = $locator->findResource($output, false);
        }

        if ($reset) {
            $this->reset();
        }

        return trim(Grav::instance()['base_url'] . '/' . $this->urlQuerystring($output), '\\');
    }
861418
public function getUrl()
    {
        if ($this->idcat < 0) return false;     
        $url = '/'.$this->_alias;             
        if ( $this->getCatalog()->isServer() ) return $url;                   
        return rtrim($this->getCatalog()->getUrl(),'/').$url;
    }
1041487
public function path($reset = true)
    {
        $output = $this->saveImage();

        if ($reset) {
            $this->reset();
        }

        return $output;
    }
206087
public function getUrl($revision = null)
	{
		// Without revision, use current info
		if (!isset($revision)) {
			return $this->info['url'];
		}

		// Obtain the properties of the revision
		if (($info = $this->getRevision($revision)) === null) {
			return null;
		}

		return $info['url'];
	}
1098610
public function getSourceURL($grant = true)
    {
        if ($this->File->exists()) {
            return $this->File->getSourceURL($grant);
        }
        return null;
    }
300017
public function getURL(): ?string
    {
        if ($this->base !== null) {
            $list = [];
            $queryList = $this->query->getList();
            foreach ($queryList as $queryItem) {
                $list[$queryItem->name] = $queryItem->value;
            }
            return $this->base . implode('/', array_map('urlencode', explode('/', (string) $this->path))) . (empty($list) ? '' : '?' . http_build_query($list));
        }
        return null;
    }
980131
public function getSourceURL($grant = true)
    {
        return $this
            ->getStore()
            ->getAsURL($this->Filename, $this->Hash, $this->Variant, $grant);
    }
1112814
public function render_children( $reset = false ) {
		$output = null;
		foreach ( $this->child as $child ) {
			if ( true === $reset && 'repeat' === $child->type ) {
				$child->instances = 0;
				$child->instance  = 0;
			}
			if ( 'repeat' === $child->type && $reset === false ) {
				$id = 1;
			}
			$output .= $child->render();
		}

		return $output;
	}
186735
protected function getEnvironment($reset = false)
    {
        if ($reset === true || null === $this->twig) {
            $this->twig = new \Twig_Environment(
                $this->getLoader(), $this->getConfig());
            $this->twig->removeExtension('escaper');
        }

        return $this->twig;
    }
897635
public function getMyAccount($reset = false)
    {
        $cacheKey = sprintf('%s:my-account', $this->sessionId);
        if ($reset || !($info = $this->cache->fetch($cacheKey))) {
            $info = $this->getClient()->getAccountInfo($reset);
            $this->cache->save($cacheKey, $info, $this->config->get('api.users_ttl'));
        }

        return $info;
    }
1251147
public function srcset($reset = true)
    {
        if (empty($this->alternatives)) {
            if ($reset) {
                $this->reset();
            }

            return '';
        }

        $srcset = [];
        foreach ($this->alternatives as $ratio => $medium) {
            $srcset[] = $medium->url($reset) . ' ' . $medium->get('width') . 'w';
        }
        $srcset[] = str_replace(' ', '%20', $this->url($reset)) . ' ' . $this->get('width') . 'w';

        return implode(', ', $srcset);
    }
415639
public function get_url($forcedownload=false, $https=false) {
        if (!$this->is_readable()) {
            return null;
        }

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

        $this->urlbase;
        $contextid = $this->lf->get_contextid();
        $component = $this->lf->get_component();
        $filearea  = $this->lf->get_filearea();
        $itemid    = $this->lf->get_itemid();
        $filepath  = $this->lf->get_filepath();
        $filename  = $this->lf->get_filename();

        if ($this->itemidused) {
            $path = '/'.$contextid.'/'.$component.'/'.$filearea.'/'.$itemid.$filepath.$filename;
        } else {
            $path = '/'.$contextid.'/'.$component.'/'.$filearea.$filepath.$filename;
        }
        return file_encode_url($this->urlbase, $path, $forcedownload, $https);
    }
1159691
protected function getFilenameForRevision(string $revision): string
    {
        $ext = pathinfo($this->filename, PATHINFO_EXTENSION);

        return substr_replace($this->filename, '-'.$revision, -strlen($ext) - 1, 0);
    }
53046
public function getAccountInfo($reset = false)
    {
        if (!isset($this->accountInfo) || $reset) {
            $url = $this->accountsEndpoint . 'me';
            try {
                $this->accountInfo = $this->simpleGet($url);
            }
            catch (BadResponseException $e) {
                throw ApiResponseException::create($e->getRequest(), $e->getResponse(), $e->getPrevious());
            }
        }

        return $this->accountInfo;
    }
901529
public function getUrl($path = null)
    {
        $path = $path ?: $this->path;

        if ($this->package->config('public_storage', false)) {
            // If file has public access enabled, we simply can try return storage
            // url to file.
            try {
                $useAbsolute = $this->package->config('absolute_url', false);
                $absolute = $this->storage->url($path);

                if ($useAbsolute) return $absolute;

                $relative = parse_url($absolute, PHP_URL_PATH);

                return '/' . trim($relative, '\\/');
            } catch (\Exception $ex) {
                // Some drivers does not support url method (like ftp), so we
                // simply continue and generate crip url to our controller.
            }
        }

        $service = new UrlService($this->package);
        if ($this->metadata->isFile()) {
            return $service->file($path);
        }

        return $service->folder($path);
    }
169908
public function get($url, $base = null, $re = false, $isImg = false) {
        set_time_limit(0);
        if ($base) {
            $uinfo = CurlClient::getUrlInfo($url);
            if ($uinfo ['root'] != $this->domain) {
                $ip = rtrim($base, DS) . DS . 'o_tfs' . DS . ($uinfo ['path'] ? $uinfo ['path'] . DS : '');
            } else {
                $ip = rtrim($base, DS) . DS . ($uinfo ['path'] ? $uinfo ['path'] . DS : '');
            }

            if (!file_exists($ip)) {
                if (!@mkdir($ip, 0777, true)) {
                    return false;
                }
            }

            $tmpName = $ip . $uinfo ['file'];
            if (file_exists($tmpName)) {
                if ($re) {
                    return @file_get_contents($tmpName);
                } else {
                    return true;
                }
            }
        }
        $curl = $this->ch;
        curl_setopt($curl, CURLOPT_URL, $url);
        $rst = curl_exec($curl);
        if ($rst === false) {
            $this->error     = curl_error($this->ch);
            $this->errorCode = '500';
            $rst             = false;
        } else {
            $code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
            if ($code != '200') {
                $this->error     = '[' . $code . ']' . get_status_header_desc($code);
                $this->errorCode = $code;
                $rst             = false;
            }
        }
        if ($rst) {
            if (!$isImg && $this->encoding != 'UTF-8') {
                $rst = CurlClient::convertString($rst, $this->encoding);
            }
            if (isset ($tmpName)) {
                if (!@file_put_contents($tmpName, $rst)) {
                    return false;
                }
            }
        }

        return $rst;
    }
1279130
public function getExpression(bool $clean = false) : string
    {
        return $clean ?
            str_replace(self::EXP_TOKEN, '', $this->expression) : // clean up expression from placeholder tokens.
            $this->expression;
    }