mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-08 01:26:31 +02:00
core: Add context hinting for new feeds
RSS-Bridge currently has to guess the queried context from the data provided by the user. This, however, can cause issues for bridges that have multiple contexts with conflicting parameters (i.e. none). This commit adds context hinting to queries via '&context=<context>' which can be omitted in which case the context is determined as before.
This commit is contained in:
@@ -194,6 +194,11 @@ abstract class BridgeAbstract implements BridgeInterface {
|
||||
*/
|
||||
public function setDatas(array $inputs){
|
||||
|
||||
if(isset($inputs['context'])) { // Context hinting (optional)
|
||||
$this->queriedContext = $inputs['context'];
|
||||
unset($inputs['context']);
|
||||
}
|
||||
|
||||
if(empty(static::PARAMETERS)) {
|
||||
|
||||
if(!empty($inputs)) {
|
||||
@@ -218,8 +223,11 @@ abstract class BridgeAbstract implements BridgeInterface {
|
||||
);
|
||||
}
|
||||
|
||||
// Guess the paramter context from input data
|
||||
$this->queriedContext = $validator->getQueriedContext($inputs, static::PARAMETERS);
|
||||
// Guess the context from input data
|
||||
if(empty($this->queriedContext)) {
|
||||
$this->queriedContext = $validator->getQueriedContext($inputs, static::PARAMETERS);
|
||||
}
|
||||
|
||||
if(is_null($this->queriedContext)) {
|
||||
returnClientError('Required parameter(s) missing');
|
||||
} elseif($this->queriedContext === false) {
|
||||
|
Reference in New Issue
Block a user