| @@ -1,4 +1,4 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly // FixIn: 9.8.0.4. |
| 4 | 4 | |
| @@ -16,13 +16,9 @@ | ||
| 16 | 16 | * @return void wp_send_json() TO front-end or skip and continue |
| 17 | 17 | */ |
| 18 | 18 | function wpbc_captcha__in_ajx__check( $request_params, $is_from_admin_panel , $original_ajx_search_params ) { |
| 19 | 19 | |
| 20 | - if ( | |
| 21 | - ( ( 'On' === get_bk_option( 'booking_is_use_captcha' ) ) || ( WPBC_NEW_FORM_BUILDER ) ) && | |
| 22 | - ( ! $is_from_admin_panel ) && | |
| 23 | - ( ( isset( $original_ajx_search_params['captcha_user_input'] ) ) && ( isset( $original_ajx_search_params['captcha_chalange'] ) ) ) | |
| 24 | - ) { | |
| 20 | + if ( ( ! $is_from_admin_panel ) && ( ( isset( $original_ajx_search_params['captcha_user_input'] ) ) && ( isset( $original_ajx_search_params['captcha_chalange'] ) ) ) ) { | |
| 25 | 21 | |
| 26 | 22 | if ( ! wpbc_captcha__simple__is_ansfer_correct( $request_params['captcha_user_input'], $request_params['captcha_chalange'] ) ) { |
| 27 | 23 | |
| 28 | 24 | $captcha_arr = wpbc_captcha__simple__generate_new(); |
| @@ -30,9 +26,9 @@ | ||
| 30 | 26 | $ajx_data_arr = array(); |
| 31 | 27 | $ajx_data_arr['status'] = 'error'; |
| 32 | 28 | $ajx_data_arr['status_error'] = 'captcha_simple_wrong'; |
| 33 | 29 | $ajx_data_arr['captcha__simple'] = $captcha_arr; |
| 34 | - $ajx_data_arr['ajx_after_action_message'] = __( 'The code you entered is incorrect', 'booking' ); | |
| 30 | + $ajx_data_arr['ajx_after_action_message'] = wpbc_frontend_messages__get( 'message_captcha_incorrect', array(), $request_params['resource_id'] ); | |
| 35 | 31 | $ajx_data_arr['ajx_after_action_message_status'] = 'warning'; |
| 36 | 32 | |
| 37 | 33 | wp_send_json( |
| 38 | 34 | array( |
| @@ -187,13 +183,9 @@ | ||
| 187 | 183 | * @return bool |
| 188 | 184 | */ |
| 189 | 185 | function wpbc_booking_form_is_captcha_allowed_here() { |
| 190 | 186 | |
| 191 | - if ( ( 'On' !== get_bk_option( 'booking_is_use_captcha' ) ) && ( ! WPBC_NEW_FORM_BUILDER ) ) { | |
| 192 | - return false; | |
| 193 | - } | |
| 194 | - | |
| 195 | - // In admin area we usually do not show CAPTCHA, except settings form page. | |
| 187 | + // In admin area we usually do not show CAPTCHA, except booking form builder preview pages. | |
| 196 | 188 | // if ( is_admin() && ( ! wpbc_is_settings_form_page() ) ) { return false; } //. |
| 197 | 189 | |
| 198 | 190 | // old URI-based logic for edge cases, keep it as extra guard:. |
| 199 | 191 | $server_request_uri = ( isset( $_SERVER['REQUEST_URI'] ) ) ? sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| @@ -200,9 +192,14 @@ | ||
| 200 | 192 | |
| 201 | 193 | // Optional legacy-style admin URI check. |
| 202 | 194 | $admin_uri = ltrim( str_replace( get_site_url( null, '', 'admin' ), '', admin_url( 'admin.php?' ) ), '/' ); |
| 203 | 195 | |
| 204 | - if ( ( '' !== $server_request_uri ) && ( false !== strpos( $server_request_uri, $admin_uri ) ) && ( ! wpbc_is_settings_form_page() ) ) { | |
| 196 | + if ( | |
| 197 | + ( '' !== $server_request_uri ) | |
| 198 | + && ( false !== strpos( $server_request_uri, $admin_uri ) ) | |
| 199 | + && ( ! wpbc_is_settings_form_page() ) | |
| 200 | + && ( ! wpbc_is_builder_booking_form_page() ) | |
| 201 | + ) { | |
| 205 | 202 | return false; |
| 206 | 203 | } |
| 207 | 204 | |
| 208 | 205 | return true; |
| @@ -287,5 +284,5 @@ | ||
| 287 | 284 | * |
| 288 | 285 | * // Return your custom markup here. |
| 289 | 286 | * return '<div class="my-addon-captcha">...</div>'; |
| 290 | 287 | * } |
| 291 | - */ | |
| 288 | + */ | |