From 755d3e133f9acdf567d78c488b28ff982dc95fed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Mazi=C3=A8re?= Date: Sat, 27 Aug 2016 10:36:56 +0200 Subject: [PATCH 01/62] [ABCTabsBridge] remove useless member $request MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pierre Mazière --- bridges/ABCTabsBridge.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/bridges/ABCTabsBridge.php b/bridges/ABCTabsBridge.php index 6031d31..355f82d 100644 --- a/bridges/ABCTabsBridge.php +++ b/bridges/ABCTabsBridge.php @@ -1,8 +1,6 @@ maintainer = "kranack"; From 1de7fb748cf93b06be25921d87b613d2aa87c275 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Mazi=C3=A8re?= Date: Sat, 27 Aug 2016 10:58:00 +0200 Subject: [PATCH 02/62] [BandcampBridge] remove useless member $request MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pierre Mazière --- bridges/BandcampBridge.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/bridges/BandcampBridge.php b/bridges/BandcampBridge.php index b9dbaa2..fa64c07 100644 --- a/bridges/BandcampBridge.php +++ b/bridges/BandcampBridge.php @@ -1,8 +1,6 @@ maintainer = "sebsauvage"; @@ -22,8 +20,7 @@ class BandcampBridge extends BridgeAbstract{ $param=$this->parameters[$this->queriedContext]; $html = ''; 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.'); + $html = $this->getSimpleHTMLDOM('http://bandcamp.com/tag/'.urlencode($param['tag']['value']).'?sort_field=date') or $this->returnServerError('No results for this query.'); } else { $this->returnClientError('You must specify tag (/tag/...)'); @@ -45,7 +42,9 @@ class BandcampBridge extends BridgeAbstract{ } public function getName(){ - return (!empty($this->request) ? $this->request .' - ' : '') .'Bandcamp Tag'; + $param=$this->parameters[$this->queriedContext]; + + return (!empty($param['tag']['value']) ? $param['tag']['value'] .' - ' : '') .'Bandcamp Tag'; } public function getCacheDuration(){ From 0d36ca21df02f0258651440aadfdaa56584ac34a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Mazi=C3=A8re?= Date: Sat, 27 Aug 2016 11:05:08 +0200 Subject: [PATCH 03/62] [CNETBridge] remove useless member $topicName MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pierre Mazière --- bridges/CNETBridge.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/bridges/CNETBridge.php b/bridges/CNETBridge.php index 2fbed35..b92cecc 100644 --- a/bridges/CNETBridge.php +++ b/bridges/CNETBridge.php @@ -1,8 +1,6 @@ maintainer = 'ORelio'; @@ -43,10 +41,7 @@ class CNETBridge extends BridgeAbstract { return $article_html; } - if (!empty($param['topic']['value'])) - $this->topicName = $param['topic']['value']; - - $pageUrl = 'http://www.cnet.com/'.(empty($this->topicName) ? '' : 'topics/'.$this->topicName.'/'); + $pageUrl = 'http://www.cnet.com/'.(empty($param['topic']['value']) ? '' : 'topics/'.$param['topic']['value'].'/'); $html = $this->getSimpleHTMLDOM($pageUrl) or $this->returnServerError('Could not request CNET: '.$pageUrl); $limit = 0; @@ -78,7 +73,8 @@ class CNETBridge extends BridgeAbstract { } public function getName() { - return 'CNET News Bridge'.(empty($this->topicName) ? '' : ' - '.$this->topicName); + $param=$this->parameters[$this->queriedContext]; + return 'CNET News Bridge'.(empty($param['topic']['value']) ? '' : ' - '.$this->param['topic']['value']); } public function getCacheDuration() { From ed0fd12193e1608649e483cab3861201be10481a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Mazi=C3=A8re?= Date: Sat, 27 Aug 2016 11:55:58 +0200 Subject: [PATCH 04/62] [DailymotionBridge] simplify code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pierre Mazière --- bridges/DailymotionBridge.php | 155 +++++++++++++++++++--------------- 1 file changed, 88 insertions(+), 67 deletions(-) diff --git a/bridges/DailymotionBridge.php b/bridges/DailymotionBridge.php index 0a73df8..f085f04 100644 --- a/bridges/DailymotionBridge.php +++ b/bridges/DailymotionBridge.php @@ -1,25 +1,25 @@ maintainer = "mitsukarenai"; - $this->name = "Dailymotion Bridge"; - $this->uri = "https://www.dailymotion.com/"; - $this->description = "Returns the 5 newest videos by username/playlist or search"; + $this->maintainer = "mitsukarenai"; + $this->name = "Dailymotion Bridge"; + $this->uri = "https://www.dailymotion.com/"; + $this->description = "Returns the 5 newest videos by username/playlist or search"; $this->parameters["By username"] = array( - 'u'=>array('name'=>'username') + 'u'=>array( + 'name'=>'username', + 'required'=>true + ) ); $this->parameters["By playlist id"] = array( - 'p'=>array( - 'name'=>'playlist id', - 'type'=>'text', - 'required'=>true - ) + 'p'=>array( + 'name'=>'playlist id', + 'required'=>true + ) ); $this->parameters["From search results"] = array( @@ -27,66 +27,87 @@ class DailymotionBridge extends BridgeAbstract{ 'name'=>'Search keyword', 'required'=>true ), - 'pa'=>array( - 'name'=>'Page', - 'type'=>'number' - ) + 'pa'=>array( + 'name'=>'Page', + 'type'=>'number' + ) ); - } - - function getMetadata($id) { - $metadata=array(); - $html2 = $this->getSimpleHTMLDOM('http://www.dailymotion.com/video/'.$id) or $this->returnServerError('Could not request Dailymotion.'); - $metadata['title'] = $html2->find('meta[property=og:title]', 0)->getAttribute('content'); - $metadata['timestamp'] = strtotime($html2->find('meta[property=video:release_date]', 0)->getAttribute('content') ); - $metadata['thumbnailUri'] = $html2->find('meta[property=og:image]', 0)->getAttribute('content'); - $metadata['uri'] = $html2->find('meta[property=og:url]', 0)->getAttribute('content'); - - return $metadata; } - public function collectData(){ + function getMetadata($id) { + $metadata=array(); + $html2 = $this->getSimpleHTMLDOM('http://www.dailymotion.com/video/'.$id) + or $this->returnServerError('Could not request Dailymotion.'); + $metadata['title'] = $html2->find('meta[property=og:title]', 0)->getAttribute('content'); + $metadata['timestamp'] = strtotime($html2->find('meta[property=video:release_date]', 0)->getAttribute('content') ); + $metadata['thumbnailUri'] = $html2->find('meta[property=og:image]', 0)->getAttribute('content'); + $metadata['uri'] = $html2->find('meta[property=og:url]', 0)->getAttribute('content'); + return $metadata; + } + + public function collectData(){ + $html = ''; + $limit = 5; + $count = 0; + + $html = $this->getSimpleHTMLDOM($this->getURI()) + or $this->returnServerError('Could not request Dailymotion.'); + + foreach($html->find('div.media a.preview_link') as $element) { + if($count < $limit) { + $item = array(); + $item['id'] = str_replace('/video/', '', strtok($element->href, '_')); + $metadata = $this->getMetadata($item['id']); + $item['uri'] = $metadata['uri']; + $item['title'] = $metadata['title']; + $item['timestamp'] = $metadata['timestamp']; + $item['content'] = '
' . $item['title'] . ''; + $this->items[] = $item; + $count++; + } + } + } + + public function getName(){ $param=$this->parameters[$this->queriedContext]; - $html = ''; - $limit = 5; - $count = 0; + switch($this->queriedContext){ + case 'By username': + $specific=$param['u']['value']; + break; + case 'By playlist id': + $specific=strtok($param['p']['value'], '_'); + break; + case 'From search results': + $specific=$param['s']['value']; + break; + } - 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']['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']['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 { - $this->returnClientError('You must either specify a Dailymotion username (?u=...) or a playlist id (?p=...) or search (?s=...)'); - } + return $specific.' : Dailymotion Bridge'; + } - foreach($html->find('div.media a.preview_link') as $element) { - if($count < $limit) { - $item = array(); - $item['id'] = str_replace('/video/', '', strtok($element->href, '_')); - $metadata = $this->getMetadata($item['id']); - $item['uri'] = $metadata['uri']; - $item['title'] = $metadata['title']; - $item['timestamp'] = $metadata['timestamp']; - $item['content'] = '
' . $item['title'] . ''; - $this->items[] = $item; - $count++; - } - } - } + 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'; + break; + case 'By playlist id': + $uri='http://www.dailymotion.com/playlist/' + .urlencode(strtok($param['p']['value'], '_')); + break; + case 'From search results': + $uri='http://www.dailymotion.com/search/' + .urlencode($param['s']['value']); + if(isset($param['pa']['value'])){ + $uri.='/'.$param['pa']['value']; + } + break; + } + return $uri; + } - public function getName(){ - return (!empty($this->request) ? $this->request .' - ' : '') .'Dailymotion Bridge'; - } - - public function getCacheDuration(){ - return 3600*3; // 3 hours - } + public function getCacheDuration(){ + return 3600*3; // 3 hours + } } From 2f1fa810825419a3066dc912784eb62d5c1fd468 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Mazi=C3=A8re?= Date: Sat, 27 Aug 2016 12:27:28 +0200 Subject: [PATCH 05/62] [GBAtempBridge] remove useless checks and simplify code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pierre Mazière --- bridges/GBAtempBridge.php | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/bridges/GBAtempBridge.php b/bridges/GBAtempBridge.php index f8fc9ff..d928117 100644 --- a/bridges/GBAtempBridge.php +++ b/bridges/GBAtempBridge.php @@ -1,8 +1,6 @@ maintainer = 'ORelio'; @@ -14,6 +12,7 @@ class GBAtempBridge extends BridgeAbstract { 'type'=>array( 'name'=>'Type', 'type'=>'list', + 'required'=>true, 'values'=>array( 'News'=>'N', 'Reviews'=>'R', @@ -65,20 +64,11 @@ class GBAtempBridge extends BridgeAbstract { public function collectData(){ $param=$this->parameters[$this->queriedContext]; - $typeFilter = ''; - 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'; } - if ($typeFilter == 'F') { $this->filter = 'Forum'; } - } else $this->returnClientError('The provided type filter is invalid. Expecting N, R, T, or F.'); - } else $this->returnClientError('Please provide a type filter. Expecting N, R, T, or F.'); $html = $this->getSimpleHTMLDOM($this->uri) or $this->returnServerError('Could not request GBAtemp.'); - if ($typeFilter == 'N') { + switch($param['type']['value']){ + case 'N': foreach ($html->find('li[class=news_item full]') as $newsItem) { $url = $this->uri.$newsItem->find('a', 0)->href; $time = intval($this->ExtractFromDelimiters($newsItem->find('abbr.DateTime', 0)->outertext, 'data-time="', '"')); @@ -87,7 +77,7 @@ class GBAtempBridge extends BridgeAbstract { $content = $this->fetch_post_content($url, $this->uri); $this->items[] = $this->build_item($url, $title, $author, $time, $content); } - } else if ($typeFilter == 'R') { + case 'R': foreach ($html->find('li.portal_review') as $reviewItem) { $url = $this->uri.$reviewItem->find('a', 0)->href; $title = $reviewItem->find('span.review_title', 0)->plaintext; @@ -102,7 +92,7 @@ class GBAtempBridge extends BridgeAbstract { $content = $this->cleanup_post_content($intro.$review.$subheader.$procons.$scores, $this->uri); $this->items[] = $this->build_item($url, $title, $author, $time, $content); } - } else if ($typeFilter == 'T') { + case 'T': foreach ($html->find('li.portal-tutorial') as $tutorialItem) { $url = $this->uri.$tutorialItem->find('a', 0)->href; $title = $tutorialItem->find('a', 0)->plaintext; @@ -111,7 +101,7 @@ class GBAtempBridge extends BridgeAbstract { $content = $this->fetch_post_content($url, $this->uri); $this->items[] = $this->build_item($url, $title, $author, $time, $content); } - } else if ($typeFilter == 'F') { + case 'F': foreach ($html->find('li.rc_item') as $postItem) { $url = $this->uri.$postItem->find('a', 1)->href; $title = $postItem->find('a', 1)->plaintext; @@ -124,7 +114,9 @@ class GBAtempBridge extends BridgeAbstract { } public function getName() { - return 'GBAtemp'.(empty($this->filter) ? '' : ' '.$this->filter).' Bridge'; + $param=$this->parameters[$this->queriedContext]; + $type=array_search($param['type']['value'],$param['type']['values']); + return 'GBAtemp '.$type.' Bridge'; } public function getCacheDuration() { From c061057861330214dc0d95d2332152ad27958c75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Mazi=C3=A8re?= Date: Sat, 27 Aug 2016 12:43:53 +0200 Subject: [PATCH 06/62] [GoogleSearchBridge] remove useless checks and useless member $request MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit still broken though Signed-off-by: Pierre Mazière --- bridges/GoogleSearchBridge.php | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/bridges/GoogleSearchBridge.php b/bridges/GoogleSearchBridge.php index 5585cea..c2512bf 100644 --- a/bridges/GoogleSearchBridge.php +++ b/bridges/GoogleSearchBridge.php @@ -9,8 +9,6 @@ */ class GoogleSearchBridge extends BridgeAbstract{ - private $request; - public function loadMetadatas() { $this->maintainer = "sebsauvage"; @@ -19,7 +17,10 @@ class GoogleSearchBridge extends BridgeAbstract{ $this->description = "Returns most recent results from Google search."; $this->parameters[] = array( - 'q'=>array('name'=>"keyword") + 'q'=>array( + 'name'=>"keyword", + 'required'=>true + ) ); } @@ -29,13 +30,7 @@ class GoogleSearchBridge extends BridgeAbstract{ $param=$this->parameters[$this->queriedContext]; $html = ''; - 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{ - $this->returnClientError('You must specify a keyword (?q=...).'); - } + $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.'); $emIsRes = $html->find('div[id=ires]',0); if( !is_null($emIsRes) ){ @@ -55,7 +50,8 @@ class GoogleSearchBridge extends BridgeAbstract{ } public function getName(){ - return (!empty($this->request) ? $this->request .' - ' : '') .'Google search'; + $param=$this->parameters[$this->queriedContext]; + return $param['q']['value'] .' - Google search'; } public function getCacheDuration(){ From d95fa6117aaab74d3eb6d0afb290993908575273 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Mazi=C3=A8re?= Date: Sat, 27 Aug 2016 14:47:52 +0200 Subject: [PATCH 07/62] [IdenticaBridge] remove useless code and fix getURI() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pierre Mazière --- bridges/IdenticaBridge.php | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/bridges/IdenticaBridge.php b/bridges/IdenticaBridge.php index a9d3017..15ed759 100644 --- a/bridges/IdenticaBridge.php +++ b/bridges/IdenticaBridge.php @@ -1,8 +1,6 @@ maintainer = "mitsukarenai"; @@ -20,15 +18,9 @@ class IdenticaBridge extends BridgeAbstract{ } public function collectData(){ - $param=$this->parameters[$this->queriedContext]; $html = ''; - 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 { - $this->returnClientError('You must specify an Identica username (?u=...).'); - } + $html = $this->getSimpleHTMLDOM($this->getURI()) + or $this->returnServerError('Requested username can\'t be found.'); foreach($html->find('li.major') as $dent) { $item = array(); @@ -41,11 +33,13 @@ class IdenticaBridge extends BridgeAbstract{ } public function getName(){ - return (!empty($this->request) ? $this->request .' - ' : '') .'Identica Bridge'; + $param=$this->parameters[$this->queriedContext]; + return $param['u']['value'] .' - Identica Bridge'; } public function getURI(){ - return 'https://identica.com'; + $param=$this->parameters[$this->queriedContext]; + return $this->uri.urlencode($param['u']['value']); } public function getCacheDuration(){ From 760141a7513b24f39a2643694e40c95248cc7a95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Mazi=C3=A8re?= Date: Sat, 27 Aug 2016 14:54:10 +0200 Subject: [PATCH 08/62] [InstagramBridge] fix parameter 'u' requirement status MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pierre Mazière --- bridges/InstagramBridge.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bridges/InstagramBridge.php b/bridges/InstagramBridge.php index 8570947..2c2a7e0 100644 --- a/bridges/InstagramBridge.php +++ b/bridges/InstagramBridge.php @@ -11,7 +11,10 @@ class InstagramBridge extends BridgeAbstract{ $this->description = "Returns the newest images"; $this->parameters[] = array( - 'u'=>array('name'=>'username') + 'u'=>array( + 'name'=>'username', + 'required'=>true + ) ); } From 614d425da4e3d37abbdc34444ba8de3304979eb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Mazi=C3=A8re?= Date: Sat, 27 Aug 2016 14:57:43 +0200 Subject: [PATCH 09/62] [InstagramBridge] fix uri, remove useless code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pierre Mazière --- bridges/InstagramBridge.php | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/bridges/InstagramBridge.php b/bridges/InstagramBridge.php index 2c2a7e0..9b48890 100644 --- a/bridges/InstagramBridge.php +++ b/bridges/InstagramBridge.php @@ -1,8 +1,6 @@ maintainer = "pauder"; @@ -20,15 +18,8 @@ class InstagramBridge extends BridgeAbstract{ } public function collectData(){ - $param=$this->parameters[$this->queriedContext]; - $html = ''; - 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 { - $this->returnClientError('You must specify a Instagram username (?u=...).'); - } + $html = $this->getSimpleHTMLDOM($this->getURI()) + or $this->returnServerError('Could not request Instagram.'); $innertext = null; @@ -74,6 +65,13 @@ class InstagramBridge extends BridgeAbstract{ } public function getName(){ - return (!empty($this->request) ? $this->request .' - ' : '') .'Instagram Bridge'; + $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']); } } + From 292f0f85ada51234cd9535337f83b9eb31ce4468 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Mazi=C3=A8re?= Date: Sat, 27 Aug 2016 15:41:42 +0200 Subject: [PATCH 10/62] [ParuVenduImmoBridge] fix undefined $param variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit and remove useless member $request Signed-off-by: Pierre Mazière --- bridges/ParuVenduImmoBridge.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/bridges/ParuVenduImmoBridge.php b/bridges/ParuVenduImmoBridge.php index 345ef97..bb0a77b 100644 --- a/bridges/ParuVenduImmoBridge.php +++ b/bridges/ParuVenduImmoBridge.php @@ -2,8 +2,6 @@ class ParuVenduImmoBridge extends BridgeAbstract { - private $request = ''; - public function loadMetadatas() { $this->maintainer = "polo2ro"; @@ -31,6 +29,7 @@ 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'; @@ -38,7 +37,6 @@ class ParuVenduImmoBridge extends BridgeAbstract $link = $this->uri.'/immobilier/annonceimmofo/liste/listeAnnonces?tt=1'.$appartment.$maison; if (isset($param['minarea']['value'])) { - $this->request .= ' '.$param['minarea']['value'].' m2'; $link .= '&sur0='.urlencode($param['minarea']['value']); } @@ -51,7 +49,6 @@ class ParuVenduImmoBridge extends BridgeAbstract } if (isset($param['lo']['value'])) { - $this->request .= ' In: '.$param['lo']['value']; $link .= '&lo='.urlencode($param['lo']['value']); } @@ -88,7 +85,18 @@ class ParuVenduImmoBridge extends BridgeAbstract } public function getName(){ - return 'Paru Vendu Immobilier'.$this->request; + $param=$this->parameters[$this->queriedContext]; + $request=''; + if(isset($param['minarea']['value']) && + !empty($param['minarea']['value']) + ){ + $request .= ' '.$param['minarea']['value'].' m2'; + } + if(isset($param['lo']['value']) && + !empty($param['lo']['value'])){ + $request .= ' In: '.$param['lo']['value']; + } + return 'Paru Vendu Immobilier'.$request; } public function getCacheDuration(){ From 05001f6b2ee09492e8468ec04a34f485b56c558c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Mazi=C3=A8re?= Date: Sat, 27 Aug 2016 16:02:12 +0200 Subject: [PATCH 11/62] [SoundcloudBridge] remove useless code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pierre Mazière --- bridges/SoundcloudBridge.php | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/bridges/SoundcloudBridge.php b/bridges/SoundcloudBridge.php index 407d6e4..b064be1 100644 --- a/bridges/SoundcloudBridge.php +++ b/bridges/SoundcloudBridge.php @@ -1,9 +1,6 @@ maintainer = "kranack"; @@ -25,31 +22,35 @@ class SoundCloudBridge extends BridgeAbstract{ public function collectData(){ $param=$this->parameters[$this->queriedContext]; - if (isset($param['u']['value']) && !empty($param['u']['value'])) - { - $this->request = $param['u']['value']; - - $res = json_decode($this->getContents('https://api.soundcloud.com/resolve?url=http://www.soundcloud.com/'. urlencode($this->request) .'&client_id=' . self::CLIENT_ID)) or $this->returnServerError('No results for this query'); - $tracks = json_decode($this->getContents('https://api.soundcloud.com/users/'. urlencode($res->id) .'/tracks?client_id=' . self::CLIENT_ID)) or $this->returnServerError('No results for this user'); - } - else - { - $this->returnClientError('You must specify username'); - } + $res = json_decode($this->getContents( + 'https://api.soundcloud.com/resolve?url=http://www.soundcloud.com/' + . urlencode($param['u']['value']) + .'&client_id=' . self::CLIENT_ID + )) or $this->returnServerError('No results for this query'); + $tracks = json_decode($this->getContents( + 'https://api.soundcloud.com/users/' + . urlencode($res->id) + .'/tracks?client_id=' . self::CLIENT_ID + )) or $this->returnServerError('No results for this user'); for ($i=0; $i < 10; $i++) { $item = array(); $item['author'] = $tracks[$i]->user->username .' - '. $tracks[$i]->title; $item['title'] = $tracks[$i]->user->username .' - '. $tracks[$i]->title; $item['content'] = '