mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-11 18:56:10 +09:00
- fixed stripslashes in tagline
This commit is contained in:
@@ -851,39 +851,39 @@ add_filter( 'um_profile_field_filter_hook__multiselect','um_profile_field__selec
|
||||
*/
|
||||
function um_profile_field_filter_xss_validation( $value, $data, $type = '' ) {
|
||||
if ( ! empty( $value ) && is_string( $value ) ) {
|
||||
$value = stripslashes( $value );
|
||||
$value = stripslashes( $value );
|
||||
$data['validate'] = isset( $data['validate'] ) ? $data['validate'] : '';
|
||||
|
||||
if ( 'text' == $type && ! in_array( $data['validate'], array( 'unique_email' ) ) || 'password' == $type ) {
|
||||
if ( 'text' === $type && ! in_array( $data['validate'], array( 'unique_email' ), true ) || 'password' === $type ) {
|
||||
$value = esc_attr( $value );
|
||||
} elseif ( $type == 'url' ) {
|
||||
} elseif ( 'url' === $type ) {
|
||||
$value = esc_url( $value );
|
||||
} elseif ( 'textarea' == $type ) {
|
||||
} elseif ( 'textarea' === $type ) {
|
||||
if ( empty( $data['html'] ) ) {
|
||||
$value = wp_kses_post( $value );
|
||||
}
|
||||
} elseif ( 'rating' == $type ) {
|
||||
} elseif ( 'rating' === $type ) {
|
||||
if ( ! is_numeric( $value ) ) {
|
||||
$value = 0;
|
||||
} else {
|
||||
if ( $data['number'] == 5 ) {
|
||||
if ( ! in_array( $value, range( 1, 5 ) ) ) {
|
||||
if ( 5 === absint( $data['number'] ) ) {
|
||||
if ( ! in_array( $value, range( 1, 5 ), true ) ) {
|
||||
$value = 0;
|
||||
}
|
||||
} elseif ( $data['number'] == 10 ) {
|
||||
if ( ! in_array( $value, range( 1, 10 ) ) ) {
|
||||
} elseif ( 10 === $data['number'] ) {
|
||||
if ( ! in_array( $value, range( 1, 10 ), true ) ) {
|
||||
$value = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif ( 'select' == $type || 'radio' == $type ) {
|
||||
} elseif ( 'select' === $type || 'radio' === $type ) {
|
||||
|
||||
/** This filter is documented in includes/core/class-fields.php */
|
||||
$option_pairs = apply_filters( 'um_select_options_pair', null, $data );
|
||||
|
||||
$array = empty( $data['options'] ) ? array() : $data['options'];
|
||||
|
||||
if ( $data['metakey'] == 'country' && empty( $array ) ) {
|
||||
if ( 'country' === $data['metakey'] && empty( $array ) ) {
|
||||
$array = UM()->builtin()->get( 'countries' );
|
||||
}
|
||||
|
||||
@@ -893,6 +893,8 @@ function um_profile_field_filter_xss_validation( $value, $data, $type = '' ) {
|
||||
$arr = $array;
|
||||
}
|
||||
|
||||
$arr = array_map( 'stripslashes', $arr );
|
||||
|
||||
if ( ! empty( $arr ) && ! in_array( $value, array_map( 'trim', $arr ) ) && empty( $data['custom_dropdown_options_source'] ) ) {
|
||||
$value = '';
|
||||
} else {
|
||||
@@ -902,7 +904,7 @@ function um_profile_field_filter_xss_validation( $value, $data, $type = '' ) {
|
||||
}
|
||||
}
|
||||
} elseif ( ! empty( $value ) && is_array( $value ) ) {
|
||||
if ( 'multiselect' == $type || 'checkbox' == $type ) {
|
||||
if ( 'multiselect' === $type || 'checkbox' === $type ) {
|
||||
|
||||
/** This filter is documented in includes/core/class-fields.php */
|
||||
$option_pairs = apply_filters( 'um_select_options_pair', null, $data );
|
||||
@@ -913,8 +915,8 @@ function um_profile_field_filter_xss_validation( $value, $data, $type = '' ) {
|
||||
}
|
||||
|
||||
if ( ! empty( $arr ) && empty( $data['custom_dropdown_options_source'] ) ) {
|
||||
$arr = wp_unslash( $arr );
|
||||
$arr = wp_slash( array_map( 'trim', $arr ) );
|
||||
$arr = wp_unslash( $arr );
|
||||
$arr = wp_slash( array_map( 'trim', $arr ) );
|
||||
$value = array_intersect( $value, $arr );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user