]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/Directory/lib/sortablegrouplist.php
Merge remote-tracking branch 'upstream/master'
[quix0rs-gnu-social.git] / plugins / Directory / lib / sortablegrouplist.php
index 756b078416f87ee40e2e03f40ffe6a137f0e7046..6eca138fb907c082f4dfd5210623c484f9dc8394 100644 (file)
  * @link      http://status.net/
  */
 
-if (!defined('STATUSNET')) {
-    exit(1);
-}
-
-require_once INSTALLDIR . '/lib/subscriptionlist.php';
+if (!defined('GNUSOCIAL')) { exit(1); }
 
 /**
  * Widget to show a sortable list of subscriptions
@@ -44,16 +40,6 @@ require_once INSTALLDIR . '/lib/subscriptionlist.php';
  */
 class SortableGroupList extends SortableSubscriptionList
 {
-    /** Owner of this list */
-    var $owner = null;
-
-    function __construct($profile, $owner=null, $action=null)
-    {
-        parent::__construct($profile, $owner, $action);
-
-        $this->owner = $owner;
-    }
-
     function startList()
     {
         $this->out->elementStart('table', array('class' => 'profile_list xoxo'));
@@ -119,49 +105,30 @@ class SortableGroupList extends SortableSubscriptionList
         $this->out->elementStart('tbody');
     }
 
-    function newListItem(Profile $profile, $odd)
+    function newListItem(Profile $profile)
     {
-        return new SortableGroupListItem($profile, $this->owner, $this->action, $odd);
+        return new SortableGroupListItem($profile, $this->owner, $this->action);
     }
 }
 
 class SortableGroupListItem extends SortableSubscriptionListItem
 {
-    /** Owner of this list */
-    var $owner = null;
-
-    function __construct($profile, $owner, $action, $alt)
-    {
-        parent::__construct($profile, $owner, $action, $alt);
-
-        $this->alt   = $alt; // is this row alternate?
-        $this->owner = $owner;
-    }
-
     function showHomepage()
     {
-        if (!empty($this->profile->homepage)) {
+        if ($this->profile->getHomepage()) {
             $this->out->text(' ');
             $aAttrs = $this->homepageAttributes();
             $this->out->elementStart('a', $aAttrs);
-            $this->out->raw($this->highlight($this->profile->homepage));
+            $this->out->text($this->profile->getHomepage());
             $this->out->elementEnd('a');
         }
     }
 
     function showDescription()
     {
-        if (!empty($this->profile->description)) {
-            $cutoff      = 140; // XXX Should this be configurable?
-            $description = htmlspecialchars($this->profile->description);
-
-            if (mb_strlen($description) > $cutoff) {
-                $description = mb_substr($description, 0, $cutoff - 1)
-                    .'<a href="' . $this->profile->homeUrl() .'">…</a>';
-            }
-
+        if ($this->profile->getDescription()) {
             $this->out->elementStart('p', 'note');
-            $this->out->raw($description);
+            $this->out->text($this->profile->getDescription());
             $this->out->elementEnd('p');
         }
 
@@ -206,8 +173,8 @@ class SortableGroupListItem extends SortableSubscriptionListItem
     {
         $this->startProfile();
 
-        $this->showAvatar($this->profile->getProfile());
-        $this->out->element('a', array('href'  => $this->profile->homeUrl(),
+        $this->showAvatar($this->profile);
+        $this->out->element('a', array('href'  => $this->profile->getUrl(),
                                             'class' => 'p-org p-nickname',
                                             'rel'   => 'contact group'),
                                  $this->profile->getNickname());
@@ -229,7 +196,7 @@ class SortableGroupListItem extends SortableSubscriptionListItem
         $r2args['action'] = $action;
         if ($cur instanceof User && $cur->hasRight(Right::DELETEGROUP)) {
             $this->out->elementStart('li', 'entity_delete');
-            $df = new DeleteGroupForm($this->out, $this->profile, $r2args);
+            $df = new DeleteGroupForm($this->out, $this->profile->getGroup(), $r2args);
             $df->show();
             $this->out->elementEnd('li');
         }
@@ -256,11 +223,11 @@ class SortableGroupListItem extends SortableSubscriptionListItem
             $this->out->elementStart('li', 'entity_subscribe');
             // XXX: special-case for user looking at own
             // subscriptions page
-            if ($user->isMember($this->profile)) {
-                $lf = new LeaveForm($this->out, $this->profile);
+            if ($user->isMember($this->profile->getGroup())) {
+                $lf = new LeaveForm($this->out, $this->profile->getGroup());
                 $lf->show();
-            } else if (!Group_block::isBlocked($this->profile, $user->getProfile())) {
-                $jf = new JoinForm($this->out, $this->profile);
+            } else if (!Group_block::isBlocked($this->profile->getGroup(), $user->getProfile())) {
+                $jf = new JoinForm($this->out, $this->profile->getGroup());
                 $jf->show();
             }
 
@@ -271,7 +238,7 @@ class SortableGroupListItem extends SortableSubscriptionListItem
     function showMemberCount()
     {
         $this->out->elementStart('td', 'entry_member_count');
-        $this->out->raw($this->profile->getMemberCount());
+        $this->out->text($this->profile->getGroup()->getMemberCount());
         $this->out->elementEnd('td');
     }
 
@@ -279,7 +246,7 @@ class SortableGroupListItem extends SortableSubscriptionListItem
     {
         $this->out->elementStart('td', 'entry_created');
         // @todo FIXME: Should we provide i18n for timestamps in core?
-        $this->out->raw(date('j M Y', strtotime($this->profile->created)));
+        $this->out->text(date('j M Y', strtotime($this->profile->created)));
         $this->out->elementEnd('td');
     }
 
@@ -287,7 +254,7 @@ class SortableGroupListItem extends SortableSubscriptionListItem
     {
         $this->out->elementStart('td', 'entry_admins');
         // @todo
-        $this->out->raw('gargargar');
+        $this->out->text('gargargar');
         $this->out->elementEnd('td');
     }