Compile the the full URL.

@return string
355300
public function compileUrl()
    {
        $append = '';
        if (count($this->compiledValues) > 0) {
            $append = implode('', $this->compiledValues);
        }

        return $this->name.$append;
    }
356850
public function getUrl(): string
    {
        $url = $this->url;

        if ($this->getMethod() == self::GET) {
            if (count($this->params) > 0) {
                $params = http_build_query($this->getParams());

                if (strpos('?', $url) !== false && substr($url, -1) != '?') {
                    // just add "&"
                    $url .= $params;
                } else {
                    $url .= '?' . $params;
                }
            }
        }
        return $url;
    }
1297070
public function getUrl(): string
    {
        $url = $this->getBaseMediaDirectoryUrl().'/'.$this->getPathRelativeToRoot();

        $url = $this->makeCompatibleForNonUnixHosts($url);

        $url = $this->rawUrlEncodeFilename($url);

        return $url;
    }
218585
public function compile()
	{
	
		if ($this->multiSource)
		{
			$multiSRC = \StringUtil::deserialize($this->data->multiSRC);
			
			// Return if there are no files
			if (!is_array($multiSRC) || empty($multiSRC))
			{
				return '';
			}
			
			$objFiles = \FilesModel::findMultipleByUuids($multiSRC);			
		}
		else
		{
			// Return if there is no file
			if ($this->data->singleSRC == '')
			{
				return '';
			}
		
			$objFiles = \FilesModel::findMultipleByUuids(array($this->data->singleSRC));
		}

		if ($objFiles === null)
		{
			if (!\Validator::isUuid($multiSRC[0]))
			{
				return '<p class="error">'.$GLOBALS['TL_LANG']['ERR']['version2format'].'</p>';
			}
			return '';
		}
		
		$file = \Input::get('file', true);
		
		// Send the file to the browser and do not send a 404 header (see #4632)
		if ($file != '' && !preg_match('/^meta(_[a-z]{2})?\.txt$/', basename($file)))
		{
			while ($objFiles->next())
			{
				if ($file == $objFiles->path || dirname($file) == $objFiles->path)
				{
					\Controller::sendFileToBrowser($file);
				}
			}
			$objFiles->reset();
		}
		
		global $objPage;
		
		$allowedDownload = \StringUtil::trimsplit(',', strtolower(\Config::get('allowedDownload')));
		$allowedVideo = \StringUtil::trimsplit(',', strtolower(\Config::get('validVideoTypes')));
		$allowedAudio = \StringUtil::trimsplit(',', strtolower(\Config::get('validAudioTypes')));
		
		$files = array();
		$auxDate = array();

		// Get all files
		while ($objFiles->next())
		{
			// Continue if the files has been processed or does not exist
			if (isset($files[$objFiles->path]) || !file_exists(TL_ROOT . '/' . $objFiles->path))
			{
				continue;
			}
			
			// Single files
			if ($objFiles->type == 'file')
			{
				$objFile = new \File($objFiles->path, true);
				
				switch ($this->source)
				{
					case 'image':
						if (!$objFile->isImage)
						{
							continue 2;
						}
						break;
						
					case 'video':
						if (!in_array($objFile->extension, $allowedVideo))
						{
							continue 2;
						}
						break;
					
					case 'audio':
						if (!in_array($objFile->extension, $allowedAudio))
						{
							continue 2;
						}
						break;
					
					default:
						if ((!in_array($objFile->extension, $allowedDownload) || preg_match('/^meta(_[a-z]{2})?\.txt$/', $objFile->basename)))
						{
							continue 2;
						}
					break;
				}

				
				$arrMeta = \Frontend::getMetaData($objFiles->meta, $objPage->language);
				
				if (empty($arrMeta))
				{
					if ($this->metaIgnore)
					{
						continue;
					}
					elseif ($objPage->rootFallbackLanguage !== null)
					{
						$arrMeta = \Frontend::getMetaData($objFiles->meta, $objPage->rootFallbackLanguage);
					}
				}
				
				// Use the file name as title if none is given
				if ($arrMeta['title'] == '')
				{
					$arrMeta['title'] = \StringUtil::specialchars($objFile->basename);
				}

				$strHref = \Environment::get('request');
				
				// Remove an existing file parameter (see #5683)
				if (preg_match('/(&(amp;)?|\?)file=/', $strHref))
				{
					$strHref = preg_replace('/(&(amp;)?|\?)file=[^&]+/', '', $strHref);
				}
				
				$strHref .= ((\Config::get('disableAlias') || strpos($strHref, '?') !== false) ? '&amp;' : '?') . 'file=' . \System::urlEncode($objFiles->path);
				
				
				// Add the file
				$files[$objFiles->path] = array
				(
					'id'        => $objFiles->id,
					'uuid'      => $objFiles->uuid,
					'name'      => $objFile->basename,
					'path' 		=> $objFiles->path,
					'size'		=> ($this->canChangeSize) ? $this->data->size : $this->size,
					'alt'       => $arrMeta['title'],
					'title'     => $arrMeta['title'],
					'imageUrl'  => $arrMeta['link'],
					'caption'   => $arrMeta['caption'],
					'href'      => $strHref,
					'filesize'  => $this->getReadableSize($objFile->filesize, 1),
					'icon'      => TL_ASSETS_URL . 'assets/contao/images/' . $objFile->icon,
					'mime'      => $objFile->mime,
					'extension' => $objFile->extension
				);
				
				$auxDate[] = $objFile->mtime;
			}
			
			// Folders
			else
			{
				$objSubfiles = \FilesModel::findByPid($objFiles->uuid);
				
				if ($objSubfiles === null)
				{
					continue;
				}
				
				while ($objSubfiles->next())
				{
					// Skip subfolders
					if ($objSubfiles->type == 'folder')
					{
						continue;
					}
				
					$objFile = new \File($objSubfiles->path, true);
					
					switch ($this->source)
					{
						case 'image':
							if (!$objFile->isImage)
							{
								continue 2;
							}
							break;
						
						case 'video':
							if (!in_array($objFile->extension, $allowedVideo))
							{
								continue 2;
							}
							break;
						
						case 'audio':
							if (!in_array($objFile->extension, $allowedAudio))
							{
								continue 2;
							}
							break;
					
						default:
							if ((!in_array($objFile->extension, $allowedDownload) || preg_match('/^meta(_[a-z]{2})?\.txt$/', $objFile->basename)))
							{
								continue 2;
							}
						break;
					}
					
					$arrMeta = \Frontend::getMetaData($objSubfiles->meta, $objPage->language);
					
					if (empty($arrMeta))
					{
						if ($this->metaIgnore)
						{
							continue;
						}
						elseif ($objPage->rootFallbackLanguage !== null)
						{
							$arrMeta = \Frontend::getMetaData($objSubfiles->meta, $objPage->rootFallbackLanguage);
						}
					}
					
					// Use the file name as title if none is given
					if ($arrMeta['title'] == '')
					{
						$arrMeta['title'] = \StringUtil::specialchars($objFile->basename);
					}

					$strHref = \Environment::get('request');
					
					// Remove an existing file parameter (see #5683)
					if (preg_match('/(&(amp;)?|\?)file=/', $strHref))
					{
						$strHref = preg_replace('/(&(amp;)?|\?)file=[^&]+/', '', $strHref);
					}
					
					$strHref .= ((\Config::get('disableAlias') || strpos($strHref, '?') !== false) ? '&amp;' : '?') . 'file=' . \System::urlEncode($objSubfiles->path);

					
					// Add the file
					$files[$objSubfiles->path] = array
					(
						'id'        => $objSubfiles->id,
						'uuid'      => $objSubfiles->uuid,
						'name'      => $objSubfiles->basename,
						'path' 		=> $objSubfiles->path,
						'size'		=> ($this->canChangeSize) ? $this->data->size : $this->size,
						'alt'       => $arrMeta['title'],
						'title'     => $arrMeta['title'],
						'imageUrl'  => $arrMeta['link'],
						'caption'   => $arrMeta['caption'],
						'href'      => $strHref,
						'filesize'  => $this->getReadableSize($objSubfiles->filesize, 1),
						'icon'      => TL_ASSETS_URL . 'assets/contao/images/' . $objSubfiles->icon,
						'mime'      => $objSubfiles->mime,
						'extension' => $objSubfiles->extension
					);
					
					$auxDate[] = $objSubfiles->mtime;
				}
			}
		}
		
		// Sort array
		switch (($this->canChangeSortBy) ? $this->data->sortBy : $this->sortBy)
		{
			default:
			case 'name_asc':
				uksort($files, 'basename_natcasecmp');
				break;
			
			case 'name_desc':
				uksort($files, 'basename_natcasercmp');
				break;
			
			case 'date_asc':
				array_multisort($files, SORT_NUMERIC, $auxDate, SORT_ASC);
				break;
			
			case 'date_desc':
				array_multisort($files, SORT_NUMERIC, $auxDate, SORT_DESC);
				break;
			
			case 'custom':
				if ($this->data->orderSRC != '')
				{
					$tmp = \StringUtil::deserialize($this->data->orderSRC);
				
					if (!empty($tmp) && is_array($tmp))
					{
						// Remove all values
						$arrOrder = array_map(function(){}, array_flip($tmp));
						
						// Move the matching elements to their position in $arrOrder
						foreach ($files as $k=>$v)
						{
							if (array_key_exists($v['uuid'], $arrOrder))
							{
								$arrOrder[$v['uuid']] = $v;
								unset($files[$k]);
							}
						}
						
						// Append the left-over files at the end
						if (!empty($files))
						{
							$arrOrder = array_merge($arrOrder, array_values($files));
						}
							
						// Remove empty (unreplaced) entries
						$files = array_values(array_filter($arrOrder));
						
						unset($arrOrder);
					}
				}
				break;
			
			case 'random':
				shuffle($files);
				break;

			case 'html5media':
				// Pre-sorted array for recommended html4 video and audio order
				$arrOrder = array('mp4'=>null, 'm4v'=>null, 'mov'=>null, 'wmv'=>null, 'webm'=>null, 'ogv'=>null, 'm4a'=>null, 'mp3'=>null, 'wma'=>null, 'mpeg'=>null, 'wav'=>null, 'ogg'=>null);
				
				foreach ($files as $file)
				{
					if (!is_array($arrOrder[$file['extension']]))
					{
						$arrOrder[$file['extension']] = $file;
					}
					
				}

				// Remove empty (unreplaced) entries
				$files = array_values(array_filter($arrOrder));

				break;
		}

		$files = array_values($files);
		
		// Limit the total number of items
		if ($this->numberOfItems > 0)
		{
			$files = array_slice($files, 0, $this->numberOfItems);
		}
		
		// Prepare images
		if ($this->source == 'image')
		{
			$pictures = array();
			foreach ($files as $key=>$image)
			{
				$image['singleSRC'] = $image['path'];
				
				$this->addImageToTemplate($pictures[$key] = new \stdClass(), $image);	
				
				$pictures[$key] = $pictures[$key]->picture;
				$pictures[$key]['imageUrl'] = $image['imageUrl'];
				$pictures[$key]['caption'] = $image['caption'];
				$pictures[$key]['id'] = $image['id'];
				$pictures[$key]['uuid'] = $image['uuid'];
				$pictures[$key]['name'] = $image['name'];
				$pictures[$key]['path'] = $image['path'];
				$pictures[$key]['extension'] = $image['extension'];
			}
			
			$files = $pictures;
		}
		
		// no collection array for single source
		if (!$this->multiSource)
		{
			$files = $files[0];
		}

		$this->writeToTemplate($files);
	}
