maintainer = "polopollo"; $this->name = "journaldugeek.com (FR)"; $this->uri = "http://www.journaldugeek.com/"; $this->description = "Returns the 5 newest posts from LeJournalDuGeek (full text)."; $this->update = '2016-08-17'; } private function LeJournalDuGeekStripCDATA($string) { $string = str_replace('', '', $string); return $string; } private function LeJournalDuGeekExtractContent($url) { $articleHTMLContent = $this->getSimpleHMLDOM($url); $text = $articleHTMLContent->find('div.post-content', 0)->innertext; foreach($articleHTMLContent->find('a.more') as $element) { if ($element->innertext == "Source") { $text = $text . '

Source : ' . $element->href . '

'; break; } } foreach($articleHTMLContent->find('iframe') as $element) { if (preg_match("/youtube/i", $element->src)) { $text = $text . '// An IFRAME to Youtube was included in the article: ' . $element->src . '
'; } } $text = preg_replace('#(.*?)#is', '', $text); $text = strip_tags($text, '



  • '); return $text; } public function collectData(array $param){ $rssFeed = $this->getSimpleHTMLDOM('http://www.journaldugeek.com/rss') or $this->returnServerError('Could not request http://www.journaldugeek.com/rss'); $limit = 0; foreach($rssFeed->find('item') as $element) { if($limit < 5) { $item = new \Item(); $item->title = $this->LeJournalDuGeekStripCDATA($element->find('title', 0)->innertext); $item->uri = $this->LeJournalDuGeekStripCDATA($element->find('guid', 0)->plaintext); $item->timestamp = strtotime($element->find('pubDate', 0)->plaintext); $item->content = $this->LeJournalDuGeekExtractContent($item->uri); $this->items[] = $item; $limit++; } } } public function getCacheDuration(){ return 1800; // 30min } }