]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/activity.php
Merge remote-tracking branch 'statusnet/180' into statusnet_1.1.x
[quix0rs-gnu-social.git] / lib / activity.php
index 5234a54c03d9221ffb49e53a81bf9aa5bc905c15..e352baf63956880d7e8fc21c1b58736ffaaec42b 100644 (file)
@@ -389,9 +389,28 @@ class Activity
 
                     $activity['geopoint'] = array(
                         'type'        => 'Point',
-                        'coordinates' => array($loc->lat, $loc->lon)
+                        'coordinates' => array($loc->lat, $loc->lon),
+                        'deprecated'  => true,
                     );
 
+                    $activity['location'] = array(
+                        'objectType' => 'place',
+                        'position' => sprintf("%+02.5F%+03.5F/", $loc->lat, $loc->lon),
+                        'lat' => $loc->lat,
+                        'lon' => $loc->lon
+                    );
+
+                    $name = $loc->getName();
+
+                    if ($name) {
+                        $activity['location']['displayName'] = $name;
+                    }
+                    
+                    $url = $loc->getURL();
+
+                    if ($url) {
+                        $activity['location']['url'] = $url;
+                    }
                 }
 
                 $activity['to']      = $this->context->getToArray();
@@ -487,15 +506,20 @@ class Activity
 
         /* Purely extensions hereafter */
 
-        $tags = array();
-
-        // Use an Activity Object for term? Which object? Note?
-        foreach ($this->categories as $cat) {
-            $tags[] = $cat->term;
+        if ($activity['verb'] == 'post') {
+            $tags = array();
+            foreach ($this->categories as $cat) {
+                if (mb_strlen($cat->term) > 0) {
+                    // Couldn't figure out which object type to use, so...
+                    $tags[] = array('objectType' => 'http://activityschema.org/object/hashtag',
+                                    'displayName' => $cat->term);
+                }
+            }
+            if (count($tags) > 0) {
+                $activity['object']['tags'] = $tags;
+            }
         }
 
-        $activity['tags'] = $tags;
-
         // XXX: a bit of a hack... Since JSON isn't namespaced we probably
         // shouldn't be using 'statusnet:notice_info', but this will work
         // for the moment.