...
|
...
|
@@ -39,7 +39,8 @@ if ($xml === false) {
|
39
|
39
|
$pos_stop = strpos($item->description, $SEARCH_SUB2, $pos_start);
|
40
|
40
|
$article['image']=$item->mediacontent['url'];
|
41
|
41
|
$articles[$cpt] = $article;
|
42
|
|
- echo '<div onclick="onArticle('.$cpt.')" style="display:inline;">';
|
|
42
|
+ echo "\n";
|
|
43
|
+ echo ' <div onclick="onArticle('.$cpt.')" style="display:inline;">';
|
43
|
44
|
echo '<img src="'.$article['image'].'" style="display:inline;" width="100%"><br>';
|
44
|
45
|
echo '<div id="nav-up" style="display:inline;"><a href="#top"><i class="fa fa-home fa-2x"></i></a></div> ';
|
45
|
46
|
echo '<div id="nav-up" style="display:inline;"><a href="#article-top"><i class="fa fa-chevron-down fa-2x"></i></a></div> ';
|
...
|
...
|
@@ -51,51 +52,55 @@ if ($xml === false) {
|
51
|
52
|
}
|
52
|
53
|
}
|
53
|
54
|
}
|
54
|
|
-echo '</div><!-- ./panel-body -->';
|
55
|
|
-echo '</div><!-- ./panel panel-default -->';
|
56
|
|
-echo '</div><!-- ./col-md-6 -->';
|
|
55
|
+echo "\n";
|
|
56
|
+echo ' </div><!-- ./panel-body -->';
|
|
57
|
+echo "\n";
|
|
58
|
+echo ' </div><!-- ./panel panel-default -->';
|
|
59
|
+echo "\n";
|
|
60
|
+echo ' </div><!-- ./col-md-6 -->';
|
|
61
|
+echo "\n";
|
57
|
62
|
echo '<div class="col-md-6">';
|
|
63
|
+echo "\n";
|
58
|
64
|
echo '<div class="panel panel-default">';
|
|
65
|
+echo "\n";
|
59
|
66
|
echo '<div class="panel-body">';
|
|
67
|
+echo "\n";
|
60
|
68
|
echo '<a name="article-top"></a><div id="article-current"></div>';
|
61
|
69
|
$cpt=0;
|
62
|
70
|
foreach ($articles as $article ) {
|
63
|
71
|
$cpt_prev=$cpt-1;
|
64
|
72
|
$cpt_next=$cpt+1;
|
|
73
|
+ echo "\n";
|
65
|
74
|
echo '<!-- ==================== article '.$cpt.'============== -->';
|
|
75
|
+ echo "\n";
|
66
|
76
|
echo "<div class=\"article\" id=\"article-$cpt\" style=\"display: none;\">\n";
|
67
|
77
|
echo "<hr>";
|
68
|
78
|
echo "<a name=\"article-$cpt\">";
|
69
|
79
|
$article_content = file_get_contents($article['link']);
|
70
|
|
- $SEARCH_SUB1='<article class="entry__content ">';
|
71
|
|
- $pos_start = strpos($article_content, $SEARCH_SUB1);
|
72
|
|
- if(!$pos_start) {
|
73
|
|
- $SEARCH_SUB1='<article class="entry__content">';
|
74
|
|
- $pos_start = strpos($article_content, $SEARCH_SUB1);
|
|
80
|
+ $doc = new DOMDocument();
|
|
81
|
+ $doc->preserveWhiteSpace = false;
|
|
82
|
+ $doc->formatOutput = true;
|
|
83
|
+ $doc->loadHTML($article_content);
|
|
84
|
+ $articles = $doc->getElementsByTagName('article');
|
|
85
|
+ foreach ( $articles as $node) {
|
|
86
|
+ $article_only = DOMinnerHTML($node);
|
75
|
87
|
}
|
76
|
|
- $pos_start += strlen($SEARCH_SUB1);
|
77
|
|
- $SEARCH_SUB2='<a class="follow-us__correction"';
|
78
|
|
- $pos_stop = strpos($article_content, $SEARCH_SUB2);
|
79
|
|
- $article_only = substr($article_content, $pos_start, $pos_stop - $pos_start);
|
80
|
88
|
|
81
|
|
- $SEARCH_SUB2='<p><strong>Lire aussi :</strong></p>';
|
82
|
|
- $pos_stop = strpos($article_content, $SEARCH_SUB2);
|
83
|
|
- if( $pos_stop ) {
|
84
|
|
- $article_only = substr($article_content, $pos_start, $pos_stop - $pos_start);
|
85
|
|
- }
|
86
|
|
- if(!$pos_stop) {
|
87
|
|
- $article_only = 'Vidéo Seulement <a href="'.$article['link'].'" target="new-'.$cpt.'">cliquez ici</a>';
|
88
|
|
- }
|
89
|
|
-
|
90
|
|
- $orgStrings = array( ' width="500" height="281" frameborder="0" ');
|
91
|
|
- $newStrings = array( ' width="100%" frameborder="0" ');
|
92
|
|
- $article_only = str_replace($orgStrings, $newStrings, $article_only);
|
93
|
|
- $orgStrings = array( 'style="width: 680px"');
|
94
|
|
- $newStrings = array( 'style="width: 100%"');
|
95
|
|
- $article_only = str_replace($orgStrings, $newStrings, $article_only);
|
96
|
|
- $orgStrings = array( '<img src="');
|
97
|
|
- $newStrings = array( '<img width="100%" src="');
|
|
89
|
+ $orgStrings = array( '<img src="',
|
|
90
|
+ 'style="width: 680px"',
|
|
91
|
+ '<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>',
|
|
92
|
+ ' width="500" height="281" frameborder="0" ');
|
|
93
|
+ $newStrings = array( '<img width="100%" src="',
|
|
94
|
+ 'style="width: 100%"',
|
|
95
|
+ '',
|
|
96
|
+ ' width="100%" frameborder="0" ');
|
98
|
97
|
$article_only = str_replace($orgStrings, $newStrings, $article_only);
|
|
98
|
+
|
|
99
|
+ $SEARCH_SUB1='<p><strong>À voir également sur <em>Le HuffPost</em>:</strong></p>';
|
|
100
|
+ $pos_stop = strpos($article_only, $SEARCH_SUB1);
|
|
101
|
+ $temp = substr($article_only, 0, $pos_stop);
|
|
102
|
+ $article_only = $temp;
|
|
103
|
+
|
99
|
104
|
$re = '/alt="(.+?)" width="(.+?)" height="(.+?)"/';
|
100
|
105
|
$temp = preg_replace($re, 'width="100%"', $article_only);
|
101
|
106
|
$article_only = $temp;
|