| ... | ... |
@@ -0,0 +1,41 @@ |
| 1 |
+<?php |
|
| 2 |
+function DisplayNewsLExpressFr(){
|
|
| 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> L'Express.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(SRC_NEWS_RSS_LEXPRESSFR); |
|
| 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 NEWS_RSS_LEXPRESSFR; ?>"><i class="fa fa-rss"></i> <?php echo NEWS_RSS_LEXPRESSFR; ?></a></div> |
|
| 35 |
+ </div><!-- /.panel-default --> |
|
| 36 |
+ </div><!-- /.col-lg-12 --> |
|
| 37 |
+ </div><!-- /.row --> |
|
| 38 |
+ <?php |
|
| 39 |
+} |
|
| 40 |
+ |
|
| 41 |
+?> |
| ... | ... |
@@ -1,22 +1,6 @@ |
| 1 | 1 |
<?php |
| 2 | 2 |
ob_start("ob_gzhandler");
|
| 3 |
-define('NEWS_RSS_LEMONDE', 'sources/lemonde.html');
|
|
| 4 |
-define('NEWS_RSS_LIBERATION', 'sources/liberation.html');
|
|
| 5 |
-define('NEWS_RSS_SLATEFR', 'sources/slatefr.html');
|
|
| 6 |
-define('NEWS_RSS_VICEFR', 'sources/vicefr.html');
|
|
| 7 |
-define('NEWS_RSS_LESINROCKS', 'sources/lesinrocks.html');
|
|
| 8 |
-define('NEWS_RSS_NUMERAMA', 'sources/numerama.html');
|
|
| 9 |
-define('NEWS_RSS_HUFFINGTONPOSTFR', 'sources/huffingtonpostfr.html');
|
|
| 10 |
-define('NEWS_RSS_LEPOINTFR', 'sources/lepointfr.html');
|
|
| 11 |
-define('URI_NEWS_RSS_LEMONDE', 'http://www.lemonde.fr/rss/une.xml');
|
|
| 12 |
-define('URI_NEWS_RSS_LIBERATION', 'http://rss.liberation.fr/rss/latest/');
|
|
| 13 |
-define('URI_NEWS_RSS_SLATEFR', 'https://www.slate.fr/rss.xml');
|
|
| 14 |
-define('URI_NEWS_RSS_VICEFR', 'http://www.vice.com/fr/rss');
|
|
| 15 |
-define('URI_NEWS_RSS_LESINROCKS', 'http://www.lesinrocks.com/feeds/feed-a-la-une/');
|
|
| 16 |
-define('URI_NEWS_RSS_NUMERAMA', 'http://www.numerama.com/rss/news.rss');
|
|
| 17 |
-define('URI_NEWS_RSS_HUFFINGTONPOSTFR', 'http://www.huffingtonpost.fr/feeds/index.xml');
|
|
| 18 |
-define('URI_NEWS_RSS_LEPOINTFR', 'http://www.lepoint.fr/24h-infos/rss.xml');
|
|
| 19 |
- |
|
| 3 |
+include_once( 'sources/rss.php' ); |
|
| 20 | 4 |
include_once( 'includes/functions.php' ); |
| 21 | 5 |
include_once( 'includes/status_messages.php' ); |
| 22 | 6 |
include_once( 'includes/themes.php' ); |
| ... | ... |
@@ -28,6 +12,7 @@ include_once( 'includes/lesinrocks.php' ); |
| 28 | 12 |
include_once( 'includes/numerama.php' ); |
| 29 | 13 |
include_once( 'includes/huffingtonpostfr.php' ); |
| 30 | 14 |
include_once( 'includes/lepointfr.php' ); |
| 15 |
+include_once( 'includes/lexpressfr.php' ); |
|
| 31 | 16 |
include_once( 'includes/default.php' ); |
| 32 | 17 |
|
| 33 | 18 |
$output = $return = 0; |
| ... | ... |
@@ -104,6 +89,7 @@ $theme_url = 'dist/css/' . $theme; |
| 104 | 89 |
<li><a href="index.php?page=numerama"><i class="fa fa-newspaper-o fa-fw"></i> Numerama</a></li> |
| 105 | 90 |
<li><a href="index.php?page=huffingtonpostfr"><i class="fa fa-newspaper-o fa-fw"></i> HuffingtonPost.fr</a></li> |
| 106 | 91 |
<li><a href="index.php?page=lepointfr"><i class="fa fa-newspaper-o fa-fw"></i> LePoint.fr</a></li> |
| 92 |
+ <li><a href="index.php?page=lexpressfr"><i class="fa fa-newspaper-o fa-fw"></i> L'Express.fr</a></li> |
|
| 107 | 93 |
<li><a href="index.php?page=vicefr"><i class="fa fa-newspaper-o fa-fw"></i> Vice.fr</a></li> |
| 108 | 94 |
<li><a href="index.php?page=lesinrocks"><i class="fa fa-newspaper-o fa-fw"></i> LesInrocks.fr</a></li> |
| 109 | 95 |
</ul> |
| ... | ... |
@@ -149,6 +135,9 @@ $theme_url = 'dist/css/' . $theme; |
| 149 | 135 |
case "lepointfr": |
| 150 | 136 |
DisplayNewsLePointFr(); |
| 151 | 137 |
break; |
| 138 |
+ case "lexpressfr": |
|
| 139 |
+ DisplayNewsLExpressFr(); |
|
| 140 |
+ break; |
|
| 152 | 141 |
default: |
| 153 | 142 |
DisplayNewsDefault(); |
| 154 | 143 |
} |
| ... | ... |
@@ -8,3 +8,4 @@ php news-lesinrocks.fr.php > lesinrocks.html 2> /dev/null |
| 8 | 8 |
php news-numerama.fr.php > numerama.html 2> /dev/null |
| 9 | 9 |
php news-huffingtonpost.fr.php > huffingtonpostfr.html 2> /dev/null |
| 10 | 10 |
php news-lepoint.fr.php > lepointfr.html 2> /dev/null |
| 11 |
+php news-lexpress.fr.php > lexpressfr.html 2> /dev/null |
| ... | ... |
@@ -8,3 +8,4 @@ php news-lesinrocks.fr.php > lesinrocks.html 2> /dev/null |
| 8 | 8 |
php news-numerama.fr.php > numerama.html 2> /dev/null |
| 9 | 9 |
php news-huffingtonpost.fr.php > huffingtonpostfr.html 2> /dev/null |
| 10 | 10 |
php news-lepoint.fr.php > lepointfr.html 2> /dev/null |
| 11 |
+php news-lexpress.fr.php > lexpressfr.html 2> /dev/null |
| ... | ... |
@@ -0,0 +1,176 @@ |
| 1 |
+<?php |
|
| 2 |
+include_once( 'news-constants.php' ); |
|
| 3 |
+ |
|
| 4 |
+$rss_content = http_get_contents(NEWS_RSS_LEXPRESSFR); |
|
| 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 |
+ $orgStrings = array('#xtor=RSS-221');
|
|
| 22 |
+ $newStrings = array('');
|
|
| 23 |
+ $article['link'] = str_replace($orgStrings, $newStrings, $article['link']); |
|
| 24 |
+ $article['pubDate'] = $item->pubDate; |
|
| 25 |
+ $article['timestamp'] = strtotime($item->pubDate); |
|
| 26 |
+ $article['description'] = $item->description; |
|
| 27 |
+ $article['image'] = $item->enclosure['url']; |
|
| 28 |
+ //$articles[$article['timestamp']] = $article; |
|
| 29 |
+ $articles[$cpt] = $article; |
|
| 30 |
+ echo '<div onclick="onArticle('.$cpt.')" style="display:inline;">';
|
|
| 31 |
+ echo '<img src="'.$article['image'].'" style="display:inline;" width="100%"><br>'; |
|
| 32 |
+ echo '<div id="nav-up" style="display:inline;"><a href="#top"><i class="fa fa-home fa-2x"></i></a></div> '; |
|
| 33 |
+ echo '<div id="nav-up" style="display:inline;"><a href="#article-top"><i class="fa fa-chevron-down fa-2x"></i></a></div> '; |
|
| 34 |
+ echo $article['title'].' '; |
|
| 35 |
+ 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>'; |
|
| 36 |
+ $cpt++; |
|
| 37 |
+ if( $cpt > $NEWS_RSS_MAX_ITEMS ) {
|
|
| 38 |
+ break; |
|
| 39 |
+ } |
|
| 40 |
+ } |
|
| 41 |
+} |
|
| 42 |
+echo '</div><!-- ./panel-body -->'; |
|
| 43 |
+echo '</div><!-- ./panel panel-default -->'; |
|
| 44 |
+echo '</div><!-- ./col-md-6 -->'; |
|
| 45 |
+echo '<div class="col-md-6">'; |
|
| 46 |
+echo '<div class="panel panel-default">'; |
|
| 47 |
+echo '<div class="panel-body">'; |
|
| 48 |
+echo '<a name="article-top"></a><div id="article-current"></div>'; |
|
| 49 |
+$cpt=0; |
|
| 50 |
+foreach ($articles as $article ) {
|
|
| 51 |
+ $cpt_prev=$cpt-1; |
|
| 52 |
+ $cpt_next=$cpt+1; |
|
| 53 |
+ echo '<!-- ==================== article '.$cpt.'============== -->'; |
|
| 54 |
+ echo "<div class=\"article\" id=\"article-$cpt\" style=\"display: none;\">\n"; |
|
| 55 |
+ echo "<hr>"; |
|
| 56 |
+ echo "<a name=\"article-$cpt\">"; |
|
| 57 |
+ $article_content = http_get_contents($article['link']); |
|
| 58 |
+ |
|
| 59 |
+ $SEARCH_SUB1='<h1 class="art-titre list-view">'; |
|
| 60 |
+ $pos_start = strpos($article_content, $SEARCH_SUB1); |
|
| 61 |
+ $pos_stop = false; |
|
| 62 |
+ if(!$pos_start) {
|
|
| 63 |
+ $SEARCH_SUB1='<h2 class="art-chapeau">'; |
|
| 64 |
+ $pos_start = strpos($article_content, $SEARCH_SUB1); |
|
| 65 |
+ } |
|
| 66 |
+ if($pos_start) {
|
|
| 67 |
+ $SEARCH_SUB1='<h3 class="header-meme-sujet">'; |
|
| 68 |
+ $pos_stop = strpos($article_content, $SEARCH_SUB1); |
|
| 69 |
+ if(!$pos_stop) {
|
|
| 70 |
+ $SEARCH_SUB1='<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>'; |
|
| 71 |
+ $pos_stop = strpos($article_content, $SEARCH_SUB1); |
|
| 72 |
+ if(!$pos_stop) {
|
|
| 73 |
+ $SEARCH_SUB1='</article>'; |
|
| 74 |
+ $pos_stop = strpos($article_content, $SEARCH_SUB1); |
|
| 75 |
+ } |
|
| 76 |
+ } |
|
| 77 |
+ } |
|
| 78 |
+ |
|
| 79 |
+ if( $pos_start && $pos_stop ) {
|
|
| 80 |
+ $article_only = substr($article_content, $pos_start, $pos_stop - $pos_start); |
|
| 81 |
+ } else {
|
|
| 82 |
+ $article_only=""; |
|
| 83 |
+ } |
|
| 84 |
+ |
|
| 85 |
+ //echo "pos_start : $pos_start<br>"; |
|
| 86 |
+ //echo "pos_stop : $pos_stop<br>"; |
|
| 87 |
+ |
|
| 88 |
+ $orgStrings = array( ' href="/', |
|
| 89 |
+ ' src="/sites/', |
|
| 90 |
+ '<img src=', |
|
| 91 |
+ ' data-src="/'); |
|
| 92 |
+ $newStrings = array( ' href="https://www.lepoint.fr/', |
|
| 93 |
+ ' src="https://www.lepoint.fr/sites/', |
|
| 94 |
+ '<img width="100%" src=', |
|
| 95 |
+ ' data-src="https://www.lepoint.fr/' ); |
|
| 96 |
+ $article_only = str_replace($orgStrings, $newStrings, $article_only); |
|
| 97 |
+ |
|
| 98 |
+ $orgStrings = array( '<div class="row">', |
|
| 99 |
+ '<div class="col-md-2">', |
|
| 100 |
+ '<div class="col-md-8">', |
|
| 101 |
+ '<div class="container width_wrap">', |
|
| 102 |
+ '<div class="col-left">', |
|
| 103 |
+ '<h3> </h3>', |
|
| 104 |
+ '<h1>', |
|
| 105 |
+ '</h1>', |
|
| 106 |
+ '<p style="text-align:center">', |
|
| 107 |
+ '<div class="image-wrap panoramique bg-undefined">', |
|
| 108 |
+ '<div class="placement-left">' ); |
|
| 109 |
+ $newStrings = array('<div>',
|
|
| 110 |
+ '<div>', |
|
| 111 |
+ '<div>', |
|
| 112 |
+ '<div>', |
|
| 113 |
+ '<div>', |
|
| 114 |
+ '', |
|
| 115 |
+ '<h4>', |
|
| 116 |
+ '</h4>', |
|
| 117 |
+ '<p>', |
|
| 118 |
+ '<div>', |
|
| 119 |
+ '<div>'); |
|
| 120 |
+ $article_only = str_replace($orgStrings, $newStrings, $article_only); |
|
| 121 |
+ |
|
| 122 |
+ $temp = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $article_only);
|
|
| 123 |
+ $article_only = $temp; |
|
| 124 |
+ $temp = preg_replace('/\s\s+/', ' ', $article_only);
|
|
| 125 |
+ $article_only = $temp; |
|
| 126 |
+ $re = '/<a class="cboxElement" (.+?)><img (.+?)><\/a>/'; |
|
| 127 |
+ $temp = preg_replace($re, '<img \\2>', $article_only); |
|
| 128 |
+ $article_only = $temp; |
|
| 129 |
+ $re = '/<noscript>(.+?)<\/noscript>/ms'; |
|
| 130 |
+ $temp = preg_replace($re, '', $article_only); |
|
| 131 |
+ $article_only = $temp; |
|
| 132 |
+ |
|
| 133 |
+ $orgStrings = array( 'http://www.lepoint.fr/' ); |
|
| 134 |
+ $newStrings = array( 'https://www.lepoint.fr/' ); |
|
| 135 |
+ $article_only = str_replace($orgStrings, $newStrings, $article_only); |
|
| 136 |
+ |
|
| 137 |
+ $re = '/<img class="w100" alt="(.+?)" data-lazyload="loading" onclick="(.+?)" src="(.+?)" title="(.+?)" data-src="(.+?)" \/>/'; |
|
| 138 |
+ $temp = preg_replace($re, '<img width="100%" src="\\5">', $article_only); |
|
| 139 |
+ $article_only = $temp; |
|
| 140 |
+ |
|
| 141 |
+ $re = '/<img class="" src data-lazyload="loading" data-src="(.+?)" data-alt="(.+?)" width="(.+?)" height="(.+?)" alt title="(.+?)"\/>/ms'; |
|
| 142 |
+ $temp = preg_replace($re, '<img width="100%" src="\\1">', $article_only); |
|
| 143 |
+ $article_only = $temp; |
|
| 144 |
+ |
|
| 145 |
+ $re = '/<img src data-lazyload="loading" data-src="(.+?)" data-alt="(.+?)" alt="(.+?)" width="(.+?)" height="(.+?)" \/>/'; |
|
| 146 |
+ $temp = preg_replace($re, '<img width="100%" src="\\1">', $article_only); |
|
| 147 |
+ $article_only = $temp; |
|
| 148 |
+ |
|
| 149 |
+ $re = '/<img class="w100" alt="" data-lazyload="loading" onclick="(.+?)" src="(.+?)" title="" data-src="(.+?)" \/>/'; |
|
| 150 |
+ $temp = preg_replace($re, '<img width="100%" src="\\3">', $article_only); |
|
| 151 |
+ $article_only = $temp; |
|
| 152 |
+ |
|
| 153 |
+ $re = '/<a href="(.+?)" class="button-type pat little-button-mob" onclick="(.+?)">Abonnez-vous<\/a>/'; |
|
| 154 |
+ $temp = preg_replace($re, '', $article_only); |
|
| 155 |
+ $article_only = $temp; |
|
| 156 |
+ |
|
| 157 |
+ $re = '/<a onclick="(.+?)" data-shadowbox="#authform" href="(.+?)" id="connect_viafreemium" class="w100 block txtcenter br-4-all bg-grey-medium-blue pas font-black bold br-4-all upper">Identifiez-vous<\/a>/'; |
|
| 158 |
+ $temp = preg_replace($re, '', $article_only); |
|
| 159 |
+ $article_only = $temp; |
|
| 160 |
+ |
|
| 161 |
+ echo '<div id="nav-up" style="display:inline;"><a href="#top"><i class="fa fa-home fa-2x"></i></a></div> '; |
|
| 162 |
+ 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> '; |
|
| 163 |
+ echo '<div id="nav-prev" onclick="onArticle('.$cpt_prev.')" style="display:inline;"><i class="fa fa-chevron-left fa-2x"></i></div> ';
|
|
| 164 |
+ echo '<div id="nav-next" onclick="onArticle('.$cpt_next.')" style="display:inline;"><i class="fa fa-chevron-right fa-2x"></i></div>';
|
|
| 165 |
+ echo '<div class="extract-content" id="'.$cpt.'">'.$article_only.'</div>'; |
|
| 166 |
+ echo '<div id="nav-up" style="display:inline;"><a href="#top"><i class="fa fa-home fa-2x"></i></a></div> '; |
|
| 167 |
+ echo '<div id="nav-up" style="display:inline;"><a href="#article-top"><i class="fa fa-chevron-up fa-2x"></i></a></div> '; |
|
| 168 |
+ 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> '; |
|
| 169 |
+ echo '<div id="nav-prev" onclick="onArticle('.$cpt_prev.')" style="display:inline;"><i class="fa fa-chevron-left fa-2x"></i></div> ';
|
|
| 170 |
+ echo '<div id="nav-next" onclick="onArticle('.$cpt_next.')" style="display:inline;"><i class="fa fa-chevron-right fa-2x"></i></div></div>';
|
|
| 171 |
+ $cpt++; |
|
| 172 |
+ if( $cpt > $NEWS_RSS_MAX_ITEMS ) {
|
|
| 173 |
+ break; |
|
| 174 |
+ } |
|
| 175 |
+} |
|
| 176 |
+?> |