30 $parts = parse_url(
$url);
32 if (isset($parts[
'query'])) {
38 if (isset($query[self::KEY_MAC])) {
39 throw new \InvalidArgumentException(
'URL has already been signed');
48 $parts[
'query'] = http_build_query($query);
67 $parts = parse_url(
$url);
69 if (isset($parts[
'query'])) {
75 if (!isset($query[self::KEY_MAC])) {
81 unset($query[self::KEY_MAC]);
83 if (isset($query[self::KEY_EXPIRES]) && $query[self::KEY_EXPIRES] <
time()) {
90 $parts[
'query'] = http_build_query($query);
elgg_build_hmac($data)
Get an HMAC token builder/validator object.
Component for creating signed URLs.
sign($url, $expires=false)
Normalizes and signs the URL with SHA256 HMAC key.
isValid($url)
Validates HMAC signature.
elgg_http_build_url(array $parts, $html_encode=true)
Builds a URL from the a parts array like one returned by parse_url().
elgg_http_add_url_query_elements($url, array $elements)
Sets elements in a URL's query string.
elgg_parse_str($str)
Parses a string using mb_parse_str() if available.