| ... | ... |
@@ -4,10 +4,10 @@ The original responsive template is from [**raspap-webgui**](https://github.com/ |
| 4 | 4 |
|
| 5 | 5 |
## Contents |
| 6 | 6 |
|
| 7 |
- - [Prerequisites](#prerequisites) |
|
| 8 |
- - [Quick installer](#quick-installer) |
|
| 9 |
- - [Supported Feeds](#supported-feeds) |
|
| 10 |
- - [License](#license) |
|
| 7 |
+ - Prerequisites |
|
| 8 |
+ - Quick installer |
|
| 9 |
+ - Supported Feeds |
|
| 10 |
+ - License |
|
| 11 | 11 |
|
| 12 | 12 |
## Prerequisites |
| 13 | 13 |
- cronjob support |
| ... | ... |
@@ -33,6 +33,7 @@ Currently are supported the following feeds : |
| 33 | 33 |
- https://www.vice.com/fr/rss |
| 34 | 34 |
- http://www.lesinrocks.com/feeds/feed-a-la-une/ |
| 35 | 35 |
- http://www.numerama.com/rss/news.rss |
| 36 |
+- http://www.huffingtonpost.fr/feeds/index.xml |
|
| 36 | 37 |
|
| 37 | 38 |
## License |
| 38 | 39 |
GPLv3 See the **LICENSE** file. |
| ... | ... |
@@ -0,0 +1,41 @@ |
| 1 |
+<?php |
|
| 2 |
+function DisplayNewsHuffingtonPostFr(){
|
|
| 3 |
+ |
|
| 4 |
+ $status = new StatusMessages(); |
|
| 5 |
+ ?> |
|
| 6 |
+ <script> |
|
| 7 |
+ function onArticle(index) {
|
|
| 8 |
+ var string_index = "article-"+index; |
|
| 9 |
+ var url = location.href; |
|
| 10 |
+ document.getElementById("article-current").innerHTML =
|
|
| 11 |
+ document.getElementById(string_index).innerHTML; |
|
| 12 |
+ location.href = "#article-top"; |
|
| 13 |
+ } |
|
| 14 |
+ </script> |
|
| 15 |
+ <div class="row"> |
|
| 16 |
+ <div class="col-lg-12"> |
|
| 17 |
+ <div class="panel panel-primary"> |
|
| 18 |
+ <div class="panel-heading"><i class="fa fa-newspaper-o fa-fw"></i> HuffingtonPost.fr </div> |
|
| 19 |
+ <div class="panel-body"> |
|
| 20 |
+ <p><?php $status->showMessages(); ?></p> |
|
| 21 |
+ <div class="row"> |
|
| 22 |
+ <div class="col-md-6"> |
|
| 23 |
+ <div class="panel panel-default"> |
|
| 24 |
+ <div class="panel-body"> |
|
| 25 |
+ <?php |
|
| 26 |
+ $articles = file_get_contents(NEWS_RSS_HUFFINGTONPOSTFR); |
|
| 27 |
+ echo $articles; |
|
| 28 |
+ ?> |
|
| 29 |
+ </div><!-- ./panel-body --> |
|
| 30 |
+ </div><!-- ./panel panel-default --> |
|
| 31 |
+ </div><!-- ./col-md-6 --> |
|
| 32 |
+ </div> <!-- /row --> |
|
| 33 |
+ </div><!-- /.panel-body --> |
|
| 34 |
+ <div class="panel-footer"><a href="<?php echo URI_NEWS_RSS_HUFFINGTONPOSTFR; ?>"><i class="fa fa-rss"></i> <?php echo URI_NEWS_RSS_HUFFINGTONPOSTFR; ?></a></div> |
|
| 35 |
+ </div><!-- /.panel-default --> |
|
| 36 |
+ </div><!-- /.col-lg-12 --> |
|
| 37 |
+ </div><!-- /.row --> |
|
| 38 |
+ <?php |
|
| 39 |
+} |
|
| 40 |
+ |
|
| 41 |
+?> |
| ... | ... |
@@ -6,12 +6,14 @@ define('NEWS_RSS_SLATEFR', 'sources/slatefr.html');
|
| 6 | 6 |
define('NEWS_RSS_VICEFR', 'sources/vicefr.html');
|
| 7 | 7 |
define('NEWS_RSS_LESINROCKS', 'sources/lesinrocks.html');
|
| 8 | 8 |
define('NEWS_RSS_NUMERAMA', 'sources/numerama.html');
|
| 9 |
+define('NEWS_RSS_HUFFINGTONPOSTFR', 'sources/huffingtonpostfr.html');
|
|
| 9 | 10 |
define('URI_NEWS_RSS_LEMONDE', 'http://www.lemonde.fr/rss/une.xml');
|
| 10 | 11 |
define('URI_NEWS_RSS_LIBERATION', 'http://rss.liberation.fr/rss/latest/');
|
| 11 | 12 |
define('URI_NEWS_RSS_SLATEFR', 'https://www.slate.fr/rss.xml');
|
| 12 | 13 |
define('URI_NEWS_RSS_VICEFR', 'http://www.vice.com/fr/rss');
|
| 13 | 14 |
define('URI_NEWS_RSS_LESINROCKS', 'http://www.lesinrocks.com/feeds/feed-a-la-une/');
|
| 14 | 15 |
define('URI_NEWS_RSS_NUMERAMA', 'http://www.numerama.com/rss/news.rss');
|
| 16 |
+define('URI_NEWS_RSS_HUFFINGTONPOSTFR', 'http://www.huffingtonpost.fr/feeds/index.xml');
|
|
| 15 | 17 |
|
| 16 | 18 |
include_once( 'includes/functions.php' ); |
| 17 | 19 |
include_once( 'includes/status_messages.php' ); |
| ... | ... |
@@ -22,6 +24,7 @@ include_once( 'includes/slatefr.php' ); |
| 22 | 24 |
include_once( 'includes/vicefr.php' ); |
| 23 | 25 |
include_once( 'includes/lesinrocks.php' ); |
| 24 | 26 |
include_once( 'includes/numerama.php' ); |
| 27 |
+include_once( 'includes/huffingtonpostfr.php' ); |
|
| 25 | 28 |
include_once( 'includes/default.php' ); |
| 26 | 29 |
|
| 27 | 30 |
$output = $return = 0; |
| ... | ... |
@@ -110,6 +113,9 @@ $theme_url = 'dist/css/' . $theme; |
| 110 | 113 |
<li> |
| 111 | 114 |
<a href="index.php?page=numerama"><i class="fa fa-newspaper-o fa-fw"></i> Numerama</a> |
| 112 | 115 |
</li> |
| 116 |
+ <li> |
|
| 117 |
+ <a href="index.php?page=huffingtonpostfr"><i class="fa fa-newspaper-o fa-fw"></i> HuffingtonPost.fr</a> |
|
| 118 |
+ </li> |
|
| 113 | 119 |
</ul> |
| 114 | 120 |
</div><!-- /.navbar-collapse --> |
| 115 | 121 |
</div><!-- /.navbar-default --> |
| ... | ... |
@@ -147,6 +153,9 @@ $theme_url = 'dist/css/' . $theme; |
| 147 | 153 |
case "numerama": |
| 148 | 154 |
DisplayNewsNumerama(); |
| 149 | 155 |
break; |
| 156 |
+ case "huffingtonpostfr": |
|
| 157 |
+ DisplayNewsHuffingtonPostFr(); |
|
| 158 |
+ break; |
|
| 150 | 159 |
default: |
| 151 | 160 |
DisplayNewsDefault(); |
| 152 | 161 |
} |
| ... | ... |
@@ -6,4 +6,5 @@ php news-slate.fr.php > slatefr.html 2> /dev/null |
| 6 | 6 |
php news-vice.fr.php > vicefr.html 2> /dev/null |
| 7 | 7 |
php news-lesinrocks.fr.php > lesinrocks.html 2> /dev/null |
| 8 | 8 |
php news-numerama.fr.php > numerama.html 2> /dev/null |
| 9 |
+php news-huffingtonpost.fr.php > huffingtonpostfr.html 2> /dev/null |
|
| 9 | 10 |
|
| ... | ... |
@@ -6,3 +6,5 @@ php news-slate.fr.php > slatefr.html 2> /dev/null |
| 6 | 6 |
php news-vice.fr.php > vicefr.html 2> /dev/null |
| 7 | 7 |
php news-lesinrocks.fr.php > lesinrocks.html 2> /dev/null |
| 8 | 8 |
php news-numerama.fr.php > numerama.html 2> /dev/null |
| 9 |
+php news-huffingtonpost.fr.php > huffingtonpostfr.html 2> /dev/null |
|
| 10 |
+ |
| ... | ... |
@@ -5,6 +5,7 @@ define('NEWS_RSS_SLATEFR', 'https://www.slate.fr/rss.xml');
|
| 5 | 5 |
define('NEWS_RSS_VICEFR', 'https://www.vice.com/fr/rss');
|
| 6 | 6 |
define('NEWS_RSS_LESINROCKS', 'http://www.lesinrocks.com/feeds/feed-a-la-une/');
|
| 7 | 7 |
define('NEWS_RSS_NUMERAMA', 'http://www.numerama.com/rss/news.rss');
|
| 8 |
+define('NEWS_RSS_HUFFINGTONPOSTFR', 'http://www.huffingtonpost.fr/feeds/index.xml');
|
|
| 8 | 9 |
$NEWS_RSS_MAX_ITEMS = 10; |
| 9 | 10 |
|
| 10 | 11 |
function DOMinnerHTML(DOMNode $element) |
| ... | ... |
@@ -0,0 +1,129 @@ |
| 1 |
+<?php |
|
| 2 |
+include_once( 'news-constants.php' ); |
|
| 3 |
+ |
|
| 4 |
+$rss_content = file_get_contents(NEWS_RSS_HUFFINGTONPOSTFR); |
|
| 5 |
+$xml = simplexml_load_string($rss_content); |
|
| 6 |
+if ($xml === false) {
|
|
| 7 |
+ echo 'Failed to read RSS'; |
|
| 8 |
+} else {
|
|
| 9 |
+ $channel = array(); |
|
| 10 |
+ $channel['title'] = $xml->channel->title; |
|
| 11 |
+ $channel['link'] = $xml->channel->link; |
|
| 12 |
+ $channel['description'] = $xml->channel->description; |
|
| 13 |
+ $channel['pubDate'] = $xml->channel->pubDate; |
|
| 14 |
+ $channel['timestamp'] = strtotime($xml->channel->pubDate); |
|
| 15 |
+ echo '<h4>' . $channel['title'] . '</h4>'; |
|
| 16 |
+ $cpt=0; |
|
| 17 |
+ foreach ($xml->channel->item as $item) {
|
|
| 18 |
+ $article = array(); |
|
| 19 |
+ $article['title'] = $item->title; |
|
| 20 |
+ $article['link'] = $item->link; |
|
| 21 |
+ $article['pubDate'] = $item->pubDate; |
|
| 22 |
+ $article['timestamp'] = strtotime($item->pubDate); |
|
| 23 |
+ $article['description'] = $item->description; |
|
| 24 |
+ $SEARCH_SUB1='<p><img width="1024" height="'; |
|
| 25 |
+ $pos_start = strpos($item->description, $SEARCH_SUB1); |
|
| 26 |
+ $pos_start += strlen($SEARCH_SUB1); |
|
| 27 |
+ $SEARCH_SUB2="\""; |
|
| 28 |
+ $pos_stop = strpos($item->description, $SEARCH_SUB2, $pos_start); |
|
| 29 |
+ $height=substr($item->description, $pos_start, $pos_stop - $pos_start); |
|
| 30 |
+ $article['width']=1024; |
|
| 31 |
+ $article['height']=$height; |
|
| 32 |
+ $SEARCH_SUB1='src="'; |
|
| 33 |
+ $pos_start = strpos($item->description, $SEARCH_SUB1); |
|
| 34 |
+ $pos_start += strlen($SEARCH_SUB1); |
|
| 35 |
+ $SEARCH_SUB2="\""; |
|
| 36 |
+ $pos_stop = strpos($item->description, $SEARCH_SUB2, $pos_start); |
|
| 37 |
+ $article['image']=substr($item->description, $pos_start, $pos_stop - $pos_start); |
|
| 38 |
+ $articles[$cpt] = $article; |
|
| 39 |
+ echo '<div onclick="onArticle('.$cpt.')" style="display:inline;">';
|
|
| 40 |
+ echo '<img src="'.$article['image'].'" style="display:inline;" width="100%"><br>'; |
|
| 41 |
+ echo '<div id="nav-up" style="display:inline;"><a href="#top"><i class="fa fa-home fa-2x"></i></a></div> '; |
|
| 42 |
+ echo '<div id="nav-up" style="display:inline;"><a href="#article-top"><i class="fa fa-chevron-down fa-2x"></i></a></div> '; |
|
| 43 |
+ echo $article['title'].' '; |
|
| 44 |
+ echo '<div id="nav-source" style="display:inline;"><a href="'.$article['link'].'" target="new-'.$cpt.'"><i class="fa fa-link fa-2x"></i></a><br></div></div>'; |
|
| 45 |
+ $cpt++; |
|
| 46 |
+ if( $cpt > $NEWS_RSS_MAX_ITEMS ) {
|
|
| 47 |
+ break; |
|
| 48 |
+ } |
|
| 49 |
+ } |
|
| 50 |
+} |
|
| 51 |
+echo '</div><!-- ./panel-body -->'; |
|
| 52 |
+echo '</div><!-- ./panel panel-default -->'; |
|
| 53 |
+echo '</div><!-- ./col-md-6 -->'; |
|
| 54 |
+echo '<div class="col-md-6">'; |
|
| 55 |
+echo '<div class="panel panel-default">'; |
|
| 56 |
+echo '<div class="panel-body">'; |
|
| 57 |
+echo '<a name="article-top"></a><div id="article-current"></div>'; |
|
| 58 |
+$cpt=0; |
|
| 59 |
+foreach ($articles as $article ) {
|
|
| 60 |
+ $cpt_prev=$cpt-1; |
|
| 61 |
+ $cpt_next=$cpt+1; |
|
| 62 |
+ echo '<!-- ==================== article '.$cpt.'============== -->'; |
|
| 63 |
+ echo "<div class=\"article\" id=\"article-$cpt\" style=\"display: none;\">\n"; |
|
| 64 |
+ echo "<hr>"; |
|
| 65 |
+ echo "<a name=\"article-$cpt\">"; |
|
| 66 |
+ $article_content = file_get_contents($article['link']); |
|
| 67 |
+ $SEARCH_SUB1='<article class="entry__content ">'; |
|
| 68 |
+ $pos_start = strpos($article_content, $SEARCH_SUB1); |
|
| 69 |
+ $pos_start += strlen($SEARCH_SUB1); |
|
| 70 |
+ $SEARCH_SUB2='<a class="follow-us__correction"'; |
|
| 71 |
+ $pos_stop = strpos($article_content, $SEARCH_SUB2); |
|
| 72 |
+ $article_only = substr($article_content, $pos_start, $pos_stop - $pos_start); |
|
| 73 |
+ |
|
| 74 |
+ $orgStrings = array( ' width="500" height="281" frameborder="0" '); |
|
| 75 |
+ $newStrings = array( ' width="100%" frameborder="0" '); |
|
| 76 |
+ $article_only = str_replace($orgStrings, $newStrings, $article_only); |
|
| 77 |
+ $orgStrings = array( 'style="width: 680px"'); |
|
| 78 |
+ $newStrings = array( 'style="width: 100%"'); |
|
| 79 |
+ $article_only = str_replace($orgStrings, $newStrings, $article_only); |
|
| 80 |
+ $orgStrings = array( '<img src="'); |
|
| 81 |
+ $newStrings = array( '<img width="100%" src="'); |
|
| 82 |
+ $article_only = str_replace($orgStrings, $newStrings, $article_only); |
|
| 83 |
+ $re = '/alt="(.+?)" width="(.+?)" height="(.+?)"/'; |
|
| 84 |
+ $temp = preg_replace($re, 'width="100%"', $article_only); |
|
| 85 |
+ $article_only = $temp; |
|
| 86 |
+ $re = '/alt="" width="(.+?)" height="(.+?)"/'; |
|
| 87 |
+ $temp = preg_replace($re, 'width="100%"', $article_only); |
|
| 88 |
+ $article_only = $temp; |
|
| 89 |
+ $re = '/<iframe width="500" height="(.+?)"/'; |
|
| 90 |
+ $temp = preg_replace($re, '<iframe width="100%"', $article_only); |
|
| 91 |
+ $article_only = $temp; |
|
| 92 |
+ $re = '/sizes="\(max-width: (.+?)\) 100vw, (.+?)"/'; |
|
| 93 |
+ $temp = preg_replace($re, 'sizes="(max-width: 100%) 100vw,100%"', $article_only); |
|
| 94 |
+ $article_only = $temp; |
|
| 95 |
+ $re = '/<figure id="attachment_(.+?)" style="width: (.+?)" class="wp-caption aligncenter">/'; |
|
| 96 |
+ $temp = preg_replace($re, '<figure id="attachment_\\1" style="width: 100%" class="wp-caption aligncenter">', $article_only); |
|
| 97 |
+ $article_only = $temp; |
|
| 98 |
+ $re = '/<img class="aligncenter size-full wp-image-(.+?)"/'; |
|
| 99 |
+ $temp = preg_replace($re, '<img ', $article_only); |
|
| 100 |
+ $article_only = $temp; |
|
| 101 |
+ $re = '/<iframe (.+?) height="(.+?)" (.+?) width="(.+?)">/'; |
|
| 102 |
+ $temp = preg_replace($re, '<iframe \\1 \\3 width="100%"', $article_only); |
|
| 103 |
+ $article_only = $temp; |
|
| 104 |
+ $re = '/<img class="image__src"/'; |
|
| 105 |
+ $temp = preg_replace($re, '<img class="image__src" width="100%"', $article_only); |
|
| 106 |
+ $article_only = $temp; |
|
| 107 |
+ |
|
| 108 |
+ $temp = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $article_only);
|
|
| 109 |
+ $article_only = $temp; |
|
| 110 |
+ $temp = preg_replace('/\s\s+/', ' ', $article_only);
|
|
| 111 |
+ $article_only = $temp; |
|
| 112 |
+ echo '<div id="nav-up" style="display:inline;"><a href="#top"><i class="fa fa-home fa-2x"></i></a></div> '; |
|
| 113 |
+ echo '<div id="nav-source" style="display:inline;"><a href="'.$article['link'].'" target="new-'.$cpt.'"><i class="fa fa-link fa-2x"></i></a></div> '; |
|
| 114 |
+ echo '<div id="nav-prev" onclick="onArticle('.$cpt_prev.')" style="display:inline;"><i class="fa fa-chevron-left fa-2x"></i></div> ';
|
|
| 115 |
+ echo '<div id="nav-next" onclick="onArticle('.$cpt_next.')" style="display:inline;"><i class="fa fa-chevron-right fa-2x"></i></div>';
|
|
| 116 |
+ echo '<div class="extract-content" id="'.$cpt.'">'; |
|
| 117 |
+ echo '<h4>'.$article['title'].'</h4>'; |
|
| 118 |
+ echo $article_only.'</div>'; |
|
| 119 |
+ echo '<div id="nav-up" style="display:inline;"><a href="#top"><i class="fa fa-home fa-2x"></i></a></div> '; |
|
| 120 |
+ echo '<div id="nav-up" style="display:inline;"><a href="#article-top"><i class="fa fa-chevron-upi fa-2x"></i></a></div> '; |
|
| 121 |
+ echo '<div id="nav-source" style="display:inline;"><a href="'.$article['link'].'" target="new-'.$cpt.'"><i class="fa fa-link fa-2x"></i></a></div> '; |
|
| 122 |
+ echo '<div id="nav-prev" onclick="onArticle('.$cpt_prev.')" style="display:inline;"><i class="fa fa-chevron-left fa-2x"></i></div> ';
|
|
| 123 |
+ echo '<div id="nav-next" onclick="onArticle('.$cpt_next.')" style="display:inline;"><i class="fa fa-chevron-right fa-2x"></i></div></div>';
|
|
| 124 |
+ $cpt++; |
|
| 125 |
+ if( $cpt > $NEWS_RSS_MAX_ITEMS ) {
|
|
| 126 |
+ break; |
|
| 127 |
+ } |
|
| 128 |
+} |
|
| 129 |
+?> |