Files
kate522 5fd7c212ed fix(runtime): 按参考主题硬切换为 loader/main/auto_fun 单一 DOM 生命周期
- 删除 AksrtFrontend registry/rehydrate 双路架构及 build/public.js 拼包入口,
  前台唯一初始路径为 PHP 本地栈(jQuery 1.9.1 → Bootstrap 3.4.1)
  → loader_js(_win/aksrtData 唯一注入)→ tbquire(['main']) → runtime/main.min.js
- window.auto_fun = debounce(z_auto_fun, 100) 为唯一重扫入口;所有模块改为
  执行一次 + off/on('auto_fun.aksrt-*') 命名空间重扫,data/class 标记幂等
- 局部更新协议统一:HTML 注入 → post_ajax.ed → auto_fun();
  远程 modal → loaded.bs.modal → auto_fun();JSON 成功 → zib_ajax.success
- 灯箱恢复 Miniimgbox/imgbox 唯一 owner(imgbox-container、a[data-imgbox]、
  imgbox_data),删除 AksrtLightbox/data-aksrt-lightbox 第二实现及 CSS/overlay,
  _win.imgbox* 重新接上 post-display 设置
- 死代码清理:runtime 下 11 组被自有实现替代的旧模块副本、无消费 vendored 库、
  顶层 grade.min.js、revenue.js、无调用方的 aksrt_get_win_runtime_config(),
  以及 loader 中 16 条死 mapping
- PHP 入队改为本地栈 + loader_js,routed/widget/submit 依赖统一换绑;
  用户卡片发布按钮恢复 nav_user_newposts_btn 设置门控
- 测试对齐:新增 frontend-lifecycle-contract,重写 navigation/lazyload/toast/
  auth-source/comment/page-display/post-visual 等断言为目标架构契约

验证:node --test widget-system+navigation 223 通过 0 失败;
构建脚本重建 main/imgbox min 与 CSS bundles;改动 PHP php -l、JS node --check
全部通过;git diff --check 干净;credits 重入 harness 通过。
2026-09-03 12:44:31 +08:00

111 lines
3.7 KiB
PHP

<?php
/**
* 固定页面模板
*
* @package AKSRT
*/
defined('ABSPATH') || exit;
get_header();
$page_settings = class_exists('\AKSRT\Settings\Settings')
? \AKSRT\Settings\Settings::get_post_page_settings()
: ['reading_progress' => false, 'lightbox' => true];
$page_id = get_queried_object_id();
$page_content_style = get_post_meta($page_id, 'page_content_style', true);
$page_content_style = $page_content_style !== '' ? sanitize_html_class($page_content_style) : 'default';
$show_sidebar = function_exists('aksrt_is_show_sidebar') ? aksrt_is_show_sidebar() : true;
?>
<?php if (!empty($page_settings['reading_progress'])) : ?>
<div id="reading-progress-global" class="reading-progress-bar" role="progressbar" aria-label="<?php esc_attr_e('阅读进度', 'aksrt'); ?>" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"></div>
<?php endif; ?>
<?php
// legacy page.php: fluid top OUTSIDE main; main.container + content-wrap/layout + sidebar sibling.
// Do not put content-shell padding/max-width on the dual-column host (breaks float math).
?>
<?php if (is_active_sidebar('page_top_fluid_' . $page_id)) : ?>
<div class="fluid-widget-wrap">
<?php dynamic_sidebar('page_top_fluid_' . $page_id); ?>
</div>
<?php endif; ?>
<main id="main-content" class="site-main container page-content-<?php echo esc_attr($page_content_style); ?> page-id-<?php echo esc_attr((string) $page_id); ?>" tabindex="-1">
<div class="content-wrap">
<div class="content-layout">
<?php if (is_active_sidebar('page_top_content_' . $page_id)) : ?>
<?php dynamic_sidebar('page_top_content_' . $page_id); ?>
<?php endif; ?>
<?php
while (have_posts()) :
the_post();
$page_meta_header_style = get_post_meta(get_the_ID(), 'page_header_style', true);
$ph_style_override = null;
if ($page_meta_header_style !== '' && in_array($page_meta_header_style, ['', '1', '2', '3', 'not'], true)) {
$ph_style_override = ($page_meta_header_style === 'not') ? '' : $page_meta_header_style;
}
$page_cover = (string) get_post_meta(get_the_ID(), 'page_header_cover_img', true);
$header_args = [
'title' => get_the_title(),
];
if ($ph_style_override !== null) {
$header_args['style'] = $ph_style_override;
}
if ($page_cover !== '') {
$header_args['cover'] = esc_url($page_cover);
}
?>
<article <?php post_class('entry-page'); ?>>
<?php get_template_part('templates/parts/page-header', null, $header_args); ?>
<?php if (has_post_thumbnail()) : ?>
<figure class="entry-thumb">
<?php the_post_thumbnail('large'); ?>
</figure>
<?php endif; ?>
<div class="entry-content<?php echo !empty($page_settings['lightbox']) ? ' imgbox-container' : ''; ?>">
<?php the_content(); ?>
<?php
wp_link_pages([
'before' => '<nav class="page-links"><span class="page-links-title">' . esc_html__('分页:', 'aksrt') . '</span>',
'after' => '</nav>',
]);
?>
</div>
</article>
<?php
// 评论关闭时模板整体不渲染(legacy 行为),无需空卡片。
if (comments_open()) {
echo '<div class="theme-box box-body radius8 main-shadow comments-card">';
comments_template();
echo '</div>';
}
endwhile;
?>
<?php if (is_active_sidebar('page_bottom_content_' . $page_id)) : ?>
<?php dynamic_sidebar('page_bottom_content_' . $page_id); ?>
<?php endif; ?>
</div>
</div>
<?php if ($show_sidebar) : ?>
<?php get_sidebar(); ?>
<?php endif; ?>
</main>
<?php if (is_active_sidebar('page_bottom_fluid_' . $page_id)) : ?>
<div class="fluid-widget-wrap">
<?php dynamic_sidebar('page_bottom_fluid_' . $page_id); ?>
</div>
<?php endif; ?>
<?php
get_footer();