fix
This commit is contained in:
@@ -44,9 +44,6 @@ class PostMetaBox {
|
||||
$meta = array_merge($defaults, $saved);
|
||||
// New route only: episodes is always a list of {url,title}.
|
||||
$meta['featured_video_episode'] = self::sanitize_video_episodes($meta['featured_video_episode'] ?? []);
|
||||
if (!in_array((string) ($meta['show_toc'] ?? ''), ['', '0', '1'], true)) {
|
||||
$meta['show_toc'] = '';
|
||||
}
|
||||
return $meta;
|
||||
}
|
||||
|
||||
@@ -186,15 +183,6 @@ class PostMetaBox {
|
||||
<option value="none" <?php selected($meta['header_image_mode'], 'none'); ?>><?php esc_html_e('不显示', 'aksrt'); ?></option>
|
||||
</select>
|
||||
|
||||
<p>
|
||||
<label for="aksrt_show_toc"><strong><?php esc_html_e('目录树', 'aksrt'); ?></strong></label>
|
||||
<select name="aksrt_post_meta[show_toc]" id="aksrt_show_toc" class="widefat">
|
||||
<option value="" <?php selected((string) ($meta['show_toc'] ?? ''), ''); ?>><?php esc_html_e('跟随全局', 'aksrt'); ?></option>
|
||||
<option value="1" <?php selected((string) ($meta['show_toc'] ?? ''), '1'); ?>><?php esc_html_e('强制开启', 'aksrt'); ?></option>
|
||||
<option value="0" <?php selected((string) ($meta['show_toc'] ?? ''), '0'); ?>><?php esc_html_e('强制关闭', 'aksrt'); ?></option>
|
||||
</select>
|
||||
</p>
|
||||
|
||||
<p><strong><?php esc_html_e('单篇交互覆盖', 'aksrt'); ?></strong></p>
|
||||
<?php
|
||||
$toggle_fields = [
|
||||
@@ -384,8 +372,6 @@ class PostMetaBox {
|
||||
'cover_images' => isset($raw['cover_images']) ? sanitize_text_field($raw['cover_images']) : '',
|
||||
'custom_excerpt' => isset($raw['custom_excerpt']) ? sanitize_textarea_field($raw['custom_excerpt']) : '',
|
||||
'header_image_mode' => isset($raw['header_image_mode']) ? sanitize_key($raw['header_image_mode']) : '',
|
||||
// New route: '' follow | '1' force on | '0' force off.
|
||||
'show_toc' => isset($raw['show_toc']) && in_array((string) $raw['show_toc'], ['', '0', '1'], true) ? (string) $raw['show_toc'] : '',
|
||||
'show_reading_progress' => isset($raw['show_reading_progress']) ? sanitize_key((string) $raw['show_reading_progress']) : '',
|
||||
'enable_lightbox' => isset($raw['enable_lightbox']) ? sanitize_key((string) $raw['enable_lightbox']) : '',
|
||||
'show_related' => isset($raw['show_related']) ? sanitize_key((string) $raw['show_related']) : '',
|
||||
@@ -462,9 +448,8 @@ class PostMetaBox {
|
||||
echo esc_html($views > 0 ? (string) $views : '—');
|
||||
} elseif ($column === 'aksrt_likes') {
|
||||
$likes = (int) ($meta['likes'] ?? 0);
|
||||
$toc = esc_attr($meta['show_toc'] ?? '');
|
||||
$mh = (int) ($meta['maxheight'] ?? 0);
|
||||
echo '<span class="aksrt-col-data" data-views="' . (int) ($meta['views'] ?? 0) . '" data-likes="' . $likes . '" data-toc="' . $toc . '" data-maxheight="' . $mh . '">' . esc_html($likes > 0 ? (string) $likes : '—') . '</span>';
|
||||
echo '<span class="aksrt-col-data" data-views="' . (int) ($meta['views'] ?? 0) . '" data-likes="' . $likes . '" data-maxheight="' . $mh . '">' . esc_html($likes > 0 ? (string) $likes : '—') . '</span>';
|
||||
} elseif ($column === 'aksrt_sales') {
|
||||
$this->render_sales_column($post_id);
|
||||
}
|
||||
@@ -616,15 +601,6 @@ class PostMetaBox {
|
||||
<span class="title"><?php esc_html_e('点赞数', 'aksrt'); ?></span>
|
||||
<input type="number" name="aksrt_qe_likes" min="0" step="1" value="" class="aksrt-qe-likes">
|
||||
</label>
|
||||
<label class="alignleft">
|
||||
<span class="title"><?php esc_html_e('目录树', 'aksrt'); ?></span>
|
||||
<select name="aksrt_qe_toc" class="aksrt-qe-toc">
|
||||
<option value="-1"><?php esc_html_e('— 不更改 —', 'aksrt'); ?></option>
|
||||
<option value=""><?php esc_html_e('跟随全局', 'aksrt'); ?></option>
|
||||
<option value="1"><?php esc_html_e('显示', 'aksrt'); ?></option>
|
||||
<option value="0"><?php esc_html_e('隐藏', 'aksrt'); ?></option>
|
||||
</select>
|
||||
</label>
|
||||
<label class="alignleft">
|
||||
<span class="title"><?php esc_html_e('限高(px)', 'aksrt'); ?></span>
|
||||
<input type="number" name="aksrt_qe_maxheight" min="0" step="100" value="" class="aksrt-qe-maxheight" placeholder="<?php esc_attr_e('0=不限', 'aksrt'); ?>">
|
||||
@@ -745,19 +721,12 @@ class PostMetaBox {
|
||||
? max(0, (int) $_POST['aksrt_qe_likes'])
|
||||
: (int) ($existing['likes'] ?? 0);
|
||||
|
||||
$toc = $existing['show_toc'] ?? '';
|
||||
if (isset($_POST['aksrt_qe_toc']) && $_POST['aksrt_qe_toc'] !== '-1') {
|
||||
$toc_v = sanitize_key((string) $_POST['aksrt_qe_toc']);
|
||||
$toc = in_array($toc_v, ['', '0', '1'], true) ? $toc_v : ($existing['show_toc'] ?? '');
|
||||
}
|
||||
|
||||
$mh = isset($_POST['aksrt_qe_maxheight']) && $_POST['aksrt_qe_maxheight'] !== ''
|
||||
? max(0, (int) $_POST['aksrt_qe_maxheight'])
|
||||
: (int) ($existing['maxheight'] ?? 0);
|
||||
|
||||
$existing['views'] = $views;
|
||||
$existing['likes'] = $likes;
|
||||
$existing['show_toc'] = $toc;
|
||||
$existing['maxheight'] = $mh;
|
||||
|
||||
update_post_meta($post_id, self::META_KEY, $existing);
|
||||
@@ -800,7 +769,6 @@ class PostMetaBox {
|
||||
|
||||
var v = data.getAttribute('data-views') || '';
|
||||
var l = data.getAttribute('data-likes') || '';
|
||||
var toc = data.getAttribute('data-toc') || '';
|
||||
var mh = data.getAttribute('data-maxheight') || '';
|
||||
|
||||
var qv = form.querySelector('.aksrt-qe-views');
|
||||
@@ -808,8 +776,6 @@ class PostMetaBox {
|
||||
if (qv) qv.value = v;
|
||||
if (ql) ql.value = l;
|
||||
|
||||
var qToc = form.querySelector('.aksrt-qe-toc');
|
||||
if (qToc) qToc.value = toc;
|
||||
var qMh = form.querySelector('.aksrt-qe-maxheight');
|
||||
if (qMh) qMh.value = mh;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user