Zibll 主线收口:统一 single 并清退 compat 资源路径
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
1 parent
0a6f97af21
commit
09f1eec909
26 files changed
+158
-1325
No files matched your search
@@ -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([
|
||||
|
||||
Reference in new issue
Block a user