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

+39
View File
@@ -465,9 +465,48 @@ class PostDisplay {
'submit_text' => $submit_text !== '' ? $submit_text : __('提交评论', 'aksrt'),
'box_placeholder' => $box_placeholder !== '' ? $box_placeholder : __('说点什么吧...', 'aksrt'),
'title' => $title !== '' ? $title : __('评论', 'aksrt'),
// Extended zibll-parity settings.
'close_comments' => !empty($settings['comment_close_comments']),
'hot_threshold' => max(1, min(999, (int) ($settings['comment_hot_threshold'] ?? 10))),
'quick_s' => !isset($settings['comment_quick_s']) || !empty($settings['comment_quick_s']),
'quick_phrases' => self::parse_comment_quick_phrases((string) ($settings['comment_quick_often'] ?? '')),
'city_s' => !isset($settings['comment_city_s']) || !empty($settings['comment_city_s']),
'city_type' => self::normalize_comment_city_type((string) ($settings['comment_city_type'] ?? 'province_city')),
];
}
/**
* @return array<int,string>
*/
private static function parse_comment_quick_phrases(string $raw): array {
if (trim($raw) === '') {
$raw = "不错,学习了\n感谢分享\n期待更新";
}
$lines = preg_split('/\r\n|\r|\n/', $raw) ?: [];
$out = [];
foreach ($lines as $line) {
$line = trim((string) $line);
if ($line !== '') {
$out[] = $line;
}
}
return array_values(array_unique($out));
}
private static function normalize_comment_city_type(string $type): string {
$type = sanitize_key($type);
// Map legacy zibll pro/city labels.
if ($type === 'pro') {
return 'province';
}
if ($type === 'city') {
return 'province_city';
}
return in_array($type, ['province_city', 'province', 'country_province'], true)
? $type
: 'province_city';
}
public static function apply_list_orderby($query): void {
if (is_admin() || !($query instanceof \WP_Query) || !$query->is_main_query()) {