@@ -353,6 +353,7 @@ discard block |
||
353 | 353 | * @param string|array $where |
354 | 354 | * @param string $order_by |
355 | 355 | * @param string $limit |
356 | + * @param boolean $unique |
|
356 | 357 | */ |
357 | 358 | private static function get_ids_query( $where, $order_by, $limit, $unique, $args, array &$query ) { |
358 | 359 | global $wpdb; |
@@ -423,6 +424,9 @@ discard block |
||
423 | 424 | $query[] = FrmDb::prepend_and_or_where( ' WHERE ', $where ) . $order_by . $limit; |
424 | 425 | } |
425 | 426 | |
427 | + /** |
|
428 | + * @param string $field_id |
|
429 | + */ |
|
426 | 430 | public static function search_entry_metas( $search, $field_id, $operator ) { |
427 | 431 | $cache_key = 'search_' . FrmAppHelper::maybe_json_encode( $search ) . $field_id . $operator; |
428 | 432 | $results = wp_cache_get( $cache_key, 'frm_entry' ); |
@@ -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; |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | } |
415 | 415 | |
416 | 416 | $base_name = 'default_value_' . $field['id']; |
417 | - $html_id = isset( $field['html_id'] ) ? $field['html_id'] : self::get_html_id( $field ); |
|
417 | + $html_id = isset( $field['html_id'] ) ? $field['html_id'] : self::get_html_id( $field ); |
|
418 | 418 | |
419 | 419 | $default_type = self::get_default_value_type( $field ); |
420 | 420 | |
@@ -712,7 +712,7 @@ discard block |
||
712 | 712 | continue; |
713 | 713 | } |
714 | 714 | |
715 | - $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][ $short_key ] ); |
|
715 | + $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][$short_key] ); |
|
716 | 716 | $tag = FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key ); |
717 | 717 | |
718 | 718 | $atts['entry'] = $entry; |
@@ -721,7 +721,7 @@ discard block |
||
721 | 721 | |
722 | 722 | if ( $replace_with !== null ) { |
723 | 723 | self::sanitize_embedded_shortcodes( compact( 'entry' ), $replace_with ); |
724 | - $content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content ); |
|
724 | + $content = str_replace( $shortcodes[0][$short_key], $replace_with, $content ); |
|
725 | 725 | } |
726 | 726 | |
727 | 727 | unset( $atts, $replace_with ); |
@@ -764,8 +764,8 @@ discard block |
||
764 | 764 | |
765 | 765 | $dynamic_default = array( 'admin_email', 'siteurl', 'frmurl', 'sitename', 'get' ); |
766 | 766 | |
767 | - if ( isset( $shortcode_values[ $atts['tag'] ] ) ) { |
|
768 | - $replace_with = $shortcode_values[ $atts['tag'] ]; |
|
767 | + if ( isset( $shortcode_values[$atts['tag']] ) ) { |
|
768 | + $replace_with = $shortcode_values[$atts['tag']]; |
|
769 | 769 | } elseif ( in_array( $atts['tag'], $dynamic_default ) ) { |
770 | 770 | $replace_with = self::dynamic_default_values( $atts['tag'], $atts ); |
771 | 771 | } elseif ( $clean_tag == 'user_agent' ) { |
@@ -976,8 +976,8 @@ discard block |
||
976 | 976 | self::field_types_for_input( $single_input, $field_selection, $field_types ); |
977 | 977 | } elseif ( in_array( $type, $multiple_input ) ) { |
978 | 978 | self::field_types_for_input( $multiple_input, $field_selection, $field_types ); |
979 | - } elseif ( isset( $field_selection[ $type ] ) ) { |
|
980 | - $field_types[ $type ] = $field_selection[ $type ]; |
|
979 | + } elseif ( isset( $field_selection[$type] ) ) { |
|
980 | + $field_types[$type] = $field_selection[$type]; |
|
981 | 981 | } |
982 | 982 | |
983 | 983 | $field_types = apply_filters( 'frm_switch_field_types', $field_types, compact( 'type' ) ); |
@@ -1010,7 +1010,7 @@ discard block |
||
1010 | 1010 | |
1011 | 1011 | private static function field_types_for_input( $inputs, $fields, &$field_types ) { |
1012 | 1012 | foreach ( $inputs as $input ) { |
1013 | - $field_types[ $input ] = $fields[ $input ]; |
|
1013 | + $field_types[$input] = $fields[$input]; |
|
1014 | 1014 | unset( $input ); |
1015 | 1015 | } |
1016 | 1016 | } |
@@ -1042,7 +1042,7 @@ discard block |
||
1042 | 1042 | 'parent' => false, |
1043 | 1043 | 'pointer' => false, |
1044 | 1044 | ); |
1045 | - $args = wp_parse_args( $args, $defaults ); |
|
1045 | + $args = wp_parse_args( $args, $defaults ); |
|
1046 | 1046 | |
1047 | 1047 | $opt_key = $args['opt_key']; |
1048 | 1048 | $field = $args['field']; |
@@ -1058,22 +1058,22 @@ discard block |
||
1058 | 1058 | |
1059 | 1059 | // Check posted vals before checking saved values |
1060 | 1060 | // For fields inside repeating sections - note, don't check if $pointer is true because it will often be zero |
1061 | - if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) { |
|
1061 | + if ( $parent && isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ) { |
|
1062 | 1062 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
1063 | - $other_val = isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ) : ''; |
|
1063 | + $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] ) ) : ''; |
|
1064 | 1064 | } else { |
1065 | - $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ); |
|
1065 | + $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ); |
|
1066 | 1066 | } |
1067 | 1067 | |
1068 | 1068 | return $other_val; |
1069 | 1069 | |
1070 | - } elseif ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) { |
|
1070 | + } elseif ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][$field['id']] ) ) { |
|
1071 | 1071 | // For normal fields |
1072 | 1072 | |
1073 | 1073 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
1074 | - $other_val = isset( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ) : ''; |
|
1074 | + $other_val = isset( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ) : ''; |
|
1075 | 1075 | } else { |
1076 | - $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][ $field['id'] ] ) ); |
|
1076 | + $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][$field['id']] ) ); |
|
1077 | 1077 | } |
1078 | 1078 | |
1079 | 1079 | return $other_val; |
@@ -1083,8 +1083,8 @@ discard block |
||
1083 | 1083 | if ( $field['type'] == 'checkbox' && is_array( $field['value'] ) ) { |
1084 | 1084 | // Check if there is an "other" val in saved value and make sure the |
1085 | 1085 | // "other" val is not equal to the Other checkbox option |
1086 | - if ( isset( $field['value'][ $opt_key ] ) && $field['options'][ $opt_key ] != $field['value'][ $opt_key ] ) { |
|
1087 | - $other_val = $field['value'][ $opt_key ]; |
|
1086 | + if ( isset( $field['value'][$opt_key] ) && $field['options'][$opt_key] != $field['value'][$opt_key] ) { |
|
1087 | + $other_val = $field['value'][$opt_key]; |
|
1088 | 1088 | } |
1089 | 1089 | } else { |
1090 | 1090 | /** |
@@ -1096,8 +1096,8 @@ discard block |
||
1096 | 1096 | // Multi-select dropdowns - key is not preserved |
1097 | 1097 | if ( is_array( $field['value'] ) ) { |
1098 | 1098 | $o_key = array_search( $temp_val, $field['value'] ); |
1099 | - if ( isset( $field['value'][ $o_key ] ) ) { |
|
1100 | - unset( $field['value'][ $o_key ], $o_key ); |
|
1099 | + if ( isset( $field['value'][$o_key] ) ) { |
|
1100 | + unset( $field['value'][$o_key], $o_key ); |
|
1101 | 1101 | } |
1102 | 1102 | } elseif ( $temp_val == $field['value'] ) { |
1103 | 1103 | // For radio and regular dropdowns |
@@ -1139,7 +1139,7 @@ discard block |
||
1139 | 1139 | return $other_args; |
1140 | 1140 | } |
1141 | 1141 | |
1142 | - $other_opt = true; |
|
1142 | + $other_opt = true; |
|
1143 | 1143 | |
1144 | 1144 | self::set_other_name( $args, $other_args ); |
1145 | 1145 | self::set_other_value( $args, $other_args ); |
@@ -1289,7 +1289,7 @@ discard block |
||
1289 | 1289 | if ( is_array( $val ) ) { |
1290 | 1290 | foreach ( $val as $k => $v ) { |
1291 | 1291 | if ( is_string( $v ) ) { |
1292 | - $val[ $k ] = str_replace( $replace, $replace_with, $v ); |
|
1292 | + $val[$k] = str_replace( $replace, $replace_with, $v ); |
|
1293 | 1293 | unset( $k, $v ); |
1294 | 1294 | } |
1295 | 1295 | } |
@@ -1628,19 +1628,19 @@ discard block |
||
1628 | 1628 | } |
1629 | 1629 | |
1630 | 1630 | public static function get_bulk_prefilled_opts( array &$prepop ) { |
1631 | - $prepop[ __( 'Countries', 'formidable' ) ] = self::get_countries(); |
|
1631 | + $prepop[__( 'Countries', 'formidable' )] = self::get_countries(); |
|
1632 | 1632 | |
1633 | 1633 | $states = self::get_us_states(); |
1634 | 1634 | $state_abv = array_keys( $states ); |
1635 | 1635 | sort( $state_abv ); |
1636 | - $prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv; |
|
1636 | + $prepop[__( 'U.S. State Abbreviations', 'formidable' )] = $state_abv; |
|
1637 | 1637 | |
1638 | 1638 | $states = array_values( $states ); |
1639 | 1639 | sort( $states ); |
1640 | - $prepop[ __( 'U.S. States', 'formidable' ) ] = $states; |
|
1640 | + $prepop[__( 'U.S. States', 'formidable' )] = $states; |
|
1641 | 1641 | unset( $state_abv, $states ); |
1642 | 1642 | |
1643 | - $prepop[ __( 'Age', 'formidable' ) ] = array( |
|
1643 | + $prepop[__( 'Age', 'formidable' )] = array( |
|
1644 | 1644 | __( 'Under 18', 'formidable' ), |
1645 | 1645 | __( '18-24', 'formidable' ), |
1646 | 1646 | __( '25-34', 'formidable' ), |
@@ -1651,7 +1651,7 @@ discard block |
||
1651 | 1651 | __( 'Prefer Not to Answer', 'formidable' ), |
1652 | 1652 | ); |
1653 | 1653 | |
1654 | - $prepop[ __( 'Satisfaction', 'formidable' ) ] = array( |
|
1654 | + $prepop[__( 'Satisfaction', 'formidable' )] = array( |
|
1655 | 1655 | __( 'Very Satisfied', 'formidable' ), |
1656 | 1656 | __( 'Satisfied', 'formidable' ), |
1657 | 1657 | __( 'Neutral', 'formidable' ), |
@@ -1660,7 +1660,7 @@ discard block |
||
1660 | 1660 | __( 'N/A', 'formidable' ), |
1661 | 1661 | ); |
1662 | 1662 | |
1663 | - $prepop[ __( 'Importance', 'formidable' ) ] = array( |
|
1663 | + $prepop[__( 'Importance', 'formidable' )] = array( |
|
1664 | 1664 | __( 'Very Important', 'formidable' ), |
1665 | 1665 | __( 'Important', 'formidable' ), |
1666 | 1666 | __( 'Neutral', 'formidable' ), |
@@ -1669,7 +1669,7 @@ discard block |
||
1669 | 1669 | __( 'N/A', 'formidable' ), |
1670 | 1670 | ); |
1671 | 1671 | |
1672 | - $prepop[ __( 'Agreement', 'formidable' ) ] = array( |
|
1672 | + $prepop[__( 'Agreement', 'formidable' )] = array( |
|
1673 | 1673 | __( 'Strongly Agree', 'formidable' ), |
1674 | 1674 | __( 'Agree', 'formidable' ), |
1675 | 1675 | __( 'Neutral', 'formidable' ), |
@@ -562,6 +562,7 @@ discard block |
||
562 | 562 | * Also called during database migration in FrmMigrate. |
563 | 563 | * |
564 | 564 | * @since 4.0 |
565 | + * @param string $type |
|
565 | 566 | * @return array |
566 | 567 | */ |
567 | 568 | public static function migrate_field_placeholder( $field, $type ) { |
@@ -1217,6 +1218,7 @@ discard block |
||
1217 | 1218 | * The line endings may prevent html from being equal when it should |
1218 | 1219 | * |
1219 | 1220 | * @since 3.06 |
1221 | + * @param string $html_name |
|
1220 | 1222 | */ |
1221 | 1223 | private static function remove_default_html( $html_name, $defaults, &$options ) { |
1222 | 1224 | if ( ! isset( $options[ $html_name ] ) || ! isset( $defaults[ $html_name ] ) ) { |
@@ -1290,6 +1292,7 @@ discard block |
||
1290 | 1292 | * Migrate post settings to form action |
1291 | 1293 | * |
1292 | 1294 | * @param string $post_type |
1295 | + * @param boolean $switch |
|
1293 | 1296 | */ |
1294 | 1297 | private static function migrate_post_settings_to_action( $form_options, $form_id, $post_type, &$imported, $switch ) { |
1295 | 1298 | if ( ! isset( $form_options['create_post'] ) || ! $form_options['create_post'] ) { |
@@ -1368,8 +1371,8 @@ discard block |
||
1368 | 1371 | * @since 2.0 |
1369 | 1372 | * |
1370 | 1373 | * @param array $post_content - check for old field IDs |
1371 | - * @param array $basic_fields - fields with string or int saved |
|
1372 | - * @param array $array_fields - fields with arrays saved |
|
1374 | + * @param string[] $basic_fields - fields with string or int saved |
|
1375 | + * @param string[] $array_fields - fields with arrays saved |
|
1373 | 1376 | * |
1374 | 1377 | * @return string $post_content - new field IDs |
1375 | 1378 | */ |
@@ -1404,6 +1407,10 @@ discard block |
||
1404 | 1407 | return $post_content; |
1405 | 1408 | } |
1406 | 1409 | |
1410 | + /** |
|
1411 | + * @param string $post_type |
|
1412 | + * @param boolean $switch |
|
1413 | + */ |
|
1407 | 1414 | private static function migrate_email_settings_to_action( $form_options, $form_id, $post_type, &$imported, $switch ) { |
1408 | 1415 | // No old notifications or autoresponders to carry over |
1409 | 1416 | if ( ! isset( $form_options['auto_responder'] ) && ! isset( $form_options['notification'] ) && ! isset( $form_options['email_to'] ) ) { |
@@ -1671,8 +1678,8 @@ discard block |
||
1671 | 1678 | /** |
1672 | 1679 | * PHP 8 backward compatibility for the libxml_disable_entity_loader function |
1673 | 1680 | * |
1674 | - * @param boolean $disable |
|
1675 | 1681 | * |
1682 | + * @param boolean $loader |
|
1676 | 1683 | * @return boolean |
1677 | 1684 | */ |
1678 | 1685 | public static function maybe_libxml_disable_entity_loader( $loader ) { |