Skip to content

Commit 8406f18

Browse files
committed
Add docblocks
1 parent 60d5cfc commit 8406f18

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

lib/class-wp-json-authentication-oauth1.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,17 +566,33 @@ protected function check_oauth_signature( $consumer, $oauth_params, $token = nul
566566
return true;
567567
}
568568

569+
/**
570+
* Creates a signature string from all query parameters
571+
*
572+
* @since 0.1
573+
* @param array $params Array of query parameters
574+
* @return string Signature string
575+
*/
569576
public function create_signature_string( $params ) {
570577
return implode( '%26', $this->join_with_equals_sign( $params ) ); // join with ampersand
571578
}
572579

580+
/**
581+
* Creates a urlencoded string out of an array of query parameters
582+
*
583+
* @since 0.1.0
584+
* @param array $params Array of parameters to convert.
585+
* @param array $query_params Array to extend.
586+
* @param string $key Optional Array key to append
587+
* @return string Urlencoded string
588+
*/
573589
public function join_with_equals_sign( $params, $query_params = array(), $key = '' ) {
574590
foreach ( $params as $param_key => $param_value ) {
575591
if ( is_array( $param_value ) ) {
576592
$query_params = $this->join_with_equals_sign( $param_value, $query_params, $param_key );
577593
} else {
578594
if ( $key ) {
579-
$param_key = $key . '[' . $param_key . ']';
595+
$param_key = $key . '[' . $param_key . ']'; // Handle multi-dimensional array
580596
}
581597
$string = $param_key . '=' . $param_value; // join with equals sign
582598
$query_params[] = urlencode( $string );

0 commit comments

Comments
 (0)