]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
OStatus: correct parsing of georss:point for max interop (commas allowed, whitespace...
authorBrion Vibber <brion@pobox.com>
Thu, 11 Feb 2010 22:42:36 +0000 (22:42 +0000)
committerBrion Vibber <brion@pobox.com>
Thu, 11 Feb 2010 22:42:36 +0000 (22:42 +0000)
plugins/OStatus/lib/feedmunger.php

index 25b0a093171fee9f17a7402b8a9b2cbfd69eae77..927a2fe7a70d1d57a1bcf35627cb0d44f4913506 100644 (file)
@@ -269,6 +269,9 @@ class FeedMunger
     }
 
     /**
+     * Parse location given as a GeoRSS-simple point, if provided.
+     * http://www.georss.org/simple
+     *
      * @param feed item $entry
      * @return mixed Location or false
      */
@@ -278,7 +281,10 @@ class FeedMunger
         $points = $dom->getElementsByTagNameNS('http://www.georss.org/georss', 'point');
         
         for ($i = 0; $i < $points->length; $i++) {
-            $point = trim($points->item(0)->textContent);
+            $point = $points->item(0)->textContent;
+            $point = str_replace(',', ' ', $point); // per spec "treat commas as whitespace"
+            $point = preg_replace('/\s+/', ' ', $point);
+            $point = trim($point);
             $coords = explode(' ', $point);
             if (count($coords) == 2) {
                 list($lat, $lon) = $coords;