feat(ip-geo): full-chain IP 归属地 on comments, user home, center, post

This commit is contained in:
2026-07-25 14:39:47 +08:00
parent 1f2ca3ac8f
commit ac7ff8d4f2
13 changed files with 457 additions and 33 deletions
+7 -1
View File
@@ -53,8 +53,14 @@ class ExtensionRuntime {
$provider = 'null';
}
$display_raw = $settings['ip_geo_display'] ?? ['comment'];
$display_raw = $settings['ip_geo_display'] ?? ['comment', 'user_home', 'user_center', 'post'];
$display = is_array($display_raw) ? $display_raw : [$display_raw];
$display = array_values(array_unique(array_filter(array_map('sanitize_key', $display))));
$allowed_display = ['comment', 'user_home', 'user_center', 'post'];
$display = array_values(array_filter($display, static fn($v) => in_array($v, $allowed_display, true)));
if ($display === []) {
$display = ['comment', 'user_home', 'user_center', 'post'];
}
$format = sanitize_key((string) ($settings['ip_geo_format'] ?? 'province_city'));
if (!in_array($format, ['province_city', 'province', 'country_province'], true)) {