165: if (preg_match_all('~\s*([^<\s]+)\s*~i', $xml, $m)) { 166: foreach ($m[1] as $loc) $locs[] = trim($loc); 167: } 168: return array_values(array_unique($locs)); 169: } 170: 171: function looks_like_product_url(string $url): bool { 172: $u = strtolower($url); 173: 174: // explizite Produktseiten (häufig bei xt:Commerce/modified) 175: if (str_contains($u, "products_id=")) return true; 176: if (str_contains($u, "product_info.php")) return true; 177: 178: // -------- NEU: cPath direkt aus HTML extrahieren (auch ohne Links) -------- 179: if (preg_match_all('~cPath=([0-9_]+)~i', $html, $mc)) { 180: foreach ($mc[1] as $cp) { 181: $cp = trim($cp); 182: if ($cp !== "") $foundCPaths[$cp] = true; 183: } 184: } 185: 186: // allgemein Query-Muster 187: $qs = ["product_id=", "artikel_id=", "article=", "pid=", "sku=", "variant="]; 188: foreach ($qs as $q) if (str_contains($u, $q)) return true; 189: 190: // Pfad-Muster