]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Profile/Peopletag file splitting for autoload
authorMikael Nordfeldth <mmn@hethane.se>
Sun, 27 Sep 2015 20:51:11 +0000 (22:51 +0200)
committerMikael Nordfeldth <mmn@hethane.se>
Sun, 27 Sep 2015 20:51:50 +0000 (22:51 +0200)
actions/showprofiletag.php
lib/framework.php
lib/peopletag.php [new file with mode: 0644]
lib/peopletaglist.php
lib/peopletaglistitem.php [new file with mode: 0644]

index 6ba0c18f90fdb65d3ad6b6cd1b1483402b626913..09085ebf1a88e89a56028e8747a22700ef51af24 100644 (file)
  * @link     http://status.net
  */
 
-if (!defined('STATUSNET') && !defined('LACONICA')) {
-    exit(1);
-}
-
-require_once INSTALLDIR.'/lib/profileminilist.php';
-require_once INSTALLDIR.'/lib/peopletaglist.php';
-require_once INSTALLDIR.'/lib/noticelist.php';
-require_once INSTALLDIR.'/lib/feedlist.php';
+if (!defined('GNUSOCIAL')) { exit(1); }
 
 class ShowprofiletagAction extends Action
 {
@@ -356,20 +349,3 @@ class ShowprofiletagAction extends Action
         $this->elementEnd('div');
     }
 }
-
-class Peopletag extends PeopletagListItem
-{
-    protected $avatarSize = AVATAR_PROFILE_SIZE;
-
-    function showStart()
-    {
-        $mode = $this->peopletag->private ? 'private' : 'public';
-        $this->out->elementStart('div', array('class' => 'h-entry peopletag peopletag-profile mode-'.$mode,
-                                             'id' => 'peopletag-' . $this->peopletag->id));
-    }
-
-    function showEnd()
-    {
-        $this->out->elementEnd('div');
-    }
-}
index d749d23bdff32c8e3144ffb4322f7ebd232dc3c2..954e29597fd0c244f298da2acd6be583806a0857 100644 (file)
@@ -38,6 +38,7 @@ define('PROFILES_PER_PAGE', 20);
 define('MESSAGES_PER_PAGE', 20);
 define('GROUPS_PER_PAGE', 20);
 define('APPS_PER_PAGE', 20);
+define('PEOPLETAGS_PER_PAGE', 20);
 
 define('GROUPS_PER_MINILIST', 8);
 define('PROFILES_PER_MINILIST', 8);
diff --git a/lib/peopletag.php b/lib/peopletag.php
new file mode 100644 (file)
index 0000000..4440beb
--- /dev/null
@@ -0,0 +1,20 @@
+<?php
+
+if (!defined('GNUSOCIAL')) { exit(1); }
+
+class Peopletag extends PeopletagListItem
+{
+    protected $avatarSize = AVATAR_PROFILE_SIZE;
+
+    function showStart()
+    {
+        $mode = $this->peopletag->private ? 'private' : 'public';
+        $this->out->elementStart('div', array('class' => 'h-entry peopletag peopletag-profile mode-'.$mode,
+                                             'id' => 'peopletag-' . $this->peopletag->id));
+    }
+
+    function showEnd()
+    {
+        $this->out->elementEnd('div');
+    }
+}
index b2f2dcca463753c2766de08dda9834505b81e911..3040d41d0a790e279834dd90adbb430f73a223c7 100644 (file)
  * @link      http://status.net/
  */
 
