@@ -26,7 +26,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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', 'field_selection' ) ); |
@@ -1012,7 +1012,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -1644,7 +1644,7 @@ discard block |
||
| 1644 | 1644 | $countries['class'] = 'frm-countries-opts'; |
| 1645 | 1645 | } |
| 1646 | 1646 | |
| 1647 | - $prepop[ __( 'Countries', 'formidable' ) ] = $countries; |
|
| 1647 | + $prepop[__( 'Countries', 'formidable' )] = $countries; |
|
| 1648 | 1648 | |
| 1649 | 1649 | // State abv. |
| 1650 | 1650 | $states = self::get_us_states(); |
@@ -1654,7 +1654,7 @@ discard block |
||
| 1654 | 1654 | $state_abv['class'] = 'frm-state-abv-opts'; |
| 1655 | 1655 | } |
| 1656 | 1656 | |
| 1657 | - $prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv; |
|
| 1657 | + $prepop[__( 'U.S. State Abbreviations', 'formidable' )] = $state_abv; |
|
| 1658 | 1658 | |
| 1659 | 1659 | // States. |
| 1660 | 1660 | $states = array_values( $states ); |
@@ -1663,7 +1663,7 @@ discard block |
||
| 1663 | 1663 | $states['class'] = 'frm-states-opts'; |
| 1664 | 1664 | } |
| 1665 | 1665 | |
| 1666 | - $prepop[ __( 'U.S. States', 'formidable' ) ] = $states; |
|
| 1666 | + $prepop[__( 'U.S. States', 'formidable' )] = $states; |
|
| 1667 | 1667 | unset( $state_abv, $states ); |
| 1668 | 1668 | |
| 1669 | 1669 | // Age. |
@@ -1681,7 +1681,7 @@ discard block |
||
| 1681 | 1681 | $ages['class'] = 'frm-age-opts'; |
| 1682 | 1682 | } |
| 1683 | 1683 | |
| 1684 | - $prepop[ __( 'Age', 'formidable' ) ] = $ages; |
|
| 1684 | + $prepop[__( 'Age', 'formidable' )] = $ages; |
|
| 1685 | 1685 | |
| 1686 | 1686 | // Satisfaction. |
| 1687 | 1687 | $satisfaction = array( |
@@ -1696,7 +1696,7 @@ discard block |
||
| 1696 | 1696 | $satisfaction['class'] = 'frm-satisfaction-opts'; |
| 1697 | 1697 | } |
| 1698 | 1698 | |
| 1699 | - $prepop[ __( 'Satisfaction', 'formidable' ) ] = $satisfaction; |
|
| 1699 | + $prepop[__( 'Satisfaction', 'formidable' )] = $satisfaction; |
|
| 1700 | 1700 | |
| 1701 | 1701 | // Importance. |
| 1702 | 1702 | $importance = array( |
@@ -1711,7 +1711,7 @@ discard block |
||
| 1711 | 1711 | $importance['class'] = 'frm-importance-opts'; |
| 1712 | 1712 | } |
| 1713 | 1713 | |
| 1714 | - $prepop[ __( 'Importance', 'formidable' ) ] = $importance; |
|
| 1714 | + $prepop[__( 'Importance', 'formidable' )] = $importance; |
|
| 1715 | 1715 | |
| 1716 | 1716 | // Agreement. |
| 1717 | 1717 | $agreement = array( |
@@ -1726,7 +1726,7 @@ discard block |
||
| 1726 | 1726 | $agreement['class'] = 'frm-agreement-opts'; |
| 1727 | 1727 | } |
| 1728 | 1728 | |
| 1729 | - $prepop[ __( 'Agreement', 'formidable' ) ] = $agreement; |
|
| 1729 | + $prepop[__( 'Agreement', 'formidable' )] = $agreement; |
|
| 1730 | 1730 | |
| 1731 | 1731 | // Likely. |
| 1732 | 1732 | $likely = array( |
@@ -1741,7 +1741,7 @@ discard block |
||
| 1741 | 1741 | $likely['class'] = 'frm-likely-opts'; |
| 1742 | 1742 | } |
| 1743 | 1743 | |
| 1744 | - $prepop[ __( 'Likely', 'formidable' ) ] = $likely; |
|
| 1744 | + $prepop[__( 'Likely', 'formidable' )] = $likely; |
|
| 1745 | 1745 | |
| 1746 | 1746 | $prepop = apply_filters( 'frm_bulk_field_choices', $prepop ); |
| 1747 | 1747 | } |
@@ -1916,16 +1916,16 @@ discard block |
||
| 1916 | 1916 | */ |
| 1917 | 1917 | private static function fill_image_setting_options( $options, &$args ) { |
| 1918 | 1918 | foreach ( $options as $key => $option ) { |
| 1919 | - $args['options'][ $key ] = $option; |
|
| 1919 | + $args['options'][$key] = $option; |
|
| 1920 | 1920 | |
| 1921 | 1921 | if ( ! empty( $option['addon'] ) ) { |
| 1922 | - $args['options'][ $key ]['custom_attrs'] = self::fill_image_setting_addon_link( $option ); |
|
| 1922 | + $args['options'][$key]['custom_attrs'] = self::fill_image_setting_addon_link( $option ); |
|
| 1923 | 1923 | } |
| 1924 | 1924 | |
| 1925 | - unset( $args['options'][ $key ]['addon'] ); |
|
| 1925 | + unset( $args['options'][$key]['addon'] ); |
|
| 1926 | 1926 | $fill = array( 'upgrade', 'message', 'content' ); |
| 1927 | 1927 | foreach ( $fill as $f ) { |
| 1928 | - unset( $args['options'][ $key ][ $f ], $f ); |
|
| 1928 | + unset( $args['options'][$key][$f], $f ); |
|
| 1929 | 1929 | } |
| 1930 | 1930 | } |
| 1931 | 1931 | } |
@@ -1946,8 +1946,8 @@ discard block |
||
| 1946 | 1946 | |
| 1947 | 1947 | $fill = array( 'upgrade', 'message', 'content' ); |
| 1948 | 1948 | foreach ( $fill as $f ) { |
| 1949 | - if ( isset( $option[ $f ] ) ) { |
|
| 1950 | - $custom_attrs[ 'data-' . $f ] = $option[ $f ]; |
|
| 1949 | + if ( isset( $option[$f] ) ) { |
|
| 1950 | + $custom_attrs['data-' . $f] = $option[$f]; |
|
| 1951 | 1951 | } |
| 1952 | 1952 | } |
| 1953 | 1953 | |