]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/profilelist.php
Merge branch 'master' of gitorious.org:social/mainline
[quix0rs-gnu-social.git] / lib / profilelist.php
index 313cf760731e9a72a41e2ffe5966269a7d01bd96..767e12bc25a7dbc2360bd65d1bddd270fd919989 100644 (file)
@@ -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());
 
@@ -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');
     }
 }