X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fprofilelist.php;h=57559b5bb27d4d43069dcc443e3ff0e88b9632b2;hb=b15f5f0cafc08c9b63090c5b4f7494fca0634238;hp=313cf760731e9a72a41e2ffe5966269a7d01bd96;hpb=d594c83a5a9a9d42fce917b544c28591fcadb1aa;p=quix0rs-gnu-social.git diff --git a/lib/profilelist.php b/lib/profilelist.php index 313cf76073..57559b5bb2 100644 --- a/lib/profilelist.php +++ b/lib/profilelist.php @@ -31,7 +31,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } -require_once INSTALLDIR.'/lib/widget.php'; require_once INSTALLDIR.'/lib/peopletags.php'; /** @@ -75,7 +74,7 @@ class ProfileList extends Widget function startList() { - $this->out->elementStart('ul', 'profiles xoxo'); + $this->out->elementStart('ul', 'profile_list xoxo'); } function endList() @@ -85,15 +84,8 @@ class ProfileList extends Widget function showProfiles() { - // Note: we don't use fetchAll() because it's borked with query() - - $profiles = array(); - - while ($this->profile->fetch()) { - $profiles[] = clone($this->profile); - } - - $cnt = count($profiles); + $cnt = $this->profile->N; + $profiles = $this->profile->fetchAll(); $max = min($cnt, $this->maxProfiles()); @@ -105,7 +97,7 @@ class ProfileList extends Widget return $cnt; } - function newListItem($profile) + function newListItem(Profile $profile) { return new ProfileListItem($profile, $this->action); } @@ -114,11 +106,6 @@ class ProfileList extends Widget { return PROFILES_PER_PAGE; } - - function avatarSize() - { - return AVATAR_STREAM_SIZE; - } } class ProfileListItem extends Widget @@ -155,7 +142,7 @@ class ProfileListItem extends Widget function startItem() { - $this->out->elementStart('li', array('class' => 'profile hentry', + $this->out->elementStart('li', array('class' => 'profile', 'id' => 'profile-' . $this->profile->id)); } @@ -164,9 +151,16 @@ class ProfileListItem extends Widget $this->startProfile(); if (Event::handle('StartProfileListItemProfileElements', array($this))) { if (Event::handle('StartProfileListItemAvatar', array($this))) { - $this->showAvatar(); + $aAttrs = $this->linkAttributes(); + $this->out->elementStart('a', $aAttrs); + $this->showAvatar($this->profile); + $this->out->elementEnd('a'); Event::handle('EndProfileListItemAvatar', array($this)); } + if (Event::handle('StartProfileListItemNickname', array($this))) { + $this->showNickname(); + Event::handle('EndProfileListItemNickname', array($this)); + } if (Event::handle('StartProfileListItemFullName', array($this))) { $this->showFullName(); Event::handle('EndProfileListItemFullName', array($this)); @@ -194,46 +188,27 @@ class ProfileListItem extends Widget function startProfile() { - $this->out->elementStart('div', 'entity_profile vcard entry-content'); + $this->out->elementStart('div', 'entity_profile h-card'); } - function showAvatar() + function showNickname() { - $avatar = $this->profile->getAvatar(AVATAR_STREAM_SIZE); - $aAttrs = $this->linkAttributes(); - $this->out->elementStart('a', $aAttrs); - $this->out->element('img', array('src' => (!empty($avatar)) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_STREAM_SIZE), - 'class' => 'photo avatar', - 'width' => AVATAR_STREAM_SIZE, - 'height' => AVATAR_STREAM_SIZE, - 'alt' => - ($this->profile->fullname) ? $this->profile->fullname : - $this->profile->nickname)); - $this->out->text(' '); - $hasFN = (!empty($this->profile->fullname)) ? 'nickname' : 'fn nickname'; - $this->out->elementStart('span', $hasFN); - $this->out->raw($this->highlight($this->profile->nickname)); - $this->out->elementEnd('span'); - $this->out->elementEnd('a'); + $this->out->element('a', array('href'=>$this->profile->getUrl(), + 'class'=>'p-nickname'), + $this->profile->getNickname()); } function showFullName() { if (!empty($this->profile->fullname)) { - $this->out->text(' '); - $this->out->elementStart('span', 'fn'); - $this->out->raw($this->highlight($this->profile->fullname)); - $this->out->elementEnd('span'); + $this->out->element('span', 'p-name', $this->profile->fullname); } } function showLocation() { if (!empty($this->profile->location)) { - $this->out->text(' '); - $this->out->elementStart('span', 'label'); - $this->out->raw($this->highlight($this->profile->location)); - $this->out->elementEnd('span'); + $this->out->element('span', 'label p-locality', $this->profile->location); } } @@ -334,13 +309,13 @@ class ProfileListItem extends Widget function linkAttributes() { return array('href' => $this->profile->profileurl, - 'class' => 'url entry-title', + 'class' => 'u-url', 'rel' => 'contact'); } function homepageAttributes() { return array('href' => $this->profile->homepage, - 'class' => 'url'); + 'class' => 'u-url'); } }