0 ? get_post($post_id) : null; if (!$post instanceof WP_Post || $post->post_status !== 'publish') { get_header(); echo '
'; echo '
' . esc_html__('无效的下载请求', 'aksrt') . '
'; echo '
'; get_footer(); exit; } $pay_meta = function_exists('aksrt_get_pay_meta') ? aksrt_get_pay_meta($post) : ['pay_type' => 'no', 'downloads' => []]; $pay_type = (string) ($pay_meta['pay_type'] ?? 'no'); $is_download = $pay_type === 'download' || (function_exists('aksrt_is_downloadable_content') && aksrt_is_downloadable_content($post)); if (!$is_download) { get_header(); echo '
'; echo '
' . esc_html__('该内容不是可下载资源', 'aksrt') . '
'; echo '

' . esc_html__('返回文章', 'aksrt') . '

'; echo '
'; get_footer(); exit; } $article_url = get_permalink($post) . '#posts-pay'; // 商品简介 / 更多详情 / 额外隐藏内容三个字段只在管理员填写时才有输出。 $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 } $has_access = function_exists('aksrt_has_paid_access') ? aksrt_has_paid_access($post) : false; $gate = function_exists('aksrt_can_download') ? aksrt_can_download($post) : true; $can_dl = $gate === true; $gate_code = is_wp_error($gate) ? $gate->get_error_code() : ''; $need_login = $gate_code === 'aksrt_need_login'; $need_purchase = $gate_code === 'aksrt_need_purchase'; $need_vip = $gate_code === 'aksrt_need_vip'; $priced = function_exists('aksrt_get_user_pay_price') ? aksrt_get_user_pay_price($post) : null; $price = is_array($priced) ? (float) ($priced['amount'] ?? 0) : (float) ($pay_meta['price'] ?? 0); $pay_modo = is_array($priced) ? ((($priced['modo'] ?? '0') === 'points') ? 'points' : '0') : ((($pay_meta['pay_modo'] ?? '0') === 'points') ? 'points' : '0'); $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'] ?? '¥'); } $price_text = $price <= 0 ? __('免费', 'aksrt') : ($pay_modo === 'points' ? (function_exists('aksrt_format_price') ? aksrt_format_price($price) : (string) $price) . ' ' . $currency : $cash_symbol . (function_exists('aksrt_format_price') ? aksrt_format_price($price) : (string) $price)); $login_url = wp_login_url(add_query_arg('post', $post_id, get_permalink())); $vip_url = function_exists('aksrt_get_user_center_url') ? aksrt_get_user_center_url() : home_url('/'); $paid_name = ''; if ($has_access || $can_dl) { if ($price <= 0) { $paid_name = __('免费资源', 'aksrt'); } else { $paid_name = __('已获得下载权限', 'aksrt'); } } get_header(); ?>
登录 后再下载。', 'aksrt')), esc_url($login_url) ); ?>
get_error_message() : __('该资源仅限会员购买/下载。', 'aksrt')); ?>
get_error_message() : __('暂无下载权限', 'aksrt')); ?>