custer : changed namespace, now all function use it

This commit is contained in:
asus
2024-03-17 14:06:25 +01:00
parent fc41f7d36b
commit 70d8998a3f
6 changed files with 38 additions and 33 deletions

View File

@@ -10,13 +10,40 @@ if (!defined('ABSPATH')) {
/*
* return the result
*
*/
function return_result($output) {
if (is_array($output) && count($output) === 0)
$output = '';
if (!is_string($output))
$output = json_encode($output, JSON_UNESCAPED_SLASHES);
return esc_html($output);
}
/*
* format the output
* if is acf, use acf default format
*/
function format_user_info($query, &$current_user, $user_id) {
$output_date_format = Custer::USER_INFO_DATE_FORMAT;
$is_acf = false;
/*
* if is special query __author_page__
* return author page url
*
*/
if ($query === '__author_page__') {
$output = get_author_posts_url($user_id);
return \CUSTER\return_result($output);
}
/*
* check if it's an acf field, and a date
* second method : check what get_field_object() returns
@@ -67,21 +94,9 @@ function format_user_info($query, &$current_user, $user_id) {
}
}
/*
* return the result
*
*/
if (is_array($output) && count($output) === 0)
$output = '';
if (!is_string($output))
$output = json_encode($output, JSON_UNESCAPED_SLASHES);
return esc_html($output);
return \CUSTER\return_result($output);
}
?>