diff --git a/bridges/CNETBridge.php b/bridges/CNETBridge.php index e951976..8a896dc 100644 --- a/bridges/CNETBridge.php +++ b/bridges/CNETBridge.php @@ -37,7 +37,8 @@ class CNETBridge extends BridgeAbstract { return $article_html; } - $pageUrl = $this->uri.(empty($this->getInput('topic')) ? '' : 'topics/'.$this->getInput('topic').'/'); + $topic=$this->getInput('topic'); + $pageUrl = $this->uri.(empty($topic) ? '' : 'topics/'.$topic.'/'); $html = $this->getSimpleHTMLDOM($pageUrl) or $this->returnServerError('Could not request CNET: '.$pageUrl); $limit = 0; @@ -69,7 +70,8 @@ class CNETBridge extends BridgeAbstract { } public function getName() { - return 'CNET News Bridge'.(empty($this->getInput('topic')) ? '' : ' - '.$this->getInput('topic')); + $topic=$this->getInput('topic'); + return 'CNET News Bridge'.(empty($topic) ? '' : ' - '.$topic); } public function getCacheDuration() { diff --git a/bridges/CryptomeBridge.php b/bridges/CryptomeBridge.php index 072fbd5..a1934b5 100644 --- a/bridges/CryptomeBridge.php +++ b/bridges/CryptomeBridge.php @@ -18,8 +18,9 @@ class CryptomeBridge extends BridgeAbstract{ public function collectData(){ $html = $this->getSimpleHTMLDOM($this->uri) or $this->returnServerError('Could not request Cryptome.'); - if (!empty($this->getInput('n'))) { /* number of documents */ - $num = min($this->getInput('n'), 20); + $number=$this->getInput('n'); + if (!empty($number)) { /* number of documents */ + $num = min($number, 20); } diff --git a/bridges/DauphineLibereBridge.php b/bridges/DauphineLibereBridge.php index 1084969..09e9809 100644 --- a/bridges/DauphineLibereBridge.php +++ b/bridges/DauphineLibereBridge.php @@ -41,8 +41,9 @@ class DauphineLibereBridge extends BridgeAbstract { $context = stream_context_create($opts); - if (empty($this->getInput('u'))) { - $html = $this->getSimpleHTMLDOM($this->uri.$this->getInput('u').'/rss') + $category=$this->getInput('u'); + if (empty($category)) { + $html = $this->getSimpleHTMLDOM($this->uri.$category.'/rss') or $this->returnServerError('Could not request DauphineLibere.'); } else { $html = $this->getSimpleHTMLDOM($this->uri.'rss') diff --git a/bridges/FourchanBridge.php b/bridges/FourchanBridge.php index eddfdde..4152a08 100644 --- a/bridges/FourchanBridge.php +++ b/bridges/FourchanBridge.php @@ -35,8 +35,8 @@ class FourchanBridge extends BridgeAbstract{ $item['timestamp'] = $element->find('span.dateTime', 0)->getAttribute('data-utc'); $item['author'] = $element->find('span.name', 0)->plaintext; - - if(!empty($element->find('.file', 0) ) ) { + $file=$element->find('.file', 0); + if(!empty($file) ) { $item['image'] = $element->find('.file a', 0)->href; $item['imageThumb'] = $element->find('.file img', 0)->src; if(!isset($item['imageThumb']) and strpos($item['image'], '.swf') !== FALSE) diff --git a/bridges/WallpaperStopBridge.php b/bridges/WallpaperStopBridge.php index 633642c..126bd61 100644 --- a/bridges/WallpaperStopBridge.php +++ b/bridges/WallpaperStopBridge.php @@ -63,7 +63,8 @@ class WallpaperStopBridge extends BridgeAbstract { } public function getName(){ - return 'WallpaperStop - '.$this->getInput('c').(!empty($this->getInput('s')) ? ' > '.$this->getInput('s') : '').' ['.$this->getInput('r').']'; + $subcategory=$this->getInput('s'); + return 'WallpaperStop - '.$this->getInput('c').(!empty($subcategory) ? ' > '.$subcategory : '').' ['.$this->getInput('r').']'; } public function getCacheDuration(){ diff --git a/bridges/WorldOfTanksBridge.php b/bridges/WorldOfTanksBridge.php index 8b0ec83..777abf2 100644 --- a/bridges/WorldOfTanksBridge.php +++ b/bridges/WorldOfTanksBridge.php @@ -31,8 +31,9 @@ class WorldOfTanksBridge extends HttpCachingBridgeAbstract{ function getURI(){ $lang = $this->getInput('lang'); $uri = $this->uri.$lang.'/news/'; - if(!empty($this->getInput('category'))) { - $uri .= 'pc-browser/'.$this->getInput('category')."/"; + $category=$this->getInput('category'); + if(!empty($category)) { + $uri .= 'pc-browser/'.$category."/"; } return $uri; } diff --git a/bridges/ZoneTelechargementBridge.php b/bridges/ZoneTelechargementBridge.php index 4a0bf03..200ce04 100644 --- a/bridges/ZoneTelechargementBridge.php +++ b/bridges/ZoneTelechargementBridge.php @@ -18,11 +18,7 @@ class ZoneTelechargementBridge extends BridgeAbstract { return $string; } - $category = '/'; - if (!empty($this->getInput('category'))) - $category = '/'.$this->getInput('category').'/'; - - $url = $this->getURI().$category.'rss.xml'; + $url = $this->getURI().$this->getInput('category').'rss.xml'; $html = $this->getSimpleHTMLDOM($url) or $this->returnServerError('Could not request Zone Telechargement: '.$url); foreach($html->find('item') as $element) {