You are here

private function KmlEncoder::unparse_url in KML 8

Reassembles the url/path from an array of components.

2 calls to KmlEncoder::unparse_url()
KmlEncoder::absolutizeUrl in src/Encoder/KmlEncoder.php
Makes sure the url is absolute (appends current host's scheme/host/port if missing).
KmlEncoder::relativizeUrl in src/Encoder/KmlEncoder.php
Makes sure the url is relative (strips scheme/host/port if present).

File

src/Encoder/KmlEncoder.php, line 173

Class

KmlEncoder
Encodes KML data in XML.

Namespace

Drupal\kml\Encoder

Code

private function unparse_url($parsed_url) {
  $scheme = isset($parsed_url['scheme']) ? $parsed_url['scheme'] . '://' : '';
  $host = isset($parsed_url['host']) ? $parsed_url['host'] : '';
  $port = isset($parsed_url['port']) ? ':' . $parsed_url['port'] : '';
  $path = isset($parsed_url['path']) ? '/' . ltrim($parsed_url['path'], '/') : '';
  $query = isset($parsed_url['query']) ? '?' . $parsed_url['query'] : '';
  $fragment = isset($parsed_url['fragment']) ? '#' . $parsed_url['fragment'] : '';
  return "{$scheme}{$host}{$port}{$path}{$query}{$fragment}";
}