|
@@ -26,7 +26,7 @@ discard block |
|
|
block discarded – undo |
|
26
|
26
|
if ( in_array( $type, array( 'data', 'lookup' ) ) ) { |
|
27
|
27
|
$values['field_options']['data_type'] = $setting; |
|
28
|
28
|
} else { |
|
29
|
|
- $values['field_options'][ $setting ] = 1; |
|
|
29
|
+ $values['field_options'][$setting] = 1; |
|
30
|
30
|
} |
|
31
|
31
|
} |
|
32
|
32
|
|
|
@@ -133,10 +133,10 @@ discard block |
|
|
block discarded – undo |
|
133
|
133
|
} |
|
134
|
134
|
|
|
135
|
135
|
foreach ( $defaults as $opt => $default ) { |
|
136
|
|
- $values[ $opt ] = isset( $field->field_options[ $opt ] ) ? $field->field_options[ $opt ] : $default; |
|
|
136
|
+ $values[$opt] = isset( $field->field_options[$opt] ) ? $field->field_options[$opt] : $default; |
|
137
|
137
|
|
|
138
|
138
|
if ( $check_post ) { |
|
139
|
|
- self::get_posted_field_setting( $opt . '_' . $field->id, $values[ $opt ] ); |
|
|
139
|
+ self::get_posted_field_setting( $opt . '_' . $field->id, $values[$opt] ); |
|
140
|
140
|
} |
|
141
|
141
|
|
|
142
|
142
|
unset( $opt, $default ); |
|
@@ -180,20 +180,20 @@ discard block |
|
|
block discarded – undo |
|
180
|
180
|
* @param mixed $value |
|
181
|
181
|
*/ |
|
182
|
182
|
private static function get_posted_field_setting( $setting, &$value ) { |
|
183
|
|
- if ( ! isset( $_POST['field_options'][ $setting ] ) ) { |
|
|
183
|
+ if ( ! isset( $_POST['field_options'][$setting] ) ) { |
|
184
|
184
|
return; |
|
185
|
185
|
} |
|
186
|
186
|
|
|
187
|
187
|
if ( strpos( $setting, 'html' ) !== false ) { |
|
188
|
188
|
// Strip slashes from HTML but not regex or script tags. |
|
189
|
189
|
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
|
190
|
|
- $value = wp_unslash( $_POST['field_options'][ $setting ] ); |
|
|
190
|
+ $value = wp_unslash( $_POST['field_options'][$setting] ); |
|
191
|
191
|
} elseif ( strpos( $setting, 'format_' ) === 0 ) { |
|
192
|
192
|
// TODO: Remove stripslashes on output, and use on input only. |
|
193
|
|
- $value = sanitize_text_field( $_POST['field_options'][ $setting ] ); // WPCS: sanitization ok. |
|
|
193
|
+ $value = sanitize_text_field( $_POST['field_options'][$setting] ); // WPCS: sanitization ok. |
|
194
|
194
|
} else { |
|
195
|
195
|
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
|
196
|
|
- $value = wp_unslash( $_POST['field_options'][ $setting ] ); |
|
|
196
|
+ $value = wp_unslash( $_POST['field_options'][$setting] ); |
|
197
|
197
|
FrmAppHelper::sanitize_value( 'wp_kses_post', $value ); |
|
198
|
198
|
} |
|
199
|
199
|
} |
|
@@ -266,7 +266,7 @@ discard block |
|
|
block discarded – undo |
|
266
|
266
|
$values['default_value'] = FrmAppHelper::maybe_json_encode( $field->default_value ); |
|
267
|
267
|
|
|
268
|
268
|
foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) { |
|
269
|
|
- $values[ $col ] = $field->{$col}; |
|
|
269
|
+ $values[$col] = $field->{$col}; |
|
270
|
270
|
} |
|
271
|
271
|
} |
|
272
|
272
|
|
|
@@ -306,7 +306,7 @@ discard block |
|
|
block discarded – undo |
|
306
|
306
|
); |
|
307
|
307
|
|
|
308
|
308
|
$msg = FrmField::get_option( $field, $error ); |
|
309
|
|
- $msg = empty( $msg ) ? $defaults[ $error ]['part'] : $msg; |
|
|
309
|
+ $msg = empty( $msg ) ? $defaults[$error]['part'] : $msg; |
|
310
|
310
|
$msg = do_shortcode( $msg ); |
|
311
|
311
|
|
|
312
|
312
|
return $msg; |
|
@@ -414,7 +414,7 @@ discard block |
|
|
block discarded – undo |
|
414
|
414
|
} |
|
415
|
415
|
|
|
416
|
416
|
$base_name = 'default_value_' . $field['id']; |
|
417
|
|
- $html_id = isset( $field['html_id'] ) ? $field['html_id'] : self::get_html_id( $field ); |
|
|
417
|
+ $html_id = isset( $field['html_id'] ) ? $field['html_id'] : self::get_html_id( $field ); |
|
418
|
418
|
|
|
419
|
419
|
$default_type = self::get_default_value_type( $field ); |
|
420
|
420
|
|
|
@@ -712,7 +712,7 @@ discard block |
|
|
block discarded – undo |
|
712
|
712
|
continue; |
|
713
|
713
|
} |
|
714
|
714
|
|
|
715
|
|
- $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][ $short_key ] ); |
|
|
715
|
+ $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][$short_key] ); |
|
716
|
716
|
$tag = FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key ); |
|
717
|
717
|
|
|
718
|
718
|
$atts['entry'] = $entry; |
|
@@ -721,7 +721,7 @@ discard block |
|
|
block discarded – undo |
|
721
|
721
|
|
|
722
|
722
|
if ( $replace_with !== null ) { |
|
723
|
723
|
self::sanitize_embedded_shortcodes( compact( 'entry' ), $replace_with ); |
|
724
|
|
- $content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content ); |
|
|
724
|
+ $content = str_replace( $shortcodes[0][$short_key], $replace_with, $content ); |
|
725
|
725
|
} |
|
726
|
726
|
|
|
727
|
727
|
unset( $atts, $replace_with ); |
|
@@ -764,8 +764,8 @@ discard block |
|
|
block discarded – undo |
|
764
|
764
|
|
|
765
|
765
|
$dynamic_default = array( 'admin_email', 'siteurl', 'frmurl', 'sitename', 'get' ); |
|
766
|
766
|
|
|
767
|
|
- if ( isset( $shortcode_values[ $atts['tag'] ] ) ) { |
|
768
|
|
- $replace_with = $shortcode_values[ $atts['tag'] ]; |
|
|
767
|
+ if ( isset( $shortcode_values[$atts['tag']] ) ) { |
|
|
768
|
+ $replace_with = $shortcode_values[$atts['tag']]; |
|
769
|
769
|
} elseif ( in_array( $atts['tag'], $dynamic_default ) ) { |
|
770
|
770
|
$replace_with = self::dynamic_default_values( $atts['tag'], $atts ); |
|
771
|
771
|
} elseif ( $clean_tag == 'user_agent' ) { |
|
@@ -974,8 +974,8 @@ discard block |
|
|
block discarded – undo |
|
974
|
974
|
self::field_types_for_input( $single_input, $field_selection, $field_types ); |
|
975
|
975
|
} elseif ( in_array( $type, $multiple_input ) ) { |
|
976
|
976
|
self::field_types_for_input( $multiple_input, $field_selection, $field_types ); |
|
977
|
|
- } elseif ( isset( $field_selection[ $type ] ) ) { |
|
978
|
|
- $field_types[ $type ] = $field_selection[ $type ]; |
|
|
977
|
+ } elseif ( isset( $field_selection[$type] ) ) { |
|
|
978
|
+ $field_types[$type] = $field_selection[$type]; |
|
979
|
979
|
} |
|
980
|
980
|
|
|
981
|
981
|
$field_types = apply_filters( 'frm_switch_field_types', $field_types, compact( 'type' ) ); |
|
@@ -1008,7 +1008,7 @@ discard block |
|
|
block discarded – undo |
|
1008
|
1008
|
|
|
1009
|
1009
|
private static function field_types_for_input( $inputs, $fields, &$field_types ) { |
|
1010
|
1010
|
foreach ( $inputs as $input ) { |
|
1011
|
|
- $field_types[ $input ] = $fields[ $input ]; |
|
|
1011
|
+ $field_types[$input] = $fields[$input]; |
|
1012
|
1012
|
unset( $input ); |
|
1013
|
1013
|
} |
|
1014
|
1014
|
} |
|
@@ -1040,7 +1040,7 @@ discard block |
|
|
block discarded – undo |
|
1040
|
1040
|
'parent' => false, |
|
1041
|
1041
|
'pointer' => false, |
|
1042
|
1042
|
); |
|
1043
|
|
- $args = wp_parse_args( $args, $defaults ); |
|
|
1043
|
+ $args = wp_parse_args( $args, $defaults ); |
|
1044
|
1044
|
|
|
1045
|
1045
|
$opt_key = $args['opt_key']; |
|
1046
|
1046
|
$field = $args['field']; |
|
@@ -1057,22 +1057,22 @@ discard block |
|
|
block discarded – undo |
|
1057
|
1057
|
// Check posted vals before checking saved values |
|
1058
|
1058
|
|
|
1059
|
1059
|
// For fields inside repeating sections - note, don't check if $pointer is true because it will often be zero |
|
1060
|
|
- if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) { |
|
|
1060
|
+ if ( $parent && isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ) { |
|
1061
|
1061
|
if ( FrmField::is_field_with_multiple_values( $field ) ) { |
|
1062
|
|
- $other_val = isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ) : ''; |
|
|
1062
|
+ $other_val = isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']][$opt_key] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']][$opt_key] ) ) : ''; |
|
1063
|
1063
|
} else { |
|
1064
|
|
- $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ); |
|
|
1064
|
+ $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ); |
|
1065
|
1065
|
} |
|
1066
|
1066
|
|
|
1067
|
1067
|
return $other_val; |
|
1068
|
1068
|
|
|
1069
|
|
- } elseif ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) { |
|
|
1069
|
+ } elseif ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][$field['id']] ) ) { |
|
1070
|
1070
|
// For normal fields |
|
1071
|
1071
|
|
|
1072
|
1072
|
if ( FrmField::is_field_with_multiple_values( $field ) ) { |
|
1073
|
|
- $other_val = isset( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ) : ''; |
|
|
1073
|
+ $other_val = isset( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ) : ''; |
|
1074
|
1074
|
} else { |
|
1075
|
|
- $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][ $field['id'] ] ) ); |
|
|
1075
|
+ $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][$field['id']] ) ); |
|
1076
|
1076
|
} |
|
1077
|
1077
|
|
|
1078
|
1078
|
return $other_val; |
|
@@ -1082,8 +1082,8 @@ discard block |
|
|
block discarded – undo |
|
1082
|
1082
|
if ( $field['type'] == 'checkbox' && is_array( $field['value'] ) ) { |
|
1083
|
1083
|
// Check if there is an "other" val in saved value and make sure the |
|
1084
|
1084
|
// "other" val is not equal to the Other checkbox option |
|
1085
|
|
- if ( isset( $field['value'][ $opt_key ] ) && $field['options'][ $opt_key ] != $field['value'][ $opt_key ] ) { |
|
1086
|
|
- $other_val = $field['value'][ $opt_key ]; |
|
|
1085
|
+ if ( isset( $field['value'][$opt_key] ) && $field['options'][$opt_key] != $field['value'][$opt_key] ) { |
|
|
1086
|
+ $other_val = $field['value'][$opt_key]; |
|
1087
|
1087
|
} |
|
1088
|
1088
|
} else { |
|
1089
|
1089
|
/** |
|
@@ -1095,8 +1095,8 @@ discard block |
|
|
block discarded – undo |
|
1095
|
1095
|
// Multi-select dropdowns - key is not preserved |
|
1096
|
1096
|
if ( is_array( $field['value'] ) ) { |
|
1097
|
1097
|
$o_key = array_search( $temp_val, $field['value'] ); |
|
1098
|
|
- if ( isset( $field['value'][ $o_key ] ) ) { |
|
1099
|
|
- unset( $field['value'][ $o_key ], $o_key ); |
|
|
1098
|
+ if ( isset( $field['value'][$o_key] ) ) { |
|
|
1099
|
+ unset( $field['value'][$o_key], $o_key ); |
|
1100
|
1100
|
} |
|
1101
|
1101
|
} elseif ( $temp_val == $field['value'] ) { |
|
1102
|
1102
|
// For radio and regular dropdowns |
|
@@ -1138,7 +1138,7 @@ discard block |
|
|
block discarded – undo |
|
1138
|
1138
|
return $other_args; |
|
1139
|
1139
|
} |
|
1140
|
1140
|
|
|
1141
|
|
- $other_opt = true; |
|
|
1141
|
+ $other_opt = true; |
|
1142
|
1142
|
|
|
1143
|
1143
|
self::set_other_name( $args, $other_args ); |
|
1144
|
1144
|
self::set_other_value( $args, $other_args ); |
|
@@ -1287,7 +1287,7 @@ discard block |
|
|
block discarded – undo |
|
1287
|
1287
|
} |
|
1288
|
1288
|
if ( is_array( $val ) ) { |
|
1289
|
1289
|
foreach ( $val as $k => $v ) { |
|
1290
|
|
- $val[ $k ] = str_replace( $replace, $replace_with, $v ); |
|
|
1290
|
+ $val[$k] = str_replace( $replace, $replace_with, $v ); |
|
1291
|
1291
|
unset( $k, $v ); |
|
1292
|
1292
|
} |
|
1293
|
1293
|
} else { |
|
@@ -1625,19 +1625,19 @@ discard block |
|
|
block discarded – undo |
|
1625
|
1625
|
} |
|
1626
|
1626
|
|
|
1627
|
1627
|
public static function get_bulk_prefilled_opts( array &$prepop ) { |
|
1628
|
|
- $prepop[ __( 'Countries', 'formidable' ) ] = self::get_countries(); |
|
|
1628
|
+ $prepop[__( 'Countries', 'formidable' )] = self::get_countries(); |
|
1629
|
1629
|
|
|
1630
|
1630
|
$states = self::get_us_states(); |
|
1631
|
1631
|
$state_abv = array_keys( $states ); |
|
1632
|
1632
|
sort( $state_abv ); |
|
1633
|
|
- $prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv; |
|
|
1633
|
+ $prepop[__( 'U.S. State Abbreviations', 'formidable' )] = $state_abv; |
|
1634
|
1634
|
|
|
1635
|
1635
|
$states = array_values( $states ); |
|
1636
|
1636
|
sort( $states ); |
|
1637
|
|
- $prepop[ __( 'U.S. States', 'formidable' ) ] = $states; |
|
|
1637
|
+ $prepop[__( 'U.S. States', 'formidable' )] = $states; |
|
1638
|
1638
|
unset( $state_abv, $states ); |
|
1639
|
1639
|
|
|
1640
|
|
- $prepop[ __( 'Age', 'formidable' ) ] = array( |
|
|
1640
|
+ $prepop[__( 'Age', 'formidable' )] = array( |
|
1641
|
1641
|
__( 'Under 18', 'formidable' ), |
|
1642
|
1642
|
__( '18-24', 'formidable' ), |
|
1643
|
1643
|
__( '25-34', 'formidable' ), |
|
@@ -1648,7 +1648,7 @@ discard block |
|
|
block discarded – undo |
|
1648
|
1648
|
__( 'Prefer Not to Answer', 'formidable' ), |
|
1649
|
1649
|
); |
|
1650
|
1650
|
|
|
1651
|
|
- $prepop[ __( 'Satisfaction', 'formidable' ) ] = array( |
|
|
1651
|
+ $prepop[__( 'Satisfaction', 'formidable' )] = array( |
|
1652
|
1652
|
__( 'Very Satisfied', 'formidable' ), |
|
1653
|
1653
|
__( 'Satisfied', 'formidable' ), |
|
1654
|
1654
|
__( 'Neutral', 'formidable' ), |
|
@@ -1657,7 +1657,7 @@ discard block |
|
|
block discarded – undo |
|
1657
|
1657
|
__( 'N/A', 'formidable' ), |
|
1658
|
1658
|
); |
|
1659
|
1659
|
|
|
1660
|
|
- $prepop[ __( 'Importance', 'formidable' ) ] = array( |
|
|
1660
|
+ $prepop[__( 'Importance', 'formidable' )] = array( |
|
1661
|
1661
|
__( 'Very Important', 'formidable' ), |
|
1662
|
1662
|
__( 'Important', 'formidable' ), |
|
1663
|
1663
|
__( 'Neutral', 'formidable' ), |
|
@@ -1666,7 +1666,7 @@ discard block |
|
|
block discarded – undo |
|
1666
|
1666
|
__( 'N/A', 'formidable' ), |
|
1667
|
1667
|
); |
|
1668
|
1668
|
|
|
1669
|
|
- $prepop[ __( 'Agreement', 'formidable' ) ] = array( |
|
|
1669
|
+ $prepop[__( 'Agreement', 'formidable' )] = array( |
|
1670
|
1670
|
__( 'Strongly Agree', 'formidable' ), |
|
1671
|
1671
|
__( 'Agree', 'formidable' ), |
|
1672
|
1672
|
__( 'Neutral', 'formidable' ), |