Zibll 主线收口:统一 single 并清退 compat 资源路径

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
kate522andClaude committed 2026-07-09 20:30:49 +08:00
1 parent 0a6f97af21
commit 09f1eec909
26 files changed
+158 -1325

No files matched your search

@@ -135,12 +135,6 @@ class AKSRT_Settings_Home_Cms {
return array_key_exists($key, $f) ? $f[$key] : $default;
}
public static function get_homepage_modules(): array {
$s = AKSRT_Settings::get_all();
$mods = $s['homepage_modules'] ?? [];
return is_array($mods) ? array_values($mods) : [];
}
public static function homepage_allowed_sorts(): array {
return ['modified', 'date', 'views', 'likes', 'comments', 'favorites', 'downloads', 'rand'];
}
@@ -209,68 +203,6 @@ class AKSRT_Settings_Home_Cms {
return $settings['homepage_tabs'];
}
public static function maybe_migrate_homepage_tabs(): bool {
$all = AKSRT_Settings::get_all();
if (!empty($all['homepage_tabs_migrated'])) {
return false;
}
$existing_tabs = isset($all['homepage_tabs']) && is_array($all['homepage_tabs']) ? $all['homepage_tabs'] : [];
if (!empty($existing_tabs)) {
$all['homepage_tabs_migrated'] = true;
update_option('aksrt_settings', $all);
AKSRT_Settings::flush_settings_cache();
return false;
}
$legacy_tabs = [];
$modules = isset($all['homepage_modules']) && is_array($all['homepage_modules']) ? $all['homepage_modules'] : [];
foreach ($modules as $module) {
if (!is_array($module) || ($module['type'] ?? '') !== 'tabs') {
continue;
}
$config = isset($module['config']) && is_array($module['config']) ? $module['config'] : [];
$cat_ids = isset($config['cat_ids']) && is_array($config['cat_ids']) ? array_values(array_filter(array_map('intval', $config['cat_ids']))) : [];
foreach ($cat_ids as $cat_id) {
if ($cat_id <= 0) {
continue;
}
$term = get_term($cat_id, 'category');
if (!$term || is_wp_error($term)) {
continue;
}
$legacy_tabs[] = [
'term_id' => $cat_id,
'title' => $term->name,
'orderby' => 'date',
'enabled' => true,
];
}
break;
}
if (!empty($legacy_tabs)) {
$all['homepage_tabs'] = $legacy_tabs;
}
if (!isset($all['homepage_content_model'])) {
$all['homepage_content_model'] = 'mixed';
}
$all['homepage_tabs_migrated'] = true;
update_option('aksrt_settings', $all);
AKSRT_Settings::flush_settings_cache();
return true;
}
public static function homepage_card_style(): string {
$settings = self::get_homepage_fixed_settings();
return $settings['homepage_card_style'];
@@ -363,7 +295,7 @@ class AKSRT_Settings_Home_Cms {
$manual_note = trim((string) ($settings['payment_manual_delivery_note'] ?? ''));
$box_position = sanitize_key((string) ($settings['payment_paid_box_position'] ?? 'top'));
if (!in_array($box_position, ['box_top', 'top', 'bottom', 'box_bottom'], true)) {
if (!in_array($box_position, ['top', 'bottom'], true)) {
$box_position = 'top';
}
@@ -597,7 +529,7 @@ class AKSRT_Settings_Home_Cms {
$max_minutes = max(5, min(1440, (int) ($s['payment_order_max_minutes'] ?? 30)));
$box_position = sanitize_key((string) ($s['payment_box_position'] ?? 'top'));
if (!in_array($box_position, ['box_top', 'top', 'bottom', 'box_bottom'], true)) {
if (!in_array($box_position, ['top', 'bottom'], true)) {
$box_position = 'top';
}