forked from blallo/rss-bridge
[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:
parent
c642fca0d0
commit
948bd9ae31
7 changed files with 18 additions and 16 deletions
|
@ -37,7 +37,8 @@ class CNETBridge extends BridgeAbstract {
|
||||||
return $article_html;
|
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);
|
$html = $this->getSimpleHTMLDOM($pageUrl) or $this->returnServerError('Could not request CNET: '.$pageUrl);
|
||||||
$limit = 0;
|
$limit = 0;
|
||||||
|
|
||||||
|
@ -69,7 +70,8 @@ class CNETBridge extends BridgeAbstract {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName() {
|
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() {
|
public function getCacheDuration() {
|
||||||
|
|
|
@ -18,8 +18,9 @@ class CryptomeBridge extends BridgeAbstract{
|
||||||
public function collectData(){
|
public function collectData(){
|
||||||
$html = $this->getSimpleHTMLDOM($this->uri)
|
$html = $this->getSimpleHTMLDOM($this->uri)
|
||||||
or $this->returnServerError('Could not request Cryptome.');
|
or $this->returnServerError('Could not request Cryptome.');
|
||||||
if (!empty($this->getInput('n'))) { /* number of documents */
|
$number=$this->getInput('n');
|
||||||
$num = min($this->getInput('n'), 20);
|
if (!empty($number)) { /* number of documents */
|
||||||
|
$num = min($number, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -41,8 +41,9 @@ class DauphineLibereBridge extends BridgeAbstract {
|
||||||
|
|
||||||
$context = stream_context_create($opts);
|
$context = stream_context_create($opts);
|
||||||
|
|
||||||
if (empty($this->getInput('u'))) {
|
$category=$this->getInput('u');
|
||||||
$html = $this->getSimpleHTMLDOM($this->uri.$this->getInput('u').'/rss')
|
if (empty($category)) {
|
||||||
|
$html = $this->getSimpleHTMLDOM($this->uri.$category.'/rss')
|
||||||
or $this->returnServerError('Could not request DauphineLibere.');
|
or $this->returnServerError('Could not request DauphineLibere.');
|
||||||
} else {
|
} else {
|
||||||
$html = $this->getSimpleHTMLDOM($this->uri.'rss')
|
$html = $this->getSimpleHTMLDOM($this->uri.'rss')
|
||||||
|
|
|
@ -35,8 +35,8 @@ class FourchanBridge extends BridgeAbstract{
|
||||||
$item['timestamp'] = $element->find('span.dateTime', 0)->getAttribute('data-utc');
|
$item['timestamp'] = $element->find('span.dateTime', 0)->getAttribute('data-utc');
|
||||||
$item['author'] = $element->find('span.name', 0)->plaintext;
|
$item['author'] = $element->find('span.name', 0)->plaintext;
|
||||||
|
|
||||||
|
$file=$element->find('.file', 0);
|
||||||
if(!empty($element->find('.file', 0) ) ) {
|
if(!empty($file) ) {
|
||||||
$item['image'] = $element->find('.file a', 0)->href;
|
$item['image'] = $element->find('.file a', 0)->href;
|
||||||
$item['imageThumb'] = $element->find('.file img', 0)->src;
|
$item['imageThumb'] = $element->find('.file img', 0)->src;
|
||||||
if(!isset($item['imageThumb']) and strpos($item['image'], '.swf') !== FALSE)
|
if(!isset($item['imageThumb']) and strpos($item['image'], '.swf') !== FALSE)
|
||||||
|
|
|
@ -63,7 +63,8 @@ class WallpaperStopBridge extends BridgeAbstract {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
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(){
|
public function getCacheDuration(){
|
||||||
|
|
|
@ -31,8 +31,9 @@ class WorldOfTanksBridge extends HttpCachingBridgeAbstract{
|
||||||
function getURI(){
|
function getURI(){
|
||||||
$lang = $this->getInput('lang');
|
$lang = $this->getInput('lang');
|
||||||
$uri = $this->uri.$lang.'/news/';
|
$uri = $this->uri.$lang.'/news/';
|
||||||
if(!empty($this->getInput('category'))) {
|
$category=$this->getInput('category');
|
||||||
$uri .= 'pc-browser/'.$this->getInput('category')."/";
|
if(!empty($category)) {
|
||||||
|
$uri .= 'pc-browser/'.$category."/";
|
||||||
}
|
}
|
||||||
return $uri;
|
return $uri;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,11 +18,7 @@ class ZoneTelechargementBridge extends BridgeAbstract {
|
||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
|
|
||||||
$category = '/';
|
$url = $this->getURI().$this->getInput('category').'rss.xml';
|
||||||
if (!empty($this->getInput('category')))
|
|
||||||
$category = '/'.$this->getInput('category').'/';
|
|
||||||
|
|
||||||
$url = $this->getURI().$category.'rss.xml';
|
|
||||||
$html = $this->getSimpleHTMLDOM($url) or $this->returnServerError('Could not request Zone Telechargement: '.$url);
|
$html = $this->getSimpleHTMLDOM($url) or $this->returnServerError('Could not request Zone Telechargement: '.$url);
|
||||||
|
|
||||||
foreach($html->find('item') as $element) {
|
foreach($html->find('item') as $element) {
|
||||||
|
|
Loading…
Reference in a new issue