mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2024-11-26 19:36:52 +03:00
988635dcf3
Add transformation from legacy items to FeedItems, before transforming items to the desired format. This allows using legacy bridges alongside bridges that return FeedItems. As discussed in #940, instead of throwing exceptions on invalid parameters, add messages to the debug log instead Add support for strings to setTimestamp(). If the provided timestamp is a string, automatically try to parse it using strtotime(). This allows bridges to simply use `$item['timestamp'] = $timestamp;` instead of `$item['timestamp'] = strtotime($timestamp);` Support simple_html_dom_node as input paramter for setURI Support simple_html_dom_node as input parameter for setContent
30 lines
646 B
PHP
30 lines
646 B
PHP
<?php
|
|
/**
|
|
* Plaintext
|
|
* Returns $this->items as raw php data.
|
|
*/
|
|
class PlaintextFormat extends FormatAbstract {
|
|
public function stringify(){
|
|
$items = $this->getItems();
|
|
$data = array();
|
|
|
|
foreach($items as $item) {
|
|
$data[] = $item->toArray();
|
|
}
|
|
|
|
$toReturn = print_r($data, true);
|
|
|
|
// Remove invalid non-UTF8 characters
|
|
ini_set('mbstring.substitute_character', 'none');
|
|
$toReturn = mb_convert_encoding($toReturn, $this->getCharset(), 'UTF-8');
|
|
return $toReturn;
|
|
}
|
|
|
|
public function display(){
|
|
$this
|
|
->setContentType('text/plain; charset=' . $this->getCharset())
|
|
->callContentType();
|
|
|
|
return parent::display();
|
|
}
|
|
}
|