用户中心减层:收敛本人入口与 panel 契约

This commit is contained in:
kate522 committed 2026-07-10 20:43:49 +08:00
1 parent 31c95c3bc6
commit dec33ea15a
33 files changed
+1585 -1488

No files matched your search

@@ -2,7 +2,7 @@
/**
* Profile Comment List Item — image-less comment row for user center.
*
* 通过 set_query_var() 接收:
* 通过 get_template_part() 的 $args 接收(保留 query var 兼容):
* - aksrt_profile_comment: WP_Comment 对象
*
* @package AKSRT
@@ -10,7 +10,7 @@
defined('ABSPATH') || exit;
$comment = get_query_var('aksrt_profile_comment');
$comment = $args['comment'] ?? get_query_var('aksrt_profile_comment');
if (!$comment instanceof WP_Comment) {
return;
}
@@ -5,7 +5,7 @@
* 用于:
* - 我的文章 / 我的收藏 / 公开主页文章列表
*
* 通过 set_query_var() 接收以下参数(可选):
* 通过 get_template_part() 的 $args 接收以下参数(保留 query var 兼容):
* - aksrt_profile_item_action: ['type'=>'edit'|'view'|'unfavorite', 'url'=>'...', 'label'=>'...']
* - aksrt_profile_item_status: 文章状态徽章文本(如 "草稿" / "私密")
*
@@ -14,7 +14,7 @@
defined('ABSPATH') || exit;
$action = get_query_var('aksrt_profile_item_action', []);
$action = isset($args['action']) ? $args['action'] : get_query_var('aksrt_profile_item_action', []);
if (!is_array($action)) {
$action = [];
}
@@ -22,7 +22,7 @@ $action_type = isset($action['type']) ? (string) $action['type'] : '';
$action_url = isset($action['url']) ? (string) $action['url'] : '';
$action_label = isset($action['label']) ? (string) $action['label'] : '';
$status_label = (string) get_query_var('aksrt_profile_item_status', '');
$status_label = isset($args['status']) ? (string) $args['status'] : (string) get_query_var('aksrt_profile_item_status', '');
$post_id = get_the_ID();
$permalink = get_permalink();
@@ -0,0 +1,5 @@
<?php
/** User center account modals. @package AKSRT */
defined('ABSPATH') || exit;
$context = is_array($args['context'] ?? null) ? $args['context'] : [];
echo $context['account_modals_html'] ?? ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
+5
View File
@@ -0,0 +1,5 @@
<?php
/** User center header. @package AKSRT */
defined('ABSPATH') || exit;
$context = is_array($args['context'] ?? null) ? $args['context'] : [];
echo $context['header_html'] ?? ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
@@ -0,0 +1,10 @@
<?php
/** User center mobile tabs. @package AKSRT */
defined('ABSPATH') || exit;
$context = is_array($args['context'] ?? null) ? $args['context'] : [];
?>
<div class="dashboard-tabs uc-mobile-tabs" role="tablist">
<?php foreach (($context['mobile_tabs'] ?? []) as $tab) : ?>
<a class="<?php echo !empty($tab['is_active']) ? 'is-active' : ''; ?>" href="<?php echo esc_url($tab['url']); ?>" data-tab="<?php echo esc_attr($tab['key']); ?>" role="tab" aria-selected="<?php echo !empty($tab['is_active']) ? 'true' : 'false'; ?>"><?php echo esc_html($tab['label']); ?></a>
<?php endforeach; ?>
</div>
@@ -0,0 +1,8 @@
<?php
/** User center comments panel. @package AKSRT */
defined('ABSPATH') || exit;
$panel = is_array($args['panel'] ?? null) ? $args['panel'] : [];
?>
<div id="panel-<?php echo esc_attr($panel['key'] ?? 'comments'); ?>" class="dashboard-panel<?php echo !empty($panel['is_active']) ? ' is-active' : ''; ?>" role="tabpanel"<?php echo empty($panel['is_active']) ? ' hidden' : ''; ?> data-panel-loaded="<?php echo !empty($panel['is_loaded']) ? 'true' : 'false'; ?>" data-tab-url="<?php echo esc_url($panel['url'] ?? ''); ?>">
<?php echo $panel['html'] ?? ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</div>
@@ -0,0 +1,8 @@
<?php
/** User center credits panel. @package AKSRT */
defined('ABSPATH') || exit;
$panel = is_array($args['panel'] ?? null) ? $args['panel'] : [];
?>
<div id="panel-<?php echo esc_attr($panel['key'] ?? 'credits'); ?>" class="dashboard-panel<?php echo !empty($panel['is_active']) ? ' is-active' : ''; ?>" role="tabpanel"<?php echo empty($panel['is_active']) ? ' hidden' : ''; ?> data-panel-loaded="<?php echo !empty($panel['is_loaded']) ? 'true' : 'false'; ?>" data-tab-url="<?php echo esc_url($panel['url'] ?? ''); ?>">
<?php echo $panel['html'] ?? ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</div>
@@ -0,0 +1,8 @@
<?php
/** User center favorites panel. @package AKSRT */
defined('ABSPATH') || exit;
$panel = is_array($args['panel'] ?? null) ? $args['panel'] : [];
?>
<div id="panel-<?php echo esc_attr($panel['key'] ?? 'favorites'); ?>" class="dashboard-panel<?php echo !empty($panel['is_active']) ? ' is-active' : ''; ?>" role="tabpanel"<?php echo empty($panel['is_active']) ? ' hidden' : ''; ?> data-panel-loaded="<?php echo !empty($panel['is_loaded']) ? 'true' : 'false'; ?>" data-tab-url="<?php echo esc_url($panel['url'] ?? ''); ?>">
<?php echo $panel['html'] ?? ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</div>
@@ -0,0 +1,8 @@
<?php
/** User center posts panel. @package AKSRT */
defined('ABSPATH') || exit;
$panel = is_array($args['panel'] ?? null) ? $args['panel'] : [];
?>
<div id="panel-<?php echo esc_attr($panel['key'] ?? 'posts'); ?>" class="dashboard-panel<?php echo !empty($panel['is_active']) ? ' is-active' : ''; ?>" role="tabpanel"<?php echo empty($panel['is_active']) ? ' hidden' : ''; ?> data-panel-loaded="<?php echo !empty($panel['is_loaded']) ? 'true' : 'false'; ?>" data-tab-url="<?php echo esc_url($panel['url'] ?? ''); ?>">
<?php echo $panel['html'] ?? ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</div>
@@ -0,0 +1,8 @@
<?php
/** User center profile panel. @package AKSRT */
defined('ABSPATH') || exit;
$panel = is_array($args['panel'] ?? null) ? $args['panel'] : [];
?>
<div id="panel-<?php echo esc_attr($panel['key'] ?? 'profile'); ?>" class="dashboard-panel<?php echo !empty($panel['is_active']) ? ' is-active' : ''; ?>" role="tabpanel"<?php echo empty($panel['is_active']) ? ' hidden' : ''; ?> data-panel-loaded="<?php echo !empty($panel['is_loaded']) ? 'true' : 'false'; ?>" data-tab-url="<?php echo esc_url($panel['url'] ?? ''); ?>">
<?php echo $panel['html'] ?? ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</div>
@@ -0,0 +1,8 @@
<?php
/** User center settings panel. @package AKSRT */
defined('ABSPATH') || exit;
$panel = is_array($args['panel'] ?? null) ? $args['panel'] : [];
?>
<div id="panel-<?php echo esc_attr($panel['key'] ?? 'settings'); ?>" class="dashboard-panel<?php echo !empty($panel['is_active']) ? ' is-active' : ''; ?>" role="tabpanel"<?php echo empty($panel['is_active']) ? ' hidden' : ''; ?> data-panel-loaded="<?php echo !empty($panel['is_loaded']) ? 'true' : 'false'; ?>" data-tab-url="<?php echo esc_url($panel['url'] ?? ''); ?>">
<?php echo $panel['html'] ?? ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</div>
+14
View File
@@ -0,0 +1,14 @@
<?php
/**
* Generic user-center panel wrapper for registered extensions.
*
* @package AKSRT
*/
defined('ABSPATH') || exit;
$panel = is_array($args['panel'] ?? null) ? $args['panel'] : [];
?>
<div id="panel-<?php echo esc_attr($panel['key'] ?? 'custom'); ?>" class="dashboard-panel<?php echo !empty($panel['is_active']) ? ' is-active' : ''; ?>" role="tabpanel"<?php echo empty($panel['is_active']) ? ' hidden' : ''; ?> data-panel-loaded="<?php echo !empty($panel['is_loaded']) ? 'true' : 'false'; ?>" data-tab-url="<?php echo esc_url($panel['url'] ?? ''); ?>">
<?php echo $panel['html'] ?? ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</div>
@@ -0,0 +1,9 @@
<?php
/** User center runtime configuration. @package AKSRT */
defined('ABSPATH') || exit;
$context = is_array($args['context'] ?? null) ? $args['context'] : [];
?>
<script>window.aksrtUserCenter=<?php echo wp_json_encode($context['runtime_config'] ?? []); ?>;</script>
<?php if (!empty($context['cover_upload_config'])) : ?>
<script>window.aksrtAuthorPage=Object.assign({},window.aksrtAuthorPage||{},{coverUpload:<?php echo wp_json_encode($context['cover_upload_config']); ?>});</script>
<?php endif; ?>
+5
View File
@@ -0,0 +1,5 @@
<?php
/** User center sidebar. @package AKSRT */
defined('ABSPATH') || exit;
$context = is_array($args['context'] ?? null) ? $args['context'] : [];
echo $context['sidebar_html'] ?? ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped