X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FContent%2FWidget.php;h=c18a3041b0568c799a35d10c15954e66a7e1b84d;hb=353be860b700784a0b3ccf9284a22482b90b8ddf;hp=b198d54cf143f7d8dc851033b7c7557d14b76367;hpb=a7fd9e3223ce95dc508c40353b4019b886f42902;p=friendica.git diff --git a/src/Content/Widget.php b/src/Content/Widget.php index b198d54cf1..c18a3041b0 100644 --- a/src/Content/Widget.php +++ b/src/Content/Widget.php @@ -29,7 +29,7 @@ use Friendica\Core\Search; use Friendica\Database\DBA; use Friendica\DI; use Friendica\Model\Contact; -use Friendica\Model\Group; +use Friendica\Model\Circle; use Friendica\Model\Item; use Friendica\Model\Post; use Friendica\Model\Profile; @@ -120,6 +120,10 @@ class Widget $networks[] = Protocol::TWITTER; } + if (!Addon::isEnabled("tumblr")) { + $networks[] = Protocol::TUMBLR; + } + if (DI::config()->get("system", "ostatus_disabled")) { $networks[] = Protocol::OSTATUS; } @@ -174,6 +178,10 @@ class Widget $baseUrl = trim($baseUrl, '?') . '?'; } + array_walk($options, function (&$value) { + $value['ref'] = rawurlencode($value['ref']); + }); + return Renderer::replaceMacros(Renderer::getMarkupTemplate('widget/filter.tpl'), [ '$type' => $type, '$title' => $title, @@ -186,29 +194,29 @@ class Widget } /** - * Return group membership widget + * Return circle membership widget * * @param string $baseurl * @param string $selected * @return string * @throws \Exception */ - public static function groups(string $baseurl, string $selected = ''): string + public static function circles(string $baseurl, string $selected = ''): string { if (!DI::userSession()->getLocalUserId()) { return ''; } - $options = array_map(function ($group) { + $options = array_map(function ($circle) { return [ - 'ref' => $group['id'], - 'name' => $group['name'] + 'ref' => $circle['id'], + 'name' => $circle['name'] ]; - }, Group::getByUserId(DI::userSession()->getLocalUserId())); + }, Circle::getByUserId(DI::userSession()->getLocalUserId())); return self::filter( - 'group', - DI::l10n()->t('Groups'), + 'circle', + DI::l10n()->t('Circles'), '', DI::l10n()->t('Everyone'), $baseurl, @@ -235,6 +243,7 @@ class Widget ['ref' => 'followers', 'name' => DI::l10n()->t('Followers')], ['ref' => 'following', 'name' => DI::l10n()->t('Following')], ['ref' => 'mutuals', 'name' => DI::l10n()->t('Mutual friends')], + ['ref' => 'nothing', 'name' => DI::l10n()->t('No relationship')], ]; return self::filter( @@ -461,8 +470,13 @@ class Widget if ($dthen) { // 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'; + /* * Starting with the current month, get the first and last days of every @@ -482,6 +496,7 @@ class Widget $ret[$dyear][] = [$str, $end_month, $start_month]; $dnow = DateTimeFormat::utc($dnow . ' -1 month', 'Y-m-d'); + } } @@ -501,7 +516,11 @@ class Widget '$url' => $url, '$dates' => $ret, '$showless' => DI::l10n()->t('show less'), - '$showmore' => DI::l10n()->t('show more') + '$showmore' => DI::l10n()->t('show more'), + '$onthisdate' => DI::l10n()->t('On this date'), + '$thisday' => $thisday, + '$nextday' => $nextday, + '$cutoffday' => $cutoffday ]); return $o; @@ -521,7 +540,7 @@ class Widget ['ref' => 'person', 'name' => DI::l10n()->t('Persons')], ['ref' => 'organisation', 'name' => DI::l10n()->t('Organisations')], ['ref' => 'news', 'name' => DI::l10n()->t('News')], - ['ref' => 'community', 'name' => DI::l10n()->t('Forums')], + ['ref' => 'community', 'name' => DI::l10n()->t('Groups')], ]; return self::filter('accounttype', DI::l10n()->t('Account Types'), '',