fix(vip): preserve safe HTML in VIP copy

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
kate522andClaude Opus 5 committed 2026-10-19 12:52:23 +08:00
1 parent 7a0445fc4a
commit 573040381d
15 files changed
+155 -118

No files matched your search

@@ -23,6 +23,7 @@ namespace {
function sanitize_text_field($value): string { return trim(strip_tags((string) $value)); }
function sanitize_textarea_field($value): string { return trim((string) $value); }
function wp_kses_post($value): string { return (string) $value; }
function wp_strip_all_tags($value): string { return trim(strip_tags((string) $value)); }
function wp_kses($value, $allowed = null): string { return (string) $value; }
function trailingslashit($value): string { return rtrim((string) $value, '/\\') . '/'; }
function get_template_directory_uri(): string { return 'https://example.test/wp-content/themes/aksrt'; }
@@ -115,15 +116,17 @@ namespace {
Settings::$snapshot = [
'pay_user_vip_1_s' => true,
'pay_user_vip_2_s' => true,
'pay_user_vip_1_name' => '青铜会员',
'pay_user_vip_2_name' => '王者会员',
'pay_user_vip_1_name' => '<strong>青铜会员</strong>',
'pay_user_vip_2_name' => '<span>王者会员</span>',
'pay_user_vip_1_desc' => '<em>专属权益</em>',
'pay_user_vip_1_equity' => '<p>一对一支持</p>',
'vip_renew' => true,
'vip_renew_desc' => '续费有礼',
'vip_renew_desc' => '<b>续费有礼</b>',
'vip_renew_price_type' => 'customize',
'vip_renew_discount' => 7.5,
'vip_renew_reduce' => '15.00',
'vip_upgrade' => true,
'vip_upgrade_desc' => '升级王者',
'vip_upgrade_desc' => '<i>升级王者</i>',
'vip_upgrade_product' => [
'month_to_month_s' => true,
'unit_price' => '12.50',
@@ -179,6 +182,17 @@ namespace {
$sanitize = (static function (): array {
$provider = \AKSRT\Admin\SchemaProvider::get_instance();
$cases = [
'vip_html' => [
'pay_user_vip_1_name' => '<b>会员</b>',
'pay_user_vip_1_desc' => '<em>简介</em>',
'pay_user_vip_1_equity' => '<p>权益</p>',
'pay_user_vip_desc' => '<span>会员介绍</span>',
'vip_renew_desc' => '<strong>续费</strong>',
'vip_upgrade_desc' => '<i>升级</i>',
'vip_1_product' => [
['price' => '88.80', 'show_price' => '99.00', 'tag' => '<b>推荐</b>', 'tag_class' => 'jb-yellow', 'time' => 1, 'unit' => 'month'],
],
],
'default_rows' => [
'pay_vip_points_exchange_s' => true,
'pay_vip_points_exchange_product' => [
@@ -215,6 +229,7 @@ namespace {
$clean = $provider->sanitize_payload('payment', $payload, 'vip');
$result = $provider->validate('payment', $clean, 'vip');
$out[$name] = [
'fields' => $clean,
'points_rows' => $clean['pay_vip_points_exchange_product'] ?? null,
'valid' => $result['valid'],
'errors' => $result['errors'],