*/
public function getUrl()
{
+ $url = null;
+ if ($this->isGroup()) {
+ // FIXME: Get rid of this event, it fills no real purpose, data should be in Profile->profileurl (replaces User_group->mainpage)
+ if (Event::handle('StartUserGroupHomeUrl', array($this->getGroup(), &$url))) {
+ $url = $this->isLocal()
+ ? common_local_url('showgroup', array('nickname' => $this->getNickname()))
+ : $this->profileurl;
+ }
+ Event::handle('EndUserGroupHomeUrl', array($this->getGroup(), $url));
+ } else {
+ $url = $this->profileurl;
+ }
if (empty($this->profileurl) ||
!filter_var($this->profileurl, FILTER_VALIDATE_URL)) {
throw new InvalidUrlException($this->profileurl);
function homeUrl()
{
- $url = null;
- if (Event::handle('StartUserGroupHomeUrl', array($this, &$url))) {
- // normally stored in mainpage, but older ones may be null
- if (!empty($this->mainpage)) {
- $url = $this->mainpage;
- } elseif ($this->isLocal()) {
- $url = common_local_url('showgroup',
- array('nickname' => $this->nickname));
- }
- }
- Event::handle('EndUserGroupHomeUrl', array($this, &$url));
- return $url;
+ $this->getProfile()->getUrl();
}
function getUri()
$this->out->elementStart('tbody');
}
- function newListItem($profile)
+ function newListItem(Profile $profile)
{
return new SortableGroupListItem($profile, $this->owner, $this->action);
}
{
function showHomepage()
{
- if (!empty($this->profile->homepage)) {
+ if ($this->profile->getHomepage()) {
$this->out->text(' ');
$aAttrs = $this->homepageAttributes();
$this->out->elementStart('a', $aAttrs);
- $this->out->raw($this->highlight($this->profile->homepage));
+ $this->out->text($this->profile->getHomepage());
$this->out->elementEnd('a');
}
}
function showDescription()
{
- if (!empty($this->profile->description)) {
- $cutoff = 140; // XXX Should this be configurable?
- $description = htmlspecialchars($this->profile->description);
-
- if (mb_strlen($description) > $cutoff) {
- $description = mb_substr($description, 0, $cutoff - 1)
- .'<a href="' . $this->profile->homeUrl() .'">…</a>';
- }
-
+ if ($this->profile->getDescription()) {
$this->out->elementStart('p', 'note');
- $this->out->raw($description);
+ $this->out->text($this->profile->getDescription());
$this->out->elementEnd('p');
}
{
$this->startProfile();
- $this->showAvatar($this->profile->getProfile());
- $this->out->element('a', array('href' => $this->profile->homeUrl(),
+ $this->showAvatar($this->profile);
+ $this->out->element('a', array('href' => $this->profile->getUrl(),
'class' => 'p-org p-nickname',
'rel' => 'contact group'),
$this->profile->getNickname());
$this->out->elementStart('li', 'entity_subscribe');
// XXX: special-case for user looking at own
// subscriptions page
- if ($user->isMember($this->profile)) {
+ if ($user->isMember($this->profile->getGroup())) {
$lf = new LeaveForm($this->out, $this->profile);
$lf->show();
} else if (!Group_block::isBlocked($this->profile, $user->getProfile())) {
function showMemberCount()
{
$this->out->elementStart('td', 'entry_member_count');
- $this->out->raw($this->profile->getMemberCount());
+ $this->out->text($this->profile->getGroup()->getMemberCount());
$this->out->elementEnd('td');
}
{
$this->out->elementStart('td', 'entry_created');
// @todo FIXME: Should we provide i18n for timestamps in core?
- $this->out->raw(date('j M Y', strtotime($this->profile->created)));
+ $this->out->text(date('j M Y', strtotime($this->profile->created)));
$this->out->elementEnd('td');
}
{
$this->out->elementStart('td', 'entry_admins');
// @todo
- $this->out->raw('gargargar');
+ $this->out->text('gargargar');
$this->out->elementEnd('td');
}
$this->out->elementEnd('table');
}
- function newListItem($profile)
+ function newListItem(Profile $profile)
{
return new SortableSubscriptionListItem($profile, $this->owner, $this->action);
}
function showSubscriberCount()
{
$this->out->elementStart('td', 'entry_subscriber_count');
- $this->out->raw($this->profile->subscriberCount());
+ $this->out->text($this->profile->subscriberCount());
$this->out->elementEnd('td');
}
function showCreatedDate()
{
$this->out->elementStart('td', 'entry_created');
- $this->out->raw(date('j M Y', strtotime($this->profile->created)));
+ $this->out->text(date('j M Y', strtotime($this->profile->created)));
$this->out->elementEnd('td');
}
function showNoticeCount()
{
$this->out->elementStart('td', 'entry_notice_count');
- $this->out->raw($this->profile->noticeCount());
+ $this->out->text($this->profile->noticeCount());
$this->out->elementEnd('td');
}
- /**
- * Overrided to truncate the bio if it's real long, because it
- * looks better that way in the SortableSubscriptionList's table
- */
function showBio()
{
- if (!empty($this->profile->bio)) {
- $cutoff = 140; // XXX Should this be configurable?
- $bio = htmlspecialchars($this->profile->bio);
-
- if (mb_strlen($bio) > $cutoff) {
- $bio = mb_substr($bio, 0, $cutoff - 1)
- .'<a href="' . $this->profile->profileurl .'">…</a>';
- }
-
+ if ($this->profile->getDescription()) {
$this->out->elementStart('p', 'note');
- $this->out->raw($bio);
+ $this->out->text($this->profile->getDescription());
$this->out->elementEnd('p');
}
}