From 1f3361c6b40f60e512bac7b108c0add5082d9b1c Mon Sep 17 00:00:00 2001 From: logmanoriginal Date: Mon, 22 Aug 2016 18:54:36 +0200 Subject: [PATCH 1/5] [formats] Change item to associative array Previously the item class was used to dump literaly any data into an object. The same can be archived by using an array with named keys (associative array). Technically it makes more sense to use an array as we want to be able to store any parameter into our item. --- formats/AtomFormat.php | 10 +++++----- formats/HtmlFormat.php | 10 +++++----- formats/MrssFormat.php | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/formats/AtomFormat.php b/formats/AtomFormat.php index 06ef8eb..7ec7d50 100644 --- a/formats/AtomFormat.php +++ b/formats/AtomFormat.php @@ -23,11 +23,11 @@ class AtomFormat extends FormatAbstract{ $entries = ''; foreach($this->getDatas() as $data){ - $entryAuthor = is_null($data->author) ? '' : $this->xml_encode($data->author); - $entryTitle = is_null($data->title) ? '' : $this->xml_encode($data->title); - $entryUri = is_null($data->uri) ? '' : $this->xml_encode($data->uri); - $entryTimestamp = is_null($data->timestamp) ? '' : $this->xml_encode(date(DATE_ATOM, $data->timestamp)); - $entryContent = is_null($data->content) ? '' : $this->xml_encode($this->sanitizeHtml($data->content)); + $entryAuthor = is_null($data['author']) ? '' : $this->xml_encode($data['author']); + $entryTitle = is_null($data['title']) ? '' : $this->xml_encode($data['title']); + $entryUri = is_null($data['uri']) ? '' : $this->xml_encode($data['uri']); + $entryTimestamp = is_null($data['timestamp']) ? '' : $this->xml_encode(date(DATE_ATOM, $data['timestamp'])); + $entryContent = is_null($data['content']) ? '' : $this->xml_encode($this->sanitizeHtml($data['content'])); $entries .= << diff --git a/formats/HtmlFormat.php b/formats/HtmlFormat.php index 19b7702..211a137 100644 --- a/formats/HtmlFormat.php +++ b/formats/HtmlFormat.php @@ -17,11 +17,11 @@ class HtmlFormat extends FormatAbstract{ $entries = ''; foreach($this->getDatas() as $data){ - $entryAuthor = is_null($data->author) ? '' : '

by: ' . $data->author . '

'; - $entryTitle = is_null($data->title) ? '' : $this->sanitizeHtml(strip_tags($data->title)); - $entryUri = is_null($data->uri) ? $uri : $data->uri; - $entryTimestamp = is_null($data->timestamp) ? '' : ''; - $entryContent = is_null($data->content) ? '' : '
' . $this->sanitizeHtml($data->content). '
'; + $entryAuthor = isset($data['author']) ? '

by: ' . $data['author'] . '

' : ''; + $entryTitle = isset($data['title']) ? $this->sanitizeHtml(strip_tags($data['title'])) : ''; + $entryUri = isset($data['uri']) ? $data['uri'] : $uri; + $entryTimestamp = isset($data['timestamp']) ? '' : ''; + $entryContent = isset($data['content']) ? '
' . $this->sanitizeHtml($data['content']). '
' : ''; $entries .= << diff --git a/formats/MrssFormat.php b/formats/MrssFormat.php index 46012e9..7d939f3 100644 --- a/formats/MrssFormat.php +++ b/formats/MrssFormat.php @@ -21,11 +21,11 @@ class MrssFormat extends FormatAbstract{ $items = ''; foreach($this->getDatas() as $data){ - $itemAuthor = is_null($data->author) ? '' : $this->xml_encode($data->author); - $itemTitle = strip_tags(is_null($data->title) ? '' : $this->xml_encode($data->title)); - $itemUri = is_null($data->uri) ? '' : $this->xml_encode($data->uri); - $itemTimestamp = is_null($data->timestamp) ? '' : $this->xml_encode(date(DATE_RFC2822, $data->timestamp)); - $itemContent = is_null($data->content) ? '' : $this->xml_encode($this->sanitizeHtml($data->content)); + $itemAuthor = is_null($data['author']) ? '' : $this->xml_encode($data['author']); + $itemTitle = strip_tags(is_null($data['title']) ? '' : $this->xml_encode($data['title'])); + $itemUri = is_null($data['uri']) ? '' : $this->xml_encode($data['uri']); + $itemTimestamp = is_null($data['timestamp']) ? '' : $this->xml_encode(date(DATE_RFC2822, $data['timestamp'])); + $itemContent = is_null($data['content']) ? '' : $this->xml_encode($this->sanitizeHtml($data['content'])); $items .= << From bf0a9d754e971aae9e8ab48d3d1bd0ef7839696b Mon Sep 17 00:00:00 2001 From: logmanoriginal Date: Mon, 22 Aug 2016 18:55:59 +0200 Subject: [PATCH 2/5] [bridges] Change all occurrences of the Item object to array --- bridges/ABCTabsBridge.php | 12 +++---- bridges/AcrimedBridge.php | 10 +++--- bridges/AllocineFRBridge.php | 8 ++--- bridges/AnimeUltimeBridge.php | 12 +++---- bridges/ArstechnicaBridge.php | 14 ++++---- bridges/Arte7Bridge.php | 16 ++++----- bridges/AskfmBridge.php | 10 +++--- bridges/BandcampBridge.php | 12 +++---- bridges/BastaBridge.php | 10 +++--- bridges/BlaguesDeMerdeBridge.php | 12 +++---- bridges/BooruprojectBridge.php | 14 ++++---- bridges/CADBridge.php | 12 +++---- bridges/CNETBridge.php | 12 +++---- bridges/CastorusBridge.php | 14 ++++---- bridges/CollegeDeFranceBridge.php | 10 +++--- bridges/CommonDreamsBridge.php | 10 +++--- bridges/CopieDoubleBridge.php | 8 ++--- bridges/CourrierInternationalBridge.php | 16 ++++----- bridges/CpasbienBridge.php | 16 ++++----- bridges/CryptomeBridge.php | 8 ++--- bridges/DailymotionBridge.php | 14 ++++---- bridges/DanbooruBridge.php | 14 ++++---- bridges/DansTonChatBridge.php | 8 ++--- bridges/DauphineLibereBridge.php | 10 +++--- bridges/DemoBridge.php | 12 +++---- bridges/DeveloppezDotComBridge.php | 12 +++---- bridges/DilbertBridge.php | 12 +++---- bridges/DollbooruBridge.php | 14 ++++---- bridges/DuckDuckGoBridge.php | 8 ++--- bridges/EZTVBridge.php | 14 ++++---- bridges/EliteDangerousGalnetBridge.php | 10 +++--- bridges/ElsevierBridge.php | 12 +++---- bridges/EstCeQuonMetEnProdBridge.php | 12 +++---- bridges/FacebookBridge.php | 12 +++---- bridges/FierPandaBridge.php | 8 ++--- bridges/FlickrExploreBridge.php | 8 ++--- bridges/FlickrTagBridge.php | 8 ++--- bridges/FootitoBridge.php | 10 +++--- bridges/FourchanBridge.php | 24 ++++++------- bridges/Freenews.php | 20 +++++------ bridges/FuturaSciencesBridge.php | 12 +++---- bridges/GBAtempBridge.php | 12 +++---- bridges/Gawker.php | 24 ++++++------- bridges/GelbooruBridge.php | 14 ++++---- bridges/GiphyBridge.php | 16 ++++----- bridges/GithubIssueBridge.php | 12 +++---- bridges/GitlabCommitsBridge.php | 16 ++++----- bridges/GizmodoFRBridge.php | 10 +++--- bridges/GooglePlusPostBridge.php | 30 ++++++++-------- bridges/GoogleSearchBridge.php | 10 +++--- bridges/GuruMedBridge.php | 10 +++--- bridges/HDWallpapersBridge.php | 10 +++--- bridges/HentaiHavenBridge.php | 10 +++--- bridges/IdenticaBridge.php | 10 +++--- bridges/InstagramBridge.php | 12 +++---- bridges/IsoHuntBridge.php | 48 ++++++++++++------------- bridges/JapanExpoBridge.php | 10 +++--- bridges/KonachanBridge.php | 14 ++++---- bridges/KoreusBridge.php | 10 +++--- bridges/KununuBridge.php | 14 ++++---- bridges/LWNprevBridge.php | 22 ++++++------ bridges/LeBonCoinBridge.php | 8 ++--- bridges/LeJournalDuGeekBridge.php | 10 +++--- bridges/LeMondeInformatiqueBridge.php | 12 +++---- bridges/Les400Culs.php | 18 +++++----- bridges/LesJoiesDuCodeBridge.php | 10 +++--- bridges/LichessBridge.php | 12 +++---- bridges/LinkedInCompany.php | 8 ++--- bridges/LolibooruBridge.php | 14 ++++---- bridges/MangareaderBridge.php | 40 ++++++++++----------- bridges/MilbooruBridge.php | 14 ++++---- bridges/MondeDiploBridge.php | 8 ++--- bridges/MsnMondeBridge.php | 12 +++---- bridges/MspabooruBridge.php | 14 ++++---- bridges/NakedSecurityBridge.php | 12 +++---- bridges/NasaApodBridge.php | 10 +++--- bridges/NeuviemeArtBridge.php | 12 +++---- bridges/NextInpactBridge.php | 12 +++---- bridges/NextgovBridge.php | 12 +++---- bridges/NiceMatinBridge.php | 10 +++--- bridges/NovelUpdatesBridge.php | 12 +++---- bridges/NumeramaBridge.php | 12 +++---- bridges/OpenClassroomsBridge.php | 8 ++--- bridges/ParuVenduImmoBridge.php | 8 ++--- bridges/PickyWallpapersBridge.php | 10 +++--- bridges/PinterestBridge.php | 20 +++++------ bridges/PlanetLibreBridge.php | 10 +++--- bridges/ProjectMGameBridge.php | 10 +++--- bridges/RTBFBridge.php | 12 +++---- bridges/Releases3DSBridge.php | 12 +++---- bridges/ReporterreBridge.php | 10 +++--- bridges/Rue89Bridge.php | 12 +++---- bridges/Rule34Bridge.php | 14 ++++---- bridges/Rule34pahealBridge.php | 14 ++++---- bridges/SafebooruBridge.php | 14 ++++---- bridges/SakugabooruBridge.php | 14 ++++---- bridges/ScmbBridge.php | 10 +++--- bridges/ScoopItBridge.php | 8 ++--- bridges/SensCritiqueBridge.php | 12 +++---- bridges/Sexactu.php | 12 +++---- bridges/ShanaprojectBridge.php | 12 +++---- bridges/SiliconBridge.php | 12 +++---- bridges/SoundcloudBridge.php | 12 +++---- bridges/StripeAPIChangeLogBridge.php | 10 +++--- bridges/SuperbWallpapersBridge.php | 10 +++--- bridges/T411Bridge.php | 12 +++---- bridges/TagBoardBridge.php | 10 +++--- bridges/TbibBridge.php | 14 ++++---- bridges/TheCodingLoveBridge.php | 10 +++--- bridges/TheHackerNewsBridge.php | 12 +++---- bridges/TheOatMealBridge.php | 18 +++++----- bridges/ThePirateBayBridge.php | 18 +++++----- bridges/TwitchApiBridge.php | 12 +++---- bridges/TwitterBridge.php | 22 ++++++------ bridges/UnsplashBridge.php | 10 +++--- bridges/ViadeoCompany.php | 8 ++--- bridges/VineBridge.php | 10 +++--- bridges/VkBridge.php | 14 ++++---- bridges/WallpaperStopBridge.php | 12 +++---- bridges/WeLiveSecurityBridge.php | 12 +++---- bridges/WhydBridge.php | 12 +++---- bridges/WikipediaBridge.php | 20 +++++------ bridges/WordPressBridge.php | 32 ++++++++--------- bridges/WorldOfTanks.php | 14 ++++---- bridges/XbooruBridge.php | 14 ++++---- bridges/YandereBridge.php | 14 ++++---- bridges/YoutubeBridge.php | 14 ++++---- bridges/ZDNetBridge.php | 12 +++---- bridges/ZatazBridge.php | 10 +++--- bridges/ZoneTelechargementBridge.php | 10 +++--- 130 files changed, 844 insertions(+), 844 deletions(-) diff --git a/bridges/ABCTabsBridge.php b/bridges/ABCTabsBridge.php index 1dbe77f..8926102 100644 --- a/bridges/ABCTabsBridge.php +++ b/bridges/ABCTabsBridge.php @@ -19,12 +19,12 @@ class ABCTabsBridge extends BridgeAbstract{ foreach ($table->find('tr') as $tab) { - $item = new \Item(); - $item->author = $tab->find('td', 1)->plaintext . ' - ' . $tab->find('td', 2)->plaintext; - $item->title = $tab->find('td', 1)->plaintext . ' - ' . $tab->find('td', 2)->plaintext; - $item->content = 'Le ' . $tab->find('td', 0)->plaintext . '
Par: ' . $tab->find('td', 5)->plaintext . '
Type: ' . $tab->find('td', 3)->plaintext; - $item->id = 'http://www.abc-tabs.com' . $tab->find('td', 2)->find('a', 0)->getAttribute('href'); - $item->uri = 'http://www.abc-tabs.com' . $tab->find('td', 2)->find('a', 0)->getAttribute('href'); + $item = array(); + $item['author'] = $tab->find('td', 1)->plaintext . ' - ' . $tab->find('td', 2)->plaintext; + $item['title'] = $tab->find('td', 1)->plaintext . ' - ' . $tab->find('td', 2)->plaintext; + $item['content'] = 'Le ' . $tab->find('td', 0)->plaintext . '
Par: ' . $tab->find('td', 5)->plaintext . '
Type: ' . $tab->find('td', 3)->plaintext; + $item['id'] = 'http://www.abc-tabs.com' . $tab->find('td', 2)->find('a', 0)->getAttribute('href'); + $item['uri'] = 'http://www.abc-tabs.com' . $tab->find('td', 2)->find('a', 0)->getAttribute('href'); $this->items[] = $item; } } diff --git a/bridges/AcrimedBridge.php b/bridges/AcrimedBridge.php index a347ed3..6446dc3 100644 --- a/bridges/AcrimedBridge.php +++ b/bridges/AcrimedBridge.php @@ -23,16 +23,16 @@ class AcrimedBridge extends RssExpander{ $namespaces = $newsItem->getNameSpaces(true); $dc = $newsItem->children($namespaces['dc']); - $item = new Item(); - $item->uri = trim($newsItem->link); - $item->title = trim($newsItem->title); - $item->timestamp = strtotime($dc->date); + $item = array(); + $item['uri'] = trim($newsItem->link); + $item['title'] = trim($newsItem->title); + $item['timestamp'] = strtotime($dc->date); $articlePage = $this->getSimpleHTMLDOM($newsItem->link); $article = $hs->sanitize($articlePage->find('article.article1', 0)->innertext); $article = HTMLSanitizer::defaultImageSrcTo($article, "http://www.acrimed.org/"); - $item->content = $article; + $item['content'] = $article; return $item; diff --git a/bridges/AllocineFRBridge.php b/bridges/AllocineFRBridge.php index 9799a70..b1a2027 100644 --- a/bridges/AllocineFRBridge.php +++ b/bridges/AllocineFRBridge.php @@ -55,7 +55,7 @@ class AllocineFRBridge extends BridgeAbstract{ foreach($html->find('figure.media-meta-fig') as $element) { - $item = new Item(); + $item = array(); $title = $element->find('div.titlebar h3.title a', 0); $content = trim($element->innertext); @@ -67,9 +67,9 @@ class AllocineFRBridge extends BridgeAbstract{ $content = str_replace('href="/', 'href="http://www.allocine.fr/', $content); $content = str_replace('src=\'/', 'src=\'http://www.allocine.fr/', $content); $content = str_replace('href=\'/', 'href=\'http://www.allocine.fr/', $content); - $item->content = $content; - $item->title = trim($title->innertext); - $item->uri = "http://www.allocine.fr" . $title->href; + $item['content'] = $content; + $item['title'] = trim($title->innertext); + $item['uri'] = "http://www.allocine.fr" . $title->href; $this->items[] = $item; } } diff --git a/bridges/AnimeUltimeBridge.php b/bridges/AnimeUltimeBridge.php index 5c25a7d..8289165 100644 --- a/bridges/AnimeUltimeBridge.php +++ b/bridges/AnimeUltimeBridge.php @@ -83,12 +83,12 @@ class AnimeUltimeBridge extends BridgeAbstract { $item_description = utf8_encode($item_description); //Build and add final item - $item = new \Item(); - $item->uri = $item_uri; - $item->title = $item_name.' '.$item_type.' '.$item_episode; - $item->author = $item_fansub; - $item->timestamp = $item_date; - $item->content = $item_description; + $item = array(); + $item['uri'] = $item_uri; + $item['title'] = $item_name.' '.$item_type.' '.$item_episode; + $item['author'] = $item_fansub; + $item['timestamp'] = $item_date; + $item['content'] = $item_description; $this->items[] = $item; $processedOK++; diff --git a/bridges/ArstechnicaBridge.php b/bridges/ArstechnicaBridge.php index c3f7244..95ad678 100644 --- a/bridges/ArstechnicaBridge.php +++ b/bridges/ArstechnicaBridge.php @@ -49,13 +49,13 @@ class ArstechnicaBridge extends BridgeAbstract { foreach($html->find('item') as $element) { if($limit < 5) { - $item = new \Item(); - $item->title = $this->StripCDATA($element->find('title', 0)->innertext); - $item->uri = $this->StripCDATA($element->find('guid', 0)->plaintext); - $item->author = $this->StripCDATA($element->find('author', 0)->innertext); - $item->timestamp = strtotime($element->find('pubDate', 0)->plaintext); - $item->content = $this->ExtractContent($item->uri); - //$item->content = $item->uri; + $item = array(); + $item['title'] = $this->StripCDATA($element->find('title', 0)->innertext); + $item['uri'] = $this->StripCDATA($element->find('guid', 0)->plaintext); + $item['author'] = $this->StripCDATA($element->find('author', 0)->innertext); + $item['timestamp'] = strtotime($element->find('pubDate', 0)->plaintext); + $item['content'] = $this->ExtractContent($item['uri']); + //$item['content'] = $item['uri']; $this->items[] = $item; $limit++; } diff --git a/bridges/Arte7Bridge.php b/bridges/Arte7Bridge.php index 6714dfd..35df0a2 100644 --- a/bridges/Arte7Bridge.php +++ b/bridges/Arte7Bridge.php @@ -76,18 +76,18 @@ class Arte7Bridge extends BridgeAbstract{ $input_json = extractVideoset($category, $lang); foreach($input_json['videos'] as $element) { - $item = new \Item(); - $item->uri = str_replace("autoplay=1", "", $element['url']); - $item->id = $element['id']; + $item = array(); + $item['uri'] = str_replace("autoplay=1", "", $element['url']); + $item['id'] = $element['id']; $hack_broadcast_time = $element['rights_end']; $hack_broadcast_time = strtok($hack_broadcast_time, 'T'); $hack_broadcast_time = strtok('T'); - $item->timestamp = strtotime($element['scheduled_on'].'T'.$hack_broadcast_time); - $item->title = $element['title']; + $item['timestamp'] = strtotime($element['scheduled_on'].'T'.$hack_broadcast_time); + $item['title'] = $element['title']; if (!empty($element['subtitle'])) - $item->title = $element['title'].' | '.$element['subtitle']; - $item->duration = round((int)$element['duration']/60); - $item->content = $element['teaser'].'

'.$item->duration.'min
'; + $item['title'] = $element['title'].' | '.$element['subtitle']; + $item['duration'] = round((int)$element['duration']/60); + $item['content'] = $element['teaser'].'

'.$item['duration'].'min
'; $this->items[] = $item; } } diff --git a/bridges/AskfmBridge.php b/bridges/AskfmBridge.php index d69e366..6ad7466 100644 --- a/bridges/AskfmBridge.php +++ b/bridges/AskfmBridge.php @@ -26,12 +26,12 @@ class AskfmBridge extends BridgeAbstract{ } foreach($html->find('div.streamItem-answer') as $element) { - $item = new \Item(); - $item->uri = 'http://ask.fm'.$element->find('a.streamItemsAge',0)->href; + $item = array(); + $item['uri'] = 'http://ask.fm'.$element->find('a.streamItemsAge',0)->href; $question = trim($element->find('h1.streamItemContent-question',0)->innertext); - $item->title = trim(htmlspecialchars_decode($element->find('h1.streamItemContent-question',0)->plaintext, ENT_QUOTES)); + $item['title'] = trim(htmlspecialchars_decode($element->find('h1.streamItemContent-question',0)->plaintext, ENT_QUOTES)); $answer = trim($element->find('p.streamItemContent-answer',0)->innertext); - #$item->update = $element->find('a.streamitemsage',0)->data-hint; // Doesn't work, DOM parser doesn't seem to like data-hint, dunno why + #$item['update'] = $element->find('a.streamitemsage',0)->data-hint; // Doesn't work, DOM parser doesn't seem to like data-hint, dunno why $visual = $element->find('div.streamItemContent-visual',0)->innertext; // This probably should be cleaned up, especially for YouTube embeds //Fix tracking links, also doesn't work foreach($element->find('a') as $link) { @@ -43,7 +43,7 @@ class AskfmBridge extends BridgeAbstract{ $content = '

' . $question . '

' . $answer . '

' . $visual . '

'; // Fix relative links without breaking // scheme used by YouTube stuff $content = preg_replace('#href="\/(?!\/)#', 'href="http://ask.fm/',$content); - $item->content = $content; + $item['content'] = $content; $this->items[] = $item; } } diff --git a/bridges/BandcampBridge.php b/bridges/BandcampBridge.php index 9d9bf60..87a6918 100644 --- a/bridges/BandcampBridge.php +++ b/bridges/BandcampBridge.php @@ -33,12 +33,12 @@ class BandcampBridge extends BridgeAbstract{ $uri = ltrim($script, "return 'url("); $uri = rtrim($uri, "')"); - $item = new \Item(); - $item->author = $release->find('div.itemsubtext',0)->plaintext . ' - ' . $release->find('div.itemtext',0)->plaintext; - $item->title = $release->find('div.itemsubtext',0)->plaintext . ' - ' . $release->find('div.itemtext',0)->plaintext; - $item->content = '
' . $release->find('div.itemsubtext',0)->plaintext . ' - ' . $release->find('div.itemtext',0)->plaintext; - $item->id = $release->find('a',0)->getAttribute('href'); - $item->uri = $release->find('a',0)->getAttribute('href'); + $item = array(); + $item['author'] = $release->find('div.itemsubtext',0)->plaintext . ' - ' . $release->find('div.itemtext',0)->plaintext; + $item['title'] = $release->find('div.itemsubtext',0)->plaintext . ' - ' . $release->find('div.itemtext',0)->plaintext; + $item['content'] = '
' . $release->find('div.itemsubtext',0)->plaintext . ' - ' . $release->find('div.itemtext',0)->plaintext; + $item['id'] = $release->find('a',0)->getAttribute('href'); + $item['uri'] = $release->find('a',0)->getAttribute('href'); $this->items[] = $item; } } diff --git a/bridges/BastaBridge.php b/bridges/BastaBridge.php index 84d5b42..32758c1 100644 --- a/bridges/BastaBridge.php +++ b/bridges/BastaBridge.php @@ -18,11 +18,11 @@ class BastaBridge extends BridgeAbstract{ foreach($html->find('item') as $element) { if($limit < 10) { - $item = new \Item(); - $item->title = $element->find('title', 0)->innertext; - $item->uri = $element->find('guid', 0)->plaintext; - $item->timestamp = strtotime($element->find('dc:date', 0)->plaintext); - $item->content = ReplaceImageUrl($this->getSimpleHTMLDOM($item->uri)->find('div.texte', 0)->innertext); + $item = array(); + $item['title'] = $element->find('title', 0)->innertext; + $item['uri'] = $element->find('guid', 0)->plaintext; + $item['timestamp'] = strtotime($element->find('dc:date', 0)->plaintext); + $item['content'] = ReplaceImageUrl($this->getSimpleHTMLDOM($item['uri'])->find('div.texte', 0)->innertext); $this->items[] = $item; $limit++; } diff --git a/bridges/BlaguesDeMerdeBridge.php b/bridges/BlaguesDeMerdeBridge.php index 8e6ef5e..c137201 100644 --- a/bridges/BlaguesDeMerdeBridge.php +++ b/bridges/BlaguesDeMerdeBridge.php @@ -14,18 +14,18 @@ class BlaguesDeMerdeBridge extends BridgeAbstract{ $html = $this->getSimpleHTMLDOM('http://www.blaguesdemerde.fr/') or $this->returnServerError('Could not request BDM.'); foreach($html->find('article.joke_contener') as $element) { - $item = new Item(); + $item = array(); $temp = $element->find('a'); if(isset($temp[2])) { - $item->content = trim($element->find('div.joke_text_contener', 0)->innertext); + $item['content'] = trim($element->find('div.joke_text_contener', 0)->innertext); $uri = $temp[2]->href; - $item->uri = $uri; - $item->title = substr($uri, (strrpos($uri, "/") + 1)); + $item['uri'] = $uri; + $item['title'] = substr($uri, (strrpos($uri, "/") + 1)); $date = $element->find("li.bdm_date",0)->innertext; $time = mktime(0, 0, 0, substr($date, 3, 2), substr($date, 0, 2), substr($date, 6, 4)); - $item->timestamp = $time; - $item->author = $element->find("li.bdm_pseudo",0)->innertext;; + $item['timestamp'] = $time; + $item['author'] = $element->find("li.bdm_pseudo",0)->innertext;; $this->items[] = $item; } } diff --git a/bridges/BooruprojectBridge.php b/bridges/BooruprojectBridge.php index 39ed3f7..972ab7b 100644 --- a/bridges/BooruprojectBridge.php +++ b/bridges/BooruprojectBridge.php @@ -36,13 +36,13 @@ class BooruprojectBridge extends BridgeAbstract{ foreach($html->find('div[class=content] span') as $element) { - $item = new \Item(); - $item->uri = 'http://'.$param['i'].'.booru.org/'.$element->find('a', 0)->href; - $item->postid = (int)preg_replace("/[^0-9]/",'', $element->find('a', 0)->getAttribute('id')); - $item->timestamp = time(); - $item->tags = $element->find('img', 0)->getAttribute('title'); - $item->title = 'Booruproject '.$param['i'].' | '.$item->postid; - $item->content = '
Tags: '.$item->tags; + $item = array(); + $item['uri'] = 'http://'.$param['i'].'.booru.org/'.$element->find('a', 0)->href; + $item['postid'] = (int)preg_replace("/[^0-9]/",'', $element->find('a', 0)->getAttribute('id')); + $item['timestamp'] = time(); + $item['tags'] = $element->find('img', 0)->getAttribute('title'); + $item['title'] = 'Booruproject '.$param['i'].' | '.$item['postid']; + $item['content'] = '
Tags: '.$item['tags']; $this->items[] = $item; } } diff --git a/bridges/CADBridge.php b/bridges/CADBridge.php index f839e19..d3d191e 100644 --- a/bridges/CADBridge.php +++ b/bridges/CADBridge.php @@ -48,12 +48,12 @@ class CADBridge extends BridgeAbstract{ foreach($html->find('item') as $element) { if($limit < 5) { - $item = new \Item(); - $item->title = $element->find('title', 0)->innertext; - $item->uri = CADUrl($element->find('description', 0)->innertext); - if ($item->uri != 'notanurl') { - $item->timestamp = strtotime($element->find('pubDate', 0)->plaintext); - $item->content = $this->CADExtractContent($item->uri); + $item = array(); + $item['title'] = $element->find('title', 0)->innertext; + $item['uri'] = CADUrl($element->find('description', 0)->innertext); + if ($item['uri'] != 'notanurl') { + $item['timestamp'] = strtotime($element->find('pubDate', 0)->plaintext); + $item['content'] = $this->CADExtractContent($item['uri']); $this->items[] = $item; $limit++; } diff --git a/bridges/CNETBridge.php b/bridges/CNETBridge.php index dee0a2a..623a9fd 100644 --- a/bridges/CNETBridge.php +++ b/bridges/CNETBridge.php @@ -63,12 +63,12 @@ class CNETBridge extends BridgeAbstract { $article_content = trim(CleanArticle(ExtractFromDelimiters($article_html, '
uri . '">' . $item->title . '

' + $item['title'] = $this->ExtractActivityTitle($activity); + $item['uri'] = $this->ExtractActivityUrl($activity); + $item['timestamp'] = $this->ExtractActivityTime($activity); + $item['content'] = '' . $item['title'] . '

' . $this->ExtractActivityPrice($activity) . '

'; - if(isset($zip_filter) && !(substr($item->title, 0, strlen($zip_filter)) === $zip_filter)){ + if(isset($zip_filter) && !(substr($item['title'], 0, strlen($zip_filter)) === $zip_filter)){ continue; // Skip this item } - if(isset($city_filter) && !(substr($item->title, strpos($item->title, ' ') + 1, strlen($city_filter)) === $city_filter)){ + if(isset($city_filter) && !(substr($item['title'], strpos($item['title'], ' ') + 1, strlen($city_filter)) === $city_filter)){ continue; // Skip this item } diff --git a/bridges/CollegeDeFranceBridge.php b/bridges/CollegeDeFranceBridge.php index ff97bd3..d9b7266 100644 --- a/bridges/CollegeDeFranceBridge.php +++ b/bridges/CollegeDeFranceBridge.php @@ -34,8 +34,8 @@ class CollegeDeFranceBridge extends BridgeAbstract{ */ $html = $this->getSimpleHTMLDOM('http://www.college-de-france.fr/components/search-audiovideo.jsp?fulltext=&siteid=1156951719600&lang=FR&type=all') or $this->returnServerError('Could not request CollegeDeFrance.'); foreach($html->find('a[data-target]') as $element) { - $item = new \Item(); - $item->title = $element->find('.title', 0)->plaintext; + $item = array(); + $item['title'] = $element->find('.title', 0)->plaintext; // Most relative URLs contains an hour in addition to the date, so let's use it // // @@ -46,9 +46,9 @@ class CollegeDeFranceBridge extends BridgeAbstract{ $timezone = new DateTimeZone('Europe/Paris'); // strpos($element->href, '201') will break in 2020 but it'll probably break prior to then due to site changes anyway $d = DateTime::createFromFormat('!Y-m-d-H\hi', substr($element->href, strpos($element->href, '201'), 16), $timezone) ?: DateTime::createFromFormat('!d m Y', trim(str_replace(array_values($months), array_keys($months), $element->find('.date', 0)->plaintext)), $timezone); - $item->timestamp = $d->format('U'); - $item->content = $element->find('.lecturer', 0)->innertext . ' - ' . $element->find('.title', 0)->innertext; - $item->uri = 'http://www.college-de-france.fr' . $element->href; + $item['timestamp'] = $d->format('U'); + $item['content'] = $element->find('.lecturer', 0)->innertext . ' - ' . $element->find('.title', 0)->innertext; + $item['uri'] = 'http://www.college-de-france.fr' . $element->href; $this->items[] = $item; } } diff --git a/bridges/CommonDreamsBridge.php b/bridges/CommonDreamsBridge.php index 95d6bc6..d10748c 100644 --- a/bridges/CommonDreamsBridge.php +++ b/bridges/CommonDreamsBridge.php @@ -28,11 +28,11 @@ class CommonDreamsBridge extends BridgeAbstract{ $limit = 0; foreach($html->find('item') as $element) { if($limit < 4) { - $item = new \Item(); - $item->title = $element->find('title', 0)->innertext; - $item->uri = CommonDreamsUrl($element->find('guid', 0)->innertext); - $item->timestamp = strtotime($element->find('pubDate', 0)->plaintext); - $item->content = $this->CommonDreamsExtractContent($item->uri); + $item = array(); + $item['title'] = $element->find('title', 0)->innertext; + $item['uri'] = CommonDreamsUrl($element->find('guid', 0)->innertext); + $item['timestamp'] = strtotime($element->find('pubDate', 0)->plaintext); + $item['content'] = $this->CommonDreamsExtractContent($item['uri']); $this->items[] = $item; $limit++; } diff --git a/bridges/CopieDoubleBridge.php b/bridges/CopieDoubleBridge.php index 49605b1..80fcd45 100644 --- a/bridges/CopieDoubleBridge.php +++ b/bridges/CopieDoubleBridge.php @@ -21,21 +21,21 @@ class CopieDoubleBridge extends BridgeAbstract{ $cpt++; if($td->class == "couleur_1") { - $item = new Item(); + $item = array(); $title = $td->innertext; $pos = strpos($title, "title = $title; + $item['title'] = $title; } elseif(strpos($element->innertext, "/images/suivant.gif") === false) { $a=$element->find("a", 0); - $item->uri = "http://www.copie-double.com" . $a->href; + $item['uri'] = "http://www.copie-double.com" . $a->href; $content = str_replace('src="/', 'src="http://www.copie-double.com/',$element->find("td", 0)->innertext); $content = str_replace('href="/', 'href="http://www.copie-double.com/',$content); - $item->content = $content; + $item['content'] = $content; $this->items[] = $item; } } diff --git a/bridges/CourrierInternationalBridge.php b/bridges/CourrierInternationalBridge.php index 9c92325..e921d81 100644 --- a/bridges/CourrierInternationalBridge.php +++ b/bridges/CourrierInternationalBridge.php @@ -24,24 +24,24 @@ class CourrierInternationalBridge extends BridgeAbstract{ foreach($element as $article) { - $item = new \Item(); + $item = array(); - $item->uri = $article->parent->getAttribute("href"); + $item['uri'] = $article->parent->getAttribute("href"); - if(strpos($item->uri, "http") === FALSE) { - $item->uri = "http://courrierinternational.fr/".$item->uri; + if(strpos($item['uri'], "http") === FALSE) { + $item['uri'] = "http://courrierinternational.fr/".$item['uri']; } - $page = $this->getSimpleHTMLDOM($item->uri); + $page = $this->getSimpleHTMLDOM($item['uri']); $cleaner = new HTMLSanitizer(); - $item->content = $cleaner->sanitize($page->find("div.article-text")[0]); - $item->title = strip_tags($article->find(".title")[0]); + $item['content'] = $cleaner->sanitize($page->find("div.article-text")[0]); + $item['title'] = strip_tags($article->find(".title")[0]); $dateTime = date_parse($page->find("time")[0]); - $item->timestamp = mktime( + $item['timestamp'] = mktime( $dateTime['hour'], $dateTime['minute'], $dateTime['second'], diff --git a/bridges/CpasbienBridge.php b/bridges/CpasbienBridge.php index 7772037..1f47045 100644 --- a/bridges/CpasbienBridge.php +++ b/bridges/CpasbienBridge.php @@ -53,20 +53,20 @@ class CpasbienBridge extends HttpCachingBridgeAbstract{ $htmlepisode=content_get_html($this->get_cached($episode->find('a', 0)->getAttribute('href'))); - $item = new \Item(); - $item->author = $episode->find('a', 0)->text(); - $item->title = $episode->find('a', 0)->text(); - $item->timestamp = $this->get_cached_time($episode->find('a', 0)->getAttribute('href')); + $item = array(); + $item['author'] = $episode->find('a', 0)->text(); + $item['title'] = $episode->find('a', 0)->text(); + $item['timestamp'] = $this->get_cached_time($episode->find('a', 0)->getAttribute('href')); $textefiche=$htmlepisode->find('#textefiche', 0)->find('p',1); if (isset($textefiche)) { - $item->content = $textefiche->text(); + $item['content'] = $textefiche->text(); } else { - $item->content = $htmlepisode->find('#textefiche', 0)->find('p',0)->text(); + $item['content'] = $htmlepisode->find('#textefiche', 0)->find('p',0)->text(); } - $item->id = $episode->find('a', 0)->getAttribute('href'); - $item->uri = $this->uri . $htmlepisode->find('#telecharger',0)->getAttribute('href'); + $item['id'] = $episode->find('a', 0)->getAttribute('href'); + $item['uri'] = $this->uri . $htmlepisode->find('#telecharger',0)->getAttribute('href'); $this->items[] = $item; } } diff --git a/bridges/CryptomeBridge.php b/bridges/CryptomeBridge.php index f998132..4f40d61 100644 --- a/bridges/CryptomeBridge.php +++ b/bridges/CryptomeBridge.php @@ -33,10 +33,10 @@ class CryptomeBridge extends BridgeAbstract{ foreach($html->find('pre') as $element) { for ( $i = 0; $i < $num; ++$i ) { - $item = new \Item(); - $item->uri = $link.substr($element->find('a', $i)->href, 20); - $item->title = substr($element->find('b', $i)->plaintext, 22); - $item->content = preg_replace('#http://cryptome.org/#', $link, $element->find('b', $i)->innertext); + $item = array(); + $item['uri'] = $link.substr($element->find('a', $i)->href, 20); + $item['title'] = substr($element->find('b', $i)->plaintext, 22); + $item['content'] = preg_replace('#http://cryptome.org/#', $link, $element->find('b', $i)->innertext); $this->items[] = $item; } break; diff --git a/bridges/DailymotionBridge.php b/bridges/DailymotionBridge.php index 351f56e..ead3763 100644 --- a/bridges/DailymotionBridge.php +++ b/bridges/DailymotionBridge.php @@ -63,13 +63,13 @@ class DailymotionBridge extends BridgeAbstract{ foreach($html->find('div.media a.preview_link') as $element) { if($count < $limit) { - $item = new \Item(); - $item->id = str_replace('/video/', '', strtok($element->href, '_')); - $metadata = $this->getMetadata($item->id); - $item->uri = $metadata['uri']; - $item->title = $metadata['title']; - $item->timestamp = $metadata['timestamp']; - $item->content = '
' . $item->title . ''; + $item = array(); + $item['id'] = str_replace('/video/', '', strtok($element->href, '_')); + $metadata = $this->getMetadata($item['id']); + $item['uri'] = $metadata['uri']; + $item['title'] = $metadata['title']; + $item['timestamp'] = $metadata['timestamp']; + $item['content'] = '
' . $item['title'] . ''; $this->items[] = $item; $count++; } diff --git a/bridges/DanbooruBridge.php b/bridges/DanbooruBridge.php index 997d963..7b451de 100644 --- a/bridges/DanbooruBridge.php +++ b/bridges/DanbooruBridge.php @@ -24,14 +24,14 @@ class DanbooruBridge extends BridgeAbstract{ } $html = $this->getSimpleHTMLDOM("http://donmai.us/posts?&page=$page&tags=$tags") or $this->returnServerError('Could not request Danbooru.'); foreach($html->find('div[id=posts] article') as $element) { - $item = new \Item(); - $item->uri = 'http://donmai.us'.$element->find('a', 0)->href; - $item->postid = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('data-id')); - $item->timestamp = time(); + $item = array(); + $item['uri'] = 'http://donmai.us'.$element->find('a', 0)->href; + $item['postid'] = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('data-id')); + $item['timestamp'] = time(); $thumbnailUri = 'http://donmai.us'.$element->find('img', 0)->src; - $item->tags = $element->find('img', 0)->getAttribute('alt'); - $item->title = 'Danbooru | '.$item->postid; - $item->content = '
Tags: '.$item->tags; + $item['tags'] = $element->find('img', 0)->getAttribute('alt'); + $item['title'] = 'Danbooru | '.$item['postid']; + $item['content'] = '
Tags: '.$item['tags']; $this->items[] = $item; } } diff --git a/bridges/DansTonChatBridge.php b/bridges/DansTonChatBridge.php index 5958c77..1492c19 100644 --- a/bridges/DansTonChatBridge.php +++ b/bridges/DansTonChatBridge.php @@ -17,10 +17,10 @@ class DansTonChatBridge extends BridgeAbstract{ $html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('Could not request DansTonChat.'); foreach($html->find('div.item') as $element) { - $item = new \Item(); - $item->uri = $element->find('a', 0)->href; - $item->title = 'DansTonChat '.$element->find('a', 1)->plaintext; - $item->content = $element->find('a', 0)->innertext; + $item = array(); + $item['uri'] = $element->find('a', 0)->href; + $item['title'] = 'DansTonChat '.$element->find('a', 1)->plaintext; + $item['content'] = $element->find('a', 0)->innertext; $this->items[] = $item; } } diff --git a/bridges/DauphineLibereBridge.php b/bridges/DauphineLibereBridge.php index 075879e..f765274 100644 --- a/bridges/DauphineLibereBridge.php +++ b/bridges/DauphineLibereBridge.php @@ -63,11 +63,11 @@ class DauphineLibereBridge extends BridgeAbstract { foreach($html->find('item') as $element) { if($limit < 10) { - $item = new \Item(); - $item->title = $element->find('title', 0)->innertext; - $item->uri = $element->find('guid', 0)->plaintext; - $item->timestamp = strtotime($element->find('pubDate', 0)->plaintext); - $item->content = $this->ExtractContent($item->uri, $context); + $item = array(); + $item['title'] = $element->find('title', 0)->innertext; + $item['uri'] = $element->find('guid', 0)->plaintext; + $item['timestamp'] = strtotime($element->find('pubDate', 0)->plaintext); + $item['content'] = $this->ExtractContent($item['uri'], $context); $this->items[] = $item; $limit++; } diff --git a/bridges/DemoBridge.php b/bridges/DemoBridge.php index 0ea65d0..6ffb80a 100644 --- a/bridges/DemoBridge.php +++ b/bridges/DemoBridge.php @@ -37,12 +37,12 @@ class DemoBridge extends BridgeAbstract{ public function collectData(array $param){ - $item = new \Item(); - $item->author = "Me!"; - $item->title = "Test"; - $item->content = "Awesome content !"; - $item->id = "Lalala"; - $item->uri = "http://test.test/test"; + $item = array(); + $item['author'] = "Me!"; + $item['title'] = "Test"; + $item['content'] = "Awesome content !"; + $item['id'] = "Lalala"; + $item['uri'] = "http://test.test/test"; $this->items[] = $item; diff --git a/bridges/DeveloppezDotComBridge.php b/bridges/DeveloppezDotComBridge.php index 61633cc..a4c2a52 100644 --- a/bridges/DeveloppezDotComBridge.php +++ b/bridges/DeveloppezDotComBridge.php @@ -46,12 +46,12 @@ class DeveloppezDotComBridge extends BridgeAbstract{ foreach($rssFeed->find('item') as $element) { if($limit < 10) { - $item = new \Item(); - $item->title = $this->DeveloppezDotComStripCDATA($element->find('title', 0)->innertext); - $item->uri = $this->DeveloppezDotComStripCDATA($element->find('guid', 0)->plaintext); - $item->timestamp = strtotime($element->find('pubDate', 0)->plaintext); - $content = $this->DeveloppezDotComExtractContent($item->uri); - $item->content = strlen($content) ? $content : $element->description; //In case of it is a tutorial, we just keep the original description + $item = array(); + $item['title'] = $this->DeveloppezDotComStripCDATA($element->find('title', 0)->innertext); + $item['uri'] = $this->DeveloppezDotComStripCDATA($element->find('guid', 0)->plaintext); + $item['timestamp'] = strtotime($element->find('pubDate', 0)->plaintext); + $content = $this->DeveloppezDotComExtractContent($item['uri']); + $item['content'] = strlen($content) ? $content : $element->description; //In case of it is a tutorial, we just keep the original description $this->items[] = $item; $limit++; } diff --git a/bridges/DilbertBridge.php b/bridges/DilbertBridge.php index 347eb72..426343c 100644 --- a/bridges/DilbertBridge.php +++ b/bridges/DilbertBridge.php @@ -26,12 +26,12 @@ class DilbertBridge extends BridgeAbstract { $title = 'Dilbert Comic Strip on '.$date; $date = strtotime($date); - $item = new \Item(); - $item->uri = $url; - $item->title = $title; - $item->author = 'Scott Adams'; - $item->timestamp = $date; - $item->content = ''.$img->alt.''; + $item = array(); + $item['uri'] = $url; + $item['title'] = $title; + $item['author'] = 'Scott Adams'; + $item['timestamp'] = $date; + $item['content'] = ''.$img->alt.''; $this->items[] = $item; } } diff --git a/bridges/DollbooruBridge.php b/bridges/DollbooruBridge.php index ca3ba74..865fbff 100644 --- a/bridges/DollbooruBridge.php +++ b/bridges/DollbooruBridge.php @@ -30,14 +30,14 @@ class DollbooruBridge extends BridgeAbstract{ foreach($html->find('div[class=shm-image-list] a') as $element) { - $item = new \Item(); - $item->uri = 'http://dollbooru.org'.$element->href; - $item->postid = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('data-post-id')); - $item->timestamp = time(); + $item = array(); + $item['uri'] = 'http://dollbooru.org'.$element->href; + $item['postid'] = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('data-post-id')); + $item['timestamp'] = time(); $thumbnailUri = 'http://dollbooru.org'.$element->find('img', 0)->src; - $item->tags = $element->getAttribute('data-tags'); - $item->title = 'Dollbooru | '.$item->postid; - $item->content = '
Tags: '.$item->tags; + $item['tags'] = $element->getAttribute('data-tags'); + $item['title'] = 'Dollbooru | '.$item['postid']; + $item['content'] = '
Tags: '.$item['tags']; $this->items[] = $item; } } diff --git a/bridges/DuckDuckGoBridge.php b/bridges/DuckDuckGoBridge.php index 7f5d2d4..3028202 100644 --- a/bridges/DuckDuckGoBridge.php +++ b/bridges/DuckDuckGoBridge.php @@ -22,10 +22,10 @@ class DuckDuckGoBridge extends BridgeAbstract{ $html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('Could not request DuckDuckGo.'); foreach($html->find('div.results_links') as $element) { - $item = new \Item(); - $item->uri = $element->find('a', 0)->href; - $item->title = $element->find('a', 1)->innertext; - $item->content = $element->find('div.snippet', 0)->plaintext; + $item = array(); + $item['uri'] = $element->find('a', 0)->href; + $item['title'] = $element->find('a', 1)->innertext; + $item['content'] = $element->find('div.snippet', 0)->plaintext; $this->items[] = $item; } } diff --git a/bridges/EZTVBridge.php b/bridges/EZTVBridge.php index 813e70f..847e70a 100644 --- a/bridges/EZTVBridge.php +++ b/bridges/EZTVBridge.php @@ -58,13 +58,13 @@ class EZTVBridge extends BridgeAbstract{ if ($released->plaintext == '>1 week') continue; // Fill item - $item = new \Item(); - $item->uri = 'https://eztv.ch/'.$epinfo->href; - $item->id = $item->uri; - $item->timestamp = makeTimestamp($released->plaintext); - $item->title = $epinfo->plaintext; - $item->content = $epinfo->alt; - if(!empty($item->title)) + $item = array(); + $item['uri'] = 'https://eztv.ch/'.$epinfo->href; + $item['id'] = $item['uri']; + $item['timestamp'] = makeTimestamp($released->plaintext); + $item['title'] = $epinfo->plaintext; + $item['content'] = $epinfo->alt; + if(isset($item['title'])) $this->items[] = $item; } } diff --git a/bridges/EliteDangerousGalnetBridge.php b/bridges/EliteDangerousGalnetBridge.php index 508301c..13dcf50 100644 --- a/bridges/EliteDangerousGalnetBridge.php +++ b/bridges/EliteDangerousGalnetBridge.php @@ -14,22 +14,22 @@ class EliteDangerousGalnetBridge extends BridgeAbstract { $html = $this->getSimpleHTMLDOM('https://community.elitedangerous.com/galnet') or $this->returnServerError('Error while downloading the website content'); foreach($html->find('div.article') as $element) { - $item = new Item(); + $item = array(); $uri = $element->find('h3 a', 0)->href; $uri = 'https://community.elitedangerous.com' . $uri; - $item->uri = $uri; + $item['uri'] = $uri; $title = $element->find('h3 a', 0)->plaintext; - $item->title = substr($title, 1); //remove the space between icon and title + $item['title'] = substr($title, 1); //remove the space between icon and title $content = $element->find('p', -1)->innertext; - $item->content = $content; + $item['content'] = $content; $date = $element->find('p.small', 0)->innertext; $article_year = substr($date, -4) - 1286; //Convert E:D date to actual date $date = substr($date, 0, -4) . $article_year; - $item->timestamp = strtotime($date); + $item['timestamp'] = strtotime($date); $this->items[] = $item; } diff --git a/bridges/ElsevierBridge.php b/bridges/ElsevierBridge.php index aa4b486..b336f4c 100644 --- a/bridges/ElsevierBridge.php +++ b/bridges/ElsevierBridge.php @@ -63,12 +63,12 @@ class ElsevierBridge extends BridgeAbstract{ $html = $this->getSimpleHTMLDOM($uri) or $this->returnServerError('No results for Elsevier journal '.$param['j']); foreach($html->find('.pod-listing') as $article){ - $item = new \Item(); - $item->uri = $article->find('.pod-listing-header>a',0)->getAttribute('href').'?np=y'; - $item->title = $article->find('.pod-listing-header>a',0)->plaintext; - $item->author = $this->ExtractArticleName($article); - $item->timestamp = $this->ExtractArticleTimestamp($article); - $item->content = $this->ExtractArticleContent($article); + $item = array(); + $item['uri'] = $article->find('.pod-listing-header>a',0)->getAttribute('href').'?np=y'; + $item['title'] = $article->find('.pod-listing-header>a',0)->plaintext; + $item['author'] = $this->ExtractArticleName($article); + $item['timestamp'] = $this->ExtractArticleTimestamp($article); + $item['content'] = $this->ExtractArticleContent($article); $this->items[] = $item; } } diff --git a/bridges/EstCeQuonMetEnProdBridge.php b/bridges/EstCeQuonMetEnProdBridge.php index 4bb9f1b..be1fe1a 100644 --- a/bridges/EstCeQuonMetEnProdBridge.php +++ b/bridges/EstCeQuonMetEnProdBridge.php @@ -19,12 +19,12 @@ class EstCeQuonMetEnProdBridge extends BridgeAbstract { $html = $this->getSimpleHTMLDOM($this->getURI()) or $this->returnServerError('Could not request EstCeQuonMetEnProd: '.$this->getURI()); - $item = new \Item(); - $item->uri = $this->getURI().'#'.date('Y-m-d'); - $item->title = $this->getName(); - $item->author = 'Nicolas Hoffmann'; - $item->timestamp = strtotime('today midnight'); - $item->content = str_replace('src="/', 'src="'.$this->getURI(), trim(ExtractFromDelimiters($html->outertext, '', '

'))); + $item = array(); + $item['uri'] = $this->getURI().'#'.date('Y-m-d'); + $item['title'] = $this->getName(); + $item['author'] = 'Nicolas Hoffmann'; + $item['timestamp'] = strtotime('today midnight'); + $item['content'] = str_replace('src="/', 'src="'.$this->getURI(), trim(ExtractFromDelimiters($html->outertext, '', '

'))); $this->items[] = $item; } diff --git a/bridges/FacebookBridge.php b/bridges/FacebookBridge.php index da40eec..c04ca9d 100644 --- a/bridges/FacebookBridge.php +++ b/bridges/FacebookBridge.php @@ -153,7 +153,7 @@ class FacebookBridge extends BridgeAbstract{ foreach($element->children() as $post) { - $item = new \Item(); + $item = array(); if (count($post->find('abbr')) > 0) { @@ -195,11 +195,11 @@ class FacebookBridge extends BridgeAbstract{ $title = substr($title, 0, strpos(wordwrap($title, 64), "\n")).'...'; //Build and add final item - $item->uri = 'https://facebook.com'.$post->find('abbr')[0]->parent()->getAttribute('href'); - $item->content = $content; - $item->title = $title; - $item->author = $author; - $item->timestamp = $date; + $item['uri'] = 'https://facebook.com'.$post->find('abbr')[0]->parent()->getAttribute('href'); + $item['content'] = $content; + $item['title'] = $title; + $item['author'] = $author; + $item['timestamp'] = $date; $this->items[] = $item; } } diff --git a/bridges/FierPandaBridge.php b/bridges/FierPandaBridge.php index 9500817..5a432fc 100644 --- a/bridges/FierPandaBridge.php +++ b/bridges/FierPandaBridge.php @@ -16,12 +16,12 @@ Class FierPandaBridge extends BridgeAbstract{ $html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('Could not request Fier Panda.'); foreach($html->find('div.container-content article') as $element) { - $item = new \Item(); - $item->uri = $this->getURI().$element->find('a', 0)->href; - $item->title = trim($element->find('h2 a', 0)->innertext); + $item = array(); + $item['uri'] = $this->getURI().$element->find('a', 0)->href; + $item['title'] = trim($element->find('h2 a', 0)->innertext); // Remove the link at the end of the article $element->find('p a', 0)->outertext = ''; - $item->content = $element->find('p', 0)->innertext; + $item['content'] = $element->find('p', 0)->innertext; $this->items[] = $item; } } diff --git a/bridges/FlickrExploreBridge.php b/bridges/FlickrExploreBridge.php index db399af..a8b7569 100644 --- a/bridges/FlickrExploreBridge.php +++ b/bridges/FlickrExploreBridge.php @@ -27,10 +27,10 @@ class FlickrExploreBridge extends BridgeAbstract{ // Get the image JSON via Flickr API $imageJSON = json_decode(file_get_contents('https://api.flickr.com/services/rest/?method=flickr.photos.getInfo&api_key=103b574d49bd51f0e18bfe907da44a0f&photo_id='.$imageID.'&format=json&nojsoncallback=1')) or $this->returnServerError('Could not request Flickr.'); // FIXME: Request time too long... - $item = new \Item(); - $item->uri = 'https://flickr.com/photo.gne?id='.$imageID; - $item->content = ''; // FIXME: Filter javascript ? - $item->title = $imageJSON->photo->title->_content; + $item = array(); + $item['uri'] = 'https://flickr.com/photo.gne?id='.$imageID; + $item['content'] = ''; // FIXME: Filter javascript ? + $item['title'] = $imageJSON->photo->title->_content; $this->items[] = $item; } } diff --git a/bridges/FlickrTagBridge.php b/bridges/FlickrTagBridge.php index 7ec7c26..424f989 100644 --- a/bridges/FlickrTagBridge.php +++ b/bridges/FlickrTagBridge.php @@ -33,11 +33,11 @@ class FlickrTagBridge extends BridgeAbstract{ } foreach($html->find('span.photo_container') as $element) { - $item = new \Item(); - $item->uri = 'http://flickr.com'.$element->find('a',0)->href; + $item = array(); + $item['uri'] = 'http://flickr.com'.$element->find('a',0)->href; $thumbnailUri = $element->find('img',0)->getAttribute('data-defer-src'); - $item->content = ''; // FIXME: Filter javascript ? - $item->title = $element->find('a',0)->title; + $item['content'] = ''; // FIXME: Filter javascript ? + $item['title'] = $element->find('a',0)->title; $this->items[] = $item; } } diff --git a/bridges/FootitoBridge.php b/bridges/FootitoBridge.php index f3357c6..525aa9e 100644 --- a/bridges/FootitoBridge.php +++ b/bridges/FootitoBridge.php @@ -14,7 +14,7 @@ class FootitoBridge extends BridgeAbstract{ $html = $this->getSimpleHTMLDOM('http://www.footito.fr/') or $this->returnServerError('Could not request Footito.'); foreach($html->find('div.post') as $element) { - $item = new Item(); + $item = array(); $content = trim($element->innertext); $content = str_replace("content = $content; + $item['content'] = $content; $title = $element->find('.contenu .texte ', 0)->plaintext; - $item->title = $title; + $item['title'] = $title; $info = $element->find('div.infos', 0); - $item->timestamp = strtotime($info->find('time', 0)->datetime); - $item->author = $info->find('a.auteur', 0)->plaintext; + $item['timestamp'] = strtotime($info->find('time', 0)->datetime); + $item['author'] = $info->find('a.auteur', 0)->plaintext; $this->items[] = $item; } diff --git a/bridges/FourchanBridge.php b/bridges/FourchanBridge.php index abc6b6d..4b3a9b0 100644 --- a/bridges/FourchanBridge.php +++ b/bridges/FourchanBridge.php @@ -30,26 +30,26 @@ class FourchanBridge extends BridgeAbstract{ $html = $this->getSimpleHTMLDOM($url) or $this->returnServerError("Could not request 4chan, thread not found"); foreach($html->find('div.postContainer') as $element) { - $item = new \Item(); - $item->id = $element->find('.post', 0)->getAttribute('id'); - $item->uri = $url.'#'.$item->id; - $item->timestamp = $element->find('span.dateTime', 0)->getAttribute('data-utc'); - $item->author = $element->find('span.name', 0)->plaintext; + $item = array(); + $item['id'] = $element->find('.post', 0)->getAttribute('id'); + $item['uri'] = $url.'#'.$item['id']; + $item['timestamp'] = $element->find('span.dateTime', 0)->getAttribute('data-utc'); + $item['author'] = $element->find('span.name', 0)->plaintext; if(!empty($element->find('.file', 0) ) ) { - $item->image = $element->find('.file a', 0)->href; - $item->imageThumb = $element->find('.file img', 0)->src; - if(empty($item->imageThumb) and strpos($item->image, '.swf') !== FALSE) - $item->imageThumb = 'http://i.imgur.com/eO0cxf9.jpg'; + $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) + $item['imageThumb'] = 'http://i.imgur.com/eO0cxf9.jpg'; } if(!empty($element->find('span.subject', 0)->innertext )) { - $item->subject = $element->find('span.subject', 0)->innertext; + $item['subject'] = $element->find('span.subject', 0)->innertext; } - $item->title = (!empty($item->subject) ? $item->subject.' - ' : '' ) . 'reply '.$item->id.' | '.$item->author; + $item['title'] = (isset($item['subject']) ? $item['subject'].' - ' : '' ) . 'reply '.$item['id'].' | '.$item['author']; - $item->content = (!empty($item->image) ? ''.$item->id.'
' : '') . ''.$element->find('.postMessage', 0)->innertext.''; + $item['content'] = (isset($item['image']) ? ''.$item['id'].'
' : '') . ''.$element->find('.postMessage', 0)->innertext.''; $this->items[] = $item; } $this->items = array_reverse($this->items); diff --git a/bridges/Freenews.php b/bridges/Freenews.php index c4ec7fb..04cbdaf 100644 --- a/bridges/Freenews.php +++ b/bridges/Freenews.php @@ -19,23 +19,23 @@ class Freenews extends RssExpander { } protected function parseRSSItem($newsItem) { - $item = new Item(); - $item->title = trim($newsItem->title); -// $this->message("item has for title \"".$item->title."\""); + $item = array(); + $item['title'] = trim($newsItem->title); +// $this->message("item has for title \"".$item['title']."\""); if(empty($newsItem->guid)) { - $item->uri = (string) $newsItem->link; + $item['uri'] = (string) $newsItem->link; } else { - $item->uri = (string) $newsItem->guid; + $item['uri'] = (string) $newsItem->guid; } // now load that uri from cache -// $this->message("now loading page ".$item->uri); - $articlePage = str_get_html($this->get_cached($item->uri)); +// $this->message("now loading page ".$item['uri']); + $articlePage = str_get_html($this->get_cached($item['uri'])); $content = $articlePage->find('.post-container', 0); - $item->content = $content->innertext; - $item->author = $articlePage->find('a[rel=author]', 0)->innertext; + $item['content'] = $content->innertext; + $item['author'] = $articlePage->find('a[rel=author]', 0)->innertext; // format should parse 2014-03-25T16:21:20Z. But, according to http://stackoverflow.com/a/10478469, it is not that simple - $item->timestamp = $this->RSS_2_0_time_to_timestamp($newsItem); + $item['timestamp'] = $this->RSS_2_0_time_to_timestamp($newsItem); return $item; } } diff --git a/bridges/FuturaSciencesBridge.php b/bridges/FuturaSciencesBridge.php index 54f372f..2d0869c 100644 --- a/bridges/FuturaSciencesBridge.php +++ b/bridges/FuturaSciencesBridge.php @@ -177,12 +177,12 @@ class FuturaSciencesBridge extends BridgeAbstract { $contents = StripWithDelimiters($contents, 'fs:xt:clicktype="', '"'); $contents = StripWithDelimiters($contents, 'fs:xt:clickname="', '"'); - $item = new \Item(); - $item->author = ExtractAuthor($article, $element); - $item->uri = $article_url; - $item->title = StripCDATA($element->find('title', 0)->innertext); - $item->timestamp = strtotime(StripCDATA($element->find('pubDate', 0)->plaintext)); - $item->content = trim($contents); + $item = array(); + $item['author'] = ExtractAuthor($article, $element); + $item['uri'] = $article_url; + $item['title'] = StripCDATA($element->find('title', 0)->innertext); + $item['timestamp'] = strtotime(StripCDATA($element->find('pubDate', 0)->plaintext)); + $item['content'] = trim($contents); $this->items[] = $item; $limit++; } diff --git a/bridges/GBAtempBridge.php b/bridges/GBAtempBridge.php index 868393c..4c1bf21 100644 --- a/bridges/GBAtempBridge.php +++ b/bridges/GBAtempBridge.php @@ -41,12 +41,12 @@ class GBAtempBridge extends BridgeAbstract { } private function build_item($uri, $title, $author, $timestamp, $content) { - $item = new \Item(); - $item->uri = $uri; - $item->title = $title; - $item->author = $author; - $item->timestamp = $timestamp; - $item->content = $content; + $item = array(); + $item['uri'] = $uri; + $item['title'] = $title; + $item['author'] = $author; + $item['timestamp'] = $timestamp; + $item['content'] = $content; return $item; } diff --git a/bridges/Gawker.php b/bridges/Gawker.php index d03c20d..e8c7581 100644 --- a/bridges/Gawker.php +++ b/bridges/Gawker.php @@ -33,35 +33,35 @@ class Gawker extends RssExpander{ } protected function parseRSSItem($newsItem) { - $item = new Item(); - $item->uri = trim($newsItem->link); - $item->title = trim($newsItem->title); - $item->timestamp = $this->RSS_2_0_time_to_timestamp($newsItem); + $item = array(); + $item['uri'] = trim($newsItem->link); + $item['title'] = trim($newsItem->title); + $item['timestamp'] = $this->RSS_2_0_time_to_timestamp($newsItem); // $this->message("///////////////////////////////////////////////////////////////////////////////////////\nprocessing item ".var_export($item, true)."\n\n\nbuilt from\n\n\n".var_export($newsItem, true)); try { // now load that uri from cache -// $this->message("loading page ".$item->uri); - $articlePage = str_get_html($this->get_cached($item->uri)); +// $this->message("loading page ".$item['uri']); + $articlePage = str_get_html($this->get_cached($item['uri'])); if(is_object($articlePage)) { $content = $articlePage->find('.post-content', 0); HTMLSanitizer::defaultImageSrcTo($content, $this->getURI()); $vcard = $articlePage->find('.vcard', 0); if(is_object($vcard)) { $authorLink = $vcard->find('a', 0); - $item->author = $authorLink->innertext; + $item['author'] = $authorLink->innertext; // TODO use author link href to fill the feed info } // $this->message("item quite loaded : ".var_export($item, true)); // I set item content as last element, for easier var_export reading - $item->content = $content->innertext; + $item['content'] = $content->innertext; } else { - throw new Exception("cache content for ".$item->uri." is NOT a Simple DOM parser object !"); + throw new Exception("cache content for ".$item['uri']." is NOT a Simple DOM parser object !"); } } catch(Exception $e) { - $this->message("obtaining ".$item->uri." resulted in exception ".$e->getMessage().". Deleting cached page ..."); + $this->message("obtaining ".$item['uri']." resulted in exception ".$e->getMessage().". Deleting cached page ..."); // maybe file is incorrect. it should be discarded from cache - $this->remove_from_cache($item->url); - $item->content = $e->getMessage(); + $this->remove_from_cache($item['url']); + $item['content'] = $e->getMessage(); } return $item; } diff --git a/bridges/GelbooruBridge.php b/bridges/GelbooruBridge.php index bd73bba..d463975 100644 --- a/bridges/GelbooruBridge.php +++ b/bridges/GelbooruBridge.php @@ -32,14 +32,14 @@ class GelbooruBridge extends BridgeAbstract{ foreach($html->find('div[class=content] span') as $element) { - $item = new \Item(); - $item->uri = 'http://gelbooru.com/'.$element->find('a', 0)->href; - $item->postid = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id')); - $item->timestamp = time(); + $item = array(); + $item['uri'] = 'http://gelbooru.com/'.$element->find('a', 0)->href; + $item['postid'] = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id')); + $item['timestamp'] = time(); $thumbnailUri = $element->find('img', 0)->src; - $item->tags = $element->find('img', 0)->getAttribute('alt'); - $item->title = 'Gelbooru | '.$item->postid; - $item->content = '
Tags: '.$item->tags; + $item['tags'] = $element->find('img', 0)->getAttribute('alt'); + $item['title'] = 'Gelbooru | '.$item['postid']; + $item['content'] = '
Tags: '.$item['tags']; $this->items[] = $item; } } diff --git a/bridges/GiphyBridge.php b/bridges/GiphyBridge.php index 61548c5..16c8f8c 100644 --- a/bridges/GiphyBridge.php +++ b/bridges/GiphyBridge.php @@ -49,10 +49,10 @@ class GiphyBridge extends BridgeAbstract{ $img = $figure->firstChild(); $caption = $figure->lastChild(); - $item = new \Item(); - $item->id = $img->getAttribute('data-gif_id'); - $item->uri = $img->getAttribute('data-bitly_gif_url'); - $item->username = 'Giphy - '.ucfirst($kw); + $item = array(); + $item['id'] = $img->getAttribute('data-gif_id'); + $item['uri'] = $img->getAttribute('data-bitly_gif_url'); + $item['username'] = 'Giphy - '.ucfirst($kw); $title = $caption->innertext(); $title = preg_replace('/\s+/', ' ',$title); $title = str_replace('animated GIF', '', $title); @@ -60,11 +60,11 @@ class GiphyBridge extends BridgeAbstract{ $title = preg_replace('/\s+/', ' ',$title); $title = trim($title); if (strlen($title) <= 0) { - $title = $item->id; + $title = $item['id']; } - $item->title = trim($title); - $item->content = - '' + $item['title'] = trim($title); + $item['content'] = + '' .'' .''; diff --git a/bridges/GithubIssueBridge.php b/bridges/GithubIssueBridge.php index e535898..2bdea3e 100644 --- a/bridges/GithubIssueBridge.php +++ b/bridges/GithubIssueBridge.php @@ -37,15 +37,15 @@ class GithubIssueBridge extends BridgeAbstract{ foreach($html->find('.js-comment-container') as $comment){ - $item = new \Item(); - $item->author=$comment->find('img',0)->getAttribute('alt'); + $item = array(); + $item['author']=$comment->find('img',0)->getAttribute('alt'); $comment=$comment->firstChild()->nextSibling(); - $item->uri=$uri.'#'.$comment->getAttribute('id'); - $item->title=trim($comment->firstChild()->plaintext); - $item->timestamp=strtotime($comment->find('relative-time',0)->getAttribute('datetime')); - $item->content=$comment->find('.comment-body',0)->innertext; + $item['uri']=$uri.'#'.$comment->getAttribute('id'); + $item['title']=trim($comment->firstChild()->plaintext); + $item['timestamp']=strtotime($comment->find('relative-time',0)->getAttribute('datetime')); + $item['content']=$comment->find('.comment-body',0)->innertext; $this->items[]=$item; } diff --git a/bridges/GitlabCommitsBridge.php b/bridges/GitlabCommitsBridge.php index 85c18b8..762e642 100644 --- a/bridges/GitlabCommitsBridge.php +++ b/bridges/GitlabCommitsBridge.php @@ -47,31 +47,31 @@ class GitlabCommitsBridge extends BridgeAbstract{ foreach($html->find('li.commit') as $commit){ - $item = new \Item(); - $item->uri=$param['uri']; + $item = array(); + $item['uri']=$param['uri']; foreach($commit->getElementsByTagName('a') as $a){ $classes=explode(' ',$a->getAttribute("class")); if(in_array('commit-short-id',$classes) || in_array('commit_short_id',$classes)){ $href=$a->getAttribute('href'); - $item->uri.=substr($href,strpos($href,'/'.$param['u'].'/'.$param['p'])); + $item['uri'].=substr($href,strpos($href,'/'.$param['u'].'/'.$param['p'])); } if(in_array('commit-row-message',$classes)){ - $item->title=$a->plaintext; + $item['title']=$a->plaintext; } if(in_array('commit-author-link',$classes)){ - $item->author=trim($a->plaintext); + $item['author']=trim($a->plaintext); } } $pre=$commit->find('pre',0); if($pre){ - $item->content=$pre->outertext; + $item['content']=$pre->outertext; }else{ - $item->content=''; + $item['content']=''; } - $item->timestamp=strtotime($commit->find('time',0)->getAttribute('datetime')); + $item['timestamp']=strtotime($commit->find('time',0)->getAttribute('datetime')); $this->items[]=$item; } diff --git a/bridges/GizmodoFRBridge.php b/bridges/GizmodoFRBridge.php index ffa7865..8bd3217 100644 --- a/bridges/GizmodoFRBridge.php +++ b/bridges/GizmodoFRBridge.php @@ -30,11 +30,11 @@ class GizmodoFRBridge extends BridgeAbstract{ foreach($rssFeed->find('item') as $element) { if($limit < 15) { - $item = new \Item(); - $item->title = $element->find('title', 0)->innertext; - $item->uri = $element->find('guid', 0)->plaintext; - $item->timestamp = strtotime($element->find('pubDate', 0)->plaintext); - $item->content = GizmodoFRExtractContent($item->uri); + $item = array(); + $item['title'] = $element->find('title', 0)->innertext; + $item['uri'] = $element->find('guid', 0)->plaintext; + $item['timestamp'] = strtotime($element->find('pubDate', 0)->plaintext); + $item['content'] = GizmodoFRExtractContent($item['uri']); $this->items[] = $item; $limit++; } diff --git a/bridges/GooglePlusPostBridge.php b/bridges/GooglePlusPostBridge.php index 6f106ee..2b35c9b 100644 --- a/bridges/GooglePlusPostBridge.php +++ b/bridges/GooglePlusPostBridge.php @@ -42,23 +42,23 @@ class GooglePlusPostBridge extends BridgeAbstract // foreach ($html->find('meta') as $e) // { -// $item = new \Item(); -// $item->content = var_export($e->attr, true); +// $item = array(); +// $item['content'] = var_export($e->attr, true); // $this->items[] = $item; // } // div[jsmodel=XNmfOc] foreach($html->find('div.yt') as $post) { - $item = new \Item(); -// $item->content = $post->find('div.Al', 0)->innertext; - $item->username = $item->fullname = $post->find('header.lea h3 a', 0)->innertext; - $item->id = $post->getAttribute('id'); -// $item->title = $item->fullname = $post->find('header.lea', 0)->plaintext; - $item->avatar = $post->find('div.ys img', 0)->src; + $item = array(); +// $item['content'] = $post->find('div.Al', 0)->innertext; + $item['username'] = $item['fullname'] = $post->find('header.lea h3 a', 0)->innertext; + $item['id'] = $post->getAttribute('id'); +// $item['title'] = $item['fullname'] = $post->find('header.lea', 0)->plaintext; + $item['avatar'] = $post->find('div.ys img', 0)->src; // var_dump((($post->find('a.o-U-s', 0)->getAllAttributes()))); - $item->uri = self::GOOGLE_PLUS_BASE_URL . $post->find('a.o-U-s', 0)->href; - $item->timestamp = strtotime($post->find('a.o-U-s', 0)->plaintext); + $item['uri'] = self::GOOGLE_PLUS_BASE_URL . $post->find('a.o-U-s', 0)->href; + $item['timestamp'] = strtotime($post->find('a.o-U-s', 0)->plaintext); $this->items[] = $item; // hashtag to treat : https://plus.google.com/explore/tag @@ -68,11 +68,11 @@ class GooglePlusPostBridge extends BridgeAbstract $hashtags[ trim($hashtag->plaintext) ] = self::GOOGLE_PLUS_BASE_URL . $hashtag->href; } - $item->content = ''; + $item['content'] = ''; // avatar display - $item->content .= ''; + $item['content'] .= ''; $content = $post->find('div.Al', 0); @@ -100,10 +100,10 @@ class GooglePlusPostBridge extends BridgeAbstract } $content = $content->innertext; - $item->content .= '
' . $content . '
'; + $item['content'] .= '
' . $content . '
'; // extract plaintext - $item->content_simple = $post->find('div.Al', 0)->plaintext; + $item['content_simple'] = $post->find('div.Al', 0)->plaintext; } // $html->save(__DIR__ . '/../posts2.html'); diff --git a/bridges/GoogleSearchBridge.php b/bridges/GoogleSearchBridge.php index 0e9da84..a374640 100644 --- a/bridges/GoogleSearchBridge.php +++ b/bridges/GoogleSearchBridge.php @@ -39,15 +39,15 @@ class GoogleSearchBridge extends BridgeAbstract{ $emIsRes = $html->find('div[id=ires]',0); if( !is_null($emIsRes) ){ foreach($emIsRes->find('li[class=g]') as $element) { - $item = new Item(); + $item = array(); // Extract direct URL from google href (eg. /url?q=...) $t = $element->find('a[href]',0)->href; - $item->uri = ''.$t; + $item['uri'] = ''.$t; parse_str(parse_url($t, PHP_URL_QUERY),$parameters); - if (isset($parameters['q'])) { $item->uri = $parameters['q']; } - $item->title = $element->find('h3',0)->plaintext; - $item->content = $element->find('span[class=st]',0)->plaintext; + if (isset($parameters['q'])) { $item['uri'] = $parameters['q']; } + $item['title'] = $element->find('h3',0)->plaintext; + $item['content'] = $element->find('span[class=st]',0)->plaintext; $this->items[] = $item; } } diff --git a/bridges/GuruMedBridge.php b/bridges/GuruMedBridge.php index 1314d40..a58ee64 100644 --- a/bridges/GuruMedBridge.php +++ b/bridges/GuruMedBridge.php @@ -20,11 +20,11 @@ class GuruMedBridge extends BridgeAbstract{ foreach($html->find('item') as $element) { if($limit < 5) { - $item = new \Item(); - $item->title = $this->GurumedStripCDATA($element->find('title', 0)->innertext); - $item->uri = $this->GurumedStripCDATA($element->find('guid', 0)->plaintext); - $item->timestamp = strtotime($element->find('pubDate', 0)->plaintext); - $item->content = $this->GurumedStripCDATA(strip_tags($element->find('description', 0), '


')); + $item = array(); + $item['title'] = $this->GurumedStripCDATA($element->find('title', 0)->innertext); + $item['uri'] = $this->GurumedStripCDATA($element->find('guid', 0)->plaintext); + $item['timestamp'] = strtotime($element->find('pubDate', 0)->plaintext); + $item['content'] = $this->GurumedStripCDATA(strip_tags($element->find('description', 0), '


')); $this->items[] = $item; $limit++; } diff --git a/bridges/HDWallpapersBridge.php b/bridges/HDWallpapersBridge.php index 4beb1a7..1aa8ff7 100644 --- a/bridges/HDWallpapersBridge.php +++ b/bridges/HDWallpapersBridge.php @@ -49,12 +49,12 @@ class HDWallpapersBridge extends BridgeAbstract { foreach($html->find('.wallpapers .wall a') as $element) { $thumbnail = $element->find('img', 0); - $item = new \Item(); + $item = array(); // http://www.hdwallpapers.in/download/yosemite_reflections-1680x1050.jpg - $item->uri = $baseUri.'/download'.str_replace('wallpapers.html', $this->resolution.'.jpg', $element->href); - $item->timestamp = time(); - $item->title = $element->find('p', 0)->text(); - $item->content = $item->title.'
'; + $item['uri'] = $baseUri.'/download'.str_replace('wallpapers.html', $this->resolution.'.jpg', $element->href); + $item['timestamp'] = time(); + $item['title'] = $element->find('p', 0)->text(); + $item['content'] = $item['title'].'
'; $this->items[] = $item; $num++; diff --git a/bridges/HentaiHavenBridge.php b/bridges/HentaiHavenBridge.php index 3242cc8..28f6975 100644 --- a/bridges/HentaiHavenBridge.php +++ b/bridges/HentaiHavenBridge.php @@ -13,12 +13,12 @@ class HentaiHavenBridge extends BridgeAbstract{ public function collectData(array $param){ $html = $this->getSimpleHTMLDOM('http://hentaihaven.org/') or $this->returnServerError('Could not request Hentai Haven.'); foreach($html->find('div.zoe-grid') as $element) { - $item = new \Item(); - $item->uri = $element->find('div.brick-content h3 a', 0)->href; + $item = array(); + $item['uri'] = $element->find('div.brick-content h3 a', 0)->href; $thumbnailUri = $element->find('a.thumbnail-image img', 0)->getAttribute('data-src'); - $item->title = mb_convert_encoding(trim($element->find('div.brick-content h3 a', 0)->innertext), 'UTF-8', 'HTML-ENTITIES'); - $item->tags = $element->find('div.oFlyout_bg div.oFlyout div.flyoutContent span.tags', 0)->plaintext; - $item->content = 'Tags: ' . $item->tags.'


' . $element->find('div.oFlyout_bg div.oFlyout div.flyoutContent p.description', 0)->innertext; + $item['title'] = mb_convert_encoding(trim($element->find('div.brick-content h3 a', 0)->innertext), 'UTF-8', 'HTML-ENTITIES'); + $item['tags'] = $element->find('div.oFlyout_bg div.oFlyout div.flyoutContent span.tags', 0)->plaintext; + $item['content'] = 'Tags: ' . $item['tags'].'


' . $element->find('div.oFlyout_bg div.oFlyout div.flyoutContent p.description', 0)->innertext; $this->items[] = $item; } } diff --git a/bridges/IdenticaBridge.php b/bridges/IdenticaBridge.php index 5b69605..0a6d8be 100644 --- a/bridges/IdenticaBridge.php +++ b/bridges/IdenticaBridge.php @@ -27,11 +27,11 @@ class IdenticaBridge extends BridgeAbstract{ } foreach($html->find('li.major') as $dent) { - $item = new \Item(); - $item->uri = html_entity_decode($dent->find('a', 0)->href); // get dent link - $item->timestamp = strtotime($dent->find('abbr.easydate', 0)->plaintext); // extract dent timestamp - $item->content = trim($dent->find('div.activity-content', 0)->innertext); // extract dent text - $item->title = $param['u'] . ' | ' . $item->content; + $item = array(); + $item['uri'] = html_entity_decode($dent->find('a', 0)->href); // get dent link + $item['timestamp'] = strtotime($dent->find('abbr.easydate', 0)->plaintext); // extract dent timestamp + $item['content'] = trim($dent->find('div.activity-content', 0)->innertext); // extract dent text + $item['title'] = $param['u'] . ' | ' . $item['content']; $this->items[] = $item; } } diff --git a/bridges/InstagramBridge.php b/bridges/InstagramBridge.php index c48ea94..9e99dc4 100644 --- a/bridges/InstagramBridge.php +++ b/bridges/InstagramBridge.php @@ -54,16 +54,16 @@ class InstagramBridge extends BridgeAbstract{ foreach($userMedia as $media) { - $item = new \Item(); - $item->uri = "https://instagram.com/p/".$media->code."/"; - $item->content = ''; + $item = array(); + $item['uri'] = "https://instagram.com/p/".$media->code."/"; + $item['content'] = ''; if (isset($media->caption)) { - $item->title = $media->caption; + $item['title'] = $media->caption; } else { - $item->title = basename($media->display_src); + $item['title'] = basename($media->display_src); } - $item->timestamp = $media->date; + $item['timestamp'] = $media->date; $this->items[] = $item; } diff --git a/bridges/IsoHuntBridge.php b/bridges/IsoHuntBridge.php index 718fe47..2ce826b 100644 --- a/bridges/IsoHuntBridge.php +++ b/bridges/IsoHuntBridge.php @@ -246,13 +246,13 @@ class IsoHuntBridge extends BridgeAbstract{ if(!$date) $this->returnServerError('Unable to find date!'); - $item = new \Item(); + $item = array(); - $item->uri = $this->fix_relative_uri($anchor->href); - $item->title = $anchor->title; - // $item->author = - $item->timestamp = strtotime($date->plaintext); - $item->content = $this->fix_relative_uri($torrent->innertext); + $item['uri'] = $this->fix_relative_uri($anchor->href); + $item['title'] = $anchor->title; + // $item['author'] = + $item['timestamp'] = strtotime($date->plaintext); + $item['content'] = $this->fix_relative_uri($torrent->innertext); $this->items[] = $item; } @@ -284,13 +284,13 @@ class IsoHuntBridge extends BridgeAbstract{ if(!$element) $this->returnServerError('Unable to find element!'); - $item = new \Item(); + $item = array(); - $item->uri = $element->href; - $item->title = $element->plaintext; - // $item->author = - // $item->timestamp = - // $item->content = + $item['uri'] = $element->href; + $item['title'] = $element->plaintext; + // $item['author'] = + // $item['timestamp'] = + // $item['content'] = $this->items[] = $item; } @@ -310,13 +310,13 @@ class IsoHuntBridge extends BridgeAbstract{ $this->returnServerError('Unable to find posts!'); foreach($posts as $post){ - $item = new \Item(); + $item = array(); - $item->uri = $this->latest_news_extract_uri($post); - $item->title = $this->latest_news_extract_title($post); - $item->author = $this->latest_news_extract_author($post); - $item->timestamp = $this->latest_news_extract_timestamp($post); - $item->content = $this->latest_news_extract_content($post); + $item['uri'] = $this->latest_news_extract_uri($post); + $item['title'] = $this->latest_news_extract_title($post); + $item['author'] = $this->latest_news_extract_author($post); + $item['timestamp'] = $this->latest_news_extract_timestamp($post); + $item['content'] = $this->latest_news_extract_content($post); $this->items[] = $item; } @@ -399,13 +399,13 @@ class IsoHuntBridge extends BridgeAbstract{ $this->returnServerError('Unable to find torrents!'); foreach($torrents as $torrent){ - $item = new \Item(); + $item = array(); - $item->uri = $this->latest_torrents_extract_uri($torrent); - $item->title = $this->latest_torrents_extract_title($torrent); - $item->author = $this->latest_torrents_extract_author($torrent); - $item->timestamp = $this->latest_torrents_extract_timestamp($torrent); - $item->content = ''; // There is no valuable content + $item['uri'] = $this->latest_torrents_extract_uri($torrent); + $item['title'] = $this->latest_torrents_extract_title($torrent); + $item['author'] = $this->latest_torrents_extract_author($torrent); + $item['timestamp'] = $this->latest_torrents_extract_timestamp($torrent); + $item['content'] = ''; // There is no valuable content $this->items[] = $item; } diff --git a/bridges/JapanExpoBridge.php b/bridges/JapanExpoBridge.php index fcb3796..125261f 100644 --- a/bridges/JapanExpoBridge.php +++ b/bridges/JapanExpoBridge.php @@ -82,11 +82,11 @@ class JapanExpoBridge extends BridgeAbstract{ $content = '
'.$date_text.'
Lire l\'article'; } - $item = new \Item(); - $item->uri = $url; - $item->title = $title; - $item->timestamp = $timestamp; - $item->content = $content; + $item = array(); + $item['uri'] = $url; + $item['title'] = $title; + $item['timestamp'] = $timestamp; + $item['content'] = $content; $this->items[] = $item; $count++; } diff --git a/bridges/KonachanBridge.php b/bridges/KonachanBridge.php index 6a42ac3..b9ef307 100644 --- a/bridges/KonachanBridge.php +++ b/bridges/KonachanBridge.php @@ -33,13 +33,13 @@ class KonachanBridge extends BridgeAbstract{ foreach($data as $datai) { $json = json_decode($datai, TRUE); - $item = new \Item(); - $item->uri = 'http://konachan.com/post/show/'.$json['id']; - $item->postid = $json['id']; - $item->timestamp = $json['created_at']; - $item->imageUri = $json['file_url']; - $item->title = 'Konachan | '.$json['id']; - $item->content = '
Tags: '.$json['tags']; + $item = array(); + $item['uri'] = 'http://konachan.com/post/show/'.$json['id']; + $item['postid'] = $json['id']; + $item['timestamp'] = $json['created_at']; + $item['imageUri'] = $json['file_url']; + $item['title'] = 'Konachan | '.$json['id']; + $item['content'] = '
Tags: '.$json['tags']; $this->items[] = $item; } } diff --git a/bridges/KoreusBridge.php b/bridges/KoreusBridge.php index cb3a4a0..d211edf 100644 --- a/bridges/KoreusBridge.php +++ b/bridges/KoreusBridge.php @@ -27,11 +27,11 @@ class KoreusBridge extends BridgeAbstract{ foreach($html->find('item') as $element) { if($limit < 5) { - $item = new \Item(); - $item->title = $this->KoreusStripCDATA($element->find('title', 0)->innertext); - $item->uri = $this->KoreusStripCDATA($element->find('guid', 0)->plaintext); - $item->timestamp = strtotime($element->find('pubDate', 0)->plaintext); - $item->content = $this->KoreusExtractContent($item->uri); + $item = array(); + $item['title'] = $this->KoreusStripCDATA($element->find('title', 0)->innertext); + $item['uri'] = $this->KoreusStripCDATA($element->find('guid', 0)->plaintext); + $item['timestamp'] = strtotime($element->find('pubDate', 0)->plaintext); + $item['content'] = $this->KoreusExtractContent($item['uri']); $this->items[] = $item; $limit++; } diff --git a/bridges/KununuBridge.php b/bridges/KununuBridge.php index 05b80c4..0902d20 100644 --- a/bridges/KununuBridge.php +++ b/bridges/KununuBridge.php @@ -93,17 +93,17 @@ class KununuBridge extends BridgeAbstract{ // Go through all articles foreach($articles as $article){ - $item = new \Item(); + $item = array(); - $item->author = $this->extract_article_author_position($article); - $item->timestamp = $this->extract_article_date($article); - $item->title = $this->extract_article_rating($article) . ' : ' . $this->extract_article_summary($article); - $item->uri = $this->extract_article_uri($article); + $item['author'] = $this->extract_article_author_position($article); + $item['timestamp'] = $this->extract_article_date($article); + $item['title'] = $this->extract_article_rating($article) . ' : ' . $this->extract_article_summary($article); + $item['uri'] = $this->extract_article_uri($article); if($full) - $item->content = $this->extract_full_description($item->uri); + $item['content'] = $this->extract_full_description($item['uri']); else - $item->content = $this->extract_article_description($article); + $item['content'] = $this->extract_article_description($article); $this->items[] = $item; } diff --git a/bridges/LWNprevBridge.php b/bridges/LWNprevBridge.php index b85639d..fc61d05 100644 --- a/bridges/LWNprevBridge.php +++ b/bridges/LWNprevBridge.php @@ -81,34 +81,34 @@ class LWNprevBridge extends BridgeAbstract{ continue; } - $item = new \Item(); + $item = array(); $h2NextSibling=$h2->nextSibling; $this->jumpToNextTag($h2NextSibling); switch($h2NextSibling->getAttribute('class')){ case 'FeatureByline': - $item->author=$h2NextSibling->getElementsByTagName('b')->item(0)->textContent; + $item['author']=$h2NextSibling->getElementsByTagName('b')->item(0)->textContent; break; case 'GAByline': $text=$h2NextSibling->textContent; - $item->author=substr($text,strpos($text,'by ')); + $item['author']=substr($text,strpos($text,'by ')); break; default: - $item->author='LWN'; + $item['author']='LWN'; break; }; $h2FirstChild=$h2->firstChild; $this->jumpToNextTag($h2FirstChild); if($h2FirstChild->nodeName==='a'){ - $item->uri='https://lwn.net'.$h2FirstChild->getAttribute('href'); + $item['uri']='https://lwn.net'.$h2FirstChild->getAttribute('href'); }else{ - $item->uri=$realURI.'#'.$URICounter; + $item['uri']=$realURI.'#'.$URICounter; } $URICounter++; - $item->timestamp=$editionTimeStamp+$URICounter; + $item['timestamp']=$editionTimeStamp+$URICounter; $h2PrevSibling=$h2->previousSibling; $this->jumpToPreviousTag($h2PrevSibling); @@ -131,11 +131,11 @@ class LWNprevBridge extends BridgeAbstract{ } $h2PrevSibling=null; - $item->title=''; + $item['title']=''; if(!empty($cat1)){ - $item->title.='['.$cat1.($cat2?'/'.$cat2:'').'] '; + $item['title'].='['.$cat1.($cat2?'/'.$cat2:'').'] '; } - $item->title.=$h2->textContent; + $item['title'].=$h2->textContent; $node=$h2; $content=''; @@ -156,7 +156,7 @@ class LWNprevBridge extends BridgeAbstract{ $content.=$node->C14N(); } } - $item->content=$content; + $item['content']=$content; $this->items[]=$item; } } diff --git a/bridges/LeBonCoinBridge.php b/bridges/LeBonCoinBridge.php index ce93c59..e71ba4a 100755 --- a/bridges/LeBonCoinBridge.php +++ b/bridges/LeBonCoinBridge.php @@ -160,8 +160,8 @@ class LeBonCoinBridge extends BridgeAbstract{ $element = $element->find('a', 0); - $item = new \Item(); - $item->uri = $element->href; + $item = array(); + $item['uri'] = $element->href; $title = html_entity_decode($element->getAttribute('title')); $content_image = $element->find('div.item_image', 0)->find('.lazyload', 0); @@ -178,8 +178,8 @@ class LeBonCoinBridge extends BridgeAbstract{ $price = $detailsList->find('h3.item_price', 0); $content .= $price === NULL ? '' : $price->plaintext; - $item->title = $title; - $item->content = $content . $date; + $item['title'] = $title; + $item['content'] = $content . $date; $this->items[] = $item; } } diff --git a/bridges/LeJournalDuGeekBridge.php b/bridges/LeJournalDuGeekBridge.php index 971fb87..84a829a 100644 --- a/bridges/LeJournalDuGeekBridge.php +++ b/bridges/LeJournalDuGeekBridge.php @@ -42,11 +42,11 @@ class LeJournalDuGeekBridge extends BridgeAbstract{ 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); + $item = array(); + $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++; } diff --git a/bridges/LeMondeInformatiqueBridge.php b/bridges/LeMondeInformatiqueBridge.php index 212dc90..3465be4 100644 --- a/bridges/LeMondeInformatiqueBridge.php +++ b/bridges/LeMondeInformatiqueBridge.php @@ -48,12 +48,12 @@ class LeMondeInformatiqueBridge extends BridgeAbstract { $article_title = $article_html->find('h1.cleanprint-title', 0)->plaintext; //Build and add final item - $item = new \Item(); - $item->uri = $article_uri; - $item->title = $article_title; - $item->author = StripCDATA($element->find('dc:creator', 0)->innertext); - $item->timestamp = strtotime($element->find('dc:date', 0)->plaintext); - $item->content = $article_content; + $item = array(); + $item['uri'] = $article_uri; + $item['title'] = $article_title; + $item['author'] = StripCDATA($element->find('dc:creator', 0)->innertext); + $item['timestamp'] = strtotime($element->find('dc:date', 0)->plaintext); + $item['content'] = $article_content; $this->items[] = $item; $limit++; } diff --git a/bridges/Les400Culs.php b/bridges/Les400Culs.php index c9f9237..49b2c1e 100644 --- a/bridges/Les400Culs.php +++ b/bridges/Les400Culs.php @@ -19,22 +19,22 @@ class Les400Culs extends RssExpander{ } protected function parseRSSItem($newsItem) { - $item = new Item(); - $item->title = trim((string) $newsItem->title); + $item = array(); + $item['title'] = trim((string) $newsItem->title); // $this->message("browsing item ".var_export($newsItem, true)); if(empty($newsItem->guid)) { - $item->uri = (string) $newsItem->link; + $item['uri'] = (string) $newsItem->link; } else { - $item->uri = (string) $newsItem->guid; + $item['uri'] = (string) $newsItem->guid; } // now load that uri from cache -// $this->message("now loading page ".$item->uri); -// $articlePage = str_get_html($this->get_cached($item->uri)); +// $this->message("now loading page ".$item['uri']); +// $articlePage = str_get_html($this->get_cached($item['uri'])); // $content = $articlePage->find('.post-container', 0); - $item->content = (string) $newsItem->description; - $item->author = (string) $newsItem->author; - $item->timestamp = $this->RSS_2_0_time_to_timestamp($newsItem); + $item['content'] = (string) $newsItem->description; + $item['author'] = (string) $newsItem->author; + $item['timestamp'] = $this->RSS_2_0_time_to_timestamp($newsItem); return $item; } public function getCacheDuration(){ diff --git a/bridges/LesJoiesDuCodeBridge.php b/bridges/LesJoiesDuCodeBridge.php index bbbd0b3..e9986d8 100644 --- a/bridges/LesJoiesDuCodeBridge.php +++ b/bridges/LesJoiesDuCodeBridge.php @@ -14,7 +14,7 @@ class LesJoiesDuCodeBridge extends BridgeAbstract{ $html = $this->getSimpleHTMLDOM('http://lesjoiesducode.fr/') or $this->returnServerError('Could not request LesJoiesDuCode.'); foreach($html->find('div.blog-post') as $element) { - $item = new Item(); + $item = array(); $temp = $element->find('h1 a', 0); $titre = html_entity_decode($temp->innertext); $url = $temp->href; @@ -35,13 +35,13 @@ class LesJoiesDuCodeBridge extends BridgeAbstract{ if($pos > 0) { $auteur = trim(str_replace("*/", "", substr($auteur->innertext, ($pos + 2)))); - $item->author = $auteur; + $item['author'] = $auteur; } - $item->content .= trim($content); - $item->uri = $url; - $item->title = trim($titre); + $item['content'] .= trim($content); + $item['uri'] = $url; + $item['title'] = trim($titre); $this->items[] = $item; } diff --git a/bridges/LichessBridge.php b/bridges/LichessBridge.php index c2da50b..252fbae 100644 --- a/bridges/LichessBridge.php +++ b/bridges/LichessBridge.php @@ -19,14 +19,14 @@ class LichessBridge extends BridgeAbstract { if ($posts_loaded < 5) { - $item = new \Item(); + $item = array(); - $item->title = html_entity_decode($entry->find('title', 0)->innertext); - $item->author = $entry->find('author', 0)->find('name', 0)->innertext; - $item->uri = $entry->find('id', 0)->plaintext; - $item->timestamp = strtotime($entry->find('published', 0)->plaintext); + $item['title'] = html_entity_decode($entry->find('title', 0)->innertext); + $item['author'] = $entry->find('author', 0)->find('name', 0)->innertext; + $item['uri'] = $entry->find('id', 0)->plaintext; + $item['timestamp'] = strtotime($entry->find('published', 0)->plaintext); - $item->content = $this->retrieve_lichess_post($item->uri); + $item['content'] = $this->retrieve_lichess_post($item['uri']); $this->items[] = $item; $posts_loaded++; diff --git a/bridges/LinkedInCompany.php b/bridges/LinkedInCompany.php index 7d4dc57..bf8fd6a 100644 --- a/bridges/LinkedInCompany.php +++ b/bridges/LinkedInCompany.php @@ -25,10 +25,10 @@ class LinkedInCompany extends BridgeAbstract{ foreach($html->find('//*[@id="my-feed-post"]/li') as $element) { $title = $element->find('span.share-body', 0)->innertext; if ($title) { - $item = new \Item(); - $item->uri = $link; - $item->title = mb_substr(strip_tags($element->find('span.share-body', 0)->innertext), 0 ,100); - $item->content = strip_tags($element->find('span.share-body', 0)->innertext); + $item = array(); + $item['uri'] = $link; + $item['title'] = mb_substr(strip_tags($element->find('span.share-body', 0)->innertext), 0 ,100); + $item['content'] = strip_tags($element->find('span.share-body', 0)->innertext); $this->items[] = $item; $i++; } diff --git a/bridges/LolibooruBridge.php b/bridges/LolibooruBridge.php index 032ca84..b91168a 100644 --- a/bridges/LolibooruBridge.php +++ b/bridges/LolibooruBridge.php @@ -33,13 +33,13 @@ class LolibooruBridge extends BridgeAbstract{ foreach($data as $datai) { $json = json_decode($datai, TRUE); - $item = new \Item(); - $item->uri = 'http://lolibooru.moe/post/show/'.$json['id']; - $item->postid = $json['id']; - $item->timestamp = $json['created_at']; - $item->imageUri = $json['file_url']; - $item->title = 'Lolibooru | '.$json['id']; - $item->content = '
Tags: '.$json['tags']; + $item = array(); + $item['uri'] = 'http://lolibooru.moe/post/show/'.$json['id']; + $item['postid'] = $json['id']; + $item['timestamp'] = $json['created_at']; + $item['imageUri'] = $json['file_url']; + $item['title'] = 'Lolibooru | '.$json['id']; + $item['content'] = '
Tags: '.$json['tags']; $this->items[] = $item; } } diff --git a/bridges/MangareaderBridge.php b/bridges/MangareaderBridge.php index 64420cf..06f0524 100644 --- a/bridges/MangareaderBridge.php +++ b/bridges/MangareaderBridge.php @@ -128,18 +128,18 @@ class MangareaderBridge extends BridgeAbstract{ $chapters = $xpath->query("a[@class='chaptersrec']", $node); if (isset($manga) && $chapters->length >= 1){ - $item = new \Item(); - $item->uri = 'http://www.mangareader.net' . htmlspecialchars($manga->getAttribute('href')); - $item->title = htmlspecialchars($manga->nodeValue); + $item = array(); + $item['uri'] = 'http://www.mangareader.net' . htmlspecialchars($manga->getAttribute('href')); + $item['title'] = htmlspecialchars($manga->nodeValue); // Add each chapter to the feed - $item->content = ""; + $item['content'] = ""; foreach ($chapters as $chapter){ - if($item->content <> ""){ - $item->content .= "
"; + if($item['content'] <> ""){ + $item['content'] .= "
"; } - $item->content .= "" . htmlspecialchars($chapter->nodeValue) . ""; + $item['content'] .= "" . htmlspecialchars($chapter->nodeValue) . ""; } $this->items[] = $item; @@ -162,13 +162,13 @@ class MangareaderBridge extends BridgeAbstract{ $mangaimgelement = $xpath->query(".//*[@class='imgsearchresults']", $manga)->item(0)->getAttribute('style'); $thumbnail = substr($mangaimgelement, 22, strlen($mangaimgelement) - 24); - $item = new \Item(); - $item->title = htmlspecialchars($xpath->query(".//*[@class='manga_name']//a", $manga)->item(0)->nodeValue); - $item->uri = 'http://www.mangareader.net' . $xpath->query(".//*[@class='manga_name']//a", $manga)->item(0)->getAttribute('href'); - $item->author = htmlspecialchars($xpath->query("//*[@class='author_name']", $manga)->item(0)->nodeValue); - $item->chaptercount = $xpath->query(".//*[@class='chapter_count']", $manga)->item(0)->nodeValue; - $item->genre = htmlspecialchars($xpath->query(".//*[@class='manga_genre']", $manga)->item(0)->nodeValue); - $item->content = '' . $item->title . '

' . $item->genre . '

' . $item->chaptercount . '

'; + $item = array(); + $item['title'] = htmlspecialchars($xpath->query(".//*[@class='manga_name']//a", $manga)->item(0)->nodeValue); + $item['uri'] = 'http://www.mangareader.net' . $xpath->query(".//*[@class='manga_name']//a", $manga)->item(0)->getAttribute('href'); + $item['author'] = htmlspecialchars($xpath->query("//*[@class='author_name']", $manga)->item(0)->nodeValue); + $item['chaptercount'] = $xpath->query(".//*[@class='chapter_count']", $manga)->item(0)->nodeValue; + $item['genre'] = htmlspecialchars($xpath->query(".//*[@class='manga_genre']", $manga)->item(0)->nodeValue); + $item['content'] = '' . $item['title'] . '

' . $item['genre'] . '

' . $item['chaptercount'] . '

'; $this->items[] = $item; } } @@ -186,18 +186,18 @@ class MangareaderBridge extends BridgeAbstract{ $chapters = $xpath->query($query); foreach ($chapters as $chapter){ - $item = new \Item(); - $item->title = htmlspecialchars($xpath->query("td[1]", $chapter)->item(0)->nodeValue); - $item->uri = 'http://www.mangareader.net' . $xpath->query("td[1]/a", $chapter)->item(0)->getAttribute('href'); - $item->timestamp = strtotime($xpath->query("td[2]", $chapter)->item(0)->nodeValue); + $item = array(); + $item['title'] = htmlspecialchars($xpath->query("td[1]", $chapter)->item(0)->nodeValue); + $item['uri'] = 'http://www.mangareader.net' . $xpath->query("td[1]/a", $chapter)->item(0)->getAttribute('href'); + $item['timestamp'] = strtotime($xpath->query("td[2]", $chapter)->item(0)->nodeValue); array_unshift($this->items, $item); } } // Return some dummy-data if no content available if(count($this->items) == 0){ - $item = new \Item(); - $item->content = "

No updates available

"; + $item = array(); + $item['content'] = "

No updates available

"; $this->items[] = $item; } diff --git a/bridges/MilbooruBridge.php b/bridges/MilbooruBridge.php index 34fa145..8c08171 100644 --- a/bridges/MilbooruBridge.php +++ b/bridges/MilbooruBridge.php @@ -29,14 +29,14 @@ class MilbooruBridge extends BridgeAbstract{ foreach($html->find('div[class=shm-image-list] span[class=thumb]') as $element) { - $item = new \Item(); - $item->uri = 'http://sheslostcontrol.net/moe/shimmie/'.$element->find('a', 0)->href; - $item->postid = (int)preg_replace("/[^0-9]/",'', $element->find('a', 0)->getAttribute('data-post-id')); - $item->timestamp = time(); + $item = array(); + $item['uri'] = 'http://sheslostcontrol.net/moe/shimmie/'.$element->find('a', 0)->href; + $item['postid'] = (int)preg_replace("/[^0-9]/",'', $element->find('a', 0)->getAttribute('data-post-id')); + $item['timestamp'] = time(); $thumbnailUri = 'http://sheslostcontrol.net/moe/shimmie/'.$element->find('img', 0)->src; - $item->tags = $element->find('a', 0)->getAttribute('data-tags'); - $item->title = 'Milbooru | '.$item->postid; - $item->content = '
Tags: '.$item->tags; + $item['tags'] = $element->find('a', 0)->getAttribute('data-tags'); + $item['title'] = 'Milbooru | '.$item['postid']; + $item['content'] = '
Tags: '.$item['tags']; $this->items[] = $item; } } diff --git a/bridges/MondeDiploBridge.php b/bridges/MondeDiploBridge.php index e839104..bc03334 100644 --- a/bridges/MondeDiploBridge.php +++ b/bridges/MondeDiploBridge.php @@ -13,10 +13,10 @@ class MondeDiploBridge extends BridgeAbstract{ foreach($html->find('div.unarticle') as $article) { $element = $article->parent(); - $item = new Item(); - $item->uri = $this->uri . $element->href; - $item->title = $element->find('h3', 0)->plaintext; - $item->content = $element->find('div.dates_auteurs', 0)->plaintext . '
' . strstr($element->find('div', 0)->plaintext, $element->find('div.dates_auteurs', 0)->plaintext, true); + $item = array(); + $item['uri'] = $this->uri . $element->href; + $item['title'] = $element->find('h3', 0)->plaintext; + $item['content'] = $element->find('div.dates_auteurs', 0)->plaintext . '
' . strstr($element->find('div', 0)->plaintext, $element->find('div.dates_auteurs', 0)->plaintext, true); $this->items[] = $item; } } diff --git a/bridges/MsnMondeBridge.php b/bridges/MsnMondeBridge.php index 14d9a65..5d7d48d 100644 --- a/bridges/MsnMondeBridge.php +++ b/bridges/MsnMondeBridge.php @@ -10,8 +10,8 @@ class MsnMondeBridge extends BridgeAbstract{ private function MsnMondeExtractContent($url, &$item) { $html2 = $this->getSimpleHTMLDOM($url); - $item->content = $html2->find('#content', 0)->find('article', 0)->find('section', 0)->plaintext; - $item->timestamp = strtotime($html2->find('.authorinfo-txt', 0)->find('time', 0)->datetime); + $item['content'] = $html2->find('#content', 0)->find('article', 0)->find('section', 0)->plaintext; + $item['timestamp'] = strtotime($html2->find('.authorinfo-txt', 0)->find('time', 0)->datetime); } public function collectData(array $param){ @@ -19,10 +19,10 @@ class MsnMondeBridge extends BridgeAbstract{ $limit = 0; foreach($html->find('.smalla') as $article) { if($limit < 10) { - $item = new \Item(); - $item->title = utf8_decode($article->find('h4', 0)->innertext); - $item->uri = "http://www.msn.com" . utf8_decode($article->find('a', 0)->href); - $this->MsnMondeExtractContent($item->uri, $item); + $item = array(); + $item['title'] = utf8_decode($article->find('h4', 0)->innertext); + $item['uri'] = "http://www.msn.com" . utf8_decode($article->find('a', 0)->href); + $this->MsnMondeExtractContent($item['uri'], $item); $this->items[] = $item; $limit++; } diff --git a/bridges/MspabooruBridge.php b/bridges/MspabooruBridge.php index 7005a40..6528b3c 100644 --- a/bridges/MspabooruBridge.php +++ b/bridges/MspabooruBridge.php @@ -32,14 +32,14 @@ class MspabooruBridge extends BridgeAbstract{ foreach($html->find('div[class=content] span') as $element) { - $item = new \Item(); - $item->uri = 'http://mspabooru.com/'.$element->find('a', 0)->href; - $item->postid = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id')); - $item->timestamp = time(); + $item = array(); + $item['uri'] = 'http://mspabooru.com/'.$element->find('a', 0)->href; + $item['postid'] = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id')); + $item['timestamp'] = time(); $thumbnailUri = $element->find('img', 0)->src; - $item->tags = $element->find('img', 0)->getAttribute('alt'); - $item->title = 'Mspabooru | '.$item->postid; - $item->content = '
Tags: '.$item->tags; + $item['tags'] = $element->find('img', 0)->getAttribute('alt'); + $item['title'] = 'Mspabooru | '.$item['postid']; + $item['content'] = '
Tags: '.$item['tags']; $this->items[] = $item; } } diff --git a/bridges/NakedSecurityBridge.php b/bridges/NakedSecurityBridge.php index ed7d5dd..4020b70 100644 --- a/bridges/NakedSecurityBridge.php +++ b/bridges/NakedSecurityBridge.php @@ -56,12 +56,12 @@ class NakedSecurityBridge extends BridgeAbstract { $article_content = '

'.$article_summary.'

'.$article_content; //Build and add final item - $item = new \Item(); - $item->uri = $article_uri; - $item->title = $article_title; - $item->author = $article_html->find('a[rel=author]', 0)->plaintext; - $item->timestamp = strtotime($element->find('pubDate', 0)->plaintext); - $item->content = $article_content; + $item = array(); + $item['uri'] = $article_uri; + $item['title'] = $article_title; + $item['author'] = $article_html->find('a[rel=author]', 0)->plaintext; + $item['timestamp'] = strtotime($element->find('pubDate', 0)->plaintext); + $item['content'] = $article_content; $this->items[] = $item; $limit++; } diff --git a/bridges/NasaApodBridge.php b/bridges/NasaApodBridge.php index 5400f6f..c8b36c3 100644 --- a/bridges/NasaApodBridge.php +++ b/bridges/NasaApodBridge.php @@ -18,11 +18,11 @@ class NasaApodBridge extends BridgeAbstract{ for($i = 0; $i < 3;$i++) { $line = $list[$i]; - $item = new \Item(); + $item = array(); $uri_page = $html->find('a',$i + 3)->href; $uri = 'http://apod.nasa.gov/apod/'.$uri_page; - $item->uri = $uri; + $item['uri'] = $uri; $picture_html = $this->getSimpleHTMLDOM($uri); $picture_html_string = $picture_html->innertext; @@ -35,11 +35,11 @@ class NasaApodBridge extends BridgeAbstract{ //Extract date from the picture page $date = explode(" ", $picture_html->find('p',1)->innertext); - $item->timestamp = strtotime($date[4].$date[3].$date[2]); + $item['timestamp'] = strtotime($date[4].$date[3].$date[2]); //Other informations - $item->content = $media.'
'.$explanation; - $item->title = $picture_html->find('b',0)->innertext; + $item['content'] = $media.'
'.$explanation; + $item['title'] = $picture_html->find('b',0)->innertext; $this->items[] = $item; } } diff --git a/bridges/NeuviemeArtBridge.php b/bridges/NeuviemeArtBridge.php index 9cd69d0..fa6c8c7 100644 --- a/bridges/NeuviemeArtBridge.php +++ b/bridges/NeuviemeArtBridge.php @@ -42,12 +42,12 @@ class NeuviemeArtBridge extends BridgeAbstract { $article_content = StripWithDelimiters($article_content, ''); //Build and add final item - $item = new \Item(); - $item->uri = $article_uri; - $item->title = $article_title; - $item->author = $article_html->find('a[class=upp transition_fast upp]', 0)->plaintext; - $item->timestamp = strtotime($element->find('pubDate', 0)->plaintext); - $item->content = $article_content; + $item = array(); + $item['uri'] = $article_uri; + $item['title'] = $article_title; + $item['author'] = $article_html->find('a[class=upp transition_fast upp]', 0)->plaintext; + $item['timestamp'] = strtotime($element->find('pubDate', 0)->plaintext); + $item['content'] = $article_content; $this->items[] = $item; $limit++; } diff --git a/bridges/NextInpactBridge.php b/bridges/NextInpactBridge.php index 1c1186d..b04b972 100644 --- a/bridges/NextInpactBridge.php +++ b/bridges/NextInpactBridge.php @@ -31,12 +31,12 @@ class NextInpactBridge extends BridgeAbstract { foreach($html->find('item') as $element) { if($limit < 3) { - $item = new \Item(); - $item->title = $this->StripCDATA($element->find('title', 0)->innertext); - $item->uri = $this->StripCDATA($element->find('guid', 0)->plaintext); - $item->author = $this->StripCDATA($element->find('creator', 0)->innertext); - $item->timestamp = strtotime($element->find('pubDate', 0)->plaintext); - $item->content = $this->ExtractContent($item->uri); + $item = array(); + $item['title'] = $this->StripCDATA($element->find('title', 0)->innertext); + $item['uri'] = $this->StripCDATA($element->find('guid', 0)->plaintext); + $item['author'] = $this->StripCDATA($element->find('creator', 0)->innertext); + $item['timestamp'] = strtotime($element->find('pubDate', 0)->plaintext); + $item['content'] = $this->ExtractContent($item['uri']); $this->items[] = $item; $limit++; } diff --git a/bridges/NextgovBridge.php b/bridges/NextgovBridge.php index 5c086a1..684df8b 100644 --- a/bridges/NextgovBridge.php +++ b/bridges/NextgovBridge.php @@ -74,12 +74,12 @@ class NextgovBridge extends BridgeAbstract { .'

'.$article_subtitle.'

' .trim($contents); - $item = new \Item(); - $item->uri = $article_url; - $item->title = $article_title; - $item->author = $article_author; - $item->timestamp = $article_timestamp; - $item->content = $contents; + $item = array(); + $item['uri'] = $article_url; + $item['title'] = $article_title; + $item['author'] = $article_author; + $item['timestamp'] = $article_timestamp; + $item['content'] = $contents; $this->items[] = $item; $limit++; } diff --git a/bridges/NiceMatinBridge.php b/bridges/NiceMatinBridge.php index ac76eb4..30a1f34 100644 --- a/bridges/NiceMatinBridge.php +++ b/bridges/NiceMatinBridge.php @@ -34,11 +34,11 @@ class NiceMatinBridge extends BridgeAbstract{ $element_text = str_replace('', '', $element_text); $element = str_get_html($element_text); - $item = new \Item(); - $item->title = $element->find('title', 0)->innertext; - $item->uri = $element->find('url', 0)->innertext; - $item->timestamp = strtotime($element->find('pubDate', 0)->plaintext); - $item->content = $this->NiceMatinExtractContent($item->uri); + $item = array(); + $item['title'] = $element->find('title', 0)->innertext; + $item['uri'] = $element->find('url', 0)->innertext; + $item['timestamp'] = strtotime($element->find('pubDate', 0)->plaintext); + $item['content'] = $this->NiceMatinExtractContent($item['uri']); $this->items[] = $item; $limit++; } diff --git a/bridges/NovelUpdatesBridge.php b/bridges/NovelUpdatesBridge.php index a9dccde..0bf451a 100644 --- a/bridges/NovelUpdatesBridge.php +++ b/bridges/NovelUpdatesBridge.php @@ -33,12 +33,12 @@ class NovelUpdatesBridge extends BridgeAbstract{ $html = stristr($html, ''); //remove tbody $html = str_get_html(stristr($html, '', true)); //remove last tbody and get back as an array foreach($html->find('tr') as $element){ - $item = new \Item(); - $item->uri = $element->find('td', 2)->find('a', 0)->href; - $item->title = $element->find('td', 2)->find('a', 0)->plaintext; - $item->team = $element->find('td', 1)->innertext; - $item->timestamp = strtotime($element->find('td', 0)->plaintext); - $item->content = ''.$this->request.' - '.$item->title.' by '.$item->team.'
'.$fullhtml->find('div.seriesimg', 0)->innertext.''; + $item = array(); + $item['uri'] = $element->find('td', 2)->find('a', 0)->href; + $item['title'] = $element->find('td', 2)->find('a', 0)->plaintext; + $item['team'] = $element->find('td', 1)->innertext; + $item['timestamp'] = strtotime($element->find('td', 0)->plaintext); + $item['content'] = ''.$this->request.' - '.$item['title'].' by '.$item['team'].'
'.$fullhtml->find('div.seriesimg', 0)->innertext.''; $this->items[] = $item; } } diff --git a/bridges/NumeramaBridge.php b/bridges/NumeramaBridge.php index 0f8341a..d3bf548 100644 --- a/bridges/NumeramaBridge.php +++ b/bridges/NumeramaBridge.php @@ -24,11 +24,11 @@ class NumeramaBridge extends BridgeAbstract{ foreach($html->find('item') as $element) { if($limit < 5) { - $item = new \Item(); - $item->title = html_entity_decode(NumeramaStripCDATA($element->find('title', 0)->innertext)); - $item->author = NumeramaStripCDATA($element->find('dc:creator', 0)->innertext); - $item->uri = NumeramaStripCDATA($element->find('guid', 0)->plaintext); - $item->timestamp = strtotime($element->find('pubDate', 0)->plaintext); + $item = array(); + $item['title'] = html_entity_decode(NumeramaStripCDATA($element->find('title', 0)->innertext)); + $item['author'] = NumeramaStripCDATA($element->find('dc:creator', 0)->innertext); + $item['uri'] = NumeramaStripCDATA($element->find('guid', 0)->plaintext); + $item['timestamp'] = strtotime($element->find('pubDate', 0)->plaintext); $article_url = NumeramaStripCDATA($element->find('guid', 0)->plaintext); $article_html = $this->getSimpleHTMLDOM($article_url) or $this->returnServerError('Could not request Numerama: '.$article_url); @@ -36,7 +36,7 @@ class NumeramaBridge extends BridgeAbstract{ $contents = ''; // add post picture $contents = $contents.$article_html->find('article[class=post-content]', 0)->innertext; // extract the post - $item->content = $contents; + $item['content'] = $contents; $this->items[] = $item; $limit++; } diff --git a/bridges/OpenClassroomsBridge.php b/bridges/OpenClassroomsBridge.php index 3486693..93fb41f 100644 --- a/bridges/OpenClassroomsBridge.php +++ b/bridges/OpenClassroomsBridge.php @@ -41,10 +41,10 @@ class OpenClassroomsBridge extends BridgeAbstract{ $html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('Could not request OpenClassrooms.'); foreach($html->find('.courseListItem') as $element) { - $item = new \Item(); - $item->uri = 'https://openclassrooms.com'.$element->find('a', 0)->href; - $item->title = $element->find('h3', 0)->plaintext; - $item->content = $element->find('slidingItem__descriptionContent', 0)->plaintext; + $item = array(); + $item['uri'] = 'https://openclassrooms.com'.$element->find('a', 0)->href; + $item['title'] = $element->find('h3', 0)->plaintext; + $item['content'] = $element->find('slidingItem__descriptionContent', 0)->plaintext; $this->items[] = $item; } } diff --git a/bridges/ParuVenduImmoBridge.php b/bridges/ParuVenduImmoBridge.php index 8cab011..528cde1 100644 --- a/bridges/ParuVenduImmoBridge.php +++ b/bridges/ParuVenduImmoBridge.php @@ -78,10 +78,10 @@ class ParuVenduImmoBridge extends BridgeAbstract list($href) = explode('#', $element->href); - $item = new \Item(); - $item->uri = $this->uri.$href; - $item->title = $element->title; - $item->content = $img.$desc.$price; + $item = array(); + $item['uri'] = $this->uri.$href; + $item['title'] = $element->title; + $item['content'] = $img.$desc.$price; $this->items[] = $item; } diff --git a/bridges/PickyWallpapersBridge.php b/bridges/PickyWallpapersBridge.php index 66d97ff..b351291 100644 --- a/bridges/PickyWallpapersBridge.php +++ b/bridges/PickyWallpapersBridge.php @@ -54,11 +54,11 @@ class PickyWallpapersBridge extends BridgeAbstract { foreach($html->find('.items li img') as $element) { - $item = new \Item(); - $item->uri = str_replace('www', 'wallpaper', $baseUri).'/'.$this->resolution.'/'.basename($element->src); - $item->timestamp = time(); - $item->title = $element->alt; - $item->content = $item->title.'
'.$element.''; + $item = array(); + $item['uri'] = str_replace('www', 'wallpaper', $baseUri).'/'.$this->resolution.'/'.basename($element->src); + $item['timestamp'] = time(); + $item['title'] = $element->alt; + $item['content'] = $item['title'].'
'.$element.''; $this->items[] = $item; $num++; diff --git a/bridges/PinterestBridge.php b/bridges/PinterestBridge.php index 2cf2f00..eb33607 100644 --- a/bridges/PinterestBridge.php +++ b/bridges/PinterestBridge.php @@ -57,9 +57,9 @@ class PinterestBridge extends BridgeAbstract{ $img = $a->find('img', 0); - $item = new \Item(); - $item->uri = $this->getURI().$a->getAttribute('href'); - $item->content = ''; + $item = array(); + $item['uri'] = $this->getURI().$a->getAttribute('href'); + $item['content'] = ''; if (isset($this->query)) @@ -72,17 +72,17 @@ class PinterestBridge extends BridgeAbstract{ $username = $div->find('div.creditName', 0); $board = $div->find('div.creditTitle', 0); - $item->username =$username->innertext; - $item->fullname = $board->innertext; - $item->avatar = $avatar; + $item['username'] =$username->innertext; + $item['fullname'] = $board->innertext; + $item['avatar'] = $avatar; - $item->content .= '
'.$item->username.''; - $item->content .= '
'.$item->fullname; + $item['content'] .= '
'.$item['username'].''; + $item['content'] .= '
'.$item['fullname']; } - $item->title = $img->getAttribute('alt'); + $item['title'] = $img->getAttribute('alt'); - //$item->timestamp = $media->created_time; + //$item['timestamp'] = $media->created_time; $this->items[] = $item; } diff --git a/bridges/PlanetLibreBridge.php b/bridges/PlanetLibreBridge.php index 498195e..5c1c9bb 100644 --- a/bridges/PlanetLibreBridge.php +++ b/bridges/PlanetLibreBridge.php @@ -19,11 +19,11 @@ class PlanetLibreBridge extends BridgeAbstract{ $limit = 0; foreach($html->find('div.post') as $element) { if($limit < 5) { - $item = new \Item(); - $item->title = $element->find('h1', 0)->plaintext; - $item->uri = $element->find('a', 0)->href; - $item->timestamp = strtotime(str_replace('/', '-', $element->find('div[class="post-date"]', 0)->plaintext)); - $item->content = $this->PlanetLibreExtractContent($item->uri); + $item = array(); + $item['title'] = $element->find('h1', 0)->plaintext; + $item['uri'] = $element->find('a', 0)->href; + $item['timestamp'] = strtotime(str_replace('/', '-', $element->find('div[class="post-date"]', 0)->plaintext)); + $item['content'] = $this->PlanetLibreExtractContent($item['uri']); $this->items[] = $item; $limit++; } diff --git a/bridges/ProjectMGameBridge.php b/bridges/ProjectMGameBridge.php index 9f6d926..02fc621 100644 --- a/bridges/ProjectMGameBridge.php +++ b/bridges/ProjectMGameBridge.php @@ -16,18 +16,18 @@ class ProjectMGameBridge extends BridgeAbstract{ $html = $this->getSimpleHTMLDOM('http://projectmgame.com/en/') or $this->returnServerError('Error while downloading the Project M homepage'); foreach($html->find('article') as $article) { - $item = new \Item(); - $item->uri = 'http://projectmgame.com/en/'.$article->find('section div.info_block a',0)->href; - $item->title = $article->find('h1 p',0)->innertext; + $item = array(); + $item['uri'] = 'http://projectmgame.com/en/'.$article->find('section div.info_block a',0)->href; + $item['title'] = $article->find('h1 p',0)->innertext; $p_list = $article->find('section p'); $content = ''; foreach($p_list as $p) $content .= $p->innertext; - $item->content = $content; + $item['content'] = $content; // get publication date $str_date = $article->find('section div.info_block a',0)->innertext; - $item->timestamp = strtotime($str_date); + $item['timestamp'] = strtotime($str_date); $this->items[] = $item; } } diff --git a/bridges/RTBFBridge.php b/bridges/RTBFBridge.php index 4c6e6c8..5abea30 100644 --- a/bridges/RTBFBridge.php +++ b/bridges/RTBFBridge.php @@ -25,15 +25,15 @@ class RTBFBridge extends BridgeAbstract { foreach($html->find('section[id!=widget-ml-avoiraussi-] .rtbf-media-grid article') as $element) { if($count < $limit) { - $item = new \Item(); - $item->id = $element->getAttribute('data-id'); - $item->uri = 'http://www.rtbf.be/auvio/detail?id='.$item->id; + $item = array(); + $item['id'] = $element->getAttribute('data-id'); + $item['uri'] = 'http://www.rtbf.be/auvio/detail?id='.$item['id']; $thumbnailUriSrcSet = explode(',', $element->find('figure .www-img-16by9 img', 0)->getAttribute('data-srcset')); $thumbnailUriLastSrc = end($thumbnailUriSrcSet); $thumbnailUri = explode(' ', $thumbnailUriLastSrc)[0]; - $item->title = trim($element->find('h3',0)->plaintext) . ' - ' . trim($element->find('h4',0)->plaintext); - $item->timestamp = strtotime($element->find('time', 0)->getAttribute('datetime')); - $item->content = ''; + $item['title'] = trim($element->find('h3',0)->plaintext) . ' - ' . trim($element->find('h4',0)->plaintext); + $item['timestamp'] = strtotime($element->find('time', 0)->getAttribute('datetime')); + $item['content'] = ''; $this->items[] = $item; $count++; } diff --git a/bridges/Releases3DSBridge.php b/bridges/Releases3DSBridge.php index 3da44d4..2242e92 100644 --- a/bridges/Releases3DSBridge.php +++ b/bridges/Releases3DSBridge.php @@ -103,12 +103,12 @@ class Releases3DSBridge extends BridgeAbstract { .''; //Build and add final item with the above three sections - $item = new \Item(); - $item->title = $name; - $item->author = $publisher; - $item->timestamp = $ignDate; - $item->uri = empty($ignLink) ? $searchLinkDuckDuckGo : $ignLink; - $item->content = $ignDescription.$releaseDescription.$releaseSearchLinks; + $item = array(); + $item['title'] = $name; + $item['author'] = $publisher; + $item['timestamp'] = $ignDate; + $item['uri'] = empty($ignLink) ? $searchLinkDuckDuckGo : $ignLink; + $item['content'] = $ignDescription.$releaseDescription.$releaseSearchLinks; $this->items[] = $item; $limit++; } diff --git a/bridges/ReporterreBridge.php b/bridges/ReporterreBridge.php index 4feae86..3c1672b 100644 --- a/bridges/ReporterreBridge.php +++ b/bridges/ReporterreBridge.php @@ -31,11 +31,11 @@ class ReporterreBridge extends BridgeAbstract{ foreach($html->find('item') as $element) { if($limit < 5) { - $item = new \Item(); - $item->title = html_entity_decode($element->find('title', 0)->plaintext); - $item->timestamp = strtotime($element->find('dc:date', 0)->plaintext); - $item->uri = $element->find('guid', 0)->innertext; - $item->content = html_entity_decode($this->ExtractContentReporterre($item->uri)); + $item = array(); + $item['title'] = html_entity_decode($element->find('title', 0)->plaintext); + $item['timestamp'] = strtotime($element->find('dc:date', 0)->plaintext); + $item['uri'] = $element->find('guid', 0)->innertext; + $item['content'] = html_entity_decode($this->ExtractContentReporterre($item['uri'])); $this->items[] = $item; $limit++; } diff --git a/bridges/Rue89Bridge.php b/bridges/Rue89Bridge.php index 4548831..dcf405e 100644 --- a/bridges/Rue89Bridge.php +++ b/bridges/Rue89Bridge.php @@ -30,12 +30,12 @@ class Rue89Bridge extends BridgeAbstract{ $datas = $this->rue89getDatas(str_replace('#commentaires', '', ($element->find('comments', 0)->plaintext))); - $item = new \Item(); - $item->title = $datas["title"]; - $item->author = $datas["author"][0]["name"]; - $item->timestamp = $datas["updated"]; - $item->content = $datas["body"]; - $item->uri = $datas["url"]; + $item = array(); + $item['title'] = $datas["title"]; + $item['author'] = $datas["author"][0]["name"]; + $item['timestamp'] = $datas["updated"]; + $item['content'] = $datas["body"]; + $item['uri'] = $datas["url"]; $this->items[] = $item; diff --git a/bridges/Rule34Bridge.php b/bridges/Rule34Bridge.php index 9636240..e0bc4f1 100644 --- a/bridges/Rule34Bridge.php +++ b/bridges/Rule34Bridge.php @@ -32,14 +32,14 @@ class Rule34Bridge extends BridgeAbstract{ foreach($html->find('div[class=content] span') as $element) { - $item = new \Item(); - $item->uri = 'http://rule34.xxx/'.$element->find('a', 0)->href; - $item->postid = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id')); - $item->timestamp = time(); + $item = array(); + $item['uri'] = 'http://rule34.xxx/'.$element->find('a', 0)->href; + $item['postid'] = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id')); + $item['timestamp'] = time(); $thumbnailUri = $element->find('img', 0)->src; - $item->tags = $element->find('img', 0)->getAttribute('alt'); - $item->title = 'Rule34 | '.$item->postid; - $item->content = '
Tags: '.$item->tags; + $item['tags'] = $element->find('img', 0)->getAttribute('alt'); + $item['title'] = 'Rule34 | '.$item['postid']; + $item['content'] = '
Tags: '.$item['tags']; $this->items[] = $item; } } diff --git a/bridges/Rule34pahealBridge.php b/bridges/Rule34pahealBridge.php index 43d6a71..dc56965 100644 --- a/bridges/Rule34pahealBridge.php +++ b/bridges/Rule34pahealBridge.php @@ -30,14 +30,14 @@ class Rule34pahealBridge extends BridgeAbstract{ foreach($html->find('div[class=shm-image-list] div[class=shm-thumb]') as $element) { - $item = new \Item(); - $item->uri = 'http://rule34.paheal.net'.$element->find('a', 0)->href; - $item->postid = (int)preg_replace("/[^0-9]/",'', $element->find('img', 0)->getAttribute('id')); - $item->timestamp = time(); + $item = array(); + $item['uri'] = 'http://rule34.paheal.net'.$element->find('a', 0)->href; + $item['postid'] = (int)preg_replace("/[^0-9]/",'', $element->find('img', 0)->getAttribute('id')); + $item['timestamp'] = time(); $thumbnailUri = $element->find('img', 0)->src; - $item->tags = $element->getAttribute('data-tags'); - $item->title = 'Rule34paheal | '.$item->postid; - $item->content = '
Tags: '.$item->tags; + $item['tags'] = $element->getAttribute('data-tags'); + $item['title'] = 'Rule34paheal | '.$item['postid']; + $item['content'] = '
Tags: '.$item['tags']; $this->items[] = $item; } } diff --git a/bridges/SafebooruBridge.php b/bridges/SafebooruBridge.php index a3e3ec8..3d3b638 100644 --- a/bridges/SafebooruBridge.php +++ b/bridges/SafebooruBridge.php @@ -32,14 +32,14 @@ class SafebooruBridge extends BridgeAbstract{ foreach($html->find('div[class=content] span') as $element) { - $item = new \Item(); - $item->uri = 'http://safebooru.org/'.$element->find('a', 0)->href; - $item->postid = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id')); - $item->timestamp = time(); + $item = array(); + $item['uri'] = 'http://safebooru.org/'.$element->find('a', 0)->href; + $item['postid'] = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id')); + $item['timestamp'] = time(); $thumbnailUri = $element->find('img', 0)->src; - $item->tags = $element->find('img', 0)->getAttribute('alt'); - $item->title = 'Safebooru | '.$item->postid; - $item->content = '
Tags: '.$item->tags; + $item['tags'] = $element->find('img', 0)->getAttribute('alt'); + $item['title'] = 'Safebooru | '.$item['postid']; + $item['content'] = '
Tags: '.$item['tags']; $this->items[] = $item; } } diff --git a/bridges/SakugabooruBridge.php b/bridges/SakugabooruBridge.php index e2ce7f9..03e44ac 100644 --- a/bridges/SakugabooruBridge.php +++ b/bridges/SakugabooruBridge.php @@ -34,13 +34,13 @@ class SakugabooruBridge extends BridgeAbstract{ foreach($data as $datai) { $json = json_decode($datai, TRUE); - $item = new \Item(); - $item->uri = 'http://sakuga.yshi.org/post/show/'.$json['id']; - $item->postid = $json['id']; - $item->timestamp = $json['created_at']; - $item->imageUri = $json['file_url']; - $item->title = 'Sakugabooru | '.$json['id']; - $item->content = '
Tags: '.$json['tags']; + $item = array(); + $item['uri'] = 'http://sakuga.yshi.org/post/show/'.$json['id']; + $item['postid'] = $json['id']; + $item['timestamp'] = $json['created_at']; + $item['imageUri'] = $json['file_url']; + $item['title'] = 'Sakugabooru | '.$json['id']; + $item['content'] = '
Tags: '.$json['tags']; $this->items[] = $item; } } diff --git a/bridges/ScmbBridge.php b/bridges/ScmbBridge.php index 367a6e4..13286f9 100644 --- a/bridges/ScmbBridge.php +++ b/bridges/ScmbBridge.php @@ -15,9 +15,9 @@ class ScmbBridge extends BridgeAbstract{ $html = $this->getSimpleHTMLDOM('http://secouchermoinsbete.fr/') or $this->returnServerError('Could not request Se Coucher Moins Bete.'); foreach($html->find('article') as $article) { - $item = new \Item(); - $item->uri = 'http://secouchermoinsbete.fr'.$article->find('p.summary a',0)->href; - $item->title = $article->find('header h1 a',0)->innertext; + $item = array(); + $item['uri'] = 'http://secouchermoinsbete.fr'.$article->find('p.summary a',0)->href; + $item['title'] = $article->find('header h1 a',0)->innertext; $article->find('span.read-more',0)->outertext=''; // remove text "En savoir plus" from anecdote content $content = $article->find('p.summary a',0)->innertext; @@ -29,10 +29,10 @@ class ScmbBridge extends BridgeAbstract{ list($y, $m, $d) = explode('-', $date); list($h, $i) = explode(':', $time); $timestamp = mktime($h,$i,0,$m,$d,$y); - $item->timestamp = $timestamp; + $item['timestamp'] = $timestamp; - $item->content = $content; + $item['content'] = $content; $this->items[] = $item; } } diff --git a/bridges/ScoopItBridge.php b/bridges/ScoopItBridge.php index 60d0416..adb49ee 100644 --- a/bridges/ScoopItBridge.php +++ b/bridges/ScoopItBridge.php @@ -26,10 +26,10 @@ class ScoopItBridge extends BridgeAbstract{ $html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('Could not request ScoopIt. for : ' . $link); foreach($html->find('div.post-view') as $element) { - $item = new Item(); - $item->uri = $element->find('a', 0)->href; - $item->title = preg_replace('~[[:cntrl:]]~', '', $element->find('div.tCustomization_post_title',0)->plaintext); - $item->content = preg_replace('~[[:cntrl:]]~', '', $element->find('div.tCustomization_post_description', 0)->plaintext); + $item = array(); + $item['uri'] = $element->find('a', 0)->href; + $item['title'] = preg_replace('~[[:cntrl:]]~', '', $element->find('div.tCustomization_post_title',0)->plaintext); + $item['content'] = preg_replace('~[[:cntrl:]]~', '', $element->find('div.tCustomization_post_description', 0)->plaintext); $this->items[] = $item; } } else { diff --git a/bridges/SensCritiqueBridge.php b/bridges/SensCritiqueBridge.php index a051ea2..c400106 100644 --- a/bridges/SensCritiqueBridge.php +++ b/bridges/SensCritiqueBridge.php @@ -109,16 +109,16 @@ class SensCritiqueBridge extends BridgeAbstract { } foreach ($list->find('li') as $movie) { - $item = new \Item(); - $item->author = htmlspecialchars_decode($movie->find('.elco-title a', 0)->plaintext, ENT_QUOTES) . ' ' . $movie->find('.elco-date', 0)->plaintext; - $item->title = $movie->find('.elco-title a', 0)->plaintext . ' ' . $movie->find('.elco-date', 0)->plaintext; - $item->content = '' . $movie->find('.elco-original-title', 0)->plaintext . '

' . + $item = array(); + $item['author'] = htmlspecialchars_decode($movie->find('.elco-title a', 0)->plaintext, ENT_QUOTES) . ' ' . $movie->find('.elco-date', 0)->plaintext; + $item['title'] = $movie->find('.elco-title a', 0)->plaintext . ' ' . $movie->find('.elco-date', 0)->plaintext; + $item['content'] = '' . $movie->find('.elco-original-title', 0)->plaintext . '

' . $movie->find('.elco-baseline', 0)->plaintext . '
' . $movie->find('.elco-baseline', 1)->plaintext . '

' . $movie->find('.elco-description', 0)->plaintext . '

' . trim($movie->find('.erra-ratings .erra-global', 0)->plaintext) . ' / 10'; - $item->id = $this->getURI() . $movie->find('.elco-title a', 0)->href; - $item->uri = $this->getURI() . $movie->find('.elco-title a', 0)->href; + $item['id'] = $this->getURI() . $movie->find('.elco-title a', 0)->href; + $item['uri'] = $this->getURI() . $movie->find('.elco-title a', 0)->href; $this->items[] = $item; } } diff --git a/bridges/Sexactu.php b/bridges/Sexactu.php index 379ff50..65305c7 100644 --- a/bridges/Sexactu.php +++ b/bridges/Sexactu.php @@ -23,30 +23,30 @@ $replace = array('January', 'February', 'March', 'April', 'May', 'June', 'July', // if you ask about that method_exists, there seems to be a bug in simple html dom // see stackoverflow for more details : http://stackoverflow.com/a/10828479/15619 if(is_object($element)) { - $item = new Item(); + $item = array(); // various metadata $titleBlock = $element->find('.title-holder', 0); if(is_object($titleBlock)) { $titleDetails = $titleBlock->find('.article-title',0); $titleData = $titleDetails->find('h2', 0)->find('a',0); $titleTimestamp =$titleDetails->find('h4',0); - $item->title = $this->correctCase(trim($titleData->innertext)); - $item->uri = $this->uri.$titleData->href; + $item['title'] = $this->correctCase(trim($titleData->innertext)); + $item['uri'] = $this->uri.$titleData->href; // Fugly date parsing due to the fact my DNS-323 doesn't support php intl extension $dateText = $titleTimestamp->innertext; $dateText = substr($dateText, strpos($dateText,',')+1); $dateText = str_replace($find, $replace, strtolower($dateText)); $date = strtotime($dateText); - $item->timestamp = $date; + $item['timestamp'] = $date; - $item->author = "Maïa Mazaurette"; + $item['author'] = "Maïa Mazaurette"; $elementText = $element->find('.text-container', 0); // don't forget to replace images server url with gq one foreach($elementText->find('img') as $image) { $image->src = $this->uri.$image->src; } - $item->content = $elementText->innertext; + $item['content'] = $elementText->innertext; $this->items[] = $item; } diff --git a/bridges/ShanaprojectBridge.php b/bridges/ShanaprojectBridge.php index 9980242..641e4fa 100644 --- a/bridges/ShanaprojectBridge.php +++ b/bridges/ShanaprojectBridge.php @@ -99,12 +99,12 @@ class ShanaprojectBridge extends BridgeAbstract { $this->returnServerError('Could not find anime headers!'); foreach($animes as $anime){ - $item = new \Item(); - $item->title = $this->ExtractAnimeTitle($anime); - $item->author = $this->ExtractAnimeAuthor($anime); - $item->uri = $this->ExtractAnimeURI($anime); - $item->timestamp = $this->ExtractAnimeTimestamp($anime); - $item->content = $this->BuildAnimeContent($anime); + $item = array(); + $item['title'] = $this->ExtractAnimeTitle($anime); + $item['author'] = $this->ExtractAnimeAuthor($anime); + $item['uri'] = $this->ExtractAnimeURI($anime); + $item['timestamp'] = $this->ExtractAnimeTimestamp($anime); + $item['content'] = $this->BuildAnimeContent($anime); $this->items[] = $item; } } diff --git a/bridges/SiliconBridge.php b/bridges/SiliconBridge.php index 956f972..1ef075a 100644 --- a/bridges/SiliconBridge.php +++ b/bridges/SiliconBridge.php @@ -45,12 +45,12 @@ class SiliconBridge extends BridgeAbstract { } //Build and add final item - $item = new \Item(); - $item->uri = $article_uri; - $item->title = StripCDATA($element->find('title', 0)->innertext); - $item->author = StripCDATA($element->find('dc:creator', 0)->innertext); - $item->timestamp = strtotime($element->find('pubDate', 0)->plaintext); - $item->content = $article_content; + $item = array(); + $item['uri'] = $article_uri; + $item['title'] = StripCDATA($element->find('title', 0)->innertext); + $item['author'] = StripCDATA($element->find('dc:creator', 0)->innertext); + $item['timestamp'] = strtotime($element->find('pubDate', 0)->plaintext); + $item['content'] = $article_content; $this->items[] = $item; $limit++; } diff --git a/bridges/SoundcloudBridge.php b/bridges/SoundcloudBridge.php index 64df079..7950cef 100644 --- a/bridges/SoundcloudBridge.php +++ b/bridges/SoundcloudBridge.php @@ -37,12 +37,12 @@ class SoundCloudBridge extends BridgeAbstract{ } for ($i=0; $i < 10; $i++) { - $item = new \Item(); - $item->author = $tracks[$i]->user->username .' - '. $tracks[$i]->title; - $item->title = $tracks[$i]->user->username .' - '. $tracks[$i]->title; - $item->content = '