ID ) ) { return; } $profiles_raw = get_user_meta( (int) $user->ID, self::USER_META_SOCIAL_PROFILES, true ); $profiles = self::normalize_social_profiles( $profiles_raw ); $value = implode( "\n", $profiles ); ?>

*/ private static function normalize_social_profiles( $profiles ): array { $values = array(); if ( is_array( $profiles ) ) { foreach ( $profiles as $profile ) { if ( ! is_string( $profile ) ) { continue; } $values[] = $profile; } } elseif ( is_string( $profiles ) ) { $split = preg_split( '/[\r\n,]+/', $profiles ); $values = false !== $split ? $split : array(); } $normalized = array(); foreach ( $values as $value ) { $url = esc_url_raw( trim( (string) $value ) ); if ( '' === $url ) { continue; } if ( in_array( $url, $normalized, true ) ) { continue; } $normalized[] = $url; } return $normalized; } }