Archived
1
0
Fork 0
This repository has been archived on 2020-07-31. You can view files and clone it, but cannot push or open issues or pull requests.
news-script/Game.php

36 lines
940 B
PHP
Raw Normal View History

2017-01-23 09:00:42 +02:00
<?php
use League\HTMLToMarkdown\HtmlConverter;
2017-01-23 09:00:42 +02:00
class Game {
public $url;
public $title;
public $author;
public $description;
public $date;
public function print() {
2017-02-21 07:27:41 +02:00
if (STYLE === 'RUS') {
$output = "* [«".trim($this->title)."»](".trim($this->url).")";
if ($this->author) {
$output .= " — *".trim($this->author)."*";
}
if ($this->description) {
$output .= " \n<blockquote>".$this->description."</blockquote>\n";
} else {
$output .= "\n";
}
}
if (STYLE === 'ENG') {
$converter = new HtmlConverter();
2017-02-21 07:27:41 +02:00
$output = "* [“".trim($this->title)."”](".trim($this->url).")";
if ($this->author) {
$output .= " by *".trim($this->author)."*";
}
if ($this->description) {
$output .= " \n> ".$converter->convert($this->description)."\n";
2017-02-21 07:27:41 +02:00
} else {
$output .= "\n";
}
2017-01-23 09:00:42 +02:00
}
return $output;
}
}