| @@ 80-85 (lines=6) @@ | ||
| 77 | } | |
| 78 | ||
| 79 | $required_parameters = array( 'token', 'timestamp', 'nonce', 'method', 'url' ); | |
| 80 | 		if ( !is_null( $body ) ) { | |
| 81 | $required_parameters[] = 'body_hash'; | |
| 82 | 			if ( !is_string( $body ) ) { | |
| 83 | return new Jetpack_Error( 'invalid_body', 'Body is malformed.' ); | |
| 84 | } | |
| 85 | } | |
| 86 | ||
| 87 | 		foreach ( $required_parameters as $required ) { | |
| 88 | 			if ( !is_scalar( $$required ) ) { | |
| @@ 64-71 (lines=8) @@ | ||
| 61 | } | |
| 62 | ||
| 63 | // Kind of annoying. Maybe refactor Jetpack_Signature to handle body-hashing | |
| 64 | 		if ( is_null( $body ) ) { | |
| 65 | $body_hash = ''; | |
| 66 | 		} else { | |
| 67 | 			if ( !is_string( $body ) ) { | |
| 68 | return new Jetpack_Error( 'invalid_body', 'Body is malformed.' ); | |
| 69 | } | |
| 70 | $body_hash = jetpack_sha1_base64( $body ); | |
| 71 | } | |
| 72 | ||
| 73 | $auth = array( | |
| 74 | 'token' => $token_key, | |