| @@ -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 ); |
| @@ -493,11 +489,11 @@ | ||
| 493 | 489 | */ |
| 494 | 490 | private static function get_settings_page_html( $values, &$field ) { |
| 495 | 491 | if ( isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ) { |
| 496 | 492 | $prev_opts = array(); |
| 497 | - $fallback_html = $field->field_options['custom_html'] ?? FrmFieldsHelper::get_default_html( $field->type ); | |
| 493 | + $fallback_html = isset( $field->field_options['custom_html'] ) ? $field->field_options['custom_html'] : FrmFieldsHelper::get_default_html( $field->type ); | |
| 498 | 494 | |
| 499 | - $field->field_options['custom_html'] = $values['field_options'][ 'custom_html_' . $field->id ] ?? $fallback_html; | |
| 495 | + $field->field_options['custom_html'] = isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ? $values['field_options'][ 'custom_html_' . $field->id ] : $fallback_html; | |
| 500 | 496 | } elseif ( $field->type === 'hidden' || $field->type === 'user_id' ) { |
| 501 | 497 | $prev_opts = $field->field_options; |
| 502 | 498 | } |
| 503 | 499 | |
| @@ -520,9 +516,9 @@ | ||
| 520 | 516 | 'name' => '', |
| 521 | 517 | ); |
| 522 | 518 | foreach ( $field_cols as $col => $default ) { |
| 523 | 519 | $default = $default === '' ? $field->{$col} : $default; |
| 524 | - $new_field[ $col ] = $values['field_options'][ $col . '_' . $field->id ] ?? $default; | |
| 520 | + $new_field[ $col ] = isset( $values['field_options'][ $col . '_' . $field->id ] ) ? $values['field_options'][ $col . '_' . $field->id ] : $default; | |
| 525 | 521 | } |
| 526 | 522 | |
| 527 | 523 | if ( $field->type === 'submit' && isset( $new_field['field_order'] ) && (int) $new_field['field_order'] === FrmSubmitHelper::DEFAULT_ORDER ) { |
| 528 | 524 | $new_field['field_order'] = $field->field_order; |
| @@ -1162,16 +1158,8 @@ | ||
| 1162 | 1158 | } else { |
| 1163 | 1159 | $visible = true; |
| 1164 | 1160 | } |
| 1165 | 1161 | |
| 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 | 1162 | return $visible; |
| 1175 | 1163 | } |
| 1176 | 1164 | |
| 1177 | 1165 | public static function show_submit( $form ) { |
| @@ -1185,11 +1173,11 @@ | ||
| 1185 | 1173 | * @since 2.3 |
| 1186 | 1174 | */ |
| 1187 | 1175 | public static function get_option( $atts ) { |
| 1188 | 1176 | $form = $atts['form']; |
| 1189 | - $default = $atts['default'] ?? ''; | |
| 1177 | + $default = isset( $atts['default'] ) ? $atts['default'] : ''; | |
| 1190 | 1178 | |
| 1191 | - return $form->options[ $atts['option'] ] ?? $default; | |
| 1179 | + return isset( $form->options[ $atts['option'] ] ) ? $form->options[ $atts['option'] ] : $default; | |
| 1192 | 1180 | } |
| 1193 | 1181 | |
| 1194 | 1182 | /** |
| 1195 | 1183 | * Get the link to edit this form. |