X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FContent%2FWidget.php;h=fad863fbeb23b13075c93463bc30b8bc5b2a3597;hb=6749b2c887552feef3a671c4063425b11a92014a;hp=8fa09ee8a25cf63da6d2f3719a0b751c5dfef3fb;hpb=ae2959c7805ae458b125f33e34f650c1520b4ccf;p=friendica.git diff --git a/src/Content/Widget.php b/src/Content/Widget.php index 8fa09ee8a2..fad863fbeb 100644 --- a/src/Content/Widget.php +++ b/src/Content/Widget.php @@ -1,7 +1,24 @@ . + * */ + namespace Friendica\Content; use Friendica\Core\Addon; @@ -13,6 +30,7 @@ use Friendica\DI; use Friendica\Model\Contact; use Friendica\Model\FileTag; use Friendica\Model\GContact; +use Friendica\Model\Group; use Friendica\Model\Item; use Friendica\Model\Profile; use Friendica\Util\DateTimeFormat; @@ -82,7 +100,7 @@ class Widget public static function unavailableNetworks() { // Always hide content from these networks - $networks = ['face', 'apdn']; + $networks = [Protocol::PHANTOM, Protocol::FACEBOOK, Protocol::APPNET]; if (!Addon::isEnabled("discourse")) { $networks[] = Protocol::DISCOURSE; @@ -175,7 +193,39 @@ class Widget } /** - * Return networks widget + * Return group membership widget + * + * @param string $baseurl + * @param string $selected + * @return string + * @throws \Exception + */ + public static function groups($baseurl, $selected = '') + { + if (!local_user()) { + return ''; + } + + $options = array_map(function ($group) { + return [ + 'ref' => $group['id'], + 'name' => $group['name'] + ]; + }, Group::getByUserId(local_user())); + + return self::filter( + 'group', + DI::l10n()->t('Groups'), + '', + DI::l10n()->t('Everyone'), + $baseurl, + $options, + $selected + ); + } + + /** + * Return contact relationship widget * * @param string $baseurl baseurl * @param string $selected optional, default empty @@ -219,10 +269,6 @@ class Widget return ''; } - if (!Feature::isEnabled(local_user(), 'networks')) { - return ''; - } - $extra_sql = self::unavailableNetworks(); $r = DBA::p("SELECT DISTINCT(`network`) FROM `contact` WHERE `uid` = ? AND NOT `deleted` AND `network` != '' $extra_sql ORDER BY `network`", @@ -425,7 +471,7 @@ class Widget } if (Feature::isEnabled($uid, 'tagadelic')) { - $owner_id = Contact::getIdForURL($a->profile['url'], 0, true); + $owner_id = Contact::getIdForURL($a->profile['url'], 0, false); if (!$owner_id) { return ''; @@ -447,10 +493,6 @@ class Widget { $o = ''; - if (!Feature::isEnabled($uid, 'archives')) { - return $o; - } - $visible_years = DI::pConfig()->get($uid, 'system', 'archive_visible_years', 5); /* arrange the list in years */