mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-04 01:55:21 +02:00
feat: support itunes namespace in top channel feed (#3776)
Also preserves other properties.
This commit is contained in:
parent
ea58c8d2bc
commit
3ce94409ab
22 changed files with 298 additions and 203 deletions
|
@ -9,10 +9,43 @@ abstract class FormatAbstract
|
|||
protected string $charset = 'UTF-8';
|
||||
protected array $items = [];
|
||||
protected int $lastModified;
|
||||
protected array $extraInfos = [];
|
||||
|
||||
protected array $feed = [];
|
||||
|
||||
abstract public function stringify();
|
||||
|
||||
public function setFeed(array $feed)
|
||||
{
|
||||
$default = [
|
||||
'name' => '',
|
||||
'uri' => '',
|
||||
'icon' => '',
|
||||
'donationUri' => '',
|
||||
];
|
||||
$this->feed = array_merge($default, $feed);
|
||||
}
|
||||
|
||||
public function getFeed(): array
|
||||
{
|
||||
return $this->feed;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FeedItem[] $items
|
||||
*/
|
||||
public function setItems(array $items): void
|
||||
{
|
||||
$this->items = $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return FeedItem[] The items
|
||||
*/
|
||||
public function getItems(): array
|
||||
{
|
||||
return $this->items;
|
||||
}
|
||||
|
||||
public function getMimeType(): string
|
||||
{
|
||||
return static::MIME_TYPE;
|
||||
|
@ -32,44 +65,4 @@ abstract class FormatAbstract
|
|||
{
|
||||
$this->lastModified = $lastModified;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FeedItem[] $items
|
||||
*/
|
||||
public function setItems(array $items): void
|
||||
{
|
||||
$this->items = $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return FeedItem[] The items
|
||||
*/
|
||||
public function getItems(): array
|
||||
{
|
||||
return $this->items;
|
||||
}
|
||||
|
||||
public function setExtraInfos(array $infos = [])
|
||||
{
|
||||
$extras = [
|
||||
'name',
|
||||
'uri',
|
||||
'icon',
|
||||
'donationUri',
|
||||
];
|
||||
foreach ($extras as $extra) {
|
||||
if (!isset($infos[$extra])) {
|
||||
$infos[$extra] = '';
|
||||
}
|
||||
}
|
||||
$this->extraInfos = $infos;
|
||||
}
|
||||
|
||||
public function getExtraInfos(): array
|
||||
{
|
||||
if (!$this->extraInfos) {
|
||||
$this->setExtraInfos();
|
||||
}
|
||||
return $this->extraInfos;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue