From 2a02023c8a16a04aa3300dda391252f6c0cbb15d Mon Sep 17 00:00:00 2001 From: logmanoriginal Date: Wed, 3 Aug 2016 20:11:25 +0200 Subject: [PATCH 1/4] Change all nested functions to member functions This fixes error "Using $this when not in object context" Nested functions are not part of the object and therefore don't have access to the object instance $this! --- bridges/LeJournalDuGeekBridge.php | 59 +++++++++++++++---------------- 1 file changed, 29 insertions(+), 30 deletions(-) diff --git a/bridges/LeJournalDuGeekBridge.php b/bridges/LeJournalDuGeekBridge.php index 04de7a44..ad339239 100644 --- a/bridges/LeJournalDuGeekBridge.php +++ b/bridges/LeJournalDuGeekBridge.php @@ -7,47 +7,46 @@ class LeJournalDuGeekBridge extends BridgeAbstract{ $this->name = "journaldugeek.com (FR)"; $this->uri = "http://www.journaldugeek.com/"; $this->description = "Returns the 5 newest posts from LeJournalDuGeek (full text)."; - $this->update = "2014-07-14"; + $this->update = "2016-08-03"; } + function LeJournalDuGeekStripCDATA($string) { + $string = str_replace('', '', $string); + return $string; + } + + function LeJournalDuGeekExtractContent($url) { + $articleHTMLContent = $this->file_get_html($url); + $text = $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 = strip_tags($text, '