feat(comments): full 1:1 zibll comment kernel for posts, forum, shop

Extract shared comment helpers (content/item/form/geo/actions), port GIF
[g=] smilies + FixedInput/moveForm UX, wire close_comments/city/quick
settings, REST comment get, and align product review chrome with zibll.
This commit is contained in:
kate522 committed 2026-07-18 15:51:47 +08:00
1 parent 9edd39c33d
commit 276a2891ba
116 files changed
+2658 -1848

No files matched your search

+30 -16
View File
@@ -275,35 +275,49 @@ $author = $author_id > 0 ? get_userdata($author_id) : null;
<div class="aksrt-product-page__tab-panel" data-aksrt-tab-panel="reviews">
<?php if (!empty($scores['total'])) : ?>
<div class="aksrt-product-page__review-summary">
<strong class="aksrt-product-page__review-avg"><?php echo esc_html((string) ($scores['average'] ?? '0')); ?></strong>
<span class="aksrt-product-page__review-level"><?php echo esc_html((string) ($scores['level'] ?? '')); ?></span>
<div class="aksrt-product-page__review-counts">
<span><?php printf(esc_html__('好评 %d', 'aksrt'), (int) ($scores['good'] ?? 0)); ?></span>
<span><?php printf(esc_html__('差评 %d', 'aksrt'), (int) ($scores['bad'] ?? 0)); ?></span>
<span><?php printf(esc_html__('有图 %d', 'aksrt'), (int) ($scores['has_image'] ?? 0)); ?></span>
<div class="aksrt-product-page__review-summary shop-comment-header" win-ajax-replace="shop-comment-header">
<div class="comment-score">
<strong class="aksrt-product-page__review-avg"><?php echo esc_html((string) ($scores['average'] ?? '0')); ?></strong>
<span class="aksrt-product-page__review-level"><?php echo esc_html((string) ($scores['level'] ?? '')); ?></span>
</div>
<div class="aksrt-product-page__review-counts comment-filter">
<a href="javascript:;" class="comment-orderby c-theme badg" data-review-filter=""><?php esc_html_e('全部', 'aksrt'); ?></a>
<a href="javascript:;" class="comment-orderby badg" data-review-filter="has_image"><?php printf(esc_html__('有图 %d', 'aksrt'), (int) ($scores['has_image'] ?? 0)); ?></a>
<a href="javascript:;" class="comment-orderby badg" data-review-filter="good"><?php printf(esc_html__('好评 %d', 'aksrt'), (int) ($scores['good'] ?? 0)); ?></a>
<a href="javascript:;" class="comment-orderby badg" data-review-filter="bad"><?php printf(esc_html__('中/差评 %d', 'aksrt'), (int) ($scores['bad'] ?? 0)); ?></a>
</div>
</div>
<?php endif; ?>
<div class="aksrt-product-page__review-list" data-aksrt-review-list>
<div class="aksrt-product-page__review-list shop-commentlist" data-aksrt-review-list data-product-id="<?php echo esc_attr((string) $product_id); ?>">
<?php foreach (($reviews['items'] ?? []) as $review) : ?>
<div class="aksrt-product-page__review-item">
<div class="aksrt-product-page__review-header">
<img src="<?php echo esc_url((string) ($review['user_avatar'] ?? '')); ?>" alt="" class="aksrt-product-page__review-avatar">
<div class="aksrt-product-page__review-item comment" data-review-id="<?php echo esc_attr((string) ($review['id'] ?? '')); ?>">
<div class="aksrt-product-page__review-header comment-header">
<img src="<?php echo esc_url((string) ($review['user_avatar'] ?? '')); ?>" alt="" class="aksrt-product-page__review-avatar avatar-img comt-avatar">
<span class="aksrt-product-page__review-name"><?php echo esc_html((string) ($review['user_name'] ?? '')); ?></span>
<span class="aksrt-product-page__review-date"><?php echo esc_html((string) ($review['date'] ?? '')); ?></span>
<span class="aksrt-product-page__review-stars">
<span class="aksrt-product-page__review-stars comment-score-badge">
<?php for ($s = 0; $s < 5; $s++) : ?>
<i class="<?php echo $s < (int) ($review['rating_average'] ?? 0) ? 'fas' : 'far'; ?> fa-star"></i>
<i class="<?php echo $s < (int) round((float) ($review['rating_average'] ?? 0)) ? 'fas' : 'far'; ?> fa-star"></i>
<?php endfor; ?>
</span>
</div>
<p class="aksrt-product-page__review-text"><?php echo esc_html((string) ($review['content'] ?? '')); ?></p>
<div class="aksrt-product-page__review-text comment-content">
<?php
$review_body = (string) ($review['content'] ?? '');
if ($review_body === '') {
echo esc_html__('用户未填写评价内容', 'aksrt');
} elseif (function_exists('aksrt_render_comment_content')) {
echo aksrt_render_comment_content($review_body); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
} else {
echo esc_html($review_body);
}
?>
</div>
<?php if (!empty($review['images'])) : ?>
<div class="aksrt-product-page__review-images">
<div class="aksrt-product-page__review-images comment-score-imgs imgbox-container">
<?php foreach ((array) $review['images'] as $rimg) : ?>
<img src="<?php echo esc_url($rimg); ?>" alt="" class="aksrt-product-page__review-img">
<img src="<?php echo esc_url($rimg); ?>" alt="" class="aksrt-product-page__review-img box-img">
<?php endforeach; ?>
</div>
<?php endif; ?>