[bridges] fix invalid use of empty() for php < 5.5

Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
This commit is contained in:
Pierre Mazière 2016-09-01 22:53:01 +02:00
parent c642fca0d0
commit 948bd9ae31
7 changed files with 18 additions and 16 deletions

View file

@ -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() {

View file

@ -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);
}

View file

@ -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')

View file

@ -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)

View file

@ -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(){

View file

@ -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;
}

View file

@ -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) {