Files
wordpress-theme-aksrt/templates/parts/resource-download-box.php
T
kate522 2595bb02db fix(frontend): 统一计数缩写口径并将流水号改为订单号
前台各处评论、浏览、点赞、收藏、已售数量统一走
aksrt_format_number() 缩写(≥10000 → 1.2W+,≥1000 → 1.5K),
缩写后缀统一为大写 K,与既有 W+ 保持一致。PHP 渲染缩写文本的
同时保留 data-base-count 原始整数,JS 增量计算不受影响;
article.js / comment-ajax.js 内的 formatStatCount / formatCount
与 PHP 规则保持同一套,避免点赞收藏后文本回跳成全量数字。

文章详情页购买信息卡、用户中心创作者收益明细、后台分成与提现
管理页、支付设置页以及四封订单/提现邮件模板中,面向用户展示的
「流水号」字样统一改为「订单号」;代码注释、内部错误码与
WP_Error 文案保留原表述。

验证:node --test "tests/*/*.test.cjs" 508 项全部通过;
php -l 检查全部改动文件无语法错误;重新构建 admin SPA 与
前台 runtime bundle。
2026-10-06 14:13:51 +08:00

471 lines
23 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
/**
* Unified paid-content download box.
*
* Downloadable content now follows the unified single.php mainline; resource-
* specific visuals are treated as content variants rather than a separate page
* system.
*
* @package AKSRT
*/
defined('ABSPATH') || exit;
$post_id = get_the_ID();
$meta = get_query_var('aksrt_resource_meta', null);
if (!is_array($meta)) {
$meta = function_exists('aksrt_get_download_box_meta') ? aksrt_get_download_box_meta($post_id) : null;
}
if (!is_array($meta)) return;
$downloads = is_array($meta['downloads']) ? $meta['downloads'] : [];
$pay_type = $meta['pay_type'] ?? 'download';
if ($pay_type !== 'download' || empty($downloads)) {
return;
}
$is_resource_context = function_exists('aksrt_is_resource_post') && aksrt_is_resource_post($post_id);
$context_variant = $is_resource_context ? 'resource' : 'content';
$subject_label = trim((string) ($meta['subject_label'] ?? ''));
if ($subject_label === '') {
$subject_label = $is_resource_context ? __('资源', 'aksrt') : __('内容', 'aksrt');
}
$price_label = function_exists('aksrt_get_pay_price_label')
? aksrt_get_pay_price_label($post_id)
: ['text' => '', 'free' => true];
// 下载策略检查
$gate = function_exists('aksrt_can_download') ? aksrt_can_download($post_id) : true;
$gate_blocked = is_wp_error($gate);
$gate_code = $gate_blocked ? $gate->get_error_code() : '';
$gate_data = $gate_blocked ? (array) $gate->get_error_data() : [];
$paid_settings = class_exists('\AKSRT\Settings\Settings')
? \AKSRT\Settings\Settings::get_paid_content_settings()
: ['download_credit' => true];
$access = class_exists('\AKSRT\Content\Visibility')
? \AKSRT\Content\Visibility::get_post_access_state($post_id)
: [];
$has_paid_access = !empty($access['has_paid_access']);
$priced = function_exists('aksrt_get_user_pay_price') ? aksrt_get_user_pay_price($post_id) : null;
$pay_modo = is_array($priced)
? ((($priced['modo'] ?? '0') === 'points') ? 'points' : '0')
: ((($meta['pay_modo'] ?? '0') === 'points') ? 'points' : '0');
$user_amount = is_array($priced) ? (float) ($priced['amount'] ?? 0) : (float) ($meta['price'] ?? 0);
$login_url = (string) ($gate_data['login_url'] ?? wp_login_url(get_permalink($post_id)));
$vip_url = function_exists('aksrt_get_user_center_tab_url')
? aksrt_get_user_center_tab_url('credits')
: (function_exists('aksrt_get_user_center_url') ? aksrt_get_user_center_url() : home_url('/'));
$is_need_login = $gate_blocked && $gate_code === 'aksrt_need_login';
$is_need_vip = $gate_blocked && $gate_code === 'aksrt_need_vip';
$is_need_purchase = $gate_blocked && $gate_code === 'aksrt_need_purchase';
// Points unpaid may also surface as need_purchase; treat low balance only after cashier.
$is_low_credit = false;
$allow_guest_buy = !is_user_logged_in()
&& function_exists('aksrt_allow_guest_content_pay')
&& aksrt_allow_guest_content_pay($post_id)
&& $pay_modo !== 'points'
&& $user_amount > 0
&& empty($access['need_vip']);
// If gate only says login but guest buy allowed for cash posts, convert to purchase CTA.
if ($is_need_login && $allow_guest_buy) {
$is_need_login = false;
$is_need_purchase = true;
$gate_blocked = true;
}
$price_amount = (float) ($price_label['amount'] ?? $user_amount);
// legacy down_alone_page: single entry to independent download page.
$alone_page = !empty($paid_settings['down_alone_page']) || !empty($paid_settings['download']['alone_page']);
$alone_url = '';
if ($alone_page && function_exists('aksrt_get_single_download_page_url')) {
$alone_url = aksrt_get_single_download_page_url($post_id);
}
$use_alone_entry = $alone_page && $alone_url !== '' && !$is_need_login && !$is_need_vip && !$is_need_purchase && !$gate_blocked;
if (!empty($GLOBALS['aksrt_on_download_file_page'])) {
$use_alone_entry = false;
}
// 缩略图
$thumbnail = get_the_post_thumbnail_url($post_id, 'medium') ?: '';
$has_thumbnail = $thumbnail !== '';
// 原价 & VIP 价(按 pay_modo 切换现金/积分档)
$original_price = (float) ($meta['original_price'] ?? 0);
if ($pay_modo === 'points') {
$vip1_price = (float) ($meta['vip1_points'] ?? 0);
$vip2_price = (float) ($meta['vip2_points'] ?? 0);
$base_price = (float) ($meta['points_price'] ?? $meta['price'] ?? 0);
} else {
$vip1_price = (float) ($meta['vip1_price'] ?? 0);
$vip2_price = (float) ($meta['vip2_price'] ?? 0);
$base_price = (float) ($meta['price'] ?? 0);
}
$has_original = $original_price > 0 && $original_price > $base_price;
$has_vip = ($vip1_price > 0 && $vip1_price < $base_price) || ($vip2_price > 0 && $vip2_price < $base_price);
$pay_limit = (int) ($meta['pay_limit'] ?? 0);
$user_vip_level = is_array($priced) ? (int) ($priced['vip_level'] ?? 0) : 0;
$member_blocked = $pay_limit > 0 && $user_vip_level < $pay_limit;
// 销量
$download_count = (int) ($meta['download_count'] ?? 0);
$sales_count = (int) ($meta['sales_count'] ?? 0);
$display_count = max($download_count, $sales_count);
$show_sales = !isset($meta['show_sales']) || !empty($meta['show_sales']);
// 付费类型徽章
$pay_type_badge = function_exists('aksrt_get_pay_type_badge') ? aksrt_get_pay_type_badge($pay_type) : '';
// 货币名称
$currency = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_currency_name() : __('积分', 'aksrt');
$cash_symbol = '¥';
if (class_exists('\AKSRT\Settings\Settings')) {
$paid_display = \AKSRT\Settings\Settings::get_paid_content_settings();
$cash_symbol = (string) ($paid_display['display']['currency_symbol'] ?? '¥');
}
$format_vip = static function (float $amount) use ($pay_modo, $currency, $cash_symbol): string {
if ($amount <= 0) {
return (string) __('免费', 'aksrt');
}
$n = function_exists('aksrt_format_price') ? aksrt_format_price($amount) : (string) $amount;
return $pay_modo === 'points' ? ($n . ' ' . $currency) : ($cash_symbol . $n);
};
$purchase_label = '';
if ($is_need_purchase && $user_amount > 0) {
$purchase_label = $pay_modo === 'points'
? sprintf(__('立即购买(%s %s)', 'aksrt'), aksrt_format_price($user_amount), $currency)
: sprintf(__('立即购买(%s%s)', 'aksrt'), $cash_symbol, aksrt_format_price($user_amount));
} elseif ($is_need_purchase) {
$purchase_label = __('购买后下载', 'aksrt');
}
?>
<section class="widget resource-download-box resource-download-box--v2<?php echo $gate_blocked ? ' is-blocked' : ''; ?><?php echo $has_paid_access ? ' is-purchased' : ''; ?> resource-download-box--<?php echo esc_attr($context_variant); ?>"
data-aksrt-download-box
data-post-id="<?php echo esc_attr((string) $post_id); ?>"
data-price="<?php echo esc_attr((string) $base_price); ?>"
data-amount="<?php echo esc_attr((string) $user_amount); ?>"
data-pay-modo="<?php echo esc_attr($pay_modo); ?>"
data-pay-limit="<?php echo esc_attr((string) $pay_limit); ?>"
data-has-paid="<?php echo $has_paid_access ? '1' : '0'; ?>"
data-credit="0"
aria-label="<?php esc_attr_e('下载区', 'aksrt'); ?>">
<?php if ($has_paid_access && $user_amount > 0) : ?>
<span class="resource-download-box__sales-badge resource-download-box__paid-badge">
<i class="fa fas fa-check-circle" aria-hidden="true"></i>
<?php esc_html_e('已购买', 'aksrt'); ?>
</span>
<?php elseif ($show_sales && $display_count > 0) : ?>
<span class="resource-download-box__sales-badge">
<i class="fa fas fa-fire" aria-hidden="true"></i>
<?php
/* translators: %s: 下载/销量数 */
$sales_label = function_exists('aksrt_format_number') ? aksrt_format_number($display_count) : number_format_i18n($display_count);
printf(esc_html__('已售 %s', 'aksrt'), $sales_label);
?>
</span>
<?php endif; ?>
<?php
$paid_order = null;
if ($has_paid_access && is_user_logged_in() && function_exists('aksrt_get_user_content_paid_order')) {
$paid_order = aksrt_get_user_content_paid_order((int) $post_id);
}
?>
<div class="resource-download-box__body">
<?php if ($has_thumbnail) : ?>
<div class="resource-download-box__thumb-col">
<img<?php echo aksrt_get_lazy_attr('lazy_other', (string) $thumbnail, 'resource-download-box__thumb'); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> alt="<?php echo esc_attr(get_the_title()); ?>">
<?php if ($pay_type_badge) : ?>
<div class="resource-download-box__pay-tag"><?php echo $pay_type_badge; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></div>
<?php endif; ?>
</div>
<?php endif; ?>
<div class="resource-download-box__content-col">
<header class="resource-download-box__header">
<div>
<p class="resource-download-box__eyebrow"><?php echo esc_html(sprintf(__('%s付费 / 下载能力', 'aksrt'), $subject_label)); ?></p>
<h2 class="resource-download-box__title">
<i class="fa fas fa-cloud-download-alt" aria-hidden="true"></i>
<?php echo $has_paid_access ? esc_html__('资源下载', 'aksrt') : esc_html__('解锁下载', 'aksrt'); ?>
</h2>
</div>
<span class="resource-download-box__count">
<?php echo esc_html(sprintf(_n('%s 个下载源', '%s 个下载源', count($downloads), 'aksrt'), number_format_i18n(count($downloads)))); ?>
</span>
</header>
<?php if ($has_paid_access && $user_amount > 0) : ?>
<div class="resource-download-box__pricing">
<span class="resource-download-box__price is-free"><?php esc_html_e('已解锁', 'aksrt'); ?></span>
<?php echo $pay_type_badge && !$has_thumbnail ? $pay_type_badge : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</div>
<?php if (is_array($paid_order) && !empty($paid_order['order_number'])) : ?>
<div class="resource-download-box__paid-meta">
<span><?php printf(esc_html__('订单号:%s', 'aksrt'), esc_html((string) $paid_order['order_number'])); ?></span>
<?php if (!empty($paid_order['paid_at'])) : ?>
<span><?php printf(esc_html__('支付时间:%s', 'aksrt'), esc_html((string) $paid_order['paid_at'])); ?></span>
<?php endif; ?>
<span>
<?php
$paid_amt = (float) ($paid_order['amount'] ?? 0);
$paid_cur = (string) ($paid_order['currency'] ?? '');
if ($paid_cur === 'points') {
printf(esc_html__('实付:%s %s', 'aksrt'), esc_html(function_exists('aksrt_format_price') ? aksrt_format_price($paid_amt) : (string) $paid_amt), esc_html($currency));
} else {
printf(esc_html__('实付:%s%s', 'aksrt'), esc_html($cash_symbol), esc_html(function_exists('aksrt_format_price') ? aksrt_format_price($paid_amt) : (string) $paid_amt));
}
?>
</span>
</div>
<?php endif; ?>
<?php else : ?>
<div class="resource-download-box__pricing">
<span class="resource-download-box__price<?php echo !empty($price_label['free']) || $has_paid_access ? ' is-free' : ''; ?>">
<?php
if ($has_paid_access && $user_amount > 0) {
esc_html_e('已解锁', 'aksrt');
} else {
echo esc_html((string) ($price_label['text'] ?? ''));
}
?>
</span>
<?php if ($has_original && !$member_blocked && !$has_paid_access) : ?>
<span class="resource-download-box__original-price">
<?php
echo esc_html(
$pay_modo === 'points'
? (aksrt_format_price($original_price) . ' ' . $currency)
: ($cash_symbol . aksrt_format_price($original_price))
);
?>
</span>
<?php endif; ?>
<?php echo $pay_type_badge && !$has_thumbnail ? $pay_type_badge : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</div>
<?php endif; ?>
<?php if ($has_vip && !$member_blocked && !$has_paid_access) : ?>
<div class="resource-download-box__vip-pricing">
<?php if ($vip1_price > 0 && $vip1_price < $base_price) : ?>
<span class="resource-download-box__vip-badge resource-download-box__vip-badge--1">
<i class="fa fas fa-certificate" aria-hidden="true"></i>
<?php
/* translators: %s: VIP1 价格 */
printf(esc_html__('VIP1 %s', 'aksrt'), $format_vip($vip1_price));
?>
</span>
<?php endif; ?>
<?php if ($vip2_price > 0 && $vip2_price < $base_price) : ?>
<span class="resource-download-box__vip-badge resource-download-box__vip-badge--2">
<i class="fa fas fa-gem" aria-hidden="true"></i>
<?php
/* translators: %s: VIP2 价格 */
printf(esc_html__('VIP2 %s', 'aksrt'), $format_vip($vip2_price));
?>
</span>
<?php endif; ?>
</div>
<?php endif; ?>
<?php
if (function_exists('aksrt_get_pay_attributes_html')) {
echo aksrt_get_pay_attributes_html($post_id); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
?>
<?php if (!empty($paid_settings['catalog_note'])) : ?>
<p class="resource-download-box__catalog-note"><?php echo esc_html((string) $paid_settings['catalog_note']); ?></p>
<?php endif; ?>
<?php if ($is_need_vip || $member_blocked) : ?>
<div class="mt10 resource-download-box__vip-gate">
<a href="<?php echo esc_url($vip_url); ?>" class="resource-download-box__btn btn-primary resource-download-box__btn--vip">
<i class="fa fas fa-certificate" aria-hidden="true"></i>
<span><?php echo esc_html($gate instanceof WP_Error ? $gate->get_error_message() : __('开通会员后下载', 'aksrt')); ?></span>
</a>
<?php
if (function_exists('aksrt_get_demo_link_html')) {
echo aksrt_get_demo_link_html($post_id); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
?>
</div>
<?php elseif ($is_need_purchase) : ?>
<div class="mt10 resource-download-box__purchase-gate">
<button
type="button"
class="resource-download-box__btn btn-primary resource-download-box__btn--purchase cashier-link <?php echo $pay_modo === 'points' ? 'is-points' : 'is-cash'; ?>"
data-action="aksrt-need-purchase"
data-aksrt-pay-content="<?php echo esc_attr((string) $post_id); ?>"
data-post-id="<?php echo esc_attr((string) $post_id); ?>"
data-pay-modo="<?php echo esc_attr($pay_modo); ?>"
data-amount="<?php echo esc_attr((string) $user_amount); ?>"
>
<i class="fa fas fa-shopping-cart" aria-hidden="true"></i>
<span><?php echo esc_html($purchase_label); ?></span>
</button>
<?php
if (function_exists('aksrt_get_demo_link_html')) {
echo aksrt_get_demo_link_html($post_id); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
?>
</div>
<?php elseif (!empty($use_alone_entry)) : ?>
<div class="mt10 resource-download-box__alone">
<a target="_blank" rel="nofollow" href="<?php echo esc_url($alone_url); ?>" class="resource-download-box__btn btn-primary resource-download-box__btn--alone">
<i class="fa fas fa-download" aria-hidden="true"></i>
<span><?php esc_html_e('资源下载', 'aksrt'); ?></span>
</a>
<?php
if (function_exists('aksrt_get_demo_link_html')) {
echo aksrt_get_demo_link_html($post_id); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
?>
</div>
<?php else : ?>
<ul class="resource-download-box__list">
<?php foreach ($downloads as $idx => $row) :
$label = isset($row['label']) ? trim((string) $row['label']) : '';
$type = isset($row['type']) ? (string) $row['type'] : 'direct';
$url = isset($row['url']) ? (string) $row['url'] : '';
if ($url === '') {
// 直连模式没有可用的原始地址,空源不渲染。
continue;
}
$extract_code = isset($row['extract_code']) ? trim((string) $row['extract_code']) : '';
$has_extract = $extract_code !== '';
$copy_key = isset($row['copy_key']) ? trim((string) $row['copy_key']) : '';
$copy_val = isset($row['copy_val']) ? trim((string) $row['copy_val']) : '';
$icon = isset($row['icon']) ? trim((string) $row['icon']) : '';
$button_class = isset($row['class']) ? trim((string) $row['class']) : '';
$has_copy = $copy_val !== '';
$service = function_exists('aksrt_detect_cloud_service') ? aksrt_detect_cloud_service($url) : ['key' => 'other', 'name' => $label, 'color' => '#6b7280'];
if ($label === '') {
$label = strpos($service['name'], '本地') === 0 ? sprintf(__('下载源 %d', 'aksrt'), $idx + 1) : (string) $service['name'];
}
$icon_markup = $icon !== '' && function_exists('aksrt_icon_markup') ? aksrt_icon_markup($icon) : '';
if ($is_need_login) {
$btn_href = $login_url;
$btn_text = __('登录后下载', 'aksrt');
$btn_icon = $icon_markup !== '' ? $icon_markup : '<i class="fa fas fa-sign-in-alt" aria-hidden="true"></i>';
$btn_extra_class = '';
$btn_modifier = ' resource-download-box__btn--login';
$btn_target = '';
$btn_rel = '';
} else {
$btn_href = $url;
$btn_text = $label;
$btn_icon = $icon_markup !== '' ? $icon_markup : '<i class="fa fas fa-download" aria-hidden="true"></i>';
$btn_extra_class = $button_class !== '' ? ' ' . $button_class : '';
$btn_modifier = ($has_paid_access ? ' resource-download-box__btn--owned' : '') . ($button_class !== '' ? ' resource-download-box__btn--custom' : '');
$btn_target = ' target="_blank"';
$btn_rel = ' rel="nofollow noopener"';
}
?>
<li class="resource-download-box__item">
<div class="resource-download-box__row">
<a
class="resource-download-box__btn btn-primary resource-download-box__btn--service-<?php echo esc_attr($service['key']); ?><?php echo esc_attr($btn_modifier); ?><?php echo esc_attr($btn_extra_class); ?>"
href="<?php echo esc_url($btn_href); ?>"<?php echo $btn_target; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?><?php echo $btn_rel; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
data-source-index="<?php echo esc_attr((string) $idx); ?>"
data-source-type="<?php echo esc_attr($type); ?>"
style="--service-color: <?php echo esc_attr($service['color']); ?>"
>
<?php echo $btn_icon; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
<span><?php echo esc_html($btn_text); ?></span>
<span class="resource-download-box__service-badge" style="background: <?php echo esc_attr($service['color']); ?>">
<?php echo esc_html($service['name']); ?>
</span>
</a>
<?php if ($has_extract || $has_copy) : ?>
<button type="button" class="resource-download-box__btn resource-download-box__btn--extract"
<?php if ($has_copy && $copy_key !== '') : ?>data-toggle="tooltip" title="<?php echo esc_attr(sprintf(__('点击复制%s', 'aksrt'), $copy_key)); ?>"<?php endif; ?>
data-clipboard-tag="<?php echo esc_attr($has_copy ? ($copy_key !== '' ? $copy_key : __('内容', 'aksrt')) : __('提取码', 'aksrt')); ?>"
data-clipboard-text="<?php echo esc_attr($has_copy ? $copy_val : $extract_code); ?>"
><?php echo esc_html($has_extract ? $extract_code : ($copy_key !== '' ? $copy_key : __('复制内容', 'aksrt'))); ?></button>
<?php endif; ?>
</div>
</li>
<?php endforeach; ?>
</ul>
<?php
if (function_exists('aksrt_get_demo_link_html')) {
$demo = aksrt_get_demo_link_html($post_id);
if ($demo !== '') {
echo '<div class="mt10 resource-download-box__demo-row">' . $demo . '</div>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
}
?>
<?php endif; ?>
<?php
if (is_user_logged_in() && $user_amount <= 0 && function_exists('aksrt_get_user_free_download_limit')) {
$dl_limit = aksrt_get_user_free_download_limit();
if ($dl_limit > 0) {
$dl_used = function_exists('aksrt_get_user_free_downloaded_number') ? aksrt_get_user_free_downloaded_number() : 0;
$dl_surplus = max(0, $dl_limit - $dl_used);
$vip_lv = function_exists('aksrt_get_user_vip_level') ? aksrt_get_user_vip_level() : 0;
$over_price = max(0.0, (float) ($meta['download_limit_over_price'] ?? 0));
if ($dl_surplus <= 0) {
echo '<div class="resource-download-box__quota-notice"><span class="badg c-red btn-block">' . esc_html__('您今日下载免费资源个数已超限,请明日再下载。', 'aksrt') . '</span></div>';
if ($over_price > 0 && !$has_paid_access) {
$over_label = $pay_modo === 'points'
? sprintf(__('立即购买(%s %s)', 'aksrt'), function_exists('aksrt_format_price') ? aksrt_format_price($over_price) : (string) $over_price, $currency)
: sprintf(__('立即购买(%s%s)', 'aksrt'), $cash_symbol, function_exists('aksrt_format_price') ? aksrt_format_price($over_price) : (string) $over_price);
echo '<div class="mt10 resource-download-box__purchase-gate">';
echo '<button type="button" class="resource-download-box__btn btn-primary resource-download-box__btn--purchase cashier-link" data-action="aksrt-need-purchase" data-aksrt-pay-content="' . esc_attr((string) $post_id) . '" data-post-id="' . esc_attr((string) $post_id) . '" data-price-type="download_limit_over" data-pay-modo="' . esc_attr($pay_modo) . '" data-amount="' . esc_attr((string) $over_price) . '">';
echo '<i class="fa fas fa-shopping-cart" aria-hidden="true"></i><span>' . esc_html($over_label) . '</span></button></div>';
}
} else {
$who = $vip_lv > 0 ? esc_html__('您是尊贵的会员,', 'aksrt') : esc_html__('您', 'aksrt');
echo '<div class="resource-download-box__quota-notice"><span class="badg c-red btn-block">' . $who . esc_html(sprintf(__('今日还可下载 %s 个免费资源', 'aksrt'), number_format_i18n($dl_surplus))) . '</span></div>';
}
}
}
?>
<?php $service_html = aksrt_get_pay_service_html(); ?>
<?php if ($service_html !== '') : ?>
<div class="resource-download-box__guarantees">
<?php echo $service_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</div>
<?php endif; ?>
</div>
</div>
<?php if ($is_need_login) : ?>
<p class="resource-download-box__hint resource-download-box__hint--login">
<i class="fa fas fa-info-circle" aria-hidden="true"></i>
<?php echo ($price_amount <= 0) ? esc_html__('免费资源,请登录后下载。', 'aksrt') : esc_html__('登录后可解锁并下载该内容。', 'aksrt'); ?>
</p>
<?php elseif ($is_need_vip || $member_blocked) : ?>
<p class="resource-download-box__hint resource-download-box__hint--vip">
<i class="fa fas fa-info-circle" aria-hidden="true"></i>
<?php echo esc_html($gate instanceof WP_Error ? $gate->get_error_message() : __('该资源仅限会员购买/下载。', 'aksrt')); ?>
</p>
<?php elseif ($is_need_purchase) : ?>
<p class="resource-download-box__hint resource-download-box__hint--purchase">
<i class="fa fas fa-info-circle" aria-hidden="true"></i>
<?php esc_html_e('请先完成购买后再下载该资源。', 'aksrt'); ?>
</p>
<?php endif; ?>
<footer class="resource-download-box__footer">
<p class="resource-download-box__notice-text">
<i class="fa fas fa-info-circle" aria-hidden="true"></i>
<?php esc_html_e('下载能力是统一付费内容的一部分,请确认内容适用性后再使用。', 'aksrt'); ?>
</p>
</footer>
</section>