[Mapbender-commits] r4640 - trunk/mapbender/http/classes

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Sep 16 11:53:50 EDT 2009


Author: christoph
Date: 2009-09-16 11:53:50 -0400 (Wed, 16 Sep 2009)
New Revision: 4640

Added:
   trunk/mapbender/http/classes/class_universal_rss_factory.php
Log:
RSS classes

Added: trunk/mapbender/http/classes/class_universal_rss_factory.php
===================================================================
--- trunk/mapbender/http/classes/class_universal_rss_factory.php	                        (rev 0)
+++ trunk/mapbender/http/classes/class_universal_rss_factory.php	2009-09-16 15:53:50 UTC (rev 4640)
@@ -0,0 +1,37 @@
+<?php
+# License:
+# Copyright (c) 2009, Open Source Geospatial Foundation
+# This program is dual licensed under the GNU General Public License 
+# and Simplified BSD license.  
+# http://svn.osgeo.org/mapbender/trunk/mapbender/license/license.txt
+
+require_once dirname(__FILE__) . "/../../core/globalSettings.php";
+require_once dirname(__FILE__) . "/../classes/class_rss_factory.php";
+require_once dirname(__FILE__) . "/../classes/class_georss_factory.php";
+
+class UniversalRssFactory {
+
+	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 false;
+		}
+
+		$domxpath = new DOMXPath($dom);		
+		$nodeList = $domxpath->query("/rss/channel/item/georss:box");
+
+		if ($nodeList->length > 0) {
+			$geoRssFactory = new GeoRssFactory();
+			return $geoRssFactory->createFromUrl($url);
+		}
+		else {
+			$rssFactory = new RssFactory();
+			return $rssFactory->createFromUrl($url);
+		}
+	}
+}
+
+?>
\ No newline at end of file



More information about the Mapbender_commits mailing list