Register a dedicated `promotion` dashboard panel gated by the existing invite switches (credits + invite reward + invite registration), and move the invite card out of the revenue tab so 收益中心 is pure earnings/withdrawal. - src/User/Center.php: register promotion panel; revenue no longer depends on invite being on - inc/helpers/user-center-renderers/profile-promotion.php: new panel body hosting the existing [data-aksrt-invite] card - profile-revenue.php: drop the invite section; aksrt-user-center.php: drop unused show_invite_section context, add promotion to built-in tabs + view map - repoint invite/promotion deep-link aliases from revenue to promotion across tab-url builder, tab resolver, runtime tabAliases, urls.php, and the revenue-JS enqueue gate - sidebar-nav.php: add 推广中心 service entry; shell.css: entry icon color; sidebar-creator.php: reword revenue card - UserRuntime.php: allow promotion in configurable tabs
99 lines
3.1 KiB
PHP
99 lines
3.1 KiB
PHP
<?php
|
|
/**
|
|
* User center sidebar: services and account settings.
|
|
*
|
|
* @package AKSRT
|
|
*/
|
|
|
|
defined('ABSPATH') || exit;
|
|
|
|
$level_url = isset($dashboard_tabs['level'])
|
|
? aksrt_get_user_center_tab_url('level')
|
|
: '';
|
|
$auth_url = isset($dashboard_tabs['auth']) ? aksrt_get_user_center_tab_url('auth') : '';
|
|
$promotion_url = isset($dashboard_tabs['promotion']) ? aksrt_get_user_center_tab_url('promotion') : '';
|
|
$orders_available = isset($dashboard_tabs['orders']);
|
|
$orders_url = $orders_available ? (string) ($orders_url ?? '') : '';
|
|
|
|
$services = array_values(array_filter([
|
|
[
|
|
'label' => __('我的等级', 'aksrt'),
|
|
'icon' => 'chart-line',
|
|
'tone' => 'level',
|
|
'url' => $level_url,
|
|
],
|
|
[
|
|
'label' => __('推广中心', 'aksrt'),
|
|
'icon' => 'bullhorn',
|
|
'tone' => 'promotion',
|
|
'url' => $promotion_url,
|
|
'tab' => 'promotion',
|
|
],
|
|
[
|
|
'label' => __('官方认证', 'aksrt'),
|
|
'icon' => 'id-badge',
|
|
'tone' => 'auth',
|
|
'url' => $auth_url,
|
|
'tab' => 'auth',
|
|
],
|
|
[
|
|
'label' => __('我的订单', 'aksrt'),
|
|
'icon' => 'receipt',
|
|
'tone' => 'orders',
|
|
'url' => $orders_url,
|
|
'tab' => 'orders',
|
|
],
|
|
], static fn(array $item): bool => (string) $item['url'] !== ''));
|
|
|
|
$settings = array_values(array_filter([
|
|
[
|
|
'label' => __('消息通知', 'aksrt'),
|
|
'icon' => 'bell',
|
|
'tone' => 'notice',
|
|
'url' => (string) ($messages_url ?? ''),
|
|
'count' => (int) ($notification_unread_count ?? 0),
|
|
],
|
|
[
|
|
'label' => __('个人资料', 'aksrt'),
|
|
'icon' => 'user-edit',
|
|
'tone' => 'profile',
|
|
'url' => isset($dashboard_tabs['profile']) ? aksrt_get_user_center_tab_url('profile') : '',
|
|
],
|
|
[
|
|
'label' => __('账户安全', 'aksrt'),
|
|
'icon' => 'shield-alt',
|
|
'tone' => 'security',
|
|
'url' => isset($dashboard_tabs['settings']) ? aksrt_get_user_center_tab_url('settings') : '',
|
|
],
|
|
], static fn(array $item): bool => (string) $item['url'] !== ''));
|
|
|
|
$render_grid = static function (array $items): void {
|
|
?>
|
|
<div class="uc-service-grid">
|
|
<?php foreach ($items as $item) : ?>
|
|
<a class="uc-service-grid__item uc-service-grid__item--<?php echo esc_attr((string) $item['tone']); ?><?php echo !empty($item['tab']) && ($active_tab ?? '') === $item['tab'] ? ' is-active' : ''; ?>" href="<?php echo esc_url((string) $item['url']); ?>"<?php if (!empty($item['tab'])) : ?> data-tab="<?php echo esc_attr((string) $item['tab']); ?>"<?php endif; ?>>
|
|
<span class="uc-service-grid__icon">
|
|
<i class="fas fa-<?php echo esc_attr((string) $item['icon']); ?>" aria-hidden="true"></i>
|
|
<?php if (!empty($item['count'])) : ?><small><?php echo esc_html((string) $item['count']); ?></small><?php endif; ?>
|
|
</span>
|
|
<span><?php echo esc_html((string) $item['label']); ?></span>
|
|
</a>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php
|
|
};
|
|
?>
|
|
<?php if ($services) : ?>
|
|
<div class="uc-sidebar__section">
|
|
<div class="uc-sidebar__heading"><span><?php esc_html_e('我的服务', 'aksrt'); ?></span></div>
|
|
<?php $render_grid($services); ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php if ($settings) : ?>
|
|
<div class="uc-sidebar__section">
|
|
<div class="uc-sidebar__heading"><span><?php esc_html_e('功能设置', 'aksrt'); ?></span></div>
|
|
<?php $render_grid($settings); ?>
|
|
</div>
|
|
<?php endif; ?>
|