diff --git a/inc/helpers/aksrt-pay.php b/inc/helpers/aksrt-pay.php index 6db12403..234ece7d 100644 --- a/inc/helpers/aksrt-pay.php +++ b/inc/helpers/aksrt-pay.php @@ -1054,7 +1054,6 @@ if (!function_exists('aksrt_get_pay_service_html')) { $service = is_array($order['service'] ?? null) ? $order['service'] : []; } - $items = []; $text = trim((string) ($service['text'] ?? '')); $value = trim((string) ($service['value'] ?? '')); $icon = trim((string) ($service['icon'] ?? 'fa fas fa-check-circle')); @@ -1062,7 +1061,6 @@ if (!function_exists('aksrt_get_pay_service_html')) { $icon = 'fa fas fa-check-circle'; } - // Support multi-line pay_service textarea (one bullet per line). $lines = []; if ($text !== '') { $lines = preg_split('/\r\n|\r|\n/', $text) ?: []; @@ -1072,15 +1070,6 @@ if (!function_exists('aksrt_get_pay_service_html')) { } $lines = array_values(array_filter(array_map('trim', $lines))); - if ($lines === []) { - // Defaults aligned with previous hardcoded guarantees. - $lines = [ - __('安全检测', 'aksrt'), - __('支持 VIP 权益', 'aksrt'), - __('支持积分结算', 'aksrt'), - ]; - } - $html = ''; foreach ($lines as $line) { $html .= ''; @@ -1253,6 +1242,8 @@ if (!function_exists('aksrt_get_paywall_html')) { $attrs = aksrt_get_pay_attributes_html($post, 'pay-attr'); $count = $sales > 0 ? '' . esc_html(sprintf(__('已售 %s', 'aksrt'), $sales)) . '' : ''; $service = aksrt_get_pay_service_html('muted-2-color'); + $widget_service = $service !== '' ? '
' . $service . '
' : ''; + $article_service = $service !== '' ? '
' . $service . '
' : ''; $demo = aksrt_get_demo_link_html($post, 'but jb-yellow padding-lg'); $demo_row = $demo !== '' ? '
' . $demo . '
' : ''; $discount = $modo === '0' ? aksrt_get_post_rebate_discount($post) : '0.00'; @@ -1268,11 +1259,11 @@ if (!function_exists('aksrt_get_paywall_html')) { AKSRT_PAY_TYPE_VIDEO => '' . esc_html__('查看视频', 'aksrt'), ]; $view_label = $view_labels[$pay_type] ?? '' . esc_html__('查看内容', 'aksrt'); - return ''; + return ''; } if ($is_widget) { - return '
' . $tag . '
' . $price . '
' . $vip . '
' . $discount_banner . '
' . $service . '
' . $button . '
' . $demo_row . $attrs . '
' . $count . '
'; + return '
' . $tag . '
' . $price . '
' . $vip . '
' . $discount_banner . '
' . $widget_service . '
' . $button . '
' . $demo_row . $attrs . '
' . $count . '
'; } $thumb = get_the_post_thumbnail($post, 'medium', ['class' => 'fit-cover', 'alt' => '']); @@ -1296,7 +1287,7 @@ if (!function_exists('aksrt_get_paywall_html')) { $graphic = '
' . $thumb . $graphic_actions . '
'; } $demo_mobile = $demo !== '' ? '
' . $demo . '
' : ''; - return '
' . $graphic . '
' . esc_html($title) . '
' . wp_kses_post($doc) . '
' . $price . '
' . $discount_mobile . ($vip !== '' ? '
' . $vip . '
' : '') . '
' . $button . '
' . $service . '
' . $demo_mobile . $attrs . $tag . $count . '
'; + return '
' . $graphic . '
' . esc_html($title) . '
' . wp_kses_post($doc) . '
' . $price . '
' . $discount_mobile . ($vip !== '' ? '
' . $vip . '
' : '') . '
' . $button . '
' . $article_service . $demo_mobile . $attrs . $tag . $count . '
'; } } diff --git a/templates/parts/resource-download-box.php b/templates/parts/resource-download-box.php index 27eddf47..516ea795 100644 --- a/templates/parts/resource-download-box.php +++ b/templates/parts/resource-download-box.php @@ -437,19 +437,12 @@ if ($is_need_purchase && $user_amount > 0) { } } ?> -
- - - - - -
+ + +
+ +
+ diff --git a/tests/widget-system/pay-card-contract.test.cjs b/tests/widget-system/pay-card-contract.test.cjs index f6097de1..e1a49c0f 100644 --- a/tests/widget-system/pay-card-contract.test.cjs +++ b/tests/widget-system/pay-card-contract.test.cjs @@ -46,6 +46,7 @@ test('the purchase card owns one direct stylesheet and no retired paywall path', const widgets = read('assets/widgets/frontend.css'); const css = read('assets/css/frontend/pay-box.css'); const publicCss = read('assets/css/main.css'); + const download = read('templates/parts/resource-download-box.php'); assert.match(assets, /assets\/css\/frontend\/pay-box\.css|\'pay-box\'/); assert.match(shortcodes, /return aksrt_get_paywall_html\(\$post, \['message' => \$message\]\);/); @@ -59,4 +60,6 @@ test('the purchase card owns one direct stylesheet and no retired paywall path', assert.doesNotMatch(retired, /aksrt-post-pay/); assert.doesNotMatch(retired, /str_replace\([\s\S]*aksrt-paywall__desc/); assert.doesNotMatch(pay, /aksrt-paid-(?:gallery|video)__(?:locked|preview|overlay|placeholder|price)/); + assert.doesNotMatch(pay + download, /安全检测|支持 VIP 权益|支持积分结算/); + assert.doesNotMatch(download, /function_exists\('aksrt_get_pay_service_html'\)/); });