'; public static function providers(): array { if (! config('airport_recommendations.enabled')) return []; $providers = array_filter(config('airport_recommendations.providers', []), fn ($p) => ($p['enabled'] ?? false) && filter_var($p['url'] ?? '', FILTER_VALIDATE_URL) && in_array(parse_url($p['url'], PHP_URL_SCHEME), ['https', 'http'], true)); uasort($providers, fn ($a, $b) => ($a['order'] ?? 0) <=> ($b['order'] ?? 0)); return $providers; } /** Presentation only: article storage, API receipts and subscription bytes stay intact. */ public static function prepare(Articles $article): array { $html = $article->sContent ?? ''; $category = $article->oCategory; $slug = $category?->sSlug; $scope = in_array($slug, ['freenode', 'shadowrocketids', 'advanced', 'client'], true) || $category?->oParent?->sSlug === 'client'; $enabled = $scope && self::providers() !== []; if (! $enabled) return ['body' => $html, 'enabled' => false, 'inline' => false]; $inline = false; if (in_array($slug, ['freenode', 'shadowrocketids'], true)) { // Match the known legacy heading and its own Fuyun link, bounded by the next heading. if (preg_match('~(?:
]*>\s*)? 如果需要更稳定的线路,可以从文末的机场推荐中选择。 ]*>.*?