@@ -12,31 +12,31 @@ |
||
12 | 12 | |
13 | 13 | class CRSSFeed { |
14 | 14 | |
15 | - // constructor - initialize SimplePie. |
|
16 | - public function __construct($feedArr, $duration = 3600) { |
|
17 | - $this->object = new SimplePie(); |
|
18 | - $this->object->set_cache_location(CACHE); |
|
19 | - $this->object->set_cache_duration($duration); |
|
20 | - $this->object->set_feed_url($feedArr); |
|
21 | - $this->object->init(); |
|
22 | - } |
|
15 | + // constructor - initialize SimplePie. |
|
16 | + public function __construct($feedArr, $duration = 3600) { |
|
17 | + $this->object = new SimplePie(); |
|
18 | + $this->object->set_cache_location(CACHE); |
|
19 | + $this->object->set_cache_duration($duration); |
|
20 | + $this->object->set_feed_url($feedArr); |
|
21 | + $this->object->init(); |
|
22 | + } |
|
23 | 23 | |
24 | - // return content. |
|
25 | - public function getFeed() { |
|
26 | - $feedItems = $this->object->get_items(); |
|
27 | - $html = '<article>'; |
|
28 | - $html .= "<h1>Senaste nytt från IDG</h1>"; |
|
29 | - foreach($feedItems as $content) { |
|
30 | - $html .= '<div class="feed-content">'; |
|
31 | - $html .= "<h2>" . $content->get_title() . "</h2>" ; |
|
32 | - $html .= "<small>Postad ". $content->get_date('Y-m-d | H:i:s')."</small>"; |
|
33 | - $html .= "<p>{$content->get_content()}</p>"; |
|
34 | - $html .= "<p><a href='" . $content->get_permalink() . "'>Läs mer</a>"; |
|
35 | - $html .= '</div>'; |
|
36 | - } |
|
37 | - $html .= "</article>"; |
|
38 | - return $html; |
|
39 | - } |
|
24 | + // return content. |
|
25 | + public function getFeed() { |
|
26 | + $feedItems = $this->object->get_items(); |
|
27 | + $html = '<article>'; |
|
28 | + $html .= "<h1>Senaste nytt från IDG</h1>"; |
|
29 | + foreach($feedItems as $content) { |
|
30 | + $html .= '<div class="feed-content">'; |
|
31 | + $html .= "<h2>" . $content->get_title() . "</h2>" ; |
|
32 | + $html .= "<small>Postad ". $content->get_date('Y-m-d | H:i:s')."</small>"; |
|
33 | + $html .= "<p>{$content->get_content()}</p>"; |
|
34 | + $html .= "<p><a href='" . $content->get_permalink() . "'>Läs mer</a>"; |
|
35 | + $html .= '</div>'; |
|
36 | + } |
|
37 | + $html .= "</article>"; |
|
38 | + return $html; |
|
39 | + } |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /*$rss = new SimplePie(); |