用户功能设置收口与废弃后台链路清理
This commit is contained in:
1 parent
081eb0870d
commit
86692ff3f9
59 files changed
+506
-1767
No files matched your search
@@ -5,7 +5,6 @@
|
||||
* Gates:
|
||||
* master: ip_geo_enabled
|
||||
* surface: ip_geo_display ∈ {comment, user_home, user_center, post}
|
||||
* users: user_city_s (+ user_city_type)
|
||||
* comments: comment_city_s (+ comment_city_type) via comments/geo.php
|
||||
*
|
||||
* Meta:
|
||||
@@ -74,9 +73,6 @@ if (!function_exists('aksrt_ip_geo_display_enabled')) :
|
||||
if (!in_array($location, aksrt_ip_geo_display_list(), true)) {
|
||||
return false;
|
||||
}
|
||||
if (in_array($location, ['user_home', 'user_center'], true) && !aksrt_user_city_enabled()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
endif;
|
||||
@@ -90,37 +86,6 @@ if (!function_exists('aksrt_ip_geo_format_key')) :
|
||||
}
|
||||
endif;
|
||||
|
||||
if (!function_exists('aksrt_user_city_enabled')) :
|
||||
/**
|
||||
* Users feature: show city on user home / user center.
|
||||
* Default true when key absent (legacy parity for new installs).
|
||||
*/
|
||||
function aksrt_user_city_enabled(): bool {
|
||||
if (!class_exists('\AKSRT\Settings\Settings')) {
|
||||
return true;
|
||||
}
|
||||
$all = \AKSRT\Settings\Settings::get_all();
|
||||
if (!array_key_exists('user_city_s', $all)) {
|
||||
return true;
|
||||
}
|
||||
return !empty($all['user_city_s']);
|
||||
}
|
||||
endif;
|
||||
|
||||
if (!function_exists('aksrt_user_city_type')) :
|
||||
function aksrt_user_city_type(): string {
|
||||
if (!class_exists('\AKSRT\Settings\Settings')) {
|
||||
return aksrt_ip_geo_format_key();
|
||||
}
|
||||
$all = \AKSRT\Settings\Settings::get_all();
|
||||
$type = sanitize_key((string) ($all['user_city_type'] ?? ''));
|
||||
if (in_array($type, ['province_city', 'province', 'country_province'], true)) {
|
||||
return $type;
|
||||
}
|
||||
return aksrt_ip_geo_format_key();
|
||||
}
|
||||
endif;
|
||||
|
||||
if (!function_exists('aksrt_normalize_geo_addr')) :
|
||||
/**
|
||||
* @param mixed $raw Meta value.
|
||||
@@ -229,8 +194,7 @@ if (!function_exists('aksrt_store_user_addr')) :
|
||||
if ($user_id <= 0 || !aksrt_ip_geo_master_enabled()) {
|
||||
return;
|
||||
}
|
||||
$need = aksrt_user_city_enabled()
|
||||
|| in_array('post', aksrt_ip_geo_display_list(), true)
|
||||
$need = in_array('post', aksrt_ip_geo_display_list(), true)
|
||||
|| in_array('user_home', aksrt_ip_geo_display_list(), true)
|
||||
|| in_array('user_center', aksrt_ip_geo_display_list(), true);
|
||||
if (!$need) {
|
||||
@@ -286,7 +250,7 @@ if (!function_exists('aksrt_get_user_city_badge_html')) :
|
||||
if ($user_id <= 0 || !aksrt_ip_geo_display_enabled($location)) {
|
||||
return '';
|
||||
}
|
||||
return aksrt_get_geo_badge_html(aksrt_get_user_addr($user_id), aksrt_user_city_type(), $class);
|
||||
return aksrt_get_geo_badge_html(aksrt_get_user_addr($user_id), aksrt_ip_geo_format_key(), $class);
|
||||
}
|
||||
endif;
|
||||
|
||||
@@ -304,8 +268,7 @@ if (!function_exists('aksrt_get_post_author_city_badge_html')) :
|
||||
if ($author_id <= 0) {
|
||||
return '';
|
||||
}
|
||||
$type = aksrt_user_city_enabled() ? aksrt_user_city_type() : aksrt_ip_geo_format_key();
|
||||
return aksrt_get_geo_badge_html(aksrt_get_user_addr($author_id), $type, $class);
|
||||
return aksrt_get_geo_badge_html(aksrt_get_user_addr($author_id), aksrt_ip_geo_format_key(), $class);
|
||||
}
|
||||
endif;
|
||||
|
||||
|
||||
Reference in new issue
Block a user