'', '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') ? AKSRT_Settings::get_paid_content_settings() : ['download_credit' => true, 'download_captcha' => false]; $cost = function_exists('aksrt_get_download_cost') ? aksrt_get_download_cost($post_id) : (int) ceil((float) ($meta['price'] ?? 0)); $credit_active = !empty($paid_settings['download_credit']) && $cost > 0; $captcha_active = !empty($paid_settings['download_captcha']) || !empty($meta['require_captcha']); if ($captcha_active && function_exists('aksrt_is_captcha_enabled_for') && !aksrt_is_captcha_enabled_for('download')) { $captcha_active = false; } $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'; // 缩略图 $thumbnail = get_the_post_thumbnail_url($post_id, 'medium') ?: ''; $has_thumbnail = $thumbnail !== ''; // 原价 & VIP 价 $original_price = (float) ($meta['original_price'] ?? 0); $vip1_price = (float) ($meta['vip1_price'] ?? 0); $vip2_price = (float) ($meta['vip2_price'] ?? 0); $has_original = $original_price > 0 && $original_price > (float) ($meta['price'] ?? 0); $has_vip = $vip1_price > 0 || $vip2_price > 0; // 销量 $download_count = (int) ($meta['download_count'] ?? 0); $sales_count = (int) ($meta['sales_count'] ?? 0); $display_count = max($download_count, $sales_count); // 付费类型徽章 $pay_type_badge = function_exists('aksrt_get_pay_type_badge') ? aksrt_get_pay_type_badge($pay_type) : ''; // 货币名称 $currency = class_exists('AKSRT_Settings') ? AKSRT_Settings::get_currency_name() : __('积分', 'aksrt'); ?>
0) : ?>
<?php echo esc_attr(get_the_title()); ?>>

0) : ?> 0) : ?>

    $row) : $label = isset($row['label']) ? (string) $row['label'] : ''; if ($label === '') { $label = sprintf(__('下载源 %d', 'aksrt'), $idx + 1); } $type = isset($row['type']) ? (string) $row['type'] : 'direct'; $url = isset($row['url']) ? (string) $row['url'] : ''; $extract_code = isset($row['extract_code']) ? trim((string) $row['extract_code']) : ''; $has_extract = $extract_code !== ''; $service = function_exists('aksrt_detect_cloud_service') ? aksrt_detect_cloud_service($url) : ['key' => 'other', 'name' => $label, 'color' => '#6b7280']; if (strpos($label, '下载源') === 0 && $service['key'] !== 'other') { $label = $service['name']; } if ($is_need_login) { $btn_tag = 'a'; $btn_text = __('登录后下载', 'aksrt'); $btn_icon = 'fa-sign-in-alt'; $btn_modifier = ' resource-download-box__btn--login'; } elseif ($is_low_credit) { $btn_tag = 'button'; $btn_text = sprintf(__('解锁下载(%d 积分)', 'aksrt'), $cost); $btn_icon = 'fa-coins'; $btn_modifier = ' resource-download-box__btn--credit-low'; } elseif ($credit_active && $cost > 0) { $btn_tag = 'button'; $btn_text = sprintf(__('下载(%d 积分)', 'aksrt'), $cost); $btn_icon = 'fa-download'; $btn_modifier = ' resource-download-box__btn--paid'; } else { $btn_tag = 'button'; $btn_text = __('立即下载', 'aksrt'); $btn_icon = 'fa-download'; $btn_modifier = ''; } ?>