| @@ -422,9 +422,9 @@ | ||
| 422 | 422 | $new_id = self::create( $values ); |
| 423 | 423 | $frm_duplicate_ids[ $field->id ] = $new_id; |
| 424 | 424 | $frm_duplicate_ids[ $field->field_key ] = $new_id; |
| 425 | 425 | unset( $field ); |
| 426 | - } | |
| 426 | + }//end foreach | |
| 427 | 427 | } |
| 428 | 428 | |
| 429 | 429 | public static function update( $id, $values ) { |
| 430 | 430 | global $wpdb; |
| @@ -442,8 +442,14 @@ | ||
| 442 | 442 | |
| 443 | 443 | self::preserve_format_option_backslashes( $values ); |
| 444 | 444 | |
| 445 | 445 | if ( isset( $values['type'] ) ) { |
| 446 | + if ( 'dropdown' === $values['type'] ) { | |
| 447 | + // To avoid conflicts with security plugins the value "dropdown" is sent for select fields. | |
| 448 | + // This is because "select" gets matched for SQL injection attempts. | |
| 449 | + $values['type'] = 'select'; | |
| 450 | + } | |
| 451 | + | |
| 446 | 452 | $values = apply_filters( 'frm_clean_' . $values['type'] . '_field_options_before_update', $values ); |
| 447 | 453 | |
| 448 | 454 | if ( $values['type'] === 'hidden' && isset( $values['field_options'] ) && isset( $values['field_options']['clear_on_focus'] ) ) { |
| 449 | 455 | // don't keep the old placeholder setting for hidden fields |
| @@ -492,9 +498,9 @@ | ||
| 492 | 498 | * Keep backslashes in the phone format option |
| 493 | 499 | * |
| 494 | 500 | * @since 2.0.8 |
| 495 | 501 | * |
| 496 | - * @param $values array - pass by reference | |
| 502 | + * @param array $values Pass by reference. | |
| 497 | 503 | */ |
| 498 | 504 | private static function preserve_format_option_backslashes( &$values ) { |
| 499 | 505 | if ( isset( $values['field_options']['format'] ) ) { |
| 500 | 506 | $values['field_options']['format'] = FrmAppHelper::preserve_backslashes( $values['field_options']['format'] ); |
| @@ -547,9 +553,9 @@ | ||
| 547 | 553 | } |
| 548 | 554 | |
| 549 | 555 | /** |
| 550 | 556 | * @param string|int $id The field id or key. |
| 551 | - * @param bool $filter When true, run the frm_field filter. | |
| 557 | + * @param bool $filter When true, run the frm_field filter. | |
| 552 | 558 | */ |
| 553 | 559 | public static function getOne( $id, $filter = false ) { |
| 554 | 560 | if ( empty( $id ) ) { |
| 555 | 561 | return null; |
| @@ -595,10 +601,10 @@ | ||
| 595 | 601 | |
| 596 | 602 | /** |
| 597 | 603 | * Get the field type by key or id |
| 598 | 604 | * |
| 599 | - * @param int|string The field id or key | |
| 600 | - * @param mixed $col The name of the column in the fields database table | |
| 605 | + * @param int|string $id The field id or key. | |
| 606 | + * @param mixed $col The name of the column in the fields database table. | |
| 601 | 607 | */ |
| 602 | 608 | public static function get_type( $id, $col = 'type' ) { |
| 603 | 609 | $field = FrmDb::check_cache( $id, 'frm_field' ); |
| 604 | 610 | if ( $field ) { |
| @@ -649,9 +655,9 @@ | ||
| 649 | 655 | unset( $result ); |
| 650 | 656 | } |
| 651 | 657 | |
| 652 | 658 | return wp_unslash( $fields ); |
| 653 | - } | |
| 659 | + }//end if | |
| 654 | 660 | |
| 655 | 661 | self::$use_cache = false; |
| 656 | 662 | |
| 657 | 663 | $where = array( |
| @@ -710,9 +716,9 @@ | ||
| 710 | 716 | /** |
| 711 | 717 | * If repeating fields should be included, adjust $where accordingly |
| 712 | 718 | * |
| 713 | 719 | * @param string $inc_repeat |
| 714 | - * @param array $where - pass by reference | |
| 720 | + * @param array $where Pass by reference. | |
| 715 | 721 | */ |
| 716 | 722 | private static function maybe_include_repeating_fields( $inc_repeat, &$where ) { |
| 717 | 723 | if ( $inc_repeat == 'include' ) { |
| 718 | 724 | $form_id = $where['fi.form_id']; |
| @@ -965,9 +971,10 @@ | ||
| 965 | 971 | $field_type = self::get_field_type( $field ); |
| 966 | 972 | $original_type = self::get_option( $field, 'original_type' ); |
| 967 | 973 | |
| 968 | 974 | if ( ! empty( $original_type ) && $original_type != $field_type ) { |
| 969 | - $field_type = $original_type; // check the original type for arrays | |
| 975 | + // Check the original type for arrays. | |
| 976 | + $field_type = $original_type; | |
| 970 | 977 | } |
| 971 | 978 | |
| 972 | 979 | return $field_type; |
| 973 | 980 | } |
| @@ -1149,9 +1156,9 @@ | ||
| 1149 | 1156 | * |
| 1150 | 1157 | * @since 3.0 |
| 1151 | 1158 | * |
| 1152 | 1159 | * @param array|object $field |
| 1153 | - * @param string $is_type Options include radio, checkbox, text | |
| 1160 | + * @param string $is_type Options include radio, checkbox, text. | |
| 1154 | 1161 | * |
| 1155 | 1162 | * @return boolean true if field type is checkbox or Dynamic checkbox |
| 1156 | 1163 | */ |
| 1157 | 1164 | public static function is_field_type( $field, $is_type ) { |