Showing 1 changed files with 6 additions and 11 deletions
+6 -11
sources/news-numerama.fr.php
... ...
@@ -64,17 +64,6 @@ foreach ($articles as $article ) {
64 64
   echo "<hr>";
65 65
   echo "<a name=\"article-$cpt\">";
66 66
   $article_content = file_get_contents($article['link']);
67
-/*  $doc = new DOMDocument();
68
-  $doc->preserveWhiteSpace = false;
69
-  $doc->formatOutput       = true;
70
-  $doc->loadHTML($article_content);
71
-  $articles = $doc->getElementsByTagName('article');
72
-  $article_only="";
73
-  foreach ( $articles as $node) {
74
-    $article_only = DOMinnerHTML($node);
75
-  }
76
- */
77
-  //$SEARCH_SUB1='<p class="chapo">';
78 67
   $SEARCH_SUB1='<article class="post-content span8 tablet12 phone12">';
79 68
   $pos_start = strpos($article_content, $SEARCH_SUB1);
80 69
   $pos_start += strlen($SEARCH_SUB1);
... ...
@@ -104,6 +93,9 @@ foreach ($articles as $article ) {
104 93
   $re = '/alt="(.+?)" width="(.+?)" height="(.+?)"/';
105 94
   $temp = preg_replace($re, 'width="100%"', $article_only);
106 95
   $article_only = $temp;
96
+  $re = '/alt="" width="(.+?)" height="(.+?)"/';
97
+  $temp = preg_replace($re, 'width="100%"', $article_only);
98
+  $article_only = $temp;
107 99
   $re = '/<iframe width="500" height="(.+?)"/';
108 100
   $temp = preg_replace($re, '<iframe width="100%"', $article_only);
109 101
   $article_only = $temp;
... ...
@@ -113,6 +105,9 @@ foreach ($articles as $article ) {
113 105
   $re = '/<figure id="attachment_(.+?)" style="width: (.+?)" class="wp-caption aligncenter">/';
114 106
   $temp = preg_replace($re, '<figure id="attachment_\\1" style="width: 100%" class="wp-caption aligncenter">', $article_only);
115 107
   $article_only = $temp;
108
+  $re = '/<img class="aligncenter size-full wp-image-(.+?)"/';
109
+  $temp = preg_replace($re, '<img ', $article_only);
110
+  $article_only = $temp;
116 111
 
117 112
   $temp = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $article_only);
118 113
   $article_only = $temp;