]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Include source client's related URL (if any) in source attribution for
authorZach Copley <zach@status.net>
Thu, 17 Jun 2010 23:08:40 +0000 (23:08 +0000)
committerZach Copley <zach@status.net>
Thu, 17 Jun 2010 23:08:40 +0000 (23:08 +0000)
Atom notice feeds

classes/Notice.php

index 0838ca2a2cb8150e7fafe9a2c95558db6675d62a..f8eda5777d5832400cb52488da19afedc31cea00 100644 (file)
@@ -1238,9 +1238,25 @@ class Notice extends Memcached_DataObject
         $xs->element('published', null, common_date_w3dtf($this->created));
         $xs->element('updated', null, common_date_w3dtf($this->created));
 
+        $source = null;
+
+        $ns = $this->getSource();
+
+        if ($ns) {
+            if (!empty($ns->name) && !empty($ns->url)) {
+                $source = '<a href="'
+                  . htmlspecialchars($ns->url)
+                  . '" rel="nofollow">'
+                  . htmlspecialchars($ns->name)
+                   . '</a>';
+            } else {
+                $source = $ns->code;
+            }
+        }
+
         $noticeInfoAttr = array(
-            'local_id'   => $this->id,    // local notice ID (useful to clients for ordering)
-            'source'     => $this->source, // the client name (source attribution)
+            'local_id'   => $this->id, // local notice ID (useful to clients for ordering)
+            'source'     => $source,   // the client name (source attribution)
         );
 
         $ns = $this->getSource();
@@ -1252,8 +1268,8 @@ class Notice extends Memcached_DataObject
 
         if (!empty($cur)) {
             $noticeInfoAttr['favorite'] = ($cur->hasFave($this)) ? "true" : "false";
-           $profile = $cur->getProfile();
-           $noticeInfoAttr['repeated'] = ($profile->hasRepeated($this->id)) ? "true" : "false";
+            $profile = $cur->getProfile();
+            $noticeInfoAttr['repeated'] = ($profile->hasRepeated($this->id)) ? "true" : "false";
         }
 
         if (!empty($this->repeat_of)) {