[RedditBridge] Add new bridge (#1213)
This commit is contained in:
parent
7c16aaf303
commit
46d5895d1d
1 changed files with 40 additions and 0 deletions
40
bridges/RedditBridge.php
Normal file
40
bridges/RedditBridge.php
Normal file
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
class RedditBridge extends FeedExpander {
|
||||
|
||||
const MAINTAINER = 'leomaradan';
|
||||
const NAME = 'Reddit Bridge';
|
||||
const URI = 'https://www.reddit.com/';
|
||||
const DESCRIPTION = 'Reddit RSS Feed fixer';
|
||||
|
||||
const PARAMETERS = array(
|
||||
'single' => array(
|
||||
'r' => array(
|
||||
'name' => 'SubReddit',
|
||||
'required' => true,
|
||||
'exampleValue' => 'selfhosted',
|
||||
'title' => 'SubReddit name'
|
||||
)
|
||||
),
|
||||
'multi' => array(
|
||||
'rs' => array(
|
||||
'name' => 'SubReddits',
|
||||
'required' => true,
|
||||
'exampleValue' => 'selfhosted, php',
|
||||
'title' => 'SubReddit names, separated by commas'
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
public function collectData(){
|
||||
|
||||
switch($this->queriedcontext) {
|
||||
case 'single': $subreddits[] = $this->getInput('r'); break;
|
||||
case 'multi': $subreddits = explode(',', $this->getInput('rs')); break;
|
||||
}
|
||||
|
||||
foreach ($subreddits as $subreddit) {
|
||||
$name = trim($subreddit);
|
||||
$this->collectExpandableDatas("https://www.reddit.com/r/$name/.rss");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue