1
0
Quellcode durchsuchen

[WhydBridge] fix getName() + code simplification

Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
Pierre Mazière vor 7 Jahren
Ursprung
Commit
23bb5c5dfb
1 geänderte Dateien mit 6 neuen und 4 gelöschten Zeilen
  1. 6 4
      bridges/WhydBridge.php

+ 6 - 4
bridges/WhydBridge.php

@@ -13,6 +13,8 @@ class WhydBridge extends BridgeAbstract{
         )
     ));
 
+    private $userName='';
+
 	public function collectData(){
 		$html = '';
         if (strlen(preg_replace("/[^0-9a-f]/",'', $this->getInput('u'))) == 24){
@@ -34,7 +36,7 @@ class WhydBridge extends BridgeAbstract{
                 }
             }
         }
-        $this->name = $html->find('div#profileTop', 0)->find('h1', 0)->plaintext;
+        $this->userName = $html->find('div#profileTop', 0)->find('h1', 0)->plaintext;
 
 		for($i = 0; $i < 10; $i++) {
 			$track = $html->find('div.post', $i);
@@ -42,13 +44,13 @@ class WhydBridge extends BridgeAbstract{
             $item['author'] = $track->find('h2', 0)->plaintext;
             $item['title'] = $track->find('h2', 0)->plaintext;
             $item['content'] = $track->find('a.thumb',0) . '<br/>' . $track->find('h2', 0)->plaintext;
-            $item['id'] = 'http://www.whyd.com' . $track->find('a.no-ajaxy',0)->getAttribute('href');
-            $item['uri'] = 'http://www.whyd.com' . $track->find('a.no-ajaxy',0)->getAttribute('href');
+            $item['id'] = $this->uri . $track->find('a.no-ajaxy',0)->getAttribute('href');
+            $item['uri'] = $this->uri . $track->find('a.no-ajaxy',0)->getAttribute('href');
             $this->items[] = $item;
         }
     }
 	public function getName(){
-		return (!empty($this->name) ? $this->name .' - ' : '') .'Whyd Bridge';
+		return (!empty($this->userName) ? $this->userName .' - ' : '') .'Whyd Bridge';
 	}
 
 	public function getCacheDuration(){