', $item_desc->innertext);
$item_desc = '';
@@ -86,7 +77,6 @@ class T411Bridge extends BridgeAbstract {
$item->title = $item_title;
$item->author = $item_author;
$item->timestamp = $item_date;
- $item->thumbnailUri = $item_image;
$item->content = $item_desc;
$this->items[] = $item;
$limit++;
@@ -94,18 +84,5 @@ class T411Bridge extends BridgeAbstract {
}
}
}
-
- public function getName() {
- return "T411 Bridge";
- }
-
- public function getURI() {
- return 'https://t411.ch/';
- }
-
- public function getCacheDuration() {
- return 3600; // 1 hour
- }
-
}
diff --git a/bridges/TagBoardBridge.php b/bridges/TagBoardBridge.php
index 30a950b3..b2a94ea6 100644
--- a/bridges/TagBoardBridge.php
+++ b/bridges/TagBoardBridge.php
@@ -7,7 +7,7 @@ class TagBoardBridge extends BridgeAbstract{
$this->name = "TagBoard";
$this->uri = "http://www.TagBoard.com";
$this->description = "Returns most recent results from TagBoard.";
- $this->update = "2014-09-10";
+ $this->update = "2016-08-09";
$this->parameters[] =
'[
@@ -31,9 +31,9 @@ class TagBoardBridge extends BridgeAbstract{
$item = new Item();
$item->uri = $element->{'permalink'};
$item->title = $element->{'text'};
- $item->thumbnailUri = $element->{'photos'}[0]->{'m'};
- if (isset($item->thumbnailUri)) {
- $item->content = '
';
+ $thumbnailUri = $element->{'photos'}[0]->{'m'};
+ if (isset($thumbnailUri)) {
+ $item->content = '
';
}else{
$item->content = $element->{'html'};
}
@@ -45,10 +45,6 @@ class TagBoardBridge extends BridgeAbstract{
return 'tagboard - ' .$this->request;
}
- public function getURI(){
- return 'http://TagBoard.com';
- }
-
public function getCacheDuration(){
return 21600; // 6 hours
}
diff --git a/bridges/TbibBridge.php b/bridges/TbibBridge.php
index 7490c869..e624c698 100644
--- a/bridges/TbibBridge.php
+++ b/bridges/TbibBridge.php
@@ -7,7 +7,7 @@ class TbibBridge extends BridgeAbstract{
$this->name = "Tbib";
$this->uri = "http://tbib.org/";
$this->description = "Returns images from given page";
- $this->update = "2014-05-25";
+ $this->update = "2016-08-09";
$this->parameters[] =
'[
@@ -41,22 +41,14 @@ class TbibBridge extends BridgeAbstract{
$item->uri = 'http://tbib.org/'.$element->find('a', 0)->href;
$item->postid = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('id'));
$item->timestamp = time();
- $item->thumbnailUri = $element->find('img', 0)->src;
+ $thumbnailUri = $element->find('img', 0)->src;
$item->tags = $element->find('img', 0)->getAttribute('alt');
$item->title = 'Tbib | '.$item->postid;
- $item->content = '
Tags: '.$item->tags;
+ $item->content = '
Tags: '.$item->tags;
$this->items[] = $item;
}
}
- public function getName(){
- return 'Tbib';
- }
-
- public function getURI(){
- return 'http://tbib.org/';
- }
-
public function getCacheDuration(){
return 1800; // 30 minutes
}
diff --git a/bridges/TheCodingLoveBridge.php b/bridges/TheCodingLoveBridge.php
index e9eef5bf..e2ff3602 100644
--- a/bridges/TheCodingLoveBridge.php
+++ b/bridges/TheCodingLoveBridge.php
@@ -7,7 +7,7 @@ class TheCodingLoveBridge extends BridgeAbstract{
$this->name = "The Coding Love";
$this->uri = "http://thecodinglove.com/";
$this->description = "The Coding Love";
- $this->update = "04/02/2015";
+ $this->update = "2016-08-09";
}
@@ -37,7 +37,7 @@ class TheCodingLoveBridge extends BridgeAbstract{
if($pos > 0)
{
$auteur = trim(str_replace("*/", "", substr($auteur->innertext, ($pos + 2))));
- $item->name = $auteur;
+ $item->author = $auteur;
}
@@ -49,19 +49,7 @@ class TheCodingLoveBridge extends BridgeAbstract{
}
}
- public function getName(){
- return 'The Coding Love';
- }
-
- public function getURI(){
- return 'http://thecodinglove.com/';
- }
-
public function getCacheDuration(){
return 7200; // 2h hours
}
- public function getDescription(){
- return "The Coding Love via rss-bridge";
- }
}
-?>
diff --git a/bridges/TheHackerNewsBridge.php b/bridges/TheHackerNewsBridge.php
new file mode 100644
index 00000000..ab43fadf
--- /dev/null
+++ b/bridges/TheHackerNewsBridge.php
@@ -0,0 +1,76 @@
+maintainer = 'ORelio';
+ $this->name = 'The Hacker News Bridge';
+ $this->uri = 'https://thehackernews.com/';
+ $this->description = 'Cyber Security, Hacking, Technology News.';
+ $this->update = '2016-08-09';
+
+ }
+
+ public function collectData(array $param) {
+
+ function StripWithDelimiters($string, $start, $end) {
+ while (strpos($string, $start) !== false) {
+ $section_to_remove = substr($string, strpos($string, $start));
+ $section_to_remove = substr($section_to_remove, 0, strpos($section_to_remove, $end) + strlen($end));
+ $string = str_replace($section_to_remove, '', $string);
+ } return $string;
+ }
+
+ function StripRecursiveHTMLSection($string, $tag_name, $tag_start) {
+ $open_tag = '<'.$tag_name;
+ $close_tag = ''.$tag_name.'>';
+ $close_tag_length = strlen($close_tag);
+ if (strpos($tag_start, $open_tag) === 0) {
+ while (strpos($string, $tag_start) !== false) {
+ $max_recursion = 100;
+ $section_to_remove = null;
+ $section_start = strpos($string, $tag_start);
+ $search_offset = $section_start;
+ do {
+ $max_recursion--;
+ $section_end = strpos($string, $close_tag, $search_offset);
+ $search_offset = $section_end + $close_tag_length;
+ $section_to_remove = substr($string, $section_start, $section_end - $section_start + $close_tag_length);
+ $open_tag_count = substr_count($section_to_remove, $open_tag);
+ $close_tag_count = substr_count($section_to_remove, $close_tag);
+ } while ($open_tag_count > $close_tag_count && $max_recursion > 0);
+ $string = str_replace($section_to_remove, '', $string);
+ }
+ }
+ return $string;
+ }
+
+ $html = $this->file_get_html($this->getURI()) or $this->returnError('Could not request TheHackerNews: '.$this->getURI(), 500);
+ $limit = 0;
+
+ foreach ($html->find('article') as $element) {
+ if ($limit < 5) {
+
+ $article_url = $element->find('a.entry-title', 0)->href;
+ $article_author = trim($element->find('span.vcard', 0)->plaintext);
+ $article_title = $element->find('a.entry-title', 0)->plaintext;
+ $article_timestamp = strtotime($element->find('span.updated', 0)->plaintext);
+ $article = $this->file_get_html($article_url) or $this->returnError('Could not request TheHackerNews: '.$article_url, 500);
+
+ $contents = $article->find('div.articlebodyonly', 0)->innertext;
+ $contents = StripRecursiveHTMLSection($contents, 'div', '
');
+
+ $item = new \Item();
+ $item->uri = $article_url;
+ $item->title = $article_title;
+ $item->author = $article_author;
+ $item->timestamp = $article_timestamp;
+ $item->content = trim($contents);
+ $this->items[] = $item;
+ $limit++;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/bridges/TheOatMealBridge.php b/bridges/TheOatMealBridge.php
index 9e8a0ff0..e65a09b6 100644
--- a/bridges/TheOatMealBridge.php
+++ b/bridges/TheOatMealBridge.php
@@ -10,7 +10,7 @@ class TheOatmealBridge extends RssExpander{
$this->name = "The Oatmeal";
$this->uri = "http://theoatmeal.com/";
$this->description = "Un petit site de dessins assez rigolos";
- $this->update = "2015-07-03";
+ $this->update = "2016-08-09";
}
@@ -53,9 +53,9 @@ class TheOatmealBridge extends RssExpander{
$item->content = $content->innertext;
$this->message("dc content is ".var_export($dc, true));
- $item->name = (string) $dc->creator;
+ $item->author = (string) $dc->creator;
$item->timestamp = DateTime::createFromFormat(DateTime::ISO8601, $dc->date)->getTimestamp();
- $this->message("writtem by ".$item->name." on ".$item->timestamp);
+ $this->message("writtem by ".$item->author." on ".$item->timestamp);
return $item;
}
diff --git a/bridges/ThePirateBayBridge.php b/bridges/ThePirateBayBridge.php
index 6f6d318a..4e2bd057 100644
--- a/bridges/ThePirateBayBridge.php
+++ b/bridges/ThePirateBayBridge.php
@@ -7,7 +7,7 @@ class ThePirateBayBridge extends BridgeAbstract{
$this->name = "The Pirate Bay";
$this->uri = "https://thepiratebay.org/";
$this->description = "Returns results for the keywords. You can put several list of keywords by separating them with a semicolon (e.g. \"one show;another show\")";
- $this->update = "2015-01-09";
+ $this->update = "2016-08-09";
$this->parameters[] =
'[
@@ -80,16 +80,4 @@ class ThePirateBayBridge extends BridgeAbstract{
}
}
}
-
- public function getName(){
- return 'The Pirate Bay';
- }
-
- public function getURI(){
- return 'https://thepiratebay.org/';
- }
-
- public function getCacheDuration(){
- return 3600; // 1 hour
- }
}
diff --git a/bridges/TuxboardBridge.php b/bridges/TuxboardBridge.php
deleted file mode 100644
index 63a1ed4b..00000000
--- a/bridges/TuxboardBridge.php
+++ /dev/null
@@ -1,64 +0,0 @@
-maintainer = "superbaillot.net";
- $this->name = "Tuxboard";
- $this->uri = "http://www.tuxboard.com/";
- $this->description = "Tuxboard";
- $this->update = "2014-07-08";
-
- }
-
- public function collectData(array $param){
-
- function StripCDATA($string) {
- $string = str_replace('', '', $string);
- return $string;
- }
-
- function ExtractContent($url) {
- $html2 = $this->file_get_html($url);
- $text = $html2->find('article#page', 0)->innertext;
- $text = preg_replace('@@si', '', $text);
- return $text;
- }
-
- $html = $this->file_get_html('http://www.tuxboard.com/feed/atom/') or $this->returnError('Could not request Tuxboard.', 404);
- $limit = 0;
-
- foreach($html->find('entry') as $element) {
- if($limit < 10) {
- $item = new \Item();
- $item->title = StripCDATA($element->find('title', 0)->innertext);
- $item->uri = $element->find('link', 0)->href;
- $item->timestamp = strtotime($element->find('published', 0)->plaintext);
- $item->content = ExtractContent($item->uri);
- $this->items[] = $item;
- $limit++;
- }
- }
-
-
-
- }
-
- public function getName(){
- return 'Tuxboard';
- }
-
- public function getURI(){
- return 'http://www.tuxboard.com';
- }
-
- public function getDescription(){
- return 'Tuxboard via rss-bridge';
- }
-
- public function getCacheDuration(){
- return 3600; // 1 hour
- }
-}
-?>
diff --git a/bridges/TwitchApiBridge.php b/bridges/TwitchApiBridge.php
index c3dbdefb..789324aa 100644
--- a/bridges/TwitchApiBridge.php
+++ b/bridges/TwitchApiBridge.php
@@ -13,7 +13,7 @@ class TwitchApiBridge extends BridgeAbstract{
$this->name = "Twitch API Bridge";
$this->uri = "http://www.twitch.tv";
$this->description = "Returns the newest broadcasts or highlights by channel name using the Twitch API (v3)";
- $this->update = "2016-01-09";
+ $this->update = "2016-08-09";
$this->parameters["Get channel without limit"] =
'[
@@ -140,10 +140,9 @@ class TwitchApiBridge extends BridgeAbstract{
$item = new \Item();
$item->id = $video->_id;
$item->uri = $video->url;
- $item->thumbnailUri = $video->preview;
$item->title = htmlspecialchars($video->title);
$item->timestamp = strtotime($video->recorded_at);
- $item->content = '
' . $item->title . ' ';
+ $item->content = '
' . $item->title . ' ';
$this->items[] = $item;
// Stop once the number of requested items is reached
@@ -165,10 +164,6 @@ class TwitchApiBridge extends BridgeAbstract{
return (!empty($this->channel) ? $this->channel . ' - ' : '') . 'Twitch API Bridge';
}
- public function getURI(){
- return 'https://www.twitch.tv';
- }
-
public function getCacheDuration(){
return 10800; // 3 hours
}
diff --git a/bridges/TwitterBridge.php b/bridges/TwitterBridge.php
index c116713e..04b0d0e9 100644
--- a/bridges/TwitterBridge.php
+++ b/bridges/TwitterBridge.php
@@ -1,22 +1,35 @@
maintainer = "mitsukarenai";
$this->name = "Twitter Bridge";
- $this->uri = "http://twitter.com/";
- $this->description = "Returns user timelines or keyword/hashtag search results (without using their API).";
- $this->update = "2014-05-25";
+ $this->uri = "https://twitter.com/";
+ $this->description = "Returns tweets by keyword/hashtag or user name";
+ $this->update = "2016-08-10";
+
+ $this->parameters["global"] =
+ '[
+ {
+ "name" : "Hide profile pictures",
+ "identifier" : "pic",
+ "type" : "checkbox",
+ "required" : "false",
+ "exampleValue" : "checked",
+ "title" : "Activate to hide profile pictures in content"
+ }
+ ]';
$this->parameters["By keyword or hashtag"] =
'[
{
"name" : "Keyword or #hashtag",
- "identifier" : "q"
+ "identifier" : "q",
+ "type" : "text",
+ "required" : "true",
+ "exampleValue" : "rss-bridge, #rss-bridge",
+ "title" : "Insert a keyword or hashtag"
}
]';
@@ -24,61 +37,96 @@ class TwitterBridge extends BridgeAbstract{
'[
{
"name" : "username",
- "identifier" : "u"
+ "identifier" : "u",
+ "type" : "text",
+ "required" : "true",
+ "exampleValue" : "sebsauvage",
+ "title" : "Insert a user name"
}
]';
}
- public function collectData(array $param){
- $html = '';
- if (isset($param['q'])) { /* keyword search mode */
- $this->request = $param['q'];
- $html = $this->file_get_html('https://twitter.com/search?q='.urlencode($this->request).'&f=tweets') or $this->returnError('No results for this query.', 404);
- }
- elseif (isset($param['u'])) { /* user timeline mode */
- $this->request = $param['u'];
- $html = $this->file_get_html('http://twitter.com/'.urlencode($this->request)) or $this->returnError('Requested username can\'t be found.', 404);
- }
- else {
- $this->returnError('You must specify a keyword (?q=...) or a Twitter username (?u=...).', 400);
- }
-
- foreach($html->find('div.js-stream-tweet') as $tweet) {
- $item = new \Item();
- $item->username = $tweet->getAttribute('data-screen-name'); // extract username and sanitize
- $item->fullname = $tweet->getAttribute('data-name'); // extract fullname (pseudonym)
- $item->avatar = $tweet->find('img', 0)->src; // get avatar link
- $item->id = $tweet->getAttribute('data-tweet-id'); // get TweetID
- $item->uri = 'https://twitter.com'.$tweet->find('a.js-permalink', 0)->getAttribute('href'); // get tweet link
- $item->timestamp = $tweet->find('span.js-short-timestamp', 0)->getAttribute('data-time'); // extract tweet timestamp
- // processing content links
- foreach($tweet->find('a') as $link) {
- if($link->hasAttribute('data-expanded-url') ) {
- $link->href = $link->getAttribute('data-expanded-url');
- }
- $link->removeAttribute('data-expanded-url');
- $link->removeAttribute('data-query-source');
- $link->removeAttribute('rel');
- $link->removeAttribute('class');
- $link->removeAttribute('target');
- $link->removeAttribute('title');
+ public function collectData(array $param){
+ $html = '';
+ if (isset($param['q'])) { /* keyword search mode */
+ $html = $this->file_get_html('https://twitter.com/search?q='.urlencode($param['q']).'&f=tweets') or $this->returnError('No results for this query.', 404);
+ }
+ elseif (isset($param['u'])) { /* user timeline mode */
+ $html = $this->file_get_html('https://twitter.com/'.urlencode($param['u']).'/with_replies') or $this->returnError('Requested username can\'t be found.', 404);
+ }
+ else {
+ $this->returnError('You must specify a keyword (?q=...) or a Twitter username (?u=...).', 400);
}
- $item->content = str_replace('href="/', 'href="https://twitter.com/', strip_tags($tweet->find('p.js-tweet-text', 0)->innertext, '
')); // extract tweet text
- $item->title = $item->fullname . ' (@' . $item->username . ') | ' . html_entity_decode(strip_tags($item->content),ENT_QUOTES,'UTF-8');
- $this->items[] = $item;
- }
- }
- public function getName(){
- return (!empty($this->request) ? $this->request .' - ' : '') .'Twitter Bridge';
- }
+ $hidePictures = false;
+ if (isset($param['pic']))
+ $hidePictures = $param['pic'] === 'on';
- public function getURI(){
- return 'http://twitter.com';
- }
+ foreach($html->find('div.js-stream-tweet') as $tweet) {
+ $item = new \Item();
+ // extract username and sanitize
+ $item->username = $tweet->getAttribute('data-screen-name');
+ // extract fullname (pseudonym)
+ $item->fullname = $tweet->getAttribute('data-name');
+ // get author
+ $item->author = $item->fullname . ' (@' . $item->username . ')';
+ // get avatar link
+ $item->avatar = $tweet->find('img', 0)->src;
+ // get TweetID
+ $item->id = $tweet->getAttribute('data-tweet-id');
+ // get tweet link
+ $item->uri = 'https://twitter.com'.$tweet->find('a.js-permalink', 0)->getAttribute('href');
+ // extract tweet timestamp
+ $item->timestamp = $tweet->find('span.js-short-timestamp', 0)->getAttribute('data-time');
+ // generate the title
+ $item->title = strip_tags($tweet->find('p.js-tweet-text', 0)->innertext);
+
+ // processing content links
+ foreach($tweet->find('a') as $link) {
+ if($link->hasAttribute('data-expanded-url') ) {
+ $link->href = $link->getAttribute('data-expanded-url');
+ }
+ $link->removeAttribute('data-expanded-url');
+ $link->removeAttribute('data-query-source');
+ $link->removeAttribute('rel');
+ $link->removeAttribute('class');
+ $link->removeAttribute('target');
+ $link->removeAttribute('title');
+ }
- public function getCacheDuration(){
- return 300; // 5 minutes
- }
+ // process emojis (reduce size)
+ foreach($tweet->find('img.Emoji') as $img){
+ $img->style .= ' height: 1em;';
+ }
+
+ // get tweet text
+ $cleanedTweet = str_replace('href="/', 'href="https://twitter.com/', $tweet->find('p.js-tweet-text', 0)->innertext);
+
+ // Add picture to content
+ $picture_html = '';
+ if(!$hidePictures){
+ $picture_html = <<
+EOD;
+ }
+
+ // add content
+ $item->content = <<
+ {$picture_html}
+
+
+EOD;
+
+ // put out
+ $this->items[] = $item;
+ }
+ }
+
+ public function getCacheDuration(){
+ return 300; // 5 minutes
+ }
}
diff --git a/bridges/TwitterBridgeClean.php b/bridges/TwitterBridgeClean.php
deleted file mode 100644
index 9f6ccfcd..00000000
--- a/bridges/TwitterBridgeClean.php
+++ /dev/null
@@ -1,85 +0,0 @@
-maintainer = "vinzv";
- $this->name = "Twitter Bridge Clean";
- $this->uri = "http://twitter.com/";
- $this->description = "Returns user timelines without username in title or search results for keywords/hashtags (without using their API).";
- $this->update = "2015-03-07";
-
- $this->parameters["By keyword or hashtag"] =
- '[
- {
- "name" : "Keyword or #hashtag",
- "identifier" : "q"
- }
- ]';
-
- $this->parameters["By username"] =
- '[
- {
- "name" : "username",
- "identifier" : "u"
- }
- ]';
-
- }
-
- public function collectData(array $param){
- $html = '';
- if (isset($param['q'])) { /* keyword search mode */
- $this->request = $param['q'];
- $html = $this->file_get_html('https://twitter.com/search?q='.urlencode($this->request).'&f=tweets') or $this->returnError('No results for this query.', 404);
- }
- elseif (isset($param['u'])) { /* user timeline mode */
- $this->request = $param['u'];
- $html = $this->file_get_html('http://twitter.com/'.urlencode($this->request)) or $this->returnError('Requested username can\'t be found.', 404);
- }
- else {
- $this->returnError('You must specify a keyword (?q=...) or a Twitter username (?u=...).', 400);
- }
-
- foreach($html->find('div.js-stream-tweet') as $tweet) {
- $item = new \Item();
- $item->username = $tweet->getAttribute('data-screen-name'); // extract username and sanitize
- $item->fullname = $tweet->getAttribute('data-name'); // extract fullname (pseudonym)
- $item->avatar = $tweet->find('img', 0)->src; // get avatar link
- $item->id = $tweet->getAttribute('data-tweet-id'); // get TweetID
- $item->uri = 'https://twitter.com'.$tweet->find('a.js-permalink', 0)->getAttribute('href'); // get tweet link
- $item->timestamp = $tweet->find('span.js-short-timestamp', 0)->getAttribute('data-time'); // extract tweet timestamp
- // processing content links
- foreach($tweet->find('a') as $link) {
- if($link->hasAttribute('data-expanded-url') ) {
- $link->href = $link->getAttribute('data-expanded-url');
- }
- $link->removeAttribute('data-expanded-url');
- $link->removeAttribute('data-query-source');
- $link->removeAttribute('rel');
- $link->removeAttribute('class');
- $link->removeAttribute('target');
- $link->removeAttribute('title');
- $link->removeAttribute('dir');
- }
- $item->content = str_replace('pic.twitter.com', 'https://pic.twitter.com', strip_tags($tweet->find('p.js-tweet-text', 0)->innertext)); // extract tweet text
- $item->title = html_entity_decode($item->content,ENT_QUOTES,'UTF-8');
- $this->items[] = $item;
- }
- }
-
- public function getName(){
- return (!empty($this->request) ? $this->request .' - ' : '') .'Twitter Bridge';
- }
-
- public function getURI(){
- return 'http://twitter.com';
- }
-
- public function getCacheDuration(){
- return 300; // 5 minutes
- }
-}
diff --git a/bridges/TwitterBridgeCleanExtended.php b/bridges/TwitterBridgeCleanExtended.php
deleted file mode 100644
index 170efff9..00000000
--- a/bridges/TwitterBridgeCleanExtended.php
+++ /dev/null
@@ -1,90 +0,0 @@
-maintainer = "Max Mehl";
- $this->name = "Twitter Bridge Clean Extended";
- $this->uri = "http://twitter.com/";
- $this->description = "Returns user timelines showing RTs correctly or search results for keywords/hashtags (without using their API).";
- $this->update = "2016-01-27";
-
- $this->parameters["By keyword or hashtag"] =
- '[
- {
- "name" : "Keyword or #hashtag",
- "identifier" : "q"
- }
- ]';
-
- $this->parameters["By username"] =
- '[
- {
- "name" : "username",
- "identifier" : "u"
- }
- ]';
-
- }
-
- public function collectData(array $param){
- $html = '';
- if (isset($param['q'])) { /* keyword search mode */
- $this->request = $param['q'];
- $html = $this->file_get_html('https://twitter.com/search?q='.urlencode($this->request).'&f=tweets') or $this->returnError('No results for this query.', 404);
- }
- elseif (isset($param['u'])) { /* user timeline mode */
- $this->request = $param['u'];
- $html = $this->file_get_html('http://twitter.com/'.urlencode($this->request)) or $this->returnError('Requested username can\'t be found.', 404);
- }
- else {
- $this->returnError('You must specify a keyword (?q=...) or a Twitter username (?u=...).', 400);
- }
-
- foreach($html->find('div.js-stream-tweet') as $tweet) {
- $item = new \Item();
- $item->username = $tweet->getAttribute('data-screen-name'); // extract username and sanitize
- $item->fullname = $tweet->getAttribute('data-name'); // extract fullname (pseudonym)
- $item->avatar = $tweet->find('img', 0)->src; // get avatar link
- $item->id = $tweet->getAttribute('data-tweet-id'); // get TweetID
- $item->uri = 'https://twitter.com'.$tweet->find('a.js-permalink', 0)->getAttribute('href'); // get tweet link
- $item->timestamp = $tweet->find('span.js-short-timestamp', 0)->getAttribute('data-time'); // extract tweet timestamp
- // processing content links
- foreach($tweet->find('a') as $link) {
- if($link->hasAttribute('data-expanded-url') ) {
- $link->href = $link->getAttribute('data-expanded-url');
- }
- $link->removeAttribute('data-expanded-url');
- $link->removeAttribute('data-query-source');
- $link->removeAttribute('rel');
- $link->removeAttribute('class');
- $link->removeAttribute('target');
- $link->removeAttribute('title');
- $link->removeAttribute('dir');
- }
- $item->content = str_replace('pic.twitter.com', 'https://pic.twitter.com', strip_tags($tweet->find('p.js-tweet-text', 0)->innertext)); // extract tweet text
- if(isset($param['u'])) {
- if($item->username != $param['u']) {
- $item->content = '♻ @' . $item->username . ': ' . $item->content;
- }
- }
- $item->title = html_entity_decode($item->content,ENT_QUOTES,'UTF-8');
- $this->items[] = $item;
- }
- }
-
- public function getName(){
- return (!empty($this->request) ? $this->request : '');
- }
-
- public function getURI(){
- return 'http://twitter.com';
- }
-
- public function getCacheDuration(){
- return 300; // 5 minutes
- }
-}
diff --git a/bridges/TwitterBridgeExtended.php b/bridges/TwitterBridgeExtended.php
deleted file mode 100644
index e15a0e9b..00000000
--- a/bridges/TwitterBridgeExtended.php
+++ /dev/null
@@ -1,92 +0,0 @@
-maintainer = "mitsukarenai";
- $this->name = "Twitter Bridge Extended";
- $this->uri = "https://twitter.com/";
- $this->description = "(same as Twitter Bridge, but with avatar, replies and RTs)";
- $this->update = "2014-05-25";
-
- $this->parameters["By keyword or hashtag"] =
- '[
- {
- "name" : "Keyword or #hashtag",
- "identifier" : "q"
- }
- ]';
-
- $this->parameters["By username"] =
- '[
- {
- "name" : "username",
- "identifier" : "u"
- }
- ]';
-
- }
-
- public function collectData(array $param){
- $html = '';
- if (isset($param['q'])) { /* keyword search mode */
- $html = $this->file_get_html('https://twitter.com/search?q='.urlencode($param['q']).'&f=tweets') or $this->returnError('No results for this query.', 404);
- }
- elseif (isset($param['u'])) { /* user timeline mode */
- $html = $this->file_get_html('https://twitter.com/'.urlencode($param['u']).'/with_replies') or $this->returnError('Requested username can\'t be found.', 404);
- }
- else {
- $this->returnError('You must specify a keyword (?q=...) or a Twitter username (?u=...).', 400);
- }
-
- foreach($html->find('div.js-stream-tweet') as $tweet) {
- $item = new \Item();
- // extract username and sanitize
- $item->username = $tweet->getAttribute('data-screen-name');
- // extract fullname (pseudonym)
- $item->fullname = $tweet->getAttribute('data-name');
- // get avatar link
- $item->avatar = $tweet->find('img', 0)->src;
- // get TweetID
- $item->id = $tweet->getAttribute('data-tweet-id');
- // get tweet link
- $item->uri = 'https://twitter.com'.$tweet->find('a.js-permalink', 0)->getAttribute('href');
- // extract tweet timestamp
- $item->timestamp = $tweet->find('span.js-short-timestamp', 0)->getAttribute('data-time');
- // extract plaintext
- $item->content_simple = str_replace('href="/', 'href="https://twitter.com/', html_entity_decode(strip_tags($tweet->find('p.js-tweet-text', 0)->innertext, '
')));
-
- // processing content links
- foreach($tweet->find('a') as $link) {
- if($link->hasAttribute('data-expanded-url') ) {
- $link->href = $link->getAttribute('data-expanded-url');
- }
- $link->removeAttribute('data-expanded-url');
- $link->removeAttribute('data-query-source');
- $link->removeAttribute('rel');
- $link->removeAttribute('class');
- $link->removeAttribute('target');
- $link->removeAttribute('title');
- }
-
- // get tweet text
- $item->content = ' '.$item->username.' '.$item->fullname.'
'.str_replace('href="/', 'href="https://twitter.com/', $tweet->find('p.js-tweet-text', 0)->innertext).' ';
- // generate the title
- $item->title = $item->fullname . ' (@'. $item->username . ') | ' . $item->content_simple;
- // put out
- $this->items[] = $item;
- }
- }
-
- public function getName(){
- return 'Twitter Bridge Extended';
- }
-
- public function getURI(){
- return 'http://twitter.com';
- }
-
- public function getCacheDuration(){
- return 300; // 5 minutes
- }
-}
diff --git a/bridges/TwitterBridgeTweaked.php b/bridges/TwitterBridgeTweaked.php
deleted file mode 100644
index e817ced0..00000000
--- a/bridges/TwitterBridgeTweaked.php
+++ /dev/null
@@ -1,165 +0,0 @@
-maintainer = "kraoc";
- $this->name = "Twitter Bridge Tweaked";
- $this->uri = "https://twitter.com/";
- $this->description = "(same as Twitter Bridge Extended, but with cleaned title & content)";
- $this->update = "2014-12-05";
-
- $this->parameters["By keyword or hashtag"] =
- '[
- {
- "name" : "Keyword or #hashtag",
- "identifier" : "q"
- }
- ]';
-
- $this->parameters["By username"] =
- '[
- {
- "name" : "username",
- "identifier" : "u"
- }
- ]';
-
- }
-
- private function containsTLD($string) {
- preg_match(
- "/(AC($|\/)|\.AD($|\/)|\.AE($|\/)|\.AERO($|\/)|\.AF($|\/)|\.AG($|\/)|\.AI($|\/)|\.AL($|\/)|\.AM($|\/)|\.AN($|\/)|\.AO($|\/)|\.AQ($|\/)|\.AR($|\/)|\.ARPA($|\/)|\.AS($|\/)|\.ASIA($|\/)|\.AT($|\/)|\.AU($|\/)|\.AW($|\/)|\.AX($|\/)|\.AZ($|\/)|\.BA($|\/)|\.BB($|\/)|\.BD($|\/)|\.BE($|\/)|\.BF($|\/)|\.BG($|\/)|\.BH($|\/)|\.BI($|\/)|\.BIZ($|\/)|\.BJ($|\/)|\.BM($|\/)|\.BN($|\/)|\.BO($|\/)|\.BR($|\/)|\.BS($|\/)|\.BT($|\/)|\.BV($|\/)|\.BW($|\/)|\.BY($|\/)|\.BZ($|\/)|\.CA($|\/)|\.CAT($|\/)|\.CC($|\/)|\.CD($|\/)|\.CF($|\/)|\.CG($|\/)|\.CH($|\/)|\.CI($|\/)|\.CK($|\/)|\.CL($|\/)|\.CM($|\/)|\.CN($|\/)|\.CO($|\/)|\.COM($|\/)|\.COOP($|\/)|\.CR($|\/)|\.CU($|\/)|\.CV($|\/)|\.CX($|\/)|\.CY($|\/)|\.CZ($|\/)|\.DE($|\/)|\.DJ($|\/)|\.DK($|\/)|\.DM($|\/)|\.DO($|\/)|\.DZ($|\/)|\.EC($|\/)|\.EDU($|\/)|\.EE($|\/)|\.EG($|\/)|\.ER($|\/)|\.ES($|\/)|\.ET($|\/)|\.EU($|\/)|\.FI($|\/)|\.FJ($|\/)|\.FK($|\/)|\.FM($|\/)|\.FO($|\/)|\.FR($|\/)|\.GA($|\/)|\.GB($|\/)|\.GD($|\/)|\.GE($|\/)|\.GF($|\/)|\.GG($|\/)|\.GH($|\/)|\.GI($|\/)|\.GL($|\/)|\.GM($|\/)|\.GN($|\/)|\.GOV($|\/)|\.GP($|\/)|\.GQ($|\/)|\.GR($|\/)|\.GS($|\/)|\.GT($|\/)|\.GU($|\/)|\.GW($|\/)|\.GY($|\/)|\.HK($|\/)|\.HM($|\/)|\.HN($|\/)|\.HR($|\/)|\.HT($|\/)|\.HU($|\/)|\.ID($|\/)|\.IE($|\/)|\.IL($|\/)|\.IM($|\/)|\.IN($|\/)|\.INFO($|\/)|\.INT($|\/)|\.IO($|\/)|\.IQ($|\/)|\.IR($|\/)|\.IS($|\/)|\.IT($|\/)|\.JE($|\/)|\.JM($|\/)|\.JO($|\/)|\.JOBS($|\/)|\.JP($|\/)|\.KE($|\/)|\.KG($|\/)|\.KH($|\/)|\.KI($|\/)|\.KM($|\/)|\.KN($|\/)|\.KP($|\/)|\.KR($|\/)|\.KW($|\/)|\.KY($|\/)|\.KZ($|\/)|\.LA($|\/)|\.LB($|\/)|\.LC($|\/)|\.LI($|\/)|\.LK($|\/)|\.LR($|\/)|\.LS($|\/)|\.LT($|\/)|\.LU($|\/)|\.LV($|\/)|\.LY($|\/)|\.MA($|\/)|\.MC($|\/)|\.MD($|\/)|\.ME($|\/)|\.MG($|\/)|\.MH($|\/)|\.MIL($|\/)|\.MK($|\/)|\.ML($|\/)|\.MM($|\/)|\.MN($|\/)|\.MO($|\/)|\.MOBI($|\/)|\.MP($|\/)|\.MQ($|\/)|\.MR($|\/)|\.MS($|\/)|\.MT($|\/)|\.MU($|\/)|\.MUSEUM($|\/)|\.MV($|\/)|\.MW($|\/)|\.MX($|\/)|\.MY($|\/)|\.MZ($|\/)|\.NA($|\/)|\.NAME($|\/)|\.NC($|\/)|\.NE($|\/)|\.NET($|\/)|\.NF($|\/)|\.NG($|\/)|\.NI($|\/)|\.NL($|\/)|\.NO($|\/)|\.NP($|\/)|\.NR($|\/)|\.NU($|\/)|\.NZ($|\/)|\.OM($|\/)|\.ORG($|\/)|\.PA($|\/)|\.PE($|\/)|\.PF($|\/)|\.PG($|\/)|\.PH($|\/)|\.PK($|\/)|\.PL($|\/)|\.PM($|\/)|\.PN($|\/)|\.PR($|\/)|\.PRO($|\/)|\.PS($|\/)|\.PT($|\/)|\.PW($|\/)|\.PY($|\/)|\.QA($|\/)|\.RE($|\/)|\.RO($|\/)|\.RS($|\/)|\.RU($|\/)|\.RW($|\/)|\.SA($|\/)|\.SB($|\/)|\.SC($|\/)|\.SD($|\/)|\.SE($|\/)|\.SG($|\/)|\.SH($|\/)|\.SI($|\/)|\.SJ($|\/)|\.SK($|\/)|\.SL($|\/)|\.SM($|\/)|\.SN($|\/)|\.SO($|\/)|\.SR($|\/)|\.ST($|\/)|\.SU($|\/)|\.SV($|\/)|\.SY($|\/)|\.SZ($|\/)|\.TC($|\/)|\.TD($|\/)|\.TEL($|\/)|\.TF($|\/)|\.TG($|\/)|\.TH($|\/)|\.TJ($|\/)|\.TK($|\/)|\.TL($|\/)|\.TM($|\/)|\.TN($|\/)|\.TO($|\/)|\.TP($|\/)|\.TR($|\/)|\.TRAVEL($|\/)|\.TT($|\/)|\.TV($|\/)|\.TW($|\/)|\.TZ($|\/)|\.UA($|\/)|\.UG($|\/)|\.UK($|\/)|\.US($|\/)|\.UY($|\/)|\.UZ($|\/)|\.VA($|\/)|\.VC($|\/)|\.VE($|\/)|\.VG($|\/)|\.VI($|\/)|\.VN($|\/)|\.VU($|\/)|\.WF($|\/)|\.WS($|\/)|\.XN--0ZWM56D($|\/)|\.XN--11B5BS3A9AJ6G($|\/)|\.XN--80AKHBYKNJ4F($|\/)|\.XN--9T4B11YI5A($|\/)|\.XN--DEBA0AD($|\/)|\.XN--G6W251D($|\/)|\.XN--HGBK6AJ7F53BBA($|\/)|\.XN--HLCJ6AYA9ESC7A($|\/)|\.XN--JXALPDLP($|\/)|\.XN--KGBECHTV($|\/)|\.XN--ZCKZAH($|\/)|\.YE($|\/)|\.YT($|\/)|\.YU($|\/)|\.ZA($|\/)|\.ZM($|\/)|\.ZW)/i",
- $string,
- $M
- );
- $has_tld = (count($M) > 0) ? true : false;
- return $has_tld;
- }
- private function cleaner($url) {
- $U = explode(' ', $url);
- $W =array();
- foreach ($U as $k => $u) {
- if (stristr($u,".")) { //only preg_match if there is a dot
- if ($this->containsTLD($u) === true) {
- unset($U[$k]);
- return $this->cleaner( implode(' ', $U) );
- }
- }
- }
- return implode(' ', $U);
- }
-
- // (c) Kraoc / urlclean
- // https://github.com/kraoc/Leed-market/blob/master/urlclean/urlclean.plugin.disabled.php
- private function resolve_url($link) {
- // fallback to crawl to real url (slowest method and unsecure to privacy)
- if (function_exists('curl_init') && !ini_get('safe_mode')) {
- curl_setopt($ch, CURLOPT_USERAGENT, $ua);
- curl_setopt($ch, CURLOPT_URL, $link);
- curl_setopt($ch, CURLOPT_HEADER, true);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- // >>> anonimization
- curl_setopt($ch, CURLOPT_COOKIESESSION, true);
- curl_setopt($ch, CURLOPT_REFERER, '');
- // <<< anonimization
- $ch = curl_init();
- $ua = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.16 (KHTML, like Gecko) Chrome/24.0.1304.0 Safari/537.16';
- $a = curl_exec($ch);
- $link = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
- }
-
- $link = preg_replace("/[?]xtor=(.)+/", "", $link); // remove: xtor
- $link = preg_replace("/utm_([^]|(&))+&*/", "", $link); // remove: utm_
-
- // cleanup end of url
- $link = preg_replace("/\?&/", "", $link);
- if (isset($link[strlen($link) -1])){
- if ($link[strlen($link) -1] == '?')
- $link = substr($link, 0, strlen($link) -1);
- }
-
- return $link;
- }
-
- public function collectData(array $param){
- $html = '';
- if (isset($param['q'])) { /* keyword search mode */
- $html = $this->file_get_html('https://twitter.com/search?q='.urlencode($param['q']).'&f=tweets') or $this->returnError('No results for this query.', 404);
- }
- elseif (isset($param['u'])) { /* user timeline mode */
- $html = $this->file_get_html('https://twitter.com/'.urlencode($param['u']).'/with_replies') or $this->returnError('Requested username can\'t be found.', 404);
- }
- else {
- $this->returnError('You must specify a keyword (?q=...) or a Twitter username (?u=...).', 400);
- }
-
- foreach($html->find('div.js-stream-tweet') as $tweet) {
- $item = new \Item();
- // extract username and sanitize
- $item->username = $tweet->getAttribute('data-screen-name');
- // extract fullname (pseudonym)
- $item->fullname = $tweet->getAttribute('data-name');
- // get avatar link
- $item->avatar = $tweet->find('img', 0)->src;
- // get TweetID
- $item->id = $tweet->getAttribute('data-tweet-id');
- // get tweet link
- $item->uri = 'https://twitter.com'.$tweet->find('a.js-permalink', 0)->getAttribute('href');
- // extract tweet timestamp
- $item->timestamp = $tweet->find('span.js-short-timestamp', 0)->getAttribute('data-time');
- // extract plaintext
- $item->content_simple = str_replace('href="/', 'href="https://twitter.com/', html_entity_decode(strip_tags($tweet->find('p.js-tweet-text', 0)->innertext, '
')));
-
- // processing content links
- foreach($tweet->find('a') as $link) {
- if($link->hasAttribute('data-expanded-url') ) {
- $link->href = $link->getAttribute('data-expanded-url');
- }
- $link->removeAttribute('data-expanded-url');
- $link->removeAttribute('data-query-source');
- $link->removeAttribute('rel');
- $link->removeAttribute('class');
- $link->removeAttribute('target');
- $link->removeAttribute('title');
- }
-
- // get tweet text
- $item->content = ' '.$item->username.' '.$item->fullname.'
'.str_replace('href="/', 'href="https://twitter.com/', $tweet->find('p.js-tweet-text', 0)->innertext).' ';
- // generate the title
-// $item->title = $item->fullname . ' (@'. $item->username . ') | ' . $item->content_simple;
- $item->title = $item->content_simple;
- $item->title = preg_replace('|https?://www\.[a-z\.0-9]+|i', '', $item->title); // remove http(s) links
- $item->title = preg_replace('|www\.[a-z\.0-9]+|i', '', $item->title); // remove www. links
- $item->title = $this->cleaner($item->title); // remove all remaining links
- $item->title = trim($item->title); // remove extra spaces at beginning and end
-
- // convert all content links to real ones
- $regex = "/(http|https|ftp|ftps)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/";
- $item->content = preg_replace_callback($regex, function($url) {
- // do stuff with $url[0] here
- return $this->resolve_url($url[0]);
- }, $item->content);
-
- // put out
- $this->items[] = $item;
- }
- }
-
- public function getName(){
- return 'Twitter Bridge Tweaked';
- }
-
- public function getURI(){
- return 'http://twitter.com';
- }
-
- public function getCacheDuration(){
- return 300; // 5 minutes
- }
-
- public function getUsername(){
- return $this->items[0]->username;
- }
-}
diff --git a/bridges/UnsplashBridge.php b/bridges/UnsplashBridge.php
index 2ac8ef2f..ccbf2a20 100644
--- a/bridges/UnsplashBridge.php
+++ b/bridges/UnsplashBridge.php
@@ -7,7 +7,7 @@ class UnsplashBridge extends BridgeAbstract {
$this->name = "Unsplash Bridge";
$this->uri = "http://unsplash.com/";
$this->description = "Returns the latests photos from Unsplash";
- $this->update = "2015-03-02";
+ $this->update = "2016-08-09";
$this->parameters[] =
'[
@@ -61,8 +61,7 @@ class UnsplashBridge extends BridgeAbstract {
$thumbnail->src).'.jpg'; // '.jpg' only for format hint
$item->timestamp = time();
$item->title = $thumbnail->alt;
- $item->thumbnailUri = $thumbnail->src;
- $item->content = $item->title.'
';
+ $item->content = $item->title.'
';
$this->items[] = $item;
$num++;
@@ -72,14 +71,6 @@ class UnsplashBridge extends BridgeAbstract {
}
}
- public function getName(){
- return 'Unsplash';
- }
-
- public function getURI(){
- return 'http://unsplash.com';
- }
-
public function getCacheDuration(){
return 43200; // 12 hours
}
diff --git a/bridges/ViadeoCompany.php b/bridges/ViadeoCompany.php
index 325cf1aa..eee7a24a 100644
--- a/bridges/ViadeoCompany.php
+++ b/bridges/ViadeoCompany.php
@@ -7,7 +7,7 @@ class ViadeoCompany extends BridgeAbstract{
$this->name = "Viadeo Company";
$this->uri = "https://www.viadeo.com/";
$this->description = "Returns most recent actus from Company on Viadeo. (http://www.viadeo.com/fr/company/
apple )";
- $this->update = "2015-12-22";
+ $this->update = "2016-08-09";
$this->parameters[] =
'[
@@ -30,22 +30,13 @@ class ViadeoCompany extends BridgeAbstract{
$item = new \Item();
$item->uri = $link;
$item->title = mb_substr($element->find('p', 0)->innertext, 0 ,100);
- $item->content = $element->find('p', 0)->innertext;
- $item->thumbnailUri = str_replace('//', 'http://', $element->find('img.usage-article__image_only', 0)->src);
+ $item->content = $element->find('p', 0)->innertext;;
$this->items[] = $item;
$i++;
}
}
}
- public function getName(){
- return 'Viadeo';
- }
-
- public function getURI(){
- return 'https://www.viadeo.com';
- }
-
public function getCacheDuration(){
return 21600; // 6 hours
}
diff --git a/bridges/VineBridge.php b/bridges/VineBridge.php
index daf520e9..db639830 100644
--- a/bridges/VineBridge.php
+++ b/bridges/VineBridge.php
@@ -7,7 +7,7 @@ class VineBridge extends BridgeAbstract {
$this->name = "Vine bridge";
$this->uri = "http://vine.co/";
$this->description = "Returns the latests vines from vine user page";
- $this->update = "2016-03-12";
+ $this->update = "2016-08-09";
$this->parameters[] =
'[
@@ -45,14 +45,6 @@ class VineBridge extends BridgeAbstract {
}
- public function getName(){
- return 'Vine';
- }
-
- public function getURI(){
- return 'http://vine.co';
- }
-
public function getCacheDuration(){
return 10; //seconds
}
diff --git a/bridges/VkBridge.php b/bridges/VkBridge.php
index abaf423e..7f5b4ffe 100644
--- a/bridges/VkBridge.php
+++ b/bridges/VkBridge.php
@@ -9,7 +9,7 @@ class VkBridge extends BridgeAbstract {
$this->name = "VK.com";
$this->uri = "http://www.vk.com/";
$this->description = "Working with open pages";
- $this->update = "21/02/2016";
+ $this->update = "2016-08-06";
$this->parameters["Url on page group or user"] = '[
{
"name" : "Url",
@@ -53,10 +53,6 @@ class VkBridge extends BridgeAbstract {
return(isset($this->name) ? $this->name . ' - ' : '') . 'VK Bridge';
}
- public function getURI() {
- return 'http://vk.com';
- }
-
public function getCacheDuration() {
return 300; // 5 minutes
}
diff --git a/bridges/WallpaperStopBridge.php b/bridges/WallpaperStopBridge.php
index 3379e820..7a70ef20 100644
--- a/bridges/WallpaperStopBridge.php
+++ b/bridges/WallpaperStopBridge.php
@@ -11,7 +11,7 @@ class WallpaperStopBridge extends BridgeAbstract {
$this->name = "WallpaperStop Bridge";
$this->uri = "http://www.wallpaperstop.com/";
$this->description = "Returns the latests wallpapers from WallpaperStop";
- $this->update = "2014-11-05";
+ $this->update = "2016-08-09";
$this->parameters[] =
'[
@@ -73,8 +73,7 @@ class WallpaperStopBridge extends BridgeAbstract {
$item->id = $matches[3];
$item->timestamp = time();
$item->title = $thumbnail->title;
- $item->thumbnailUri = $baseUri.$thumbnail->src;
- $item->content = $item->title.'
';
+ $item->content = $item->title.'
';
$this->items[] = $item;
$num++;
@@ -91,10 +90,6 @@ class WallpaperStopBridge extends BridgeAbstract {
return 'WallpaperStop - '.$this->category.(!empty($this->subcategory) ? ' > '.$this->subcategory : '').' ['.$this->resolution.']';
}
- public function getURI(){
- return 'http://www.wallpaperstop.com';
- }
-
public function getCacheDuration(){
return 43200; // 12 hours
}
diff --git a/bridges/WeLiveSecurityBridge.php b/bridges/WeLiveSecurityBridge.php
index cdb04bd3..9fdf87b6 100644
--- a/bridges/WeLiveSecurityBridge.php
+++ b/bridges/WeLiveSecurityBridge.php
@@ -3,10 +3,10 @@ class WeLiveSecurityBridge extends BridgeAbstract {
public function loadMetadatas() {
$this->maintainer = 'ORelio';
- $this->name = $this->getName();
- $this->uri = $this->getURI();
+ $this->name = 'We Live Security';
+ $this->uri = 'http://www.welivesecurity.com/';
$this->description = 'Returns the newest articles.';
- $this->update = '2016-07-19';
+ $this->update = '2016-08-09';
}
public function collectData(array $param) {
@@ -49,7 +49,6 @@ class WeLiveSecurityBridge extends BridgeAbstract {
$item = new \Item();
$item->uri = $article_url;
- $item->thumbnailUri = $article_image;
$item->title = $element->find('title', 0)->plaintext;
$item->author = $article_html->find('a[rel=author]', 0)->plaintext;
$item->timestamp = strtotime($element->find('pubDate', 0)->plaintext);
@@ -60,16 +59,4 @@ class WeLiveSecurityBridge extends BridgeAbstract {
}
}
}
-
- public function getName() {
- return 'We Live Security';
- }
-
- public function getURI() {
- return 'http://www.welivesecurity.com/';
- }
-
- public function getCacheDuration() {
- return 3600; //1 hour
- }
}
\ No newline at end of file
diff --git a/bridges/WhydBridge.php b/bridges/WhydBridge.php
index 2b9e1dd4..cf9959c5 100644
--- a/bridges/WhydBridge.php
+++ b/bridges/WhydBridge.php
@@ -10,7 +10,7 @@ class WhydBridge extends BridgeAbstract{
$this->name = "Whyd Bridge";
$this->uri = "http://www.whyd.com/";
$this->description = "Returns 10 newest music from user profile";
- $this->update = "2014-07-18";
+ $this->update = "2016-08-09";
$this->parameters[] =
'[
@@ -48,7 +48,7 @@ class WhydBridge extends BridgeAbstract{
for($i = 0; $i < 10; $i++) {
$track = $html->find('div.post', $i);
$item = new \Item();
- $item->name = $track->find('h2', 0)->plaintext;
+ $item->author = $track->find('h2', 0)->plaintext;
$item->title = $track->find('h2', 0)->plaintext;
$item->content = $track->find('a.thumb',0) . '
' . $track->find('h2', 0)->plaintext;
$item->id = 'http://www.whyd.com' . $track->find('a.no-ajaxy',0)->getAttribute('href');
@@ -60,10 +60,6 @@ class WhydBridge extends BridgeAbstract{
return (!empty($this->name) ? $this->name .' - ' : '') .'Whyd Bridge';
}
- public function getURI(){
- return 'http://www.whyd.com/';
- }
-
public function getCacheDuration(){
return 600; // 10 minutes
}
diff --git a/bridges/WikipediaBridge.php b/bridges/WikipediaBridge.php
new file mode 100644
index 00000000..5fb48f9b
--- /dev/null
+++ b/bridges/WikipediaBridge.php
@@ -0,0 +1,304 @@
+maintainer = 'logmanoriginal';
+ $this->name = 'Wikipedia bridge for many languages';
+ $this->uri = 'https://www.wikipedia.org/';
+ $this->description = 'Returns articles for a language of your choice';
+ $this->update = '2016-08-07';
+
+ $this->parameters[] =
+ '[
+ {
+ "name": "Language",
+ "identifier": "language",
+ "type": "list",
+ "required": "true",
+ "title": "Select your language",
+ "exampleValue": "English",
+ "values": [
+ {
+ "name": "English",
+ "value": "en"
+ },
+ {
+ "name": "German",
+ "value": "de"
+ },
+ {
+ "name": "French",
+ "value": "fr"
+ },
+ {
+ "name": "Esperanto",
+ "value": "eo"
+ }
+ ]
+ },
+ {
+ "name": "Subject",
+ "identifier": "subject",
+ "type": "list",
+ "required": "true",
+ "title": "What subject are you interested in?",
+ "exampleValue": "Today\'s featured article",
+ "values": [
+ {
+ "name": "Today\'s featured article",
+ "value": "tfa"
+ },
+ {
+ "name": "Did you know...",
+ "value": "dyk"
+ }
+ ]
+ },
+ {
+ "name": "Load full article",
+ "identifier": "fullarticle",
+ "type": "checkbox",
+ "required": "false",
+ "title": "Activate to always load the full article",
+ "exampleValue": "false"
+ }
+ ]';
+ }
+
+ public function collectData(array $params){
+ if(!isset($params['language']))
+ $this->returnError('You must specify a valid language via \'&language=\'!', 400);
+
+ if(!$this->CheckLanguageCode(strtolower($params['language'])))
+ $this->returnError('The language code you provided (\'' . $params['language'] . '\') is not supported!', 400);
+
+ if(!isset($params['subject']))
+ $this->returnError('You must specify a valid subject via \'&subject=\'!', 400);
+
+ $subject = WIKIPEDIA_SUBJECT_TFA;
+ switch($params['subject']){
+ case 'tfa':
+ $subject = WIKIPEDIA_SUBJECT_TFA;
+ break;
+ case 'dyk':
+ $subject = WIKIPEDIA_SUBJECT_DYK;
+ break;
+ default:
+ $subject = WIKIPEDIA_SUBJECT_TFA;
+ break;
+ }
+
+ $fullArticle = false;
+ if(isset($params['fullarticle']))
+ $fullArticle = $params['fullarticle'] === 'on' ? true : false;
+
+ // We store the correct URI as URI of this bridge (so it can be used later!)
+ $this->uri = 'https://' . strtolower($params['language']) . '.wikipedia.org';
+
+ // While we at it let's also update the name for the feed
+ switch($subject){
+ case WIKIPEDIA_SUBJECT_TFA:
+ $this->name = 'Today\'s featured article from ' . strtolower($params['language']) . '.wikipedia.org';
+ break;
+ case WIKIPEDIA_SUBJECT_DYK:
+ $this->name = 'Did you know? - articles from ' . strtolower($params['language']) . '.wikipedia.org';
+ break;
+ default:
+ $this->name = 'Articles from ' . strtolower($params['language']) . '.wikipedia.org';
+ break;
+ }
+
+ // This will automatically send us to the correct main page in any language (try it!)
+ $html = $this->file_get_html($this->uri . '/wiki');
+
+ if(!$html)
+ $this->returnError('Could not load site: ' . $this->uri . '!', 404);
+
+ /*
+ * Now read content depending on the language (make sure to create one function per language!)
+ * We build the function name automatically, just make sure you create a private function ending
+ * with your desired language code, where the language code is upper case! (en -> GetContentsEN).
+ */
+ $function = 'GetContents' . strtoupper($params['language']);
+
+ if(!method_exists($this, $function))
+ $this->returnError('A function to get the contents for your langauage is missing (\'' . $function . '\')!', 501);
+
+ /*
+ * The method takes care of creating all items.
+ */
+ $this->$function($html, $subject, $fullArticle);
+ }
+
+ /**
+ * Returns true if the language code is part of the parameters list
+ */
+ private function CheckLanguageCode($languageCode){
+ $parameter = json_decode($this->parameters[0], true);
+ $languages = $parameter[0]['values'];
+
+ $language_names = array();
+
+ foreach($languages as $language)
+ $language_names[] = $language['value'];
+
+ return in_array($languageCode, $language_names);
+ }
+
+ /**
+ * Replaces all relative URIs with absolute ones
+ * @param $element A simplehtmldom element
+ * @return The $element->innertext with all URIs replaced
+ */
+ private function ReplaceURIInHTMLElement($element){
+ return str_replace('href="/', 'href="' . $this->uri . '/', $element->innertext);
+ }
+
+ /*
+ * Adds a new item to $items using a generic operation (should work for most (all?) wikis)
+ */
+ private function AddTodaysFeaturedArticleGeneric($element, $fullArticle){
+ // Clean the bottom of the featured article
+ $element->find('div', -1)->outertext = '';
+
+ // The title and URI of the article is best defined in an anchor containint the string '...' ('full article ...')
+ $target = $element->find('p/a', 0); // We'll use the first anchor as fallback
+ foreach($element->find('//a') as $anchor){
+ if(strpos($anchor->innertext, '...') !== false){
+ $target = $anchor;
+ break;
+ }
+ }
+
+ $item = new \Item();
+ $item->uri = $this->uri . $target->href;
+ $item->title = $target->title;
+
+ if(!$fullArticle)
+ $item->content = strip_tags($this->ReplaceURIInHTMLElement($element), '
');
+ else
+ $item->content = $this->LoadFullArticle($item->uri);
+
+ $this->items[] = $item;
+ }
+
+ /*
+ * Adds a new item to $items using a generic operation (should work for most (all?) wikis)
+ */
+ private function AddDidYouKnowGeneric($element, $fullArticle){
+ foreach($element->find('ul', 0)->find('li') as $entry){
+ $item = new \Item();
+
+ // We can only use the first anchor, there is no way of finding the 'correct' one if there are multiple
+ $item->uri = $this->uri . $entry->find('a', 0)->href;
+ $item->title = strip_tags($entry->innertext);
+
+ if(!$fullArticle)
+ $item->content = $this->ReplaceURIInHTMLElement($entry);
+ else
+ $item->content = $this->LoadFullArticle($item->uri);
+
+ $this->items[] = $item;
+ }
+ }
+
+ /**
+ * Loads the full article from a given URI
+ */
+ private function LoadFullArticle($uri){
+ $content_html = $this->file_get_html($uri);
+
+ if(!$content_html)
+ $this->returnError('Could not load site: ' . $uri . '!', 404);
+
+ $content = $content_html->find('#mw-content-text', 0);
+
+ if(!$content)
+ $this->returnError('Could not find content in page: ' . $uri . '!', 404);
+
+ // Let's remove a couple of things from the article
+ $table = $content->find('#toc', 0); // Table of contents
+ if(!$table === false)
+ $table->outertext = '';
+
+ foreach($content->find('ol.references') as $reference) // References
+ $reference->outertext = '';
+
+ return str_replace('href="/', 'href="' . $this->uri . '/', $content->innertext);
+ }
+
+ /**
+ * Implementation for de.wikipedia.org
+ */
+ private function GetContentsDE($html, $subject, $fullArticle){
+ switch($subject){
+ case WIKIPEDIA_SUBJECT_TFA:
+ $element = $html->find('div[id=mf-tfa]', 0);
+ $this->AddTodaysFeaturedArticleGeneric($element, $fullArticle);
+ break;
+ case WIKIPEDIA_SUBJECT_DYK:
+ $element = $html->find('div[id=mf-dyk]', 0);
+ $this->AddDidYouKnowGeneric($element, $fullArticle);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * Implementation for fr.wikipedia.org
+ */
+ private function GetContentsFR($html, $subject, $fullArticle){
+ switch($subject){
+ case WIKIPEDIA_SUBJECT_TFA:
+ $element = $html->find('div[id=accueil-lumieresur]', 0);
+ $this->AddTodaysFeaturedArticleGeneric($element, $fullArticle);
+ break;
+ case WIKIPEDIA_SUBJECT_DYK:
+ $element = $html->find('div[id=SaviezVous]', 0);
+ $this->AddDidYouKnowGeneric($element, $fullArticle);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * Implementation for en.wikipedia.org
+ */
+ private function GetContentsEN($html, $subject, $fullArticle){
+ switch($subject){
+ case WIKIPEDIA_SUBJECT_TFA:
+ $element = $html->find('div[id=mp-tfa]', 0);
+ $this->AddTodaysFeaturedArticleGeneric($element, $fullArticle);
+ break;
+ case WIKIPEDIA_SUBJECT_DYK:
+ $element = $html->find('div[id=mp-dyk]', 0);
+ $this->AddDidYouKnowGeneric($element, $fullArticle);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * Implementation for eo.wikipedia.org
+ */
+ private function GetContentsEO($html, $subject, $fullArticle){
+ switch($subject){
+ case WIKIPEDIA_SUBJECT_TFA:
+ $element = $html->find('div[id=mf-artikolo-de-la-semajno]', 0);
+ $this->AddTodaysFeaturedArticleGeneric($element, $fullArticle);
+ break;
+ case WIKIPEDIA_SUBJECT_DYK:
+ $element = $html->find('div[id=mw-content-text]', 0)->find('table', 4)->find('td', 4);
+ $this->AddDidYouKnowGeneric($element, $fullArticle);
+ break;
+ default:
+ break;
+ }
+ }
+}
diff --git a/bridges/WikipediaDEBridge.php b/bridges/WikipediaDEBridge.php
deleted file mode 100644
index 5bb974a8..00000000
--- a/bridges/WikipediaDEBridge.php
+++ /dev/null
@@ -1,48 +0,0 @@
-maintainer = "cnlpete";
- $this->name = "Wikipedia DE Today's Featured Article...";
- $this->uri = "https://de.wikipedia.org/";
- $this->description = "Returns the highlighted en.wikipedia.org article.";
- $this->update = "2015-11-04";
-
- }
-
- public function collectData(array $param){
- $html = '';
- $host = 'http://de.wikipedia.org';
- // If you want HTTPS access instead, uncomment the following line:
- //$host = 'https://de.wikipedia.org';
- $link = '/wiki/Wikipedia:Hauptseite';
-
- $html = $this->file_get_html($host.$link) or $this->returnError('Could not request Wikipedia DE.', 404);
-
- $element = $html->find('div[id=mf-tfa]', 0);
- $element->find('div', -1)->outertext = '';
-
- $item = new \Item();
- $item->uri = $host.$element->find('p', 0)->find('a', 0)->href;
- $item->title = $element->find('p',0)->find('a',0)->title;
-
- $html2 = $this->file_get_html($item->uri) or $this->returnError('Could not request Wikipedia DE '.$item->title.'.', 404);
- $element2 = $html2->find('div[id=mw-content-text]', 0);
- $item->content = str_replace('href="/', 'href="'.$host.'/', $element2->innertext);
-
- $this->items[] = $item;
- }
-
- public function getName(){
- return 'Wikipedia DE "Today\'s Featured Article"';
- }
-
- public function getURI(){
- return 'https://de.wikipedia.org/wiki/Wikipedia:Hauptseite';
- }
-
- public function getCacheDuration(){
- return 3600*8; // 8 hours
- }
-}
diff --git a/bridges/WikipediaENBridge.php b/bridges/WikipediaENBridge.php
deleted file mode 100644
index 37f1f57a..00000000
--- a/bridges/WikipediaENBridge.php
+++ /dev/null
@@ -1,44 +0,0 @@
-maintainer = "gsurrel";
- $this->name = "Wikipedia EN 'Today's Featured Article...'";
- $this->uri = "https://en.wikipedia.org/";
- $this->description = "Returns the highlighted en.wikipedia.org article.";
- $this->update = "2014-05-25";
-
- }
-
- public function collectData(array $param){
- $html = '';
- $host = 'http://en.wikipedia.org';
- // If you want HTTPS access instead, uncomment the following line:
- //$host = 'https://en.wikipedia.org';
- $link = '/wiki/Main_Page';
-
- $html = $this->file_get_html($host.$link) or $this->returnError('Could not request Wikipedia EN.', 404);
-
- $element = $html->find('div[id=mp-tfa]', 0);
- // Clean the bottom of the featured article
- $element->find('div', -1)->outertext = '';
- $item = new \Item();
- $item->uri = $host.$element->find('p', 0)->find('a', 0)->href;
- $item->title = $element->find('p',0)->find('a',0)->title;
- $item->content = str_replace('href="/', 'href="'.$host.'/', $element->innertext);
- $this->items[] = $item;
- }
-
- public function getName(){
- return 'Wikipedia EN "Today\'s Featued Article"';
- }
-
- public function getURI(){
- return 'https://en.wikipedia.org/wiki/Main_Page';
- }
-
- public function getCacheDuration(){
- return 3600*4; // 4 hours
- }
-}
diff --git a/bridges/WikipediaEOBridge.php b/bridges/WikipediaEOBridge.php
deleted file mode 100644
index 89050a6b..00000000
--- a/bridges/WikipediaEOBridge.php
+++ /dev/null
@@ -1,44 +0,0 @@
-maintainer = "gsurrel";
- $this->name = "Wikipedia EO 'Artikolo de la semajno'";
- $this->uri = "https://eo.wikipedia.org/";
- $this->description = "Returns the highlighted eo.wikipedia.org article.";
- $this->update = "2014-05-25";
-
- }
-
- public function collectData(array $param){
- $html = '';
- $host = 'http://eo.wikipedia.org';
- // If you want HTTPS access instead, uncomment the following line:
- //$host = 'https://eo.wikipedia.org';
- $link = '/wiki/Vikipedio:%C4%88efpa%C4%9Do';
-
- $html = $this->file_get_html($host.$link) or $this->returnError('Could not request Wikipedia EO.', 404);
-
- $element = $html->find('div[id=mf-tfa]', 0);
- // Link to article
- $link = $element->find('p', -2)->find('a', 0);
- $item = new \Item();
- $item->uri = $host.$link->href;
- $item->title = $link->title;
- $item->content = str_replace('href="/', 'href="'.$host.'/', $element->innertext);
- $this->items[] = $item;
- }
-
- public function getName(){
- return 'Wikipedia EO "Artikolo de la semajno"';
- }
-
- public function getURI(){
- return 'https://eo.wikipedia.org/wiki/Vikipedio:%C4%88efpa%C4%9Do';
- }
-
- public function getCacheDuration(){
- return 3600*12; // 12 hours
- }
-}
diff --git a/bridges/WikipediaFRBridge.php b/bridges/WikipediaFRBridge.php
deleted file mode 100644
index 293d7c99..00000000
--- a/bridges/WikipediaFRBridge.php
+++ /dev/null
@@ -1,46 +0,0 @@
-maintainer = "gsurrel";
- $this->name = "Wikipedia FR 'Lumière sur...'";
- $this->uri = "https://fr.wikipedia.org/";
- $this->description = "Returns the highlighted fr.wikipedia.org article.";
- $this->update = "2016-06-04";
-
- }
-
- public function collectData(array $param){
- $html = '';
- $host = 'http://fr.wikipedia.org';
- // If you want HTTPS access instead, uncomment the following line:
- //$host = 'https://fr.wikipedia.org';
- $link = '/wiki/Wikip%C3%A9dia:Accueil_principal';
-
- $html = $this->file_get_html($host.$link) or $this->returnError('Could not request Wikipedia FR.', 404);
-
- $element = $html->find('div[id=mf-lumieresur]', 0);
- # Use the "Lire la suite" link to dependably get the title of the article
- # usually it's a child of a li.BA element (Bon article)
- # occasionally it's a li.AdQ (Article de qualité)
- $lirelasuite_link = $element->find('.BA > i > a, .AdQ > i > a', 0);
- $item = new \Item();
- $item->uri = $host.$lirelasuite_link->href;
- $item->title = $lirelasuite_link->title;
- $item->content = str_replace('href="/', 'href="'.$host.'/', $element->innertext);
- $this->items[] = $item;
- }
-
- public function getName(){
- return 'Wikipedia FR "Lumière sur..."';
- }
-
- public function getURI(){
- return 'https://fr.wikipedia.org/wiki/Wikip%C3%A9dia:Accueil_principal';
- }
-
- public function getCacheDuration(){
- return 3600*4; // 4 hours
- }
-}
diff --git a/bridges/WordPressBridge.php b/bridges/WordPressBridge.php
index fb432862..28e57048 100644
--- a/bridges/WordPressBridge.php
+++ b/bridges/WordPressBridge.php
@@ -1,16 +1,18 @@
maintainer = "aledeg";
$this->name = "Wordpress Bridge";
- $this->uri = "https://wordpress.com/";
+ $this->uri = "https://wordpress.org/";
$this->description = "Returns the 3 newest full posts of a Wordpress blog";
- $this->update = "2015-09-05";
+ $this->update = "2016-08-09";
$this->parameters[] =
'[
@@ -18,13 +20,40 @@ class WordPressBridge extends BridgeAbstract {
"name" : "blog URL",
"required" : "true",
"identifier" : "url"
- },
- {
- "name" : "Blog name",
- "identifier" : "name"
}
]';
+ }
+ // Returns the content type for a given html dom
+ private function DetectContentType($html){
+ if($html->find('entry'))
+ return WORDPRESS_TYPE_ATOM;
+ if($html->find('item'))
+ return WORDPRESS_TYPE_RSS;
+ return WORDPRESS_TYPE_ATOM; // Make ATOM default
+ }
+
+ // Replaces all 'link' tags with 'url' for simplehtmldom to actually find 'links' ('url')
+ private function ReplaceLinkTagsWithUrlTags($element){
+ // We need to fix the 'link' tag as simplehtmldom cannot parse it (just rename it and load back as dom)
+ $element_text = $element->outertext;
+ $element_text = str_replace(' ', '', $element_text);
+ $element_text = str_replace('', ' ', $element_text);
+ $element_text = str_replace(' ', '', $string);
+ return $string;
+ }
+
+ private function ClearContent($content) {
+ $content = preg_replace('/');
$contents = StripWithDelimiters($contents, ' ');
- $contents = StripWithDelimiters($contents, ''));
+ $content_img = strpos($contents, '
'; //Include thumbnail
+ $contents = $content_img
+ .''.$article_subtitle.'
'
+ .$contents;
$item = new \Item();
$item->author = $author;
$item->uri = $article_url;
$item->title = $article_title;
- $item->thumbnailUri = $thumbnail;
$item->timestamp = $article_timestamp;
$item->content = $contents;
$this->items[] = $item;
@@ -293,16 +298,4 @@ class ZDNetBridge extends BridgeAbstract {
}
}
-
- public function getName() {
- return 'ZDNet Bridge';
- }
-
- public function getURI() {
- return 'http://www.zdnet.com/';
- }
-
- public function getCacheDuration() {
- return 3600;
- }
-}
\ No newline at end of file
+}
diff --git a/bridges/ZatazBridge.php b/bridges/ZatazBridge.php
index baf28286..7a771daf 100644
--- a/bridges/ZatazBridge.php
+++ b/bridges/ZatazBridge.php
@@ -4,15 +4,15 @@ class ZatazBridge extends BridgeAbstract {
public function loadMetadatas() {
$this->maintainer = "aledeg";
- $this->name = "Zataz";
- $this->uri = "http://www.zataz.com/";
+ $this->name = 'Zataz Magazine';
+ $this->uri = 'http://www.zataz.com';
$this->description = "ZATAZ Magazine - S'informer, c'est déjà se sécuriser";
- $this->update = "07/02/2015";
+ $this->update = "2016-08-09";
}
public function collectData(array $param) {
- $html = $this->file_get_html($this->getURI()) or $this->returnError('Could not request ' . $this->getURI(), 404);
+ $html = $this->file_get_html($this->uri) or $this->returnError('Could not request ' . $this->uri, 404);
$recent_posts = $html->find('#recent-posts-3', 0)->find('ul', 0)->find('li');
foreach ($recent_posts as $article) {
@@ -42,16 +42,8 @@ class ZatazBridge extends BridgeAbstract {
return $date->format('U');
}
- public function getName() {
- return 'Zataz Magazine';
- }
-
public function getCacheDuration() {
return 7200; // 2h
}
- public function getURI() {
- return 'http://www.zataz.com';
- }
-
}
diff --git a/bridges/ZoneTelechargementBridge.php b/bridges/ZoneTelechargementBridge.php
index 07c29b7b..2d0c6b6a 100644
--- a/bridges/ZoneTelechargementBridge.php
+++ b/bridges/ZoneTelechargementBridge.php
@@ -4,10 +4,10 @@ class ZoneTelechargementBridge extends BridgeAbstract {
public function loadMetadatas() {
$this->maintainer = 'ORelio';
- $this->name = $this->getName();
- $this->uri = $this->getURI();
+ $this->name = 'Zone Telechargement Bridge';
+ $this->uri = 'https://www.zone-telechargement.com/';
$this->description = 'RSS proxy returning the newest releases. You may specify a category found in RSS URLs, else main feed is selected.';
- $this->update = "2016-03-16";
+ $this->update = "2016-08-06";
$this->parameters[] =
'[
@@ -43,16 +43,4 @@ class ZoneTelechargementBridge extends BridgeAbstract {
$limit++;
}
}
-
- public function getName() {
- return 'Zone Telechargement Bridge';
- }
-
- public function getURI() {
- return 'https://www.zone-telechargement.com/';
- }
-
- public function getCacheDuration() {
- return 3600;
- }
}
diff --git a/css/HtmlFormat.css b/css/HtmlFormat.css
new file mode 100644
index 00000000..cee20207
--- /dev/null
+++ b/css/HtmlFormat.css
@@ -0,0 +1,106 @@
+html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, figcaption, figure, footer, header, hgroup, menu, nav, section, summary, time, mark, audio, video {
+
+ margin: 0;
+ padding: 0;
+ border: 0;
+ outline: 0;
+ font-size: 100%;
+ font: inherit;
+ vertical-align: baseline;
+
+}
+/* HTML5 display-role reset for older browsers */
+article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {
+
+ display: block;
+
+}
+
+/* Let's go for the actual style */
+
+body {
+
+ background-color: #EEEEEE;
+ font-family: 'Noto Sans';
+
+}
+
+section {
+
+ background-color: #FFFFFF;
+ width: 90%;
+ margin: 30px auto;
+ padding: 10px 15px;
+
+ box-shadow: 0px 1px 2px rgba(0,0,0, 0.25);
+
+}
+
+section > h2 {
+
+ font-size: 200%;
+ font-weight: bold;
+ text-align: center;
+
+}
+
+h1.pagetitle {
+
+ font-size: 300%;
+ font-weight: bold;
+
+ text-align: center;
+ color: #2196F3;
+
+}
+
+h1.pagetitle > a {
+ color: #2196F3;
+}
+
+a.backlink, a.backlink:link, a.backlink:visited, a.itemtitle, a.itemtitle:link, a.itemtitle:visited {
+
+ color: #2196F3;
+
+}
+
+.buttons {
+
+ text-align: center;
+
+}
+
+section > div.content {
+
+ padding: 10px;
+
+}
+
+section > time, section > p.author {
+
+ color: #888;
+ font-size: 80%;
+ padding: 10px;
+
+}
+
+button.backbutton, button.rss-feed {
+
+ line-height: 1em;
+ color: #FFF;
+ font-weight: bold;
+ vertical-align: middle;
+ padding: 6px 12px;
+ margin: 12px auto 0px;
+ box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.3);
+ border-radius: 2px;
+ border: 1px solid transparent;
+ width: 200px;
+ background: #2196F3 none repeat scroll 0% 0%;
+ cursor: pointer;
+
+ margin: 10px;
+
+
+}
+
diff --git a/css/style.css b/css/style.css
index 36f25b78..f8305069 100644
--- a/css/style.css
+++ b/css/style.css
@@ -1,143 +1,196 @@
-/* html5 boilerplate from http://csswizardry.com/2011/01/the-real-html5-boilerplate/ */
-/*------------------------------------*\
- RESET
-\*------------------------------------*/
-/* http://meyerweb.com/eric/tools/css/reset/
- v2.0b1 | 201101
- NOTE:WORK IN PROGRESS
- USE WITH CAUTION AND TEST WITH ABANDON */
+html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, figcaption, figure, footer, header, hgroup, menu, nav, section, summary, time, mark, audio, video {
+
+ margin: 0;
+ padding: 0;
+ border: 0;
+ outline: 0;
+ font-size: 100%;
+ font: inherit;
+ vertical-align: baseline;
-html,body,div,span,applet,object,iframe,
-h1,h2,h3,h4,h5,h6,p,blockquote,pre,
-a,abbr,acronym,address,big,cite,code,
-del,dfn,em,img,ins,kbd,q,s,samp,
-small,strike,strong,sub,sup,tt,var,
-b,u,i,center,
-dl,dt,dd,ol,ul,li,
-fieldset,form,label,legend,
-table,caption,tbody,tfoot,thead,tr,th,td,
-article,aside,canvas,details,figcaption,figure,
-footer,header,hgroup,menu,nav,section,summary,
-time,mark,audio,video{
- margin:0;
- padding:0;
- border:0;
- outline:0;
- font-size:100%;
- font:inherit;
- vertical-align:baseline;
}
/* HTML5 display-role reset for older browsers */
-article,aside,details,figcaption,figure,
-footer,header,hgroup,menu,nav,section{
- display:block;
-}
-body{
- line-height:1;
-}
-ol,ul{
- list-style:none;
-}
-blockquote,q{
- quotes:none;
-}
-blockquote:before,blockquote:after,
-q:before,q:after{
- content:’’;
- content:none;
-}
-/* remember to define visible focus styles!
-:focus{
- outline:?????;
-} */
+article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {
+
+ display: block;
-/* remember to highlight inserts somehow! */
-ins{
- text-decoration:none;
-}
-del{
- text-decoration:line-through;
}
-table{
- border-collapse:collapse;
- border-spacing:0;
-}
-
-
-/*------------------------------------*\
- $MAIN
-\*------------------------------------*/
-/* GO! */
-
+/* Let's go for the actual style */
body {
- font-family: "Segoe UI", Candara, "Bitstream Vera Sans", "DejaVu Sans", "Bitstream Vera Sans", "Trebuchet MS", Verdana, "Verdana Ref", sans-serif;
- font-size: 120%;
+
+ background-color: #EEEEEE;
+ font-family: 'Noto Sans';
+
}
-h1 {
- font-size: 300%;
- font-weight: bold;
- text-shadow: 0 5px 6px rgba(150,150,150,0.69);
+header {
+
+ text-shadow:0 5px 6px rgba(150,150,150,0.69);
+ text-align: center;
+ color: #1182DB;
+
}
-h2 {
- font-size: 120%;
- margin-bottom: 10px;
+header > h1 {
+
+ font-size: 300%;
+
}
-h2 a {
- color:black;
-}
+header > h2 {
-form {
- margin-bottom: 10px;
-}
+ margin-left: 1em;
+ font-size: 120%;
-header,footer {
- max-width: 600px;
- margin: 0 auto;
- padding: 20px;
-}
-
-header h2 {
- margin-left:1em;
-}
-
-footer {
- text-align: center;
- font-size: 80%;
}
section {
- max-width: 600px;
- margin: 30px auto;
- padding: 10px 15px;
- -webkit-box-shadow: 0 0 9px rgba(50,50,50,0.51);
- -moz-box-shadow: 0 0 9px rgba(50,50,50,0.51);
- box-shadow: 0 0 9px rgba(50,50,50,0.51);
- background: #f5f5f5;
+
+ background-color: #FFFFFF;
+ width: 80%;
+ margin: 30px auto;
+ padding: 10px 15px;
+ text-align: center;
+
+ box-shadow: 0px 1px 2px rgba(0,0,0, 0.25);
+
+}
+
+
+section:last-of-type {
+
+ opacity: 0.5;
+
+}
+
+section:last-of-type:hover {
+
+ opacity: 1;
+
+}
+
+
+section > h2 {
+
+ font-size: 200%;
+ font-weight: bold;
+
+}
+
+a, a:link, a:visited {
+
+ color: #2196F3;
+
+}
+
+button {
+
+ line-height: 1.9em;
+ color: #FFF;
+ font-weight: bold;
+ vertical-align: middle;
+ padding: 6px 12px;
+ margin: 12px auto 0px;
+ box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.3);
+ border-radius: 2px;
+ border: 1px solid transparent;
+ min-width: 140px;
+ background: #2196F3 none repeat scroll 0% 0%;
+ cursor: pointer;
+
+ width: calc(20% - 4px);
+
+}
+
+button.small {
+
+ width: auto;
+ line-height: 1.2em;
+
}
.description {
- font-size:70%;
- margin-bottom: 10px;
- position:relative;
- bottom: 5px;
- color: #555;
+
+ margin: 10px;
+ text-decoration: underline;
+
+}
+
+h5 {
+
+ margin: 20px;
+ font-weight: bold;
+
+}
+
+form {
+
+ margin-bottom: 6px;
+
}
.maintainer {
- font-size:60%;
- float:right;
- color: #777;
+
+ font-size: 60%;
+ text-align: right;
+
}
-.placeholder {
- color: #aaa;
+input[type="text"] {
+
+ background-color: white;
+ color: #404552;
+ border: 0px;
+ border-bottom: 2px solid #2196F3;
+ font-size: 1.1em;
+ margin-left: 8px;
+ padding-left: 4px;
+
}
-input, label {
- font-size: 80%;
+form {
+
+ display: none;
+
+}
+
+h5 {
+
+ display: none;
+
+}
+
+.showmore-box {
+
+ display: none;
+
+}
+
+.showmore, .showless {
+
+ color: #888888;
+ cursor: pointer;
+
+}
+
+.showmore-box:checked ~ .showmore {
+
+ display: none;
+
+}
+
+.showmore-box:not(:checked) ~ .showless {
+
+ display: none;
+
+}
+
+
+
+.showmore-box:checked ~ form, .showmore-box:checked ~ h5 {
+
+ display: block;
+
}
diff --git a/formats/AtomFormat.php b/formats/AtomFormat.php
index 303e3866..06ef8eb0 100644
--- a/formats/AtomFormat.php
+++ b/formats/AtomFormat.php
@@ -1,9 +1,4 @@
xml_encode($_SERVER['REQUEST_URI']);
$extraInfos = $this->getExtraInfos();
- $title = xml_encode($extraInfos['name']);
- $uri = $extraInfos['uri'];
- $icon = xml_encode('http://icons.better-idea.org/icon?url='. $uri .'&size=64');
- $uri = xml_encode($uri);
+ $title = $this->xml_encode($extraInfos['name']);
+ $uri = !empty($extraInfos['uri']) ? $extraInfos['uri'] : 'https://github.com/sebsauvage/rss-bridge';
+ $icon = $this->xml_encode('http://icons.better-idea.org/icon?url='. $uri .'&size=64');
+ $uri = $this->xml_encode($uri);
$entries = '';
foreach($this->getDatas() as $data){
- $entryName = is_null($data->name) ? $title : xml_encode($data->name);
- $entryAuthor = is_null($data->author) ? $uri : xml_encode($data->author);
- $entryTitle = is_null($data->title) ? '' : xml_encode($data->title);
- $entryUri = is_null($data->uri) ? '' : xml_encode($data->uri);
- $entryTimestamp = is_null($data->timestamp) ? '' : xml_encode(date(DATE_ATOM, $data->timestamp));
- // We prevent content from closing the CDATA too early.
- $entryContent = is_null($data->content) ? '' : 'sanitizeHtml(str_replace(']]>','',$data->content)) . ']]>';
-
- // We generate a list of the enclosure links
- $entryEnclosures = "";
-
- foreach($data->enclosures as $enclosure) {
-
- $entryEnclosures .= " ";
-
- }
-
+ $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 .= <<
- {$entryName}
- {$entryAuthor}
+ {$entryAuthor}
{$entryUri}
{$entryTimestamp}
{$entryContent}
- {$entryEnclosures}
EOD;
@@ -108,4 +89,8 @@ EOD;
return parent::display();
}
+
+ private function xml_encode($text) {
+ return htmlspecialchars($text, ENT_XML1);
+ }
}
diff --git a/formats/HtmlFormat.php b/formats/HtmlFormat.php
index 4bc48abd..19b7702d 100644
--- a/formats/HtmlFormat.php
+++ b/formats/HtmlFormat.php
@@ -12,61 +12,46 @@ class HtmlFormat extends FormatAbstract{
$extraInfos = $this->getExtraInfos();
$title = htmlspecialchars($extraInfos['name']);
$uri = htmlspecialchars($extraInfos['uri']);
- $atomquery = str_replace('format=HtmlFormat', 'format=AtomFormat', htmlentities($_SERVER['QUERY_STRING']));
+ $atomquery = str_replace('format=HtmlFormat', 'format=AtomFormat', htmlentities($_SERVER['QUERY_STRING']));
+ $mrssquery = str_replace('format=HtmlFormat', 'format=MrssFormat', htmlentities($_SERVER['QUERY_STRING']));
$entries = '';
foreach($this->getDatas() as $data){
- $entryUri = is_null($data->uri) ? $uri : $data->uri;
+ $entryAuthor = is_null($data->author) ? '' : 'by: ' . $data->author . '
';
$entryTitle = is_null($data->title) ? '' : $this->sanitizeHtml(strip_tags($data->title));
- $entryTimestamp = is_null($data->timestamp) ? '' : '' . date(DATE_ATOM, $data->timestamp) . ' ';
- $entryAuthor = is_null($data->author) ? '' : 'by: ' . $data->author . ' ';
- $entryContent = is_null($data->content) ? '' : '' . $this->sanitizeHtml($data->content). '
';
+ $entryUri = is_null($data->uri) ? $uri : $data->uri;
+ $entryTimestamp = is_null($data->timestamp) ? '' : '' . date(DATE_ATOM, $data->timestamp) . ' ';
+ $entryContent = is_null($data->content) ? '' : '' . $this->sanitizeHtml($data->content). '
';
$entries .= <<
-
- {$entryTimestamp}
- {$entryAuthor}
- {$entryContent}
-
+