X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FContent%2FWidget.php;h=b9a75e4d2d8c5c1546f246175d55ff3b59171cb5;hb=ddd2c72be8e7245389f97d74dd847f5a20410936;hp=6b44a62eb7dbe9bb6cbdae91665e57c11b3e8f49;hpb=3e3f48e5ec2f265035692ccc4ae355c86421bab5;p=friendica.git diff --git a/src/Content/Widget.php b/src/Content/Widget.php index 6b44a62eb7..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, @@ -517,6 +513,7 @@ class Widget '$showmore' => DI::l10n()->t('show more'), '$onthisdate' => DI::l10n()->t('On this date'), '$thisday' => $thisday, + '$nextday' => $nextday, '$cutoffday' => $cutoffday ]); @@ -540,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 + ); } }