PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.16.1
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.16.1
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 +14 -14 6.36.16.1 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,12 +118,18 @@
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 }
126 +
127 + if ( ! class_exists( 'WP_Screen', false ) ) {
128 + require_once ABSPATH . 'wp-admin/includes/class-wp-screen.php';
129 + }
130 +
131 + FrmAppHelper::set_current_screen_and_hook_suffix();
125 132 },
126 133 1
127 134 );
128 135 }
@@ -155,20 +162,13 @@
155 162 * @param array $errors all errors that were caught in this form submission, passed into the frm_before_replace_shortcodes filter for reference.
156 163 * @return string
157 164 */
158 165 private static function maybe_modify_ajax_error( $error, $field_id, $form, $errors ) {
159 - if ( false !== strpos( $field_id, '-' ) ) {
160 - // repeated fields look like field_id-repeater_id-iteration, so pull the first value for the field id.
161 - list( $use_field_id ) = explode( '-', $field_id );
162 - } else {
163 - $use_field_id = $field_id;
164 - }
165 -
166 - if ( ! is_numeric( $use_field_id ) ) {
166 + if ( ! is_numeric( $field_id ) ) {
167 167 return $error;
168 168 }
169 169
170 - $use_field = FrmField::getOne( $use_field_id );
170 + $use_field = FrmField::getOne( $field_id );
171 171
172 172 if ( ! $use_field ) {
173 173 return $error;
174 174 }
@@ -177,9 +177,9 @@
177 177 $error_body = FrmFieldsController::pull_custom_error_body_from_custom_html( $form, $use_field, $errors );
178 178
179 179 if ( false !== $error_body ) {
180 180 $error = str_replace( '[error]', $error, $error_body );
181 - $error = str_replace( '[key]', $field_id, $error );
181 + $error = str_replace( '[key]', $use_field['field_key'], $error );
182 182 }
183 183
184 184 return $error;
185 185 }
@@ -190,9 +190,9 @@
190 190 *
191 191 * @since 6.2
192 192 *
193 193 * @param array $response
194 - * @param string|int $form_id
194 + * @param int|string $form_id
195 195 * @return array
196 196 */
197 197 private static function check_for_failed_form_submission( $response, $form_id ) {
198 198 $frm_settings = FrmAppHelper::get_settings( array( 'current_form' => $form_id ) );