- sidebar-nav: 工单中心 icon ticket-color -> comment-color - 删除 assets/icons/sprite/ticket-color.svg 并重建 svg-icon.js - 同步更新相关契约测试 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
101 lines
3.3 KiB
PHP
101 lines
3.3 KiB
PHP
<?php
|
|
/**
|
|
* User center sidebar: services and account settings.
|
|
*
|
|
* Icon set mirrors the reference theme user-center sidebar: every entry renders
|
|
* an inline SVG from the theme sprite through aksrt_icon_markup().
|
|
*
|
|
* @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') : '';
|
|
$orders_available = isset($dashboard_tabs['orders']);
|
|
$orders_url = $orders_available ? (string) ($orders_url ?? '') : '';
|
|
$tickets_available = isset($dashboard_tabs['tickets']);
|
|
$tickets_url = $tickets_available ? aksrt_get_user_center_tab_url('tickets') : '';
|
|
|
|
// 参考主题由 zibpay 把「我的订单」前插到按钮组最前,其后才是等级 / 认证。
|
|
$services = array_values(array_filter([
|
|
[
|
|
'label' => __('我的订单', 'aksrt'),
|
|
'icon' => 'order-color',
|
|
'url' => $orders_url,
|
|
'tab' => 'orders',
|
|
],
|
|
[
|
|
'label' => __('我的等级', 'aksrt'),
|
|
'icon' => 'trend-color',
|
|
'url' => $level_url,
|
|
'tab' => 'level',
|
|
],
|
|
[
|
|
'label' => __('官方认证', 'aksrt'),
|
|
'icon' => 'user-auth',
|
|
'url' => $auth_url,
|
|
'tab' => 'auth',
|
|
],
|
|
[
|
|
'label' => __('工单中心', 'aksrt'),
|
|
'icon' => 'comment-color',
|
|
'url' => $tickets_url,
|
|
'tab' => 'tickets',
|
|
],
|
|
], static fn(array $item): bool => (string) $item['url'] !== ''));
|
|
|
|
$settings = array_values(array_filter([
|
|
[
|
|
'label' => __('消息通知', 'aksrt'),
|
|
'icon' => 'msg-color',
|
|
'url' => isset($dashboard_tabs['msg']) ? aksrt_get_user_center_tab_url('msg') : '',
|
|
'tab' => 'msg',
|
|
],
|
|
[
|
|
'label' => __('个人资料', 'aksrt'),
|
|
'icon' => 'user-color',
|
|
'url' => isset($dashboard_tabs['profile']) ? aksrt_get_user_center_tab_url('profile') : '',
|
|
'tab' => 'profile',
|
|
],
|
|
[
|
|
'label' => __('账户安全', 'aksrt'),
|
|
'icon' => 'security-color',
|
|
'url' => isset($dashboard_tabs['settings']) ? aksrt_get_user_center_tab_url('settings') : '',
|
|
'tab' => 'settings',
|
|
],
|
|
], static fn(array $item): bool => (string) $item['url'] !== ''));
|
|
|
|
$render_grid = static function (array $items): void {
|
|
?>
|
|
<div class="flex ac hh text-center icon-but-box user-icon-but-box">
|
|
<?php foreach ($items as $item) :
|
|
$tab = (string) ($item['tab'] ?? '');
|
|
$item_class = 'icon-but-' . ($tab !== '' ? $tab : 'item');
|
|
$icon_html = aksrt_icon_markup('zibsvg-' . (string) $item['icon']);
|
|
?>
|
|
<a class="<?php echo esc_attr($item_class); ?>" href="<?php echo esc_url((string) $item['url']); ?>"<?php if ($tab !== '') : ?> data-tab="<?php echo esc_attr($tab); ?>"<?php endif; ?>>
|
|
<div class="em16"><?php echo $icon_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></div>
|
|
<div class="px12 muted-color mt3"><?php echo esc_html((string) $item['label']); ?></div>
|
|
</a>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php
|
|
};
|
|
?>
|
|
<?php if ($services) : ?>
|
|
<div class="uc-sidebar-iconbox zib-widget padding-6 mb10-sm">
|
|
<div class="padding-6 ml3"><?php esc_html_e('我的服务', 'aksrt'); ?></div>
|
|
<?php $render_grid($services); ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php if ($settings) : ?>
|
|
<div class="uc-sidebar-iconbox zib-widget padding-6">
|
|
<div class="padding-6 ml3"><?php esc_html_e('功能设置', 'aksrt'); ?></div>
|
|
<?php $render_grid($settings); ?>
|
|
</div>
|
|
<?php endif; ?>
|