← All changes
|
classes/controllers/FrmEntriesAJAXSubmitController.php
+0
-6
6.26.1
→
6.13
View file →
| @@ -40,9 +40,8 @@ | ||
| 40 | 40 | 'pass' => false, |
| 41 | 41 | ); |
| 42 | 42 | |
| 43 | 43 | $form_id = FrmAppHelper::get_post_param( 'form_id', 0, 'absint' ); |
| 44 | - | |
| 45 | 44 | if ( ! $form_id ) { |
| 46 | 45 | echo json_encode( $response ); |
| 47 | 46 | wp_die(); |
| 48 | 47 | } |
| @@ -47,9 +46,8 @@ | ||
| 47 | 46 | wp_die(); |
| 48 | 47 | } |
| 49 | 48 | |
| 50 | 49 | $form = FrmForm::getOne( $form_id ); |
| 51 | - | |
| 52 | 50 | if ( ! $form ) { |
| 53 | 51 | echo json_encode( $response ); |
| 54 | 52 | wp_die(); |
| 55 | 53 | } |
| @@ -54,9 +52,8 @@ | ||
| 54 | 52 | wp_die(); |
| 55 | 53 | } |
| 56 | 54 | |
| 57 | 55 | $is_ajax_on = FrmForm::is_ajax_on( $form ); |
| 58 | - | |
| 59 | 56 | if ( ! $is_ajax_on ) { |
| 60 | 57 | // This continues in the Pro version as it is required for other features including in-place edit. |
| 61 | 58 | // In Lite, if AJAX submit is not on, just exit early as this function is getting called incorrectly. |
| 62 | 59 | echo json_encode( $response ); |
| @@ -87,9 +84,8 @@ | ||
| 87 | 84 | $response['content'] .= '<span class="frm_end_ajax_' . $form->id . '"></span>'; |
| 88 | 85 | } |
| 89 | 86 | } else { |
| 90 | 87 | $obj = array(); |
| 91 | - | |
| 92 | 88 | foreach ( $errors as $field => $error ) { |
| 93 | 89 | $field_id = str_replace( 'field', '', $field ); |
| 94 | 90 | $error = self::maybe_modify_ajax_error( $error, $field_id, $form, $errors ); |
| 95 | 91 | $obj[ $field_id ] = $error; |
| @@ -163,9 +159,8 @@ | ||
| 163 | 159 | * @param string $error |
| 164 | 160 | * @param string $field_id |
| 165 | 161 | * @param stdClass $form the form being submitted (not necessarily the field's form when embedded/repeated). |
| 166 | 162 | * @param array $errors all errors that were caught in this form submission, passed into the frm_before_replace_shortcodes filter for reference. |
| 167 | - * | |
| 168 | 163 | * @return string |
| 169 | 164 | */ |
| 170 | 165 | private static function maybe_modify_ajax_error( $error, $field_id, $form, $errors ) { |
| 171 | 166 | if ( ! is_numeric( $field_id ) ) { |
| @@ -196,9 +191,8 @@ | ||
| 196 | 191 | * @since 6.2 |
| 197 | 192 | * |
| 198 | 193 | * @param array $response |
| 199 | 194 | * @param int|string $form_id |
| 200 | - * | |
| 201 | 195 | * @return array |
| 202 | 196 | */ |
| 203 | 197 | private static function check_for_failed_form_submission( $response, $form_id ) { |
| 204 | 198 | $frm_settings = FrmAppHelper::get_settings( array( 'current_form' => $form_id ) ); |