进行了一些小优化

This commit is contained in:
2026-08-31 19:16:30 +08:00
parent 71444b139a
commit 183e725eb4
2 changed files with 7 additions and 7 deletions
+4 -7
View File
@@ -30,7 +30,6 @@ final class UserRenderer {
}
return self::card_box($user_id, [
'class' => 'widget',
'show_posts' => false,
'show_checkin' => true,
'show_img_bg' => !isset($i['show_img_bg']) || !empty($i['show_img_bg']),
@@ -49,7 +48,6 @@ final class UserRenderer {
$post_style = sanitize_key((string) ($i['post_style'] ?? 'mini'));
return self::card_box((int) $user->ID, [
'class' => 'widget',
'show_img_bg' => !isset($i['show_img_bg']) || !empty($i['show_img_bg']),
'show_posts' => !isset($i['show_posts']) || !empty($i['show_posts']),
'limit' => max(0, min(12, (int) ($i['limit'] ?? 6))),
@@ -100,14 +98,14 @@ final class UserRenderer {
}
}
return '<div class="user-card zib-widget widget">' . $cover
return '<div class="user-card zib-widget">' . $cover
. '<div class="card-content mt10">'
. '<div class="user-content">'
. '<div class="user-avatar">' . $avatar . '</div>'
. '<div class="user-info mt10">'
. '<div class="text-center box-body">'
. '<p class="muted-color box-body em12">' . esc_html($title) . '</p>'
. '<p>' . $buttons . '</p>'
. '<p class="user-card__auth-btns">' . $buttons . '</p>'
. $oauth_html
. '</div></div></div></div></div>';
}
@@ -116,11 +114,10 @@ final class UserRenderer {
* 登录卡片(legacy zib_get_user_card_box parity)。
*
* @param int $user_id 卡片用户。
* @param array $args class/show_posts/show_checkin/show_img_bg/show_button/button_1,2 与文章模块参数。
* @param array $args show_posts/show_checkin/show_img_bg/show_button/button_1,2 与文章模块参数。
*/
private static function card_box(int $user_id, array $args = []): string {
$args = wp_parse_args($args, [
'class' => '',
'show_posts' => true,
'show_checkin' => false,
'show_img_bg' => false,
@@ -185,7 +182,7 @@ final class UserRenderer {
$cover = '<div class="user-cover graphic" style="padding-bottom: 50%;"><img' . aksrt_get_lazy_attr('lazy_cover', $cover_url, 'fit-cover user-cover', aksrt_get_lazy_thumb()) . ' alt="' . esc_attr__('用户封面', 'aksrt') . '"></div>';
}
return '<div class="user-card zib-widget ' . esc_attr((string) $args['class']) . '">' . $cover
return '<div class="user-card zib-widget">' . $cover
. '<div class="card-content mt10 relative">'
. '<div class="user-content">' . $checkin
. '<div class="user-avatar">' . $avatar . '</div>'