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 = get_the_title($post); $subtitle = ''; if (function_exists('get_the_subtitle')) { // noop — AKSRT may not have zibll 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; $need_login = is_wp_error($gate) && $gate->get_error_code() === 'aksrt_need_login'; // Free download + login required (Zibll pay_free_logged_show). $price = (float) ($pay_meta['price'] ?? 0); $order_settings = class_exists('AKSRT_Settings') ? AKSRT_Settings::get_order_settings() : []; $free_logged_show = !empty($order_settings['free_logged_show']); if ($price <= 0 && $free_logged_show && !is_user_logged_in()) { $can_dl = false; $need_login = true; $has_access = true; // free "access" but must login to download } $paid_name = ''; if ($has_access || $can_dl) { if ($price <= 0) { $paid_name = __('免费资源', 'aksrt'); } else { $paid_name = __('已获得下载权限', 'aksrt'); } } get_header(); ?>
登录 后再下载。', 'aksrt')), esc_url($login_url) ); ?>