66 lines
1.7 KiB
PHP
66 lines
1.7 KiB
PHP
<?php
|
|
use \Pandoc\Pandoc;
|
|
|
|
class Game {
|
|
public $url;
|
|
public $title;
|
|
public $author;
|
|
public $description;
|
|
/**
|
|
* Дата выхода игры.
|
|
*
|
|
* @var DateTime
|
|
*/
|
|
public $date;
|
|
public $image;
|
|
public $platform;
|
|
public $url_online;
|
|
public $url_download;
|
|
public $url_discussion;
|
|
public $url_download_description;
|
|
public $language;
|
|
public $categories;
|
|
public function print() {
|
|
$converter = new Pandoc();
|
|
if (STYLE === 'RUS') {
|
|
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) {
|
|
if (is_array($this->author)) {
|
|
$output .= " — <em>".implode(', ', array_map('trim', $this->author))."</em>";
|
|
} else {
|
|
$output .= " — <em>".trim($this->author)."</em>";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (STYLE === 'ENG') {
|
|
$output = "* [“".trim($this->title)."”](".trim($this->url).")";
|
|
if ($this->author) {
|
|
$output .= " by *".trim($this->author)."*";
|
|
}
|
|
}
|
|
if ($this->description) {
|
|
if (FORMAT === 'MARKDOWN') {
|
|
$output .= "\n\n > ".$converter->convert($this->description, 'html', 'markdown_github')."\n";
|
|
}
|
|
if (FORMAT === 'HTML') {
|
|
$output .= "\n<blockquote>".$this->description."</blockquote>\n";
|
|
}
|
|
}
|
|
if (FORMAT === 'MARKDOWN') {
|
|
$output .= "\n";
|
|
}
|
|
if (FORMAT === 'HTML') {
|
|
$output .= "</li>\n";
|
|
}
|
|
return $output;
|
|
}
|
|
}
|