61 lines
1.6 KiB
PHP
61 lines
1.6 KiB
PHP
<?php
|
|
use League\HTMLToMarkdown\HtmlConverter;
|
|
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 HtmlConverter();
|
|
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) {
|
|
$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)."\n";
|
|
}
|
|
if (FORMAT === 'HTML') {
|
|
$output .= "\n<blockquote>".$converter->convert($this->description)."</blockquote>\n";
|
|
}
|
|
}
|
|
if (FORMAT === 'MARKDOWN') {
|
|
$output .= "\n";
|
|
}
|
|
if (FORMAT === 'HTML') {
|
|
$output .= "</li>\n";
|
|
}
|
|
return $output;
|
|
}
|
|
}
|