';
- if (isset( $data['allowclear'] ) && $data['allowclear'] == 0) {
+ if ( isset( $data['allowclear'] ) && $data['allowclear'] == 0 ) {
$class = 'um-s2';
} else {
$class = 'um-s1';
}
- if (isset( $data['label'] )) {
+ if ( isset( $data['label'] ) ) {
$output .= $this->field_label( $label, $key, $data );
}
$output .= '
';
- if (isset( $icon ) && $icon && isset( $this->field_icons ) && $this->field_icons == 'field') {
+ if ( isset( $icon ) && $icon && isset( $this->field_icons ) && $this->field_icons == 'field' ) {
$output .= '
';
}
@@ -2466,7 +2469,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
$atts_ajax = '';
$select_original_option_value = '';
- if (isset( $data['parent_dropdown_relationship'] ) && !empty( $data['parent_dropdown_relationship'] ) && !UM()->user()->preview) {
+ if ( ! empty( $data['parent_dropdown_relationship'] ) && ! UM()->user()->preview ) {
$disabled_by_parent_option = 'disabled = disabled';
@@ -2496,20 +2499,19 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
$parent_dropdown_relationship = apply_filters( "um_custom_dropdown_options_parent__{$form_key}", $data['parent_dropdown_relationship'], $data );
$atts_ajax .= " data-um-parent='{$parent_dropdown_relationship}' ";
- if (isset( $data['custom_dropdown_options_source'] ) && !empty( $data['custom_dropdown_options_source'] ) &&
- $has_parent_option && function_exists( $data['custom_dropdown_options_source'] ) &&
+ if ( ! empty( $data['custom_dropdown_options_source'] ) && $has_parent_option && function_exists( $data['custom_dropdown_options_source'] ) &&
um_user( $data['parent_dropdown_relationship'] )
) {
$options = call_user_func( $data['custom_dropdown_options_source'], $data['parent_dropdown_relationship'] );
$disabled_by_parent_option = '';
- if (um_user( $form_key )) {
+ if ( um_user( $form_key ) ) {
$select_original_option_value = " data-um-original-value='" . um_user( $form_key ) . "' ";
}
}
}
- if (!empty( $data['custom_dropdown_options_source'] )) {
+ if ( ! empty( $data['custom_dropdown_options_source'] ) ) {
/**
* UM hook
@@ -2589,12 +2591,12 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
*/
$enable_options_pair = apply_filters( "um_fields_options_enable_pairs__{$key}", false );
- if( ! $has_parent_option ) {
- if ( isset($options) && $options == 'builtin'){
+ if ( ! $has_parent_option ) {
+ if ( isset( $options ) && $options == 'builtin' ) {
$options = UM()->builtin()->get ( $filter );
}
- if ( ! isset( $options )) {
+ if ( ! isset( $options ) ) {
$options = UM()->builtin()->get( 'countries' );
}
@@ -2684,7 +2686,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
$um_field_checkbox_item_title = $v;
}
- if (isset( $options_pair )) {
+ if ( isset( $options_pair ) ) {
$option_value = $k;
$um_field_checkbox_item_title = $v;
}
diff --git a/includes/core/class-validation.php b/includes/core/class-validation.php
index e0c02298..cd49d001 100644
--- a/includes/core/class-validation.php
+++ b/includes/core/class-validation.php
@@ -73,16 +73,17 @@ if ( ! class_exists( 'um\core\Validation' ) ) {
}
//validation of correct values from options in wp-admin
+ $stripslashes = stripslashes( $value );
if ( in_array( $fields[ $key ]['type'], array( 'select' ) ) &&
- isset( $value ) && ! empty( $fields[ $key ]['options'] ) &&
- ! in_array( stripslashes( $value ), array_map( 'trim', $fields[ $key ]['options'] ) ) ) {
+ ! empty( $stripslashes ) && ! empty( $fields[ $key ]['options'] ) &&
+ ! in_array( $stripslashes, array_map( 'trim', $fields[ $key ]['options'] ) ) ) {
unset( $changes[ $key ] );
}
//validation of correct values from options in wp-admin
//the user cannot set invalid value in the hidden input at the page
if ( in_array( $fields[ $key ]['type'], array( 'multiselect', 'checkbox', 'radio' ) ) &&
- isset( $value ) && ! empty( $fields[ $key ]['options'] ) ) {
+ ! empty( $value ) && ! empty( $fields[ $key ]['options'] ) ) {
$value = array_map( 'stripslashes', array_map( 'trim', $value ) );
$changes[ $key ] = array_intersect( $value, array_map( 'trim', $fields[ $key ]['options'] ) );
}
diff --git a/includes/core/um-actions-profile.php b/includes/core/um-actions-profile.php
index aed46f0d..302e9e90 100644
--- a/includes/core/um-actions-profile.php
+++ b/includes/core/um-actions-profile.php
@@ -247,16 +247,17 @@ function um_user_edit_profile( $args ) {
}
//validation of correct values from options in wp-admin
+ $stripslashes = stripslashes( $args['submitted'][ $key ] );
if ( in_array( $array['type'], array( 'select' ) ) &&
- isset( $args['submitted'][ $key ] ) && ! empty( $array['options'] ) &&
- ! in_array( stripslashes( $args['submitted'][ $key ] ), array_map( 'trim', $array['options'] ) ) ) {
+ ! empty( $array['options'] ) && ! empty( $stripslashes ) &&
+ ! in_array( $stripslashes, array_map( 'trim', $array['options'] ) ) ) {
continue;
}
//validation of correct values from options in wp-admin
//the user cannot set invalid value in the hidden input at the page
if ( in_array( $array['type'], array( 'multiselect', 'checkbox', 'radio' ) ) &&
- isset( $args['submitted'][ $key ] ) && ! empty( $array['options'] ) ) {
+ ! empty( $args['submitted'][ $key ] ) && ! empty( $array['options'] ) ) {
$args['submitted'][ $key ] = array_map( 'stripslashes', array_map( 'trim', $args['submitted'][ $key ] ) );
$args['submitted'][ $key ] = array_intersect( $args['submitted'][ $key ], array_map( 'trim', $array['options'] ) );
}