mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-04 15:47:32 +02:00
Created Read queriedContext (markdown)
30
Read-queriedContext.md
Normal file
30
Read-queriedContext.md
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
The queried context is defined via `PARAMETERS` and can be accessed via `$this->queriedContext`.
|
||||||
|
It provides a way to identify which context the bridge is called with.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```PHP
|
||||||
|
...
|
||||||
|
const PARAMETERS = array(
|
||||||
|
'By user name' => array(
|
||||||
|
'u' => array('name' => 'Username')
|
||||||
|
),
|
||||||
|
'By user ID' => array(
|
||||||
|
'id' => array('name' => 'User ID')
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
In this example `$this->queriedContext` will either return **By user name** or **By user ID**. The queried context might return no value, so the best way to handle it is by using a case-structure:
|
||||||
|
|
||||||
|
```PHP
|
||||||
|
switch($this->queriedContext){
|
||||||
|
case 'By user name':
|
||||||
|
break;
|
||||||
|
case 'By user ID':
|
||||||
|
break;
|
||||||
|
default: // Return default value
|
||||||
|
}
|
||||||
|
```
|
Reference in New Issue
Block a user