diff --git a/lib/Creator/AtomCreator10.php b/lib/Creator/AtomCreator10.php index ce7e914..e3073d5 100644 --- a/lib/Creator/AtomCreator10.php +++ b/lib/Creator/AtomCreator10.php @@ -28,10 +28,11 @@ function createFeed() { $feed.= $this->_createGeneratorComment(); $feed.= $this->_createStylesheetReferences(); $feed.= "items[0]->lat!="") { + if (!empty($this->items[0]->lat)) + { $feed.= " xmlns:georss=\"http://www.georss.org/georss\"\n"; } - if ($this->language!="") { + if ($this->language!=""){ $feed.= " xml:lang=\"".$this->language."\""; } $feed.= ">\n"; diff --git a/lib/Creator/RSSCreator10.php b/lib/Creator/RSSCreator10.php index 2bb0f23..3183af8 100644 --- a/lib/Creator/RSSCreator10.php +++ b/lib/Creator/RSSCreator10.php @@ -25,10 +25,14 @@ function createFeed() { $feed.= " xmlns=\"http://purl.org/rss/1.0/\"\n"; $feed.= " xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n"; $feed.= " xmlns:slash=\"http://purl.org/rss/1.0/modules/slash/\"\n"; - if ($this->items[0]->thumb!="") + if (!empty($this->items[0]->thumb)) + { $feed.= " xmlns:photo=\"http://www.pheed.com/pheed/\"\n"; - if ($this->items[0]->lat!="") + } + if (!empty($this->items[0]->lat)) + { $feed.= " xmlns:georss=\"http://www.georss.org/georss\"\n"; + } $feed.= " xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n"; $feed.= " syndicationURL."\">\n"; $feed.= " ".htmlspecialchars($this->title)."\n"; diff --git a/test/Creator/AtomCreator10Test.php b/test/Creator/AtomCreator10Test.php new file mode 100644 index 0000000..85fcddf --- /dev/null +++ b/test/Creator/AtomCreator10Test.php @@ -0,0 +1,13 @@ +description = 'Feed Description'; + $feed = $creator->createFeed('ATOM1.0'); + + $parsed = simplexml_load_string($feed); + $this->assertEquals('Feed Description', $parsed->subtitle); + } +} \ No newline at end of file diff --git a/test/Creator/RSSCreator10Test.php b/test/Creator/RSSCreator10Test.php new file mode 100644 index 0000000..ee9f15d --- /dev/null +++ b/test/Creator/RSSCreator10Test.php @@ -0,0 +1,13 @@ +description = 'Feed Description'; + $feed = $creator->createFeed('RSS1.0'); + + $parsed = simplexml_load_string($feed); + $this->assertEquals('Feed Description', $parsed->channel->description); + } +} \ No newline at end of file