优化了一些问题
This commit is contained in:
1 parent
88eb29c645
commit
af30159a03
6 files changed
+151
-92
No files matched your search
+15
-15
@@ -914,19 +914,6 @@ if (!function_exists('aksrt_get_single_download_page_url')) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether independent download page mode is enabled (legacy down_alone_page).
|
||||
*/
|
||||
if (!function_exists('aksrt_is_download_alone_page_enabled')) {
|
||||
function aksrt_is_download_alone_page_enabled(): bool {
|
||||
if (!class_exists('\AKSRT\Settings\Settings')) {
|
||||
return false;
|
||||
}
|
||||
$paid = \AKSRT\Settings\Settings::get_paid_content_settings();
|
||||
return !empty($paid['down_alone_page']) || !empty($paid['download']['alone_page']);
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// 价格显示
|
||||
// ============================================================
|
||||
@@ -1450,12 +1437,20 @@ if (!function_exists('aksrt_get_paid_download_actions_html')) {
|
||||
return '<div class="muted-2-color text-center">' . esc_html__('暂无可下载资源', 'aksrt') . '</div>';
|
||||
}
|
||||
|
||||
// 下载总开关关闭 = 直连模式:按钮直接输出原始地址,不走本站中转链接。
|
||||
$direct_download = class_exists('\AKSRT\Content\Download')
|
||||
&& !\AKSRT\Content\Download::get_instance()->is_enabled();
|
||||
|
||||
$buttons = '';
|
||||
foreach ($downloads as $index => $download) {
|
||||
if (!is_array($download)) {
|
||||
continue;
|
||||
}
|
||||
$url = (string) ($download['url'] ?? '');
|
||||
if ($direct_download && $url === '') {
|
||||
// 直连模式没有可用的原始地址,空源不渲染。
|
||||
continue;
|
||||
}
|
||||
$label = trim((string) ($download['label'] ?? ''));
|
||||
$service = function_exists('aksrt_detect_cloud_service')
|
||||
? aksrt_detect_cloud_service($url)
|
||||
@@ -1474,8 +1469,13 @@ if (!function_exists('aksrt_get_paid_download_actions_html')) {
|
||||
$copy_label = $extract_code !== '' ? $extract_code : ($copy_key !== '' ? $copy_key : __('更多内容', 'aksrt'));
|
||||
|
||||
$buttons .= '<div class="but-download flex ac">';
|
||||
$buttons .= '<button type="button" class="mr10 but ' . esc_attr($button_class) . '" data-action="aksrt-download" data-source-index="' . esc_attr((string) $index) . '" data-source-type="' . esc_attr($type) . '" data-has-extract="' . ($has_extract ? '1' : '0') . '">';
|
||||
$buttons .= '<i class="fa fa-download" aria-hidden="true"></i>' . esc_html($label) . '</button>';
|
||||
if ($direct_download) {
|
||||
$buttons .= '<a class="mr10 but ' . esc_attr($button_class) . '" href="' . esc_url($url) . '" target="_blank" rel="nofollow noopener">';
|
||||
$buttons .= '<i class="fa fa-download" aria-hidden="true"></i>' . esc_html($label) . '</a>';
|
||||
} else {
|
||||
$buttons .= '<button type="button" class="mr10 but ' . esc_attr($button_class) . '" data-action="aksrt-download" data-source-index="' . esc_attr((string) $index) . '" data-source-type="' . esc_attr($type) . '" data-has-extract="' . ($has_extract ? '1' : '0') . '">';
|
||||
$buttons .= '<i class="fa fa-download" aria-hidden="true"></i>' . esc_html($label) . '</button>';
|
||||
}
|
||||
if ($copy_value !== '') {
|
||||
$buttons .= '<button type="button" class="but" data-clipboard-tag="' . esc_attr($copy_key !== '' ? $copy_key : __('内容', 'aksrt')) . '" data-clipboard-text="' . esc_attr($copy_value) . '">' . esc_html($copy_label) . '</button>';
|
||||
} elseif ($extract_code !== '') {
|
||||
|
||||
Reference in new issue
Block a user