|
@@ -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; |
|
@@ -416,7 +416,7 @@ discard block |
|
|
block discarded – undo |
|
416
|
416
|
} |
|
417
|
417
|
|
|
418
|
418
|
$base_name = 'default_value_' . $field['id']; |
|
419
|
|
- $html_id = isset( $field['html_id'] ) ? $field['html_id'] : self::get_html_id( $field ); |
|
|
419
|
+ $html_id = isset( $field['html_id'] ) ? $field['html_id'] : self::get_html_id( $field ); |
|
420
|
420
|
|
|
421
|
421
|
$default_type = self::get_default_value_type( $field ); |
|
422
|
422
|
|
|
@@ -714,7 +714,7 @@ discard block |
|
|
block discarded – undo |
|
714
|
714
|
continue; |
|
715
|
715
|
} |
|
716
|
716
|
|
|
717
|
|
- $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][ $short_key ] ); |
|
|
717
|
+ $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][$short_key] ); |
|
718
|
718
|
$tag = FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key ); |
|
719
|
719
|
|
|
720
|
720
|
$atts['entry'] = $entry; |
|
@@ -723,7 +723,7 @@ discard block |
|
|
block discarded – undo |
|
723
|
723
|
|
|
724
|
724
|
if ( $replace_with !== null ) { |
|
725
|
725
|
self::sanitize_embedded_shortcodes( compact( 'entry' ), $replace_with ); |
|
726
|
|
- $content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content ); |
|
|
726
|
+ $content = str_replace( $shortcodes[0][$short_key], $replace_with, $content ); |
|
727
|
727
|
} |
|
728
|
728
|
|
|
729
|
729
|
unset( $atts, $replace_with ); |
|
@@ -766,8 +766,8 @@ discard block |
|
|
block discarded – undo |
|
766
|
766
|
|
|
767
|
767
|
$dynamic_default = array( 'admin_email', 'siteurl', 'frmurl', 'sitename', 'get' ); |
|
768
|
768
|
|
|
769
|
|
- if ( isset( $shortcode_values[ $atts['tag'] ] ) ) { |
|
770
|
|
- $replace_with = $shortcode_values[ $atts['tag'] ]; |
|
|
769
|
+ if ( isset( $shortcode_values[$atts['tag']] ) ) { |
|
|
770
|
+ $replace_with = $shortcode_values[$atts['tag']]; |
|
771
|
771
|
} elseif ( in_array( $atts['tag'], $dynamic_default ) ) { |
|
772
|
772
|
$replace_with = self::dynamic_default_values( $atts['tag'], $atts ); |
|
773
|
773
|
} elseif ( $clean_tag == 'user_agent' ) { |
|
@@ -978,8 +978,8 @@ discard block |
|
|
block discarded – undo |
|
978
|
978
|
self::field_types_for_input( $single_input, $field_selection, $field_types ); |
|
979
|
979
|
} elseif ( in_array( $type, $multiple_input ) ) { |
|
980
|
980
|
self::field_types_for_input( $multiple_input, $field_selection, $field_types ); |
|
981
|
|
- } elseif ( isset( $field_selection[ $type ] ) ) { |
|
982
|
|
- $field_types[ $type ] = $field_selection[ $type ]; |
|
|
981
|
+ } elseif ( isset( $field_selection[$type] ) ) { |
|
|
982
|
+ $field_types[$type] = $field_selection[$type]; |
|
983
|
983
|
} |
|
984
|
984
|
|
|
985
|
985
|
$field_types = apply_filters( 'frm_switch_field_types', $field_types, compact( 'type' ) ); |
|
@@ -1012,7 +1012,7 @@ discard block |
|
|
block discarded – undo |
|
1012
|
1012
|
|
|
1013
|
1013
|
private static function field_types_for_input( $inputs, $fields, &$field_types ) { |
|
1014
|
1014
|
foreach ( $inputs as $input ) { |
|
1015
|
|
- $field_types[ $input ] = $fields[ $input ]; |
|
|
1015
|
+ $field_types[$input] = $fields[$input]; |
|
1016
|
1016
|
unset( $input ); |
|
1017
|
1017
|
} |
|
1018
|
1018
|
} |
|
@@ -1044,7 +1044,7 @@ discard block |
|
|
block discarded – undo |
|
1044
|
1044
|
'parent' => false, |
|
1045
|
1045
|
'pointer' => false, |
|
1046
|
1046
|
); |
|
1047
|
|
- $args = wp_parse_args( $args, $defaults ); |
|
|
1047
|
+ $args = wp_parse_args( $args, $defaults ); |
|
1048
|
1048
|
|
|
1049
|
1049
|
$opt_key = $args['opt_key']; |
|
1050
|
1050
|
$field = $args['field']; |
|
@@ -1060,22 +1060,22 @@ discard block |
|
|
block discarded – undo |
|
1060
|
1060
|
|
|
1061
|
1061
|
// Check posted vals before checking saved values |
|
1062
|
1062
|
// For fields inside repeating sections - note, don't check if $pointer is true because it will often be zero |
|
1063
|
|
- if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) { |
|
|
1063
|
+ if ( $parent && isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ) { |
|
1064
|
1064
|
if ( FrmField::is_field_with_multiple_values( $field ) ) { |
|
1065
|
|
- $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 ] ) ) : ''; |
|
|
1065
|
+ $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] ) ) : ''; |
|
1066
|
1066
|
} else { |
|
1067
|
|
- $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ); |
|
|
1067
|
+ $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ); |
|
1068
|
1068
|
} |
|
1069
|
1069
|
|
|
1070
|
1070
|
return $other_val; |
|
1071
|
1071
|
|
|
1072
|
|
- } elseif ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) { |
|
|
1072
|
+ } elseif ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][$field['id']] ) ) { |
|
1073
|
1073
|
// For normal fields |
|
1074
|
1074
|
|
|
1075
|
1075
|
if ( FrmField::is_field_with_multiple_values( $field ) ) { |
|
1076
|
|
- $other_val = isset( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ) : ''; |
|
|
1076
|
+ $other_val = isset( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ) : ''; |
|
1077
|
1077
|
} else { |
|
1078
|
|
- $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][ $field['id'] ] ) ); |
|
|
1078
|
+ $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][$field['id']] ) ); |
|
1079
|
1079
|
} |
|
1080
|
1080
|
|
|
1081
|
1081
|
return $other_val; |
|
@@ -1085,8 +1085,8 @@ discard block |
|
|
block discarded – undo |
|
1085
|
1085
|
if ( $field['type'] == 'checkbox' && is_array( $field['value'] ) ) { |
|
1086
|
1086
|
// Check if there is an "other" val in saved value and make sure the |
|
1087
|
1087
|
// "other" val is not equal to the Other checkbox option |
|
1088
|
|
- if ( isset( $field['value'][ $opt_key ] ) && $field['options'][ $opt_key ] != $field['value'][ $opt_key ] ) { |
|
1089
|
|
- $other_val = $field['value'][ $opt_key ]; |
|
|
1088
|
+ if ( isset( $field['value'][$opt_key] ) && $field['options'][$opt_key] != $field['value'][$opt_key] ) { |
|
|
1089
|
+ $other_val = $field['value'][$opt_key]; |
|
1090
|
1090
|
} |
|
1091
|
1091
|
} else { |
|
1092
|
1092
|
/** |
|
@@ -1098,8 +1098,8 @@ discard block |
|
|
block discarded – undo |
|
1098
|
1098
|
// Multi-select dropdowns - key is not preserved |
|
1099
|
1099
|
if ( is_array( $field['value'] ) ) { |
|
1100
|
1100
|
$o_key = array_search( $temp_val, $field['value'] ); |
|
1101
|
|
- if ( isset( $field['value'][ $o_key ] ) ) { |
|
1102
|
|
- unset( $field['value'][ $o_key ], $o_key ); |
|
|
1101
|
+ if ( isset( $field['value'][$o_key] ) ) { |
|
|
1102
|
+ unset( $field['value'][$o_key], $o_key ); |
|
1103
|
1103
|
} |
|
1104
|
1104
|
} elseif ( $temp_val == $field['value'] ) { |
|
1105
|
1105
|
// For radio and regular dropdowns |
|
@@ -1141,7 +1141,7 @@ discard block |
|
|
block discarded – undo |
|
1141
|
1141
|
return $other_args; |
|
1142
|
1142
|
} |
|
1143
|
1143
|
|
|
1144
|
|
- $other_opt = true; |
|
|
1144
|
+ $other_opt = true; |
|
1145
|
1145
|
|
|
1146
|
1146
|
self::set_other_name( $args, $other_args ); |
|
1147
|
1147
|
self::set_other_value( $args, $other_args ); |
|
@@ -1291,7 +1291,7 @@ discard block |
|
|
block discarded – undo |
|
1291
|
1291
|
if ( is_array( $val ) ) { |
|
1292
|
1292
|
foreach ( $val as $k => $v ) { |
|
1293
|
1293
|
if ( is_string( $v ) ) { |
|
1294
|
|
- $val[ $k ] = str_replace( $replace, $replace_with, $v ); |
|
|
1294
|
+ $val[$k] = str_replace( $replace, $replace_with, $v ); |
|
1295
|
1295
|
unset( $k, $v ); |
|
1296
|
1296
|
} |
|
1297
|
1297
|
} |
|
@@ -1630,19 +1630,19 @@ discard block |
|
|
block discarded – undo |
|
1630
|
1630
|
} |
|
1631
|
1631
|
|
|
1632
|
1632
|
public static function get_bulk_prefilled_opts( array &$prepop ) { |
|
1633
|
|
- $prepop[ __( 'Countries', 'formidable' ) ] = self::get_countries(); |
|
|
1633
|
+ $prepop[__( 'Countries', 'formidable' )] = self::get_countries(); |
|
1634
|
1634
|
|
|
1635
|
1635
|
$states = self::get_us_states(); |
|
1636
|
1636
|
$state_abv = array_keys( $states ); |
|
1637
|
1637
|
sort( $state_abv ); |
|
1638
|
|
- $prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv; |
|
|
1638
|
+ $prepop[__( 'U.S. State Abbreviations', 'formidable' )] = $state_abv; |
|
1639
|
1639
|
|
|
1640
|
1640
|
$states = array_values( $states ); |
|
1641
|
1641
|
sort( $states ); |
|
1642
|
|
- $prepop[ __( 'U.S. States', 'formidable' ) ] = $states; |
|
|
1642
|
+ $prepop[__( 'U.S. States', 'formidable' )] = $states; |
|
1643
|
1643
|
unset( $state_abv, $states ); |
|
1644
|
1644
|
|
|
1645
|
|
- $prepop[ __( 'Age', 'formidable' ) ] = array( |
|
|
1645
|
+ $prepop[__( 'Age', 'formidable' )] = array( |
|
1646
|
1646
|
__( 'Under 18', 'formidable' ), |
|
1647
|
1647
|
__( '18-24', 'formidable' ), |
|
1648
|
1648
|
__( '25-34', 'formidable' ), |
|
@@ -1653,7 +1653,7 @@ discard block |
|
|
block discarded – undo |
|
1653
|
1653
|
__( 'Prefer Not to Answer', 'formidable' ), |
|
1654
|
1654
|
); |
|
1655
|
1655
|
|
|
1656
|
|
- $prepop[ __( 'Satisfaction', 'formidable' ) ] = array( |
|
|
1656
|
+ $prepop[__( 'Satisfaction', 'formidable' )] = array( |
|
1657
|
1657
|
__( 'Very Satisfied', 'formidable' ), |
|
1658
|
1658
|
__( 'Satisfied', 'formidable' ), |
|
1659
|
1659
|
__( 'Neutral', 'formidable' ), |
|
@@ -1662,7 +1662,7 @@ discard block |
|
|
block discarded – undo |
|
1662
|
1662
|
__( 'N/A', 'formidable' ), |
|
1663
|
1663
|
); |
|
1664
|
1664
|
|
|
1665
|
|
- $prepop[ __( 'Importance', 'formidable' ) ] = array( |
|
|
1665
|
+ $prepop[__( 'Importance', 'formidable' )] = array( |
|
1666
|
1666
|
__( 'Very Important', 'formidable' ), |
|
1667
|
1667
|
__( 'Important', 'formidable' ), |
|
1668
|
1668
|
__( 'Neutral', 'formidable' ), |
|
@@ -1671,7 +1671,7 @@ discard block |
|
|
block discarded – undo |
|
1671
|
1671
|
__( 'N/A', 'formidable' ), |
|
1672
|
1672
|
); |
|
1673
|
1673
|
|
|
1674
|
|
- $prepop[ __( 'Agreement', 'formidable' ) ] = array( |
|
|
1674
|
+ $prepop[__( 'Agreement', 'formidable' )] = array( |
|
1675
|
1675
|
__( 'Strongly Agree', 'formidable' ), |
|
1676
|
1676
|
__( 'Agree', 'formidable' ), |
|
1677
|
1677
|
__( 'Neutral', 'formidable' ), |
|
@@ -1826,16 +1826,16 @@ discard block |
|
|
block discarded – undo |
|
1826
|
1826
|
); |
|
1827
|
1827
|
|
|
1828
|
1828
|
foreach ( $options as $key => $option ) { |
|
1829
|
|
- $args['options'][ $key ] = $option; |
|
|
1829
|
+ $args['options'][$key] = $option; |
|
1830
|
1830
|
|
|
1831
|
1831
|
if ( ! empty( $option['addon'] ) ) { |
|
1832
|
|
- $args['options'][ $key ]['custom_attrs'] = array( 'class' => 'frm_noallow frm_show_upgrade' ); |
|
|
1832
|
+ $args['options'][$key]['custom_attrs'] = array( 'class' => 'frm_noallow frm_show_upgrade' ); |
|
1833
|
1833
|
|
|
1834
|
1834
|
if ( 'pro' === $option['addon'] ) { |
|
1835
|
|
- $args['options'][ $key ]['custom_attrs']['data-upgrade'] = __( 'Image Options', 'formidable' ); |
|
1836
|
|
- $args['options'][ $key ]['custom_attrs']['data-message'] = __( 'Show images instead of radio buttons or check boxes. This is ideal for polls, surveys, segmenting questionnaires and more.', 'formidable' ) . '<img src="' . FrmAppHelper::plugin_url() . '/images/image-options.png" />'; |
|
1837
|
|
- $args['options'][ $key ]['custom_attrs']['data-medium'] = 'builder'; |
|
1838
|
|
- $args['options'][ $key ]['custom_attrs']['data-content'] = 'image-options'; |
|
|
1835
|
+ $args['options'][$key]['custom_attrs']['data-upgrade'] = __( 'Image Options', 'formidable' ); |
|
|
1836
|
+ $args['options'][$key]['custom_attrs']['data-message'] = __( 'Show images instead of radio buttons or check boxes. This is ideal for polls, surveys, segmenting questionnaires and more.', 'formidable' ) . '<img src="' . FrmAppHelper::plugin_url() . '/images/image-options.png" />'; |
|
|
1837
|
+ $args['options'][$key]['custom_attrs']['data-medium'] = 'builder'; |
|
|
1838
|
+ $args['options'][$key]['custom_attrs']['data-content'] = 'image-options'; |
|
1839
|
1839
|
} else { |
|
1840
|
1840
|
// translators: Add-on name. |
|
1841
|
1841
|
$upgrade_label = sprintf( __( 'Formidable %s', 'formidable' ), ucwords( $option['addon'] ) ); |
|
@@ -1849,15 +1849,15 @@ discard block |
|
|
block discarded – undo |
|
1849
|
1849
|
} |
|
1850
|
1850
|
$requires = FrmFormsHelper::get_plan_required( $upgrading ); |
|
1851
|
1851
|
|
|
1852
|
|
- $args['options'][ $key ]['custom_attrs']['data-upgrade'] = $upgrade_label; |
|
1853
|
|
- $args['options'][ $key ]['custom_attrs']['data-message'] = $upgrade_message; |
|
1854
|
|
- $args['options'][ $key ]['custom_attrs']['data-link'] = $upgrade_link; |
|
1855
|
|
- $args['options'][ $key ]['custom_attrs']['data-medium'] = 'builder'; |
|
1856
|
|
- $args['options'][ $key ]['custom_attrs']['data-oneclick'] = $install_data; |
|
1857
|
|
- $args['options'][ $key ]['custom_attrs']['data-requires'] = $requires; |
|
|
1852
|
+ $args['options'][$key]['custom_attrs']['data-upgrade'] = $upgrade_label; |
|
|
1853
|
+ $args['options'][$key]['custom_attrs']['data-message'] = $upgrade_message; |
|
|
1854
|
+ $args['options'][$key]['custom_attrs']['data-link'] = $upgrade_link; |
|
|
1855
|
+ $args['options'][$key]['custom_attrs']['data-medium'] = 'builder'; |
|
|
1856
|
+ $args['options'][$key]['custom_attrs']['data-oneclick'] = $install_data; |
|
|
1857
|
+ $args['options'][$key]['custom_attrs']['data-requires'] = $requires; |
|
1858
|
1858
|
} |
|
1859
|
1859
|
|
|
1860
|
|
- unset( $args['options'][ $key ]['addon'] ); |
|
|
1860
|
+ unset( $args['options'][$key]['addon'] ); |
|
1861
|
1861
|
} |
|
1862
|
1862
|
} |
|
1863
|
1863
|
|