32 if (isset($parts[
'query'])) {
38 if (isset($query[self::KEY_MAC])) {
39 throw new \InvalidArgumentException(
'URL has already been signed');
43 $query[self::KEY_EXPIRES] = strtotime($expires);
48 $parts[
'query'] = http_build_query($query);
69 if (isset($parts[
'query'])) {
75 if (!isset($query[self::KEY_MAC])) {
80 $token = $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_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.
elgg parse_url
Parse a URL into its parts.
elgg_build_hmac($data)
Get an HMAC token builder/validator object.
Component for creating signed URLs.
elgg_http_build_url(array $parts, $html_encode=true)
Builds a URL from the a parts array like one returned by parse_url().
isValid($url)
Validates HMAC signature.
sign($url, $expires=false)
Normalizes and signs the URL with SHA256 HMAC key.