]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch 'master' into testing
authorBrion Vibber <brion@pobox.com>
Mon, 5 Apr 2010 17:42:41 +0000 (10:42 -0700)
committerBrion Vibber <brion@pobox.com>
Mon, 5 Apr 2010 17:42:41 +0000 (10:42 -0700)
actions/groupmembers.php
actions/peopletag.php
actions/showgroup.php
actions/subscribers.php
lib/default.php
lib/profileaction.php
lib/profilelist.php
lib/profileminilist.php

index a16debd7b068ecd4e69deec35d61e42475f83752..fb4e46dbc0ea145e40b58a626d5efbfce44c47d8 100644 (file)
@@ -212,6 +212,7 @@ class GroupMemberListItem extends ProfileListItem
         }
 
     }
+
     function showGroupBlockForm()
     {
         $user = common_current_user();
@@ -224,7 +225,24 @@ class GroupMemberListItem extends ProfileListItem
             $bf->show();
             $this->out->elementEnd('li');
         }
+    }
+
+    function linkAttributes()
+    {
+        $aAttrs = parent::linkAttributes();
+
+        if (common_config('nofollow', 'members')) {
+            $aAttrs['rel'] .= ' nofollow';
+        }
+
+        return $aAttrs;
+    }
 
+    function homepageAttributes()
+    {
+        if (common_config('nofollow', 'members')) {
+            $aAttrs['rel'] = 'nofollow';
+        }
     }
 }
 
index 4ba1dc0f1f71327aba61394b74f4192a3f8171be..456cc21c4c149446b5f16ac3d3d57a39816fae00 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,33 @@ 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 homepageAttributes()
+    {
+        if (common_config('nofollow', 'peopletag')) {
+            $aAttrs['rel'] = 'nofollow';
+        }
+    }
+}
+
index a0d05ba37a39f62c3861502968e5d89db53ecddc..3d369e9ebfbf7d46577be5ba3f0b31d559b76640 100644 (file)
@@ -388,18 +388,23 @@ class ShowgroupAction extends GroupDesignAction
         $this->elementStart('div', array('id' => 'entity_members',
                                          'class' => 'section'));
 
-        $this->element('h2', null, _('Members'));
+        if (Event::handle('StartShowGroupMembersMiniList', array($this))) {
 
-        $pml = new ProfileMiniList($member, $this);
-        $cnt = $pml->show();
-        if ($cnt == 0) {
-             $this->element('p', null, _('(None)'));
-        }
+            $this->element('h2', null, _('Members'));
+
+            $gmml = new GroupMembersMiniList($member, $this);
+            $cnt = $gmml->show();
+            if ($cnt == 0) {
+                $this->element('p', null, _('(None)'));
+            }
+
+            if ($cnt > MEMBERS_PER_SECTION) {
+                $this->element('a', array('href' => common_local_url('groupmembers',
+                                                                     array('nickname' => $this->group->nickname))),
+                               _('All members'));
+            }
 
-        if ($cnt > MEMBERS_PER_SECTION) {
-            $this->element('a', array('href' => common_local_url('groupmembers',
-                                                                 array('nickname' => $this->group->nickname))),
-                           _('All members'));
+            Event::handle('EndShowGroupMembersMiniList', array($this));
         }
 
         $this->elementEnd('div');
@@ -502,3 +507,26 @@ class GroupAdminSection extends ProfileSection
         return null;
     }
 }
+
+class GroupMembersMiniList extends ProfileMiniList
+{
+    function newListItem($profile)
+    {
+        return new GroupMembersMiniListItem($profile, $this->action);
+    }
+}
+
+class GroupMembersMiniListItem extends ProfileMiniListItem
+{
+    function linkAttributes()
+    {
+        $aAttrs = parent::linkAttributes();
+
+        if (common_config('nofollow', 'members')) {
+            $aAttrs['rel'] .= ' nofollow';
+        }
+
+        return $aAttrs;
+    }
+}
+
index 4bced62840dcda4f3f8a28d591583b901729ccc1..6dda7312d67bf7eafb408375f30c6641435951e5 100644 (file)
@@ -163,4 +163,22 @@ class SubscribersListItem extends SubscriptionListItem
             $bf->show();
         }
     }
