Commit 4b22b0c4 authored by mmn's avatar mmn

More listitems and lists into separate files + stronger typing

parent 6d9f390b
......@@ -132,64 +132,3 @@ class SubscribersAction extends GalleryAction
parent::showSections();
}
}
class SubscribersList extends SubscriptionList
{
function newListItem($profile)
{
return new SubscribersListItem($profile, $this->owner, $this->action);
}
}
class SubscribersListItem extends SubscriptionListItem
{
function showActions()
{
$this->startActions();
if (Event::handle('StartProfileListItemActionElements', array($this))) {
$this->showSubscribeButton();
// Relevant code!
$this->showBlockForm();
Event::handle('EndProfileListItemActionElements', array($this));
}
$this->endActions();
}
function showBlockForm()
{
$user = common_current_user();
if (!empty($user) && $this->owner->id == $user->id) {
$returnto = array('action' => 'subscribers',
'nickname' => $this->owner->getNickname());
$page = $this->out->arg('page');
if ($page) {
$returnto['param-page'] = $page;
}
$bf = new BlockForm($this->out, $this->profile, $returnto);
$bf->show();
}
}
function linkAttributes()
{
$aAttrs = parent::linkAttributes();
if (common_config('nofollow', 'subscribers')) {
$aAttrs['rel'] .= ' nofollow';
}
return $aAttrs;
}
function homepageAttributes()
{
$aAttrs = parent::linkAttributes();
if (common_config('nofollow', 'subscribers')) {
$aAttrs['rel'] = 'nofollow';
}
return $aAttrs;
}
}
<?php
if (!defined('GNUSOCIAL')) { exit(1); }
class SubscribersList extends SubscriptionList
{
function newListItem(Profile $profile)
{
return new SubscribersListItem($profile, $this->owner, $this->action);
}
}
<?php
if (!defined('GNUSOCIAL')) { exit(1); }
class SubscribersListItem extends SubscriptionListItem
{
function showActions()
{
$this->startActions();
if (Event::handle('StartProfileListItemActionElements', array($this))) {
$this->showSubscribeButton();
// Relevant code!
$this->showBlockForm();
Event::handle('EndProfileListItemActionElements', array($this));
}
$this->endActions();
}
function showBlockForm()
{
$user = common_current_user();
if (!empty($user) && $this->owner->id == $user->id) {
$returnto = array('action' => 'subscribers',
'nickname' => $this->owner->getNickname());
$page = $this->out->arg('page');
if ($page) {
$returnto['param-page'] = $page;
}
$bf = new BlockForm($this->out, $this->profile, $returnto);
$bf->show();
}
}
function linkAttributes()
{
$aAttrs = parent::linkAttributes();
if (common_config('nofollow', 'subscribers')) {
$aAttrs['rel'] .= ' nofollow';
}
return $aAttrs;
}
function homepageAttributes()
{
$aAttrs = parent::linkAttributes();
if (common_config('nofollow', 'subscribers')) {
$aAttrs['rel'] = 'nofollow';
}
return $aAttrs;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment