]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
nofollow for peopletag pages
authorEvan Prodromou <evan@status.net>
Mon, 5 Apr 2010 15:03:14 +0000 (11:03 -0400)
committerEvan Prodromou <evan@status.net>
Mon, 5 Apr 2010 15:03:14 +0000 (11:03 -0400)
actions/peopletag.php

index 4ba1dc0f1f71327aba61394b74f4192a3f8171be..af40b9d82a08476d582c3daa9634fb0e309c7e68 100644 (file)
@@ -32,8 +32,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
     exit(1);
 }
 
-require_once INSTALLDIR.'/lib/profilelist.php';
-
 /**
  * This class outputs a paginated list of profiles self-tagged with a given tag
  *
@@ -124,8 +122,8 @@ class PeopletagAction extends Action
 
         $profile->query(sprintf($qry, $this->tag, $lim));
 
-        $pl  = new ProfileList($profile, $this);
-        $cnt = $pl->show();
+        $ptl = new PeopleTagList($profile, $this); // pass the ammunition
+        $cnt = $ptl->show();
 
         $this->pagination($this->page > 1,
                           $cnt > PROFILES_PER_PAGE,
@@ -146,3 +144,41 @@ class PeopletagAction extends Action
     }
 
 }
+
+class PeopleTagList extends ProfileList
+{
+    function newListItem($profile)
+    {
+        return new PeopleTagListItem($profile, $this->action);
+    }
+}
+
+class PeopleTagListItem extends ProfileListItem
+{
+    function linkAttributes()
+    {
+        $aAttrs = parent::linkAttributes();
+
+        if (common_config('nofollow', 'peopletag')) {
+            $aAttrs['rel'] .= ' nofollow';
+        }
+
+        return $aAttrs;
+    }
+
+    function showHomepage()
+    {
+        if (!empty($this->profile->homepage)) {
+            $this->out->text(' ');
+            $aAttrs = array('href' => $this->profile->homepage,
+                            'class' => 'url');
+            if (common_config('nofollow', 'peopletag')) {
+                $aAttrs['rel'] = 'nofollow';
+            }
+            $this->out->elementStart('a', $aAttrs);
+            $this->out->raw($this->highlight($this->profile->homepage));
+            $this->out->elementEnd('a');
+        }
+    }
+}
+