diff --git a/bridges/AllocineFRBridge.php b/bridges/AllocineFRBridge.php
index 4289b0c..3911955 100644
--- a/bridges/AllocineFRBridge.php
+++ b/bridges/AllocineFRBridge.php
@@ -22,14 +22,8 @@ class AllocineFRBridge extends BridgeAbstract{
));
public function collectData(){
- $params=$this->parameters[$this->queriedContext];
-
- // Check all parameters
- if(!isset($params['category']['value']))
- $this->returnClientError('You must specify a valid category (&category= )!');
-
$category = '';
- switch($params['category']['value']){
+ switch($this->getInput('category')){
case 'faux-raccord':
$this->uri = 'http://www.allocine.fr/video/programme-12284/saison-24580/';
$category = 'Faux Raccord';
diff --git a/bridges/AnimeUltimeBridge.php b/bridges/AnimeUltimeBridge.php
index 51e74e1..6b65247 100644
--- a/bridges/AnimeUltimeBridge.php
+++ b/bridges/AnimeUltimeBridge.php
@@ -21,13 +21,12 @@ class AnimeUltimeBridge extends BridgeAbstract {
private $filter = 'Releases';
public function collectData(){
- $param=$this->parameters[$this->queriedContext];
//Add type filter if provided
$typeFilter = '';
- if (!empty($param['type']['value'])) {
- if ($param['type']['value'] == 'A' || $param['type']['value'] == 'D' || $param['type']['value'] == 'T') {
- $typeFilter = $param['type']['value'];
+ if (!empty($this->getInput('type'))) {
+ if ($this->getInput('type') == 'A' || $this->getInput('type') == 'D' || $this->getInput('type') == 'T') {
+ $typeFilter = $this->getInput('type');
if ($typeFilter == 'A') { $this->filter = 'Anime'; }
if ($typeFilter == 'D') { $this->filter = 'Drama'; }
if ($typeFilter == 'T') { $this->filter = 'Tokusatsu'; }
diff --git a/bridges/Arte7Bridge.php b/bridges/Arte7Bridge.php
index 2f24b81..9510dd1 100644
--- a/bridges/Arte7Bridge.php
+++ b/bridges/Arte7Bridge.php
@@ -60,13 +60,12 @@
}
public function collectData(){
- $param=$this->parameters[$this->queriedContext];
$category='toutes-les-videos'; $lang='fr';
- if (!empty($param['catfr']['value']))
- $category=$param['catfr']['value'];
- if (!empty($param['catde']['value']))
- { $category=$param['catde']['value']; $lang='de'; }
+ if (!empty($this->getInput('catfr')))
+ $category=$this->getInput('catfr');
+ if (!empty($this->getInput('catde')))
+ { $category=$this->getInput('catde'); $lang='de'; }
$input_json = $this->extractVideoset($category, $lang);
foreach($input_json['videos'] as $element) {
diff --git a/bridges/AskfmBridge.php b/bridges/AskfmBridge.php
index 0a88d51..785dab2 100644
--- a/bridges/AskfmBridge.php
+++ b/bridges/AskfmBridge.php
@@ -15,10 +15,9 @@ class AskfmBridge extends BridgeAbstract{
);
public function collectData(){
- $param=$this->parameters[$this->queriedContext];
$html = '';
- if (isset($param['u']['value'])) {
- $this->request = $param['u']['value'];
+ if (isset($this->getInput('u'))) {
+ $this->request = $this->getInput('u');
$html = $this->getSimpleHTMLDOM('http://ask.fm/'.urlencode($this->request).'/answers/more?page=0') or $this->returnServerError('Requested username can\'t be found.');
}
else {
diff --git a/bridges/BandcampBridge.php b/bridges/BandcampBridge.php
index a5666e8..5434cb5 100644
--- a/bridges/BandcampBridge.php
+++ b/bridges/BandcampBridge.php
@@ -13,10 +13,9 @@ class BandcampBridge extends BridgeAbstract{
));
public function collectData(){
- $param=$this->parameters[$this->queriedContext];
$html = '';
- if (isset($param['tag']['value'])) {
- $html = $this->getSimpleHTMLDOM('http://bandcamp.com/tag/'.urlencode($param['tag']['value']).'?sort_field=date') or $this->returnServerError('No results for this query.');
+ if (isset($this->getInput('tag'))) {
+ $html = $this->getSimpleHTMLDOM('http://bandcamp.com/tag/'.urlencode($this->getInput('tag')).'?sort_field=date') or $this->returnServerError('No results for this query.');
}
else {
$this->returnClientError('You must specify tag (/tag/...)');
@@ -38,9 +37,8 @@ class BandcampBridge extends BridgeAbstract{
}
public function getName(){
- $param=$this->parameters[$this->queriedContext];
- return (!empty($param['tag']['value']) ? $param['tag']['value'] .' - ' : '') .'Bandcamp Tag';
+ return (!empty($this->getInput('tag')) ? $this->getInput('tag') .' - ' : '') .'Bandcamp Tag';
}
public function getCacheDuration(){
diff --git a/bridges/BooruprojectBridge.php b/bridges/BooruprojectBridge.php
index 3684541..66e2554 100644
--- a/bridges/BooruprojectBridge.php
+++ b/bridges/BooruprojectBridge.php
@@ -17,29 +17,28 @@ class BooruprojectBridge extends BridgeAbstract{
));
public function collectData(){
- $param=$this->parameters[$this->queriedContext];
$page = 0; $tags = '';
- if (!empty($param['p']['value'])) {
- $page = (int)preg_replace("/[^0-9]/",'', $param['p']['value']);
+ if (!empty($this->getInput('p'))) {
+ $page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p'));
$page = $page - 1;
$page = $page * 20;
}
- if (!empty($param['t']['value'])) {
- $tags = '&tags='.urlencode($param['t']['value']);
+ if (!empty($this->getInput('t'))) {
+ $tags = '&tags='.urlencode($this->getInput('t'));
}
- if (empty($param['i']['value'])) {
+ if (empty($this->getInput('i'))) {
$this->returnServerError('Please enter a ***.booru.org instance.');
}
- $html = $this->getSimpleHTMLDOM("http://".$param['i']['value'].".booru.org/index.php?page=post&s=list&pid=".$page.$tags) or $this->returnServerError('Could not request Booruproject.');
+ $html = $this->getSimpleHTMLDOM("http://".$this->getInput('i').".booru.org/index.php?page=post&s=list&pid=".$page.$tags) or $this->returnServerError('Could not request Booruproject.');
foreach($html->find('div[class=content] span') as $element) {
$item = array();
- $item['uri'] = 'http://'.$param['i']['value'].'.booru.org/'.$element->find('a', 0)->href;
+ $item['uri'] = 'http://'.$this->getInput('i').'.booru.org/'.$element->find('a', 0)->href;
$item['postid'] = (int)preg_replace("/[^0-9]/",'', $element->find('a', 0)->getAttribute('id'));
$item['timestamp'] = time();
$item['tags'] = $element->find('img', 0)->getAttribute('title');
- $item['title'] = 'Booruproject '.$param['i']['value'].' | '.$item['postid'];
+ $item['title'] = 'Booruproject '.$this->getInput('i').' | '.$item['postid'];
$item['content'] = '
Tags: '.$item['tags'];
$this->items[] = $item;
}
diff --git a/bridges/CNETBridge.php b/bridges/CNETBridge.php
index 445c119..b296391 100644
--- a/bridges/CNETBridge.php
+++ b/bridges/CNETBridge.php
@@ -11,7 +11,6 @@ class CNETBridge extends BridgeAbstract {
));
public function collectData(){
- $param=$this->parameters[$this->queriedContext];
function ExtractFromDelimiters($string, $start, $end) {
if (strpos($string, $start) !== false) {
@@ -38,7 +37,7 @@ class CNETBridge extends BridgeAbstract {
return $article_html;
}
- $pageUrl = 'http://www.cnet.com/'.(empty($param['topic']['value']) ? '' : 'topics/'.$param['topic']['value'].'/');
+ $pageUrl = 'http://www.cnet.com/'.(empty($this->getInput('topic')) ? '' : 'topics/'.$this->getInput('topic').'/');
$html = $this->getSimpleHTMLDOM($pageUrl) or $this->returnServerError('Could not request CNET: '.$pageUrl);
$limit = 0;
@@ -70,8 +69,7 @@ class CNETBridge extends BridgeAbstract {
}
public function getName() {
- $param=$this->parameters[$this->queriedContext];
- return 'CNET News Bridge'.(empty($param['topic']['value']) ? '' : ' - '.$this->param['topic']['value']);
+ return 'CNET News Bridge'.(empty($this->getInput('topic')) ? '' : ' - '.$this->param['topic']['value']);
}
public function getCacheDuration() {
diff --git a/bridges/CastorusBridge.php b/bridges/CastorusBridge.php
index c328293..453f2b5 100644
--- a/bridges/CastorusBridge.php
+++ b/bridges/CastorusBridge.php
@@ -74,12 +74,11 @@ class CastorusBridge extends BridgeAbstract {
}
public function collectData(){
- $params=$this->parameters[$this->queriedContext];
- if(isset($params['zip']['value']))
- $zip_filter = trim($params['zip']['value']);
+ if(isset($this->getInput('zip')))
+ $zip_filter = trim($this->getInput('zip'));
- if(isset($params['city']['value']))
- $city_filter = trim($params['city']['value']);
+ if(isset($this->getInput('city')))
+ $city_filter = trim($this->getInput('city'));
$html = $this->getSimpleHTMLDOM($this->uri);
diff --git a/bridges/CpasbienBridge.php b/bridges/CpasbienBridge.php
index a8e1b5a..587f84a 100644
--- a/bridges/CpasbienBridge.php
+++ b/bridges/CpasbienBridge.php
@@ -15,10 +15,9 @@ class CpasbienBridge extends HttpCachingBridgeAbstract{
));
public function collectData(){
- $param=$this->parameters[$this->queriedContext];
$html = '';
- if (isset($param['q']['value'])) { /* keyword search mode */
- $request = str_replace(" ","-",trim($param['q']['value']));
+ if (isset($this->getInput('q'))) { /* keyword search mode */
+ $request = str_replace(" ","-",trim($this->getInput('q')));
$html = $this->getSimpleHTMLDOM($this->uri.'/recherche/'.urlencode($request).'.html') or $this->returnServerError('No results for this query.');
} else {
$this->returnClientError('You must specify a keyword (?q=...).');
diff --git a/bridges/CryptomeBridge.php b/bridges/CryptomeBridge.php
index b7e5fbb..77ce4bd 100644
--- a/bridges/CryptomeBridge.php
+++ b/bridges/CryptomeBridge.php
@@ -15,7 +15,6 @@ class CryptomeBridge extends BridgeAbstract{
));
public function collectData(){
- $param=$this->parameters[$this->queriedContext];
$html = '';
$num = 20;
$link = 'http://cryptome.org/';
@@ -23,8 +22,8 @@ class CryptomeBridge extends BridgeAbstract{
//$link = 'https://secure.netsolhost.com/cryptome.org/';
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('Could not request Cryptome.');
- if (!empty($param['n']['value'])) { /* number of documents */
- $num = min(max(1, $param['n']['value']+0), $num);
+ if (!empty($this->getInput('n'))) { /* number of documents */
+ $num = min(max(1, $this->getInput('n')+0), $num);
}
diff --git a/bridges/DailymotionBridge.php b/bridges/DailymotionBridge.php
index 50c8988..58dfe8f 100644
--- a/bridges/DailymotionBridge.php
+++ b/bridges/DailymotionBridge.php
@@ -68,16 +68,15 @@ class DailymotionBridge extends BridgeAbstract{
}
public function getName(){
- $param=$this->parameters[$this->queriedContext];
switch($this->queriedContext){
case 'By username':
- $specific=$param['u']['value'];
+ $specific=$this->getInput('u');
break;
case 'By playlist id':
- $specific=strtok($param['p']['value'], '_');
+ $specific=strtok($this->getInput('p'), '_');
break;
case 'From search results':
- $specific=$param['s']['value'];
+ $specific=$this->getInput('s');
break;
}
@@ -85,21 +84,20 @@ class DailymotionBridge extends BridgeAbstract{
}
public function getURI(){
- $param=$this->parameters[$this->queriedContext];
switch($this->queriedContext){
case 'By username':
$uri='http://www.dailymotion.com/user/'
- .urlencode($param['u']['value']).'/1';
+ .urlencode($this->getInput('u')).'/1';
break;
case 'By playlist id':
$uri='http://www.dailymotion.com/playlist/'
- .urlencode(strtok($param['p']['value'], '_'));
+ .urlencode(strtok($this->getInput('p'), '_'));
break;
case 'From search results':
$uri='http://www.dailymotion.com/search/'
- .urlencode($param['s']['value']);
- if(isset($param['pa']['value'])){
- $uri.='/'.$param['pa']['value'];
+ .urlencode($this->getInput('s'));
+ if(isset($this->getInput('pa'))){
+ $uri.='/'.$this->getInput('pa');
}
break;
}
diff --git a/bridges/DanbooruBridge.php b/bridges/DanbooruBridge.php
index 0e73967..4a48004 100644
--- a/bridges/DanbooruBridge.php
+++ b/bridges/DanbooruBridge.php
@@ -12,13 +12,12 @@ class DanbooruBridge extends BridgeAbstract{
));
public function collectData(){
- $param=$this->parameters[$this->queriedContext];
$page = 1;$tags='';
- if (isset($param['p']['value'])) {
- $page = (int)preg_replace("/[^0-9]/",'', $param['p']['value']);
+ if (isset($this->getInput('p'))) {
+ $page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p'));
}
- if (isset($param['t']['value'])) {
- $tags = urlencode($param['t']['value']);
+ if (isset($this->getInput('t'))) {
+ $tags = urlencode($this->getInput('t'));
}
$html = $this->getSimpleHTMLDOM("http://donmai.us/posts?&page=$page&tags=$tags") or $this->returnServerError('Could not request Danbooru.');
foreach($html->find('div[id=posts] article') as $element) {
diff --git a/bridges/DauphineLibereBridge.php b/bridges/DauphineLibereBridge.php
index f55017f..d4fa6b7 100644
--- a/bridges/DauphineLibereBridge.php
+++ b/bridges/DauphineLibereBridge.php
@@ -38,7 +38,6 @@ class DauphineLibereBridge extends BridgeAbstract {
}
public function collectData(){
- $param=$this->parameters[$this->queriedContext];
// Simulate Mozilla user-agent to fix error 403 (Forbidden)
$opts = array('http' =>
@@ -50,8 +49,8 @@ class DauphineLibereBridge extends BridgeAbstract {
$context = stream_context_create($opts);
- if (isset($param['u']['value'])) { /* user timeline mode */
- $this->request = $param['u']['value'];
+ if (isset($this->getInput('u'))) { /* user timeline mode */
+ $this->request = $this->getInput('u');
$html = $this->getSimpleHTMLDOM('http://www.ledauphine.com/'.$this->request.'/rss',false,$context) or $this->returnServerError('Could not request DauphineLibere.');
}
else {
diff --git a/bridges/DollbooruBridge.php b/bridges/DollbooruBridge.php
index 43faba4..8a4e93a 100644
--- a/bridges/DollbooruBridge.php
+++ b/bridges/DollbooruBridge.php
@@ -16,13 +16,12 @@ class DollbooruBridge extends BridgeAbstract{
));
public function collectData(){
- $param=$this->parameters[$this->queriedContext];
$page = 0;$tags='';
- if (isset($param['p']['value'])) {
- $page = (int)preg_replace("/[^0-9]/",'', $param['p']['value']);
+ if (isset($this->getInput('p'))) {
+ $page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p'));
}
- if (isset($param['t']['value'])) {
- $tags = urlencode($param['t']['value']);
+ if (isset($this->getInput('t'))) {
+ $tags = urlencode($this->getInput('t'));
}
$html = $this->getSimpleHTMLDOM("http://dollbooru.org/post/list/$tags/$page") or $this->returnServerError('Could not request Dollbooru.');
diff --git a/bridges/DuckDuckGoBridge.php b/bridges/DuckDuckGoBridge.php
index 143ab9f..1ca33bb 100644
--- a/bridges/DuckDuckGoBridge.php
+++ b/bridges/DuckDuckGoBridge.php
@@ -13,9 +13,8 @@ class DuckDuckGoBridge extends BridgeAbstract{
));
public function collectData(){
- $param=$this->parameters[$this->queriedContext];
$html = '';
- $link = 'http://duckduckgo.com/html/?q='.$param['u']['value'].'+sort:date';
+ $link = 'http://duckduckgo.com/html/?q='.$this->getInput('u').'+sort:date';
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('Could not request DuckDuckGo.');
diff --git a/bridges/EZTVBridge.php b/bridges/EZTVBridge.php
index 5e28413..39eaab4 100644
--- a/bridges/EZTVBridge.php
+++ b/bridges/EZTVBridge.php
@@ -15,7 +15,6 @@ class EZTVBridge extends BridgeAbstract{
));
public function collectData(){
- $param=$this->parameters[$this->queriedContext];
// Make timestamp from relative released time in table
function makeTimestamp($relativeReleaseTime){
@@ -31,11 +30,11 @@ class EZTVBridge extends BridgeAbstract{
}
// Check for ID provided
- if (!isset($param['i']['value']))
+ if (!isset($this->getInput('i')))
$this->returnClientError('You must provide a list of ID (?i=showID1,showID2,...)');
// Loop on show ids
- $showList = explode(",",$param['i']['value']);
+ $showList = explode(",",$this->getInput('i'));
foreach($showList as $showID){
// Get show page
diff --git a/bridges/ElsevierBridge.php b/bridges/ElsevierBridge.php
index 6a96a6c..fa16c8e 100644
--- a/bridges/ElsevierBridge.php
+++ b/bridges/ElsevierBridge.php
@@ -56,9 +56,8 @@ class ElsevierBridge extends BridgeAbstract{
}
public function collectData(){
- $param=$this->parameters[$this->queriedContext];
- $uri = 'http://www.journals.elsevier.com/' . $param['j']['value'] . '/recent-articles/';
- $html = $this->getSimpleHTMLDOM($uri) or $this->returnServerError('No results for Elsevier journal '.$param['j']['value']);
+ $uri = 'http://www.journals.elsevier.com/' . $this->getInput('j') . '/recent-articles/';
+ $html = $this->getSimpleHTMLDOM($uri) or $this->returnServerError('No results for Elsevier journal '.$this->getInput('j'));
foreach($html->find('.pod-listing') as $article){
$item = array();
diff --git a/bridges/FacebookBridge.php b/bridges/FacebookBridge.php
index d3ef9bf..0a2554a 100644
--- a/bridges/FacebookBridge.php
+++ b/bridges/FacebookBridge.php
@@ -14,7 +14,6 @@ class FacebookBridge extends BridgeAbstract{
));
public function collectData(){
- $param=$this->parameters[$this->queriedContext];
//Extract a string using start and end delimiters
function ExtractFromDelimiters($string, $start, $end) {
@@ -102,11 +101,11 @@ class FacebookBridge extends BridgeAbstract{
//Retrieve page contents
if (is_null($html)) {
- if (isset($param['u']['value'])) {
- if (!strpos($param['u']['value'], "/")) {
- $html = $this->getSimpleHTMLDOM('https://www.facebook.com/'.urlencode($param['u']['value']).'?_fb_noscript=1') or $this->returnServerError('No results for this query.');
+ if (isset($this->getInput('u'))) {
+ if (!strpos($this->getInput('u'), "/")) {
+ $html = $this->getSimpleHTMLDOM('https://www.facebook.com/'.urlencode($this->getInput('u')).'?_fb_noscript=1') or $this->returnServerError('No results for this query.');
} else {
- $html = $this->getSimpleHTMLDOM('https://www.facebook.com/pages/'.$param['u']['value'].'?_fb_noscript=1') or $this->returnServerError('No results for this query.');
+ $html = $this->getSimpleHTMLDOM('https://www.facebook.com/pages/'.$this->getInput('u').'?_fb_noscript=1') or $this->returnServerError('No results for this query.');
}
} else {
$this->returnClientError('You must specify a Facebook username.');
@@ -146,7 +145,7 @@ class FacebookBridge extends BridgeAbstract{
if(isset($element)) {
$author = str_replace(' | Facebook', '', $html->find('title#pageTitle', 0)->innertext);
- $profilePic = 'https://graph.facebook.com/'.$param['u']['value'].'/picture?width=200&height=200';
+ $profilePic = 'https://graph.facebook.com/'.$this->getInput('u').'/picture?width=200&height=200';
$this->name = $author;
foreach($element->children() as $post) {
@@ -205,8 +204,8 @@ class FacebookBridge extends BridgeAbstract{
}
public function setDatas(array $param){
- if (isset($param['captcha_response']['value']))
- unset($param['captcha_response']['value']);
+ if (isset($this->getInput('captcha_response')))
+ unset($this->getInput('captcha_response'));
parent::setDatas($param);
}
diff --git a/bridges/FlickrTagBridge.php b/bridges/FlickrTagBridge.php
index 43e22d9..869025e 100644
--- a/bridges/FlickrTagBridge.php
+++ b/bridges/FlickrTagBridge.php
@@ -17,14 +17,13 @@ class FlickrTagBridge extends BridgeAbstract{
);
public function collectData(){
- $param=$this->parameters[$this->queriedContext];
$html = $this->getSimpleHTMLDOM('http://www.flickr.com/search/?q=vendee&s=rec') or $this->returnServerError('Could not request Flickr.');
- if (isset($param['q']['value'])) { /* keyword search mode */
- $this->request = $param['q']['value'];
+ if (isset($this->getInput('q'))) { /* keyword search mode */
+ $this->request = $this->getInput('q');
$html = $this->getSimpleHTMLDOM('http://www.flickr.com/search/?q='.urlencode($this->request).'&s=rec') or $this->returnServerError('No results for this query.');
}
- elseif (isset($param['u']['value'])) { /* user timeline mode */
- $this->request = $param['u']['value'];
+ elseif (isset($this->getInput('u'))) { /* user timeline mode */
+ $this->request = $this->getInput('u');
$html = $this->getSimpleHTMLDOM('http://www.flickr.com/photos/'.urlencode($this->request).'/') or $this->returnServerError('Requested username can\'t be found.');
}
diff --git a/bridges/FourchanBridge.php b/bridges/FourchanBridge.php
index f566364..ad92ac1 100644
--- a/bridges/FourchanBridge.php
+++ b/bridges/FourchanBridge.php
@@ -11,12 +11,11 @@ class FourchanBridge extends BridgeAbstract{
));
public function collectData(){
- $param=$this->parameters[$this->queriedContext];
- if (!isset($param['t']['value']))
+ if (!isset($this->getInput('t')))
$this->returnClientError('You must specify the thread URL (?t=...)');
- $thread = parse_url($param['t']['value']) or $this->returnClientError('This URL seems malformed, please check it.');
+ $thread = parse_url($this->getInput('t')) or $this->returnClientError('This URL seems malformed, please check it.');
if($thread['host'] !== 'boards.4chan.org')
$this->returnClientError('4chan thread URL only.');
diff --git a/bridges/FuturaSciencesBridge.php b/bridges/FuturaSciencesBridge.php
index d25d6ac..cc252b8 100644
--- a/bridges/FuturaSciencesBridge.php
+++ b/bridges/FuturaSciencesBridge.php
@@ -79,7 +79,6 @@ class FuturaSciencesBridge extends BridgeAbstract {
));
public function collectData(){
- $param=$this->parameters[$this->queriedContext];
function StripCDATA($string) {
$string = str_replace('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);
diff --git a/bridges/GBAtempBridge.php b/bridges/GBAtempBridge.php
index ef554ad..eccd090 100644
--- a/bridges/GBAtempBridge.php
+++ b/bridges/GBAtempBridge.php
@@ -60,11 +60,10 @@ class GBAtempBridge extends BridgeAbstract {
}
public function collectData(){
- $param=$this->parameters[$this->queriedContext];
$html = $this->getSimpleHTMLDOM($this->uri) or $this->returnServerError('Could not request GBAtemp.');
- switch($param['type']['value']){
+ switch($this->getInput('type')){
case 'N':
foreach ($html->find('li[class=news_item full]') as $newsItem) {
$url = $this->uri.$newsItem->find('a', 0)->href;
@@ -111,8 +110,7 @@ class GBAtempBridge extends BridgeAbstract {
}
public function getName() {
- $param=$this->parameters[$this->queriedContext];
- $type=array_search($param['type']['value'],$param['type']['values']);
+ $type=array_search($this->getInput('type'),$param['type']['values']);
return 'GBAtemp '.$type.' Bridge';
}
diff --git a/bridges/GawkerBridge.php b/bridges/GawkerBridge.php
index 3d6bc2b..7522fbb 100644
--- a/bridges/GawkerBridge.php
+++ b/bridges/GawkerBridge.php
@@ -22,12 +22,11 @@ class GawkerBridge extends RssExpander{
}
public function collectData(){
- $param=$this->parameters[$this->queriedContext];
- if (empty($param['site']['value'])) {
+ if (empty($this->getInput('site'))) {
trigger_error("If no site is provided, nothing is gonna happen", E_USER_ERROR);
} else {
- $this->name = $param['site']['value'];
- $url = $this->toURI(strtolower($param['site']['value']));
+ $this->name = $this->getInput('site');
+ $url = $this->toURI(strtolower($this->getInput('site')));
}
$this->debugMessage("loading feed from ".$this->getURI());
parent::collectExpandableDatas($url);
diff --git a/bridges/GelbooruBridge.php b/bridges/GelbooruBridge.php
index 486c9eb..67ec92b 100644
--- a/bridges/GelbooruBridge.php
+++ b/bridges/GelbooruBridge.php
@@ -15,15 +15,14 @@ class GelbooruBridge extends BridgeAbstract{
));
public function collectData(){
- $param=$this->parameters[$this->queriedContext];
$page = 0;
- if (isset($param['p']['value'])) {
- $page = (int)preg_replace("/[^0-9]/",'', $param['p']['value']);
+ if (isset($this->getInput('p'))) {
+ $page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p'));
$page = $page - 1;
$page = $page * 63;
}
- if (isset($param['t']['value'])) {
- $tags = urlencode($param['t']['value']);
+ if (isset($this->getInput('t'))) {
+ $tags = urlencode($this->getInput('t'));
}
$html = $this->getSimpleHTMLDOM("http://gelbooru.com/index.php?page=post&s=list&tags=$tags&pid=$page") or $this->returnServerError('Could not request Gelbooru.');
diff --git a/bridges/GiphyBridge.php b/bridges/GiphyBridge.php
index cf2af65..6705a0d 100644
--- a/bridges/GiphyBridge.php
+++ b/bridges/GiphyBridge.php
@@ -17,23 +17,22 @@ class GiphyBridge extends BridgeAbstract{
));
public function collectData(){
- $param=$this->parameters[$this->queriedContext];
$html = '';
$base_url = 'http://giphy.com';
- if (isset($param['s']['value'])) { /* keyword search mode */
- $html = $this->getSimpleHTMLDOM($base_url.'/search/'.urlencode($param['s']['value'].'/')) or $this->returnServerError('No results for this query.');
+ if (isset($this->getInput('s'))) { /* keyword search mode */
+ $html = $this->getSimpleHTMLDOM($base_url.'/search/'.urlencode($this->getInput('s').'/')) or $this->returnServerError('No results for this query.');
}
else {
$this->returnClientError('You must specify a search worf (?s=...).');
}
$max = GIPHY_LIMIT;
- if (isset($param['n']['value'])) {
- $max = (integer) $param['n']['value'];
+ if (isset($this->getInput('n'))) {
+ $max = (integer) $this->getInput('n');
}
$limit = 0;
- $kw = urlencode($param['s']['value']);
+ $kw = urlencode($this->getInput('s'));
foreach($html->find('div.hoverable-gif') as $entry) {
if($limit < $max) {
$node = $entry->first_child();
diff --git a/bridges/GithubIssueBridge.php b/bridges/GithubIssueBridge.php
index 83c98be..8b520e9 100644
--- a/bridges/GithubIssueBridge.php
+++ b/bridges/GithubIssueBridge.php
@@ -29,12 +29,11 @@ class GithubIssueBridge extends BridgeAbstract{
);
public function collectData(){
- $param=$this->parameters[$this->queriedContext];
- $uri = 'https://github.com/'.$param['u']['value'].'/'.$param['p']['value'].'/issues/'.(isset($param['i']['value'])?$param['i']['value']:'');
+ $uri = 'https://github.com/'.$this->getInput('u').'/'.$this->getInput('p').'/issues/'.(isset($this->getInput('i'))?$this->getInput('i'):'');
$html = $this->getSimpleHTMLDOM($uri)
- or $this->returnServerError('No results for Github Issue '.$param['i']['value'].' in project '.$param['u']['value'].'/'.$param['p']['value']);
+ or $this->returnServerError('No results for Github Issue '.$this->getInput('i').' in project '.$this->getInput('u').'/'.$this->getInput('p'));
- if(isset($param['i']['value'])){
+ if(isset($this->getInput('i'))){
foreach($html->find('.js-comment-container') as $comment){
$item = array();
diff --git a/bridges/GitlabCommitsBridge.php b/bridges/GitlabCommitsBridge.php
index c8558fe..dd7af0c 100644
--- a/bridges/GitlabCommitsBridge.php
+++ b/bridges/GitlabCommitsBridge.php
@@ -26,29 +26,28 @@ class GitlabCommitsBridge extends BridgeAbstract{
));
public function collectData(){
- $param=$this->parameters[$this->queriedContext];
- $uri = $param['uri']['value'].'/'.$param['u']['value'].'/'.$param['p']['value'].'/commits/';
- if(isset($param['b']['value'])){
- $uri.=$param['b']['value'];
+ $uri = $this->getInput('uri').'/'.$this->getInput('u').'/'.$this->getInput('p').'/commits/';
+ if(isset($this->getInput('b'))){
+ $uri.=$this->getInput('b');
}else{
$uri.='master';
}
$html = $this->getSimpleHTMLDOM($uri)
- or $this->returnServerError('No results for Gitlab Commits of project '.$param['uri']['value'].'/'.$param['u']['value'].'/'.$param['p']['value']);
+ or $this->returnServerError('No results for Gitlab Commits of project '.$this->getInput('uri').'/'.$this->getInput('u').'/'.$this->getInput('p'));
foreach($html->find('li.commit') as $commit){
$item = array();
- $item['uri']=$param['uri']['value'];
+ $item['uri']=$this->getInput('uri');
foreach($commit->getElementsByTagName('a') as $a){
$classes=explode(' ',$a->getAttribute("class"));
if(in_array('commit-short-id',$classes) ||
in_array('commit_short_id',$classes)){
$href=$a->getAttribute('href');
- $item['uri'].=substr($href,strpos($href,'/'.$param['u']['value'].'/'.$param['p']['value']));
+ $item['uri'].=substr($href,strpos($href,'/'.$this->getInput('u').'/'.$this->getInput('p')));
}
if(in_array('commit-row-message',$classes)){
$item['title']=$a->plaintext;
diff --git a/bridges/GooglePlusPostBridge.php b/bridges/GooglePlusPostBridge.php
index 8e7b228..ad780ed 100644
--- a/bridges/GooglePlusPostBridge.php
+++ b/bridges/GooglePlusPostBridge.php
@@ -21,12 +21,12 @@ class GooglePlusPostBridge extends BridgeAbstract
public function collectData()
{
$param=$this->parameters[$queriedContext];
- if (!isset($param['username']['value']))
+ if (!isset($this->getInput('username')))
{
$this->returnClientError('You must specify a username (?username=...).');
}
- $this->request = $param['username']['value'];
+ $this->request = $this->getInput('username');
// get content parsed
// $html = $this->getSimpleHTMLDOM(__DIR__ . '/../posts2.html'
$html = $this->getSimpleHTMLDOM(self::GOOGLE_PLUS_BASE_URL . urlencode($this->request) . '/posts'
diff --git a/bridges/GoogleSearchBridge.php b/bridges/GoogleSearchBridge.php
index 9d1cf5c..2c2ecac 100644
--- a/bridges/GoogleSearchBridge.php
+++ b/bridges/GoogleSearchBridge.php
@@ -24,10 +24,9 @@ class GoogleSearchBridge extends BridgeAbstract{
public function collectData(){
- $param=$this->parameters[$this->queriedContext];
$html = '';
- $html = $this->getSimpleHTMLDOM('https://www.google.com/search?q=' . urlencode($param['q']['value']) . '&num=100&complete=0&tbs=qdr:y,sbd:1') or $this->returnServerError('No results for this query.');
+ $html = $this->getSimpleHTMLDOM('https://www.google.com/search?q=' . urlencode($this->getInput('q')) . '&num=100&complete=0&tbs=qdr:y,sbd:1') or $this->returnServerError('No results for this query.');
$emIsRes = $html->find('div[id=ires]',0);
if( !is_null($emIsRes) ){
@@ -47,8 +46,7 @@ class GoogleSearchBridge extends BridgeAbstract{
}
public function getName(){
- $param=$this->parameters[$this->queriedContext];
- return $param['q']['value'] .' - Google search';
+ return $this->getInput('q') .' - Google search';
}
public function getCacheDuration(){
diff --git a/bridges/HDWallpapersBridge.php b/bridges/HDWallpapersBridge.php
index 2008e40..8133c6e 100644
--- a/bridges/HDWallpapersBridge.php
+++ b/bridges/HDWallpapersBridge.php
@@ -20,12 +20,11 @@ class HDWallpapersBridge extends BridgeAbstract {
));
public function collectData(){
- $param=$this->parameters[$this->queriedContext];
$html = '';
$baseUri = 'http://www.hdwallpapers.in';
- $this->category = $param['c']['value'] ?: 'latest_wallpapers'; // Latest default
- $this->resolution = $param['r']['value'] ?: '1920x1200'; // Wide wallpaper default
+ $this->category = $this->getInput('c') ?: 'latest_wallpapers'; // Latest default
+ $this->resolution = $this->getInput('r') ?: '1920x1200'; // Wide wallpaper default
$category = $this->category;
if (strrpos($category, 'wallpapers') !== strlen($category)-strlen('wallpapers')) {
@@ -33,7 +32,7 @@ class HDWallpapersBridge extends BridgeAbstract {
}
$num = 0;
- $max = $param['m']['value'] ?: 14;
+ $max = $this->getInput('m') ?: 14;
$lastpage = 1;
for ($page = 1; $page <= $lastpage; $page++) {
diff --git a/bridges/IdenticaBridge.php b/bridges/IdenticaBridge.php
index 9168523..d089631 100644
--- a/bridges/IdenticaBridge.php
+++ b/bridges/IdenticaBridge.php
@@ -23,19 +23,17 @@ class IdenticaBridge extends BridgeAbstract{
$item['uri'] = html_entity_decode($dent->find('a', 0)->href); // get dent link
$item['timestamp'] = strtotime($dent->find('abbr.easydate', 0)->plaintext); // extract dent timestamp
$item['content'] = trim($dent->find('div.activity-content', 0)->innertext); // extract dent text
- $item['title'] = $param['u']['value'] . ' | ' . $item['content'];
+ $item['title'] = $this->getInput('u') . ' | ' . $item['content'];
$this->items[] = $item;
}
}
public function getName(){
- $param=$this->parameters[$this->queriedContext];
- return $param['u']['value'] .' - Identica Bridge';
+ return $this->getInput('u') .' - Identica Bridge';
}
public function getURI(){
- $param=$this->parameters[$this->queriedContext];
- return $this->uri.urlencode($param['u']['value']);
+ return $this->uri.urlencode($this->getInput('u'));
}
public function getCacheDuration(){
diff --git a/bridges/InstagramBridge.php b/bridges/InstagramBridge.php
index 1c7905c..4551e27 100644
--- a/bridges/InstagramBridge.php
+++ b/bridges/InstagramBridge.php
@@ -61,13 +61,11 @@ class InstagramBridge extends BridgeAbstract{
}
public function getName(){
- $param=$this->parameters[$this->queriedContext];
return $this->param['u']['value'] .' - Instagram Bridge';
}
public function getURI(){
- $param=$this->parameters[$this->queriedContext];
- return $this->uri.urlencode($param['u']['value']);
+ return $this->uri.urlencode($this->getInput('u'));
}
}
diff --git a/bridges/IsoHuntBridge.php b/bridges/IsoHuntBridge.php
index 5f9cad7..8defbd8 100644
--- a/bridges/IsoHuntBridge.php
+++ b/bridges/IsoHuntBridge.php
@@ -90,23 +90,22 @@ class IsoHuntBridge extends BridgeAbstract{
);
public function collectData(){
- $params=$this->parameters[$this->queriedContext];
$request_path = '/'; // We'll request the main page by default
- if(isset($params['latest_category']['value'])){ // Requesting one of the latest categories
- $this->request_latest_category($params['latest_category']['value']);
- } elseif(isset($params['torrent_category']['value'])){ // Requesting one of the torrent categories
+ if(isset($this->getInput('latest_category'))){ // Requesting one of the latest categories
+ $this->request_latest_category($this->getInput('latest_category'));
+ } elseif(isset($this->getInput('torrent_category'))){ // Requesting one of the torrent categories
$order_popularity = false;
- if(isset($params['torrent_popularity']['value']))
- $order_popularity = $params['torrent_popularity']['value'];
+ if(isset($this->getInput('torrent_popularity')))
+ $order_popularity = $this->getInput('torrent_popularity');
- $this->request_torrent_category($params['torrent_category']['value'], $order_popularity);
- } else if(isset($params['search_name']['value'])){ // Requesting search
- if(isset($params['search_category']['value']))
- $this->request_search($params['search_name']['value'], $params['search_category']['value']);
+ $this->request_torrent_category($this->getInput('torrent_category'), $order_popularity);
+ } else if(isset($this->getInput('search_name'))){ // Requesting search
+ if(isset($this->getInput('search_category')))
+ $this->request_search($this->getInput('search_name'), $this->getInput('search_category'));
else
- $this->request_search($params['search_name']['value']);
+ $this->request_search($this->getInput('search_name'));
} else {
$this->returnClientError('Unknown request!');
}
diff --git a/bridges/JapanExpoBridge.php b/bridges/JapanExpoBridge.php
index 828593e..e953667 100644
--- a/bridges/JapanExpoBridge.php
+++ b/bridges/JapanExpoBridge.php
@@ -17,7 +17,6 @@ class JapanExpoBridge extends BridgeAbstract{
));
public function collectData(){
- $param=$this->parameters[$this->queriedContext];
function french_pubdate_to_timestamp($date_to_parse) {
return strtotime(
@@ -49,7 +48,7 @@ class JapanExpoBridge extends BridgeAbstract{
$link = 'http://www.japan-expo-paris.com/fr/actualites';
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('Could not request JapanExpo: '.$link);
- $fullcontent = (!empty($param['mode']['value']) && $param['mode']['value'] == 'full');
+ $fullcontent = (!empty($this->getInput('mode')) && $this->getInput('mode') == 'full');
$count = 0;
foreach ($html->find('a._tile2') as $element) {
diff --git a/bridges/KonachanBridge.php b/bridges/KonachanBridge.php
index bda5a96..dcdb9d9 100644
--- a/bridges/KonachanBridge.php
+++ b/bridges/KonachanBridge.php
@@ -15,13 +15,12 @@ class KonachanBridge extends BridgeAbstract{
));
public function collectData(){
- $param=$this->parameters[$this->queriedContext];
$page = 1;$tags='';
- if (isset($param['p']['value'])) {
- $page = (int)preg_replace("/[^0-9]/",'', $param['p']['value']);
+ if (isset($this->getInput('p'))) {
+ $page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p'));
}
- if (isset($param['t']['value'])) {
- $tags = urlencode($param['t']['value']);
+ if (isset($this->getInput('t'))) {
+ $tags = urlencode($this->getInput('t'));
}
$html = $this->getSimpleHTMLDOM("http://konachan.com/post?page=$page&tags=$tags") or $this->returnServerError('Could not request Konachan.');
$input_json = explode('Post.register(', $html);
diff --git a/bridges/KununuBridge.php b/bridges/KununuBridge.php
index 0fa63c9..fc49025 100644
--- a/bridges/KununuBridge.php
+++ b/bridges/KununuBridge.php
@@ -40,21 +40,20 @@ class KununuBridge extends BridgeAbstract{
);
public function collectData(){
- $params=$this->parameters[$this->queriedContext];
// Get Site
- $site = strtolower(trim($params['site']['value']));
+ $site = strtolower(trim($this->getInput('site')));
if(!isset($site) || empty($site) || !$this->site_is_valid($site))
$this->returnClientError('You must specify a valid site (&site=...)!');
// Get Company (fixing whitespace and umlauts)
- $company = $this->encode_umlauts(strtolower(str_replace(' ', '-', trim($params['company']['value']))));
+ $company = $this->encode_umlauts(strtolower(str_replace(' ', '-', trim($this->getInput('company')))));
if(!isset($company) || empty($company))
$this->returnClientError('You must specify a company (&company=...)!');
$full = false; // By default we'll load only short article
- if(isset($params['full']['value']))
- $full = strtolower(trim($params['full']['value']));
+ if(isset($this->getInput('full')))
+ $full = strtolower(trim($this->getInput('full')));
// Get reviews section name (depends on site)
$section = '';
diff --git a/bridges/LeBonCoinBridge.php b/bridges/LeBonCoinBridge.php
index 974419c..3779952 100755
--- a/bridges/LeBonCoinBridge.php
+++ b/bridges/LeBonCoinBridge.php
@@ -135,14 +135,13 @@ class LeBonCoinBridge extends BridgeAbstract{
);
public function collectData(){
- $param=$this->parameters[$this->queriedContext];
$html = '';
- if (empty($param['c']['value'])) {
- $link = 'http://www.leboncoin.fr/annonces/offres/' . $param['r']['value'] . '/?f=a&th=1&q=' . urlencode($param['k']['value']);
+ if (empty($this->getInput('c'))) {
+ $link = 'http://www.leboncoin.fr/annonces/offres/' . $this->getInput('r') . '/?f=a&th=1&q=' . urlencode($this->getInput('k'));
}
else {
- $link = 'http://www.leboncoin.fr/' . $param['c']['value'] . '/offres/' . $param['r']['value'] . '/?f=a&th=1&q=' . urlencode($param['k']['value']);
+ $link = 'http://www.leboncoin.fr/' . $this->getInput('c') . '/offres/' . $this->getInput('r') . '/?f=a&th=1&q=' . urlencode($this->getInput('k'));
}
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('Could not request LeBonCoin.');
diff --git a/bridges/LinkedInCompany.php b/bridges/LinkedInCompany.php
index 9f0560d..ccdf16c 100644
--- a/bridges/LinkedInCompany.php
+++ b/bridges/LinkedInCompany.php
@@ -14,9 +14,8 @@ class LinkedInCompany extends BridgeAbstract{
));
public function collectData(){
- $param=$this->parameters[$this->queriedContext];
$html = '';
- $link = 'https://www.linkedin.com/company/'.$param['c']['value'];
+ $link = 'https://www.linkedin.com/company/'.$this->getInput('c');
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('Could not request LinkedIn.');
diff --git a/bridges/LolibooruBridge.php b/bridges/LolibooruBridge.php
index 5bfec8c..7628860 100644
--- a/bridges/LolibooruBridge.php
+++ b/bridges/LolibooruBridge.php
@@ -15,13 +15,12 @@ class LolibooruBridge extends BridgeAbstract{
));
public function collectData(){
- $param=$this->parameters[$this->queriedContext];
$page = 1; $tags = '';
- if (isset($param['p']['value'])) {
- $page = (int)preg_replace("/[^0-9]/",'', $param['p']['value']);
+ if (isset($this->getInput('p'))) {
+ $page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p'));
}
- if (isset($param['t']['value'])) {
- $tags = urlencode($param['t']['value']);
+ if (isset($this->getInput('t'))) {
+ $tags = urlencode($this->getInput('t'));
}
$html = $this->getSimpleHTMLDOM("http://lolibooru.moe/post?page=$page&tags=$tags") or $this->returnServerError('Could not request Lolibooru.');
$input_json = explode('Post.register(', $html);
diff --git a/bridges/MangareaderBridge.php b/bridges/MangareaderBridge.php
index 8d00f29..7df542d 100644
--- a/bridges/MangareaderBridge.php
+++ b/bridges/MangareaderBridge.php
@@ -76,7 +76,6 @@ class MangareaderBridge extends BridgeAbstract{
);
public function collectData(){
- $param=$this->parameters[$this->queriedContext];
$this->request = '';
@@ -84,21 +83,21 @@ class MangareaderBridge extends BridgeAbstract{
$path = "latest";
$limit = MANGAREADER_LIMIT;
- if(isset($param['category']['value'])){ // Get popular updates
+ if(isset($this->getInput('category'))){ // Get popular updates
$type = "popular";
$path = "popular";
- if($param['category']['value'] !== "all"){
- $path .= "/" . $param['category']['value'];
+ if($this->getInput('category') !== "all"){
+ $path .= "/" . $this->getInput('category');
}
}
- if(isset($param['path']['value'])){ // Get manga updates
+ if(isset($this->getInput('path'))){ // Get manga updates
$type = "path";
- $path = $param['path']['value'];
+ $path = $this->getInput('path');
}
- if(isset($param['limit']['value']) && $param['limit']['value'] !== ""){ // Get manga updates (optional parameter)
- $limit = $param['limit']['value'];
+ if(isset($this->getInput('limit')) && $this->getInput('limit') !== ""){ // Get manga updates (optional parameter)
+ $limit = $this->getInput('limit');
}
// We'll use the DOM parser for this as it makes navigation easier
diff --git a/bridges/MilbooruBridge.php b/bridges/MilbooruBridge.php
index a035202..46a84a6 100644
--- a/bridges/MilbooruBridge.php
+++ b/bridges/MilbooruBridge.php
@@ -16,13 +16,12 @@ class MilbooruBridge extends BridgeAbstract{
));
public function collectData(){
- $param=$this->parameters[$this->queriedContext];
$page = 0;$tags='';
- if (isset($param['p']['value'])) {
- $page = (int)preg_replace("/[^0-9]/",'', $param['p']['value']);
+ if (isset($this->getInput('p'))) {
+ $page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p'));
}
- if (isset($param['t']['value'])) {
- $tags = urlencode($param['t']['value']);
+ if (isset($this->getInput('t'))) {
+ $tags = urlencode($this->getInput('t'));
}
$html = $this->getSimpleHTMLDOM("http://sheslostcontrol.net/moe/shimmie/index.php?q=/post/list/$tags/$page") or $this->returnServerError('Could not request Milbooru.');
diff --git a/bridges/MspabooruBridge.php b/bridges/MspabooruBridge.php
index 3deca86..5ade185 100644
--- a/bridges/MspabooruBridge.php
+++ b/bridges/MspabooruBridge.php
@@ -16,15 +16,14 @@ class MspabooruBridge extends BridgeAbstract{
));
public function collectData(){
- $param=$this->parameters[$this->queriedContext];
$page = 0;$tags='';
- if (isset($param['p']['value'])) {
- $page = (int)preg_replace("/[^0-9]/",'', $param['p']['value']);
+ if (isset($this->getInput('p'))) {
+ $page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p'));
$page = $page - 1;
$page = $page * 50;
}
- if (isset($param['t']['value'])) {
- $tags = urlencode($param['t']['value']);
+ if (isset($this->getInput('t'))) {
+ $tags = urlencode($this->getInput('t'));
}
$html = $this->getSimpleHTMLDOM("http://mspabooru.com/index.php?page=post&s=list&tags=$tags&pid=$page") or $this->returnServerError('Could not request Mspabooru.');
diff --git a/bridges/NextgovBridge.php b/bridges/NextgovBridge.php
index 622fc65..9c5f9e3 100644
--- a/bridges/NextgovBridge.php
+++ b/bridges/NextgovBridge.php
@@ -26,7 +26,6 @@ class NextgovBridge extends BridgeAbstract {
));
public function collectData(){
- $param=$this->parameters[$this->queriedContext];
function ExtractFromDelimiters($string, $start, $end) {
if (strpos($string, $start) !== false) {
@@ -44,7 +43,7 @@ class NextgovBridge extends BridgeAbstract {
} return $string;
}
- $category = $param['category']['value'];
+ $category = $this->getInput('category');
if (empty($category))
$category = 'all';
if ($category !== preg_replace('/[^a-z-]+/', '', $category) || strlen($category > 32))
diff --git a/bridges/NovelUpdatesBridge.php b/bridges/NovelUpdatesBridge.php
index b389dac..de69087 100644
--- a/bridges/NovelUpdatesBridge.php
+++ b/bridges/NovelUpdatesBridge.php
@@ -13,10 +13,9 @@ class NovelUpdatesBridge extends BridgeAbstract{
));
public function collectData(){
- $param=$this->parameters[$this->queriedContext];
- if (!isset($param['n']['value']))
+ if (!isset($this->getInput('n')))
$this->returnClientError('You must specify the novel URL (/series/...)');
- $thread = parse_url($param['n']['value']) or $this->returnClientError('This URL seems malformed, please check it.');
+ $thread = parse_url($this->getInput('n')) or $this->returnClientError('This URL seems malformed, please check it.');
if($thread['host'] !== 'www.novelupdates.com')
$this->returnClientError('NovelUpdates URL only.');
if(strpos($thread['path'], 'series/') === FALSE)
diff --git a/bridges/OpenClassroomsBridge.php b/bridges/OpenClassroomsBridge.php
index d878709..9e560f9 100644
--- a/bridges/OpenClassroomsBridge.php
+++ b/bridges/OpenClassroomsBridge.php
@@ -26,14 +26,13 @@ class OpenClassroomsBridge extends BridgeAbstract{
public function collectData(){
- $param=$this->parameters[$this->queriedContext];
- if (empty($param['u']['value']))
+ if (empty($this->getInput('u')))
{
$this->returnServerError('Error: You must chose a category.');
}
$html = '';
- $link = 'https://openclassrooms.com/courses?categories='.$param['u']['value'].'&title=&sort=updatedAt+desc';
+ $link = 'https://openclassrooms.com/courses?categories='.$this->getInput('u').'&title=&sort=updatedAt+desc';
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('Could not request OpenClassrooms.');
diff --git a/bridges/ParuVenduImmoBridge.php b/bridges/ParuVenduImmoBridge.php
index cd62099..5a1cb5c 100644
--- a/bridges/ParuVenduImmoBridge.php
+++ b/bridges/ParuVenduImmoBridge.php
@@ -25,27 +25,26 @@ class ParuVenduImmoBridge extends BridgeAbstract
public function collectData()
{
- $param=$this->parameters[$this->queriedContext];
$html = '';
$num = 20;
$appartment = '&tbApp=1&tbDup=1&tbChb=1&tbLof=1&tbAtl=1&tbPla=1';
$maison = '&tbMai=1&tbVil=1&tbCha=1&tbPro=1&tbHot=1&tbMou=1&tbFer=1';
$link = $this->uri.'/immobilier/annonceimmofo/liste/listeAnnonces?tt=1'.$appartment.$maison;
- if (isset($param['minarea']['value'])) {
- $link .= '&sur0='.urlencode($param['minarea']['value']);
+ if (isset($this->getInput('minarea'))) {
+ $link .= '&sur0='.urlencode($this->getInput('minarea'));
}
- if (isset($param['maxprice']['value'])) {
- $link .= '&px1='.urlencode($param['maxprice']['value']);
+ if (isset($this->getInput('maxprice'))) {
+ $link .= '&px1='.urlencode($this->getInput('maxprice'));
}
- if (isset($param['pa']['value'])) {
- $link .= '&pa='.urlencode($param['pa']['value']);
+ if (isset($this->getInput('pa'))) {
+ $link .= '&pa='.urlencode($this->getInput('pa'));
}
- if (isset($param['lo']['value'])) {
- $link .= '&lo='.urlencode($param['lo']['value']);
+ if (isset($this->getInput('lo'))) {
+ $link .= '&lo='.urlencode($this->getInput('lo'));
}
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('Could not request paruvendu.');
@@ -81,16 +80,15 @@ class ParuVenduImmoBridge extends BridgeAbstract
}
public function getName(){
- $param=$this->parameters[$this->queriedContext];
$request='';
- if(isset($param['minarea']['value']) &&
- !empty($param['minarea']['value'])
+ if(isset($this->getInput('minarea')) &&
+ !empty($this->getInput('minarea'))
){
- $request .= ' '.$param['minarea']['value'].' m2';
+ $request .= ' '.$this->getInput('minarea').' m2';
}
- if(isset($param['lo']['value']) &&
- !empty($param['lo']['value'])){
- $request .= ' In: '.$param['lo']['value'];
+ if(isset($this->getInput('lo')) &&
+ !empty($this->getInput('lo'))){
+ $request .= ' In: '.$this->getInput('lo');
}
return 'Paru Vendu Immobilier'.$request;
}
diff --git a/bridges/PickyWallpapersBridge.php b/bridges/PickyWallpapersBridge.php
index 380a885..79cedf5 100644
--- a/bridges/PickyWallpapersBridge.php
+++ b/bridges/PickyWallpapersBridge.php
@@ -26,19 +26,18 @@ class PickyWallpapersBridge extends BridgeAbstract {
public function collectData(){
- $param=$this->parameters[$this->queriedContext];
$html = '';
- if (!isset($param['c']['value'])) {
+ if (!isset($this->getInput('c'))) {
$this->returnClientError('You must specify at least a category (?c=...).');
} else {
$baseUri = 'http://www.pickywallpapers.com';
- $this->category = $param['c']['value'];
- $this->subcategory = $param['s']['value'] ?: '';
- $this->resolution = $param['r']['value'] ?: '1920x1200'; // Wide wallpaper default
+ $this->category = $this->getInput('c');
+ $this->subcategory = $this->getInput('s') ?: '';
+ $this->resolution = $this->getInput('r') ?: '1920x1200'; // Wide wallpaper default
$num = 0;
- $max = $param['m']['value'] ?: 12;
+ $max = $this->getInput('m') ?: 12;
$lastpage = 1;
for ($page = 1; $page <= $lastpage; $page++) {
diff --git a/bridges/PinterestBridge.php b/bridges/PinterestBridge.php
index b3ddd8e..91ff2b2 100644
--- a/bridges/PinterestBridge.php
+++ b/bridges/PinterestBridge.php
@@ -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.');
}
diff --git a/bridges/RTBFBridge.php b/bridges/RTBFBridge.php
index c669bc9..2f02d4a 100644
--- a/bridges/RTBFBridge.php
+++ b/bridges/RTBFBridge.php
@@ -14,13 +14,12 @@ class RTBFBridge extends BridgeAbstract {
));
public function collectData(){
- $param=$this->parameters[$this->queriedContext];
$html = '';
$limit = 10;
$count = 0;
- if (isset($param['c']['value'])) {
- $html = $this->getSimpleHTMLDOM('http://www.rtbf.be/auvio/emissions/detail?id='.$param['c']['value']) or $this->returnServerError('Could not request RTBF.');
+ if (isset($this->getInput('c'))) {
+ $html = $this->getSimpleHTMLDOM('http://www.rtbf.be/auvio/emissions/detail?id='.$this->getInput('c')) or $this->returnServerError('Could not request RTBF.');
foreach($html->find('section[id!=widget-ml-avoiraussi-] .rtbf-media-grid article') as $element) {
if($count < $limit) {
diff --git a/bridges/Rule34Bridge.php b/bridges/Rule34Bridge.php
index 5a0ebf8..6f72c23 100644
--- a/bridges/Rule34Bridge.php
+++ b/bridges/Rule34Bridge.php
@@ -15,15 +15,14 @@ class Rule34Bridge extends BridgeAbstract{
));
public function collectData(){
- $param=$this->parameters[$this->queriedContext];
$page = 0;$tags='';
- if (isset($param['p']['value'])) {
- $page = (int)preg_replace("/[^0-9]/",'', $param['p']['value']);
+ if (isset($this->getInput('p'))) {
+ $page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p'));
$page = $page - 1;
$page = $page * 50;
}
- if (isset($param['t']['value'])) {
- $tags = urlencode($param['t']['value']);
+ if (isset($this->getInput('t'))) {
+ $tags = urlencode($this->getInput('t'));
}
$html = $this->getSimpleHTMLDOM("http://rule34.xxx/index.php?page=post&s=list&tags=$tags&pid=$page") or $this->returnServerError('Could not request Rule34.');
diff --git a/bridges/Rule34pahealBridge.php b/bridges/Rule34pahealBridge.php
index 2c9b3da..2f24c8a 100644
--- a/bridges/Rule34pahealBridge.php
+++ b/bridges/Rule34pahealBridge.php
@@ -16,13 +16,12 @@ class Rule34pahealBridge extends BridgeAbstract{
public function collectData(){
- $param=$this->parameters[$this->queriedContext];
$page = 0;$tags='';
- if (isset($param['p']['value'])) {
- $page = (int)preg_replace("/[^0-9]/",'', $param['p']['value']);
+ if (isset($this->getInput('p'))) {
+ $page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p'));
}
- if (isset($param['t']['value'])) {
- $tags = urlencode($param['t']['value']);
+ if (isset($this->getInput('t'))) {
+ $tags = urlencode($this->getInput('t'));
}
$html = $this->getSimpleHTMLDOM("http://rule34.paheal.net/post/list/$tags/$page") or $this->returnServerError('Could not request Rule34paheal.');
diff --git a/bridges/SafebooruBridge.php b/bridges/SafebooruBridge.php
index dc4fed7..4fb147c 100644
--- a/bridges/SafebooruBridge.php
+++ b/bridges/SafebooruBridge.php
@@ -15,15 +15,14 @@ class SafebooruBridge extends BridgeAbstract{
));
public function collectData(){
- $param=$this->parameters[$this->queriedContext];
$page = 0;$tags='';
- if (isset($param['p']['value'])) {
- $page = (int)preg_replace("/[^0-9]/",'', $param['p']['value']);
+ if (isset($this->getInput('p'))) {
+ $page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p'));
$page = $page - 1;
$page = $page * 40;
}
- if (isset($param['t']['value'])) {
- $tags = urlencode($param['t']['value']);
+ if (isset($this->getInput('t'))) {
+ $tags = urlencode($this->getInput('t'));
}
$html = $this->getSimpleHTMLDOM("http://safebooru.org/index.php?page=post&s=list&tags=$tags&pid=$page") or $this->returnServerError('Could not request Safebooru.');
diff --git a/bridges/SakugabooruBridge.php b/bridges/SakugabooruBridge.php
index 41ad516..246b40a 100644
--- a/bridges/SakugabooruBridge.php
+++ b/bridges/SakugabooruBridge.php
@@ -15,13 +15,12 @@ class SakugabooruBridge extends BridgeAbstract{
));
public function collectData(){
- $param=$this->parameters[$this->queriedContext];
$page = 1;$tags='';
- if (isset($param['p']['value'])) {
- $page = (int)preg_replace("/[^0-9]/",'', $param['p']['value']);
+ if (isset($this->getInput('p'))) {
+ $page = (int)preg_replace("/[^0-9]/",'', $this->getInput('p'));
}
- if (isset($param['t']['value'])) {
- $tags = urlencode($param['t']['value']);
+ if (isset($this->getInput('t'))) {
+ $tags = urlencode($this->getInput('t'));
}
$html = $this->getSimpleHTMLDOM("http://sakuga.yshi.org/post?page=$page&tags=$tags") or $this->returnServerError('Could not request Sakugabooru.');
$input_json = explode('Post.register(', $html);
diff --git a/bridges/ScoopItBridge.php b/bridges/ScoopItBridge.php
index c9a8971..32bdc47 100644
--- a/bridges/ScoopItBridge.php
+++ b/bridges/ScoopItBridge.php
@@ -14,10 +14,9 @@ class ScoopItBridge extends BridgeAbstract{
));
public function collectData(){
- $param=$this->parameters[$this->queriedContext];
$html = '';
- if ($param['u']['value'] != '') {
- $this->request = $param['u']['value'];
+ if ($this->getInput('u') != '') {
+ $this->request = $this->getInput('u');
$link = 'http://scoop.it/search?q=' .urlencode($this->request);
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('Could not request ScoopIt. for : ' . $link);
diff --git a/bridges/SensCritiqueBridge.php b/bridges/SensCritiqueBridge.php
index c1d6986..f877dcf 100644
--- a/bridges/SensCritiqueBridge.php
+++ b/bridges/SensCritiqueBridge.php
@@ -34,18 +34,17 @@ class SensCritiqueBridge extends BridgeAbstract {
));
public function collectData(){
- $param=$this->parameters[$this->queriedContext];
- if ((isset($param['m']['value']) && $param['m']['value'])) {
+ if ((isset($this->getInput('m')) && $this->getInput('m'))) {
$this->collectMoviesData();
- } else if ((isset($param['s']['value']) && $param['s']['value'])) {
+ } else if ((isset($this->getInput('s')) && $this->getInput('s'))) {
$this->collectSeriesData();
- } else if ((isset($param['g']['value']) && $param['g']['value'])) {
+ } else if ((isset($this->getInput('g')) && $this->getInput('g'))) {
$this->collectGamesData();
- } else if ((isset($param['b']['value']) && $param['b']['value'])) {
+ } else if ((isset($this->getInput('b')) && $this->getInput('b'))) {
$this->collectBooksData();
- } else if ((isset($param['bd']['value']) && $param['bd']['value'])) {
+ } else if ((isset($this->getInput('bd')) && $this->getInput('bd'))) {
$this->collectBDsData();
- } else if ((isset($param['mu']['value']) && $param['mu']['value'])) {
+ } else if ((isset($this->getInput('mu')) && $this->getInput('mu'))) {
$this->collectMusicsData();
} else {
$this->returnClientError('You must choose a category');
diff --git a/bridges/SoundcloudBridge.php b/bridges/SoundcloudBridge.php
index 46f4529..be22cd7 100644
--- a/bridges/SoundcloudBridge.php
+++ b/bridges/SoundcloudBridge.php
@@ -16,11 +16,10 @@ class SoundCloudBridge extends BridgeAbstract{
const CLIENT_ID = '0aca19eae3843844e4053c6d8fdb7875';
public function collectData(){
- $param=$this->parameters[$this->queriedContext];
$res = json_decode($this->getContents(
'https://api.soundcloud.com/resolve?url=http://www.soundcloud.com/'
- . urlencode($param['u']['value'])
+ . urlencode($this->getInput('u'))
.'&client_id=' . self::CLIENT_ID
)) or $this->returnServerError('No results for this query');
$tracks = json_decode($this->getContents(
@@ -35,18 +34,17 @@ class SoundCloudBridge extends BridgeAbstract{
$item['title'] = $tracks[$i]->user->username .' - '. $tracks[$i]->title;
$item['content'] = '