[core] store parameters values in BridgeAbstract::parameters

This way, any BridgeAbstract method can now have access to these values,
no only collectData

Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
This commit is contained in:
Pierre Mazière 2016-08-25 01:24:53 +02:00
parent dea37c8e34
commit 117031bf0f
131 changed files with 548 additions and 411 deletions

View file

@ -12,7 +12,7 @@ class ABCTabsBridge extends BridgeAbstract{
}
public function collectData(array $param){
public function collectData(){
$html = '';
$html = $this->getSimpleHTMLDOM('http://www.abc-tabs.com/tablatures/nouveautes.html') or $this->returnClientError('No results for this query.');
$table = $html->find('table#myTable', 0)->children(1);

View file

@ -10,7 +10,8 @@ class AcrimedBridge extends RssExpander{
}
public function collectData(array $param){
public function collectData(){
$param=$this->parameters[$this->queriedContext];
parent::collectExpandableDatas($param, "http://www.acrimed.org/spip.php?page=backend");

View file

@ -24,14 +24,15 @@ class AllocineFRBridge extends BridgeAbstract{
);
}
public function collectData(array $params){
public function collectData(){
$params=$this->parameters[$this->queriedContext];
// Check all parameters
if(!isset($params['category']))
if(!isset($params['category']['value']))
$this->returnClientError('You must specify a valid category (&category= )!');
$category = '';
switch($params['category']){
switch($params['category']['value']){
case 'faux-raccord':
$this->uri = 'http://www.allocine.fr/video/programme-12284/saison-24580/';
$category = 'Faux Raccord';

View file

@ -24,13 +24,14 @@ class AnimeUltimeBridge extends BridgeAbstract {
);
}
public function collectData(array $param) {
public function collectData(){
$param=$this->parameters[$this->queriedContext];
//Add type filter if provided
$typeFilter = '';
if (!empty($param['type'])) {
if ($param['type'] == 'A' || $param['type'] == 'D' || $param['type'] == 'T') {
$typeFilter = $param['type'];
if (!empty($param['type']['value'])) {
if ($param['type']['value'] == 'A' || $param['type']['value'] == 'D' || $param['type']['value'] == 'T') {
$typeFilter = $param['type']['value'];
if ($typeFilter == 'A') { $this->filter = 'Anime'; }
if ($typeFilter == 'D') { $this->filter = 'Drama'; }
if ($typeFilter == 'T') { $this->filter = 'Tokusatsu'; }

View file

@ -42,7 +42,7 @@ class ArstechnicaBridge extends BridgeAbstract {
return $text;
}
public function collectData(array $param) {
public function collectData(){
$html = $this->getSimpleHTMLDOM('http://feeds.arstechnica.com/arstechnica/index') or $this->returnServerError('Could not request NextInpact.');
$limit = 0;

View file

@ -61,13 +61,14 @@ class Arte7Bridge extends BridgeAbstract{
return $input;
}
public function collectData(array $param){
public function collectData(){
$param=$this->parameters[$this->queriedContext];
$category='toutes-les-videos'; $lang='fr';
if (!empty($param['catfr']))
$category=$param['catfr'];
if (!empty($param['catde']))
{ $category=$param['catde']; $lang='de'; }
if (!empty($param['catfr']['value']))
$category=$param['catfr']['value'];
if (!empty($param['catde']['value']))
{ $category=$param['catde']['value']; $lang='de'; }
$input_json = $this->extractVideoset($category, $lang);
foreach($input_json['videos'] as $element) {

View file

@ -16,10 +16,11 @@ class AskfmBridge extends BridgeAbstract{
);
}
public function collectData(array $param){
public function collectData(){
$param=$this->parameters[$this->queriedContext];
$html = '';
if (isset($param['u'])) {
$this->request = $param['u'];
if (isset($param['u']['value'])) {
$this->request = $param['u']['value'];
$html = $this->getSimpleHTMLDOM('http://ask.fm/'.urlencode($this->request).'/answers/more?page=0') or $this->returnServerError('Requested username can\'t be found.');
}
else {

View file

@ -18,10 +18,11 @@ class BandcampBridge extends BridgeAbstract{
);
}
public function collectData(array $param){
public function collectData(){
$param=$this->parameters[$this->queriedContext];
$html = '';
if (isset($param['tag'])) {
$this->request = $param['tag'];
if (isset($param['tag']['value'])) {
$this->request = $param['tag']['value'];
$html = $this->getSimpleHTMLDOM('http://bandcamp.com/tag/'.urlencode($this->request).'?sort_field=date') or $this->returnServerError('No results for this query.');
}
else {

View file

@ -7,7 +7,7 @@ class BastaBridge extends BridgeAbstract{
$this->description = "Returns the newest articles.";
}
public function collectData(array $param){
public function collectData(){
// Replaces all relative image URLs by absolute URLs. Relative URLs always start with 'local/'!
function ReplaceImageUrl($content){
return preg_replace('/src=["\']{1}([^"\']+)/ims', 'src=\'http://www.bastamag.net/$1\'', $content);

View file

@ -10,7 +10,7 @@ class BlaguesDeMerdeBridge extends BridgeAbstract{
}
public function collectData(array $param){
public function collectData(){
$html = $this->getSimpleHTMLDOM('http://www.blaguesdemerde.fr/') or $this->returnServerError('Could not request BDM.');
foreach($html->find('article.joke_contener') as $element) {

View file

@ -19,29 +19,30 @@ class BooruprojectBridge extends BridgeAbstract{
}
public function collectData(array $param){
public function collectData(){
$param=$this->parameters[$this->queriedContext];
$page = 0; $tags = '';
if (!empty($param['p'])) {
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
if (!empty($param['p']['value'])) {
$page = (int)preg_replace("/[^0-9]/",'', $param['p']['value']);
$page = $page - 1;
$page = $page * 20;
}
if (!empty($param['t'])) {
$tags = '&tags='.urlencode($param['t']);
if (!empty($param['t']['value'])) {
$tags = '&tags='.urlencode($param['t']['value']);
}
if (empty($param['i'])) {
if (empty($param['i']['value'])) {
$this->returnServerError('Please enter a ***.booru.org instance.');
}
$html = $this->getSimpleHTMLDOM("http://".$param['i'].".booru.org/index.php?page=post&s=list&pid=".$page.$tags) or $this->returnServerError('Could not request Booruproject.');
$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.');
foreach($html->find('div[class=content] span') as $element) {
$item = array();
$item['uri'] = 'http://'.$param['i'].'.booru.org/'.$element->find('a', 0)->href;
$item['uri'] = 'http://'.$param['i']['value'].'.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'].' | '.$item['postid'];
$item['title'] = 'Booruproject '.$param['i']['value'].' | '.$item['postid'];
$item['content'] = '<a href="' . $item['uri'] . '"><img src="' . $element->find('img', 0)->src . '" /></a><br>Tags: '.$item['tags'];
$this->items[] = $item;
}

View file

@ -34,7 +34,7 @@ class CADBridge extends BridgeAbstract{
return '<img src="'.$img.'"/>';
}
public function collectData(array $param){
public function collectData(){
function CADUrl($string) {
$html2 = explode("\"", $string);
$string = $html2[1];

View file

@ -15,7 +15,8 @@ class CNETBridge extends BridgeAbstract {
);
}
public function collectData(array $param) {
public function collectData(){
$param=$this->parameters[$this->queriedContext];
function ExtractFromDelimiters($string, $start, $end) {
if (strpos($string, $start) !== false) {
@ -42,8 +43,8 @@ class CNETBridge extends BridgeAbstract {
return $article_html;
}
if (!empty($param['topic']))
$this->topicName = $param['topic'];
if (!empty($param['topic']['value']))
$this->topicName = $param['topic']['value'];
$pageUrl = 'http://www.cnet.com/'.(empty($this->topicName) ? '' : 'topics/'.$this->topicName.'/');
$html = $this->getSimpleHTMLDOM($pageUrl) or $this->returnServerError('Could not request CNET: '.$pageUrl);

View file

@ -73,12 +73,13 @@ class CastorusBridge extends BridgeAbstract {
return $price->innertext;
}
public function collectData(array $params){
if(isset($params['zip']))
$zip_filter = trim($params['zip']);
public function collectData(){
$params=$this->parameters[$this->queriedContext];
if(isset($params['zip']['value']))
$zip_filter = trim($params['zip']['value']);
if(isset($params['city']))
$city_filter = trim($params['city']);
if(isset($params['city']['value']))
$city_filter = trim($params['city']['value']);
$html = $this->getSimpleHTMLDOM($this->uri);

View file

@ -8,7 +8,7 @@ class CollegeDeFranceBridge extends BridgeAbstract{
$this->description = "Returns the latest audio and video from CollegeDeFrance";
}
public function collectData(array $param) {
public function collectData(){
$months = array(
'01' => 'janv.',
'02' => 'févr.',

View file

@ -16,7 +16,7 @@ class CommonDreamsBridge extends BridgeAbstract{
return $text;
}
public function collectData(array $param){
public function collectData(){
function CommonDreamsUrl($string) {
$html2 = explode(" ", $string);

View file

@ -11,7 +11,7 @@ class CopieDoubleBridge extends BridgeAbstract{
}
public function collectData(array $param){
public function collectData(){
$html = $this->getSimpleHTMLDOM('http://www.copie-double.com/') or $this->returnServerError('Could not request CopieDouble.');
$table = $html->find('table table', 2);

View file

@ -10,7 +10,7 @@ class CourrierInternationalBridge extends BridgeAbstract{
}
public function collectData(array $param){
public function collectData(){
$html = '';

View file

@ -21,11 +21,12 @@ class CpasbienBridge extends HttpCachingBridgeAbstract{
}
public function collectData(array $param){
public function collectData(){
$param=$this->parameters[$this->queriedContext];
$this->loadMetadatas();
$html = '';
if (isset($param['q'])) { /* keyword search mode */
$this->request = str_replace(" ","-",trim($param['q']));
if (isset($param['q']['value'])) { /* keyword search mode */
$this->request = str_replace(" ","-",trim($param['q']['value']));
$html = $this->getSimpleHTMLDOM($this->uri.'/recherche/'.urlencode($this->request).'.html') or $this->returnServerError('No results for this query.');
}
else {

View file

@ -18,7 +18,8 @@ class CryptomeBridge extends BridgeAbstract{
}
public function collectData(array $param){
public function collectData(){
$param=$this->parameters[$this->queriedContext];
$html = '';
$num = 20;
$link = 'http://cryptome.org/';
@ -26,8 +27,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'])) { /* number of documents */
$num = min(max(1, $param['n']+0), $num);
if (!empty($param['n']['value'])) { /* number of documents */
$num = min(max(1, $param['n']['value']+0), $num);
}

View file

@ -45,21 +45,22 @@ class DailymotionBridge extends BridgeAbstract{
return $metadata;
}
public function collectData(array $param){
public function collectData(){
$param=$this->parameters[$this->queriedContext];
$html = '';
$limit = 5;
$count = 0;
if (isset($param['u'])) { // user timeline mode
$this->request = $param['u'];
if (isset($param['u']['value'])) { // user timeline mode
$this->request = $param['u']['value'];
$html = $this->getSimpleHTMLDOM('http://www.dailymotion.com/user/'.urlencode($this->request).'/1') or $this->returnServerError('Could not request Dailymotion.');
}
else if (isset($param['p'])) { // playlist mode
$this->request = strtok($param['p'], '_');
else if (isset($param['p']['value'])) { // playlist mode
$this->request = strtok($param['p']['value'], '_');
$html = $this->getSimpleHTMLDOM('http://www.dailymotion.com/playlist/'.urlencode($this->request).'') or $this->returnServerError('Could not request Dailymotion.');
}
else if (isset($param['s'])) { // search mode
$this->request = $param['s']; $page = 1; if (isset($param['pa'])) $page = (int)preg_replace("/[^0-9]/",'', $param['pa']);
else if (isset($param['s']['value'])) { // search mode
$this->request = $param['s']['value']; $page = 1; if (isset($param['pa']['value'])) $page = (int)preg_replace("/[^0-9]/",'', $param['pa']['value']);
$html = $this->getSimpleHTMLDOM('http://www.dailymotion.com/search/'.urlencode($this->request).'/'.$page.'') or $this->returnServerError('Could not request Dailymotion.');
}
else {

View file

@ -14,13 +14,14 @@ class DanbooruBridge extends BridgeAbstract{
);
}
public function collectData(array $param){
public function collectData(){
$param=$this->parameters[$this->queriedContext];
$page = 1;$tags='';
if (isset($param['p'])) {
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
if (isset($param['p']['value'])) {
$page = (int)preg_replace("/[^0-9]/",'', $param['p']['value']);
}
if (isset($param['t'])) {
$tags = urlencode($param['t']);
if (isset($param['t']['value'])) {
$tags = urlencode($param['t']['value']);
}
$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) {

View file

@ -10,7 +10,7 @@ class DansTonChatBridge extends BridgeAbstract{
}
public function collectData(array $param){
public function collectData(){
$html = '';
$link = 'http://danstonchat.com/latest.html';

View file

@ -40,7 +40,8 @@ class DauphineLibereBridge extends BridgeAbstract {
return $text;
}
public function collectData(array $param){
public function collectData(){
$param=$this->parameters[$this->queriedContext];
// Simulate Mozilla user-agent to fix error 403 (Forbidden)
$opts = array('http' =>
@ -52,8 +53,8 @@ class DauphineLibereBridge extends BridgeAbstract {
$context = stream_context_create($opts);
if (isset($param['u'])) { /* user timeline mode */
$this->request = $param['u'];
if (isset($param['u']['value'])) { /* user timeline mode */
$this->request = $param['u']['value'];
$html = $this->getSimpleHTMLDOM('http://www.ledauphine.com/'.$this->request.'/rss',false,$context) or $this->returnServerError('Could not request DauphineLibere.');
}
else {

View file

@ -35,7 +35,7 @@ class DemoBridge extends BridgeAbstract{
);
}
public function collectData(array $param){
public function collectData(){
$item = array();
$item['author'] = "Me!";

View file

@ -40,7 +40,7 @@ class DeveloppezDotComBridge extends BridgeAbstract{
return trim($text);
}
public function collectData(array $param){
public function collectData(){
$rssFeed = $this->getSimpleHTMLDOM('http://www.developpez.com/index/rss') or $this->returnServerError('Could not request http://www.developpez.com/index/rss');
$limit = 0;

View file

@ -10,7 +10,7 @@ class DilbertBridge extends BridgeAbstract {
}
public function collectData(array $param) {
public function collectData(){
$html = $this->getSimpleHTMLDOM($this->getURI()) or $this->returnServerError('Could not request Dilbert: '.$this->getURI());

View file

@ -18,13 +18,14 @@ class DollbooruBridge extends BridgeAbstract{
);
}
public function collectData(array $param){
public function collectData(){
$param=$this->parameters[$this->queriedContext];
$page = 0;$tags='';
if (isset($param['p'])) {
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
if (isset($param['p']['value'])) {
$page = (int)preg_replace("/[^0-9]/",'', $param['p']['value']);
}
if (isset($param['t'])) {
$tags = urlencode($param['t']);
if (isset($param['t']['value'])) {
$tags = urlencode($param['t']['value']);
}
$html = $this->getSimpleHTMLDOM("http://dollbooru.org/post/list/$tags/$page") or $this->returnServerError('Could not request Dollbooru.');

View file

@ -15,9 +15,10 @@ class DuckDuckGoBridge extends BridgeAbstract{
);
}
public function collectData(array $param){
public function collectData(){
$param=$this->parameters[$this->queriedContext];
$html = '';
$link = 'http://duckduckgo.com/html/?q='.$param['u'].'+sort:date';
$link = 'http://duckduckgo.com/html/?q='.$param['u']['value'].'+sort:date';
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('Could not request DuckDuckGo.');

View file

@ -17,7 +17,8 @@ class EZTVBridge extends BridgeAbstract{
);
}
public function collectData(array $param){
public function collectData(){
$param=$this->parameters[$this->queriedContext];
// Make timestamp from relative released time in table
function makeTimestamp($relativeReleaseTime){
@ -33,11 +34,11 @@ class EZTVBridge extends BridgeAbstract{
}
// Check for ID provided
if (!isset($param['i']))
if (!isset($param['i']['value']))
$this->returnClientError('You must provide a list of ID (?i=showID1,showID2,...)');
// Loop on show ids
$showList = explode(",",$param['i']);
$showList = explode(",",$param['i']['value']);
foreach($showList as $showID){
// Get show page

View file

@ -10,7 +10,7 @@ class EliteDangerousGalnetBridge extends BridgeAbstract
$this->description = "Returns the latest page of news from Galnet";
}
public function collectData(array $param)
public function collectData()
{
$html = $this->getSimpleHTMLDOM('https://community.elitedangerous.com/galnet') or $this->returnServerError('Error while downloading the website content');
foreach($html->find('div.article') as $element) {

View file

@ -58,9 +58,10 @@ class ElsevierBridge extends BridgeAbstract{
return '';
}
public function collectData(array $param){
$uri = 'http://www.journals.elsevier.com/' . $param['j'] . '/recent-articles/';
$html = $this->getSimpleHTMLDOM($uri) or $this->returnServerError('No results for Elsevier journal '.$param['j']);
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']);
foreach($html->find('.pod-listing') as $article){
$item = array();

View file

@ -8,7 +8,7 @@ class EstCeQuonMetEnProdBridge extends BridgeAbstract {
$this->description = 'Should we put a website in production today? (French)';
}
public function collectData(array $param) {
public function collectData(){
function ExtractFromDelimiters($string, $start, $end) {
if (strpos($string, $start) !== false) {
$section_retrieved = substr($string, strpos($string, $start) + strlen($start));

View file

@ -16,7 +16,8 @@ class FacebookBridge extends BridgeAbstract{
);
}
public function collectData(array $param) {
public function collectData(){
$param=$this->parameters[$this->queriedContext];
//Extract a string using start and end delimiters
function ExtractFromDelimiters($string, $start, $end) {
@ -104,11 +105,11 @@ class FacebookBridge extends BridgeAbstract{
//Retrieve page contents
if (is_null($html)) {
if (isset($param['u'])) {
if (!strpos($param['u'], "/")) {
$html = $this->getSimpleHTMLDOM('https://www.facebook.com/'.urlencode($param['u']).'?_fb_noscript=1') or $this->returnServerError('No results for this query.');
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.');
} else {
$html = $this->getSimpleHTMLDOM('https://www.facebook.com/pages/'.$param['u'].'?_fb_noscript=1') or $this->returnServerError('No results for this query.');
$html = $this->getSimpleHTMLDOM('https://www.facebook.com/pages/'.$param['u']['value'].'?_fb_noscript=1') or $this->returnServerError('No results for this query.');
}
} else {
$this->returnClientError('You must specify a Facebook username.');
@ -148,7 +149,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'].'/picture?width=200&amp;height=200';
$profilePic = 'https://graph.facebook.com/'.$param['u']['value'].'/picture?width=200&amp;height=200';
$this->name = $author;
foreach($element->children() as $post) {
@ -207,8 +208,8 @@ class FacebookBridge extends BridgeAbstract{
}
public function setDatas(array $param){
if (isset($param['captcha_response']))
unset($param['captcha_response']);
if (isset($param['captcha_response']['value']))
unset($param['captcha_response']['value']);
parent::setDatas($param);
}

View file

@ -10,7 +10,7 @@ Class FierPandaBridge extends BridgeAbstract{
}
public function collectData(array $param){
public function collectData(){
$link = 'http://www.fier-panda.fr/';
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('Could not request Fier Panda.');

View file

@ -10,7 +10,7 @@ class FlickrExploreBridge extends BridgeAbstract{
}
public function collectData(array $param){
public function collectData(){
$html = $this->getSimpleHTMLDOM('https://www.flickr.com/explore') or $this->returnServerError('Could not request Flickr.');
foreach($html->find('.photo-list-photo-view') as $element) {

View file

@ -17,14 +17,15 @@ class FlickrTagBridge extends BridgeAbstract{
);
}
public function collectData(array $param){
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'])) { /* keyword search mode */
$this->request = $param['q'];
if (isset($param['q']['value'])) { /* keyword search mode */
$this->request = $param['q']['value'];
$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'])) { /* user timeline mode */
$this->request = $param['u'];
elseif (isset($param['u']['value'])) { /* user timeline mode */
$this->request = $param['u']['value'];
$html = $this->getSimpleHTMLDOM('http://www.flickr.com/photos/'.urlencode($this->request).'/') or $this->returnServerError('Requested username can\'t be found.');
}

View file

@ -10,7 +10,7 @@ class FootitoBridge extends BridgeAbstract{
}
public function collectData(array $param){
public function collectData(){
$html = $this->getSimpleHTMLDOM('http://www.footito.fr/') or $this->returnServerError('Could not request Footito.');
foreach($html->find('div.post') as $element) {

View file

@ -14,12 +14,13 @@ class FourchanBridge extends BridgeAbstract{
}
public function collectData(array $param){
public function collectData(){
$param=$this->parameters[$this->queriedContext];
if (!isset($param['t']))
if (!isset($param['t']['value']))
$this->returnClientError('You must specify the thread URL (?t=...)');
$thread = parse_url($param['t']) or $this->returnClientError('This URL seems malformed, please check it.');
$thread = parse_url($param['t']['value']) or $this->returnClientError('This URL seems malformed, please check it.');
if($thread['host'] !== 'boards.4chan.org')
$this->returnClientError('4chan thread URL only.');

View file

@ -14,7 +14,8 @@ class FreenewsBridge extends RssExpander {
);
}
public function collectData(array $param){
public function collectData(){
$param=$this->parameters[$this->queriedContext];
parent::collectExpandableDatas($param, FREENEWS_RSS);
}

View file

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

View file

@ -63,11 +63,12 @@ class GBAtempBridge extends BridgeAbstract {
return $this->cleanup_post_content($content, $site_url);
}
public function collectData(array $param) {
public function collectData(){
$param=$this->parameters[$this->queriedContext];
$typeFilter = '';
if (!empty($param['type'])) {
if ($param['type'] == 'N' || $param['type'] == 'R' || $param['type'] == 'T' || $param['type'] == 'F') {
$typeFilter = $param['type'];
if (!empty($param['type']['value'])) {
if ($param['type']['value'] == 'N' || $param['type']['value'] == 'R' || $param['type']['value'] == 'T' || $param['type']['value'] == 'F') {
$typeFilter = $param['type']['value'];
if ($typeFilter == 'N') { $this->filter = 'News'; }
if ($typeFilter == 'R') { $this->filter = 'Review'; }
if ($typeFilter == 'T') { $this->filter = 'Tutorial'; }

View file

@ -21,12 +21,13 @@ class GawkerBridge extends RssExpander{
return RSS_PREFIX.$name.RSS_SUFFIX;
}
public function collectData(array $param){
if (empty($param['site'])) {
public function collectData(){
$param=$this->parameters[$this->queriedContext];
if (empty($param['site']['value'])) {
trigger_error("If no site is provided, nothing is gonna happen", E_USER_ERROR);
} else {
$this->name = $param['site'];
$url = $this->toURI(strtolower($param['site']));
$this->name = $param['site']['value'];
$url = $this->toURI(strtolower($param['site']['value']));
}
$this->debugMessage("loading feed from ".$this->getURI());
parent::collectExpandableDatas($param, $url);

View file

@ -18,15 +18,16 @@ class GelbooruBridge extends BridgeAbstract{
}
public function collectData(array $param){
public function collectData(){
$param=$this->parameters[$this->queriedContext];
$page = 0;
if (isset($param['p'])) {
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
if (isset($param['p']['value'])) {
$page = (int)preg_replace("/[^0-9]/",'', $param['p']['value']);
$page = $page - 1;
$page = $page * 63;
}
if (isset($param['t'])) {
$tags = urlencode($param['t']);
if (isset($param['t']['value'])) {
$tags = urlencode($param['t']['value']);
}
$html = $this->getSimpleHTMLDOM("http://gelbooru.com/index.php?page=post&s=list&tags=$tags&pid=$page") or $this->returnServerError('Could not request Gelbooru.');

View file

@ -20,23 +20,24 @@ class GiphyBridge extends BridgeAbstract{
}
public function collectData(array $param){
public function collectData(){
$param=$this->parameters[$this->queriedContext];
$html = '';
$base_url = 'http://giphy.com';
if (isset($param['s'])) { /* keyword search mode */
$html = $this->getSimpleHTMLDOM($base_url.'/search/'.urlencode($param['s'].'/')) or $this->returnServerError('No results for this query.');
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.');
}
else {
$this->returnClientError('You must specify a search worf (?s=...).');
}
$max = GIPHY_LIMIT;
if (isset($param['n'])) {
$max = (integer) $param['n'];
if (isset($param['n']['value'])) {
$max = (integer) $param['n']['value'];
}
$limit = 0;
$kw = urlencode($param['s']);
$kw = urlencode($param['s']['value']);
foreach($html->find('div.hoverable-gif') as $entry) {
if($limit < $max) {
$node = $entry->first_child();

View file

@ -28,12 +28,13 @@ class GithubIssueBridge extends BridgeAbstract{
);
}
public function collectData(array $param){
$uri = 'https://github.com/'.$param['u'].'/'.$param['p'].'/issues/'.(isset($param['i'])?$param['i']:'');
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']:'');
$html = $this->getSimpleHTMLDOM($uri)
or $this->returnServerError('No results for Github Issue '.$param['i'].' in project '.$param['u'].'/'.$param['p']);
or $this->returnServerError('No results for Github Issue '.$param['i']['value'].' in project '.$param['u']['value'].'/'.$param['p']['value']);
if(isset($param['i'])){
if(isset($param['i']['value'])){
foreach($html->find('.js-comment-container') as $comment){
$item = array();

View file

@ -33,29 +33,30 @@ class GitlabCommitsBridge extends BridgeAbstract{
);
}
public function collectData(array $param){
$uri = $param['uri'].'/'.$param['u'].'/'.$param['p'].'/commits/';
if(isset($param['b'])){
$uri.=$param['b'];
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'];
}else{
$uri.='master';
}
$html = $this->getSimpleHTMLDOM($uri)
or $this->returnServerError('No results for Gitlab Commits of project '.$param['uri'].'/'.$param['u'].'/'.$param['p']);
or $this->returnServerError('No results for Gitlab Commits of project '.$param['uri']['value'].'/'.$param['u']['value'].'/'.$param['p']['value']);
foreach($html->find('li.commit') as $commit){
$item = array();
$item['uri']=$param['uri'];
$item['uri']=$param['uri']['value'];
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'].'/'.$param['p']));
$item['uri'].=substr($href,strpos($href,'/'.$param['u']['value'].'/'.$param['p']['value']));
}
if(in_array('commit-row-message',$classes)){
$item['title']=$a->plaintext;

View file

@ -10,7 +10,7 @@ class GizmodoFRBridge extends BridgeAbstract{
}
public function collectData(array $param){
public function collectData(){
function GizmodoFRExtractContent($url) {
$articleHTMLContent = $this->getSimpleHTMLDOM($url);

View file

@ -22,14 +22,14 @@ class GooglePlusPostBridge extends BridgeAbstract
const GOOGLE_PLUS_BASE_URL = 'https://plus.google.com/';
public function collectData(array $param)
public function collectData()
{
if (!isset($param['username']))
if (!isset($param['username']['value']))
{
$this->returnClientError('You must specify a username (?username=...).');
}
$this->request = $param['username'];
$this->request = $param['username']['value'];
// get content parsed
// $html = $this->getSimpleHTMLDOM(__DIR__ . '/../posts2.html'
$html = $this->getSimpleHTMLDOM(self::GOOGLE_PLUS_BASE_URL . urlencode($this->request) . '/posts'

View file

@ -25,11 +25,12 @@ class GoogleSearchBridge extends BridgeAbstract{
}
public function collectData(array $param){
public function collectData(){
$param=$this->parameters[$this->queriedContext];
$html = '';
if (isset($param['q'])) { /* keyword search mode */
$this->request = $param['q'];
if (isset($param['q']['value'])) { /* keyword search mode */
$this->request = $param['q']['value'];
$html = $this->getSimpleHTMLDOM('https://www.google.com/search?q=' . urlencode($this->request) . '&num=100&complete=0&tbs=qdr:y,sbd:1') or $this->returnServerError('No results for this query.');
}
else{

View file

@ -14,7 +14,7 @@ class GuruMedBridge extends BridgeAbstract{
return $string;
}
public function collectData(array $param){
public function collectData(){
$html = $this->getSimpleHTMLDOM('http://gurumed.org/feed') or $this->returnServerError('Could not request Gurumed.');
$limit = 0;

View file

@ -21,12 +21,13 @@ class HDWallpapersBridge extends BridgeAbstract {
);
}
public function collectData(array $param){
public function collectData(){
$param=$this->parameters[$this->queriedContext];
$html = '';
$baseUri = 'http://www.hdwallpapers.in';
$this->category = $param['c'] ?: 'latest_wallpapers'; // Latest default
$this->resolution = $param['r'] ?: '1920x1200'; // Wide wallpaper default
$this->category = $param['c']['value'] ?: 'latest_wallpapers'; // Latest default
$this->resolution = $param['r']['value'] ?: '1920x1200'; // Wide wallpaper default
$category = $this->category;
if (strrpos($category, 'wallpapers') !== strlen($category)-strlen('wallpapers')) {
@ -34,7 +35,7 @@ class HDWallpapersBridge extends BridgeAbstract {
}
$num = 0;
$max = $param['m'] ?: 14;
$max = $param['m']['value'] ?: 14;
$lastpage = 1;
for ($page = 1; $page <= $lastpage; $page++) {

View file

@ -10,7 +10,7 @@ class HentaiHavenBridge extends BridgeAbstract{
}
public function collectData(array $param){
public function collectData(){
$html = $this->getSimpleHTMLDOM('http://hentaihaven.org/') or $this->returnServerError('Could not request Hentai Haven.');
foreach($html->find('div.zoe-grid') as $element) {
$item = array();

View file

@ -19,10 +19,11 @@ class IdenticaBridge extends BridgeAbstract{
}
public function collectData(array $param){
public function collectData(){
$param=$this->parameters[$this->queriedContext];
$html = '';
if (isset($param['u'])) { /* user timeline mode */
$this->request = $param['u'];
if (isset($param['u']['value'])) { /* user timeline mode */
$this->request = $param['u']['value'];
$html = $this->getSimpleHTMLDOM('https://identi.ca/'.urlencode($this->request)) or $this->returnServerError('Requested username can\'t be found.');
}
else {
@ -34,7 +35,7 @@ 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'] . ' | ' . $item['content'];
$item['title'] = $param['u']['value'] . ' | ' . $item['content'];
$this->items[] = $item;
}
}

View file

@ -16,10 +16,11 @@ class InstagramBridge extends BridgeAbstract{
}
public function collectData(array $param){
public function collectData(){
$param=$this->parameters[$this->queriedContext];
$html = '';
if (isset($param['u'])) { /* user timeline mode */
$this->request = $param['u'];
if (isset($param['u']['value'])) { /* user timeline mode */
$this->request = $param['u']['value'];
$html = $this->getSimpleHTMLDOM('http://instagram.com/'.urlencode($this->request)) or $this->returnServerError('Could not request Instagram.');
}
else {

View file

@ -89,23 +89,24 @@ class IsoHuntBridge extends BridgeAbstract{
);
}
public function collectData(array $params){
public function collectData(){
$params=$this->parameters[$this->queriedContext];
$request_path = '/'; // We'll request the main page by default
if(isset($params['latest_category'])){ // Requesting one of the latest categories
$this->request_latest_category($params['latest_category']);
} elseif(isset($params['torrent_category'])){ // Requesting one of the torrent categories
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
$order_popularity = false;
if(isset($params['torrent_popularity']))
$order_popularity = $params['torrent_popularity'] === "on";
if(isset($params['torrent_popularity']['value']))
$order_popularity = $params['torrent_popularity']['value'];
$this->request_torrent_category($params['torrent_category'], $order_popularity);
} else if(isset($params['search_name'])){ // Requesting search
if(isset($params['search_category']))
$this->request_search($params['search_name'], $params['search_category']);
$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']);
else
$this->request_search($params['search_name']);
$this->request_search($params['search_name']['value']);
} else {
$this->returnClientError('Unknown request!');
}

View file

@ -18,7 +18,8 @@ class JapanExpoBridge extends BridgeAbstract{
);
}
public function collectData(array $param) {
public function collectData(){
$param=$this->parameters[$this->queriedContext];
function french_pubdate_to_timestamp($date_to_parse) {
return strtotime(
@ -50,7 +51,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']) && $param['mode'] == 'full');
$fullcontent = (!empty($param['mode']['value']) && $param['mode']['value'] == 'full');
$count = 0;
foreach ($html->find('a._tile2') as $element) {

View file

@ -17,13 +17,14 @@ class KonachanBridge extends BridgeAbstract{
);
}
public function collectData(array $param){
public function collectData(){
$param=$this->parameters[$this->queriedContext];
$page = 1;$tags='';
if (isset($param['p'])) {
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
if (isset($param['p']['value'])) {
$page = (int)preg_replace("/[^0-9]/",'', $param['p']['value']);
}
if (isset($param['t'])) {
$tags = urlencode($param['t']);
if (isset($param['t']['value'])) {
$tags = urlencode($param['t']['value']);
}
$html = $this->getSimpleHTMLDOM("http://konachan.com/post?page=$page&tags=$tags") or $this->returnServerError('Could not request Konachan.');
$input_json = explode('Post.register(', $html);

View file

@ -21,7 +21,7 @@ class KoreusBridge extends BridgeAbstract{
return $text;
}
public function collectData(array $param){
public function collectData(){
$html = $this->getSimpleHTMLDOM('http://feeds.feedburner.com/Koreus-articles') or $this->returnServerError('Could not request Koreus.');
$limit = 0;

View file

@ -39,21 +39,22 @@ class KununuBridge extends BridgeAbstract{
);
}
public function collectData(array $params){
public function collectData(){
$params=$this->parameters[$this->queriedContext];
// Get Site
$site = strtolower(trim($params['site']));
$site = strtolower(trim($params['site']['value']));
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']))));
$company = $this->encode_umlauts(strtolower(str_replace(' ', '-', trim($params['company']['value']))));
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']))
$full = strtolower(trim($params['full'])) === 'on';
if(isset($params['full']['value']))
$full = strtolower(trim($params['full']['value'])) === 'on';
// Get reviews section name (depends on site)
$section = '';

View file

@ -35,7 +35,7 @@ class LWNprevBridge extends BridgeAbstract{
}
}
public function collectData(array $param){
public function collectData(){
// Because the LWN page is written in loose HTML and not XHTML,
// Simple HTML Dom is not accurate enough for the job

View file

@ -138,14 +138,15 @@ class LeBonCoinBridge extends BridgeAbstract{
}
public function collectData(array $param){
public function collectData(){
$param=$this->parameters[$this->queriedContext];
$html = '';
if (empty($param['c'])) {
$link = 'http://www.leboncoin.fr/annonces/offres/' . $param['r'] . '/?f=a&th=1&q=' . urlencode($param['k']);
if (empty($param['c']['value'])) {
$link = 'http://www.leboncoin.fr/annonces/offres/' . $param['r']['value'] . '/?f=a&th=1&q=' . urlencode($param['k']['value']);
}
else {
$link = 'http://www.leboncoin.fr/' . $param['c'] . '/offres/' . $param['r'] . '/?f=a&th=1&q=' . urlencode($param['k']);
$link = 'http://www.leboncoin.fr/' . $param['c']['value'] . '/offres/' . $param['r']['value'] . '/?f=a&th=1&q=' . urlencode($param['k']['value']);
}
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('Could not request LeBonCoin.');

View file

@ -36,7 +36,7 @@ class LeJournalDuGeekBridge extends BridgeAbstract{
return $text;
}
public function collectData(array $param){
public function collectData(){
$rssFeed = $this->getSimpleHTMLDOM('http://www.journaldugeek.com/rss') or $this->returnServerError('Could not request http://www.journaldugeek.com/rss');
$limit = 0;

View file

@ -10,7 +10,7 @@ class LeMondeInformatiqueBridge extends BridgeAbstract {
}
public function collectData(array $param) {
public function collectData(){
function StripCDATA($string) {
$string = str_replace('<![CDATA[', '', $string);

View file

@ -14,7 +14,8 @@ class Les400CulsBridge extends RssExpander{
}
public function collectData(array $param){
public function collectData(){
$param=$this->parameters[$this->queriedContext];
parent::collectExpandableDatas($param, SEXE_FEED);
}

View file

@ -10,7 +10,7 @@ class LesJoiesDuCodeBridge extends BridgeAbstract{
}
public function collectData(array $param){
public function collectData(){
$html = $this->getSimpleHTMLDOM('http://lesjoiesducode.fr/') or $this->returnServerError('Could not request LesJoiesDuCode.');
foreach($html->find('div.blog-post') as $element) {

View file

@ -10,7 +10,7 @@ class LichessBridge extends BridgeAbstract
$this->description = 'Returns the 5 newest posts from the Lichess blog (full text)';
}
public function collectData(array $param)
public function collectData()
{
$xml_feed = $this->getSimpleHTMLDOM('http://fr.lichess.org/blog.atom') or $this->returnServerError('Could not retrieve Lichess blog feed.');

View file

@ -16,9 +16,10 @@ class LinkedInCompany extends BridgeAbstract{
);
}
public function collectData(array $param){
public function collectData(){
$param=$this->parameters[$this->queriedContext];
$html = '';
$link = 'https://www.linkedin.com/company/'.$param['c'];
$link = 'https://www.linkedin.com/company/'.$param['c']['value'];
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('Could not request LinkedIn.');

View file

@ -17,13 +17,14 @@ class LolibooruBridge extends BridgeAbstract{
);
}
public function collectData(array $param){
public function collectData(){
$param=$this->parameters[$this->queriedContext];
$page = 1; $tags = '';
if (isset($param['p'])) {
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
if (isset($param['p']['value'])) {
$page = (int)preg_replace("/[^0-9]/",'', $param['p']['value']);
}
if (isset($param['t'])) {
$tags = urlencode($param['t']);
if (isset($param['t']['value'])) {
$tags = urlencode($param['t']['value']);
}
$html = $this->getSimpleHTMLDOM("http://lolibooru.moe/post?page=$page&tags=$tags") or $this->returnServerError('Could not request Lolibooru.');
$input_json = explode('Post.register(', $html);

View file

@ -76,7 +76,8 @@ class MangareaderBridge extends BridgeAbstract{
);
}
public function collectData(array $param){
public function collectData(){
$param=$this->parameters[$this->queriedContext];
$this->request = '';
@ -84,21 +85,21 @@ class MangareaderBridge extends BridgeAbstract{
$path = "latest";
$limit = MANGAREADER_LIMIT;
if(isset($param['category'])){ // Get popular updates
if(isset($param['category']['value'])){ // Get popular updates
$type = "popular";
$path = "popular";
if($param['category'] !== "all"){
$path .= "/" . $param['category'];
if($param['category']['value'] !== "all"){
$path .= "/" . $param['category']['value'];
}
}
if(isset($param['path'])){ // Get manga updates
if(isset($param['path']['value'])){ // Get manga updates
$type = "path";
$path = $param['path'];
$path = $param['path']['value'];
}
if(isset($param['limit']) && $param['limit'] !== ""){ // Get manga updates (optional parameter)
$limit = $param['limit'];
if(isset($param['limit']['value']) && $param['limit']['value'] !== ""){ // Get manga updates (optional parameter)
$limit = $param['limit']['value'];
}
// We'll use the DOM parser for this as it makes navigation easier

View file

@ -17,13 +17,14 @@ class MilbooruBridge extends BridgeAbstract{
);
}
public function collectData(array $param){
public function collectData(){
$param=$this->parameters[$this->queriedContext];
$page = 0;$tags='';
if (isset($param['p'])) {
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
if (isset($param['p']['value'])) {
$page = (int)preg_replace("/[^0-9]/",'', $param['p']['value']);
}
if (isset($param['t'])) {
$tags = urlencode($param['t']);
if (isset($param['t']['value'])) {
$tags = urlencode($param['t']['value']);
}
$html = $this->getSimpleHTMLDOM("http://sheslostcontrol.net/moe/shimmie/index.php?q=/post/list/$tags/$page") or $this->returnServerError('Could not request Milbooru.');

View file

@ -8,7 +8,7 @@ class MondeDiploBridge extends BridgeAbstract{
$this->description = "Returns most recent results from MondeDiplo.";
}
public function collectData(array $param){
public function collectData(){
$html = $this->getSimpleHTMLDOM($this->uri) or $this->returnServerError('Could not request MondeDiplo. for : ' . $link);
foreach($html->find('div.unarticle') as $article) {

View file

@ -14,7 +14,7 @@ class MsnMondeBridge extends BridgeAbstract{
$item['timestamp'] = strtotime($html2->find('.authorinfo-txt', 0)->find('time', 0)->datetime);
}
public function collectData(array $param){
public function collectData(){
$html = $this->getSimpleHTMLDOM($this->uri) or $this->returnServerError('Could not request MsnMonde.');
$limit = 0;
foreach($html->find('.smalla') as $article) {

View file

@ -18,15 +18,16 @@ class MspabooruBridge extends BridgeAbstract{
}
public function collectData(array $param){
public function collectData(){
$param=$this->parameters[$this->queriedContext];
$page = 0;$tags='';
if (isset($param['p'])) {
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
if (isset($param['p']['value'])) {
$page = (int)preg_replace("/[^0-9]/",'', $param['p']['value']);
$page = $page - 1;
$page = $page * 50;
}
if (isset($param['t'])) {
$tags = urlencode($param['t']);
if (isset($param['t']['value'])) {
$tags = urlencode($param['t']['value']);
}
$html = $this->getSimpleHTMLDOM("http://mspabooru.com/index.php?page=post&s=list&tags=$tags&pid=$page") or $this->returnServerError('Could not request Mspabooru.');

View file

@ -8,7 +8,7 @@ class NakedSecurityBridge extends BridgeAbstract {
$this->description = 'Returns the newest articles.';
}
public function collectData(array $param) {
public function collectData(){
function StripRecursiveHTMLSection($string, $tag_name, $tag_start) {
$open_tag = '<'.$tag_name;

View file

@ -10,7 +10,7 @@ class NasaApodBridge extends BridgeAbstract{
}
public function collectData(array $param) {
public function collectData(){
$html = $this->getSimpleHTMLDOM('http://apod.nasa.gov/apod/archivepix.html') or $this->returnServerError('Error while downloading the website content');
$list = explode("<br>", $html->find('b', 0)->innertext);

View file

@ -8,7 +8,7 @@ class NeuviemeArtBridge extends BridgeAbstract {
$this->description = "Returns the newest articles.";
}
public function collectData(array $param) {
public function collectData(){
function StripWithDelimiters($string, $start, $end) {
while (strpos($string, $start) !== false) {

View file

@ -25,7 +25,7 @@ class NextInpactBridge extends BridgeAbstract {
return $text;
}
public function collectData(array $param) {
public function collectData(){
$html = $this->getSimpleHTMLDOM('http://www.nextinpact.com/rss/news.xml') or $this->returnServerError('Could not request NextInpact.');
$limit = 0;

View file

@ -28,7 +28,8 @@ class NextgovBridge extends BridgeAbstract {
);
}
public function collectData(array $param) {
public function collectData(){
$param=$this->parameters[$this->queriedContext];
function ExtractFromDelimiters($string, $start, $end) {
if (strpos($string, $start) !== false) {
@ -46,7 +47,7 @@ class NextgovBridge extends BridgeAbstract {
} return $string;
}
$category = $param['category'];
$category = $param['category']['value'];
if (empty($category))
$category = 'all';
if ($category !== preg_replace('/[^a-z-]+/', '', $category) || strlen($category > 32))

View file

@ -22,7 +22,7 @@ class NiceMatinBridge extends BridgeAbstract{
return $text;
}
public function collectData(array $param){
public function collectData(){
$html = $this->getSimpleHTMLDOM('http://www.nicematin.com/derniere-minute/rss') or $this->returnServerError('Could not request NiceMatin.');
$limit = 0;

View file

@ -15,10 +15,11 @@ class NovelUpdatesBridge extends BridgeAbstract{
);
}
public function collectData(array $param){
if (!isset($param['n']))
public function collectData(){
$param=$this->parameters[$this->queriedContext];
if (!isset($param['n']['value']))
$this->returnClientError('You must specify the novel URL (/series/...)');
$thread = parse_url($param['n']) or $this->returnClientError('This URL seems malformed, please check it.');
$thread = parse_url($param['n']['value']) 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)

View file

@ -10,7 +10,7 @@ class NumeramaBridge extends BridgeAbstract{
}
public function collectData(array $param) {
public function collectData(){
function NumeramaStripCDATA($string) {
$string = str_replace('<![CDATA[', '', $string);

View file

@ -29,14 +29,15 @@ class OpenClassroomsBridge extends BridgeAbstract{
}
public function collectData(array $param){
if (empty($param['u']))
public function collectData(){
$param=$this->parameters[$this->queriedContext];
if (empty($param['u']['value']))
{
$this->returnServerError('Error: You must chose a category.');
}
$html = '';
$link = 'https://openclassrooms.com/courses?categories='.$param['u'].'&title=&sort=updatedAt+desc';
$link = 'https://openclassrooms.com/courses?categories='.$param['u']['value'].'&title=&sort=updatedAt+desc';
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('Could not request OpenClassrooms.');

View file

@ -29,7 +29,7 @@ class ParuVenduImmoBridge extends BridgeAbstract
);
}
public function collectData(array $param)
public function collectData()
{
$html = '';
$num = 20;
@ -37,22 +37,22 @@ class ParuVenduImmoBridge extends BridgeAbstract
$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'])) {
$this->request .= ' '.$param['minarea'].' m2';
$link .= '&sur0='.urlencode($param['minarea']);
if (isset($param['minarea']['value'])) {
$this->request .= ' '.$param['minarea']['value'].' m2';
$link .= '&sur0='.urlencode($param['minarea']['value']);
}
if (isset($param['maxprice'])) {
$link .= '&px1='.urlencode($param['maxprice']);
if (isset($param['maxprice']['value'])) {
$link .= '&px1='.urlencode($param['maxprice']['value']);
}
if (isset($param['pa'])) {
$link .= '&pa='.urlencode($param['pa']);
if (isset($param['pa']['value'])) {
$link .= '&pa='.urlencode($param['pa']['value']);
}
if (isset($param['lo'])) {
$this->request .= ' In: '.$param['lo'];
$link .= '&lo='.urlencode($param['lo']);
if (isset($param['lo']['value'])) {
$this->request .= ' In: '.$param['lo']['value'];
$link .= '&lo='.urlencode($param['lo']['value']);
}
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('Could not request paruvendu.');

View file

@ -28,19 +28,20 @@ class PickyWallpapersBridge extends BridgeAbstract {
}
public function collectData(array $param){
public function collectData(){
$param=$this->parameters[$this->queriedContext];
$html = '';
if (!isset($param['c'])) {
if (!isset($param['c']['value'])) {
$this->returnClientError('You must specify at least a category (?c=...).');
} else {
$baseUri = 'http://www.pickywallpapers.com';
$this->category = $param['c'];
$this->subcategory = $param['s'] ?: '';
$this->resolution = $param['r'] ?: '1920x1200'; // Wide wallpaper default
$this->category = $param['c']['value'];
$this->subcategory = $param['s']['value'] ?: '';
$this->resolution = $param['r']['value'] ?: '1920x1200'; // Wide wallpaper default
$num = 0;
$max = $param['m'] ?: 12;
$max = $param['m']['value'] ?: 12;
$lastpage = 1;
for ($page = 1; $page <= $lastpage; $page++) {

View file

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

View file

@ -14,7 +14,7 @@ class PlanetLibreBridge extends BridgeAbstract{
return $text;
}
public function collectData(array $param){
public function collectData(){
$html = $this->getSimpleHTMLDOM('http://www.planet-libre.org/') or $this->returnServerError('Could not request PlanetLibre.');
$limit = 0;
foreach($html->find('div.post') as $element) {

View file

@ -11,7 +11,7 @@ class ProjectMGameBridge extends BridgeAbstract{
}
public function collectData(array $param){
public function collectData(){
$html = '';
$html = $this->getSimpleHTMLDOM('http://projectmgame.com/en/') or $this->returnServerError('Error while downloading the Project M homepage');

View file

@ -15,13 +15,14 @@ class RTBFBridge extends BridgeAbstract {
);
}
public function collectData(array $param) {
public function collectData(){
$param=$this->parameters[$this->queriedContext];
$html = '';
$limit = 10;
$count = 0;
if (isset($param['c'])) {
$html = $this->getSimpleHTMLDOM('http://www.rtbf.be/auvio/emissions/detail?id='.$param['c']) or $this->returnServerError('Could not request RTBF.');
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.');
foreach($html->find('section[id!=widget-ml-avoiraussi-] .rtbf-media-grid article') as $element) {
if($count < $limit) {

View file

@ -10,7 +10,7 @@ class Releases3DSBridge extends BridgeAbstract {
}
public function collectData(array $param) {
public function collectData(){
function ExtractFromDelimiters($string, $start, $end) {
if (strpos($string, $start) !== false) {

View file

@ -25,7 +25,7 @@ class ReporterreBridge extends BridgeAbstract{
return $text;
}
public function collectData(array $param){
public function collectData(){
$html = $this->getSimpleHTMLDOM('http://www.reporterre.net/spip.php?page=backend') or $this->returnServerError('Could not request Reporterre.');
$limit = 0;

View file

@ -19,7 +19,7 @@ class Rue89Bridge extends BridgeAbstract{
}
public function collectData(array $param){
public function collectData(){
$html = $this->getSimpleHTMLDOM('http://api.rue89.nouvelobs.com/feed') or $this->returnServerError('Could not request Rue89.');

View file

@ -18,15 +18,16 @@ class Rule34Bridge extends BridgeAbstract{
}
public function collectData(array $param){
public function collectData(){
$param=$this->parameters[$this->queriedContext];
$page = 0;$tags='';
if (isset($param['p'])) {
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
if (isset($param['p']['value'])) {
$page = (int)preg_replace("/[^0-9]/",'', $param['p']['value']);
$page = $page - 1;
$page = $page * 50;
}
if (isset($param['t'])) {
$tags = urlencode($param['t']);
if (isset($param['t']['value'])) {
$tags = urlencode($param['t']['value']);
}
$html = $this->getSimpleHTMLDOM("http://rule34.xxx/index.php?page=post&s=list&tags=$tags&pid=$page") or $this->returnServerError('Could not request Rule34.');

View file

@ -18,13 +18,14 @@ class Rule34pahealBridge extends BridgeAbstract{
}
public function collectData(array $param){
public function collectData(){
$param=$this->parameters[$this->queriedContext];
$page = 0;$tags='';
if (isset($param['p'])) {
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
if (isset($param['p']['value'])) {
$page = (int)preg_replace("/[^0-9]/",'', $param['p']['value']);
}
if (isset($param['t'])) {
$tags = urlencode($param['t']);
if (isset($param['t']['value'])) {
$tags = urlencode($param['t']['value']);
}
$html = $this->getSimpleHTMLDOM("http://rule34.paheal.net/post/list/$tags/$page") or $this->returnServerError('Could not request Rule34paheal.');

View file

@ -18,15 +18,16 @@ class SafebooruBridge extends BridgeAbstract{
}
public function collectData(array $param){
public function collectData(){
$param=$this->parameters[$this->queriedContext];
$page = 0;$tags='';
if (isset($param['p'])) {
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
if (isset($param['p']['value'])) {
$page = (int)preg_replace("/[^0-9]/",'', $param['p']['value']);
$page = $page - 1;
$page = $page * 40;
}
if (isset($param['t'])) {
$tags = urlencode($param['t']);
if (isset($param['t']['value'])) {
$tags = urlencode($param['t']['value']);
}
$html = $this->getSimpleHTMLDOM("http://safebooru.org/index.php?page=post&s=list&tags=$tags&pid=$page") or $this->returnServerError('Could not request Safebooru.');

View file

@ -18,13 +18,14 @@ class SakugabooruBridge extends BridgeAbstract{
}
public function collectData(array $param){
public function collectData(){
$param=$this->parameters[$this->queriedContext];
$page = 1;$tags='';
if (isset($param['p'])) {
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
if (isset($param['p']['value'])) {
$page = (int)preg_replace("/[^0-9]/",'', $param['p']['value']);
}
if (isset($param['t'])) {
$tags = urlencode($param['t']);
if (isset($param['t']['value'])) {
$tags = urlencode($param['t']['value']);
}
$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);

View file

@ -10,7 +10,7 @@ class ScmbBridge extends BridgeAbstract{
}
public function collectData(array $param){
public function collectData(){
$html = '';
$html = $this->getSimpleHTMLDOM('http://secouchermoinsbete.fr/') or $this->returnServerError('Could not request Se Coucher Moins Bete.');

View file

@ -17,10 +17,11 @@ class ScoopItBridge extends BridgeAbstract{
}
public function collectData(array $param){
public function collectData(){
$param=$this->parameters[$this->queriedContext];
$html = '';
if ($param['u'] != '') {
$this->request = $param['u'];
if ($param['u']['value'] != '') {
$this->request = $param['u']['value'];
$link = 'http://scoop.it/search?q=' .urlencode($this->request);
$html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('Could not request ScoopIt. for : ' . $link);

View file

@ -37,18 +37,19 @@ class SensCritiqueBridge extends BridgeAbstract {
);
}
public function collectData(array $param) {
if ((isset($param['m']) && $param['m'])) {
public function collectData(){
$param=$this->parameters[$this->queriedContext];
if ((isset($param['m']['value']) && $param['m']['value'])) {
$this->collectMoviesData();
} else if ((isset($param['s']) && $param['s'])) {
} else if ((isset($param['s']['value']) && $param['s']['value'])) {
$this->collectSeriesData();
} else if ((isset($param['g']) && $param['g'])) {
} else if ((isset($param['g']['value']) && $param['g']['value'])) {
$this->collectGamesData();
} else if ((isset($param['b']) && $param['b'])) {
} else if ((isset($param['b']['value']) && $param['b']['value'])) {
$this->collectBooksData();
} else if ((isset($param['bd']) && $param['bd'])) {
} else if ((isset($param['bd']['value']) && $param['bd']['value'])) {
$this->collectBDsData();
} else if ((isset($param['mu']) && $param['mu'])) {
} else if ((isset($param['mu']['value']) && $param['mu']['value'])) {
$this->collectMusicsData();
} else {
$this->returnClientError('You must choose a category');

View file

@ -10,7 +10,7 @@ class Sexactu extends BridgeAbstract{
}
public function collectData(array $param){
public function collectData(){
$find = array('janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'novembre', 'décembre');
$replace = array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');

Some files were not shown because too many files have changed in this diff Show more