PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.22
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.22
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | classes/controllers/FrmEntriesAJAXSubmitController.php +8 -14 6.46.22 View file →
@@ -14,9 +14,10 @@
14 14 *
15 15 * @return void
16 16 */
17 17 public static function ajax_create() {
18 - self::fix_woocommerce_conflict(); // This is called before we exit early to cover the conflict in Pro as well.
18 + // This is called before we exit early to cover the conflict in Pro as well.
19 + self::fix_woocommerce_conflict();
19 20
20 21 if ( is_callable( 'FrmProEntriesController::ajax_create' ) ) {
21 22 // Let Pro handle AJAX Submit if it's available.
22 23 // This is because Pro requires additional code to support other Pro features.
@@ -99,9 +100,9 @@
99 100 'entry_id' => 0,
100 101 'class' => FrmFormsHelper::form_error_class(),
101 102 )
102 103 );
103 - }
104 + }//end if
104 105
105 106 $response = self::check_for_failed_form_submission( $response, $form->id );
106 107
107 108 echo json_encode( $response );
@@ -117,9 +118,9 @@
117 118 */
118 119 private static function fix_woocommerce_conflict() {
119 120 add_action(
120 121 'wp_print_footer_scripts',
121 - function() {
122 + function () {
122 123 if ( ! function_exists( 'get_current_screen' ) ) {
123 124 require_once ABSPATH . 'wp-admin/includes/screen.php';
124 125 }
125 126
@@ -161,20 +162,13 @@
161 162 * @param array $errors all errors that were caught in this form submission, passed into the frm_before_replace_shortcodes filter for reference.
162 163 * @return string
163 164 */
164 165 private static function maybe_modify_ajax_error( $error, $field_id, $form, $errors ) {
165 - if ( false !== strpos( $field_id, '-' ) ) {
166 - // repeated fields look like field_id-repeater_id-iteration, so pull the first value for the field id.
167 - list( $use_field_id ) = explode( '-', $field_id );
168 - } else {
169 - $use_field_id = $field_id;
170 - }
171 -
172 - if ( ! is_numeric( $use_field_id ) ) {
166 + if ( ! is_numeric( $field_id ) ) {
173 167 return $error;
174 168 }
175 169
176 - $use_field = FrmField::getOne( $use_field_id );
170 + $use_field = FrmField::getOne( $field_id );
177 171
178 172 if ( ! $use_field ) {
179 173 return $error;
180 174 }
@@ -183,9 +177,9 @@
183 177 $error_body = FrmFieldsController::pull_custom_error_body_from_custom_html( $form, $use_field, $errors );
184 178
185 179 if ( false !== $error_body ) {
186 180 $error = str_replace( '[error]', $error, $error_body );
187 - $error = str_replace( '[key]', $field_id, $error );
181 + $error = str_replace( '[key]', $use_field['field_key'], $error );
188 182 }
189 183
190 184 return $error;
191 185 }
@@ -196,9 +190,9 @@
196 190 *
197 191 * @since 6.2
198 192 *
199 193 * @param array $response
200 - * @param string|int $form_id
194 + * @param int|string $form_id
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 ) );