PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.19
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.19
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/models/FrmForm.php +18 -32 6.256.19 View file →
@@ -17,22 +17,22 @@
17 17 $new_values = array(
18 18 'form_key' => FrmAppHelper::get_unique_key( $values['form_key'], $wpdb->prefix . 'frm_forms', 'form_key' ),
19 19 'name' => $values['name'],
20 20 'description' => $values['description'],
21 - 'status' => $values['status'] ?? 'published',
22 - 'logged_in' => $values['logged_in'] ?? 0,
21 + 'status' => isset( $values['status'] ) ? $values['status'] : 'published',
22 + 'logged_in' => isset( $values['logged_in'] ) ? $values['logged_in'] : 0,
23 23 'is_template' => isset( $values['is_template'] ) ? (int) $values['is_template'] : 0,
24 24 'parent_form_id' => isset( $values['parent_form_id'] ) ? absint( $values['parent_form_id'] ) : 0,
25 25 'editable' => isset( $values['editable'] ) ? (int) $values['editable'] : 0,
26 - 'created_at' => $values['created_at'] ?? current_time( 'mysql', 1 ),
26 + 'created_at' => isset( $values['created_at'] ) ? $values['created_at'] : current_time( 'mysql', 1 ),
27 27 );
28 28
29 29 $options = isset( $values['options'] ) ? (array) $values['options'] : array();
30 30 FrmFormsHelper::fill_form_options( $options, $values );
31 31
32 - $options['before_html'] = $values['options']['before_html'] ?? FrmFormsHelper::get_default_html( 'before' );
33 - $options['after_html'] = $values['options']['after_html'] ?? FrmFormsHelper::get_default_html( 'after' );
34 - $options['submit_html'] = $values['options']['submit_html'] ?? FrmFormsHelper::get_default_html( 'submit' );
32 + $options['before_html'] = isset( $values['options']['before_html'] ) ? $values['options']['before_html'] : FrmFormsHelper::get_default_html( 'before' );
33 + $options['after_html'] = isset( $values['options']['after_html'] ) ? $values['options']['after_html'] : FrmFormsHelper::get_default_html( 'after' );
34 + $options['submit_html'] = isset( $values['options']['submit_html'] ) ? $values['options']['submit_html'] : FrmFormsHelper::get_default_html( 'submit' );
35 35
36 36 /**
37 37 * Allows modifying form options before updating or creating.
38 38 *
@@ -279,11 +279,11 @@
279 279
280 280 $options = ! empty( $values['options'] ) ? (array) $values['options'] : array();
281 281 FrmFormsHelper::fill_form_options( $options, $values );
282 282
283 - $options['custom_style'] = $values['options']['custom_style'] ?? 0;
284 - $options['before_html'] = $values['options']['before_html'] ?? FrmFormsHelper::get_default_html( 'before' );
285 - $options['after_html'] = $values['options']['after_html'] ?? FrmFormsHelper::get_default_html( 'after' );
283 + $options['custom_style'] = isset( $values['options']['custom_style'] ) ? $values['options']['custom_style'] : 0;
284 + $options['before_html'] = isset( $values['options']['before_html'] ) ? $values['options']['before_html'] : FrmFormsHelper::get_default_html( 'before' );
285 + $options['after_html'] = isset( $values['options']['after_html'] ) ? $values['options']['after_html'] : FrmFormsHelper::get_default_html( 'after' );
286 286 $options['submit_html'] = isset( $values['options']['submit_html'] ) && '' !== $values['options']['submit_html'] ? $values['options']['submit_html'] : FrmFormsHelper::get_default_html( 'submit' );
287 287
288 288 /**
289 289 * Allows modifying form options before updating or creating.
@@ -354,14 +354,10 @@
354 354 // Don't check for POST html.
355 355 unset( $update_options['custom_html'] );
356 356 $update_options = apply_filters( 'frm_field_options_to_update', $update_options );
357 357
358 - if ( ! is_array( $field->field_options ) ) {
359 - $field->field_options = array();
360 - }
361 -
362 358 foreach ( $update_options as $opt => $default ) {
363 - $field->field_options[ $opt ] = $values['field_options'][ $opt . '_' . $field_id ] ?? $default;
359 + $field->field_options[ $opt ] = isset( $values['field_options'][ $opt . '_' . $field_id ] ) ? $values['field_options'][ $opt . '_' . $field_id ] : $default;
364 360 self::sanitize_field_opt( $opt, $field->field_options[ $opt ] );
365 361 }
366 362
367 363 $field->field_options = apply_filters( 'frm_update_field_options', $field->field_options, $field, $values );
@@ -477,16 +473,14 @@
477 473 * @return string
478 474 */
479 475 private static function normalize_calc_spaces( $calc ) {
480 476 // Check for a pattern with 5 parts
481 - // $1 \d|\] the first comparison digit or the end of a comparison shortcode.
477 + // $1 \d the first comparison digit.
482 478 // $2 a space (optional).
483 479 // $3 an equals sign (optional) that follows the < operator for <= comparisons.
484 480 // $4 another space (optional).
485 - // $5 \d|\[ the second comparison digit or the start of a comparison shortcode.
486 - $calc = preg_replace( '/(\d|\])( ){0,1}<(=){0,1}( ){0,1}(\d|\[)/', '$1 <$3 $5', $calc );
487 -
488 - return $calc;
481 + // $5 \d the second comparison digit.
482 + return preg_replace( '/(\d)( ){0,1}<(=){0,1}( ){0,1}(\d)/', '$1 <$3 $5', $calc );
489 483 }
490 484
491 485 /**
492 486 * Updating the settings page
@@ -493,11 +487,11 @@
493 487 */
494 488 private static function get_settings_page_html( $values, &$field ) {
495 489 if ( isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ) {
496 490 $prev_opts = array();
497 - $fallback_html = $field->field_options['custom_html'] ?? FrmFieldsHelper::get_default_html( $field->type );
491 + $fallback_html = isset( $field->field_options['custom_html'] ) ? $field->field_options['custom_html'] : FrmFieldsHelper::get_default_html( $field->type );
498 492
499 - $field->field_options['custom_html'] = $values['field_options'][ 'custom_html_' . $field->id ] ?? $fallback_html;
493 + $field->field_options['custom_html'] = isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ? $values['field_options'][ 'custom_html_' . $field->id ] : $fallback_html;
500 494 } elseif ( $field->type === 'hidden' || $field->type === 'user_id' ) {
501 495 $prev_opts = $field->field_options;
502 496 }
503 497
@@ -520,9 +514,9 @@
520 514 'name' => '',
521 515 );
522 516 foreach ( $field_cols as $col => $default ) {
523 517 $default = $default === '' ? $field->{$col} : $default;
524 - $new_field[ $col ] = $values['field_options'][ $col . '_' . $field->id ] ?? $default;
518 + $new_field[ $col ] = isset( $values['field_options'][ $col . '_' . $field->id ] ) ? $values['field_options'][ $col . '_' . $field->id ] : $default;
525 519 }
526 520
527 521 if ( $field->type === 'submit' && isset( $new_field['field_order'] ) && (int) $new_field['field_order'] === FrmSubmitHelper::DEFAULT_ORDER ) {
528 522 $new_field['field_order'] = $field->field_order;
@@ -1162,16 +1156,8 @@
1162 1156 } else {
1163 1157 $visible = true;
1164 1158 }
1165 1159
1166 - /**
1167 - * @since 6.25
1168 - *
1169 - * @param bool $visible
1170 - * @param object $form
1171 - */
1172 - $visible = (bool) apply_filters( 'frm_form_is_visible', $visible, $form );
1173 -
1174 1160 return $visible;
1175 1161 }
1176 1162
1177 1163 public static function show_submit( $form ) {
@@ -1185,11 +1171,11 @@
1185 1171 * @since 2.3
1186 1172 */
1187 1173 public static function get_option( $atts ) {
1188 1174 $form = $atts['form'];
1189 - $default = $atts['default'] ?? '';
1175 + $default = isset( $atts['default'] ) ? $atts['default'] : '';
1190 1176
1191 - return $form->options[ $atts['option'] ] ?? $default;
1177 + return isset( $form->options[ $atts['option'] ] ) ? $form->options[ $atts['option'] ] : $default;
1192 1178 }
1193 1179
1194 1180 /**
1195 1181 * Get the link to edit this form.