WC_REST_Authentication::parse_header( string $header )
Parse the Authorization header into parameters.
Description Description
Parameters Parameters
- $header
-
(Required) Authorization header value (not including "Authorization: " prefix).
Return Return
(array) Map of parameter values.
Source Source
File: includes/class-wc-rest-authentication.php
public function parse_header( $header ) { if ( 'OAuth ' !== substr( $header, 0, 6 ) ) { return array(); } // From OAuth PHP library, used under MIT license. $params = array(); if ( preg_match_all( '/(oauth_[a-z_-]*)=(:?"([^"]*)"|([^,]*))/', $header, $matches ) ) { foreach ( $matches[1] as $i => $h ) { $params[ $h ] = urldecode( empty( $matches[3][ $i ] ) ? $matches[4][ $i ] : $matches[3][ $i ] ); } if ( isset( $params['realm'] ) ) { unset( $params['realm'] ); } } return $params; }
Changelog Changelog
Version | Description |
---|---|
3.0.0 | Introduced. |