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

48 lines
1.3 KiB
PHP

<?php
use League\HTMLToMarkdown\HtmlConverter;
class Game {
public $url;
public $title;
public $author;
public $description;
public $date;
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;
}
}