The theme was renamed Zibll/子比 → AKSRT → Jio, but upstream branding survived the sweeps in CSS classes, the SVG sprite prefix, a persisted widget field ID, JS events, admin Vue class names, test infrastructure and docblocks. Renames: - zib-widget / zib-widget-wrap / zib-slider → jio-widget-box / jio-widget-box-wrap / jio-slider-box (jio-widget is taken by the modern widget shell, jio-box-* by the card primitives) - zib-partners-scroll + zps-* → jio-partners-scroll + jps-* - zib-combo-info-card + zci-* → jio-combo-info-card + jci-* - zibsvg- → jiosvg-, including the exported picker helpers and the fa-zibsvg- family-prefix guard - zibpay_type → pay_type; the dual-read fallback in PostQuery collapses to a single key - [zibajax="submit"] dropped (no PHP emitter); zib_ajax.success → jio_ajax.success - aks-* admin Vue classes → jio-* - zib_palette() → palette() User-facing vendor traces are gone: the floating "more" button default no longer ships a zibll.com link or 子比主题 marketing copy, the notice widget ships no preset promo entries, and the four 官网教程 links are removed from the post-list admin schema. Test infrastructure renamed to neutral names (docker-compose.reference.yml, Caddyfile, article-baseline.json, modern-widgets-contract.test.cjs) with their DB/volume/env/slug identifiers following. Kept intentionally, documented in tests/fixtures/README.md: the golden fixture reference fingerprint (a SHA-256 record of an external directory, read by validate-widget-golden / generate-widget-golden-fixture / audit-widget-system), the doesNotMatch guards that prove the old tokens are gone, and the reference theme's own meta key in the visual fixtures. No backward-compat or data migration: saved widget configs holding old icon keys or the old field ID silently lose them, per the project's rewrite-over-compatibility rule. Verified: 132/132 node contract tests, php tests/widget-system/run.php (146 assertions), audit-admin-contracts, audit-psr4-paths and validate-widget-golden all green; tracked bundles regenerated and in sync. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
180 lines
6.0 KiB
PHP
180 lines
6.0 KiB
PHP
<?php
|
||
/**
|
||
* Fixed homepage layout renderer.
|
||
*
|
||
* @package Jio
|
||
*/
|
||
|
||
defined('ABSPATH') || exit;
|
||
|
||
if (!function_exists('jio_homepage_render_layout')) {
|
||
/**
|
||
* Render the fixed homepage layout (legacy latest-first content stream).
|
||
*
|
||
* Order (legacy-aligned):
|
||
* fluid top → main.container → top content → tabs/list → bottom content → sidebar
|
||
* → fluid bottom. Hero/header-slider is rendered from header.php, not here.
|
||
*/
|
||
function jio_homepage_render_layout(): void {
|
||
$main_list_enabled = !class_exists('\Jio\Settings\Settings') || \Jio\Settings\Settings::home_posts_list_enabled();
|
||
|
||
// Fluid zones live outside <main>, once only (removed from header.php).
|
||
jio_homepage_render_widget_zone(
|
||
['home_top_fluid'],
|
||
'fluid-widget-wrap jio-homepage__fluid-zone jio-homepage__fluid-zone--top'
|
||
);
|
||
?>
|
||
<main id="main-content" role="main" class="container site-main jio-homepage" tabindex="-1">
|
||
<div class="content-wrap jio-homepage__shell">
|
||
<div class="content-layout jio-homepage__content-layout jio-homepage__primary">
|
||
<?php
|
||
jio_homepage_render_widget_zone(
|
||
['home_top_content'],
|
||
'jio-homepage__content-zone jio-homepage__content-zone--top'
|
||
);
|
||
|
||
?>
|
||
|
||
<?php if ($main_list_enabled) :
|
||
$tab_configs = jio_homepage_get_current_page() === 1 ? jio_homepage_get_tab_configs() : [];
|
||
?>
|
||
<div class="home-tab-content">
|
||
<?php echo jio_homepage_get_tab_header_html($tab_configs); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||
<div class="tab-content">
|
||
<div class="posts-row ajaxpager tab-pane fade in active" id="index-tab-main">
|
||
<?php jio_homepage_render_ajax_option_menu(); ?>
|
||
<?php jio_homepage_render_posts_grid(jio_homepage_get_latest_query(), true); ?>
|
||
</div>
|
||
<?php echo jio_homepage_get_tab_panes_html($tab_configs); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||
</div>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<?php
|
||
jio_homepage_render_widget_zone(
|
||
['home_bottom_content'],
|
||
'jio-homepage__content-zone jio-homepage__content-zone--bottom'
|
||
);
|
||
?>
|
||
</div>
|
||
</div>
|
||
|
||
<?php jio_homepage_render_sidebar(); ?>
|
||
</main>
|
||
<?php
|
||
jio_homepage_render_widget_zone(
|
||
['home_bottom_fluid'],
|
||
'fluid-widget-wrap jio-homepage__fluid-zone jio-homepage__fluid-zone--bottom'
|
||
);
|
||
}
|
||
}
|
||
|
||
if (!function_exists('jio_homepage_get_tab_header_html')) {
|
||
/**
|
||
* 首页 tab 头:tab 导航 / 翻页标题条 / 空占位 三态。
|
||
*
|
||
* @param array<int, array<string, mixed>> $tab_configs Configured term tabs.
|
||
*/
|
||
function jio_homepage_get_tab_header_html(array $tab_configs): string {
|
||
$list_title = class_exists('\Jio\Settings\Settings')
|
||
? \Jio\Settings\Settings::home_list_title()
|
||
: '';
|
||
$fallback_title = $list_title !== '' ? $list_title : __('最新发布', 'jio');
|
||
$paged = jio_homepage_get_current_page();
|
||
|
||
//不是第一页
|
||
if ($paged > 1) {
|
||
return '<div class="box-body notop nobottom"><div class="title-theme">' . $fallback_title
|
||
. '<small class="ml10">' . esc_html(sprintf(__('第%s页', 'jio'), $paged)) . '</small></div></div>';
|
||
}
|
||
|
||
$index_tab_nav = '';
|
||
foreach ($tab_configs as $index => $tab_cfg) {
|
||
$index_tab_nav .= '<li><a data-toggle="tab" data-ajax="' . esc_url(jio_homepage_get_tab_link($tab_cfg))
|
||
. '" href="#index-tab-' . (int) $index . '">' . wp_kses_post($tab_cfg['title']) . '</a></li>';
|
||
}
|
||
|
||
if (!$index_tab_nav) {
|
||
return $list_title !== ''
|
||
? '<div class="box-body notop nobottom"><div class="title-theme">' . wp_kses_post($list_title) . '</div></div>'
|
||
: '<div></div>';
|
||
}
|
||
|
||
$html = '<li class="active"><a data-toggle="tab" href="#index-tab-main">' . wp_kses_post($fallback_title) . '</a></li>' . $index_tab_nav;
|
||
|
||
return '<div class="index-tab affix-header-sm relative home-tab-nav-box mb10" offset-top="-8"><ul style="width:100%;" class="scroll-x no-scrollbar">' . $html . '</ul></div>';
|
||
}
|
||
}
|
||
|
||
if (!function_exists('jio_homepage_get_tab_panes_html')) {
|
||
/**
|
||
* 每个栏目的原位刷新 pane。
|
||
*
|
||
* pane 本身就是 .ajaxpager;post_ajax_trigger 指向栏目页,post_ajax 加载后
|
||
* 用栏目页自身的列表 DOM 原地替换 loader,不新建区域。
|
||
*
|
||
* @param array<int, array<string, mixed>> $tab_configs Configured term tabs.
|
||
*/
|
||
function jio_homepage_get_tab_panes_html(array $tab_configs): string {
|
||
if (!$tab_configs) {
|
||
return '';
|
||
}
|
||
|
||
$html = '';
|
||
foreach ($tab_configs as $index => $tab_cfg) {
|
||
$config = jio_archive_get_render_config(['context' => 'category', 'term_id' => (int) $tab_cfg['term_id']]);
|
||
$is_card = ($config['mode'] ?? 'list') === 'card';
|
||
$placeholder = jio_render_placeholder($is_card ? 'card' : 'list', $is_card ? (wp_is_mobile() ? 4 : 12) : (wp_is_mobile() ? 4 : 6));
|
||
$html .= '<div class="ajaxpager tab-pane fade" id="index-tab-' . (int) $index . '">';
|
||
$html .= '<span class="post_ajax_trigger"><a class="ajax_load ajax-next ajax-open" href="' . esc_url(jio_homepage_get_tab_link($tab_cfg)) . '"></a></span>';
|
||
$html .= '<div class="post_ajax_loader">' . $placeholder . '</div>';
|
||
$html .= '</div>';
|
||
}
|
||
|
||
return $html;
|
||
}
|
||
}
|
||
|
||
if (!function_exists('jio_homepage_get_tab_link')) {
|
||
/**
|
||
* 栏目 tab 的加载链接:栏目页 + nofilter(抑制响应页的筛选菜单)。
|
||
*
|
||
* @param array<string, mixed> $tab_cfg Tab config with term and orderby.
|
||
*/
|
||
function jio_homepage_get_tab_link(array $tab_cfg): string {
|
||
$term = $tab_cfg['term'] ?? null;
|
||
if (!$term instanceof WP_Term) {
|
||
return home_url('/');
|
||
}
|
||
|
||
$query_arg = ['nofilter' => 'true'];
|
||
if (!empty($tab_cfg['orderby'])) {
|
||
$query_arg['orderby'] = $tab_cfg['orderby'];
|
||
}
|
||
|
||
$link = get_term_link($term);
|
||
if (is_wp_error($link)) {
|
||
return home_url('/');
|
||
}
|
||
|
||
return add_query_arg($query_arg, $link);
|
||
}
|
||
}
|
||
|
||
if (!function_exists('jio_render_fixed_homepage')) {
|
||
/**
|
||
* Render the new fixed homepage layout.
|
||
*/
|
||
function jio_render_fixed_homepage(): bool {
|
||
if (!jio_is_fixed_homepage_request()) {
|
||
return false;
|
||
}
|
||
|
||
get_header();
|
||
jio_homepage_render_layout();
|
||
get_footer();
|
||
|
||
return true;
|
||
}
|
||
}
|