@php $fxzNavScope = in_array($fxzNavScope ?? '', ['primary', 'sticky', 'mobile'], true) ? $fxzNavScope : 'primary'; $fxzNavItems = is_array($fxzNavItems ?? null) ? $fxzNavItems : []; $fxzNavDescriptions = [ '/about-us' => ['about', 'Company, service and support overview'], '/faqs' => ['question', 'Common account and platform questions'], '/terms-conditions' => ['document', 'Website and service-use terms'], '/privacy-policy' => ['privacy', 'How personal information is handled'], '/aml-policy' => ['shield', 'Identity, monitoring and financial-crime controls'], '/gdpr-compliance' => ['lock', 'Data-protection governance and rights'], '/cookies-policy' => ['cookies', 'Cookies, local storage and preferences'], '/risk' => ['warning', 'Leveraged trading and market risks'], '/complaints' => ['comments', 'How to submit and follow a complaint'], ]; $fxzNavAliases = [ '/about' => '/about-us', '/faq' => '/faqs', '/terms' => '/terms-conditions', '/terms-and-conditions' => '/terms-conditions', '/privacy' => '/privacy-policy', '/risk-disclosure' => '/risk', '/contact' => '/contact-us', ]; $fxzNavPath = static function (string $url) use ($fxzNavAliases): string { $path = '/'.trim((string) parse_url($url, PHP_URL_PATH), '/'); $base = rtrim(request()->getBaseUrl(), '/'); if ($base !== '' && ($path === $base || str_starts_with($path, $base.'/'))) { $path = '/'.ltrim(substr($path, strlen($base)), '/'); } return $fxzNavAliases[$path] ?? $path; }; $fxzNavCurrentPath = $fxzNavPath(request()->getRequestUri()); $fxzNavIsCurrent = static function (array $item, int $depth = 0) use (&$fxzNavIsCurrent, $fxzNavPath, $fxzNavCurrentPath): bool { $url = trim((string) ($item['url'] ?? '')); $host = parse_url($url, PHP_URL_HOST); if ($url !== '' && $url !== '#' && (! $host || strcasecmp($host, request()->getHost()) === 0) && $fxzNavPath($url) === $fxzNavCurrentPath) { return true; } if ($depth >= 12) return false; foreach ((array) ($item['children'] ?? []) as $child) { if (is_array($child) && $fxzNavIsCurrent($child, $depth + 1)) return true; } return false; }; // Only source-owned SVG markup is unescaped. Administrator labels and URLs // are always escaped; arbitrary SVG/HTML cannot enter through a menu record. $fxzNavRender = static function (array $items, int $level = 0, string $trail = '', bool $resourceChildren = false) use (&$fxzNavRender, $fxzNavScope, $fxzNavDescriptions, $fxzNavPath, $fxzNavIsCurrent): string { if ($level > 12) return ''; $html = ''; foreach (array_values($items) as $index => $item) { if (! is_array($item)) continue; $title = trim((string) ($item['title'] ?? '')); $url = trim((string) ($item['url'] ?? '#')) ?: '#'; $scheme = parse_url($url, PHP_URL_SCHEME); if (preg_match('/[\x00-\x20\\\\]/', $url) || ($scheme && ! in_array(strtolower($scheme), ['http', 'https', 'mailto', 'tel'], true))) { $url = '#'; } $target = ($item['target'] ?? '_self') === '_blank' ? '_blank' : '_self'; $children = array_values(array_filter((array) ($item['children'] ?? []), 'is_array')); $resources = $level === 0 && strcasecmp($title, 'Resources') === 0; $id = 'fxz-'.$fxzNavScope.'-submenu-'.$trail.$index; $classes = 'runtime-menu-item runtime-global-menu-item runtime-menu-level-'.$level; if ($children) $classes .= ' dropdown'; if ($resources) $classes .= ' fxz-resources-dropdown'; if ($fxzNavIsCurrent($item)) $classes .= ' current'; $html .= '