851229
public function compile(): string
    {
        $ruleKeys = \array_keys($this->policies);
        if (\in_array('report-only', $ruleKeys)) {
            $this->reportOnly = !!$this->policies['report-only'];
        } else {
            $this->reportOnly = false;
        }

        $compiled = [];

        foreach (self::$directives as $dir) {
            if (\in_array($dir, $ruleKeys)) {
                if (empty($ruleKeys)) {
                    if ($dir === 'base-uri') {
                        continue;
                    }
                }
                $compiled []= $this->compileSubgroup(
                    $dir,
                    $this->policies[$dir]
                );
            }
        }

        if (!empty($this->policies['report-uri'])) {
            if (!\is_string($this->policies['report-uri'])) {
                throw new \TypeError('report-uri policy somehow not a string');
            }
            if ($this->supportOldBrowsers) {
                $compiled [] = 'report-uri ' . $this->policies['report-uri'] . '; ';
            }
            $compiled []= 'report-to ' . $this->policies['report-uri'] . '; ';
        }
        if (!empty($this->policies['upgrade-insecure-requests'])) {
            $compiled []= 'upgrade-insecure-requests';
        }

        $this->compiled = \implode('', $compiled);
        $this->needsCompile = false;
        return $this->compiled;
    }
243655
protected function compileExpression()
    {
        $parts = [$this->getMode()];

        foreach ($this->targetSize as $value) {

            if (is_numeric($value)) {
                $parts[] = (string) $value;
            }
        }

        foreach ($this->arguments as $i => $arg) {

            if (is_numeric($arg) || ($i === 1 and $this->isColor($arg))) {
                $parts[] = trim((string) $arg);
            }
        }

        $source = $this->source;
        $params = implode('/', $parts);
        $filter = $this->compileFilterExpression();

        return compact('source', 'params', 'filter');
    }
