]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
More listitems and lists into separate files + stronger typing
authorMikael Nordfeldth <mmn@hethane.se>
Wed, 6 Jan 2016 00:36:46 +0000 (01:36 +0100)
committerMikael Nordfeldth <mmn@hethane.se>
Wed, 6 Jan 2016 00:36:46 +0000 (01:36 +0100)
actions/subscribers.php
lib/subscriberslist.php [new file with mode: 0644]
lib/subscriberslistitem.php [new file with mode: 0644]

index 2724927878c586d640c0a827317dd61e59993f3a..81ab70e21e87acd8079969a973c7637e65bebe97 100644 (file)
@@ -132,64 +132,3 @@ class SubscribersAction extends GalleryAction
         parent::showSections();
     }
 }
-
-class SubscribersList extends SubscriptionList
-{
-    function newListItem($profile)
-    {
-        return new SubscribersListItem($profile, $this->owner, $this->action);
-    }
-}
-
-class SubscribersListItem extends SubscriptionListItem
-{
-    function showActions()
-    {
-        $this->startActions();
-        if (Event::handle('StartProfileListItemActionElements', array($this))) {
-            $this->showSubscribeButton();
-            // Relevant code!
-            $this->showBlockForm();
-            Event::handle('EndProfileListItemActionElements', array($this));
-        }
-        $this->endActions();
-    }
-
-    function showBlockForm()
-    {
-        $user = common_current_user();
-
-        if (!empty($user) && $this->owner->id == $user->id) {
-            $returnto = array('action' => 'subscribers',
-                              'nickname' => $this->owner->getNickname());
-            $page = $this->out->arg('page');
-            if ($page) {
-                $returnto['param-page'] = $page;
-            }
-            $bf = new BlockForm($this->out, $this->profile, $returnto);
-            $bf->show();
-        }
-    }
-
-    function linkAttributes()
-    {
-        $aAttrs = parent::linkAttributes();
-
-        if (common_config('nofollow', 'subscribers')) {
-            $aAttrs['rel'] .= ' nofollow';
-        }
-
-        return $aAttrs;
-    }
-
-    function homepageAttributes()
-    {
-        $aAttrs = parent::linkAttributes();
-
-        if (common_config('nofollow', 'subscribers')) {
-            $aAttrs['rel'] = 'nofollow';
-        }
-
-        return $aAttrs;
-    }
-}
diff --git a/lib/subscriberslist.php b/lib/subscriberslist.php
new file mode 100644 (file)
index 0000000..420456f
--- /dev/null
@@ -0,0 +1,11 @@
+<?php
+
+if (!defined('GNUSOCIAL')) { exit(1); }
+
+class SubscribersList extends SubscriptionList 
+{ 
+    function newListItem(Profile $profile) 
+    { 
+        return new SubscribersListItem($profile, $this->owner, $this->action); 
+    } 
+}
diff --git a/lib/subscriberslistitem.php b/lib/subscriberslistitem.php
new file mode 100644 (file)
index 0000000..556a352
--- /dev/null
@@ -0,0 +1,56 @@
+<?php
+
+if (!defined('GNUSOCIAL')) { exit(1); }
+
+class SubscribersListItem extends SubscriptionListItem
+{
+    function showActions()
+    {
+        $this->startActions();
+        if (Event::handle('StartProfileListItemActionElements', array($this))) {
+            $this->showSubscribeButton();
+            // Relevant code!
+            $this->showBlockForm();
+            Event::handle('EndProfileListItemActionElements', array($this));
+        }
+        $this->endActions();
+    }
+
+    function showBlockForm()
+    {
+        $user = common_current_user();
+
+        if (!empty($user) && $this->owner->id == $user->id) {
+            $returnto = array('action' => 'subscribers',
+                              'nickname' => $this->owner->getNickname());
+            $page = $this->out->arg('page');
+            if ($page) {
+                $returnto['param-page'] = $page;
+            }
+            $bf = new BlockForm($this->out, $this->profile, $returnto);
+            $bf->show();
+        }
+    }
+
+    function linkAttributes()
+    {
+        $aAttrs = parent::linkAttributes();
+
+        if (common_config('nofollow', 'subscribers')) {
+            $aAttrs['rel'] .= ' nofollow';
+        }
+
+        return $aAttrs;
+    }
+
+    function homepageAttributes()
+    {
+        $aAttrs = parent::linkAttributes();
+
+        if (common_config('nofollow', 'subscribers')) {
+            $aAttrs['rel'] = 'nofollow';
+        }
+
+        return $aAttrs;
+    }
+}