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
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-04-27 10:27:25 +03:00
$converter = new HtmlConverter();
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) {
$output .= " — <em>".trim($this->author)."</em>";
}
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') {
$output .= "\n\n > ".$converter->convert($this->description)."\n";
}
if (FORMAT === 'HTML') {
$output .= "\n<blockquote>".$converter->convert($this->description)."</blockquote>\n";
}
}
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;
}
}