| @@ -1,5 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | +// Exit if accessed directly | |
| 3 | +if ( ! defined( 'ABSPATH' ) ) exit; | |
| 4 | + | |
| 2 | 5 | /* handle field output */ |
| 3 | 6 | function wppb_input_handler( $output, $form_location, $field, $user_id, $field_check_errors, $request_data ){ |
| 4 | 7 | if ( $field['field'] == 'Input' ){ |
| 5 | 8 | $item_title = apply_filters( 'wppb_'.$form_location.'_input_custom_field_'.$field['id'].'_item_title', wppb_icl_t( 'plugin profile-builder-pro', 'custom_field_'.$field['id'].'_title_translation', $field['field-title'], true ) ); |
| @@ -13,8 +16,12 @@ | ||
| 13 | 16 | $input_value = ( isset( $field['default-value'] ) ? trim( $field['default-value'] ) : '' ); |
| 14 | 17 | |
| 15 | 18 | $input_value = ( isset( $request_data[wppb_handle_meta_name( $field['meta-name'] )] ) ? trim( stripslashes( $request_data[wppb_handle_meta_name( $field['meta-name'] )] ) ) : $input_value ); |
| 16 | 19 | |
| 20 | + //Add WPML support | |
| 21 | + $input_value = wppb_icl_t( 'plugin profile-builder-pro', 'custom_field_input_'.$field['id'].'_default_value_translation', $input_value, true ); | |
| 22 | + $input_value = apply_filters( 'wppb_form_input_field_value', $input_value, $field, $form_location ); | |
| 23 | + | |
| 17 | 24 | if ( $form_location != 'back_end' ){ |
| 18 | 25 | $error_mark = ( ( $field['required'] == 'Yes' ) ? '<span class="wppb-required" title="'.wppb_required_field_error($field["field-title"]).'">*</span>' : '' ); |
| 19 | 26 | |
| 20 | 27 | if ( array_key_exists( $field['id'], $field_check_errors ) ) |
| @@ -49,9 +56,9 @@ | ||
| 49 | 56 | /* handle field save */ |
| 50 | 57 | function wppb_save_input_value( $field, $user_id, $request_data, $form_location ){ |
| 51 | 58 | if( $field['field'] == 'Input' ){ |
| 52 | 59 | if ( isset( $request_data[wppb_handle_meta_name( $field['meta-name'] )] ) ) |
| 53 | - update_user_meta( $user_id, $field['meta-name'], $request_data[wppb_handle_meta_name( $field['meta-name'] )] ); | |
| 60 | + update_user_meta( $user_id, $field['meta-name'], sanitize_text_field( $request_data[wppb_handle_meta_name( $field['meta-name'] )] ) ); | |
| 54 | 61 | } |
| 55 | 62 | } |
| 56 | 63 | add_action( 'wppb_save_form_field', 'wppb_save_input_value', 10, 4 ); |
| 57 | 64 | add_action( 'wppb_backend_save_form_field', 'wppb_save_input_value', 10, 4 ); |