Formats: Remove display & related method (#2776)

Format should not be responsible for sending HTTP response.
This commit is contained in:
Jan Tojnar 2022-06-07 18:05:33 +02:00 committed by GitHub
parent e85932b1a5
commit fb501652d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 11 additions and 178 deletions

View file

@ -156,14 +156,6 @@ EOD;
return $toReturn;
}
public function display(){
$this
->setContentType(self::MIME_TYPE . '; charset=' . $this->getCharset())
->callContentType();
return parent::display();
}
private function xml_encode($text){
return htmlspecialchars($text, ENT_XML1);
}

View file

@ -137,14 +137,6 @@ EOD;
return $toReturn;
}
public function display() {
$this
->setContentType(self::MIME_TYPE . '; charset=' . $this->getCharset())
->callContentType();
return parent::display();
}
private function buildButton($format, $query) {
return <<<EOD
<a href="./?{$query}"><button class="rss-feed">{$format}</button></a>

View file

@ -122,14 +122,6 @@ class JsonFormat extends FormatAbstract {
return $json;
}
public function display(){
$this
->setContentType(self::MIME_TYPE . '; charset=' . $this->getCharset())
->callContentType();
return parent::display();
}
private function isHTML($text) {
return (strlen(strip_tags($text)) != strlen($text));
}

View file

@ -150,14 +150,6 @@ EOD;
return $toReturn;
}
public function display(){
$this
->setContentType(self::MIME_TYPE . '; charset=' . $this->getCharset())
->callContentType();
return parent::display();
}
private function xml_encode($text){
return htmlspecialchars($text, ENT_XML1);
}

View file

@ -21,12 +21,4 @@ class PlaintextFormat extends FormatAbstract {
$toReturn = mb_convert_encoding($toReturn, $this->getCharset(), 'UTF-8');
return $toReturn;
}
public function display(){
$this
->setContentType(self::MIME_TYPE . '; charset=' . $this->getCharset())
->callContentType();
return parent::display();
}
}