diff --git a/inc/helpers/aksrt-pay.php b/inc/helpers/aksrt-pay.php index 5c90404e..7b83f092 100644 --- a/inc/helpers/aksrt-pay.php +++ b/inc/helpers/aksrt-pay.php @@ -1623,6 +1623,11 @@ if (!function_exists('aksrt_get_paid_box_html')) { $title_style = $count !== '' ? ' style="padding-right:48px"' : ''; $body_class = 'box-body relative' . ($pay_type === AKSRT_PAY_TYPE_VIDEO ? ' dplayer-featured' : ''); + // 付费后才展示的额外隐藏内容。整个函数只在有付费权限时才会走到这里, + // 因此无需再判断购买状态;HTML 由管理员在 metabox 里录入,已过 kses。 + $pay_extra_hide = trim((string) ($meta['pay_extra_hide'] ?? '')); + $pay_extra_hide = $pay_extra_hide !== '' ? '
' . $pay_extra_hide . '
' : ''; + return '' . $download_box + . $pay_extra_hide . $service . ''; } diff --git a/src/Core/DomainModel.php b/src/Core/DomainModel.php index c21c2add..a7f8430a 100644 --- a/src/Core/DomainModel.php +++ b/src/Core/DomainModel.php @@ -181,7 +181,6 @@ class DomainModel { 'video_pic' => '', 'video_title' => '', 'video_episode' => [], - 'video_scale_height' => 0, 'downloads' => [], 'attributes' => [], 'gallery' => [], @@ -194,9 +193,6 @@ class DomainModel { 'require_captcha' => false, // §3.8 电商增强字段 'virtual_sales' => 0, - 'stock' => -1, - 'card_keys' => [], - 'purchase_limit' => 0, 'free_preview' => '', 'show_sales' => true, // legacy: free daily quota overbuy price (cash or points by pay_modo). @@ -356,26 +352,6 @@ class DomainModel { return array_values(array_unique($gallery)); } - /** - * Sanitize card/key codes for auto-delivery. - * Each entry is a non-empty sanitized string (one code per line). - */ - public static function sanitize_card_keys($value): array { - if (!is_array($value)) { - return []; - } - - $keys = []; - foreach ($value as $key) { - $key = sanitize_text_field((string) $key); - if ($key !== '') { - $keys[] = $key; - } - } - - return $keys; - } - /** * @param array $raw * @return array @@ -409,7 +385,6 @@ class DomainModel { $meta['video_pic'] = esc_url_raw((string) ($raw['video_pic'] ?? '')); $meta['video_title'] = sanitize_text_field((string) ($raw['video_title'] ?? '')); $meta['video_episode'] = self::sanitize_video_episodes($raw['video_episode'] ?? []); - $meta['video_scale_height'] = max(0, min(200, (int) ($raw['video_scale_height'] ?? 0))); $meta['downloads'] = self::sanitize_downloads($raw['downloads'] ?? []); $meta['attributes'] = self::sanitize_attributes($raw['attributes'] ?? []); $meta['gallery'] = self::sanitize_gallery($raw['gallery'] ?? []); @@ -423,9 +398,6 @@ class DomainModel { // §3.8 电商增强字段 $meta['virtual_sales'] = max(0, (int) ($raw['virtual_sales'] ?? 0)); - $meta['stock'] = (int) ($raw['stock'] ?? -1); - $meta['card_keys'] = self::sanitize_card_keys($raw['card_keys'] ?? []); - $meta['purchase_limit'] = max(0, (int) ($raw['purchase_limit'] ?? 0)); $meta['free_preview'] = wp_kses_post((string) ($raw['free_preview'] ?? '')); $meta['show_sales'] = !isset($raw['show_sales']) || !empty($raw['show_sales']); $meta['download_limit_over_price'] = $meta['pay_modo'] === 'points' diff --git a/src/Core/ResourceMetaBox.php b/src/Core/ResourceMetaBox.php index eb582308..6e4fd07c 100644 --- a/src/Core/ResourceMetaBox.php +++ b/src/Core/ResourceMetaBox.php @@ -141,7 +141,6 @@ class ResourceMetaBox { upload('video_pic', __('视频封面(可选)', 'aksrt'), (string) ($meta['video_pic'] ?? ''), 'image'); ?> text('video_title', __('本集标题', 'aksrt'), (string) ($meta['video_title'] ?? ''), __('如需添加剧集则需填写此处', 'aksrt'), __('第1集', 'aksrt')); ?> group('video_episode', __('更多剧集', 'aksrt'), (array) ($meta['video_episode'] ?? []), 'video_row', __('添加剧集', 'aksrt'), __('为付费视频添加更多剧集。', 'aksrt')); ?> - number('video_scale_height', __('固定长宽比例', 'aksrt'), (string) ($meta['video_scale_height'] ?? 0), '5', '%', __('为 0 则不固定长宽比例。', 'aksrt')); ?>
@@ -336,7 +335,6 @@ class ResourceMetaBox { 'video_pic' => (string) ($raw['video_pic'] ?? ''), 'video_title' => (string) ($raw['video_title'] ?? ''), 'video_episode' => $raw['video_episode'] ?? [], - 'video_scale_height' => $raw['video_scale_height'] ?? 0, 'downloads' => $raw['downloads'] ?? [], 'attributes' => $raw['attributes'] ?? [], 'demo_url' => (string) ($raw['demo_url'] ?? ''), diff --git a/templates/pages/page-download-file.php b/templates/pages/page-download-file.php index 2622d3d9..92c4c086 100644 --- a/templates/pages/page-download-file.php +++ b/templates/pages/page-download-file.php @@ -40,7 +40,11 @@ if (!$is_download) { } $article_url = get_permalink($post) . '#posts-pay'; -$pay_title = get_the_title($post); +// 商品简介 / 更多详情 / 额外隐藏内容三个字段只在管理员填写时才有输出。 +$pay_title = trim((string) ($pay_meta['pay_title'] ?? '')) !== '' ? (string) $pay_meta['pay_title'] : get_the_title($post); +$pay_doc = trim((string) ($pay_meta['pay_doc'] ?? '')); +$pay_details = trim((string) ($pay_meta['pay_details'] ?? '')); +$pay_extra_hide = trim((string) ($pay_meta['pay_extra_hide'] ?? '')); $subtitle = ''; if (function_exists('get_the_subtitle')) { // noop — AKSRT may not have legacy subtitle helper @@ -115,6 +119,13 @@ get_header();
+ +
+ + +
+ +
+ +
+
diff --git a/tests/widget-system/post-editor-reference-contract.test.cjs b/tests/widget-system/post-editor-reference-contract.test.cjs index fb70dbd8..163674f8 100644 --- a/tests/widget-system/post-editor-reference-contract.test.cjs +++ b/tests/widget-system/post-editor-reference-contract.test.cjs @@ -249,7 +249,6 @@ test('article paid-content metabox follows the reference field set without shop 'promotion_tag', 'gallery_show', 'video_episode', - 'video_scale_height', 'downloads', 'attributes', 'pay_doc', @@ -259,6 +258,10 @@ test('article paid-content metabox follows the reference field set without shop assert.match(meta, /add_meta_box\('aksrt_pay_meta', __\('付费功能'/); fields.forEach((field) => assert.match(meta, new RegExp(field))); + + // video_scale_height 是参考主题轮播组件 widget 的参数,不属于付费视频字段, + // 当初误搬到付费 metabox 上且从未被消费,已移除。 + assert.doesNotMatch(meta, /video_scale_height/); assert.doesNotMatch(meta, /aksrt_pay_(?:stock|purchase_limit|card_keys|free_preview|require_login|require_captcha)/); assert.doesNotMatch(meta, /电商增强|parse_json_array/); });