feat(pay): alone download page, free-login gate, list pay badges

This commit is contained in:
kate522 committed 2026-07-14 00:38:43 +08:00
1 parent 0ad41715e2
commit 5acf302e53
8 files changed
+448 -186

No files matched your search

+37 -3
View File
@@ -55,7 +55,26 @@ $balance = (int) ($gate_data['balance'] ?? 0);
$login_url = (string) ($gate_data['login_url'] ?? wp_login_url(get_permalink($post_id)));
$is_need_login = $gate_blocked && $gate_code === 'aksrt_need_login';
$is_low_credit = $gate_blocked && $gate_code === 'aksrt_credits_insufficient';
$is_low_credit = $gate_blocked && $gate_code === 'aksrt_credits_insufficient';
// Zibll pay_free_logged_show: free downloads still require login.
$free_logged_show = !empty($paid_settings['free_logged_show']);
$price_amount = (float) ($meta['price'] ?? 0);
if ($price_amount <= 0 && $free_logged_show && !is_user_logged_in()) {
$is_need_login = true;
$gate_blocked = true;
}
// Zibll 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_low_credit;
if (!empty($GLOBALS['aksrt_on_download_file_page'])) {
$use_alone_entry = false;
}
// 缩略图
$thumbnail = get_the_post_thumbnail_url($post_id, 'medium') ?: '';
@@ -160,7 +179,21 @@ $currency = class_exists('AKSRT_Settings') ? AKSRT_Settings::get_currency_name()
<p class="resource-download-box__catalog-note"><?php echo esc_html((string) $paid_settings['catalog_note']); ?></p>
<?php endif; ?>
<ul class="resource-download-box__list">
<?php if (!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="fas fa-download" aria-hidden="true"></i>
<span><?php esc_html_e('资源下载', 'aksrt'); ?></span>
</a>
<?php if (!empty($meta['demo_url'])) : ?>
<a target="_blank" rel="nofollow" href="<?php echo esc_url((string) $meta['demo_url']); ?>" class="resource-download-box__btn btn-outline resource-download-box__btn--demo">
<i class="fas fa-external-link-alt" aria-hidden="true"></i>
<span><?php esc_html_e('在线演示', 'aksrt'); ?></span>
</a>
<?php endif; ?>
</div>
<?php else : ?>
<ul class="resource-download-box__list">
<?php foreach ($downloads as $idx => $row) :
$label = isset($row['label']) ? (string) $row['label'] : '';
if ($label === '') {
@@ -241,6 +274,7 @@ $currency = class_exists('AKSRT_Settings') ? AKSRT_Settings::get_currency_name()
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<div class="resource-download-box__guarantees">
<span class="resource-download-box__guarantee">
@@ -262,7 +296,7 @@ $currency = class_exists('AKSRT_Settings') ? AKSRT_Settings::get_currency_name()
<?php if ($is_need_login) : ?>
<p class="resource-download-box__hint resource-download-box__hint--login">
<i class="fas fa-info-circle" aria-hidden="true"></i>
<?php esc_html_e('登录后可解锁并下载该内容。', 'aksrt'); ?>
<?php echo (isset($price_amount) && $price_amount <= 0) ? esc_html__('免费资源,请登录后下载。', 'aksrt') : esc_html__('登录后可解锁并下载该内容。', 'aksrt'); ?>
</p>
<?php elseif ($is_low_credit) : ?>
<p class="resource-download-box__hint resource-download-box__hint--credit">