+
+    function linkAttributes()
+    {
+        $aAttrs = parent::linkAttributes();
+
+        if (common_config('nofollow', 'subscribers')) {
+            $aAttrs['rel'] .= ' nofollow';
+        }
+
+        return $aAttrs;
+    }
+
+    function homepageAttributes()
+    {
+        if (common_config('nofollow', 'subscribers')) {
+            $aAttrs['rel'] = 'nofollow';
+        }
+    }
 }
index 7d9a37174b7f37bd3aeb44d6e6880ba0fca95d46..fa4ece10addbb1fdab09bc607c27b8c9b615efb5 100644 (file)
@@ -299,4 +299,8 @@ $default =
               ),
         'api' =>
         array('realm' => null),
+        'nofollow' =>
+        array('subscribers' => true,
+              'members' => true,
+              'peopletag' => true),
         );
index 029c21845d6630088189eb2c2731537c92011e84..82e0224af2182141780eb744797eaf0d600cc33b 100644 (file)
@@ -139,25 +139,30 @@ class ProfileAction extends OwnerDesignAction
         $this->elementStart('div', array('id' => 'entity_subscribers',
                                          'class' => 'section'));
 
-        $this->element('h2', null, _('Subscribers'));
+        if (Event::handle('StartShowSubscribersMiniList', array($this))) {
 
-        $cnt = 0;
+            $this->element('h2', null, _('Subscribers'));
 
-        if (!empty($profile)) {
-            $pml = new ProfileMiniList($profile, $this);
-            $cnt = $pml->show();
-            if ($cnt == 0) {
-                $this->element('p', null, _('(None)'));
+            $cnt = 0;
+
+            if (!empty($profile)) {
+                $sml = new SubscribersMiniList($profile, $this);
+                $cnt = $sml->show();
+                if ($cnt == 0) {
+                    $this->element('p', null, _('(None)'));
+                }
             }
-        }
 
-        if ($cnt > PROFILES_PER_MINILIST) {
-            $this->elementStart('p');
-            $this->element('a', array('href' => common_local_url('subscribers',
-                                                                 array('nickname' => $this->profile->nickname)),
-                                      'class' => 'more'),
-                           _('All subscribers'));
-            $this->elementEnd('p');
+            if ($cnt > PROFILES_PER_MINILIST) {
+                $this->elementStart('p');
+                $this->element('a', array('href' => common_local_url('subscribers',
+                                                                     array('nickname' => $this->profile->nickname)),
+                                          'class' => 'more'),
+                               _('All subscribers'));
+                $this->elementEnd('p');
+            }
+
+            Event::handle('EndShowSubscribersMiniList', array($this));
         }
 
         $this->elementEnd('div');
@@ -254,3 +259,23 @@ class ProfileAction extends OwnerDesignAction
     }
 }
 
