4 * Laconica - a distributed open-source microblogging tool
5 * Copyright (C) 2008, Controlez-Vous, Inc.
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Affero General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Affero General Public License for more details.
17 * You should have received a copy of the GNU Affero General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 if (!defined('LACONICA')) { exit(1); }
23 define('PROFILES_PER_PAGE', 10);
29 function __construct($profile) {
30 $this->profile = $profile;
33 function show_list() {
35 common_element_start('ul', array('id' => 'profiles'));
39 while ($this->profile->fetch()) {
41 if($cnt > PROFILES_PER_PAGE) {
47 common_element_end('ul');
52 $this->profile = $this->profile;
54 common_element_start('li', array('class' => 'profile_single',
55 'id' => 'profile-' . $this->profile->id));
56 $avatar = $this->profile->getAvatar(AVATAR_STREAM_SIZE);
57 common_element_start('a', array('href' => $this->profile->profileurl));
58 common_element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_STREAM_SIZE),
59 'class' => 'avatar stream',
60 'width' => AVATAR_STREAM_SIZE,
61 'height' => AVATAR_STREAM_SIZE,
63 ($this->profile->fullname) ? $this->profile->fullname :
64 $this->profile->nickname));
65 common_element_end('a');
66 common_element_start('p');
67 common_element_start('a', array('href' => $this->profile->profileurl,
68 'class' => 'nickname'));
69 common_raw($this->highlight($this->profile->nickname));
70 common_element_end('a');
71 if ($this->profile->fullname) {
73 common_element_start('span', 'fullname');
74 common_raw($this->highlight($this->profile->fullname));
75 common_element_end('span');
77 if ($this->profile->location) {
79 common_element_start('span', 'location');
80 common_raw($this->highlight($this->profile->location));
81 common_element_end('span');
83 common_element_end('p');
84 if ($this->profile->homepage) {
85 common_element_start('p', 'website');
86 common_element_start('a', array('href' => $this->profile->homepage));
87 common_raw($this->highlight($this->profile->homepage));
88 common_element_end('a');
89 common_element_end('p');
91 if ($this->profile->bio) {
92 common_element_start('p', 'bio');
93 common_raw($this->highlight($this->profile->bio));
94 common_element_end('p');
96 common_element_end('li');
99 function highlight($text) {
100 return htmlspecialchars($text);