Files
wordpress-theme-aksrt/inc/classes/admin/schema/class-aksrt-admin-schema-extensions-ip.php
T

52 lines
2.8 KiB
PHP

<?php
/**
* AKSRT_Admin_Schema_Extensions_IP section schema.
*
* @package AKSRT
*/
defined('ABSPATH') || exit;
class AKSRT_Admin_Schema_Extensions_IP {
public static function build(): array {
return [
'key' => 'ip',
'title' => 'IP归属地',
'version' => '1.0.0',
'option_key' => 'aksrt_settings',
'groups' => [
['key' => 'basic', 'title' => '基础配置', 'fields' => [
['key' => 'ip_geo_enabled', 'label' => '启用 IP 归属地', 'type' => 'switch', 'default' => false],
['key' => 'ip_addr_sdk', 'label' => 'IP 接口服务商', 'type' => 'radio', 'default' => 'null', 'options' => [
['label' => '轮流查询', 'value' => 'polling'],
['label' => '腾讯位置服务', 'value' => 'qq'],
['label' => '高德位置服务', 'value' => 'amap'],
['label' => '太平洋公共接口', 'value' => 'null'],
]],
['key' => 'ip_geo_cache_ttl', 'label' => '缓存时间 (秒)', 'type' => 'number', 'default' => 86400, 'min' => 3600, 'max' => 604800],
]],
['key' => 'providers', 'title' => '接口凭据', 'fields' => [
['key' => 'ip_addr_sdk_qq_appkey', 'label' => '腾讯 AppKey', 'type' => 'input', 'default' => ''],
['key' => 'ip_addr_sdk_qq_secretkey', 'label' => '腾讯 SecretKey', 'type' => 'input', 'default' => ''],
['key' => 'ip_addr_sdk_amap_appkey', 'label' => '高德 AppKey', 'type' => 'input', 'default' => ''],
['key' => 'ip_addr_sdk_amap_secretkey', 'label' => '高德 SecretKey', 'type' => 'input', 'default' => ''],
]],
['key' => 'display', 'title' => '展示设置', 'fields' => [
['key' => 'ip_geo_display', 'label' => '展示位置', 'type' => 'checkbox', 'default' => ['comment'], 'sanitize_type' => 'array', 'options' => [
['label' => '评论区', 'value' => 'comment'],
['label' => '用户主页', 'value' => 'user_home'],
['label' => '文章页', 'value' => 'post'],
]],
['key' => 'ip_geo_format', 'label' => '显示格式', 'type' => 'radio', 'default' => 'province_city', 'options' => [
['label' => '省份+城市', 'value' => 'province_city'],
['label' => '仅省份', 'value' => 'province'],
['label' => '国家+省份', 'value' => 'country_province'],
]],
['key' => 'ip_geo_fallback_text', 'label' => '查询失败时文案', 'type' => 'input', 'default' => ''],
]],
],
];
}
}