X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FContent%2FWidget.php;h=b9a75e4d2d8c5c1546f246175d55ff3b59171cb5;hb=ddd2c72be8e7245389f97d74dd847f5a20410936;hp=c18a3041b0568c799a35d10c15954e66a7e1b84d;hpb=2632875bab6376cd4ae5361676596ef004b13e6a;p=friendica.git diff --git a/src/Content/Widget.php b/src/Content/Widget.php index c18a3041b0..b9a75e4d2d 100644 --- a/src/Content/Widget.php +++ b/src/Content/Widget.php @@ -1,6 +1,6 @@ DI::l10n()->t('Archives'), '$size' => $visible_years, '$cutoff_year' => $cutoff_year, @@ -543,7 +537,63 @@ class Widget ['ref' => 'community', 'name' => DI::l10n()->t('Groups')], ]; - return self::filter('accounttype', DI::l10n()->t('Account Types'), '', - DI::l10n()->t('All'), $base, $accounts, $accounttype); + return self::filter( + 'accounttype', + DI::l10n()->t('Account Types'), + '', + DI::l10n()->t('All'), + $base, + $accounts, + $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 = []; + + $enabled = DI::pConfig()->get($uid, 'system', 'enabled_timelines', []); + + foreach (DI::NetworkFactory()->getTimelines('') as $channel) { + if (empty($enabled) || in_array($channel->code, $enabled)) { + $channels[] = ['ref' => $channel->code, 'name' => $channel->label]; + } + } + + foreach (DI::ChannelFactory()->getTimelines($uid) as $channel) { + if (empty($enabled) || in_array($channel->code, $enabled)) { + $channels[] = ['ref' => $channel->code, 'name' => $channel->label]; + } + } + + foreach (DI::userDefinedChannel()->selectByUid($uid) as $channel) { + if (empty($enabled) || in_array($channel->code, $enabled)) { + $channels[] = ['ref' => $channel->code, 'name' => $channel->label]; + } + } + + foreach (DI::CommunityFactory()->getTimelines(true) as $community) { + if (empty($enabled) || in_array($community->code, $enabled)) { + $channels[] = ['ref' => $community->code, 'name' => $community->label]; + } + } + + return self::filter( + 'channel', + DI::l10n()->t('Channels'), + '', + '', + $base, + $channels, + $channelname + ); } }