fix(frontend): close single 1:1 residuals without legacy paths

Unify TOC ownership, real video episode list, slider overlay, single-query related list, Zibll user-card after-box, and new-route subtitle/meta contracts.
This commit is contained in:
kate522 committed 2026-07-13 13:18:19 +08:00
1 parent 48f7436030
commit 5ce43c4326
10 files changed
+1373 -1298

No files matched your search

+21 -5
View File
@@ -65,6 +65,8 @@ function aksrt_render_slider(array $args = []): string {
'slider_class' => '',
'show_nav' => true,
'show_pagination' => true,
// Optional absolute overlay HTML (e.g. single cover title/meta). Not escaped.
'overlay_html' => '',
];
$args = wp_parse_args($args, $defaults);
@@ -90,7 +92,13 @@ function aksrt_render_slider(array $args = []): string {
// 高度样式
$height_style = '';
if ($args['scale_height']) {
$height_style = sprintf('--pc-height:auto;--m-height:auto;--scale-ratio:%s;', esc_attr((string) $args['scale_ratio']));
// padding-bottom percentage for ratio box (Zibll graphic cover style).
$ratio_pct = max(10, min(100, (float) $args['scale_ratio'] * 100));
$height_style = sprintf(
'--pc-height:auto;--m-height:auto;--scale-ratio:%s;padding-bottom:%s%%;',
esc_attr((string) $args['scale_ratio']),
esc_attr((string) $ratio_pct)
);
} else {
$height_style = sprintf('--pc-height:%s;--m-height:%s;', esc_attr($args['pc_height']), esc_attr($args['m_height']));
}
@@ -102,11 +110,13 @@ function aksrt_render_slider(array $args = []): string {
$wrapper_classes = ['aksrt-slider-wrapper'];
if ($args['wrapper_class']) $wrapper_classes[] = $args['wrapper_class'];
if ($args['scale_height']) $wrapper_classes[] = 'aksrt-slider-wrapper--scale';
if ((string) $args['overlay_html'] !== '') $wrapper_classes[] = 'aksrt-slider-wrapper--has-overlay';
$wrapper_class_str = implode(' ', $wrapper_classes);
// 渲染 HTML
$html = '<div class="' . esc_attr($wrapper_class_str) . '">';
$html .= '<div class="' . esc_attr($slider_class_str) . '" ' . implode(' ', $data_attrs) . ' style="' . esc_attr($height_style) . '">';
$html = '<div class="' . esc_attr($wrapper_class_str) . '"' . ($args['scale_height'] ? ' style="position:relative;' . esc_attr(sprintf('padding-bottom:%s%%;', (string) max(10, min(100, (float) $args['scale_ratio'] * 100)))) . '"' : '') . '>';
$html .= '<div class="' . esc_attr($slider_class_str) . '" ' . implode(' ', $data_attrs) . ' style="' . esc_attr($height_style) . ($args['scale_height'] ? 'position:absolute;inset:0;width:100%;height:100%;' : '') . '">';
$html .= '<div class="swiper-wrapper">';
foreach ($slides as $slide) {
@@ -116,7 +126,7 @@ function aksrt_render_slider(array $args = []): string {
$desc = sanitize_text_field($slide['desc'] ?? '');
$alt = sanitize_text_field($slide['alt'] ?? $title);
$bg_color = sanitize_hex_color($slide['bg_color'] ?? '');
$target = $slide['target'] === '_blank' ? '_blank' : '_self';
$target = ($slide['target'] ?? '') === '_blank' ? '_blank' : '_self';
$slide_style = $bg_color ? 'background-color:' . esc_attr($bg_color) . ';' : '';
@@ -127,7 +137,7 @@ function aksrt_render_slider(array $args = []): string {
}
if ($image) {
$html .= '<img class="swiper-lazy" data-src="' . esc_url($image) . '" alt="' . esc_attr($alt) . '" loading="lazy">';
$html .= '<img class="swiper-lazy fit-cover" data-src="' . esc_url($image) . '" src="' . esc_url($image) . '" alt="' . esc_attr($alt) . '" loading="lazy">';
$html .= '<div class="swiper-lazy-preloader"></div>';
}
@@ -158,6 +168,12 @@ function aksrt_render_slider(array $args = []): string {
}
$html .= '</div>'; // .new-swiper
// Cover title/meta overlay (trusted HTML from single cover renderer).
if ((string) $args['overlay_html'] !== '') {
$html .= '<div class="aksrt-slider-overlay">' . $args['overlay_html'] . '</div>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
$html .= '</div>'; // .aksrt-slider-wrapper
return $html;