public function testAppendItemToGeoRss() { $anotherRssFactory = new GeoRssFactory(); $anotherGeoRss = $anotherRssFactory->createAt($this->randomRss); $someGeoRssFactory = new GeoRssFactory(); $yetAnotherGeoRss = $someGeoRssFactory->createFromUrl($this->randomRss); $yetAnotherGeoRss->setTitle("testTitel"); $yetAnotherGeoRss->setDescription("testDescription"); $yetAnotherGeoRss->setUrl("testUrl"); $item = $yetAnotherGeoRss->append(); $item->setBbox(new Mapbender_bbox(8, 49, 9, 50, "EPSG:4326")); $this->assertTrue($yetAnotherGeoRss->saveAsFile()); }
public function createFromUrl($url) { $dom = new DOMDocument(); $dom->preserveWhitespace = false; $success = $dom->load($url); if (!$success) { new mb_exception(__FILE__ . ": createFromUrl(): Could not load " . $url); return null; } $nodeList = $dom->getElementsByTagName("rss"); if ($nodeList->length > 0) { $node = $nodeList->item(0); if ($node->hasAttribute("xmlns:georss")) { $geoRssFactory = new GeoRssFactory(); return $geoRssFactory->createFromUrl($url); } } $rssFactory = new RssFactory(); return $rssFactory->createFromUrl($url); }