]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/foaf.php
Notice::saveNew() accepts url and rendered options
[quix0rs-gnu-social.git] / actions / foaf.php
index 4dae9dfc19aeae6dafc73236ea2068556920e333..e9f67b7f2bd0208e248bff5d30a8857a9e4d5113 100644 (file)
@@ -108,11 +108,29 @@ class FoafAction extends Action
         if ($this->profile->bio) {
             $this->element('bio:olb', null, $this->profile->bio);
         }
-        // XXX: more structured location data
-        if ($this->profile->location) {
+        
+        $location = $this->profile->getLocation();
+        if ($location) {
+            $attr = array();
+            if ($location->getRdfURL()) {
+                $attr['rdf:about'] = $location->getRdfURL();
+            }
+            $location_name = $location->getName();
+            
             $this->elementStart('based_near');
-            $this->elementStart('geo:SpatialThing');
-            $this->element('name', null, $this->profile->location);
+            $this->elementStart('geo:SpatialThing', $attr);
+            if ($location_name) {
+                $this->element('name', null, $location_name);
+            }
+            if ($location->lat) {
+                $this->element('geo:lat', null, $location->lat);
+            }
+            if ($location->lon) {
+                $this->element('geo:long', null, $location->lat);
+            }
+            if ($location->getURL()) {
+                $this->element('page', array('rdf:resource'=>$location->getURL()));
+            }
             $this->elementEnd('geo:SpatialThing');
             $this->elementEnd('based_near');
         }
@@ -146,8 +164,10 @@ class FoafAction extends Action
             while ($sub->fetch()) {
                 if ($sub->token) {
                     $other = Remote_profile::staticGet('id', $sub->subscriber);
+                    $profile = Profile::staticGet('id', $sub->subscriber);
                 } else {
                     $other = User::staticGet('id', $sub->subscriber);
+                    $profile = Profile::staticGet('id', $sub->subscriber);
                 }
                 if (!$other) {
                     common_debug('Got a bad subscription: '.print_r($sub,true));
@@ -158,12 +178,15 @@ class FoafAction extends Action
                 } else {
                     $person[$other->uri] = array(LISTENER,
                                                  $other->id,
-                                                 $other->nickname,
+                                                 $profile->nickname,
                                                  (empty($sub->token)) ? 'User' : 'Remote_profile');
                 }
                 $other->free();
                 $other = null;
                 unset($other);
+                $profile->free();
+                $profile = null;
+                unset($profile);
             }
         }
 
@@ -254,8 +277,10 @@ class FoafAction extends Action
                 while ($sub->fetch()) {
                     if (!empty($sub->token)) {
                         $other = Remote_profile::staticGet('id', $sub->subscribed);
+                        $profile = Profile::staticGet('id', $sub->subscribed);
                     } else {
                         $other = User::staticGet('id', $sub->subscribed);
+                        $profile = Profile::staticGet('id', $sub->subscribed);
                     }
                     if (empty($other)) {
                         common_debug('Got a bad subscription: '.print_r($sub,true));
@@ -264,11 +289,14 @@ class FoafAction extends Action
                     $this->element('sioc:follows', array('rdf:resource' => $other->uri.'#acct'));
                     $person[$other->uri] = array(LISTENEE,
                                                  $other->id,
-                                                 $other->nickname,
+                                                 $profile->nickname,
                                                  (empty($sub->token)) ? 'User' : 'Remote_profile');
                     $other->free();
                     $other = null;
                     unset($other);
+                    $profile->free();
+                    $profile = null;
+                    unset($profile);
                 }
             }