*/ public function get_catalog(int $user_id = 0): array { return [ 'currency_name' => $GLOBALS['jio_probe_currency'] ?? '积分', 'points_exchange' => [ 'enabled' => true, 'packages' => [['package_id' => 6001, 'level' => 1, 'points' => 500]], ], ]; } } } namespace Jio\Settings { final class Settings { // 仅在 catalog 未带 currency_name 时回退,用于验证兜底路径。 public static function get_currency_name(): string { return $GLOBALS['jio_probe_fallback'] ?? '积分'; } } } namespace { require dirname(__DIR__, 2) . '/inc/helpers/jio-vip.php'; $GLOBALS['jio_probe_currency'] = isset($argv[1]) ? (string) $argv[1] : '书币'; $GLOBALS['jio_probe_fallback'] = isset($argv[2]) ? (string) $argv[2] : '回退币'; // 场景 1:后台改名后,横条标题跟随自定义货币名。 echo jio_get_vip_points_exchange_entry_html(1, 0), "\n"; // 场景 2:已是会员 → 不输出。 echo (jio_get_vip_points_exchange_entry_html(1, 2) === '' ? 'VIP_HIDDEN' : 'VIP_SHOWN'), "\n"; // 场景 3:catalog 未带 currency_name → 回退到设置里的名称。 $GLOBALS['jio_probe_currency'] = ''; echo jio_get_vip_points_exchange_entry_html(1, 0), "\n"; }