From b385559a0f5a616397438ec33963506eab9c6a92 Mon Sep 17 00:00:00 2001 From: nikitasinelnikov Date: Wed, 17 Jul 2019 17:03:52 +0300 Subject: [PATCH] - code review; --- includes/core/um-filters-account.php | 5 ++++- includes/um-short-functions.php | 8 -------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/includes/core/um-filters-account.php b/includes/core/um-filters-account.php index cf3c5fff..064ab8f6 100644 --- a/includes/core/um-filters-account.php +++ b/includes/core/um-filters-account.php @@ -72,7 +72,10 @@ add_filter( "um_get_field__last_name","um_account_disable_name_fields", 10 ,1 ); function um_account_sanitize_data( $data ) { foreach ( $data as $key => $value ) { if ( is_array( $value ) ) { - $data[ $key ] = array_filter($value, 'um_strip_tags_array'); + $data[ $key ] = array_filter( $value, function( $var ) { + $var = trim( esc_html( strip_tags( $var ) ) ); + return $var; + }); } else { $data[ $key ] = trim( esc_html( strip_tags( $value ) ) ); } diff --git a/includes/um-short-functions.php b/includes/um-short-functions.php index 1669a83b..8779538d 100644 --- a/includes/um-short-functions.php +++ b/includes/um-short-functions.php @@ -2712,12 +2712,4 @@ if ( ! function_exists( 'um_is_profile_owner' ) ) { return ( $user_id == um_profile_id() ); } -} - -/** - * Strip tags if array - */ -function um_strip_tags_array( $var ) { - $var = trim( esc_html( strip_tags( $var ) ) ); - return $var; } \ No newline at end of file