]> git.mxchange.org Git - friendica.git/blobdiff - src/Content/Widget.php
Fix code standards
[friendica.git] / src / Content / Widget.php
index f0236c00c1de637c6c6f80b6c556bec44edc6605..1f73f0449591d1fc8746e4b662dfcf2e1965a705 100644 (file)
@@ -102,7 +102,7 @@ class Widget
        public static function unavailableNetworks(): array
        {
                // Always hide content from these networks
-               $networks = [Protocol::PHANTOM, Protocol::FACEBOOK, Protocol::APPNET, Protocol::ZOT];
+               $networks = [Protocol::PHANTOM, Protocol::FACEBOOK, Protocol::APPNET, Protocol::TWITTER, Protocol::ZOT];
 
                if (!Addon::isEnabled("discourse")) {
                        $networks[] = Protocol::DISCOURSE;
@@ -116,10 +116,6 @@ class Widget
                        $networks[] = Protocol::PUMPIO;
                }
 
-               if (!Addon::isEnabled("twitter")) {
-                       $networks[] = Protocol::TWITTER;
-               }
-
                if (!Addon::isEnabled("tumblr")) {
                        $networks[] = Protocol::TUMBLR;
                }
@@ -472,6 +468,8 @@ class Widget
                        // Set the start and end date to the beginning of the month
                        $cutoffday = $dthen;
                        $thisday = substr($dnow, 4);
+                       $nextday = date('Y-m-d', strtotime($dnow . ' + 1 day'));
+                       $nextday = substr($nextday, 4);
                        $dnow = substr($dnow, 0, 8) . '01';
                        $dthen = substr($dthen, 0, 8) . '01';
 
@@ -515,6 +513,7 @@ class Widget
                        '$showmore' => DI::l10n()->t('show more'),
                        '$onthisdate' => DI::l10n()->t('On this date'),
                        '$thisday' => $thisday,
+                       '$nextday' => $nextday,
                        '$cutoffday' => $cutoffday
                ]);
 
@@ -548,4 +547,35 @@ class Widget
                        $accounttype
                );
        }
+
+       /**
+        * Get a list of all channels
+        *
+        * @param string $base
+        * @param string $channelname
+        * @param integer $uid
+        * @return string
+        */
+       public static function channels(string $base, string $channelname, int $uid): string
+       {
+               $channels = [];
+
+               foreach (DI::TimelineFactory()->getChannelsForUser($uid) as $channel) {
+                       $channels[] = ['ref' => $channel->code, 'name' => $channel->label];
+               }
+
+               foreach (DI::TimelineFactory()->getCommunities(true) as $community) {
+                       $channels[] = ['ref' => $community->code, 'name' => $community->label];
+               }
+
+               return self::filter(
+                       'channel',
+                       DI::l10n()->t('Channels'),
+                       '',
+                       '',
+                       $base,
+                       $channels,
+                       $channelname
+               );
+       }
 }