Utilities for manipulating URLs.
More...
|
static | parseUrl (string $url) |
| Parse a possibly-relative URL into components.
|
|
static | assembleUrl (array $urlParts) |
| This function will reassemble a URL parsed with self::parseURL().
|
|
static | removeDotSegments (string $urlPath) |
| Remove all dot-segments in the provided URL path.
|
|
static | expandUrl (string $url, string $base) |
| Expand a relative URL using a base URL.
|
|
static | matchesDomainList (string $url, array $domains) |
| Check whether a given URL has a domain that occurs in a given set of domains.
|
|
Utilities for manipulating URLs.
- See also
- https://tools.ietf.org/html/rfc3986
◆ assembleUrl()
static Wikimedia\Parsoid\Utils\UrlUtils::assembleUrl |
( |
array | $urlParts | ) |
|
|
static |
This function will reassemble a URL parsed with self::parseURL().
Note no percent-encoding or syntax validation is performed.
- Parameters
-
array | $urlParts | URL parts, as output from self::parseUrl |
- Returns
- string URL assembled from its component parts
◆ expandUrl()
static Wikimedia\Parsoid\Utils\UrlUtils::expandUrl |
( |
string | $url, |
|
|
string | $base ) |
|
static |
◆ matchesDomainList()
static Wikimedia\Parsoid\Utils\UrlUtils::matchesDomainList |
( |
string | $url, |
|
|
array | $domains ) |
|
static |
Check whether a given URL has a domain that occurs in a given set of domains.
- Parameters
-
string | $url | |
array | $domains | Array of domains (strings) |
- Returns
- bool True if the host part of $url ends in one of the strings in $domains
◆ parseUrl()
static Wikimedia\Parsoid\Utils\UrlUtils::parseUrl |
( |
string | $url | ) |
|
|
static |
Parse a possibly-relative URL into components.
Note no percent-decoding is performed, and only minimal syntax validation.
- Parameters
-
- Returns
- (string|null)[]
- 'scheme': Scheme of the url, if any.
- 'authority': Authority part of the url, if any. This is the part in between the "//" and the path. For http, this is the "user@host:port".
- 'path': Path part of the URL. Never null, but may be the empty string.
- 'query': Query part of the URL, if any.
- 'fragment': Fragment part of the URL, if any.
◆ removeDotSegments()
static Wikimedia\Parsoid\Utils\UrlUtils::removeDotSegments |
( |
string | $urlPath | ) |
|
|
static |
Remove all dot-segments in the provided URL path.
For example, '/a/./b/../c/' becomes '/a/c/'.
- See also
- https://tools.ietf.org/html/rfc3986#section-5.2.4
- Note
- Copied from MediaWiki's UrlUtils::removeDotSegments()
- Parameters
-
string | $urlPath | URL path, potentially containing dot-segments |
- Returns
- string URL path with all dot-segments removed
The documentation for this class was generated from the following file: