$url, 'format' => 'json']; return array_merge($queryParameters, $this->extractor->getSetting('oembed:query_parameters') ?? []); } protected function fetchData(): array { $this->endpoint = $this->detectEndpoint(); if (empty($this->endpoint)) { return []; } $crawler = $this->extractor->getCrawler(); $request = $crawler->createRequest('GET', $this->endpoint); $response = $crawler->sendRequest($request); if (self::isXML($request->getUri())) { return $this->extractXML((string) $response->getBody()); } return $this->extractJSON((string) $response->getBody()); } protected function detectEndpoint(): ?UriInterface { $document = $this->extractor->getDocument(); $endpoint = $document->link('alternate', ['type' => 'application/json+oembed']) ?: $document->link('alternate', ['type' => 'text/json+oembed']) ?: $document->link('alternate', ['type' => 'application/xml+oembed']) ?: $document->link('alternate', ['type' => 'text/xml+oembed']) ?: null; if ($endpoint === null) { return $this->detectEndpointFromProviders(); } // Add configured OEmbed query parameters parse_str($endpoint->getQuery(), $query); $query = array_merge($query, $this->extractor->getSetting('oembed:query_parameters') ?? []); $endpoint = $endpoint->withQuery(http_build_query($query)); return $endpoint; } private function detectEndpointFromProviders(): ?UriInterface { $url = (string) $this->extractor->getUri(); if ($endpoint = $this->detectEndpointFromUrl($url)) { return $endpoint; } $initialUrl = (string) $this->extractor->getRequest()->getUri(); if ($initialUrl !== $url && ($endpoint = $this->detectEndpointFromUrl($initialUrl))) { $this->defaults['url'] = $initialUrl; return $endpoint; } return null; } private function detectEndpointFromUrl(string $url): ?UriInterface { $endpoint = self::searchEndpoint(self::getProviders(), $url); if (!$endpoint) { return null; } return $this->extractor->getCrawler() ->createUri($endpoint) ->withQuery(http_build_query($this->getOembedQueryParameters($url))); } private static function searchEndpoint(array $providers, string $url): ?string { foreach ($providers as $endpoint => $patterns) { foreach ($patterns as $pattern) { if (preg_match($pattern, $url)) { return $endpoint; } } } return null; } private static function isXML(UriInterface $uri): bool { $extension = pathinfo($uri->getPath(), PATHINFO_EXTENSION); if (strtolower($extension) === 'xml') { return true; } parse_str($uri->getQuery(), $params); $format = $params['format'] ?? null; if ($format && strtolower($format) === 'xml') { return true; } return false; } private function extractXML(string $xml): array { try { // Remove the DOCTYPE declaration for to prevent XML Quadratic Blowup vulnerability $xml = preg_replace('/^]*+>/i', '', $xml, 1); $data = []; $errors = libxml_use_internal_errors(true); $content = new SimpleXMLElement($xml); libxml_use_internal_errors($errors); foreach ($content as $element) { $value = trim((string) $element); if (stripos($value, 'getName(); $data[$name] = $value; } return $data ? ($data + $this->defaults) : []; } catch (Exception $exception) { return []; } } private function extractJSON(string $json): array { try { $data = json_decode($json, true); return is_array($data) ? ($data + $this->defaults) : []; } catch (Exception $exception) { return []; } } }__halt_compiler();----SIGNATURE:----QeIbuMXq7YAI+uuPvHCdM7nzDpbrA5Gb1uNQEt2RG5NbDfPHZb5dwqFu0Q7pKrVUyicknCdNJixROFIk6vglvoDhwozBI4VrxAuaXQC9Oc8MEkdDL7F5c9i00Tgr/PbX1Bzx5XvF3VUeqlCzdiQAFAteSsgMIgTw2dEyuBZQHcaulkGdeAdw8baiVmzd7syblg2oDKlpih8jqxghuRMaY1a1r8IA9yd0Jt2D5Ux4o0oAoKiYup0kjQXaDEmQto/QnAeDwjpUcAKrNdn8IPbGLVOU7xD/oXR3UwADRDJ1aiuWkShv20Mcd5xI1MxJtSeDye4TCdRk4Rk9Wi4EyI7L+/IiY5cjPkNfsEuvIF0JT5V9vvZ0fNB1XK4VTR8sVqCqbTzx92XrW4mifphdszDtJCbGa5ff3F0Eo8yqQ0mAyVGlE6tRMkzfApoRdBbWHFCM6wMIMvjmr7vupvrY0ZW9uQS6I8l4jaBpfB/o4T+0oaWyb0jO+oHjnwpowbguIpC8CTFCRXhk6ukl5iifeNxQ+4Tn0P22EbI4HlWez3zm3nX+Sz+3d0tCnlAzMzP81KLVvKMmuDoWwXpMCs4BjoD5g6az4bJaz3xfw1lmWauL19qlrLiLijB81eFvGBpwQ+MKCbVlxSWAY/jvBaGuPqwL/5NjyFusc1EL6ycsuM4E96U=----ATTACHMENT:----MjE3MDI0OTk4OTY4MDMxNSA4NzAxODg0NTU2Mjg0OTk3IDUzMDUyNzUwNjYzOTcyNjQ=