]> git.mxchange.org Git - friendica.git/blobdiff - src/Content/Widget.php
Merge pull request #8036 from nupplaphil/task/redundant_system_call
[friendica.git] / src / Content / Widget.php
index 09a5fc6345b75bbe01e25ff10b30ec195935a126..f1f8f25fa34921d018123fb88e05861a2ad60226 100644 (file)
@@ -10,9 +10,9 @@ use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
 use Friendica\Core\Protocol;
 use Friendica\Core\Renderer;
-use Friendica\Core\System;
 use Friendica\Core\Session;
 use Friendica\Database\DBA;
+use Friendica\DI;
 use Friendica\Model\Contact;
 use Friendica\Model\FileTag;
 use Friendica\Model\GContact;
@@ -22,7 +22,6 @@ use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Proxy as ProxyUtils;
 use Friendica\Util\Strings;
 use Friendica\Util\Temporal;
-use Friendica\Util\XML;
 
 class Widget
 {
@@ -49,13 +48,12 @@ class Widget
         */
        public static function findPeople()
        {
-               $a = \get_app();
                $global_dir = Config::get('system', 'directory');
 
                if (Config::get('system', 'invitation_only')) {
                        $x = intval(PConfig::get(local_user(), 'system', 'invites_remaining'));
                        if ($x || is_site_admin()) {
-                               $a->page['aside'] .= '<div class="side-link widget" id="side-invite-remain">'
+                               DI::page()['aside'] .= '<div class="side-link widget" id="side-invite-remain">'
                                        . L10n::tt('%d invitation available', '%d invitations available', $x)
                                        . '</div>';
                        }
@@ -89,6 +87,10 @@ class Widget
                // Always hide content from these networks
                $networks = ['face', 'apdn'];
 
+               if (!Addon::isEnabled("discourse")) {
+                       $networks[] = Protocol::DISCOURSE;
+               }
+
                if (!Addon::isEnabled("statusnet")) {
                        $networks[] = Protocol::STATUSNET;
                }
@@ -274,6 +276,10 @@ class Widget
                foreach (FileTag::fileToArray($saved) as $savedFolderName) {
                        $terms[] = ['ref' => $savedFolderName, 'name' => $savedFolderName];
                }
+               
+               usort($terms, function ($a, $b) {
+                       return strcmp($a['name'], $b['name']);
+               });
 
                return self::filter(
                        'file',
@@ -394,7 +400,7 @@ class Widget
                $tpl = Renderer::getMarkupTemplate('widget/remote_friends_common.tpl');
                return Renderer::replaceMacros($tpl, [
                        '$desc'     => L10n::tt("%d contact in common", "%d contacts in common", $t),
-                       '$base'     => System::baseUrl(),
+                       '$base'     => DI::baseUrl(),
                        '$uid'      => $profile_uid,
                        '$cid'      => (($cid) ? $cid : '0'),
                        '$linkmore' => (($t > 5) ? 'true' : ''),