]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Allow OStatusPlugin to set the source attribution title
authorZach Copley <zach@status.net>
Thu, 6 May 2010 20:25:20 +0000 (20:25 +0000)
committerZach Copley <zach@status.net>
Thu, 6 May 2010 21:48:12 +0000 (21:48 +0000)
lib/noticelist.php

index c7dc9d29d912d9203bf6862fbfbd82bd15a4233b..432ea78d5bee61e7c43bffbc973c1688fb37eb81 100644 (file)
@@ -497,40 +497,37 @@ class NoticeListItem extends Widget
             $this->out->text(_('from'));
             $this->out->text(' ');
 
-            // if $ns->name and $ns->url are populated we have
-            // configured a source attr somewhere
-            if (empty($ns->name) && empty($ns->url)) {
-                // otherwise it's from normal channel such as web or api
-                $this->out->element('span', 'device', $source_name);
-            } else {
-                $name  = null;
-                $url   = null;
-                $title = null;
+            $name  = $source_name;
+            $url   = $ns->url;
+            $title = null;
 
-                if (Event::handle('StartNoticeSourceLink', array($this->notice, &$name, &$url, &$title))) {
-                    $name = $source_name;
-                    $url  = $ns->url;
-                }
-                Event::handle('EndNoticeSourceLink', array($this->notice, &$name, &$url, &$title));
+            if (Event::handle('StartNoticeSourceLink', array($this->notice, &$name, &$url, &$title))) {
+                $name = $source_name;
+                $url  = $ns->url;
+            }
+            Event::handle('EndNoticeSourceLink', array($this->notice, &$name, &$url, &$title));
 
-                if (!empty($name) && !empty($url)) {
-                    $this->out->elementStart('span', 'device');
+            // if $ns->name and $ns->url are populated we have
+            // configured a source attr somewhere
+            if (!empty($name) && !empty($url)) {
 
-                    $attrs = array(
-                        'href' => $url,
-                        'rel' => 'external'
-                    );
+                $this->out->elementStart('span', 'device');
 
-                    if (isset($title)) {
-                        $attrs['title'] = $title;
-                    }
+                $attrs = array(
+                    'href' => $url,
+                    'rel' => 'external'
+                );
 
-                    $this->out->element('a', $attrs, $name);
-                    $this->out->elementEnd('span');
-                } else {
-                    $this->out->element('span', 'device', $name);
+                if (!empty($title)) {
+                    $attrs['title'] = $title;
                 }
+
+                $this->out->element('a', $attrs, $name);
+                $this->out->elementEnd('span');
+            } else {
+                $this->out->element('span', 'device', $name);
             }
+
             $this->out->elementEnd('span');
         }
     }