refactor(admin): clean up audit/permission/paid content config
- P1: remove the duplicate "审核联动" (ai_moderate_background/submit) block from the attachment permissions page; those settings live in the "评论审核" / API content audit surfaces. - P2: rename the "内容审核" submenu to "评论审核" (permissions domain). - P4: remove the "下载/付费内容中心" page and its schema/route chain; hardcode runtime policy so download always supports credit purchase and paid content is limited to posts. Drop the now-dead cms_features.download_credit flag and parse_slug_list helper.
This commit is contained in:
@@ -16,9 +16,6 @@ class PaymentRuntime {
|
||||
*/
|
||||
public static function get_paid_content_settings(): array {
|
||||
$settings = Settings::get_all();
|
||||
$features = HomeCms::get_cms_features();
|
||||
$catalog_note = trim((string) ($settings['payment_paid_catalog_note'] ?? ''));
|
||||
$manual_note = trim((string) ($settings['payment_manual_delivery_note'] ?? ''));
|
||||
|
||||
$box_position = sanitize_key((string) ($settings['pay_box_position'] ?? 'top'));
|
||||
// Zibll: box_top | top | bottom | box_bottom
|
||||
@@ -27,35 +24,37 @@ class PaymentRuntime {
|
||||
}
|
||||
|
||||
return [
|
||||
'download_credit' => !empty($features['download_credit']) && Settings::credits_enabled(),
|
||||
// 下载门槛永远支持积分购买模式(不再由页面开关控制)。
|
||||
'download_credit' => Settings::credits_enabled(),
|
||||
'default_cost' => Settings::download_default_cost(),
|
||||
'paid_post_types' => self::parse_slug_list((string) ($settings['payment_paid_post_types'] ?? 'post'), ['post']),
|
||||
'vip_free_download' => !empty($settings['payment_vip_free_download']),
|
||||
'vip_exempt_roles' => self::parse_slug_list((string) ($settings['payment_vip_exempt_roles'] ?? '')),
|
||||
'catalog_note' => $catalog_note,
|
||||
'manual_delivery_note' => $manual_note !== '' ? $manual_note : __('付费或人工确认内容请在订单备注中记录交付方式。', 'aksrt'),
|
||||
// 付费内容仅文章。
|
||||
'paid_post_types' => ['post'],
|
||||
'vip_free_download' => false,
|
||||
'vip_exempt_roles' => [],
|
||||
'catalog_note' => '',
|
||||
'manual_delivery_note' => __('付费或人工确认内容请在订单备注中记录交付方式。', 'aksrt'),
|
||||
'no_logged_in' => !isset($settings['pay_no_logged_in']) || !empty($settings['pay_no_logged_in']),
|
||||
'down_alone_page' => !empty($settings['payment_down_alone_page']),
|
||||
'down_alone_page' => false,
|
||||
'display' => [
|
||||
'mark' => sanitize_text_field((string) ($settings['pay_mark'] ?? '付费')),
|
||||
'currency_symbol' => sanitize_text_field((string) ($settings['payment_currency_symbol'] ?? '¥')),
|
||||
'currency_symbol' => '¥',
|
||||
'show_user' => !isset($settings['pay_show_user']) || !empty($settings['pay_show_user']),
|
||||
'show_paycount' => !isset($settings['pay_show_paycount']) || !empty($settings['pay_show_paycount']),
|
||||
'box_position' => $box_position,
|
||||
],
|
||||
'download' => [
|
||||
'enabled' => !empty($settings['payment_download_enable']),
|
||||
'remote' => !isset($settings['payment_download_remote_s']) || !empty($settings['payment_download_remote_s']),
|
||||
'verify_nonce' => !isset($settings['payment_download_verify_nonce']) || !empty($settings['payment_download_verify_nonce']),
|
||||
'user_log' => max(0, min(9999, (int) ($settings['payment_download_user_log'] ?? 50))),
|
||||
'post_log' => max(0, min(9999, (int) ($settings['payment_download_post_log'] ?? 50))),
|
||||
'remote_size' => max(1, (int) ($settings['payment_download_remote_size'] ?? 2048)),
|
||||
'remote_ext' => sanitize_text_field((string) ($settings['payment_download_remote_ext'] ?? 'zip,rar,7z')),
|
||||
'alone_page' => !empty($settings['payment_down_alone_page']),
|
||||
'enabled' => true,
|
||||
'remote' => true,
|
||||
'verify_nonce' => true,
|
||||
'user_log' => 50,
|
||||
'post_log' => 50,
|
||||
'remote_size' => 2048,
|
||||
'remote_ext' => 'zip,rar,7z',
|
||||
'alone_page' => false,
|
||||
],
|
||||
// Content cashier coupon (zibll coupon_post_s / coupon_desc).
|
||||
'coupon_post_s' => !empty($settings['coupon_post_s']),
|
||||
'coupon_desc' => sanitize_textarea_field((string) ($settings['coupon_desc'] ?? '')),
|
||||
// 内容收银台优惠码:不再提供全局开关,默认关闭。
|
||||
'coupon_post_s' => false,
|
||||
'coupon_desc' => '',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -495,22 +494,6 @@ class PaymentRuntime {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string[] $fallback
|
||||
* @return string[]
|
||||
*/
|
||||
private static function parse_slug_list(string $raw, array $fallback = []): array {
|
||||
$items = preg_split('/[\s,]+/', $raw, -1, PREG_SPLIT_NO_EMPTY);
|
||||
$normalized = [];
|
||||
foreach ((array) $items as $item) {
|
||||
$slug = sanitize_key((string) $item);
|
||||
if ($slug !== '' && !in_array($slug, $normalized, true)) {
|
||||
$normalized[] = $slug;
|
||||
}
|
||||
}
|
||||
return !empty($normalized) ? $normalized : $fallback;
|
||||
}
|
||||
|
||||
private static function count_structured_lines(string $raw): int {
|
||||
$lines = preg_split('/[\r\n]+/', $raw, -1, PREG_SPLIT_NO_EMPTY);
|
||||
$count = 0;
|
||||
|
||||
Reference in New Issue
Block a user