mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-07-31 13:50:23 +02:00
feat: support itunes namespace in top channel feed (#3776)
Also preserves other properties.
This commit is contained in:
@@ -40,9 +40,38 @@ abstract class BridgeAbstract
|
||||
|
||||
abstract public function collectData();
|
||||
|
||||
public function getItems()
|
||||
public function getFeed(): array
|
||||
{
|
||||
return $this->items;
|
||||
return [
|
||||
'name' => $this->getName(),
|
||||
'uri' => $this->getURI(),
|
||||
'donationUri' => $this->getDonationURI(),
|
||||
'icon' => $this->getIcon(),
|
||||
];
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return static::NAME;
|
||||
}
|
||||
|
||||
public function getURI()
|
||||
{
|
||||
return static::URI ?? 'https://github.com/RSS-Bridge/rss-bridge/';
|
||||
}
|
||||
|
||||
public function getDonationURI(): string
|
||||
{
|
||||
return static::DONATION_URI;
|
||||
}
|
||||
|
||||
public function getIcon()
|
||||
{
|
||||
if (static::URI) {
|
||||
// This favicon may or may not exist
|
||||
return rtrim(static::URI, '/') . '/favicon.ico';
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
public function getOption(string $name)
|
||||
@@ -50,6 +79,9 @@ abstract class BridgeAbstract
|
||||
return $this->configuration[$name] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* The description is currently not used in feed production
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return static::DESCRIPTION;
|
||||
@@ -60,29 +92,14 @@ abstract class BridgeAbstract
|
||||
return static::MAINTAINER;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return static::NAME;
|
||||
}
|
||||
|
||||
public function getIcon()
|
||||
{
|
||||
return static::URI . '/favicon.ico';
|
||||
}
|
||||
|
||||
public function getParameters(): array
|
||||
{
|
||||
return static::PARAMETERS;
|
||||
}
|
||||
|
||||
public function getURI()
|
||||
public function getItems()
|
||||
{
|
||||
return static::URI;
|
||||
}
|
||||
|
||||
public function getDonationURI(): string
|
||||
{
|
||||
return static::DONATION_URI;
|
||||
return $this->items;
|
||||
}
|
||||
|
||||
public function getCacheTimeout()
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -9,9 +9,6 @@ const PATH_LIB_CACHES = __DIR__ . '/../caches/';
|
||||
/** Path to the cache folder */
|
||||
const PATH_CACHE = __DIR__ . '/../cache/';
|
||||
|
||||
/** URL to the RSS-Bridge repository */
|
||||
const REPOSITORY = 'https://github.com/RSS-Bridge/rss-bridge/';
|
||||
|
||||
// Allow larger files for simple_html_dom
|
||||
// todo: extract to config (if possible)
|
||||
const MAX_FILE_SIZE = 10000000;
|
||||
|
Reference in New Issue
Block a user