From 05825cf6f778b98bc93fb4a7ba7d7fd5072755ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Mazi=C3=A8re?= Date: Sun, 28 Aug 2016 20:30:37 +0200 Subject: [PATCH] [GVBAtempBridge] fix getName() and fetch_post_content() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pierre Mazière --- bridges/GBAtempBridge.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/bridges/GBAtempBridge.php b/bridges/GBAtempBridge.php index eccd090a..bab42be7 100644 --- a/bridges/GBAtempBridge.php +++ b/bridges/GBAtempBridge.php @@ -54,14 +54,19 @@ class GBAtempBridge extends BridgeAbstract { } private function fetch_post_content($uri, $site_url) { - $html = $this->getSimpleHTMLDOM($uri) or $this->returnServerError('Could not request GBAtemp: '.$uri); + $html = $this->getSimpleHTMLDOM($uri); + if(!$html){ + return 'Could not request GBAtemp '.$uri; + } + $content = $html->find('div.messageContent', 0)->innertext; return $this->cleanup_post_content($content, $site_url); } public function collectData(){ - $html = $this->getSimpleHTMLDOM($this->uri) or $this->returnServerError('Could not request GBAtemp.'); + $html = $this->getSimpleHTMLDOM($this->uri) + or $this->returnServerError('Could not request GBAtemp.'); switch($this->getInput('type')){ case 'N': @@ -110,7 +115,10 @@ class GBAtempBridge extends BridgeAbstract { } public function getName() { - $type=array_search($this->getInput('type'),$param['type']['values']); + $type=array_search( + $this->getInput('type'), + $this->parameters[$this->queriedContext]['type']['values'] + ); return 'GBAtemp '.$type.' Bridge'; }