custer : changed namespace, now all function use it
This commit is contained in:
@@ -21,14 +21,14 @@ function extract_if_array_size_one($value) {
|
||||
function merge_two_arrays($array1, $array2) {
|
||||
$new_array = $array1;
|
||||
foreach ($array2 as $key2 => $value2) {
|
||||
$value = extract_if_array_size_one($value2);
|
||||
$value = \CUSTER\extract_if_array_size_one($value2);
|
||||
// if key was not in first array, add the new element to it
|
||||
if (!isset($new_array[$key2])) {
|
||||
$new_array[$key2] = $value2;
|
||||
continue;
|
||||
}
|
||||
// if key was in first array, add both in an array
|
||||
$value1 = extract_if_array_size_one($new_array[$key2]);
|
||||
$value1 = \CUSTER\extract_if_array_size_one($new_array[$key2]);
|
||||
if (empty($value1))
|
||||
$new_array[$key2] = $value2;
|
||||
else if (empty($value2))
|
||||
@@ -47,7 +47,7 @@ function output_list_front($array, $current_user, $user_id) {
|
||||
foreach ($array as $key => $value) {
|
||||
if (str_starts_with($key, '_'))
|
||||
continue ;
|
||||
$value = format_user_info($key, $current_user, $user_id);
|
||||
$value = \CUSTER\format_user_info($key, $current_user, $user_id);
|
||||
$output .= '<li>';
|
||||
$output .= '<span>';
|
||||
$output .= $key;
|
||||
@@ -158,8 +158,8 @@ function current_user_infos($atts) {
|
||||
if ($output_all) {
|
||||
$user_properties = (array) get_userdata($user_id)->data;
|
||||
$user_metas = get_user_meta($user_id);
|
||||
$user_infos = merge_two_arrays($user_metas, $user_properties);
|
||||
return output_list_front($user_infos, $current_user, $user_id);
|
||||
$user_infos = \CUSTER\merge_two_arrays($user_metas, $user_properties);
|
||||
return \CUSTER\output_list_front($user_infos, $current_user, $user_id);
|
||||
}
|
||||
|
||||
|
||||
@@ -174,7 +174,7 @@ function current_user_infos($atts) {
|
||||
$query = $atts;
|
||||
else
|
||||
return '';
|
||||
return format_user_info($query, $current_user, $user_id);
|
||||
return \CUSTER\format_user_info($query, $current_user, $user_id);
|
||||
}
|
||||
add_shortcode('custer_user_info', __NAMESPACE__.'\current_user_infos');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user