forked from GNUsocial/gnu-social
Merge branch 'nofollow'
This commit is contained in:
commit
0b30230b5a
|
@ -32,8 +32,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once INSTALLDIR.'/lib/profilelist.php';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class outputs a paginated list of profiles self-tagged with a given tag
|
* 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));
|
$profile->query(sprintf($qry, $this->tag, $lim));
|
||||||
|
|
||||||
$pl = new ProfileList($profile, $this);
|
$ptl = new PeopleTagList($profile, $this); // pass the ammunition
|
||||||
$cnt = $pl->show();
|
$cnt = $ptl->show();
|
||||||
|
|
||||||
$this->pagination($this->page > 1,
|
$this->pagination($this->page > 1,
|
||||||
$cnt > PROFILES_PER_PAGE,
|
$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');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -388,10 +388,12 @@ class ShowgroupAction extends GroupDesignAction
|
||||||
$this->elementStart('div', array('id' => 'entity_members',
|
$this->elementStart('div', array('id' => 'entity_members',
|
||||||
'class' => 'section'));
|
'class' => 'section'));
|
||||||
|
|
||||||
|
if (Event::handle('StartShowGroupMembersMiniList', array($this))) {
|
||||||
|
|
||||||
$this->element('h2', null, _('Members'));
|
$this->element('h2', null, _('Members'));
|
||||||
|
|
||||||
$pml = new ProfileMiniList($member, $this);
|
$gmml = new GroupMembersMiniList($member, $this);
|
||||||
$cnt = $pml->show();
|
$cnt = $gmml->show();
|
||||||
if ($cnt == 0) {
|
if ($cnt == 0) {
|
||||||
$this->element('p', null, _('(None)'));
|
$this->element('p', null, _('(None)'));
|
||||||
}
|
}
|
||||||
|
@ -402,6 +404,9 @@ class ShowgroupAction extends GroupDesignAction
|
||||||
_('All members'));
|
_('All members'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Event::handle('EndShowGroupMembersMiniList', array($this));
|
||||||
|
}
|
||||||
|
|
||||||
$this->elementEnd('div');
|
$this->elementEnd('div');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -502,3 +507,26 @@ class GroupAdminSection extends ProfileSection
|
||||||
return null;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -296,4 +296,8 @@ $default =
|
||||||
),
|
),
|
||||||
'api' =>
|
'api' =>
|
||||||
array('realm' => null),
|
array('realm' => null),
|
||||||
|
'nofollow' =>
|
||||||
|
array('subscribers' => true,
|
||||||
|
'members' => true,
|
||||||
|
'peopletag' => true),
|
||||||
);
|
);
|
||||||
|
|
|
@ -139,13 +139,15 @@ class ProfileAction extends OwnerDesignAction
|
||||||
$this->elementStart('div', array('id' => 'entity_subscribers',
|
$this->elementStart('div', array('id' => 'entity_subscribers',
|
||||||
'class' => 'section'));
|
'class' => 'section'));
|
||||||
|
|
||||||
|
if (Event::handle('StartShowSubscribersMiniList', array($this))) {
|
||||||
|
|
||||||
$this->element('h2', null, _('Subscribers'));
|
$this->element('h2', null, _('Subscribers'));
|
||||||
|
|
||||||
$cnt = 0;
|
$cnt = 0;
|
||||||
|
|
||||||
if (!empty($profile)) {
|
if (!empty($profile)) {
|
||||||
$pml = new ProfileMiniList($profile, $this);
|
$sml = new SubscribersMiniList($profile, $this);
|
||||||
$cnt = $pml->show();
|
$cnt = $sml->show();
|
||||||
if ($cnt == 0) {
|
if ($cnt == 0) {
|
||||||
$this->element('p', null, _('(None)'));
|
$this->element('p', null, _('(None)'));
|
||||||
}
|
}
|
||||||
|
@ -160,6 +162,9 @@ class ProfileAction extends OwnerDesignAction
|
||||||
$this->elementEnd('p');
|
$this->elementEnd('p');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Event::handle('EndShowSubscribersMiniList', array($this));
|
||||||
|
}
|
||||||
|
|
||||||
$this->elementEnd('div');
|
$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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -181,9 +181,8 @@ class ProfileListItem extends Widget
|
||||||
function showAvatar()
|
function showAvatar()
|
||||||
{
|
{
|
||||||
$avatar = $this->profile->getAvatar(AVATAR_STREAM_SIZE);
|
$avatar = $this->profile->getAvatar(AVATAR_STREAM_SIZE);
|
||||||
$this->out->elementStart('a', array('href' => $this->profile->profileurl,
|
$aAttrs = $this->linkAttributes();
|
||||||
'class' => 'url entry-title',
|
$this->out->elementStart('a', $aAttrs);
|
||||||
'rel' => 'contact'));
|
|
||||||
$this->out->element('img', array('src' => ($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_STREAM_SIZE),
|
$this->out->element('img', array('src' => ($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_STREAM_SIZE),
|
||||||
'class' => 'photo avatar',
|
'class' => 'photo avatar',
|
||||||
'width' => AVATAR_STREAM_SIZE,
|
'width' => AVATAR_STREAM_SIZE,
|
||||||
|
@ -299,4 +298,11 @@ class ProfileListItem extends Widget
|
||||||
{
|
{
|
||||||
return htmlspecialchars($text);
|
return htmlspecialchars($text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function linkAttributes()
|
||||||
|
{
|
||||||
|
return array('href' => $this->profile->profileurl,
|
||||||
|
'class' => 'url entry-title',
|
||||||
|
'rel' => 'contact');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,10 +81,10 @@ class ProfileMiniListItem extends ProfileListItem
|
||||||
function show()
|
function show()
|
||||||
{
|
{
|
||||||
$this->out->elementStart('li', 'vcard');
|
$this->out->elementStart('li', 'vcard');
|
||||||
$this->out->elementStart('a', array('title' => $this->profile->getBestName(),
|
if (Event::handle('StartProfileListItemProfileElements', array($this))) {
|
||||||
'href' => $this->profile->profileurl,
|
if (Event::handle('StartProfileListItemAvatar', array($this))) {
|
||||||
'rel' => 'contact member',
|
$aAttrs = $this->linkAttributes();
|
||||||
'class' => 'url'));
|
$this->out->elementStart('a', $aAttrs);
|
||||||
$avatar = $this->profile->getAvatar(AVATAR_MINI_SIZE);
|
$avatar = $this->profile->getAvatar(AVATAR_MINI_SIZE);
|
||||||
$this->out->element('img', array('src' => (($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_MINI_SIZE)),
|
$this->out->element('img', array('src' => (($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_MINI_SIZE)),
|
||||||
'width' => AVATAR_MINI_SIZE,
|
'width' => AVATAR_MINI_SIZE,
|
||||||
|
@ -95,6 +95,22 @@ class ProfileMiniListItem extends ProfileListItem
|
||||||
$this->profile->nickname));
|
$this->profile->nickname));
|
||||||
$this->out->element('span', 'fn nickname', $this->profile->nickname);
|
$this->out->element('span', 'fn nickname', $this->profile->nickname);
|
||||||
$this->out->elementEnd('a');
|
$this->out->elementEnd('a');
|
||||||
|
Event::handle('EndProfileListItemAvatar', array($this));
|
||||||
|
}
|
||||||
$this->out->elementEnd('li');
|
$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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue