Языки и категории
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_download;
|
||||||
public $url_discussion;
|
public $url_discussion;
|
||||||
public $url_download_description;
|
public $url_download_description;
|
||||||
|
public $language;
|
||||||
|
public $categories;
|
||||||
public function print() {
|
public function print() {
|
||||||
$converter = new HtmlConverter();
|
$converter = new HtmlConverter();
|
||||||
if (STYLE === 'RUS') {
|
if (STYLE === 'RUS') {
|
||||||
|
|
|
@ -62,6 +62,13 @@ class Steam extends Source {
|
||||||
$game->author = array_map('trim', $game->author);
|
$game->author = array_map('trim', $game->author);
|
||||||
}
|
}
|
||||||
$game->image = $game_page->filter('img.game_header_image_full')->first()->attr('src');
|
$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();
|
$date = $game_page->filter('div.date')->first()->text();
|
||||||
$game->date = \DateTime::createFromFormat('d M, Y', $date);
|
$game->date = \DateTime::createFromFormat('d M, Y', $date);
|
||||||
if ($game->date === FALSE) { // если Steam отдал страницу на русском
|
if ($game->date === FALSE) { // если Steam отдал страницу на русском
|
||||||
|
|
|
@ -101,6 +101,7 @@ class Wikipage {
|
||||||
}
|
}
|
||||||
$this->txtadd('platform', ' |платформа='.$this->game->platform);
|
$this->txtadd('platform', ' |платформа='.$this->game->platform);
|
||||||
$this->txtadd('image', ' |обложка='.$this->covername);
|
$this->txtadd('image', ' |обложка='.$this->covername);
|
||||||
|
$this->txtadd('language', ' |язык='.$this->game->language);
|
||||||
|
|
||||||
$this->content .= "\n}}\n";
|
$this->content .= "\n}}\n";
|
||||||
|
|
||||||
|
@ -117,6 +118,14 @@ class Wikipage {
|
||||||
}
|
}
|
||||||
$this->txtadd('url_discussion', '* ['.$this->game->url_discussion.' Обсуждение игры]');
|
$this->txtadd('url_discussion', '* ['.$this->game->url_discussion.' Обсуждение игры]');
|
||||||
$this->txtadd('url', '* ['.$this->game->url.' Страница игры]');
|
$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) {
|
protected function txtadd($param, $text) {
|
||||||
|
|
Reference in a new issue