$f, 'path' => '/' . $rel]; } } return $files; } $allFiles = scanAll('/opt/wevads/public', '', $excludeDirs, $excludeFiles); usort($allFiles, fn($a,$b) => strcmp($a['name'], $b['name'])); function parseMenu($file) { $html = file_get_contents($file); $html = preg_replace('//s', '', $html); $menu = []; $seen = []; // Liens directs en premier (dans l'ordre du vrai menu) $directLinks = [ ['t' => 'Dashboard', 'u' => '/dashboard.html', 'd' => true], ['t' => '🎛️ Control Hub', 'u' => '/control-hub.php', 'd' => true], ['t' => '🏆 Winning Config', 'u' => '/deliverads/brain-dashboard.php', 'd' => true], ]; foreach ($directLinks as $dl) { $menu[] = $dl; $seen[$dl['t']] = true; } // Nav-toggle menus $parts = preg_split('/(]*nav-toggle[^>]*>)/', $html, -1, PREG_SPLIT_DELIM_CAPTURE); for ($i = 1; $i < count($parts); $i += 2) { if (!isset($parts[$i+1])) continue; $section = $parts[$i] . $parts[$i+1]; if (preg_match('/]*>([^<]+)/', $section, $pm)) { $parentTitle = trim($pm[1]); if (isset($seen[$parentTitle])) continue; $seen[$parentTitle] = true; $children = []; if (preg_match('/