Showing 2 changed files with 17 additions and 19 deletions
-19
sources/news-slate.fr.php
... ...
@@ -1,25 +1,6 @@
1 1
 <?php
2 2
 include_once( 'news-constants.php' );
3 3
 
4
-
5
-function getElementByClass(&$parentNode, $tagName, $className, $offset = 0) {
6
-    $response = false;
7
-    $childNodeList = $parentNode->getElementsByTagName($tagName);
8
-    $tagCount = 0;
9
-    for ($i = 0; $i < $childNodeList->length; $i++) {
10
-        $temp = $childNodeList->item($i);
11
-        if (stripos($temp->getAttribute('class'), $className) !== false) {
12
-            if ($tagCount == $offset) {
13
-                $response = $temp;
14
-                break;
15
-            }
16
-            $tagCount++;
17
-        }
18
-    }
19
-    return $response;
20
-}
21
-
22
-
23 4
 $rss_content = http_get_contents(NEWS_RSS_SLATEFR);
24 5
 $xml = simplexml_load_string($rss_content);
25 6
 if ($xml === false) {
+17
sources/rss.php
... ...
@@ -57,4 +57,21 @@ function ERROR($Message) {
57 57
   fwrite($stderr,"[ERROR]".$Message.PHP_EOL); 
58 58
   fclose($stderr); 
59 59
 }
60
+
61
+function getElementByClass(&$parentNode, $tagName, $className, $offset = 0) {
62
+    $response = false;
63
+    $childNodeList = $parentNode->getElementsByTagName($tagName);
64
+    $tagCount = 0;
65
+    for ($i = 0; $i < $childNodeList->length; $i++) {
66
+        $temp = $childNodeList->item($i);
67
+        if (stripos($temp->getAttribute('class'), $className) !== false) {
68
+            if ($tagCount == $offset) {
69
+                $response = $temp;
70
+                break;
71
+            }
72
+            $tagCount++;
73
+        }
74
+    }
75
+    return $response;
76
+}
60 77
 ?>