X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fprofileblock.php;h=65c4fa99d2c51ac980eae7ef32079478c7fd014f;hb=1ae5ea8f4cf40113a14a183b754101177f99ba32;hp=dca0814437452ca8e94683ced83230d1e1e13c90;hpb=519bbfb2e973169e52d6802fdca7f49930d2dabb;p=quix0rs-gnu-social.git diff --git a/lib/profileblock.php b/lib/profileblock.php index dca0814437..65c4fa99d2 100644 --- a/lib/profileblock.php +++ b/lib/profileblock.php @@ -4,7 +4,7 @@ * Copyright (C) 2011, StatusNet, Inc. * * Superclass for profile blocks - * + * * PHP version 5 * * This program is free software: you can redistribute it and/or modify @@ -47,7 +47,8 @@ if (!defined('STATUSNET')) { abstract class ProfileBlock extends Widget { - abstract function avatar(); + protected $avatarSize = AVATAR_PROFILE_SIZE; + abstract function name(); abstract function url(); abstract function location(); @@ -56,16 +57,18 @@ abstract class ProfileBlock extends Widget function show() { - $this->out->elementStart('div', 'profile_block'); - - $size = $this->avatarSize(); - - $this->out->element('img', array('src' => $this->avatar(), - 'class' => 'profile_block_avatar', - 'alt' => $this->name(), - 'width' => $size, - 'height' => $size)); + $this->showActions(); + $this->showAvatar($this->profile); + $this->showName(); + $this->showLocation(); + $this->showHomepage(); + $this->showOtherProfiles(); + $this->showDescription(); + $this->showTags(); + } + function showName() + { $name = $this->name(); if (!empty($name)) { @@ -79,35 +82,72 @@ abstract class ProfileBlock extends Widget } $this->out->elementEnd('p'); } + } + + function showDescription() + { + $description = $this->description(); + + if (!empty($description)) { + $this->out->element( + 'p', + 'profile_block_description', + $description + ); + } + } + function showLocation() + { $location = $this->location(); if (!empty($location)) { $this->out->element('p', 'profile_block_location', $location); } + } + function showHomepage() + { $homepage = $this->homepage(); if (!empty($homepage)) { - $this->out->element('a', 'profile_block_homepage', $homepage); + $this->out->element('a', + array('href' => $homepage, + 'rel' => 'me', + 'class' => 'profile_block_homepage'), + $homepage); } + } - $description = $this->description(); + function showOtherProfiles() + { + $otherProfiles = $this->otherProfiles(); + + if (!empty($otherProfiles)) { + + $this->out->elementStart('ul', + array('class' => 'profile_block_otherprofile_list')); + + foreach ($otherProfiles as $otherProfile) { + $this->out->elementStart('li'); + $this->out->elementStart('a', + array('href' => $otherProfile['href'], + 'rel' => 'me', + 'class' => 'profile_block_otherprofile', + 'title' => $otherProfile['text'])); + $this->out->element('img', + array('src' => $otherProfile['image'], + 'class' => 'profile_block_otherprofile_icon')); + $this->out->elementEnd('a'); + $this->out->elementEnd('li'); + } - if (!empty($description)) { - $this->out->element('p', - 'profile_block_description', - $description); + $this->out->elementEnd('ul'); } - - $this->showActions(); - - $this->out->elementEnd('div'); } - function avatarSize() + function showTags() { - return AVATAR_PROFILE_SIZE; } function showActions()