- Storage: aksrt_floating_buttons now uses reference float_btn shape (fixed 8 sortable types, more-buttons group); single source of defaults/sanitize in AKSRT\Settings\FloatButtons - Admin SPA: CSF-parity page split into components/floating/* - Frontend: aksrt_float_right() on wp_footer mirrors zib_float_right() (wp_is_mobile, PC tooltip, toggle-theme, ontop/scrollTopTo, qrcode, wechat/qq, pay_vip, add, more) - CSS: floating-buttons.css rewritten from reference rules; legacy float rules removed from main/part/shell/overlay-primitives - Remove dead code: reorder route/API, get_floating_buttons_items, floatingSchema, floatActionsId, float-theme-toggle bindings, common/floating.css, aksrt-runtime-win.php, .aksrt-float-btn
144 lines
4.4 KiB
PHP
144 lines
4.4 KiB
PHP
<?php
|
|
/**
|
|
* @package AKSRT
|
|
*/
|
|
|
|
namespace AKSRT\Settings;
|
|
|
|
defined('ABSPATH') || exit;
|
|
|
|
trait CategoryIntegrationGroups {
|
|
|
|
/**
|
|
* 获取分类推荐配置(含默认值)
|
|
* @return array
|
|
*/
|
|
public static function get_category_recommend_settings(): array {
|
|
return CategoryRuntime::get_category_recommend_settings();
|
|
}
|
|
|
|
/**
|
|
* 获取分类封面图 URL(带优先级回退)
|
|
*
|
|
* 优先级:
|
|
* 1. aksrt_category_cover_id term meta
|
|
* 2. 该分类最新一篇有缩略图文章的缩略图
|
|
* 3. 默认占位图
|
|
*/
|
|
public static function get_category_cover_url(int $term_id): string {
|
|
return CategoryRuntime::get_category_cover_url($term_id);
|
|
}
|
|
|
|
/**
|
|
* 获取分类推荐描述(带优先级回退)
|
|
*
|
|
* 优先级:
|
|
* 1. aksrt_category_recommend_desc term meta
|
|
* 2. 原生 category description
|
|
* 3. 空字符串
|
|
*/
|
|
public static function get_category_recommend_desc(int $term_id): string {
|
|
return CategoryRuntime::get_category_recommend_desc($term_id);
|
|
}
|
|
|
|
/**
|
|
* 清理分类推荐缓存
|
|
*/
|
|
public static function flush_category_recommend_cache(): void {
|
|
CategoryRuntime::flush_category_recommend_cache();
|
|
}
|
|
|
|
/**
|
|
* 获取分类推荐渲染数据(带缓存)
|
|
*
|
|
* @param array $settings 分类推荐配置
|
|
* @return array 每项包含 term_id, name, description, count, link, cover, posts
|
|
*/
|
|
public static function get_category_recommend_items(array $settings): array {
|
|
return CategoryRuntime::get_category_recommend_items($settings);
|
|
}
|
|
|
|
/**
|
|
* 获取底部Tab完整配置
|
|
* @return array {enabled, scroll_hide, scroll_down_hide, items}
|
|
*/
|
|
public static function get_footer_tabbar_settings(): array {
|
|
return Integration::get_footer_tabbar_settings();
|
|
}
|
|
|
|
/**
|
|
* 获取底部Tab项(仅返回启用的,按排序)
|
|
* @return array
|
|
*/
|
|
public static function get_footer_tabbar_items(): array {
|
|
return Integration::get_footer_tabbar_items();
|
|
}
|
|
|
|
/**
|
|
* 获取文章页专属Tab模式
|
|
* @return string 'default' | 'extend'
|
|
*/
|
|
public static function get_footer_tabbar_single(): string {
|
|
return Integration::get_footer_tabbar_single();
|
|
}
|
|
|
|
/**
|
|
* 获取通知系统设置
|
|
* @return array {read_retention_days, unread_retention_days, max_per_user}
|
|
*/
|
|
public static function get_notification_settings(): array {
|
|
return Integration::get_notification_settings();
|
|
}
|
|
|
|
/** 单项通知是否启用 */
|
|
public static function notification_enabled(string $type): bool {
|
|
return Integration::notification_enabled($type);
|
|
}
|
|
|
|
/** user 徽标是否启用 */
|
|
public static function notification_user_badge_enabled(): bool {
|
|
return Integration::notification_user_badge_enabled();
|
|
}
|
|
|
|
/** user 徽标是否包含即时提醒 */
|
|
public static function notification_badge_include_stateful(): bool {
|
|
return Integration::notification_badge_include_stateful();
|
|
}
|
|
|
|
/**
|
|
* 获取右侧浮动按钮完整配置(结构见 FloatButtons::defaults())。
|
|
*/
|
|
public static function get_floating_buttons_settings(): array {
|
|
return Integration::get_floating_buttons_settings();
|
|
}
|
|
|
|
/**
|
|
* Customizer 注册(可选)
|
|
*/
|
|
public function customizer(\WP_Customize_Manager $wp_customize): void {
|
|
$wp_customize->add_setting('blogname', ['default' => get_bloginfo('name'), 'type' => 'option']);
|
|
|
|
$wp_customize->add_setting('aksrt_logo', [
|
|
'default' => '',
|
|
'sanitize_callback' => 'esc_url_raw',
|
|
'transport' => 'postMessage',
|
|
]);
|
|
$wp_customize->add_control(new \WP_Customize_Image_Control(
|
|
$wp_customize,
|
|
'aksrt_logo',
|
|
['label' => __('Logo', 'aksrt'), 'section' => 'title_tagline']
|
|
));
|
|
|
|
$wp_customize->add_setting('aksrt_favicon', [
|
|
'default' => '',
|
|
'sanitize_callback' => 'esc_url_raw',
|
|
'transport' => 'postMessage',
|
|
]);
|
|
$wp_customize->add_control(new \WP_Customize_Upload_Control(
|
|
$wp_customize,
|
|
'aksrt_favicon',
|
|
['label' => __('Favicon', 'aksrt'), 'section' => 'title_tagline']
|
|
));
|
|
}
|
|
}
|