1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-08-20 23:31:37 +02:00

[core + bridges] add BridgeAbstract::$inputs and BridgeAbstract::getInput()

Inputs are not stored in BridgeAbstract::$parameters anymore to separate
static data from dynamic data.
The getInput method allows for more readable code.

Also fix an "undefined index 'global'" notice

Probability of breaking bridges: high !

Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
This commit is contained in:
Pierre Mazière
2016-08-28 01:25:33 +02:00
parent a4fd7b8b98
commit 1b3c8a8aeb
78 changed files with 303 additions and 385 deletions

View File

@@ -79,7 +79,6 @@ class FuturaSciencesBridge extends BridgeAbstract {
));
public function collectData(){
$param=$this->parameters[$this->queriedContext];
function StripCDATA($string) {
$string = str_replace('<![CDATA[', '', $string);
@@ -136,10 +135,10 @@ class FuturaSciencesBridge extends BridgeAbstract {
return '';
}
$url = $this->getURI().'rss/'.$param['feed']['value'].'.xml';
if (empty($param['feed']['value']))
$url = $this->getURI().'rss/'.$this->getInput('feed').'.xml';
if (empty($this->getInput('feed')))
$this->returnClientError('Please select a feed to display.'.$url);
if ($param['feed']['value'] !== preg_replace('/[^a-zA-Z-\/]+/', '', $param['feed']['value']) || substr_count($param['feed']['value'], '/') > 1 || strlen($param['feed']['value'] > 64))
if ($this->getInput('feed') !== preg_replace('/[^a-zA-Z-\/]+/', '', $this->getInput('feed')) || substr_count($this->getInput('feed'), '/') > 1 || strlen($this->getInput('feed') > 64))
$this->returnClientError('Invalid "feed" parameter.'.$url);
$html = $this->getSimpleHTMLDOM($url) or $this->returnServerError('Could not request Futura-Sciences: '.$url);