Make aksrt_settings the sole theme settings store for get_all(), remove aksrt_seo_settings/aksrt_basic_settings merge paths, point global.logo schema at aksrt_settings, and delete the retired settings migration page, route, REST endpoint, and related SPA surface.
289 lines
15 KiB
PHP
289 lines
15 KiB
PHP
<?php
|
|
/**
|
|
* AKSRT settings display and page domain aggregations.
|
|
*
|
|
* @package AKSRT
|
|
*/
|
|
|
|
defined('ABSPATH') || exit;
|
|
|
|
trait AKSRT_Settings_Display_Page_Groups {
|
|
|
|
/**
|
|
* 获取 SEO 设置(从 aksrt_settings 读取)
|
|
*/
|
|
public static function get_seo_settings(): array {
|
|
$s = self::get_all();
|
|
return [
|
|
'seo_enabled' => !isset($s['seo_enabled']) || !empty($s['seo_enabled']),
|
|
'seo_connector' => trim((string) ($s['seo_connector'] ?? '-')),
|
|
'seo_title' => $s['seo_title'] ?? '',
|
|
'seo_description' => $s['seo_description'] ?? '',
|
|
'seo_keywords' => self::seo_keywords(),
|
|
'seo_ai_enabled' => !empty($s['seo_ai_enabled']),
|
|
'ai_seo_title_prompt' => trim((string) ($s['ai_seo_title_prompt'] ?? '')),
|
|
'ai_seo_keywords_prompt' => trim((string) ($s['ai_seo_keywords_prompt'] ?? '')),
|
|
'ai_seo_description_prompt' => trim((string) ($s['ai_seo_description_prompt'] ?? '')),
|
|
'seo_baidu_push' => !empty($s['seo_baidu_push']) || !empty($s['baidu_push_enabled']),
|
|
'seo_baidu_normal' => !empty($s['seo_baidu_normal']),
|
|
'seo_baidu_fast' => !empty($s['seo_baidu_fast']),
|
|
'seo_baidu_token' => (string) (($s['seo_baidu_token'] ?? '') ?: ($s['baidu_push_token'] ?? '')),
|
|
'seo_image_optimize' => !isset($s['seo_image_optimize']) || !empty($s['seo_image_optimize']),
|
|
'seo_image_default' => esc_url_raw((string) ($s['seo_image_default'] ?? '')),
|
|
'seo_image_always_default'=> !empty($s['seo_image_always_default']),
|
|
'seo_auto_alt' => !isset($s['seo_auto_alt']) || !empty($s['seo_auto_alt']),
|
|
'seo_go_link' => !isset($s['seo_go_link']) || !empty($s['seo_go_link']),
|
|
'seo_go_link_nonce' => !isset($s['seo_go_link_nonce']) || !empty($s['seo_go_link_nonce']),
|
|
'seo_go_link_post' => !isset($s['seo_go_link_post']) || !empty($s['seo_go_link_post']),
|
|
'seo_go_link_exclude' => trim((string) ($s['seo_go_link_exclude'] ?? '')),
|
|
'seo_no_category' => !empty($s['seo_no_category']),
|
|
'seo_jsonld' => !isset($s['seo_jsonld']) || !empty($s['seo_jsonld']),
|
|
'seo_jsonld_single' => !isset($s['seo_jsonld_single']) || !empty($s['seo_jsonld_single']),
|
|
'seo_jsonld_page' => !isset($s['seo_jsonld_page']) || !empty($s['seo_jsonld_page']),
|
|
'head_code' => self::custom_head_code(),
|
|
'foot_code' => self::custom_footer_code(),
|
|
'trackcode' => self::trackcode(),
|
|
];
|
|
}
|
|
|
|
/**
|
|
* 获取顶部多功能组件设置
|
|
*/
|
|
public static function get_header_components_settings(): array {
|
|
$s = self::get_all();
|
|
$show_on = isset($s['header_components_show_on']) ? (array) $s['header_components_show_on'] : ['home'];
|
|
$show_type = $s['header_components_device_visibility'] ?? '';
|
|
if (!in_array($show_type, ['', 'only_pc', 'only_sm'], true)) {
|
|
$show_type = '';
|
|
}
|
|
return [
|
|
'search_enabled' => self::header_components_search_enabled(),
|
|
'search_config' => self::get_header_components_search_config(),
|
|
'cards_enabled' => self::header_components_cards_enabled(),
|
|
'show_on_pages' => array_values(array_filter(array_map('sanitize_key', $show_on))),
|
|
'show_type' => $show_type,
|
|
'filter_blur' => isset($s['header_components_filter_blur_devices']) ? array_values(array_intersect(array_map('sanitize_key', (array) $s['header_components_filter_blur_devices']), ['pc', 'mobile'])) : [],
|
|
'card_show' => isset($s['header_components_card_show_devices']) ? array_values(array_intersect(array_map('sanitize_key', (array) $s['header_components_card_show_devices']), ['pc', 'mobile'])) : ['pc', 'mobile'],
|
|
'slider_config' => self::get_slider_config(),
|
|
'icon_cards' => self::get_header_components_icon_cards(),
|
|
'card_columns' => self::get_header_components_card_columns(),
|
|
'card_bg_enabled' => self::header_components_card_bg_enabled(),
|
|
];
|
|
}
|
|
|
|
/**
|
|
* 获取"全局&功能"域的合并设置
|
|
*/
|
|
public static function get_global_settings(): array {
|
|
return [
|
|
'site_logo' => self::logo_url(),
|
|
'site_logo_dark' => self::logo_dark_url(),
|
|
'logo_text' => self::logo_text(),
|
|
'logo_width' => self::logo_width(),
|
|
'site_favicon' => self::favicon_url(),
|
|
'avatar_source' => self::avatar_source(),
|
|
'icp_filing' => self::icp_filing(),
|
|
'footer_text' => self::footer_text(),
|
|
'theme_mode' => self::theme_mode(),
|
|
'theme_mode_button' => self::get_theme_mode_button_positions(),
|
|
'primary_color' => self::primary_color(),
|
|
'border_radius' => self::border_radius(),
|
|
'theme_main_radius' => self::card_radius(),
|
|
'qj_loading' => self::is_qj_loading_enabled(),
|
|
'qj_dh_xs' => self::get_qj_loading_style(),
|
|
'container_max_width' => self::container_max_width(),
|
|
'font_family' => self::font_family(),
|
|
'search_type' => self::search_mode(),
|
|
'search_placeholder' => self::search_placeholder(),
|
|
'search_history_enabled' => self::search_history_enabled(),
|
|
'hot_search_enabled' => self::hot_search_enabled(),
|
|
'hot_search_keywords' => self::hot_search_keywords(),
|
|
'search_suggestions_enabled' => self::search_suggestions_enabled(),
|
|
'search_posts' => self::search_posts_enabled(),
|
|
'search_no_page' => self::search_no_page(),
|
|
'search_exclude_cats' => self::search_exclude_cats(),
|
|
'search_cat' => self::search_cat_enabled(),
|
|
'search_cat_in' => self::search_cat_in(),
|
|
'search_more_cat_obj' => self::search_more_cat_obj(),
|
|
'search_custom_key_s' => self::search_custom_key_enabled(),
|
|
'search_custom_key' => self::search_custom_key(),
|
|
'search_facets' => self::search_facets_enabled(),
|
|
'search_facets_order' => self::search_facets_order(),
|
|
'custom_css' => self::custom_css(),
|
|
'head_code' => self::custom_head_code(),
|
|
'foot_code' => self::custom_footer_code(),
|
|
'trackcode' => self::trackcode(),
|
|
'seo' => self::get_seo_settings(),
|
|
'mail' => self::get_smtp(),
|
|
'email_events' => self::get_email_event_config(),
|
|
'email_private_receive_limit' => self::get_email_private_receive_limit(),
|
|
'footer' => self::get_footer_settings(),
|
|
'tabbar' => self::get_footer_tabbar_settings(),
|
|
'floating_buttons' => self::get_floating_buttons_settings(),
|
|
'header_nav' => self::get_header_nav_settings(),
|
|
'header_newposts' => self::get_header_newposts_config(),
|
|
'header_theme' => self::get_header_theme_config(),
|
|
'friend_links' => self::get_friend_links(),
|
|
'comment_enabled' => self::comment_enabled(),
|
|
'cms_features' => self::get_cms_features(),
|
|
'page_display' => self::get_page_display_settings(),
|
|
'footer_theme' => self::get_footer_theme_config(),
|
|
];
|
|
}
|
|
|
|
/**
|
|
* 获取"页面&显示"域的合并设置
|
|
*/
|
|
public static function get_page_display_settings(): array {
|
|
return [
|
|
'header_components' => self::get_header_components_settings(),
|
|
'homepage' => self::get_homepage_fixed_settings(),
|
|
'category_recommend' => self::get_category_recommend_settings(),
|
|
'category' => self::get_category_page_settings(),
|
|
'tag' => self::get_tag_page_settings(),
|
|
'special' => self::get_special_page_settings(),
|
|
'user_home' => self::get_user_home_settings(),
|
|
'other' => self::get_other_page_settings(),
|
|
'background' => self::get_global_background_settings(),
|
|
'menu_decoration' => function_exists('aksrt_get_menu_decoration_settings')
|
|
? aksrt_get_menu_decoration_settings()
|
|
: [],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* 获取"文章&列表"域的合并设置
|
|
*/
|
|
public static function get_post_list_settings(): array {
|
|
$list = self::get_post_list_style_settings();
|
|
$thumb = self::get_post_thumb_settings();
|
|
$filter = self::get_post_filter_settings();
|
|
|
|
return [
|
|
'list' => [
|
|
'post_card_style' => $list['card_style'],
|
|
'post_list_author' => $list['show_author'],
|
|
'post_show_date' => $list['show_date'],
|
|
'post_show_views' => $list['show_views'],
|
|
'post_show_category' => $list['show_category'],
|
|
'post_show_comments' => $list['show_comments'],
|
|
'post_show_likes' => $list['show_likes'],
|
|
'post_excerpt_length' => $list['excerpt_length'],
|
|
'paging_ajax_s' => AKSRT_Settings_Post_Display::is_list_paging_ajax() ? '1' : '0',
|
|
'paging_ajax_ias_s' => AKSRT_Settings_Post_Display::is_list_paging_ajax_ias(),
|
|
'post_pagination_mode' => self::get_post_pagination_mode(),
|
|
'render_mode' => $list['render_mode'],
|
|
'sticky_s' => $list['sticky_pages'],
|
|
'list_badge_show' => $list['badge_types'],
|
|
'target_blank' => $list['target_blank'],
|
|
'item_heading_bold' => $list['heading_bold'],
|
|
'list_meta_show' => $list['mobile_meta'],
|
|
'list_show_type' => $list['list_show_type'],
|
|
'ias_max' => $list['ias_max'],
|
|
'ajax_trigger' => $list['ajax_trigger_text'],
|
|
'ajax_nomore' => $list['ajax_nomore_text'],
|
|
'ajax_nomore_text' => $list['ajax_nomore_text'],
|
|
'post_list_columns' => $list['columns'],
|
|
'post_list_per_page' => $list['per_page'],
|
|
'list_list_style' => $list['list_style'],
|
|
'list_list_img_position' => $list['list_img_position'],
|
|
'list_list_scale' => $list['list_scale'],
|
|
'list_card_style' => $list['card_style'],
|
|
'list_card_scale' => $list['card_scale'],
|
|
'list_card_home' => $list['card_home'],
|
|
'list_card_cat' => $list['card_cat'],
|
|
'list_card_tag' => $list['card_tag'],
|
|
'list_card_topics' => $list['card_topics'],
|
|
'list_card_author' => $list['card_author'],
|
|
],
|
|
'thumb' => [
|
|
'thumb_priority' => implode(',', $thumb['priority']),
|
|
'thumb_fallback' => $thumb['fallback'],
|
|
'thumb_spare_images' => $thumb['spare_images'],
|
|
'thumb_lazy' => $thumb['lazy'],
|
|
'thumb_aspect_ratio' => $thumb['aspect_ratio'],
|
|
'thumb_multi_enabled' => $thumb['multi_enabled'],
|
|
'thumb_multi_count' => $thumb['multi_count'],
|
|
'list_thumb_fit' => $thumb['fit'],
|
|
'list_thumb_slides_s' => $thumb['slides_s'],
|
|
'list_thumb_video_s' => $thumb['video_s'],
|
|
'list_thumb_video_mute_s' => $thumb['video_mute_s'],
|
|
'thumb_postfirstimg_s' => $thumb['postfirstimg_s'],
|
|
'thumb_catimg_s' => $thumb['catimg_s'],
|
|
],
|
|
'filter' => [
|
|
'filter_enabled' => $filter['enabled'],
|
|
'filter_categories' => $filter['categories'],
|
|
'filter_tags' => $filter['tags'],
|
|
'filter_sort' => $filter['sort'],
|
|
],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* 获取"用户&互动"域的合并设置
|
|
*/
|
|
public static function get_user_interaction_settings(): array {
|
|
return [
|
|
'oauth' => self::get_oauth(),
|
|
'notifications' => self::get_notification_settings(),
|
|
'credits' => self::get_credit_settings(),
|
|
];
|
|
}
|
|
|
|
/**
|
|
* 获取"功能&权限"域的合并设置
|
|
*/
|
|
public static function get_permission_settings(): array {
|
|
return [
|
|
'moderation' => self::get_moderation(),
|
|
'capabilities' => self::get_user_capabilities(),
|
|
];
|
|
}
|
|
|
|
/**
|
|
* 获取"支付&付费"域的合并设置
|
|
*/
|
|
public static function get_payment_settings(): array {
|
|
return [
|
|
'paid' => self::get_paid_content_settings(),
|
|
'recharge' => self::get_payment_recharge_settings(),
|
|
'vip' => self::get_payment_vip_settings(),
|
|
'revenue' => self::get_payment_revenue_settings(),
|
|
'affiliate' => self::get_payment_affiliate_settings(),
|
|
'gateway' => self::get_payment_gateway_settings(),
|
|
'order' => self::get_order_settings(),
|
|
'card_pass' => self::get_card_pass_settings(),
|
|
'withdrawal' => self::get_withdrawal_settings(),
|
|
];
|
|
}
|
|
|
|
/**
|
|
* 获取 IP 归属地设置
|
|
*/
|
|
public static function get_ip_geo_settings(): array {
|
|
return AKSRT_Settings_Extension_Runtime::get_ip_geo_settings();
|
|
}
|
|
|
|
/**
|
|
* 获取内容审核设置
|
|
*/
|
|
public static function get_content_audit_settings(): array {
|
|
return AKSRT_Settings_Extension_Runtime::get_content_audit_settings();
|
|
}
|
|
|
|
/**
|
|
* 获取搜索引擎推送设置
|
|
*/
|
|
public static function get_search_push_settings(): array {
|
|
return AKSRT_Settings_Extension_Runtime::get_search_push_settings();
|
|
}
|
|
|
|
/**
|
|
* 获取短信接口设置
|
|
*/
|
|
public static function get_sms_settings(): array {
|
|
return AKSRT_Settings_Extension_Runtime::get_sms_settings();
|
|
}
|
|
}
|