From 80651273b3cc841d5a3776e14a82884f1971a93b Mon Sep 17 00:00:00 2001 From: ORelio Date: Tue, 26 Jul 2016 21:19:39 +0200 Subject: [PATCH] [ZDNet] Auto-insert image --- bridges/ZDNetBridge.php | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/bridges/ZDNetBridge.php b/bridges/ZDNetBridge.php index 4267b983..79924aa0 100644 --- a/bridges/ZDNetBridge.php +++ b/bridges/ZDNetBridge.php @@ -6,8 +6,8 @@ class ZDNetBridge extends BridgeAbstract { $this->maintainer = 'ORelio'; $this->name = $this->getName(); $this->uri = $this->getURI(); - $this->description = 'Returns the newest articles.'; - $this->update = '2016-07-18'; + $this->description = 'Technology News, Analysis, Comments and Product Reviews for IT Professionals.'; + $this->update = '2016-07-20'; $this->parameters[] = // http://www.zdnet.com/zdnet.opml @@ -261,7 +261,7 @@ class ZDNetBridge extends BridgeAbstract { $thumbnail = $article->find('meta[itemprop=image]', 0); if (is_object($thumbnail)) $thumbnail = $thumbnail->content; - else $thumbnail = 'http://zdnet1.cbsistatic.com/fly/bundles/zdnetcss/images/logos/logo-192x192.png'; + else $thumbnail = ''; $contents = $article->find('article', 0)->innertext; foreach (array( @@ -277,8 +277,17 @@ class ZDNetBridge extends BridgeAbstract { } $contents = StripWithDelimiters($contents, ''); $contents = StripWithDelimiters($contents, ''); - $contents = StripWithDelimiters($contents, '
')); + $content_img = strpos($contents, '

'; //Include thumbnail + $contents = $content_img + .'

'.$article_subtitle.'

' + .$contents; + + if ($thumbnail == '') + $thumbnail = 'http://zdnet1.cbsistatic.com/fly/bundles/zdnetcss/images/logos/logo-192x192.png'; $item = new \Item(); $item->author = $author; @@ -303,6 +312,6 @@ class ZDNetBridge extends BridgeAbstract { } public function getCacheDuration() { - return 3600; + return 3600; //1 hour } -} \ No newline at end of file +}