Passed
Branch master (cecea5)
by Johan
02:39
created
webroot/test-rss.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -9,15 +9,15 @@
 block discarded – undo
9 9
 
10 10
 // Prepare the page content
11 11
 $rss = new Anax\Rssfeed\CRssfeed([ 
12
-    	'url' => 'http://feeds.idg.se/ComputerSweden20SenasteNyheter',
13
-    	'heading' => 'An example RSS feed - Computer Sweden',
14
-    	'items' => '5',
15
-    	]);
12
+        'url' => 'http://feeds.idg.se/ComputerSweden20SenasteNyheter',
13
+        'heading' => 'An example RSS feed - Computer Sweden',
14
+        'items' => '5',
15
+        ]);
16 16
     
17 17
     $content = $rss->readRSS();
18 18
 
19 19
 $app->theme->setVariable('title', "Test page")
20
-           ->setVariable('main', "
20
+            ->setVariable('main', "
21 21
     <p><i>This is a sample pagecontroller that lists a RSS feed.</i></p>
22 22
     {$content}
23 23
 ");
Please login to merge, or discard this patch.
src/Rssfeed/CRssfeed.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -21,34 +21,34 @@
 block discarded – undo
21 21
      * @param array $options to alter the default behaviour.
22 22
      */
23 23
     public function __construct($options=array()) {
24
-       $this->url = $options['url'];
25
-       $this->heading = $options['heading']; 
26
-       $this->items = $options['items'];
24
+        $this->url = $options['url'];
25
+        $this->heading = $options['heading']; 
26
+        $this->items = $options['items'];
27 27
     }
28 28
 	
29 29
     public function readRSS(){
30 30
     	
31
-       $html = "<article>";
32
-       $heading = $this->heading; 
33
-       $html .= "<h1>$heading</h1>";
34
-       $xml = simplexml_load_file($this->url);
35
-       for($i = 0; $i < $this->items; $i++){
36
-	       $title = $xml->channel->item[$i]->title;
37
-	       $link = $xml->channel->item[$i]->link;
38
-	       $description = $xml->channel->item[$i]->description;
39
-	       $pubDate = $xml->channel->item[$i]->pubDate;
31
+        $html = "<article>";
32
+        $heading = $this->heading; 
33
+        $html .= "<h1>$heading</h1>";
34
+        $xml = simplexml_load_file($this->url);
35
+        for($i = 0; $i < $this->items; $i++){
36
+            $title = $xml->channel->item[$i]->title;
37
+            $link = $xml->channel->item[$i]->link;
38
+            $description = $xml->channel->item[$i]->description;
39
+            $pubDate = $xml->channel->item[$i]->pubDate;
40 40
 	       
41
-	       // Formatting the date
42
-           $pubDate= date("D, d M Y H:i:s T", strtotime($pubDate));
41
+            // Formatting the date
42
+            $pubDate= date("D, d M Y H:i:s T", strtotime($pubDate));
43 43
 	       
44
-           $html .= "<a href='$link'><h3>$title</h3></a>";
45
-	       $html .= "<small>$pubDate</small><br /><br />";
46
-           $html .= "$description";
47
-           $html .= "<hr />";
48
-       }
49
-       $html .= "</article>";
44
+            $html .= "<a href='$link'><h3>$title</h3></a>";
45
+            $html .= "<small>$pubDate</small><br /><br />";
46
+            $html .= "$description";
47
+            $html .= "<hr />";
48
+        }
49
+        $html .= "</article>";
50 50
            
51
-       return $html;
51
+        return $html;
52 52
     
53 53
     }      
54 54
      
Please login to merge, or discard this patch.