1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-08-16 13:34:11 +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

@@ -21,27 +21,26 @@ class PinterestBridge extends BridgeAbstract{
);
public function collectData(){
$param=$this->parameters[$this->queriedContext];
$html = '';
if (isset($param['u']['value']) || isset($param['b']['value'])) {
if (isset($this->getInput('u')) || isset($this->getInput('b'))) {
if (empty($param['u']['value']))
if (empty($this->getInput('u')))
{
$this->returnClientError('You must specify a Pinterest username (?u=...).');
}
if (empty($param['b']['value']))
if (empty($this->getInput('b')))
{
$this->returnClientError('You must specify a Pinterest board for this username (?b=...).');
}
$this->username = $param['u']['value'];
$this->board = $param['b']['value'];
$this->username = $this->getInput('u');
$this->board = $this->getInput('b');
$html = $this->getSimpleHTMLDOM($this->getURI().'/'.urlencode($this->username).'/'.urlencode($this->board)) or $this->returnServerError('Username and/or board not found');
} else if (isset($param['q']['value']))
} else if (isset($this->getInput('q')))
{
$this->query = $param['q']['value'];
$this->query = $this->getInput('q');
$html = $this->getSimpleHTMLDOM($this->getURI().'/search/?q='.urlencode($this->query)) or $this->returnServerError('Could not request Pinterest.');
}