summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-02-11 22:42:36 +0000
committerBrion Vibber <brion@pobox.com>2010-02-11 22:42:36 +0000
commite08657d56cc10d2cf45e9e5701856d8a0dc7351e (patch)
tree0bee6ff144dd179f782b7e471938bcc8fbf2e691 /plugins
parentc465f675d9dbcf9f808bc31a1d01e753df4ddf58 (diff)
OStatus: correct parsing of georss:point for max interop (commas allowed, whitespace not strictly defined)
Diffstat (limited to 'plugins')
-rw-r--r--plugins/OStatus/lib/feedmunger.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/plugins/OStatus/lib/feedmunger.php b/plugins/OStatus/lib/feedmunger.php
index 25b0a0931..927a2fe7a 100644
--- a/plugins/OStatus/lib/feedmunger.php
+++ b/plugins/OStatus/lib/feedmunger.php
@@ -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;