Языки и категории
This commit is contained in:
parent
6a26f8b41f
commit
4b9db5ac0c
2
Game.php
2
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') {
|
||||
|
|
|
@ -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 отдал страницу на русском
|
||||
|
|
|
@ -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) {
|
||||
|
|
Reference in a new issue