From 23bb5c5dfbb5319e429f3a87ad3217f96e74556e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Mazi=C3=A8re?= Date: Tue, 30 Aug 2016 00:07:22 +0200 Subject: [PATCH] [WhydBridge] fix getName() + code simplification MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pierre Mazière --- bridges/WhydBridge.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/bridges/WhydBridge.php b/bridges/WhydBridge.php index 5adfc982..bbaee2d2 100644 --- a/bridges/WhydBridge.php +++ b/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) . '
' . $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(){