@@ -11,14 +11,14 @@ discard block |
||
11 | 11 | * @param string $class The fully-qualified class name. |
12 | 12 | * @return void |
13 | 13 | */ |
14 | -spl_autoload_register(function ($class) { |
|
14 | +spl_autoload_register(function($class) { |
|
15 | 15 | |
16 | 16 | // project-specific namespace prefix |
17 | 17 | //$prefix = 'Foo\\Bar\\'; |
18 | 18 | $prefix = 'Miax\\'; |
19 | 19 | |
20 | 20 | // base directory for the namespace prefix |
21 | - $base_dir = __DIR__ . '/src/'; |
|
21 | + $base_dir = __DIR__.'/src/'; |
|
22 | 22 | |
23 | 23 | // does the class use the namespace prefix? |
24 | 24 | $len = strlen($prefix); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | // replace the namespace prefix with the base directory, replace namespace |
34 | 34 | // separators with directory separators in the relative class name, append |
35 | 35 | // with .php |
36 | - $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php'; |
|
36 | + $file = $base_dir.str_replace('\\', '/', $relative_class).'.php'; |
|
37 | 37 | |
38 | 38 | // if the file exists, require it |
39 | 39 | if (file_exists($file)) { |
@@ -13,11 +13,11 @@ discard block |
||
13 | 13 | class CRSSFeedTest extends \PHPUnit_Framework_TestCase { |
14 | 14 | |
15 | 15 | |
16 | - /** ------------------------------------------------------- |
|
16 | + /** ------------------------------------------------------- |
|
17 | 17 | * Test 1 |
18 | - * |
|
18 | + * |
|
19 | 19 | */ |
20 | - /*public function testGetFeed(){ |
|
20 | + /*public function testGetFeed(){ |
|
21 | 21 | $feed = new \Miax\RSSFeed\CRSSFeed('test'); |
22 | 22 | $res = $el['name']; |
23 | 23 | $exp = 'test'; |
@@ -26,15 +26,15 @@ discard block |
||
26 | 26 | |
27 | 27 | */ |
28 | 28 | |
29 | - /** --------------------------------------------------------- |
|
29 | + /** --------------------------------------------------------- |
|
30 | 30 | * Test 2 Mock of SimplePie |
31 | 31 | * |
32 | 32 | */ |
33 | 33 | |
34 | - //private $rss; |
|
34 | + //private $rss; |
|
35 | 35 | |
36 | 36 | |
37 | - /*public function setUp(){ |
|
37 | + /*public function setUp(){ |
|
38 | 38 | $feed = new SimplePie(); |
39 | 39 | $feed = getFeed('http://feeds.feedburner.com/idg/vzzs/'); |
40 | 40 | $rss = new Miax\RSSFeed\CRSSFeed($feed); |
@@ -69,12 +69,12 @@ discard block |
||
69 | 69 | } |
70 | 70 | */ |
71 | 71 | |
72 | - /** --------------------------------------------------------- |
|
72 | + /** --------------------------------------------------------- |
|
73 | 73 | * Test 3 |
74 | 74 | * |
75 | 75 | */ |
76 | 76 | |
77 | - /*protected function setVerboseErrorHandler(){ |
|
77 | + /*protected function setVerboseErrorHandler(){ |
|
78 | 78 | $handler = function($errorNumber, $errorString, $errorFile, $errorLine) { |
79 | 79 | echo " |
80 | 80 | ERROR INFO |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | set_error_handler($handler); |
87 | 87 | }*/ |
88 | 88 | |
89 | - /* public function testGetFeed() { |
|
89 | + /* public function testGetFeed() { |
|
90 | 90 | $feed = new Miax\RSSFeed\CRSSFeed(['http://feeds.feedburner.com/idg/vzzs/']); |
91 | 91 | $content = $this->feed->getFeed(); |
92 | 92 | $this->assertEqual($feed, $content, "Return type is not a valid type"); |
@@ -94,14 +94,14 @@ discard block |
||
94 | 94 | }*/ |
95 | 95 | |
96 | 96 | |
97 | - /** --------------------------------------------------------- |
|
97 | + /** --------------------------------------------------------- |
|
98 | 98 | * Test test |
99 | 99 | * |
100 | 100 | */ |
101 | 101 | |
102 | 102 | |
103 | - public function testTesting() { |
|
103 | + public function testTesting() { |
|
104 | 104 | $this->assertEquals(1, 1, "Just making sure this is being checked."); |
105 | - } |
|
105 | + } |
|
106 | 106 | |
107 | 107 | } |
108 | 108 | \ No newline at end of file |
@@ -1,4 +1,4 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include __DIR__ . "/../autoloader.php"; |
|
3 | +include __DIR__."/../autoloader.php"; |
|
4 | 4 | //include __DIR__ . "/../src/CRSSFeed.php"; |
5 | 5 | \ No newline at end of file |
@@ -14,31 +14,31 @@ discard block |
||
14 | 14 | |
15 | 15 | class CRSSFeed { |
16 | 16 | |
17 | - // constructor - initialize SimplePie. |
|
18 | - public function __construct($feedArr, $duration = 3600) { |
|
19 | - $this->object = new SimplePie(); |
|
20 | - $this->object->set_cache_location(CACHE); |
|
21 | - $this->object->set_cache_duration($duration); |
|
22 | - $this->object->set_feed_url($feedArr); |
|
23 | - $this->object->init(); |
|
24 | - } |
|
17 | + // constructor - initialize SimplePie. |
|
18 | + public function __construct($feedArr, $duration = 3600) { |
|
19 | + $this->object = new SimplePie(); |
|
20 | + $this->object->set_cache_location(CACHE); |
|
21 | + $this->object->set_cache_duration($duration); |
|
22 | + $this->object->set_feed_url($feedArr); |
|
23 | + $this->object->init(); |
|
24 | + } |
|
25 | 25 | |
26 | - // return content. |
|
27 | - public function getFeed() { |
|
28 | - $feedItems = $this->object->get_items(); |
|
29 | - $html = "<article>"; |
|
30 | - $html .= "<h1>Senaste nytt från IDG</h1>"; //change this to your own headline |
|
31 | - foreach($feedItems as $content) { |
|
32 | - $html .= "<div class='feed-content'>"; |
|
33 | - $html .= "<h2>" . $content->get_title() . "</h2>" ; |
|
34 | - $html .= "<small>Postad ". $content->get_date('Y-m-d | H:i:s')."</small>"; |
|
35 | - $html .= "<p>" . $content->get_content() . "</p>"; |
|
36 | - $html .= "<p><a href=" . $content->get_permalink() . ">Läs mer</a>"; |
|
37 | - $html .= "</div>"; |
|
38 | - } |
|
39 | - $html .= "</article>"; |
|
40 | - return $html; |
|
41 | - } |
|
26 | + // return content. |
|
27 | + public function getFeed() { |
|
28 | + $feedItems = $this->object->get_items(); |
|
29 | + $html = "<article>"; |
|
30 | + $html .= "<h1>Senaste nytt från IDG</h1>"; //change this to your own headline |
|
31 | + foreach($feedItems as $content) { |
|
32 | + $html .= "<div class='feed-content'>"; |
|
33 | + $html .= "<h2>" . $content->get_title() . "</h2>" ; |
|
34 | + $html .= "<small>Postad ". $content->get_date('Y-m-d | H:i:s')."</small>"; |
|
35 | + $html .= "<p>" . $content->get_content() . "</p>"; |
|
36 | + $html .= "<p><a href=" . $content->get_permalink() . ">Läs mer</a>"; |
|
37 | + $html .= "</div>"; |
|
38 | + } |
|
39 | + $html .= "</article>"; |
|
40 | + return $html; |
|
41 | + } |
|
42 | 42 | } |
43 | 43 | /* |
44 | 44 | $feed = new SimplePie(); |
@@ -49,5 +49,5 @@ discard block |
||
49 | 49 | echo var_dump($html); |
50 | 50 | }*/ |
51 | 51 | |
52 | - //$rssFeed = new Miax\RSSFeed\CRSSFeed(['http://feeds.feedburner.com/idg/vzzs']); |
|
52 | + //$rssFeed = new Miax\RSSFeed\CRSSFeed(['http://feeds.feedburner.com/idg/vzzs']); |
|
53 | 53 | //$content = $rssFeed->getFeed(); |
54 | 54 | \ No newline at end of file |
@@ -28,12 +28,12 @@ |
||
28 | 28 | $feedItems = $this->object->get_items(); |
29 | 29 | $html = "<article>"; |
30 | 30 | $html .= "<h1>Senaste nytt från IDG</h1>"; //change this to your own headline |
31 | - foreach($feedItems as $content) { |
|
31 | + foreach ($feedItems as $content) { |
|
32 | 32 | $html .= "<div class='feed-content'>"; |
33 | - $html .= "<h2>" . $content->get_title() . "</h2>" ; |
|
34 | - $html .= "<small>Postad ". $content->get_date('Y-m-d | H:i:s')."</small>"; |
|
35 | - $html .= "<p>" . $content->get_content() . "</p>"; |
|
36 | - $html .= "<p><a href=" . $content->get_permalink() . ">Läs mer</a>"; |
|
33 | + $html .= "<h2>".$content->get_title()."</h2>"; |
|
34 | + $html .= "<small>Postad ".$content->get_date('Y-m-d | H:i:s')."</small>"; |
|
35 | + $html .= "<p>".$content->get_content()."</p>"; |
|
36 | + $html .= "<p><a href=".$content->get_permalink().">Läs mer</a>"; |
|
37 | 37 | $html .= "</div>"; |
38 | 38 | } |
39 | 39 | $html .= "</article>"; |