[GVBAtempBridge] fix getName() and fetch_post_content()

Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
This commit is contained in:
Pierre Mazière 2016-08-28 20:30:37 +02:00
parent 2ca854cacf
commit 05825cf6f7

View file

@ -54,14 +54,19 @@ class GBAtempBridge extends BridgeAbstract {
} }
private function fetch_post_content($uri, $site_url) { 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; $content = $html->find('div.messageContent', 0)->innertext;
return $this->cleanup_post_content($content, $site_url); return $this->cleanup_post_content($content, $site_url);
} }
public function collectData(){ 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')){ switch($this->getInput('type')){
case 'N': case 'N':
@ -110,7 +115,10 @@ class GBAtempBridge extends BridgeAbstract {
} }
public function getName() { 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'; return 'GBAtemp '.$type.' Bridge';
} }