]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/Bookmark/bookmarklistitem.php
non-existent poco
[quix0rs-gnu-social.git] / plugins / Bookmark / bookmarklistitem.php
index 381864c21cf53ee90600268eaccfae75aeb28aeb..a2dbf8156dafdef83afef57295e23f18edd4e84e 100644 (file)
@@ -60,41 +60,39 @@ class BookmarkListItem extends NoticeListItemAdapter
         $notice = $this->nli->notice;
         $out    = $this->nli->out;
 
-        $out->elementStart('p', array('class' => 'entry-content'));
-
         $nb = Bookmark::getByNotice($notice);
 
-        $profile = $notice->getProfile();
-
-        $atts = $notice->attachments();
+        if (empty($nb)) {
+            common_log(LOG_ERR, "No bookmark for notice {$notice->id}");
+            parent::showContent();
+            return;
+        } else if (empty($nb->url)) {
+            common_log(LOG_ERR, "No url for bookmark {$nb->id} for notice {$notice->id}");
+            parent::showContent();
+            return;
+        }
 
-        if (empty($atts)) {
+        $profile = $notice->getProfile();
 
-            // Something went wrong!
+        $out->elementStart('p', array('class' => 'entry-content'));
 
-            common_log(
-                LOG_ERR,
-                sprintf(
-                    'Bookmark %1$s (notice %2$d) has no attachments.',
-                    $nb->id,
-                    $notice->id
-                )
-            );
+        // Whether to nofollow
 
-            // try to show the notice as plain text
+        $attrs = array('href' => $nb->url,
+                       'class' => 'bookmark-title');
 
-            parent::showContent();
-            return;
+        $nf = common_config('nofollow', 'external');
 
+        if ($nf == 'never' || ($nf == 'sometimes' and $out instanceof ShowstreamAction)) {
+            $attrs['rel'] = 'external';
+        } else {
+            $attrs['rel'] = 'nofollow external';
         }
 
-        $att = $atts[0];
-
         $out->elementStart('h3');
         $out->element('a',
-                  array('href' => $att->url,
-                        'class' => 'bookmark-title'),
-                  $nb->title);
+                      $attrs,
+                      $nb->title);
         $out->elementEnd('h3');
 
         // Replies look like "for:" tags