Skip to content

Commit 297be3a

Browse files
chore: core review
1 parent 204949a commit 297be3a

4 files changed

Lines changed: 7 additions & 7 deletions

File tree

inc/integrations/class-form-settings-data.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ public function set_captcha( $has_captcha ) {
366366
/**
367367
* Set captcha provider.
368368
*
369-
* @param string $provider Provider slug.
369+
* @param mixed $provider Provider slug, as received from the form options payload.
370370
* @return Form_Settings_Data
371371
* @since 3.1.12
372372
*/

inc/render/class-form-captcha-block.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class Form_Captcha_Block {
1818
* This method will pe passed to the render_callback parameter and it will output
1919
* the server side output of the block.
2020
*
21-
* @param array $attributes Block attrs.
21+
* @param array<string, mixed> $attributes Block attrs.
2222
* @return mixed|string
2323
*/
2424
public function render( $attributes ) {

inc/server/class-form-server.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -988,12 +988,12 @@ public function check_form_captcha( $form_data ) {
988988
)
989989
);
990990

991-
if ( is_wp_error( $resp ) || ! isset( $resp['body'] ) ) {
991+
if ( is_wp_error( $resp ) ) {
992992
$form_data->set_error( Form_Data_Response::ERROR_INVALID_CAPTCHA_TOKEN );
993993
return $form_data;
994994
}
995995

996-
$result = json_decode( $resp['body'], true );
996+
$result = json_decode( wp_remote_retrieve_body( $resp ), true );
997997

998998
if ( ! is_array( $result ) || empty( $result['success'] ) ) {
999999
$form_data->set_error( Form_Data_Response::ERROR_INVALID_CAPTCHA_TOKEN );

src/blocks/test/unit/form-captcha.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import { addCaptchaOnPage } from '../../frontend/form/captcha';
33
/**
44
* Build a form container like the saved Form block markup.
55
*
6-
* @param {string} id The form id.
7-
* @param {Object} options Options.
8-
* @param {boolean} options.legacy Add the legacy `has-captcha` class.
6+
* @param {string} id The form id.
7+
* @param {Object} options Options.
8+
* @param {boolean} options.legacy Add the legacy `has-captcha` class.
99
* @param {string} options.provider Add a Captcha block container with the given provider.
1010
* @return {HTMLDivElement} The form node, attached to the document.
1111
*/

0 commit comments

Comments
 (0)