927145
public function compile()
    {
        extract($this->vars);

        ob_start();
        /** @noinspection PhpIncludeInspection */
        include $this->filename;
        $__strCompiled__ = ob_get_contents();
        ob_end_clean();

        return $__strCompiled__;
    }
102028
protected function buildCompatibleUrl()
    {
        $url             = $this->url;
        $parametersIndex = stripos($url, "?");
        if (!is_int($parametersIndex) || $parametersIndex < 0) {
            $url .= "?";
        } else {
            $url .= "&";
        }
        return $url;
    }
1341198
public function getAbsoluteUrl(): string
    {
        if (!$this->absoluteUrl) {
            // Guessing we're a http endpoint.
            $this->absoluteUrl = 'http://'.
                ($this->getHeader('Host') ?? 'localhost').
                $this->getUrl();
        }

        return $this->absoluteUrl;
    }
804597
public function getFullUrl()
    {
        /** @var Uri $uri */
        $uri = $this->getUri();

        return rtrim($uri->getBaseUrl(), '/') . '/' . ltrim($uri->getPath(), '/');
    }
873421
public function getCreateUrl()
    {
        $queryString = '';

        if ($constraints = $this->model()->getConstraints()) {
            $queryString = http_build_query($constraints);
        }

        return sprintf('%s/create%s',
            $this->resource(),
            $queryString ? ('?'.$queryString) : ''
        );
    }