+class SubscribersMiniList extends ProfileMiniList
+{
+    function newListItem($profile)
+    {
+        return new SubscribersMiniListItem($profile, $this->action);
+    }
+}
+
+class SubscribersMiniListItem extends ProfileMiniListItem
+{
+    function linkAttributes()
+    {
+        $aAttrs = parent::linkAttributes();
+        if (common_config('nofollow', 'subscribers')) {
+            $aAttrs['rel'] .= ' nofollow';
+        }
+        return $aAttrs;
+    }
+}
+
index 3e5513895ce5c4caebdde866e30b0eeb6f111f7a..b010fb724921028a04e36661471b8932bd7102b8 100644 (file)
@@ -181,9 +181,8 @@ class ProfileListItem extends Widget
     function showAvatar()
     {
         $avatar = $this->profile->getAvatar(AVATAR_STREAM_SIZE);
-        $this->out->elementStart('a', array('href' => $this->profile->profileurl,
-                                            'class' => 'url entry-title',
-                                            'rel' => 'contact'));
+        $aAttrs = $this->linkAttributes();
+        $this->out->elementStart('a', $aAttrs);
         $this->out->element('img', array('src' => ($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_STREAM_SIZE),
                                          'class' => 'photo avatar',
                                          'width' => AVATAR_STREAM_SIZE,
@@ -223,8 +222,8 @@ class ProfileListItem extends Widget
     {
         if (!empty($this->profile->homepage)) {
             $this->out->text(' ');
-            $this->out->elementStart('a', array('href' => $this->profile->homepage,
-                                                'class' => 'url'));
+            $aAttrs = $this->homepageAttributes();
+            $this->out->elementStart('a', $aAttrs);
             $this->out->raw($this->highlight($this->profile->homepage));
             $this->out->elementEnd('a');
         }
@@ -299,4 +298,17 @@ class ProfileListItem extends Widget
     {
         return htmlspecialchars($text);
     }
+
+    function linkAttributes()
+    {
+        return array('href' => $this->profile->profileurl,
+                     'class' => 'url entry-title',
+                     'rel' => 'contact');
+    }
+
+    function homepageAttributes()
+    {
+        return array('href' => $this->profile->homepage,
+                     'class' => 'url');
+    }
 }
index 079170d802ddcc2c813c8da2722c4ba297552abc..a9895347486c1253fd1bd389922d1211bec58b82 100644 (file)
@@ -81,20 +81,36 @@ class ProfileMiniListItem extends ProfileListItem
     function show()
     {
         $this->out->elementStart('li', 'vcard');
-        $this->out->elementStart('a', array('title' => $this->profile->getBestName(),
-                                       'href' => $this->profile->profileurl,
-                                       'rel' => 'contact member',
-                                       'class' => 'url'));
-        $avatar = $this->profile->getAvatar(AVATAR_MINI_SIZE);
-        $this->out->element('img', array('src' => (($avatar) ? $avatar->displayUrl() :  Avatar::defaultImage(AVATAR_MINI_SIZE)),
-                                    'width' => AVATAR_MINI_SIZE,
-                                    'height' => AVATAR_MINI_SIZE,
-                                    'class' => 'avatar photo',
-                                    'alt' =>  ($this->profile->fullname) ?
-                                    $this->profile->fullname :
-                                    $this->profile->nickname));
-        $this->out->element('span', 'fn nickname', $this->profile->nickname);
-        $this->out->elementEnd('a');
-        $this->out->elementEnd('li');
+        if (Event::handle('StartProfileListItemProfileElements', array($this))) {
+            if (Event::handle('StartProfileListItemAvatar', array($this))) {
+                $aAttrs = $this->linkAttributes();
+                $this->out->elementStart('a', $aAttrs);
+                $avatar = $this->profile->getAvatar(AVATAR_MINI_SIZE);
+                $this->out->element('img', array('src' => (($avatar) ? $avatar->displayUrl() :  Avatar::defaultImage(AVATAR_MINI_SIZE)),
+                                                 'width' => AVATAR_MINI_SIZE,
+                                                 'height' => AVATAR_MINI_SIZE,
+                                                 'class' => 'avatar photo',
+                                                 'alt' =>  ($this->profile->fullname) ?
+                                                 $this->profile->fullname :
+                                                 $this->profile->nickname));
+                $this->out->element('span', 'fn nickname', $this->profile->nickname);
+                $this->out->elementEnd('a');
+                Event::handle('EndProfileListItemAvatar', array($this));
+            }
+            $this->out->elementEnd('li');
+        }
+    }
+
+    // default; overridden for nofollow lists
+
+    function linkAttributes()
+    {
+        $aAttrs = parent::linkAttributes();
+
+        $aAttrs['title'] = $this->profile->getBestName();
+        $aAttrs['rel']   = 'contact member'; // @todo: member? always?
+        $aAttrs['class'] = 'url';
+
+        return $aAttrs;
     }
 }