Zibll 主线收口:统一 single 并清退 compat 资源路径
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -32,20 +32,6 @@ class AKSRT_Admin_Extension_Controller extends AKSRT_Admin_Controller_Base {
|
||||
'permission_callback' => [$this, 'check_permission'],
|
||||
]);
|
||||
|
||||
// Docs page stats
|
||||
register_rest_route(self::API_NAMESPACE, '/docs/stats', [
|
||||
'methods' => 'GET',
|
||||
'callback' => [$this, 'get_docs_stats'],
|
||||
'permission_callback' => [$this, 'check_permission'],
|
||||
]);
|
||||
|
||||
// Docs search (public, for frontend AJAX)
|
||||
register_rest_route(self::API_NAMESPACE, '/docs/search', [
|
||||
'methods' => 'GET',
|
||||
'callback' => [$this, 'search_docs'],
|
||||
'permission_callback' => '__return_true',
|
||||
]);
|
||||
|
||||
// Extensions service status summary (aggregated)
|
||||
register_rest_route(self::API_NAMESPACE, '/settings/extensions', [
|
||||
'methods' => 'GET',
|
||||
@@ -126,36 +112,11 @@ class AKSRT_Admin_Extension_Controller extends AKSRT_Admin_Controller_Base {
|
||||
}
|
||||
|
||||
public function get_docs_stats(): WP_REST_Response {
|
||||
$nav_count = 0;
|
||||
$special_count = 0;
|
||||
|
||||
$nav_query = new WP_Query([
|
||||
'post_type' => 'page',
|
||||
'post_status' => 'publish',
|
||||
'meta_key' => '_wp_page_template',
|
||||
'meta_value' => 'templates/pages/page-documentnav.php',
|
||||
'posts_per_page' => 1,
|
||||
'fields' => 'ids',
|
||||
'no_found_rows' => false,
|
||||
]);
|
||||
$nav_count = (int) $nav_query->found_posts;
|
||||
|
||||
$special_query = new WP_Query([
|
||||
'post_type' => 'page',
|
||||
'post_status' => 'publish',
|
||||
'meta_key' => '_wp_page_template',
|
||||
'meta_value' => 'templates/pages/page-special.php',
|
||||
'posts_per_page' => 1,
|
||||
'fields' => 'ids',
|
||||
'no_found_rows' => false,
|
||||
]);
|
||||
$special_count = (int) $special_query->found_posts;
|
||||
|
||||
return $this->success([
|
||||
'data' => [
|
||||
'total' => $nav_count + $special_count,
|
||||
'nav_count' => $nav_count,
|
||||
'special_count' => $special_count,
|
||||
'total' => 0,
|
||||
'nav_count' => 0,
|
||||
'special_count' => 0,
|
||||
],
|
||||
]);
|
||||
}
|
||||
@@ -164,24 +125,10 @@ class AKSRT_Admin_Extension_Controller extends AKSRT_Admin_Controller_Base {
|
||||
* GET /docs/search — search document pages by keyword.
|
||||
*/
|
||||
public function search_docs(WP_REST_Request $request): WP_REST_Response {
|
||||
$keyword = trim(sanitize_text_field((string) $request->get_param('keyword')));
|
||||
$root_id = (int) $request->get_param('root_id');
|
||||
$limit = max(1, min(50, (int) ($request->get_param('limit') ?: 20)));
|
||||
|
||||
if ($keyword === '') {
|
||||
return $this->success(['data' => ['results' => [], 'total' => 0]]);
|
||||
}
|
||||
|
||||
if (!class_exists('AKSRT_Docs_Presenter')) {
|
||||
return $this->success(['data' => ['results' => [], 'total' => 0]]);
|
||||
}
|
||||
|
||||
$results = AKSRT_Docs_Presenter::get_instance()->search_pages($keyword, $root_id, $limit);
|
||||
|
||||
return $this->success([
|
||||
'data' => [
|
||||
'results' => $results,
|
||||
'total' => count($results),
|
||||
'results' => [],
|
||||
'total' => 0,
|
||||
],
|
||||
]);
|
||||
}
|
||||
@@ -439,13 +386,12 @@ class AKSRT_Admin_Extension_Controller extends AKSRT_Admin_Controller_Base {
|
||||
$services['push'] = ['enabled' => false, 'provider' => '', 'configured' => false, 'available' => false, 'verified' => false, 'transport' => '', 'missing_fields' => []];
|
||||
}
|
||||
|
||||
// Docs Mode
|
||||
$docs_en = !empty($settings['docs_mode_enabled']);
|
||||
// Docs Mode (compat path is retired from rebuilt mainline)
|
||||
$services['docs_mode'] = [
|
||||
'enabled' => $docs_en,
|
||||
'enabled' => false,
|
||||
'provider' => 'builtin',
|
||||
'configured' => $docs_en,
|
||||
'available' => $docs_en,
|
||||
'configured' => false,
|
||||
'available' => false,
|
||||
'verified' => true,
|
||||
'transport' => 'builtin',
|
||||
'missing_fields' => [],
|
||||
|
||||
@@ -9,7 +9,6 @@ trait AKSRT_Admin_Global_Controller_Part_2 {
|
||||
|
||||
if ($request->get_method() === 'GET') {
|
||||
$data = AKSRT_Settings::get_homepage_fixed_settings();
|
||||
$data['homepage_modules'] = AKSRT_Settings::get_homepage_modules();
|
||||
return rest_ensure_response([
|
||||
'code' => 'success',
|
||||
'data' => $data,
|
||||
@@ -104,30 +103,6 @@ trait AKSRT_Admin_Global_Controller_Part_2 {
|
||||
$settings['homepage_tabs'] = $tabs;
|
||||
}
|
||||
|
||||
if (isset($params['homepage_modules']) && is_array($params['homepage_modules'])) {
|
||||
$modules = [];
|
||||
$allowed_types = [
|
||||
'hero', 'banner', 'category', 'tabs', 'ranking', 'recent',
|
||||
'tag_cloud', 'friend_links', 'html', 'hotspot',
|
||||
'category_recommend_cards', 'text_title', 'button_group',
|
||||
'spacing', 'faq', 'data_grid', 'highlight_cards',
|
||||
'partner_marquee', 'product_showcase',
|
||||
];
|
||||
foreach ($params['homepage_modules'] as $module) {
|
||||
if (!is_array($module) || !in_array($module['type'] ?? '', $allowed_types, true)) {
|
||||
continue;
|
||||
}
|
||||
$modules[] = [
|
||||
'id' => sanitize_text_field($module['id'] ?? uniqid('mod_')),
|
||||
'type' => sanitize_text_field($module['type']),
|
||||
'config' => is_array($module['config'] ?? null) ? $module['config'] : [],
|
||||
'enabled' => !empty($module['enabled']),
|
||||
'title' => sanitize_text_field($module['title'] ?? ''),
|
||||
];
|
||||
}
|
||||
$settings['homepage_modules'] = $modules;
|
||||
}
|
||||
|
||||
$current = get_option($option_key, []);
|
||||
if (!is_array($current)) {
|
||||
$current = [];
|
||||
@@ -141,7 +116,6 @@ trait AKSRT_Admin_Global_Controller_Part_2 {
|
||||
AKSRT_Settings::flush_settings_cache();
|
||||
update_option('aksrt_homepage_schema_version', gmdate('Y-m-d'));
|
||||
delete_transient('aksrt_homepage_cached_images');
|
||||
delete_transient('aksrt_homepage_modules_cache');
|
||||
do_action('aksrt_homepage_settings_changed');
|
||||
|
||||
return rest_ensure_response([
|
||||
|
||||
@@ -35,10 +35,8 @@ class AKSRT_Admin_Schema_Payment {
|
||||
['key' => 'payment_paid_show_user', 'label' => '显示购买用户', 'type' => 'switch', 'default' => true],
|
||||
['key' => 'payment_paid_show_paycount', 'label' => '显示购买次数', 'type' => 'switch', 'default' => true],
|
||||
['key' => 'payment_paid_box_position', 'label' => '付费框位置', 'type' => 'radio', 'default' => 'top', 'options' => [
|
||||
['label' => '文章模块上', 'value' => 'box_top'],
|
||||
['label' => '内容顶', 'value' => 'top'],
|
||||
['label' => '内容底', 'value' => 'bottom'],
|
||||
['label' => '模块下', 'value' => 'box_bottom'],
|
||||
['label' => '内容顶部(正文前)', 'value' => 'top'],
|
||||
['label' => '内容底部(正文后)', 'value' => 'bottom'],
|
||||
]],
|
||||
]],
|
||||
['key' => 'download', 'title' => '下载能力', 'fields' => [
|
||||
@@ -294,10 +292,8 @@ class AKSRT_Admin_Schema_Payment {
|
||||
['key' => 'display', 'title' => '展示设置', 'fields' => [
|
||||
['key' => 'payment_mark', 'label' => '付费标记', 'type' => 'input', 'default' => '付费'],
|
||||
['key' => 'payment_box_position', 'label' => '付费框位置', 'type' => 'radio', 'default' => 'top', 'options' => [
|
||||
['label' => '文章模块上', 'value' => 'box_top'],
|
||||
['label' => '内容顶', 'value' => 'top'],
|
||||
['label' => '内容底', 'value' => 'bottom'],
|
||||
['label' => '模块下', 'value' => 'box_bottom'],
|
||||
['label' => '内容顶部(正文前)', 'value' => 'top'],
|
||||
['label' => '内容底部(正文后)', 'value' => 'bottom'],
|
||||
]],
|
||||
['key' => 'payment_free_logged_show', 'label' => '登录用户显示免费', 'type' => 'switch', 'default' => false],
|
||||
['key' => 'payment_show_ip', 'label' => '显示用户IP', 'type' => 'switch', 'default' => false],
|
||||
|
||||
Reference in New Issue
Block a user