468701
function url()
    {
        $ini = eZINI::instance();
        if ( $ini->variable( 'URLTranslator', 'Translation' ) == 'enabled' )
        {
            return $this->urlAlias();
        }
        return 'content/view/full/' . $this->NodeID;
    }
220556
private function generateUrl(): string
    {
        static $re = '/\%5B\d+\%5D/m';
        static $subst = '%5B%5D';

        $query = [];
        /**
         * @var IArgument
         */
        foreach ($this->arguments as $key => $value) {
            $query[$key] = $value->toPrimitive();
        }

        foreach ($this->mergeableArguments as $key => $value) {
            $query[$key] = $value->toPrimitive();
        }

        foreach ($this->stackableArguments as $key => $value) {
            $query[$key] = $value->toArray();
        }

        $queryArg = http_build_query($query, null, '&', PHP_QUERY_RFC3986);

        $fullUrl = $this->routeUrl() . '?' . preg_replace($re, $subst, $queryArg);

        return $fullUrl;
    }
593766
public function compile()
    {
        $requestHandler = $this->getRequestHandler();

        $encodedData = $this->encodeData($this->getParams());
        $requestHandler->setRawBody($encodedData);

        $response = $requestHandler->send();
        $xml = new \SimpleXMLElement($response->getBody());
        $data = $this->parseXml($xml);

        return $this->buildResponse($data);
    }
47087
public function buildComplete($url = null, $full = false) {
		if (is_array($url)) {
			$url = $this->addQueryStrings($url);
		}

		return Router::url($url, $full);
	}
914273
public function fullUrlIs()
    {
        $url = $this->fullUrl();

        foreach (func_get_args() as $pattern) {
            if (Str::is($pattern, $url)) {
                return true;
            }
        }

        return false;
    }
699439
public function full_url() {
		$query = $this->getQueryString();

		$question = ( $this->getBaseUrl() . $this->getPathInfo() ) === '/' ? '/?' : '?';

		return $query ? ( $this->url() . $question . $query ) : $this->url();
	}