fix(admin): replicate reference post-feature settings page 1:1

- Rewrite post_list/feature schema (PHP + JS) with the reference theme's
  field set, order, defaults and dependencies; print/PDF toggles dropped
- Move the migrated reference fields off the post-page schema (lightbox
  six switches, post like, default view/like ranges) to kill the dual path
- Map PostDisplay::get_post_page_settings() to the new keys without legacy
  fallback: imagelightbox* (pc_s/m_s checkboxes merged), post_like_s,
  post_default_mate ranges, article_nav + article_nav_mobile_nav_s
- Wire article_nav runtime: content data-nav/no-nav gate with per-post
  override, mobile drawer TOC box, imgbox_type config
- Seed random views/likes on new posts from post_default_mate ranges
- Keep the print stylesheet enqueued unconditionally (no switch); drop the
  dead print/PDF settings and needs_print requirement
- Add post-feature settings reference contract test
This commit is contained in:
2026-09-24 14:29:04 +08:00
parent c331b2aeef
commit 4d6b2c6045
12 changed files with 469 additions and 85 deletions
-2
View File
@@ -52,8 +52,6 @@ if (!function_exists('aksrt_resolve_single_post_display_settings')) :
'yiyan_header' => false,
'yiyan_footer' => false,
'yiyan_box' => false,
'print_enabled' => true,
'pdf_export_enabled' => false,
];
// Normalize legacy aliases → canonical render keys (idempotent).
if (!array_key_exists('share_enabled', $settings) && array_key_exists('share_s', $settings)) {
+10 -1
View File
@@ -602,11 +602,19 @@ if (!function_exists('aksrt_single_render_article')) :
function aksrt_single_render_article(array $ctx): void {
$settings = is_array($ctx['settings'] ?? null) ? $ctx['settings'] : [];
$maxheight = (int) $ctx['content_maxheight'];
// 文章目录树(参考主题 article_nav):全局开关 + 每篇文章「不显示目录树」覆盖。
$article_nav_on = !isset($settings['article_nav']) || !empty($settings['article_nav']);
if ($article_nav_on) {
$extension_meta = get_post_meta(get_the_ID(), \AKSRT\Core\DomainModel::POST_META_KEY, true);
if (is_array($extension_meta) && !empty($extension_meta['no_article-navs'])) {
$article_nav_on = false;
}
}
?>
<article <?php post_class('article main-bg theme-box box-body radius8 main-shadow'); ?>>
<?php aksrt_single_render_box_header($ctx); ?>
<div class="article-content">
<div class="article-content<?php echo $article_nav_on ? '' : ' no-nav'; ?>">
<?php if (!empty($settings['yiyan_header'])) : ?>
<?php
aksrt_render_yiyan_block([
@@ -626,6 +634,7 @@ if (!function_exists('aksrt_single_render_article')) :
<?php endif; ?>
<div class="theme-box wp-posts-content<?php echo $maxheight > 0 ? ' limit-height' : ''; ?>"
<?php echo $article_nav_on ? 'data-nav="posts"' : ''; ?>
<?php echo $maxheight > 0 ? ' style="max-height:' . esc_attr((string) $maxheight) . 'px;"' : ''; ?>
data-maxheight="<?php echo esc_attr((string) ($maxheight > 0 ? max(0, $maxheight - 80) : 0)); ?>">
<?php the_content(); ?>
+8 -1
View File
@@ -102,7 +102,14 @@ if (!function_exists('aksrt_nav_mobile_content')) :
echo $menu; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
if (is_singular('post')) {
echo '<div class="posts-nav-box" data-title="' . esc_attr__('文章目录', 'aksrt') . '"></div>';
$page = class_exists('\AKSRT\Settings\Settings')
? \AKSRT\Settings\Settings::get_post_page_settings()
: [];
$article_nav = !isset($page['article_nav']) || !empty($page['article_nav']);
$article_nav_mobile = !isset($page['article_nav_mobile']) || !empty($page['article_nav_mobile']);
if ($article_nav && $article_nav_mobile) {
echo '<div class="posts-nav-box" data-title="' . esc_attr__('文章目录', 'aksrt') . '"></div>';
}
}
// User box at bottom of drawer.