From e9ff7b32f17d60e0f29a511461a327f8902b300c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Mazi=C3=A8re?= Date: Sun, 28 Aug 2016 01:48:57 +0200 Subject: [PATCH] [AskfmBridge] remove useless code and fix getName() and getURI() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pierre Mazière --- bridges/AskfmBridge.php | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/bridges/AskfmBridge.php b/bridges/AskfmBridge.php index 785dab26..6de8f54f 100644 --- a/bridges/AskfmBridge.php +++ b/bridges/AskfmBridge.php @@ -16,13 +16,8 @@ class AskfmBridge extends BridgeAbstract{ public function collectData(){ $html = ''; - 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 { - $this->returnClientError('You must specify a username (?u=...).'); - } + $html = $this->getSimpleHTMLDOM($this->getURI()) + or $this->returnServerError('Requested username can\'t be found.'); foreach($html->find('div.streamItem-answer') as $element) { $item = array(); @@ -48,11 +43,11 @@ class AskfmBridge extends BridgeAbstract{ } public function getName(){ - return empty($this->request) ? $this->name : $this->request; + return $this->name.' : '.$this->getInput('u'); } public function getURI(){ - return empty($this->request) ? $this->uri : 'http://ask.fm/'.urlencode($this->request); + return $this->uri.urlencode($this->getInput('u')).'/answers/more?page=0'; } public function getCacheDuration(){