-if (!defined('STATUSNET') && !defined('LACONICA')) {
-    exit(1);
-}
-
-require_once INSTALLDIR.'/lib/widget.php';
-
-define('PEOPLETAGS_PER_PAGE', 20);
+if (!defined('GNUSOCIAL')) { exit(1); }
 
 /**
  * Widget to show a list of peopletags
@@ -88,201 +82,3 @@ class PeopletagList extends Widget
         $ptag->show();
     }
 }
-
-class PeopletagListItem extends Widget
-{
-    var $peopletag = null;
-    var $current = null;
-    var $profile = null;
-
-    /**
-     * constructor
-     *
-     * Also initializes the owner attribute.
-     *
-     * @param Notice $notice The notice we'll display
-     */
-    function __construct($peopletag, $current, $out=null)
-    {
-        parent::__construct($out);
-        $this->peopletag  = $peopletag;
-        $this->current = $current;
-        $this->profile = Profile::getKV('id', $this->peopletag->tagger);
-    }
-
-    /**
-     * recipe function for displaying a single peopletag.
-     *
-     * This uses all the other methods to correctly display a notice. Override
-     * it or one of the others to fine-tune the output.
-     *
-     * @return void
-     */
-    function url()
-    {
-        return $this->peopletag->homeUrl();
-    }
-
-    function show()
-    {
-        if (empty($this->peopletag)) {
-            common_log(LOG_WARNING, "Trying to show missing peopletag; skipping.");
-            return;
-        }
-
-        if (Event::handle('StartShowPeopletagItem', array($this))) {
-            $this->showStart();
-            $this->showPeopletag();
-            $this->showStats();
-            $this->showEnd();
-            Event::handle('EndShowPeopletagItem', array($this));
-        }
-    }
-
-    function showStart()
-    {
-        $mode = ($this->peopletag->private) ? 'private' : 'public';
-        $this->out->elementStart('li', array('class' => 'h-entry peopletag mode-' . $mode,
-                                             'id' => 'peopletag-' . $this->peopletag->id));
-    }
-
-    function showEnd()
-    {
-        $this->out->elementEnd('li');
-    }
-
-    function showPeopletag()
-    {
-        $this->showCreator();
-        $this->showTag();
-        $this->showPrivacy();
-        $this->showUpdated();
-        $this->showActions();
-        $this->showDescription();
-    }
-
-    function showStats()
-    {
-        $this->out->elementStart('div', 'entry-summary entity_statistics');
-        $this->out->elementStart('span', 'tagged-count');
-        $this->out->element('a',
-            array('href' => common_local_url('peopletagged',
-                                              array('tagger' => $this->profile->nickname,
-                                                    'tag' => $this->peopletag->tag))),
-            // TRANS: Link description for link to list of users tagged with a tag (so part of a list).
-            _('Listed'));
-        $this->out->raw($this->peopletag->taggedCount());
-        $this->out->elementEnd('span');
-
-        $this->out->elementStart('span', 'subscriber-count');
-        $this->out->element('a',
-            array('href' => common_local_url('peopletagsubscribers',
-                                              array('tagger' => $this->profile->nickname,
-                                                    'tag' => $this->peopletag->tag))),
-            // TRANS: Link description for link to list of users subscribed to a tag.
-            _('Subscribers'));
-        $this->out->raw($this->peopletag->subscriberCount());
-        $this->out->elementEnd('span');
-        $this->out->elementEnd('div');
-    }
-
-    function showOwnerOptions()
-    {
-        $this->out->elementStart('li', 'entity_edit');
-        $this->out->element('a', array('href' =>
-                    common_local_url('editpeopletag', array('tagger' => $this->profile->nickname,
-                                                    'tag' => $this->peopletag->tag)),
-                                  // TRANS: Title for link to edit list settings.
-                                  'title' => _('Edit list settings.')),
-                       // TRANS: Text for link to edit list settings.
-                       _('Edit'));
-        $this->out->elementEnd('li');
-    }
-
-    function showSubscribeForm()
-    {
-        $this->out->elementStart('li');
-
-        if (Event::handle('StartSubscribePeopletagForm', array($this->out, $this->peopletag))) {
-            if ($this->current) {
-                if ($this->peopletag->hasSubscriber($this->current->id)) {
-                    $form = new UnsubscribePeopletagForm($this->out, $this->peopletag);
-                    $form->show();
-                } else {
-                    $form = new SubscribePeopletagForm($this->out, $this->peopletag);
-                    $form->show();
-                }
-            }
-            Event::handle('EndSubscribePeopletagForm', array($this->out, $this->peopletag));
-        }
-
-        $this->out->elementEnd('li');
-    }
-
-    function showCreator()
-    {
-        $attrs = array();
-        $attrs['href'] = $this->profile->profileurl;
-        $attrs['class'] = 'h-card p-author nickname p-name';
-        $attrs['rel'] = 'contact';
-        $attrs['title'] = $this->profile->getFancyName();
-
-        $this->out->elementStart('a', $attrs);
-        $this->showAvatar($this->profile);
-        $this->out->text($this->profile->getNickname());
-        $this->out->elementEnd('a');
-    }
-
-    function showUpdated()
-    {
-        if (!empty($this->peopletag->modified)) {
-            $this->out->element('abbr',
-                array('title' => common_date_w3dtf($this->peopletag->modified),
-                      'class' => 'updated'),
-                common_date_string($this->peopletag->modified));
-        }
-    }
-
-    function showPrivacy()
-    {
-        if ($this->peopletag->private) {
-            $this->out->elementStart('a',
-                array('href' => common_local_url('peopletagsbyuser',
-                    array('nickname' => $this->profile->nickname, 'private' => 1))));
-            // TRANS: Privacy mode text in list list item for private list.
-            $this->out->element('span', 'privacy_mode', _m('MODE','Private'));
-            $this->out->elementEnd('a');
-        }
-    }
-
-    function showTag()
-    {
-        $this->out->elementStart('span', 'entry-title tag');
-        $this->out->element('a',
-            array('rel'   => 'bookmark',
-                  'href'  => $this->url()),
-            htmlspecialchars($this->peopletag->tag));
-        $this->out->elementEnd('span');
-    }
-
-    function showActions()
-    {
-        $this->out->elementStart('div', 'entity_actions');
-        $this->out->elementStart('ul');
-
-        if (!$this->peopletag->private) {
-            $this->showSubscribeForm();
-        }
-
-        if (!empty($this->current) && $this->profile->id == $this->current->id) {
-            $this->showOwnerOptions();
-        }
-        $this->out->elementEnd('ul');
-        $this->out->elementEnd('div');
-    }
-
-    function showDescription()
-    {
-        $this->out->element('div', 'e-content description', $this->peopletag->description);
-    }
-}
diff --git a/lib/peopletaglistitem.php b/lib/peopletaglistitem.php
new file mode 100644 (file)
index 0000000..75ce606
--- /dev/null
@@ -0,0 +1,228 @@
+<?php
+/**
+ * StatusNet, the distributed open-source microblogging tool
+ *
+ * Widget to show a list of peopletags
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Public
+ * @package   StatusNet
+ * @author    Shashi Gowda <connect2shashi@gmail.com>
+ * @copyright 2008-2009 StatusNet, Inc.
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link      http://status.net/
+ */
+
+if (!defined('GNUSOCIAL')) { exit(1); }
+
+class PeopletagListItem extends Widget
+{
+    var $peopletag = null;
+    var $current = null;
+    var $profile = null;
+
+    /**
+     * constructor
+     *
+     * Also initializes the owner attribute.
+     *
+     * @param Notice $notice The notice we'll display
+     */
+    function __construct($peopletag, $current, $out=null)
+    {
+        parent::__construct($out);
+        $this->peopletag  = $peopletag;
+        $this->current = $current;
+        $this->profile = Profile::getKV('id', $this->peopletag->tagger);
+    }
+
+    /**
+     * recipe function for displaying a single peopletag.
+     *
+     * This uses all the other methods to correctly display a notice. Override
+     * it or one of the others to fine-tune the output.
+     *
+     * @return void
+     */
+    function url()
+    {
+        return $this->peopletag->homeUrl();
+    }
+
+    function show()
+    {
+        if (empty($this->peopletag)) {
+            common_log(LOG_WARNING, "Trying to show missing peopletag; skipping.");
+            return;
+        }
+
+        if (Event::handle('StartShowPeopletagItem', array($this))) {
+            $this->showStart();
+            $this->showPeopletag();
+            $this->showStats();
+            $this->showEnd();
+            Event::handle('EndShowPeopletagItem', array($this));
+        }
+    }
+
+    function showStart()
+    {
+        $mode = ($this->peopletag->private) ? 'private' : 'public';
+        $this->out->elementStart('li', array('class' => 'h-entry peopletag mode-' . $mode,
+                                             'id' => 'peopletag-' . $this->peopletag->id));
+    }
+
+    function showEnd()
+    {
+        $this->out->elementEnd('li');
+    }
+
+    function showPeopletag()
+    {
+        $this->showCreator();
+        $this->showTag();
+        $this->showPrivacy();
+        $this->showUpdated();
+        $this->showActions();
+        $this->showDescription();
+    }
+
+    function showStats()
+    {
+        $this->out->elementStart('div', 'entry-summary entity_statistics');
+        $this->out->elementStart('span', 'tagged-count');
+        $this->out->element('a',
+            array('href' => common_local_url('peopletagged',
+                                              array('tagger' => $this->profile->nickname,
+                                                    'tag' => $this->peopletag->tag))),
+            // TRANS: Link description for link to list of users tagged with a tag (so part of a list).
+            _('Listed'));
+        $this->out->raw($this->peopletag->taggedCount());
+        $this->out->elementEnd('span');
+
+        $this->out->elementStart('span', 'subscriber-count');
+        $this->out->element('a',
+            array('href' => common_local_url('peopletagsubscribers',
+                                              array('tagger' => $this->profile->nickname,
+                                                    'tag' => $this->peopletag->tag))),
+            // TRANS: Link description for link to list of users subscribed to a tag.
+            _('Subscribers'));
+        $this->out->raw($this->peopletag->subscriberCount());
+        $this->out->elementEnd('span');
+        $this->out->elementEnd('div');
+    }
+
+    function showOwnerOptions()
+    {
+        $this->out->elementStart('li', 'entity_edit');
+        $this->out->element('a', array('href' =>
+                    common_local_url('editpeopletag', array('tagger' => $this->profile->nickname,
+                                                    'tag' => $this->peopletag->tag)),
+                                  // TRANS: Title for link to edit list settings.
+                                  'title' => _('Edit list settings.')),
+                       // TRANS: Text for link to edit list settings.
+                       _('Edit'));
+        $this->out->elementEnd('li');
+    }
+
+    function showSubscribeForm()
+    {
+        $this->out->elementStart('li');
+
+        if (Event::handle('StartSubscribePeopletagForm', array($this->out, $this->peopletag))) {
+            if ($this->current) {
+                if ($this->peopletag->hasSubscriber($this->current->id)) {
+                    $form = new UnsubscribePeopletagForm($this->out, $this->peopletag);
+                    $form->show();
+                } else {
+                    $form = new SubscribePeopletagForm($this->out, $this->peopletag);
+                    $form->show();
+                }
+            }
+            Event::handle('EndSubscribePeopletagForm', array($this->out, $this->peopletag));
+        }
+
+        $this->out->elementEnd('li');
+    }
+
+    function showCreator()
+    {
+        $attrs = array();
+        $attrs['href'] = $this->profile->profileurl;
+        $attrs['class'] = 'h-card p-author nickname p-name';
+        $attrs['rel'] = 'contact';
+        $attrs['title'] = $this->profile->getFancyName();
+
+        $this->out->elementStart('a', $attrs);
+        $this->showAvatar($this->profile);
+        $this->out->text($this->profile->getNickname());
+        $this->out->elementEnd('a');
+    }
+
+    function showUpdated()
+    {
+        if (!empty($this->peopletag->modified)) {
+            $this->out->element('abbr',
+                array('title' => common_date_w3dtf($this->peopletag->modified),
+                      'class' => 'updated'),
+                common_date_string($this->peopletag->modified));
+        }
+    }
+
+    function showPrivacy()
+    {
+        if ($this->peopletag->private) {
+            $this->out->elementStart('a',
+                array('href' => common_local_url('peopletagsbyuser',
+                    array('nickname' => $this->profile->nickname, 'private' => 1))));
+            // TRANS: Privacy mode text in list list item for private list.
+            $this->out->element('span', 'privacy_mode', _m('MODE','Private'));
+            $this->out->elementEnd('a');
+        }
+    }
+
+    function showTag()
+    {
+        $this->out->elementStart('span', 'entry-title tag');
+        $this->out->element('a',
+            array('rel'   => 'bookmark',
+                  'href'  => $this->url()),
+            htmlspecialchars($this->peopletag->tag));
+        $this->out->elementEnd('span');
+    }
+
+    function showActions()
+    {
+        $this->out->elementStart('div', 'entity_actions');
+        $this->out->elementStart('ul');
+
+        if (!$this->peopletag->private) {
+            $this->showSubscribeForm();
+        }
+
+        if (!empty($this->current) && $this->profile->id == $this->current->id) {
+            $this->showOwnerOptions();
+        }
+        $this->out->elementEnd('ul');
+        $this->out->elementEnd('div');
+    }
+
+    function showDescription()
+    {
+        $this->out->element('div', 'e-content description', $this->peopletag->description);
+    }
+}