修复AJAX 引擎

This commit is contained in:
kate522 committed 2026-08-23 18:01:56 +08:00
1 parent c4512f2bc2
commit 616beb8c03
8 files changed
+50 -32

No files matched your search

+10 -15
View File
@@ -9,19 +9,6 @@
defined('ABSPATH') || exit;
if (!function_exists('aksrt_archive_get_list_style_settings')) :
/**
* Shared list style defaults for archive surfaces.
*
* @return array<string,mixed>
*/
function aksrt_archive_get_list_style_settings(): array {
return class_exists('\AKSRT\Settings\Settings')
? \AKSRT\Settings\Settings::get_post_list_style_settings()
: [];
}
endif;
if (!function_exists('aksrt_resolve_post_list_render_config')) :
/**
* Build the legacy-shaped arguments used by every list surface.
@@ -34,11 +21,14 @@ if (!function_exists('aksrt_resolve_post_list_render_config')) :
* @return array<string,mixed>
*/
function aksrt_resolve_post_list_render_config(array $args = []): array {
$has_top_level_term_id = array_key_exists('term_id', $args);
$args = wp_parse_args($args, [
'context' => '',
'term_id' => 0,
'overrides' => [],
]);
$overrides = is_array($args['overrides']) ? $args['overrides'] : [];
$has_override_term_id = array_key_exists('term_id', $overrides);
$context = sanitize_key((string) ($args['context'] ?: ($overrides['context'] ?? '')));
if ($context === '') {
if (function_exists('is_front_page') && (is_front_page() || is_home())) {
@@ -55,17 +45,22 @@ if (!function_exists('aksrt_resolve_post_list_render_config')) :
$context = 'archive';
}
}
$term_id = $has_override_term_id ? absint($overrides['term_id']) : absint($args['term_id']);
if ($context === 'category' && !$has_top_level_term_id && !$has_override_term_id) {
$term_id = absint(get_queried_object_id());
}
$config = [
'context' => $context,
'term_id' => $term_id,
'is_home' => $context === 'home',
'is_category' => $context === 'category',
'is_tag' => $context === 'tag',
'is_author' => $context === 'author',
'is_search' => $context === 'search',
];
foreach (['type', 'no_author', 'no_margin', 'is_mult_thumb', 'is_no_thumb', 'is_card', 'highlight_query', 'wrapper_class', 'skip_wrapper'] as $key) {
foreach (['type', 'term_id', 'no_author', 'no_margin', 'is_mult_thumb', 'is_no_thumb', 'is_card', 'highlight_query', 'wrapper_class', 'skip_wrapper'] as $key) {
if (array_key_exists($key, $overrides)) {
$config[$key] = $overrides[$key];
$config[$key] = $key === 'term_id' ? absint($overrides[$key]) : $overrides[$key];
}
}
return aksrt_renderer_config($config);