mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2024-11-22 17:45:40 +03:00
55 lines
1.4 KiB
PHP
55 lines
1.4 KiB
PHP
|
<?php
|
||
|
|
||
|
class FeedMergeBridge extends FeedExpander {
|
||
|
const MAINTAINER = 'dvikan';
|
||
|
const NAME = 'FeedMerge';
|
||
|
const URI = 'https://github.com/RSS-Bridge/rss-bridge';
|
||
|
const DESCRIPTION = <<<'TEXT'
|
||
|
This bridge merges two or more feeds into a single feed. Max 10 items are fetched from each feed.
|
||
|
TEXT;
|
||
|
|
||
|
const PARAMETERS = [
|
||
|
[
|
||
|
'feed_name' => [
|
||
|
'name' => 'Feed name',
|
||
|
'type' => 'text',
|
||
|
'exampleValue' => 'rss-bridge/FeedMerger',
|
||
|
],
|
||
|
'feed_1' => [
|
||
|
'name' => 'Feed url',
|
||
|
'type' => 'text',
|
||
|
'required' => true,
|
||
|
'exampleValue' => 'https://lorem-rss.herokuapp.com/feed?unit=day'
|
||
|
],
|
||
|
'feed_2' => ['name' => 'Feed url', 'type' => 'text'],
|
||
|
'feed_3' => ['name' => 'Feed url', 'type' => 'text'],
|
||
|
'feed_4' => ['name' => 'Feed url', 'type' => 'text'],
|
||
|
'feed_5' => ['name' => 'Feed url', 'type' => 'text'],
|
||
|
]
|
||
|
];
|
||
|
|
||
|
public function collectData() {
|
||
|
$limit = 10;
|
||
|
$feeds = [
|
||
|
$this->getInput('feed_1'),
|
||
|
$this->getInput('feed_2'),
|
||
|
$this->getInput('feed_3'),
|
||
|
$this->getInput('feed_4'),
|
||
|
$this->getInput('feed_5'),
|
||
|
];
|
||
|
// Remove empty values
|
||
|
$feeds = array_filter($feeds);
|
||
|
foreach ($feeds as $feed) {
|
||
|
$this->collectExpandableDatas($feed, $limit);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public function getIcon() {
|
||
|
return 'https://cdn.jsdelivr.net/npm/famfamfam-silk@1.0.0/dist/png/folder_feed.png';
|
||
|
}
|
||
|
|
||
|
public function getName() {
|
||
|
return $this->getInput('feed_name') ?: 'rss-bridge/FeedMerger';
|
||
|
}
|
||
|
}
|