@@ -75,16 +75,16 @@ discard block |
||
75 | 75 | 'name' => sprintf( |
76 | 76 | /* translators: Formidable addon name */ |
77 | 77 | esc_html_x( 'Formidable %s', 'Formidable Addon Name', 'formidable' ), |
78 | - $addon_list[ $matching_addon ]['name'] |
|
78 | + $addon_list[$matching_addon]['name'] |
|
79 | 79 | ), |
80 | - 'addon' => $addon_list[ $matching_addon ]['slug'], |
|
81 | - 'short_description' => $addon_list[ $matching_addon ]['excerpt'], |
|
80 | + 'addon' => $addon_list[$matching_addon]['slug'], |
|
81 | + 'short_description' => $addon_list[$matching_addon]['excerpt'], |
|
82 | 82 | 'slug' => self::$slug, |
83 | - 'version' => $addon_list[ $matching_addon ]['version'], |
|
83 | + 'version' => $addon_list[$matching_addon]['version'], |
|
84 | 84 | ); |
85 | 85 | |
86 | 86 | // Splice in the base addon data. |
87 | - $inject = array_merge( $inject, $addon_list[ $matching_addon ], $overrides ); |
|
87 | + $inject = array_merge( $inject, $addon_list[$matching_addon], $overrides ); |
|
88 | 88 | |
89 | 89 | // Add it to the top of the list. |
90 | 90 | array_unshift( $result->plugins, $inject ); |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | * @return array |
137 | 137 | */ |
138 | 138 | private function get_addons() { |
139 | - $api = new FrmFormApi(); |
|
139 | + $api = new FrmFormApi(); |
|
140 | 140 | return $api->get_api_info(); |
141 | 141 | } |
142 | 142 | |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | |
342 | 342 | $all_plugins = get_plugins(); |
343 | 343 | |
344 | - return isset( $all_plugins[ $plugin ] ); |
|
344 | + return isset( $all_plugins[$plugin] ); |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | /** |
@@ -30,7 +30,7 @@ |
||
30 | 30 | $grid_helper = new FrmFieldGridHelper(); |
31 | 31 | $values['count'] = 0; |
32 | 32 | foreach ( $values['fields'] as $field ) { |
33 | - $values['count']++; |
|
33 | + $values['count'] ++; |
|
34 | 34 | $grid_helper->set_field( $field ); |
35 | 35 | $grid_helper->maybe_begin_field_wrapper(); |
36 | 36 | FrmFieldsController::load_single_field( $field, $values ); |
@@ -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 |
@@ -86,7 +86,7 @@ |
||
86 | 86 | |
87 | 87 | foreach ( $forms as $form ) { |
88 | 88 | $form_title = '' === $form->name ? __( '(no title)', 'formidable' ) : FrmAppHelper::truncate( $form->name, 50 ); |
89 | - $options[ $form->id ] = esc_html( $form_title ); |
|
89 | + $options[$form->id] = esc_html( $form_title ); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | return $options; |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | |
19 | 19 | $_GET['page'] = 'formidable'; |
20 | 20 | |
21 | - $values = array( |
|
21 | + $values = array( |
|
22 | 22 | 'id' => FrmAppHelper::get_post_param( 'form_id', '', 'absint' ), |
23 | 23 | 'doing_ajax' => true, |
24 | 24 | ); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | |
42 | 42 | ob_start(); |
43 | 43 | self::load_single_field( $field, $values ); |
44 | - $field_html[ absint( $field->id ) ] = ob_get_contents(); |
|
44 | + $field_html[absint( $field->id )] = ob_get_contents(); |
|
45 | 45 | ob_end_clean(); |
46 | 46 | } |
47 | 47 | |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | foreach ( $opts as $opt_key => $opt ) { |
257 | 257 | if ( strpos( $opt, '|' ) !== false ) { |
258 | 258 | $vals = explode( '|', $opt ); |
259 | - $opts[ $opt_key ] = array( |
|
259 | + $opts[$opt_key] = array( |
|
260 | 260 | 'label' => trim( $vals[0] ), |
261 | 261 | 'value' => trim( $vals[1] ), |
262 | 262 | ); |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | $other_array = array(); |
272 | 272 | foreach ( $field['options'] as $opt_key => $opt ) { |
273 | 273 | if ( FrmFieldsHelper::is_other_opt( $opt_key ) ) { |
274 | - $other_array[ $opt_key ] = $opt; |
|
274 | + $other_array[$opt_key] = $opt; |
|
275 | 275 | } |
276 | 276 | unset( $opt_key, $opt ); |
277 | 277 | } |
@@ -313,18 +313,18 @@ discard block |
||
313 | 313 | $disabled_fields = FrmAppHelper::pro_is_installed() ? array() : $pro_field_selection; |
314 | 314 | $frm_settings = FrmAppHelper::get_settings(); |
315 | 315 | |
316 | - if ( ! isset( $all_field_types[ $field['type'] ] ) ) { |
|
316 | + if ( ! isset( $all_field_types[$field['type']] ) ) { |
|
317 | 317 | // Add fallback for an add-on field type that has been deactivated. |
318 | - $all_field_types[ $field['type'] ] = array( |
|
318 | + $all_field_types[$field['type']] = array( |
|
319 | 319 | 'name' => ucfirst( $field['type'] ), |
320 | 320 | 'icon' => 'frm_icon_font frm_pencil_icon', |
321 | 321 | ); |
322 | - } elseif ( ! is_array( $all_field_types[ $field['type'] ] ) ) { |
|
322 | + } elseif ( ! is_array( $all_field_types[$field['type']] ) ) { |
|
323 | 323 | // Fallback for fields added in a more basic way. |
324 | - FrmFormsHelper::prepare_field_type( $all_field_types[ $field['type'] ] ); |
|
324 | + FrmFormsHelper::prepare_field_type( $all_field_types[$field['type']] ); |
|
325 | 325 | } |
326 | 326 | |
327 | - $type_name = $all_field_types[ $field['type'] ]['name']; |
|
327 | + $type_name = $all_field_types[$field['type']]['name']; |
|
328 | 328 | if ( $field['type'] === 'divider' && FrmField::is_option_true( $field, 'repeat' ) ) { |
329 | 329 | $type_name = $all_field_types['divider|repeat']['name']; |
330 | 330 | } |
@@ -387,13 +387,13 @@ discard block |
||
387 | 387 | $active = 'default_value'; |
388 | 388 | |
389 | 389 | foreach ( $settings as $type ) { |
390 | - if ( ! empty( $field[ $type ] ) ) { |
|
390 | + if ( ! empty( $field[$type] ) ) { |
|
391 | 391 | $active = $type; |
392 | 392 | } |
393 | 393 | } |
394 | 394 | |
395 | - $types[ $active ]['class'] .= ' current'; |
|
396 | - $types[ $active ]['current'] = true; |
|
395 | + $types[$active]['class'] .= ' current'; |
|
396 | + $types[$active]['current'] = true; |
|
397 | 397 | |
398 | 398 | return $types; |
399 | 399 | } |
@@ -407,8 +407,8 @@ discard block |
||
407 | 407 | 'website' => 'url', |
408 | 408 | 'image' => 'url', |
409 | 409 | ); |
410 | - if ( isset( $type_switch[ $type ] ) ) { |
|
411 | - $type = $type_switch[ $type ]; |
|
410 | + if ( isset( $type_switch[$type] ) ) { |
|
411 | + $type = $type_switch[$type]; |
|
412 | 412 | } |
413 | 413 | |
414 | 414 | $pro_fields = FrmField::pro_field_selection(); |
@@ -532,11 +532,11 @@ discard block |
||
532 | 532 | // include "col" for valid html |
533 | 533 | $unit = trim( preg_replace( '/[0-9]+/', '', $field['size'] ) ); |
534 | 534 | |
535 | - if ( ! isset( $calc[ $unit ] ) ) { |
|
535 | + if ( ! isset( $calc[$unit] ) ) { |
|
536 | 536 | return; |
537 | 537 | } |
538 | 538 | |
539 | - $size = (float) str_replace( $unit, '', $field['size'] ) / $calc[ $unit ]; |
|
539 | + $size = (float) str_replace( $unit, '', $field['size'] ) / $calc[$unit]; |
|
540 | 540 | |
541 | 541 | $add_html['cols'] = 'cols="' . absint( $size ) . '"'; |
542 | 542 | } |
@@ -729,11 +729,11 @@ discard block |
||
729 | 729 | private static function get_form_for_js_validation( $field ) { |
730 | 730 | global $frm_vars; |
731 | 731 | if ( ! empty( $frm_vars['js_validate_forms'] ) ) { |
732 | - if ( isset( $frm_vars['js_validate_forms'][ $field['form_id'] ] ) ) { |
|
733 | - return $frm_vars['js_validate_forms'][ $field['form_id'] ]; |
|
732 | + if ( isset( $frm_vars['js_validate_forms'][$field['form_id']] ) ) { |
|
733 | + return $frm_vars['js_validate_forms'][$field['form_id']]; |
|
734 | 734 | } |
735 | - if ( ! empty( $field['parent_form_id'] ) && isset( $frm_vars['js_validate_forms'][ $field['parent_form_id'] ] ) ) { |
|
736 | - return $frm_vars['js_validate_forms'][ $field['parent_form_id'] ]; |
|
735 | + if ( ! empty( $field['parent_form_id'] ) && isset( $frm_vars['js_validate_forms'][$field['parent_form_id']] ) ) { |
|
736 | + return $frm_vars['js_validate_forms'][$field['parent_form_id']]; |
|
737 | 737 | } |
738 | 738 | } |
739 | 739 | return false; |
@@ -804,10 +804,10 @@ discard block |
||
804 | 804 | |
805 | 805 | if ( is_numeric( $k ) && strpos( $v, '=' ) ) { |
806 | 806 | $add_html[] = $v; |
807 | - } elseif ( ! empty( $k ) && isset( $add_html[ $k ] ) ) { |
|
808 | - $add_html[ $k ] = str_replace( $k . '="', $k . '="' . $v, $add_html[ $k ] ); |
|
807 | + } elseif ( ! empty( $k ) && isset( $add_html[$k] ) ) { |
|
808 | + $add_html[$k] = str_replace( $k . '="', $k . '="' . $v, $add_html[$k] ); |
|
809 | 809 | } else { |
810 | - $add_html[ $k ] = $k . '="' . esc_attr( $v ) . '"'; |
|
810 | + $add_html[$k] = $k . '="' . esc_attr( $v ) . '"'; |
|
811 | 811 | } |
812 | 812 | |
813 | 813 | unset( $k, $v ); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $metas = FrmEntryMeta::get_entry_meta_info( $entry_exist ); |
78 | 78 | $field_metas = array(); |
79 | 79 | foreach ( $metas as $meta ) { |
80 | - $field_metas[ $meta->field_id ] = $meta->meta_value; |
|
80 | + $field_metas[$meta->field_id] = $meta->meta_value; |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | $filtered_vals = array_filter( $values['item_meta'] ); |
@@ -131,10 +131,10 @@ discard block |
||
131 | 131 | $reduced = array(); |
132 | 132 | foreach ( $filter_vals as $field_id => $value ) { |
133 | 133 | $field = FrmFieldFactory::get_field_object( $field_id ); |
134 | - $reduced[ $field_id ] = $field->get_value_to_save( $value, array( 'entry_id' => $entry_id ) ); |
|
135 | - $reduced[ $field_id ] = $field->set_value_before_save( $reduced[ $field_id ] ); |
|
136 | - if ( '' === $reduced[ $field_id ] || ( is_array( $reduced[ $field_id ] ) && 0 === count( $reduced[ $field_id ] ) ) ) { |
|
137 | - unset( $reduced[ $field_id ] ); |
|
134 | + $reduced[$field_id] = $field->get_value_to_save( $value, array( 'entry_id' => $entry_id ) ); |
|
135 | + $reduced[$field_id] = $field->set_value_before_save( $reduced[$field_id] ); |
|
136 | + if ( '' === $reduced[$field_id] || ( is_array( $reduced[$field_id] ) && 0 === count( $reduced[$field_id] ) ) ) { |
|
137 | + unset( $reduced[$field_id] ); |
|
138 | 138 | } |
139 | 139 | } |
140 | 140 | return $reduced; |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | $query = "SELECT it.*, fr.name as form_name, fr.form_key as form_key FROM {$wpdb->prefix}frm_items it |
328 | 328 | LEFT OUTER JOIN {$wpdb->prefix}frm_forms fr ON it.form_id=fr.id WHERE "; |
329 | 329 | |
330 | - $query .= is_numeric( $id ) ? 'it.id=%d' : 'it.item_key=%s'; |
|
330 | + $query .= is_numeric( $id ) ? 'it.id=%d' : 'it.item_key=%s'; |
|
331 | 331 | $query_args = array( $id ); |
332 | 332 | $query = $wpdb->prepare( $query, $query_args ); // WPCS: unprepared SQL ok. |
333 | 333 | |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | private static function prepare_entries( &$entries ) { |
373 | 373 | foreach ( $entries as $k => $entry ) { |
374 | 374 | self::prepare_entry( $entry ); |
375 | - $entries[ $k ] = $entry; |
|
375 | + $entries[$k] = $entry; |
|
376 | 376 | } |
377 | 377 | } |
378 | 378 | |
@@ -397,20 +397,20 @@ discard block |
||
397 | 397 | foreach ( $metas as $meta_val ) { |
398 | 398 | if ( $meta_val->item_id == $entry->id ) { |
399 | 399 | FrmAppHelper::unserialize_or_decode( $meta_val->meta_value ); |
400 | - $entry->metas[ $meta_val->field_id ] = $meta_val->meta_value; |
|
400 | + $entry->metas[$meta_val->field_id] = $meta_val->meta_value; |
|
401 | 401 | if ( $include_key ) { |
402 | - $entry->metas[ $meta_val->field_key ] = $entry->metas[ $meta_val->field_id ]; |
|
402 | + $entry->metas[$meta_val->field_key] = $entry->metas[$meta_val->field_id]; |
|
403 | 403 | } |
404 | 404 | continue; |
405 | 405 | } |
406 | 406 | |
407 | 407 | // include sub entries in an array |
408 | - if ( ! isset( $entry->metas[ $meta_val->field_id ] ) ) { |
|
409 | - $entry->metas[ $meta_val->field_id ] = array(); |
|
408 | + if ( ! isset( $entry->metas[$meta_val->field_id] ) ) { |
|
409 | + $entry->metas[$meta_val->field_id] = array(); |
|
410 | 410 | } |
411 | 411 | |
412 | 412 | FrmAppHelper::unserialize_or_decode( $meta_val->meta_value ); |
413 | - $entry->metas[ $meta_val->field_id ][] = $meta_val->meta_value; |
|
413 | + $entry->metas[$meta_val->field_id][] = $meta_val->meta_value; |
|
414 | 414 | |
415 | 415 | unset( $meta_val ); |
416 | 416 | } |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | |
458 | 458 | if ( $inc_form ) { |
459 | 459 | $fields = 'it.*, fr.name as form_name,fr.form_key as form_key'; |
460 | - $table .= 'LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_forms fr ON it.form_id=fr.id '; |
|
460 | + $table .= 'LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_forms fr ON it.form_id=fr.id '; |
|
461 | 461 | } |
462 | 462 | |
463 | 463 | if ( preg_match( '/ meta_([0-9]+)/', $order_by, $order_matches ) ) { |
@@ -501,16 +501,16 @@ discard block |
||
501 | 501 | } |
502 | 502 | |
503 | 503 | foreach ( $metas as $m_key => $meta_val ) { |
504 | - if ( ! isset( $entries[ $meta_val->item_id ] ) ) { |
|
504 | + if ( ! isset( $entries[$meta_val->item_id] ) ) { |
|
505 | 505 | continue; |
506 | 506 | } |
507 | 507 | |
508 | - if ( ! isset( $entries[ $meta_val->item_id ]->metas ) ) { |
|
509 | - $entries[ $meta_val->item_id ]->metas = array(); |
|
508 | + if ( ! isset( $entries[$meta_val->item_id]->metas ) ) { |
|
509 | + $entries[$meta_val->item_id]->metas = array(); |
|
510 | 510 | } |
511 | 511 | |
512 | 512 | FrmAppHelper::unserialize_or_decode( $meta_val->meta_value ); |
513 | - $entries[ $meta_val->item_id ]->metas[ $meta_val->field_id ] = $meta_val->meta_value; |
|
513 | + $entries[$meta_val->item_id]->metas[$meta_val->field_id] = $meta_val->meta_value; |
|
514 | 514 | unset( $m_key, $meta_val ); |
515 | 515 | } |
516 | 516 | |
@@ -688,7 +688,7 @@ discard block |
||
688 | 688 | } |
689 | 689 | |
690 | 690 | private static function get_entry_value( $values, $name, $default ) { |
691 | - return isset( $values[ $name ] ) ? $values[ $name ] : $default; |
|
691 | + return isset( $values[$name] ) ? $values[$name] : $default; |
|
692 | 692 | } |
693 | 693 | |
694 | 694 | /** |
@@ -75,19 +75,19 @@ discard block |
||
75 | 75 | global $frm_vars; |
76 | 76 | $form_id = FrmForm::get_current_form_id(); |
77 | 77 | |
78 | - $columns[ $form_id . '_id' ] = 'ID'; |
|
79 | - $columns[ $form_id . '_item_key' ] = esc_html__( 'Entry Key', 'formidable' ); |
|
78 | + $columns[$form_id . '_id'] = 'ID'; |
|
79 | + $columns[$form_id . '_item_key'] = esc_html__( 'Entry Key', 'formidable' ); |
|
80 | 80 | |
81 | 81 | if ( $form_id ) { |
82 | 82 | self::get_columns_for_form( $form_id, $columns ); |
83 | 83 | } else { |
84 | - $columns[ $form_id . '_form_id' ] = __( 'Form', 'formidable' ); |
|
85 | - $columns[ $form_id . '_name' ] = __( 'Entry Name', 'formidable' ); |
|
86 | - $columns[ $form_id . '_user_id' ] = __( 'Created By', 'formidable' ); |
|
84 | + $columns[$form_id . '_form_id'] = __( 'Form', 'formidable' ); |
|
85 | + $columns[$form_id . '_name'] = __( 'Entry Name', 'formidable' ); |
|
86 | + $columns[$form_id . '_user_id'] = __( 'Created By', 'formidable' ); |
|
87 | 87 | } |
88 | 88 | |
89 | - $columns[ $form_id . '_created_at' ] = __( 'Entry creation date', 'formidable' ); |
|
90 | - $columns[ $form_id . '_updated_at' ] = __( 'Entry update date', 'formidable' ); |
|
89 | + $columns[$form_id . '_created_at'] = __( 'Entry creation date', 'formidable' ); |
|
90 | + $columns[$form_id . '_updated_at'] = __( 'Entry update date', 'formidable' ); |
|
91 | 91 | self::maybe_add_ip_col( $form_id, $columns ); |
92 | 92 | |
93 | 93 | $frm_vars['cols'] = $columns; |
@@ -135,10 +135,10 @@ discard block |
||
135 | 135 | |
136 | 136 | foreach ( $sub_form_cols as $k => $sub_form_col ) { |
137 | 137 | if ( FrmField::is_no_save_field( $sub_form_col->type ) ) { |
138 | - unset( $sub_form_cols[ $k ] ); |
|
138 | + unset( $sub_form_cols[$k] ); |
|
139 | 139 | continue; |
140 | 140 | } |
141 | - $columns[ $form_id . '_' . $sub_form_col->field_key . '-_-' . $field->id ] = FrmAppHelper::truncate( $sub_form_col->name, 35 ); |
|
141 | + $columns[$form_id . '_' . $sub_form_col->field_key . '-_-' . $field->id] = FrmAppHelper::truncate( $sub_form_col->name, 35 ); |
|
142 | 142 | unset( $sub_form_col ); |
143 | 143 | } |
144 | 144 | } |
@@ -155,15 +155,15 @@ discard block |
||
155 | 155 | $has_separate_value = ! FrmField::is_option_empty( $field, 'separate_value' ); |
156 | 156 | $is_post_status = FrmField::is_option_true( $field, 'post_field' ) && $field->field_options['post_field'] == 'post_status'; |
157 | 157 | if ( $has_separate_value && ! $is_post_status ) { |
158 | - $columns[ $form_id . '_frmsep_' . $col_id ] = FrmAppHelper::truncate( $field->name, 35 ); |
|
158 | + $columns[$form_id . '_frmsep_' . $col_id] = FrmAppHelper::truncate( $field->name, 35 ); |
|
159 | 159 | } |
160 | 160 | |
161 | - $columns[ $form_id . '_' . $col_id ] = FrmAppHelper::truncate( $field->name, 35 ); |
|
161 | + $columns[$form_id . '_' . $col_id] = FrmAppHelper::truncate( $field->name, 35 ); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | private static function maybe_add_ip_col( $form_id, &$columns ) { |
165 | 165 | if ( FrmAppHelper::ips_saved() ) { |
166 | - $columns[ $form_id . '_ip' ] = 'IP'; |
|
166 | + $columns[$form_id . '_ip'] = 'IP'; |
|
167 | 167 | } |
168 | 168 | } |
169 | 169 | |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | foreach ( $meta_value as $mk => $mv ) { |
202 | 202 | // Remove blank values. |
203 | 203 | if ( empty( $mv ) ) { |
204 | - unset( $meta_value[ $mk ] ); |
|
204 | + unset( $meta_value[$mk] ); |
|
205 | 205 | } |
206 | 206 | } |
207 | 207 | |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | |
278 | 278 | foreach ( $fields as $field ) { |
279 | 279 | if ( self::field_supports_sorting( $field ) ) { |
280 | - $columns[ $form_id . '_' . $field->field_key ] = 'meta_' . $field->id; |
|
280 | + $columns[$form_id . '_' . $field->field_key] = 'meta_' . $field->id; |
|
281 | 281 | } |
282 | 282 | } |
283 | 283 | |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | $atts['form_id'] . '_item_key' => '', |
354 | 354 | $atts['form_id'] . '_id' => '', |
355 | 355 | ); |
356 | - $cols = $remove_first + array_reverse( $frm_vars['cols'], true ); |
|
356 | + $cols = $remove_first + array_reverse( $frm_vars['cols'], true ); |
|
357 | 357 | |
358 | 358 | $i = $atts['i']; |
359 | 359 | |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | |
365 | 365 | if ( empty( $result ) || ! in_array( $col_key, $result, true ) ) { |
366 | 366 | $result[] = $col_key; |
367 | - $i--; |
|
367 | + $i --; |
|
368 | 368 | } |
369 | 369 | |
370 | 370 | unset( $col_key, $col ); |
@@ -497,9 +497,9 @@ discard block |
||
497 | 497 | if ( ! isset( $frm_vars['form_params'] ) ) { |
498 | 498 | $frm_vars['form_params'] = array(); |
499 | 499 | } |
500 | - $frm_vars['form_params'][ $form->id ] = $params; |
|
500 | + $frm_vars['form_params'][$form->id] = $params; |
|
501 | 501 | |
502 | - if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) { |
|
502 | + if ( isset( $frm_vars['created_entries'][$form_id] ) ) { |
|
503 | 503 | return; |
504 | 504 | } |
505 | 505 | |
@@ -515,16 +515,16 @@ discard block |
||
515 | 515 | */ |
516 | 516 | $errors = apply_filters( 'frm_entries_before_create', $errors, $form ); |
517 | 517 | |
518 | - $frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors ); |
|
518 | + $frm_vars['created_entries'][$form_id] = array( 'errors' => $errors ); |
|
519 | 519 | |
520 | 520 | if ( empty( $errors ) ) { |
521 | 521 | $_POST['frm_skip_cookie'] = 1; |
522 | 522 | $do_success = false; |
523 | 523 | if ( $params['action'] == 'create' ) { |
524 | - if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) { |
|
525 | - $frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST ); |
|
524 | + if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][$form_id]['entry_id'] ) ) { |
|
525 | + $frm_vars['created_entries'][$form_id]['entry_id'] = FrmEntry::create( $_POST ); |
|
526 | 526 | |
527 | - $params['id'] = $frm_vars['created_entries'][ $form_id ]['entry_id']; |
|
527 | + $params['id'] = $frm_vars['created_entries'][$form_id]['entry_id']; |
|
528 | 528 | $do_success = true; |
529 | 529 | } |
530 | 530 | } |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | 'fill' => '#4d4d4d', |
158 | 158 | 'orange' => '#f05a24', |
159 | 159 | ); |
160 | - $atts = array_merge( $defaults, $atts ); |
|
160 | + $atts = array_merge( $defaults, $atts ); |
|
161 | 161 | |
162 | 162 | return '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 599.68 601.37" width="' . esc_attr( $atts['width'] ) . '" height="' . esc_attr( $atts['height'] ) . '"> |
163 | 163 | <path fill="' . esc_attr( $atts['orange'] ) . '" d="M289.6 384h140v76h-140z"/> |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | * @return string |
365 | 365 | */ |
366 | 366 | public static function get_server_value( $value ) { |
367 | - return isset( $_SERVER[ $value ] ) ? wp_strip_all_tags( wp_unslash( $_SERVER[ $value ] ) ) : ''; |
|
367 | + return isset( $_SERVER[$value] ) ? wp_strip_all_tags( wp_unslash( $_SERVER[$value] ) ) : ''; |
|
368 | 368 | } |
369 | 369 | |
370 | 370 | /** |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | ); |
388 | 388 | $ip = ''; |
389 | 389 | foreach ( $ip_options as $key ) { |
390 | - if ( ! isset( $_SERVER[ $key ] ) ) { |
|
390 | + if ( ! isset( $_SERVER[$key] ) ) { |
|
391 | 391 | continue; |
392 | 392 | } |
393 | 393 | |
@@ -412,10 +412,10 @@ discard block |
||
412 | 412 | |
413 | 413 | if ( $src == 'get' ) { |
414 | 414 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
415 | - $value = isset( $_POST[ $param ] ) ? wp_unslash( $_POST[ $param ] ) : ( isset( $_GET[ $param ] ) ? wp_unslash( $_GET[ $param ] ) : $default ); |
|
416 | - if ( ! isset( $_POST[ $param ] ) && isset( $_GET[ $param ] ) && ! is_array( $value ) ) { |
|
415 | + $value = isset( $_POST[$param] ) ? wp_unslash( $_POST[$param] ) : ( isset( $_GET[$param] ) ? wp_unslash( $_GET[$param] ) : $default ); |
|
416 | + if ( ! isset( $_POST[$param] ) && isset( $_GET[$param] ) && ! is_array( $value ) ) { |
|
417 | 417 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
418 | - $value = htmlspecialchars_decode( wp_unslash( $_GET[ $param ] ) ); |
|
418 | + $value = htmlspecialchars_decode( wp_unslash( $_GET[$param] ) ); |
|
419 | 419 | } |
420 | 420 | self::sanitize_value( $sanitize, $value ); |
421 | 421 | } else { |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | } |
437 | 437 | |
438 | 438 | $p = trim( $p, ']' ); |
439 | - $value = isset( $value[ $p ] ) ? $value[ $p ] : $default; |
|
439 | + $value = isset( $value[$p] ) ? $value[$p] : $default; |
|
440 | 440 | } |
441 | 441 | } |
442 | 442 | |
@@ -492,26 +492,26 @@ discard block |
||
492 | 492 | 'sanitize' => 'sanitize_text_field', |
493 | 493 | 'serialized' => false, |
494 | 494 | ); |
495 | - $args = wp_parse_args( $args, $defaults ); |
|
495 | + $args = wp_parse_args( $args, $defaults ); |
|
496 | 496 | |
497 | 497 | $value = $args['default']; |
498 | 498 | if ( $args['type'] == 'get' ) { |
499 | - if ( $_GET && isset( $_GET[ $args['param'] ] ) ) { |
|
499 | + if ( $_GET && isset( $_GET[$args['param']] ) ) { |
|
500 | 500 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
501 | - $value = wp_unslash( $_GET[ $args['param'] ] ); |
|
501 | + $value = wp_unslash( $_GET[$args['param']] ); |
|
502 | 502 | } |
503 | 503 | } elseif ( $args['type'] == 'post' ) { |
504 | - if ( isset( $_POST[ $args['param'] ] ) ) { |
|
504 | + if ( isset( $_POST[$args['param']] ) ) { |
|
505 | 505 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
506 | - $value = wp_unslash( $_POST[ $args['param'] ] ); |
|
506 | + $value = wp_unslash( $_POST[$args['param']] ); |
|
507 | 507 | if ( $args['serialized'] === true && is_serialized_string( $value ) && is_serialized( $value ) ) { |
508 | 508 | self::unserialize_or_decode( $value ); |
509 | 509 | } |
510 | 510 | } |
511 | 511 | } else { |
512 | - if ( isset( $_REQUEST[ $args['param'] ] ) ) { |
|
512 | + if ( isset( $_REQUEST[$args['param']] ) ) { |
|
513 | 513 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
514 | - $value = wp_unslash( $_REQUEST[ $args['param'] ] ); |
|
514 | + $value = wp_unslash( $_REQUEST[$args['param']] ); |
|
515 | 515 | } |
516 | 516 | } |
517 | 517 | |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | if ( is_array( $value ) ) { |
544 | 544 | $temp_values = $value; |
545 | 545 | foreach ( $temp_values as $k => $v ) { |
546 | - self::sanitize_value( $sanitize, $value[ $k ] ); |
|
546 | + self::sanitize_value( $sanitize, $value[$k] ); |
|
547 | 547 | } |
548 | 548 | } else { |
549 | 549 | $value = call_user_func( $sanitize, $value ); |
@@ -554,8 +554,8 @@ discard block |
||
554 | 554 | public static function sanitize_request( $sanitize_method, &$values ) { |
555 | 555 | $temp_values = $values; |
556 | 556 | foreach ( $temp_values as $k => $val ) { |
557 | - if ( isset( $sanitize_method[ $k ] ) ) { |
|
558 | - $values[ $k ] = call_user_func( $sanitize_method[ $k ], $val ); |
|
557 | + if ( isset( $sanitize_method[$k] ) ) { |
|
558 | + $values[$k] = call_user_func( $sanitize_method[$k], $val ); |
|
559 | 559 | } |
560 | 560 | } |
561 | 561 | } |
@@ -578,7 +578,7 @@ discard block |
||
578 | 578 | if ( is_array( $value ) ) { |
579 | 579 | $temp_values = $value; |
580 | 580 | foreach ( $temp_values as $k => $v ) { |
581 | - self::decode_specialchars( $value[ $k ] ); |
|
581 | + self::decode_specialchars( $value[$k] ); |
|
582 | 582 | } |
583 | 583 | } else { |
584 | 584 | self::decode_amp( $value ); |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | $allowed_html = $html; |
656 | 656 | } elseif ( ! empty( $allowed ) ) { |
657 | 657 | foreach ( (array) $allowed as $a ) { |
658 | - $allowed_html[ $a ] = isset( $html[ $a ] ) ? $html[ $a ] : array(); |
|
658 | + $allowed_html[$a] = isset( $html[$a] ) ? $html[$a] : array(); |
|
659 | 659 | } |
660 | 660 | } |
661 | 661 | |
@@ -817,8 +817,8 @@ discard block |
||
817 | 817 | } |
818 | 818 | |
819 | 819 | global $wp_query; |
820 | - if ( isset( $wp_query->query_vars[ $param ] ) ) { |
|
821 | - $value = $wp_query->query_vars[ $param ]; |
|
820 | + if ( isset( $wp_query->query_vars[$param] ) ) { |
|
821 | + $value = $wp_query->query_vars[$param]; |
|
822 | 822 | } |
823 | 823 | |
824 | 824 | return $value; |
@@ -996,7 +996,7 @@ discard block |
||
996 | 996 | 'new_file_path' => self::plugin_path() . '/js', |
997 | 997 | ) |
998 | 998 | ); |
999 | - $new_file = new FrmCreateFile( $file_atts ); |
|
999 | + $new_file = new FrmCreateFile( $file_atts ); |
|
1000 | 1000 | |
1001 | 1001 | $files = array( |
1002 | 1002 | self::plugin_path() . '/js/jquery/jquery.placeholder.min.js', |
@@ -1402,8 +1402,8 @@ discard block |
||
1402 | 1402 | return $error; |
1403 | 1403 | } |
1404 | 1404 | |
1405 | - $nonce_value = ( $_REQUEST && isset( $_REQUEST[ $nonce_name ] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST[ $nonce_name ] ) ) : ''; |
|
1406 | - if ( $_REQUEST && ( ! isset( $_REQUEST[ $nonce_name ] ) || ! wp_verify_nonce( $nonce_value, $nonce ) ) ) { |
|
1405 | + $nonce_value = ( $_REQUEST && isset( $_REQUEST[$nonce_name] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST[$nonce_name] ) ) : ''; |
|
1406 | + if ( $_REQUEST && ( ! isset( $_REQUEST[$nonce_name] ) || ! wp_verify_nonce( $nonce_value, $nonce ) ) ) { |
|
1407 | 1407 | $frm_settings = self::get_settings(); |
1408 | 1408 | $error = $frm_settings->admin_permission; |
1409 | 1409 | } |
@@ -1438,7 +1438,7 @@ discard block |
||
1438 | 1438 | } else { |
1439 | 1439 | foreach ( $value as $k => $v ) { |
1440 | 1440 | if ( ! is_array( $v ) ) { |
1441 | - $value[ $k ] = call_user_func( $original_function, $v ); |
|
1441 | + $value[$k] = call_user_func( $original_function, $v ); |
|
1442 | 1442 | } |
1443 | 1443 | } |
1444 | 1444 | } |
@@ -1463,7 +1463,7 @@ discard block |
||
1463 | 1463 | $return = array_merge( $return, self::array_flatten( $value, $keys ) ); |
1464 | 1464 | } else { |
1465 | 1465 | if ( $keys == 'keep' ) { |
1466 | - $return[ $key ] = $value; |
|
1466 | + $return[$key] = $value; |
|
1467 | 1467 | } else { |
1468 | 1468 | $return[] = $value; |
1469 | 1469 | } |
@@ -1527,11 +1527,11 @@ discard block |
||
1527 | 1527 | } |
1528 | 1528 | |
1529 | 1529 | $ver = $default; |
1530 | - if ( ! isset( $wp_scripts->registered[ $handle ] ) ) { |
|
1530 | + if ( ! isset( $wp_scripts->registered[$handle] ) ) { |
|
1531 | 1531 | return $ver; |
1532 | 1532 | } |
1533 | 1533 | |
1534 | - $query = $wp_scripts->registered[ $handle ]; |
|
1534 | + $query = $wp_scripts->registered[$handle]; |
|
1535 | 1535 | if ( is_object( $query ) && ! empty( $query->ver ) ) { |
1536 | 1536 | $ver = $query->ver; |
1537 | 1537 | } |
@@ -1708,7 +1708,7 @@ discard block |
||
1708 | 1708 | |
1709 | 1709 | foreach ( array( 'name', 'description' ) as $var ) { |
1710 | 1710 | $default_val = isset( $record->{$var} ) ? $record->{$var} : ''; |
1711 | - $values[ $var ] = self::get_param( $var, $default_val, 'get', 'wp_kses_post' ); |
|
1711 | + $values[$var] = self::get_param( $var, $default_val, 'get', 'wp_kses_post' ); |
|
1712 | 1712 | unset( $var, $default_val ); |
1713 | 1713 | } |
1714 | 1714 | |
@@ -1766,9 +1766,9 @@ discard block |
||
1766 | 1766 | } |
1767 | 1767 | } |
1768 | 1768 | |
1769 | - $field_type = isset( $post_values['field_options'][ 'type_' . $field->id ] ) ? $post_values['field_options'][ 'type_' . $field->id ] : $field->type; |
|
1770 | - if ( isset( $post_values['item_meta'][ $field->id ] ) ) { |
|
1771 | - $new_value = $post_values['item_meta'][ $field->id ]; |
|
1769 | + $field_type = isset( $post_values['field_options']['type_' . $field->id] ) ? $post_values['field_options']['type_' . $field->id] : $field->type; |
|
1770 | + if ( isset( $post_values['item_meta'][$field->id] ) ) { |
|
1771 | + $new_value = $post_values['item_meta'][$field->id]; |
|
1772 | 1772 | self::unserialize_or_decode( $new_value ); |
1773 | 1773 | } else { |
1774 | 1774 | $new_value = $meta_value; |
@@ -1789,7 +1789,7 @@ discard block |
||
1789 | 1789 | |
1790 | 1790 | $field_array = array_merge( (array) $field->field_options, $field_array ); |
1791 | 1791 | |
1792 | - $values['fields'][ $field->id ] = $field_array; |
|
1792 | + $values['fields'][$field->id] = $field_array; |
|
1793 | 1793 | } |
1794 | 1794 | |
1795 | 1795 | /** |
@@ -1836,11 +1836,11 @@ discard block |
||
1836 | 1836 | } |
1837 | 1837 | |
1838 | 1838 | foreach ( $form->options as $opt => $value ) { |
1839 | - if ( isset( $post_values[ $opt ] ) ) { |
|
1840 | - $values[ $opt ] = $post_values[ $opt ]; |
|
1841 | - self::unserialize_or_decode( $values[ $opt ] ); |
|
1839 | + if ( isset( $post_values[$opt] ) ) { |
|
1840 | + $values[$opt] = $post_values[$opt]; |
|
1841 | + self::unserialize_or_decode( $values[$opt] ); |
|
1842 | 1842 | } else { |
1843 | - $values[ $opt ] = $value; |
|
1843 | + $values[$opt] = $value; |
|
1844 | 1844 | } |
1845 | 1845 | } |
1846 | 1846 | |
@@ -1854,8 +1854,8 @@ discard block |
||
1854 | 1854 | $form_defaults = FrmFormsHelper::get_default_opts(); |
1855 | 1855 | |
1856 | 1856 | foreach ( $form_defaults as $opt => $default ) { |
1857 | - if ( ! isset( $values[ $opt ] ) || $values[ $opt ] == '' ) { |
|
1858 | - $values[ $opt ] = ( $post_values && isset( $post_values['options'][ $opt ] ) ) ? $post_values['options'][ $opt ] : $default; |
|
1857 | + if ( ! isset( $values[$opt] ) || $values[$opt] == '' ) { |
|
1858 | + $values[$opt] = ( $post_values && isset( $post_values['options'][$opt] ) ) ? $post_values['options'][$opt] : $default; |
|
1859 | 1859 | } |
1860 | 1860 | |
1861 | 1861 | unset( $opt, $default ); |
@@ -1866,8 +1866,8 @@ discard block |
||
1866 | 1866 | } |
1867 | 1867 | |
1868 | 1868 | foreach ( array( 'before', 'after', 'submit' ) as $h ) { |
1869 | - if ( ! isset( $values[ $h . '_html' ] ) ) { |
|
1870 | - $values[ $h . '_html' ] = ( isset( $post_values['options'][ $h . '_html' ] ) ? $post_values['options'][ $h . '_html' ] : FrmFormsHelper::get_default_html( $h ) ); |
|
1869 | + if ( ! isset( $values[$h . '_html'] ) ) { |
|
1870 | + $values[$h . '_html'] = ( isset( $post_values['options'][$h . '_html'] ) ? $post_values['options'][$h . '_html'] : FrmFormsHelper::get_default_html( $h ) ); |
|
1871 | 1871 | } |
1872 | 1872 | unset( $h ); |
1873 | 1873 | } |
@@ -2019,25 +2019,25 @@ discard block |
||
2019 | 2019 | if ( ! is_numeric( $levels ) ) { |
2020 | 2020 | // Show time in specified unit. |
2021 | 2021 | $levels = self::get_unit( $levels ); |
2022 | - if ( isset( $time_strings[ $levels ] ) ) { |
|
2022 | + if ( isset( $time_strings[$levels] ) ) { |
|
2023 | 2023 | $diff = array( |
2024 | 2024 | $levels => self::time_format( $levels, $diff ), |
2025 | 2025 | ); |
2026 | 2026 | $time_strings = array( |
2027 | - $levels => $time_strings[ $levels ], |
|
2027 | + $levels => $time_strings[$levels], |
|
2028 | 2028 | ); |
2029 | 2029 | } |
2030 | 2030 | $levels = 1; |
2031 | 2031 | } |
2032 | 2032 | |
2033 | 2033 | foreach ( $time_strings as $k => $v ) { |
2034 | - if ( isset( $diff[ $k ] ) && $diff[ $k ] ) { |
|
2035 | - $time_strings[ $k ] = $diff[ $k ] . ' ' . ( $diff[ $k ] > 1 ? $v[1] : $v[0] ); |
|
2036 | - } elseif ( isset( $diff[ $k ] ) && count( $time_strings ) === 1 ) { |
|
2034 | + if ( isset( $diff[$k] ) && $diff[$k] ) { |
|
2035 | + $time_strings[$k] = $diff[$k] . ' ' . ( $diff[$k] > 1 ? $v[1] : $v[0] ); |
|
2036 | + } elseif ( isset( $diff[$k] ) && count( $time_strings ) === 1 ) { |
|
2037 | 2037 | // Account for 0. |
2038 | - $time_strings[ $k ] = $diff[ $k ] . ' ' . $v[1]; |
|
2038 | + $time_strings[$k] = $diff[$k] . ' ' . $v[1]; |
|
2039 | 2039 | } else { |
2040 | - unset( $time_strings[ $k ] ); |
|
2040 | + unset( $time_strings[$k] ); |
|
2041 | 2041 | } |
2042 | 2042 | } |
2043 | 2043 | |
@@ -2056,8 +2056,8 @@ discard block |
||
2056 | 2056 | 'y' => 'y', |
2057 | 2057 | 'd' => 'days', |
2058 | 2058 | ); |
2059 | - if ( isset( $return[ $unit ] ) ) { |
|
2060 | - return $diff[ $return[ $unit ] ]; |
|
2059 | + if ( isset( $return[$unit] ) ) { |
|
2060 | + return $diff[$return[$unit]]; |
|
2061 | 2061 | } |
2062 | 2062 | |
2063 | 2063 | $total = $diff['days'] * self::convert_time( 'd', $unit ); |
@@ -2065,11 +2065,11 @@ discard block |
||
2065 | 2065 | $times = array( 'h', 'i', 's' ); |
2066 | 2066 | |
2067 | 2067 | foreach ( $times as $time ) { |
2068 | - if ( ! isset( $diff[ $time ] ) ) { |
|
2068 | + if ( ! isset( $diff[$time] ) ) { |
|
2069 | 2069 | continue; |
2070 | 2070 | } |
2071 | 2071 | |
2072 | - $total += $diff[ $time ] * self::convert_time( $time, $unit ); |
|
2072 | + $total += $diff[$time] * self::convert_time( $time, $unit ); |
|
2073 | 2073 | } |
2074 | 2074 | |
2075 | 2075 | return floor( $total ); |
@@ -2089,7 +2089,7 @@ discard block |
||
2089 | 2089 | 'y' => DAY_IN_SECONDS * 365.25, |
2090 | 2090 | ); |
2091 | 2091 | |
2092 | - return $convert[ $from ] / $convert[ $to ]; |
|
2092 | + return $convert[$from] / $convert[$to]; |
|
2093 | 2093 | } |
2094 | 2094 | |
2095 | 2095 | /** |
@@ -2097,7 +2097,7 @@ discard block |
||
2097 | 2097 | */ |
2098 | 2098 | private static function get_unit( $unit ) { |
2099 | 2099 | $units = self::get_time_strings(); |
2100 | - if ( isset( $units[ $unit ] ) || is_numeric( $unit ) ) { |
|
2100 | + if ( isset( $units[$unit] ) || is_numeric( $unit ) ) { |
|
2101 | 2101 | return $unit; |
2102 | 2102 | } |
2103 | 2103 | |
@@ -2208,17 +2208,17 @@ discard block |
||
2208 | 2208 | |
2209 | 2209 | case 1: |
2210 | 2210 | $l2 = $name; |
2211 | - self::add_value_to_array( $name, $l2, $this_val, $vars[ $l1 ] ); |
|
2211 | + self::add_value_to_array( $name, $l2, $this_val, $vars[$l1] ); |
|
2212 | 2212 | break; |
2213 | 2213 | |
2214 | 2214 | case 2: |
2215 | 2215 | $l3 = $name; |
2216 | - self::add_value_to_array( $name, $l3, $this_val, $vars[ $l1 ][ $l2 ] ); |
|
2216 | + self::add_value_to_array( $name, $l3, $this_val, $vars[$l1][$l2] ); |
|
2217 | 2217 | break; |
2218 | 2218 | |
2219 | 2219 | case 3: |
2220 | 2220 | $l4 = $name; |
2221 | - self::add_value_to_array( $name, $l4, $this_val, $vars[ $l1 ][ $l2 ][ $l3 ] ); |
|
2221 | + self::add_value_to_array( $name, $l4, $this_val, $vars[$l1][$l2][$l3] ); |
|
2222 | 2222 | } |
2223 | 2223 | |
2224 | 2224 | unset( $this_val, $n ); |
@@ -2237,8 +2237,8 @@ discard block |
||
2237 | 2237 | public static function add_value_to_array( $name, $l1, $val, &$vars ) { |
2238 | 2238 | if ( $name == '' ) { |
2239 | 2239 | $vars[] = $val; |
2240 | - } elseif ( ! isset( $vars[ $l1 ] ) ) { |
|
2241 | - $vars[ $l1 ] = $val; |
|
2240 | + } elseif ( ! isset( $vars[$l1] ) ) { |
|
2241 | + $vars[$l1] = $val; |
|
2242 | 2242 | } |
2243 | 2243 | } |
2244 | 2244 | |
@@ -2254,7 +2254,7 @@ discard block |
||
2254 | 2254 | 'email_subject' => esc_attr( sprintf( __( 'If you leave the subject blank, the default will be used: %1$s Form submitted on %2$s', 'formidable' ), $form_name, self::site_name() ) ), |
2255 | 2255 | ); |
2256 | 2256 | |
2257 | - if ( ! isset( $tooltips[ $name ] ) ) { |
|
2257 | + if ( ! isset( $tooltips[$name] ) ) { |
|
2258 | 2258 | return; |
2259 | 2259 | } |
2260 | 2260 | |
@@ -2264,7 +2264,7 @@ discard block |
||
2264 | 2264 | echo ' class="frm_help"'; |
2265 | 2265 | } |
2266 | 2266 | |
2267 | - echo ' title="' . esc_attr( $tooltips[ $name ] ); |
|
2267 | + echo ' title="' . esc_attr( $tooltips[$name] ); |
|
2268 | 2268 | |
2269 | 2269 | if ( 'open' != $class ) { |
2270 | 2270 | echo '"'; |
@@ -2319,13 +2319,13 @@ discard block |
||
2319 | 2319 | } |
2320 | 2320 | |
2321 | 2321 | private static function prepare_action_slashes( $val, $key, &$post_content ) { |
2322 | - if ( ! isset( $post_content[ $key ] ) || is_numeric( $val ) ) { |
|
2322 | + if ( ! isset( $post_content[$key] ) || is_numeric( $val ) ) { |
|
2323 | 2323 | return; |
2324 | 2324 | } |
2325 | 2325 | |
2326 | 2326 | if ( is_array( $val ) ) { |
2327 | 2327 | foreach ( $val as $k1 => $v1 ) { |
2328 | - self::prepare_action_slashes( $v1, $k1, $post_content[ $key ] ); |
|
2328 | + self::prepare_action_slashes( $v1, $k1, $post_content[$key] ); |
|
2329 | 2329 | unset( $k1, $v1 ); |
2330 | 2330 | } |
2331 | 2331 | } else { |
@@ -2333,7 +2333,7 @@ discard block |
||
2333 | 2333 | $val = stripslashes( $val ); |
2334 | 2334 | |
2335 | 2335 | // Add backslashes before double quotes and forward slashes only |
2336 | - $post_content[ $key ] = addcslashes( $val, '"\\/' ); |
|
2336 | + $post_content[$key] = addcslashes( $val, '"\\/' ); |
|
2337 | 2337 | } |
2338 | 2338 | } |
2339 | 2339 | |
@@ -2392,14 +2392,14 @@ discard block |
||
2392 | 2392 | continue; |
2393 | 2393 | } |
2394 | 2394 | $key = $input['name']; |
2395 | - if ( isset( $formatted[ $key ] ) ) { |
|
2396 | - if ( is_array( $formatted[ $key ] ) ) { |
|
2397 | - $formatted[ $key ][] = $input['value']; |
|
2395 | + if ( isset( $formatted[$key] ) ) { |
|
2396 | + if ( is_array( $formatted[$key] ) ) { |
|
2397 | + $formatted[$key][] = $input['value']; |
|
2398 | 2398 | } else { |
2399 | - $formatted[ $key ] = array( $formatted[ $key ], $input['value'] ); |
|
2399 | + $formatted[$key] = array( $formatted[$key], $input['value'] ); |
|
2400 | 2400 | } |
2401 | 2401 | } else { |
2402 | - $formatted[ $key ] = $input['value']; |
|
2402 | + $formatted[$key] = $input['value']; |
|
2403 | 2403 | } |
2404 | 2404 | } |
2405 | 2405 | |
@@ -2965,8 +2965,8 @@ discard block |
||
2965 | 2965 | } |
2966 | 2966 | |
2967 | 2967 | foreach ( $keys as $key ) { |
2968 | - if ( isset( $values[ $key ] ) ) { |
|
2969 | - $values[ $key ] = self::kses( $values[ $key ], 'all' ); |
|
2968 | + if ( isset( $values[$key] ) ) { |
|
2969 | + $values[$key] = self::kses( $values[$key], 'all' ); |
|
2970 | 2970 | } |
2971 | 2971 | } |
2972 | 2972 |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | $new_values['field_key'] = FrmAppHelper::get_unique_key( $key, $wpdb->prefix . 'frm_fields', 'field_key' ); |
232 | 232 | |
233 | 233 | foreach ( array( 'name', 'description', 'type', 'default_value' ) as $col ) { |
234 | - $new_values[ $col ] = $values[ $col ]; |
|
234 | + $new_values[$col] = $values[$col]; |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | $new_values['options'] = $values['options']; |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | $new_values['created_at'] = current_time( 'mysql', 1 ); |
244 | 244 | |
245 | 245 | if ( isset( $values['id'] ) ) { |
246 | - $frm_duplicate_ids[ $values['field_key'] ] = $new_values['field_key']; |
|
246 | + $frm_duplicate_ids[$values['field_key']] = $new_values['field_key']; |
|
247 | 247 | $new_values = apply_filters( 'frm_duplicated_field', $new_values ); |
248 | 248 | } |
249 | 249 | |
@@ -252,9 +252,9 @@ discard block |
||
252 | 252 | foreach ( $new_values as $k => $v ) { |
253 | 253 | if ( is_array( $v ) ) { |
254 | 254 | if ( $k === 'default_value' ) { |
255 | - $new_values[ $k ] = FrmAppHelper::maybe_json_encode( $v ); |
|
255 | + $new_values[$k] = FrmAppHelper::maybe_json_encode( $v ); |
|
256 | 256 | } else { |
257 | - $new_values[ $k ] = serialize( $v ); |
|
257 | + $new_values[$k] = serialize( $v ); |
|
258 | 258 | } |
259 | 259 | } |
260 | 260 | unset( $k, $v ); |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | |
277 | 277 | if ( $query_results ) { |
278 | 278 | if ( isset( $values['id'] ) ) { |
279 | - $frm_duplicate_ids[ $values['id'] ] = $new_id; |
|
279 | + $frm_duplicate_ids[$values['id']] = $new_id; |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | return $new_id; |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | public static function duplicate( $old_form_id, $form_id, $copy_keys = false, $blog_id = false ) { |
330 | 330 | global $frm_duplicate_ids; |
331 | 331 | |
332 | - $where = array( |
|
332 | + $where = array( |
|
333 | 333 | array( |
334 | 334 | 'or' => 1, |
335 | 335 | 'fi.form_id' => $old_form_id, |
@@ -375,8 +375,8 @@ discard block |
||
375 | 375 | |
376 | 376 | $values = apply_filters( 'frm_duplicated_field', $values ); |
377 | 377 | $new_id = self::create( $values ); |
378 | - $frm_duplicate_ids[ $field->id ] = $new_id; |
|
379 | - $frm_duplicate_ids[ $field->field_key ] = $new_id; |
|
378 | + $frm_duplicate_ids[$field->id] = $new_id; |
|
379 | + $frm_duplicate_ids[$field->field_key] = $new_id; |
|
380 | 380 | unset( $field ); |
381 | 381 | } |
382 | 382 | } |
@@ -408,9 +408,9 @@ discard block |
||
408 | 408 | |
409 | 409 | // serialize array values |
410 | 410 | foreach ( array( 'field_options', 'options' ) as $opt ) { |
411 | - if ( isset( $values[ $opt ] ) && is_array( $values[ $opt ] ) ) { |
|
412 | - $values[ $opt ] = FrmAppHelper::maybe_filter_array( $values[ $opt ], array( 'custom_html' ) ); |
|
413 | - $values[ $opt ] = serialize( $values[ $opt ] ); |
|
411 | + if ( isset( $values[$opt] ) && is_array( $values[$opt] ) ) { |
|
412 | + $values[$opt] = FrmAppHelper::maybe_filter_array( $values[$opt], array( 'custom_html' ) ); |
|
413 | + $values[$opt] = serialize( $values[$opt] ); |
|
414 | 414 | } |
415 | 415 | } |
416 | 416 | if ( isset( $values['default_value'] ) && is_array( $values['default_value'] ) ) { |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | 'id' => $id, |
563 | 563 | 'field_key' => $id, |
564 | 564 | ); |
565 | - $type = FrmDb::get_var( 'frm_fields', $where, $col ); |
|
565 | + $type = FrmDb::get_var( 'frm_fields', $where, $col ); |
|
566 | 566 | } |
567 | 567 | |
568 | 568 | return $type; |
@@ -588,7 +588,7 @@ discard block |
||
588 | 588 | continue; |
589 | 589 | } |
590 | 590 | |
591 | - $fields[ $result->id ] = $result; |
|
591 | + $fields[$result->id] = $result; |
|
592 | 592 | $count ++; |
593 | 593 | if ( $limit == 1 ) { |
594 | 594 | $fields = $result; |
@@ -634,7 +634,7 @@ discard block |
||
634 | 634 | $count = 0; |
635 | 635 | foreach ( $results as $result ) { |
636 | 636 | $count ++; |
637 | - $fields[ $result->id ] = $result; |
|
637 | + $fields[$result->id] = $result; |
|
638 | 638 | if ( ! empty( $limit ) && $count >= $limit ) { |
639 | 639 | break; |
640 | 640 | } |
@@ -703,7 +703,7 @@ discard block |
||
703 | 703 | } |
704 | 704 | |
705 | 705 | if ( ! empty( $sub_fields ) ) { |
706 | - $index = $k + $index_offset; |
|
706 | + $index = $k + $index_offset; |
|
707 | 707 | $index_offset += count( $sub_fields ); |
708 | 708 | array_splice( $results, $index, 0, $sub_fields ); |
709 | 709 | } |
@@ -748,7 +748,7 @@ discard block |
||
748 | 748 | $query_type = ( $limit == ' LIMIT 1' || $limit == 1 ) ? 'row' : 'results'; |
749 | 749 | |
750 | 750 | if ( is_array( $where ) ) { |
751 | - $args = array( |
|
751 | + $args = array( |
|
752 | 752 | 'order_by' => $order_by, |
753 | 753 | 'limit' => $limit, |
754 | 754 | ); |
@@ -779,9 +779,9 @@ discard block |
||
779 | 779 | FrmDb::set_cache( $result->field_key, $result, 'frm_field' ); |
780 | 780 | |
781 | 781 | self::prepare_options( $result ); |
782 | - $results[ $r_key ]->field_options = $result->field_options; |
|
783 | - $results[ $r_key ]->options = $result->options; |
|
784 | - $results[ $r_key ]->default_value = $result->default_value; |
|
782 | + $results[$r_key]->field_options = $result->field_options; |
|
783 | + $results[$r_key]->options = $result->options; |
|
784 | + $results[$r_key]->default_value = $result->default_value; |
|
785 | 785 | |
786 | 786 | unset( $r_key, $result ); |
787 | 787 | } |
@@ -983,23 +983,23 @@ discard block |
||
983 | 983 | } |
984 | 984 | |
985 | 985 | public static function is_option_true_in_array( $field, $option ) { |
986 | - return isset( $field[ $option ] ) && $field[ $option ]; |
|
986 | + return isset( $field[$option] ) && $field[$option]; |
|
987 | 987 | } |
988 | 988 | |
989 | 989 | public static function is_option_true_in_object( $field, $option ) { |
990 | - return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ]; |
|
990 | + return isset( $field->field_options[$option] ) && $field->field_options[$option]; |
|
991 | 991 | } |
992 | 992 | |
993 | 993 | public static function is_option_empty_in_array( $field, $option ) { |
994 | - return ! isset( $field[ $option ] ) || empty( $field[ $option ] ); |
|
994 | + return ! isset( $field[$option] ) || empty( $field[$option] ); |
|
995 | 995 | } |
996 | 996 | |
997 | 997 | public static function is_option_empty_in_object( $field, $option ) { |
998 | - return ! isset( $field->field_options[ $option ] ) || empty( $field->field_options[ $option ] ); |
|
998 | + return ! isset( $field->field_options[$option] ) || empty( $field->field_options[$option] ); |
|
999 | 999 | } |
1000 | 1000 | |
1001 | 1001 | public static function is_option_value_in_object( $field, $option ) { |
1002 | - return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ] != ''; |
|
1002 | + return isset( $field->field_options[$option] ) && $field->field_options[$option] != ''; |
|
1003 | 1003 | } |
1004 | 1004 | |
1005 | 1005 | /** |
@@ -1017,10 +1017,10 @@ discard block |
||
1017 | 1017 | |
1018 | 1018 | public static function get_option_in_array( $field, $option ) { |
1019 | 1019 | |
1020 | - if ( isset( $field[ $option ] ) ) { |
|
1021 | - $this_option = $field[ $option ]; |
|
1022 | - } elseif ( isset( $field['field_options'] ) && is_array( $field['field_options'] ) && isset( $field['field_options'][ $option ] ) ) { |
|
1023 | - $this_option = $field['field_options'][ $option ]; |
|
1020 | + if ( isset( $field[$option] ) ) { |
|
1021 | + $this_option = $field[$option]; |
|
1022 | + } elseif ( isset( $field['field_options'] ) && is_array( $field['field_options'] ) && isset( $field['field_options'][$option] ) ) { |
|
1023 | + $this_option = $field['field_options'][$option]; |
|
1024 | 1024 | } else { |
1025 | 1025 | $this_option = ''; |
1026 | 1026 | } |
@@ -1029,7 +1029,7 @@ discard block |
||
1029 | 1029 | } |
1030 | 1030 | |
1031 | 1031 | public static function get_option_in_object( $field, $option ) { |
1032 | - return isset( $field->field_options[ $option ] ) ? $field->field_options[ $option ] : ''; |
|
1032 | + return isset( $field->field_options[$option] ) ? $field->field_options[$option] : ''; |
|
1033 | 1033 | } |
1034 | 1034 | |
1035 | 1035 | /** |