Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness. Use rawurlencode() instead.

WC_API_Authentication::normalize_parameters( array $parameters )

Normalize each parameter by assuming each parameter may have already been encoded, so attempt to decode, and then re-encode according to RFC 3986


Description Description

Note both the key and value is normalized so a filter param like:

‘filter[period]’ => ‘week’

is encoded to:

‘filter%5Bperiod%5D’ => ‘week’

This conforms to the OAuth 1.0a spec which indicates the entire query string should be URL encoded

See also See also


Top ↑

Parameters Parameters

$parameters

(Required) un-normalized parameters


Top ↑

Return Return

(array) normalized parameters


Top ↑

Source Source

File: includes/legacy/api/v2/class-wc-api-authentication.php

	private function normalize_parameters( $parameters ) {

		$normalized_parameters = array();

		foreach ( $parameters as $key => $value ) {

			// Percent symbols (%) must be double-encoded
			$key   = str_replace( '%', '%25', rawurlencode( rawurldecode( $key ) ) );
			$value = str_replace( '%', '%25', rawurlencode( rawurldecode( $value ) ) );

			$normalized_parameters[ $key ] = $value;
		}

		return $normalized_parameters;
	}

Top ↑

Changelog Changelog

Changelog
Version Description
2.1 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.