collectDataUrl(self::URI . 'xml.php'); } protected function collectDataUrl($dataUrl) { $xml = getContents($dataUrl); $limit = 0; foreach (array_reverse(explode('', $xml)) as $element) { if ($limit >= 5) { break; } if (strpos($element, '') === false) { continue; } $releasename = extractFromDelimiters($element, '', ''); if (empty($releasename)) { continue; } $id = extractFromDelimiters($element, '', ''); $name = extractFromDelimiters($element, '', ''); $publisher = extractFromDelimiters($element, '', ''); $region = extractFromDelimiters($element, '', ''); $group = extractFromDelimiters($element, '', ''); $imagesize = extractFromDelimiters($element, '', ''); $serial = extractFromDelimiters($element, '', ''); $titleid = extractFromDelimiters($element, '', ''); $imgcrc = extractFromDelimiters($element, '', ''); $filename = extractFromDelimiters($element, '', ''); $trimmedsize = extractFromDelimiters($element, '', ''); $firmware = extractFromDelimiters($element, '', ''); $type = extractFromDelimiters($element, '', ''); $card = extractFromDelimiters($element, '', ''); //Main section : Release description from 3DS database $releaseDescription = '

Release Details

Release ID: ' . $id . '
Game Name: ' . $name . '
Publisher: ' . $publisher . '
Region: ' . $region . '
Group: ' . $group . '
Image size: ' . (intval($imagesize) / 8) . 'MB
Serial: ' . $serial . '
Title ID: ' . $titleid . '
Image CRC: ' . $imgcrc . '
File Name: ' . $filename . '
Release Name: ' . $releasename . '
Trimmed size: ' . intval(intval($trimmedsize) / 1048576) . 'MB
Firmware: ' . $firmware . '
Type: ' . $this->typeToString($type) . '
Card: ' . $this->cardToString($card) . '
'; //Build search links section to facilitate release search using search engines $releaseNameEncoded = urlencode(str_replace(' ', '+', $releasename)); $searchLinkGoogle = 'https://google.com/?q=' . $releaseNameEncoded; $searchLinkDuckDuckGo = 'https://duckduckgo.com/?q=' . $releaseNameEncoded; $searchLinkQwant = 'https://lite.qwant.com/?q=' . $releaseNameEncoded . '&t=web'; $releaseSearchLinks = '

Search this release

'; //Build and add final item with the above three sections $item = []; $item['title'] = $name; $item['author'] = $publisher; //$item['timestamp'] = $ignDate; //$item['enclosures'] = [$ignCoverArt]; $item['uri'] = empty($ignLink) ? $searchLinkDuckDuckGo : $ignLink; $item['content'] = $releaseDescription . $releaseSearchLinks; $this->items[] = $item; $limit++; } } private function typeToString($type) { switch ($type) { case 1: return 'Card Game'; case 4: return 'eShop'; default: return '??? (' . $type . ')'; } } private function cardToString($card) { switch ($card) { case 1: return 'Regular (CARD1)'; case 2: return 'NAND (CARD2)'; default: return '??? (' . $card . ')'; } } }