200 lines
5.6 KiB
PHP
200 lines
5.6 KiB
PHP
<?php
|
||
/**
|
||
* AKSRT settings domain-grouped facade tail.
|
||
*
|
||
* @package AKSRT
|
||
*/
|
||
|
||
defined('ABSPATH') || exit;
|
||
|
||
trait AKSRT_Settings_Domain_Groups {
|
||
|
||
/**
|
||
* 获取微信通知设置
|
||
*
|
||
* @return array{enabled:bool,app_id:string,app_secret:string,template_id:string}
|
||
*/
|
||
public static function get_wechat_settings(): array {
|
||
return AKSRT_Settings_Integration::get_wechat_settings();
|
||
}
|
||
|
||
/**
|
||
* 更新微信通知设置
|
||
*
|
||
* @param array $settings 合并后的完整微信配置
|
||
*/
|
||
public static function update_wechat_settings(array $settings): void {
|
||
AKSRT_Settings_Integration::update_wechat_settings($settings);
|
||
}
|
||
|
||
/**
|
||
* 获取商城设置
|
||
*
|
||
* @return array
|
||
*/
|
||
public static function get_shop_settings(): array {
|
||
return AKSRT_Settings_Forum_Shop::get_shop_settings();
|
||
}
|
||
|
||
/**
|
||
* 获取论坛设置
|
||
*
|
||
* 对标 zibll 论坛后台 12 section,提供一站式读取。
|
||
* 所有 key 与 schema_forum() 一一对应。
|
||
*/
|
||
public static function get_forum_settings(): array {
|
||
return AKSRT_Settings_Forum_Shop::get_forum_settings();
|
||
}
|
||
|
||
/**
|
||
* 获取文档模式设置
|
||
*/
|
||
public static function get_docs_mode_settings(): array {
|
||
return AKSRT_Settings_Integration::get_docs_mode_settings();
|
||
}
|
||
|
||
/**
|
||
* 获取全局背景设置
|
||
*/
|
||
public static function get_global_background_settings(): array {
|
||
return AKSRT_Settings_Display_Runtime::get_global_background_settings();
|
||
}
|
||
|
||
/**
|
||
* 获取页脚布局模板
|
||
*/
|
||
public static function get_footer_layout_template(): string {
|
||
$footer = self::get_footer_settings();
|
||
$template = sanitize_key((string) ($footer['layout_template'] ?? 'default'));
|
||
if (!in_array($template, ['default', 'compact', 'centered'], true)) {
|
||
$template = 'default';
|
||
}
|
||
return $template;
|
||
}
|
||
|
||
/**
|
||
* 获取邮件事件配置
|
||
*
|
||
* @param string $event 事件类型,留空返回全部
|
||
* @return array 单个事件配置或全部事件数组
|
||
*/
|
||
public static function get_email_event_config(string $event = ''): array {
|
||
return AKSRT_Settings_Mail::get_email_event_config($event);
|
||
}
|
||
|
||
/**
|
||
* 邮件事件是否启用
|
||
*/
|
||
public static function is_email_event_enabled(string $event): bool {
|
||
return AKSRT_Settings_Mail::is_email_event_enabled($event);
|
||
}
|
||
|
||
/**
|
||
* 通过邮件事件体系发送邮件
|
||
*/
|
||
public static function send_event_email(
|
||
string $event,
|
||
string $to,
|
||
string $default_subject,
|
||
string $default_content,
|
||
array $placeholders = []
|
||
): bool {
|
||
return AKSRT_Settings_Mail::send_event_email($event, $to, $default_subject, $default_content, $placeholders);
|
||
}
|
||
|
||
/** 禁封设置 */
|
||
public static function ban_settings(): array {
|
||
return AKSRT_Settings_User_Runtime::ban_settings();
|
||
}
|
||
|
||
/** 举报设置 */
|
||
public static function report_settings(): array {
|
||
return AKSRT_Settings_User_Runtime::report_settings();
|
||
}
|
||
|
||
/** 站内通知总开关 */
|
||
public static function message_enabled(): bool {
|
||
return AKSRT_Settings_Integration::message_enabled();
|
||
}
|
||
|
||
/** 通知基础设置(basic group) */
|
||
public static function notification_settings(): array {
|
||
return AKSRT_Settings_Integration::notification_settings();
|
||
}
|
||
|
||
/** 已关闭的通知推送类型列表 */
|
||
public static function notification_closed_types(): array {
|
||
return AKSRT_Settings_Integration::notification_closed_types();
|
||
}
|
||
|
||
/** 自动清理已读消息配置 */
|
||
public static function auto_clear_settings(): array {
|
||
return AKSRT_Settings_Integration::auto_clear_settings();
|
||
}
|
||
|
||
/** 私信功能配置 */
|
||
public static function private_message_settings(): array {
|
||
return AKSRT_Settings_Integration::private_message_settings();
|
||
}
|
||
|
||
/**
|
||
* 获取菜单项扩展 meta 字段列表
|
||
*/
|
||
public static function get_menu_item_meta_fields(): array {
|
||
return [
|
||
'icon_class',
|
||
'icon_svg',
|
||
'badge_text',
|
||
'badge_color',
|
||
'menu_card_image',
|
||
'menu_card_desc',
|
||
];
|
||
}
|
||
|
||
/**
|
||
* Capability definitions registry.
|
||
*
|
||
* @return array<string, array{label:string, roles?:string[], exclude_roles?:string[], default?:array<string,mixed>}>
|
||
*/
|
||
public static function cap_definitions(): array {
|
||
return AKSRT_Settings_Capabilities::cap_definitions();
|
||
}
|
||
|
||
/**
|
||
* All role columns in the capability matrix.
|
||
*/
|
||
public static function cap_role_columns(): array {
|
||
return AKSRT_Settings_Capabilities::cap_role_columns();
|
||
}
|
||
|
||
/**
|
||
* Read the user_caps matrix from settings.
|
||
*
|
||
* @return array<string, array<string, mixed>>
|
||
*/
|
||
public static function get_user_capabilities(): array {
|
||
return AKSRT_Settings_Capabilities::get_user_capabilities();
|
||
}
|
||
|
||
/**
|
||
* Resolve whether a user has a specific capability.
|
||
*/
|
||
public static function user_can(string $cap, int $user_id = 0, ?int $context = null): bool {
|
||
return AKSRT_Settings_Capabilities::user_can($cap, $user_id, $context);
|
||
}
|
||
|
||
/**
|
||
* 获取"网站安全"设置
|
||
*/
|
||
public static function get_security_settings(): array {
|
||
return AKSRT_Settings_Capabilities::get_security_settings();
|
||
}
|
||
|
||
/**
|
||
* 获取"系统工具"设置
|
||
*/
|
||
public static function get_system_tools_settings(): array {
|
||
return AKSRT_Settings_Capabilities::get_system_tools_settings();
|
||
}
|
||
}
|