39 lines
1009 B
PHP
39 lines
1009 B
PHP
<?php
|
|
/**
|
|
* Unified asset presentation helpers.
|
|
*
|
|
* @package AKSRT
|
|
*/
|
|
|
|
defined('ABSPATH') || exit;
|
|
|
|
if (!function_exists('aksrt_user_points')) {
|
|
function aksrt_user_points(int $user_id = 0): int {
|
|
$user_id = $user_id > 0 ? $user_id : get_current_user_id();
|
|
return $user_id > 0
|
|
? \AKSRT\Credits\MetaAssetService::get_instance()->balance_points($user_id)
|
|
: 0;
|
|
}
|
|
}
|
|
|
|
if (!function_exists('aksrt_user_balance_decimal')) {
|
|
function aksrt_user_balance_decimal(int $user_id = 0): string {
|
|
$user_id = $user_id > 0 ? $user_id : get_current_user_id();
|
|
return $user_id > 0
|
|
? \AKSRT\Credits\MetaAssetService::get_instance()->balance_decimal($user_id)
|
|
: '0.00';
|
|
}
|
|
}
|
|
|
|
if (!function_exists('aksrt_format_points')) {
|
|
function aksrt_format_points(int $points): string {
|
|
return number_format_i18n($points);
|
|
}
|
|
}
|
|
|
|
if (!function_exists('aksrt_asset_reason_label')) {
|
|
function aksrt_asset_reason_label(string $reason): string {
|
|
return \AKSRT\Ledger\LedgerPresentation::reason_label($reason);
|
|
}
|
|
}
|