diff --git a/plugins/cipf_plugin/php/user_infos.php b/plugins/cipf_plugin/php/user_infos.php
index d5bb8ad..27496d3 100644
--- a/plugins/cipf_plugin/php/user_infos.php
+++ b/plugins/cipf_plugin/php/user_infos.php
@@ -39,20 +39,18 @@ function merge_two_arrays_CIPF($array1, $array2) {
}
-function output_list_front_CIPF($array) {
+function output_list_front_CIPF($array, $current_user, $user_id) {
PLGNTLS_class::debug_infos();
$output = '
';
foreach ($array as $key => $value) {
if (str_starts_with($key, '_'))
continue ;
+ $value = format_user_info_CIPF($key, $current_user, $user_id);
$output .= '- ';
$output .= '';
$output .= $key;
$output .= ' : ';
- if (is_array($value) && count($value) === 1)
- $output .= json_encode($value[0]);
- else
- $output .= json_encode($value);
+ $output .= $value;
$output .= '';
$output .= '
';
}
@@ -127,10 +125,13 @@ function format_user_info_CIPF($query, &$current_user, $user_id) {
* return the result
*
*/
- if (is_string($output))
- return $output;
- else
- return json_encode($output);
+ while (is_array($output) && count($output) === 1)
+ $output = reset($output);
+ if (is_array($output) && count($output) === 0)
+ $output = '';
+ if (!is_string($output))
+ $output = json_encode($output, JSON_UNESCAPED_SLASHES);
+ return esc_html($output);
}
@@ -217,7 +218,7 @@ function current_user_infos_CIPF($atts) {
$user_properties = (array) get_userdata($user_id)->data;
$user_metas = get_user_meta($user_id);
$user_infos = merge_two_arrays_CIPF($user_metas, $user_properties);
- return output_list_front_CIPF($user_infos);
+ return output_list_front_CIPF($user_infos, $current_user, $user_id);
}
/*
@@ -226,7 +227,7 @@ function current_user_infos_CIPF($atts) {
*
*/
if (is_array($atts))
- $query = reset($atts);
+ $query = $atts[0];
else if (is_string($atts))
$query = $atts;
else