2017-01-23 09:00:42 +02:00
|
|
|
<?php
|
2018-04-01 20:14:48 +03:00
|
|
|
use \Pandoc\Pandoc;
|
|
|
|
|
2017-01-23 09:00:42 +02:00
|
|
|
class Game {
|
|
|
|
public $url;
|
|
|
|
public $title;
|
|
|
|
public $author;
|
|
|
|
public $description;
|
2018-03-24 21:01:30 +02:00
|
|
|
/**
|
|
|
|
* Дата выхода игры.
|
|
|
|
*
|
|
|
|
* @var DateTime
|
|
|
|
*/
|
2017-01-23 09:00:42 +02:00
|
|
|
public $date;
|
2018-03-22 09:39:02 +02:00
|
|
|
public $image;
|
2018-03-23 20:00:43 +02:00
|
|
|
public $platform;
|
|
|
|
public $url_online;
|
|
|
|
public $url_download;
|
|
|
|
public $url_discussion;
|
|
|
|
public $url_download_description;
|
2018-03-28 17:43:01 +03:00
|
|
|
public $language;
|
|
|
|
public $categories;
|
2017-01-23 09:00:42 +02:00
|
|
|
public function print() {
|
2018-04-01 20:14:48 +03:00
|
|
|
$converter = new Pandoc();
|
2017-02-21 07:27:41 +02:00
|
|
|
if (STYLE === 'RUS') {
|
2017-07-13 10:49:49 +03:00
|
|
|
if (FORMAT === 'MARKDOWN') {
|
|
|
|
$output = "* [«".trim($this->title)."»](".trim($this->url).")";
|
|
|
|
if ($this->author) {
|
|
|
|
$output .= " — *".trim($this->author)."*";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (FORMAT === 'HTML') {
|
|
|
|
$output = "<li><a rel='nofollow' target='_blank' href='".trim($this->url)."'>«".trim($this->title)."»</a>";
|
|
|
|
if ($this->author) {
|
2018-04-11 14:11:03 +03:00
|
|
|
if (is_array($this->author)) {
|
|
|
|
$output .= " — <em>".implode(', ', array_map('trim', $this->author))."</em>";
|
|
|
|
} else {
|
|
|
|
$output .= " — <em>".trim($this->author)."</em>";
|
|
|
|
}
|
2017-07-13 10:49:49 +03:00
|
|
|
}
|
2017-02-21 07:27:41 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (STYLE === 'ENG') {
|
|
|
|
$output = "* [“".trim($this->title)."”](".trim($this->url).")";
|
|
|
|
if ($this->author) {
|
|
|
|
$output .= " by *".trim($this->author)."*";
|
|
|
|
}
|
2017-04-27 10:27:25 +03:00
|
|
|
}
|
|
|
|
if ($this->description) {
|
2017-07-13 10:49:49 +03:00
|
|
|
if (FORMAT === 'MARKDOWN') {
|
2018-04-01 20:14:48 +03:00
|
|
|
$output .= "\n\n > ".$converter->convert($this->description, 'html', 'markdown_github')."\n";
|
2017-07-13 10:49:49 +03:00
|
|
|
}
|
|
|
|
if (FORMAT === 'HTML') {
|
2018-04-01 20:14:48 +03:00
|
|
|
$output .= "\n<blockquote>".$this->description."</blockquote>\n";
|
2017-07-13 10:49:49 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (FORMAT === 'MARKDOWN') {
|
2017-04-27 10:27:25 +03:00
|
|
|
$output .= "\n";
|
2017-01-23 09:00:42 +02:00
|
|
|
}
|
2017-07-13 10:49:49 +03:00
|
|
|
if (FORMAT === 'HTML') {
|
|
|
|
$output .= "</li>\n";
|
|
|
|
}
|
2017-01-23 09:00:42 +02:00
|
|
|
return $output;
|
|
|
|
}
|
|
|
|
}
|