From a3f99c9c3ff7aebc6552cb1eead1c2a041f54078 Mon Sep 17 00:00:00 2001 From: Quentin Delmas Date: Sun, 9 Sep 2018 17:32:36 +0100 Subject: [PATCH] [GOGBridge] Added bridge for GOG.com --- bridges/GOGBridge.php | 66 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 bridges/GOGBridge.php diff --git a/bridges/GOGBridge.php b/bridges/GOGBridge.php new file mode 100644 index 00000000..79047c69 --- /dev/null +++ b/bridges/GOGBridge.php @@ -0,0 +1,66 @@ +products as $game) { + + $item = array(); + $item['author'] = $game->developer . ' / ' . $game->publisher; + $item['title'] = $game->title; + $item['id'] = $game->id; + $item['uri'] = self::URI . $game->url; + $item['content'] = $this->buildGameContentPage($game); + $item['timestamp'] = $game->globalReleaseDate; + + foreach($game->gallery as $image) { + $item['enclosures'][] = $image . '.jpg'; + } + + $this->items[] = $item; + $limit += 1; + + if($limit == 10) break; + + } + + } + + private function buildGameContentPage($game) { + + $gameDescriptionText = getContents('https://api.gog.com/products/' . $game->id . '?expand=description') or + die('Unable to get game description from GOG !'); + + $gameDescriptionValue = json_decode($gameDescriptionText); + + $content = 'Genres: '; + $content .= implode(', ', $game->genres); + + $content .= '
Supported Platforms: '; + if($game->worksOn->Windows) { + $content .= 'Windows '; + } + if($game->worksOn->Mac) { + $content .= 'Mac '; + } + if($game->worksOn->Linux) { + $content .= 'Linux '; + } + + $content .= '
' . $gameDescriptionValue->description->full; + + return $content; + + } + +}