diff --git a/Game.php b/Game.php index 1557759..148d8c2 100644 --- a/Game.php +++ b/Game.php @@ -17,6 +17,8 @@ class Game { public $url_download; public $url_discussion; public $url_download_description; + public $language; + public $categories; public function print() { $converter = new HtmlConverter(); if (STYLE === 'RUS') { diff --git a/Source/Steam.php b/Source/Steam.php index 204dda8..ad91c8e 100644 --- a/Source/Steam.php +++ b/Source/Steam.php @@ -62,6 +62,13 @@ class Steam extends Source { $game->author = array_map('trim', $game->author); } $game->image = $game_page->filter('img.game_header_image_full')->first()->attr('src'); + $game->categories = 'Коммерческая ИЛ'; + $languages = $game_page->filter('.game_language_options tr td:first-child'); + $game->language = []; + foreach ($languages as $language) { + $game->language[] = trim($language->nodeValue); + } + $game->language = implode(', ', $game->language); $date = $game_page->filter('div.date')->first()->text(); $game->date = \DateTime::createFromFormat('d M, Y', $date); if ($game->date === FALSE) { // если Steam отдал страницу на русском diff --git a/Wikipage.php b/Wikipage.php index f63de77..d50cde6 100644 --- a/Wikipage.php +++ b/Wikipage.php @@ -101,6 +101,7 @@ class Wikipage { } $this->txtadd('platform', ' |платформа='.$this->game->platform); $this->txtadd('image', ' |обложка='.$this->covername); + $this->txtadd('language', ' |язык='.$this->game->language); $this->content .= "\n}}\n"; @@ -117,6 +118,14 @@ class Wikipage { } $this->txtadd('url_discussion', '* ['.$this->game->url_discussion.' Обсуждение игры]'); $this->txtadd('url', '* ['.$this->game->url.' Страница игры]'); + if (is_array($this->game->categories)) { + $this->content .= PHP_EOL; + foreach ($this->game->categories as $category) { + $this->content .= '[[Категория:'.$category.']]'; + } + } else { + $this->content .= PHP_EOL.'[[Категория:'.$this->game->categories.']]'; + } } protected function txtadd($param, $text) {