summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-04-05 10:42:41 -0700
committerBrion Vibber <brion@pobox.com>2010-04-05 10:42:41 -0700
commitb71f276ed5420bc17262fe7981617ce6e27839c4 (patch)
tree104c6fe37665d434635e3970c151aca52612efc7 /lib
parentf2b60b78b6096447a8aadc3d5075bb916f89880a (diff)
parent2a489018b11838280ef0c74f6727d5b9c0c10a0f (diff)
Merge branch 'master' into testing
Diffstat (limited to 'lib')
-rw-r--r--lib/default.php4
-rw-r--r--lib/profileaction.php55
-rw-r--r--lib/profilelist.php22
-rw-r--r--lib/profileminilist.php46
4 files changed, 92 insertions, 35 deletions
diff --git a/lib/default.php b/lib/default.php
index 7d9a37174..fa4ece10a 100644
--- a/lib/default.php
+++ b/lib/default.php
@@ -299,4 +299,8 @@ $default =
),
'api' =>
array('realm' => null),
+ 'nofollow' =>
+ array('subscribers' => true,
+ 'members' => true,
+ 'peopletag' => true),
);
diff --git a/lib/profileaction.php b/lib/profileaction.php
index 029c21845..82e0224af 100644
--- a/lib/profileaction.php
+++ b/lib/profileaction.php
@@ -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;
+ }
+}
+
diff --git a/lib/profilelist.php b/lib/profilelist.php
index 3e5513895..b010fb724 100644
--- a/lib/profilelist.php
+++ b/lib/profilelist.php
@@ -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');
+ }
}
diff --git a/lib/profileminilist.php b/lib/profileminilist.php
index 079170d80..a98953474 100644
--- a/lib/profileminilist.php
+++ b/lib/profileminilist.php
@@ -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;
}
}